summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2022-04-07 14:10:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-13 21:01:07 +0200
commitb3c00be2ff8bc7e211fb04ec42facf0e4c876800 (patch)
tree0c0e19be9b3b2b8ad4b4756aca62d02d7e18f73a
parent9a45e08636bba2949819cbf4d9ee0b974dd5c7a6 (diff)
downloadlinux-stable-b3c00be2ff8bc7e211fb04ec42facf0e4c876800.tar.gz
linux-stable-b3c00be2ff8bc7e211fb04ec42facf0e4c876800.tar.bz2
linux-stable-b3c00be2ff8bc7e211fb04ec42facf0e4c876800.zip
SUNRPC: svc_tcp_sendmsg() should handle errors from xdr_alloc_bvec()
[ Upstream commit b056fa070814897be32d83b079dbc311375588e7 ] The allocation is done with GFP_KERNEL, but it could still fail in a low memory situation. Fixes: 4a85a6a3320b ("SUNRPC: Handle TCP socket sends with kernel_sendpage() again") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/sunrpc/svcsock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index eba1714bf09a..6d5bb8bfed38 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1091,7 +1091,9 @@ static int svc_tcp_sendmsg(struct socket *sock, struct msghdr *msg,
int flags, ret;
*sentp = 0;
- xdr_alloc_bvec(xdr, GFP_KERNEL);
+ ret = xdr_alloc_bvec(xdr, GFP_KERNEL);
+ if (ret < 0)
+ return ret;
msg->msg_flags = MSG_MORE;
ret = kernel_sendmsg(sock, msg, &rm, 1, rm.iov_len);