Commit fba91afb authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Fix an Oops due to socket not set up yet...

We can Oops in both xs_udp_send_request() and xs_tcp_send_request() if the
call to xs_sendpages() returns an error due to the socket not yet being
set up.
Deal with that situation by returning a new error: ENOTSOCK, so that we
know to avoid dereferencing transport->sock.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent d7371c41
...@@ -467,7 +467,7 @@ static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, ...@@ -467,7 +467,7 @@ static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen,
int err, sent = 0; int err, sent = 0;
if (unlikely(!sock)) if (unlikely(!sock))
return -ENOTCONN; return -ENOTSOCK;
clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags); clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
if (base != 0) { if (base != 0) {
...@@ -594,6 +594,10 @@ static int xs_udp_send_request(struct rpc_task *task) ...@@ -594,6 +594,10 @@ static int xs_udp_send_request(struct rpc_task *task)
} }
switch (status) { switch (status) {
case -ENOTSOCK:
status = -ENOTCONN;
/* Should we call xs_close() here? */
break;
case -EAGAIN: case -EAGAIN:
xs_nospace(task); xs_nospace(task);
break; break;
...@@ -693,6 +697,10 @@ static int xs_tcp_send_request(struct rpc_task *task) ...@@ -693,6 +697,10 @@ static int xs_tcp_send_request(struct rpc_task *task)
} }
switch (status) { switch (status) {
case -ENOTSOCK:
status = -ENOTCONN;
/* Should we call xs_close() here? */
break;
case -EAGAIN: case -EAGAIN:
xs_nospace(task); xs_nospace(task);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment