svcrpc: fix UDP on servers with lots of threads
authorJ. Bruce Fields <bfields@redhat.com>
Wed, 20 Feb 2019 17:54:50 +0000 (12:54 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 19:11:36 +0000 (20:11 +0100)
commitf03f5295caf0106820d1dac1fe0e019ee00f05dc
tree475f65c8c1ae8f0c1c4290a763d7caf899bde559
parent1363f37fbd241c8341816513dfd07b3d9ed3a4ba
svcrpc: fix UDP on servers with lots of threads

commit b7e5034cbecf5a65b7bfdc2b20a8378039577706 upstream.

James Pearson found that an NFS server stopped responding to UDP
requests if started with more than 1017 threads.

sv_max_mesg is about 2^20, so that is probably where the calculation
performed by

svc_sock_setbufsize(svsk->sk_sock,
                            (serv->sv_nrthreads+3) * serv->sv_max_mesg,
                            (serv->sv_nrthreads+3) * serv->sv_max_mesg);

starts to overflow an int.

Reported-by: James Pearson <jcpearson@gmail.com>
Tested-by: James Pearson <jcpearson@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/svcsock.c