]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Trond Myklebust <Trond.Myklebust@netapp.com> |
2 | Subject: SUNRPC: Fix an Oops due to socket not set up yet... | |
3 | References: 474062 | |
4 | Patch-mainline: v2.6.29-rc7 | |
5 | ||
6 | Upstream commit fba91afbec2c004e2c8733ae9e0ca6998e962c64 | |
7 | ||
8 | SUNRPC: Fix an Oops due to socket not set up yet... | |
9 | ||
10 | We can Oops in both xs_udp_send_request() and xs_tcp_send_request() if the | |
11 | call to xs_sendpages() returns an error due to the socket not yet being | |
12 | set up. | |
13 | Deal with that situation by returning a new error: ENOTSOCK, so that we | |
14 | know to avoid dereferencing transport->sock. | |
15 | ||
16 | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> | |
17 | Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> | |
18 | --- | |
19 | ||
20 | Index: linux-2.6.27-SLE11_BRANCH/net/sunrpc/xprtsock.c | |
21 | =================================================================== | |
22 | --- linux-2.6.27-SLE11_BRANCH.orig/net/sunrpc/xprtsock.c | |
23 | +++ linux-2.6.27-SLE11_BRANCH/net/sunrpc/xprtsock.c | |
24 | @@ -469,7 +469,7 @@ static int xs_sendpages(struct socket *s | |
25 | int err, sent = 0; | |
26 | ||
27 | if (unlikely(!sock)) | |
28 | - return -ENOTCONN; | |
29 | + return -ENOTSOCK; | |
30 | ||
31 | clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags); | |
32 | if (base != 0) { | |
33 | @@ -596,6 +596,10 @@ static int xs_udp_send_request(struct rp | |
34 | } | |
35 | ||
36 | switch (status) { | |
37 | + case -ENOTSOCK: | |
38 | + status = -ENOTCONN; | |
39 | + /* Should we call xs_close() here? */ | |
40 | + break; | |
41 | case -EAGAIN: | |
42 | xs_nospace(task); | |
43 | break; | |
44 | @@ -695,6 +699,10 @@ static int xs_tcp_send_request(struct rp | |
45 | } | |
46 | ||
47 | switch (status) { | |
48 | + case -ENOTSOCK: | |
49 | + status = -ENOTCONN; | |
50 | + /* Should we call xs_close() here? */ | |
51 | + break; | |
52 | case -EAGAIN: | |
53 | xs_nospace(task); | |
54 | break; |