]> git.baikalelectronics.ru Git - kernel.git/commit
SUNRPC: handle malloc failure in ->request_prepare
authorNeilBrown <neilb@suse.de>
Wed, 30 Mar 2022 00:48:37 +0000 (11:48 +1100)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 30 Mar 2022 02:15:46 +0000 (22:15 -0400)
commitf6481550ed86a8165d6b3b631e4ed0abd26364fa
tree08d161fda19bae91adc563d9ee8e609b2a21a499
parent39aeb1f683493a4143f85d2b4b96821a49c9e6c2
SUNRPC: handle malloc failure in ->request_prepare

If ->request_prepare() detects an error, it sets ->rq_task->tk_status.
This is easy for callers to ignore.
The only caller is xprt_request_enqueue_receive() and it does ignore the
error, as does call_encode() which calls it.  This can result in a
request being queued to receive a reply without an allocated receive buffer.

So instead of setting rq_task->tk_status, return an error, and store in
->tk_status only in call_encode();

The call to xprt_request_enqueue_receive() is now earlier in
call_encode(), where the error can still be handled.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
include/linux/sunrpc/xprt.h
net/sunrpc/clnt.c
net/sunrpc/xprt.c
net/sunrpc/xprtsock.c