android_kernel_xiaomi_sm8350/net/sunrpc
Cyrill Gorcunov 27df6f25ff sunrpc: fix possible overrun on read of /proc/sys/sunrpc/transports
Vegard Nossum reported
----------------------
> I noticed that something weird is going on with /proc/sys/sunrpc/transports.
> This file is generated in net/sunrpc/sysctl.c, function proc_do_xprt(). When
> I "cat" this file, I get the expected output:
>    $ cat /proc/sys/sunrpc/transports
>    tcp 1048576
>    udp 32768

> But I think that it does not check the length of the buffer supplied by
> userspace to read(). With my original program, I found that the stack was
> being overwritten by the characters above, even when the length given to
> read() was just 1.

David Wagner added (among other things) that copy_to_user could be
probably used here.

Ingo Oeser suggested to use simple_read_from_buffer() here.

The conclusion is that proc_do_xprt doesn't check for userside buffer
size indeed so fix this by using Ingo's suggestion.

Reported-by: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
CC: Ingo Oeser <ioe-lkml@rameria.de>
Cc: Neil Brown <neilb@suse.de>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Greg Banks <gnb@sgi.com>
Cc: Tom Tucker <tom@opengridcomputing.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2008-09-01 14:24:24 -04:00
..
auth_gss Merge branch 'for-2.6.27' of git://linux-nfs.org/~bfields/linux 2008-07-20 21:21:46 -07:00
xprtrdma svcrdma: Fix race between svc_rdma_recvfrom thread and the dto_tasklet 2008-08-13 16:57:31 -04:00
auth_generic.c SUNRPC: AUTH_SYS "machine creds" shouldn't use negative valued uid/gid 2008-05-18 14:18:27 -04:00
auth_null.c
auth_unix.c SUNRPC: Use GFP_NOFS when allocating credentials 2008-07-09 12:08:48 -04:00
auth.c
cache.c sunrpc: assign PDE->data before gluing PDE into /proc tree 2008-05-02 02:44:36 -07:00
clnt.c SUNRPC: Ensure our task is notified when an rpcbind call is done 2008-07-09 12:09:45 -04:00
Makefile
rpc_pipe.c SL*B: drop kmem cache argument from constructor 2008-07-26 12:00:07 -07:00
rpcb_clnt.c SUNRPC: Support registering IPv6 interfaces with local rpcbind daemon 2008-07-15 18:08:55 -04:00
sched.c SUNRPC: Remove the BKL from the callback functions 2008-07-15 18:10:57 -04:00
socklib.c
stats.c sunrpc: assign PDE->data before gluing PDE into /proc tree 2008-05-02 02:44:36 -07:00
sunrpc_syms.c
svc_xprt.c svc: Remove unused header files from svc_xprt.c 2008-05-19 07:33:42 -05:00
svc.c cpumask: change cpumask_of_cpu_ptr to use new cpumask_of_cpu 2008-07-26 16:40:33 +02:00
svcauth_unix.c svcrpc: fix proc/net/rpc/auth.unix.ip/content display 2008-05-18 19:13:07 -04:00
svcauth.c
svcsock.c SUNRPC: Update RPC server's TCP record marker decoder 2008-04-23 16:13:43 -04:00
sysctl.c sunrpc: fix possible overrun on read of /proc/sys/sunrpc/transports 2008-09-01 14:24:24 -04:00
timer.c
xdr.c
xprt.c SUNRPC: Ensure all transports set rq_xtime consistently 2008-07-09 12:09:15 -04:00
xprtsock.c SUNRPC: Ensure all transports set rq_xtime consistently 2008-07-09 12:09:15 -04:00