diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2022-04-07 21:10:23 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-13 21:59:20 +0300 |
commit | 3fd9be3ec5c8ff0f052edee2a6fe127f5457ee7c (patch) | |
tree | 3ecb37e3a39544a73c08f5cd3ce01a572f403ad4 /net/sunrpc/svcsock.c | |
parent | 3b32dda29f994f036de528c07221fa72ba721f1c (diff) | |
download | linux-3fd9be3ec5c8ff0f052edee2a6fe127f5457ee7c.tar.xz |
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>
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r-- | net/sunrpc/svcsock.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 478f857cdaed..6ea3d87e1147 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -1096,7 +1096,9 @@ static int svc_tcp_sendmsg(struct socket *sock, struct xdr_buf *xdr, int ret; *sentp = 0; - xdr_alloc_bvec(xdr, GFP_KERNEL); + ret = xdr_alloc_bvec(xdr, GFP_KERNEL); + if (ret < 0) + return ret; ret = kernel_sendmsg(sock, &msg, &rm, 1, rm.iov_len); if (ret < 0) |