Skip to content

Commit b056fa0

Browse files
author
Trond Myklebust
committed
SUNRPC: svc_tcp_sendmsg() should handle errors from xdr_alloc_bvec()
The allocation is done with GFP_KERNEL, but it could still fail in a low memory situation. Fixes: 4a85a6a ("SUNRPC: Handle TCP socket sends with kernel_sendpage() again") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 25cf32a commit b056fa0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

net/sunrpc/svcsock.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,9 @@ static int svc_tcp_sendmsg(struct socket *sock, struct xdr_buf *xdr,
10961096
int ret;
10971097

10981098
*sentp = 0;
1099-
xdr_alloc_bvec(xdr, GFP_KERNEL);
1099+
ret = xdr_alloc_bvec(xdr, GFP_KERNEL);
1100+
if (ret < 0)
1101+
return ret;
11001102

11011103
ret = kernel_sendmsg(sock, &msg, &rm, 1, rm.iov_len);
11021104
if (ret < 0)

0 commit comments

Comments
 (0)