Commit b056fa07 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: 4a85a6a3 ("SUNRPC: Handle TCP socket sends with kernel_sendpage() again")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 25cf32ad
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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)