diff options
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index c5ee4ff61364..8a84ab64cafd 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -2060,10 +2060,14 @@ static int unix_shutdown(struct socket *sock, int mode) | |||
2060 | struct sock *sk = sock->sk; | 2060 | struct sock *sk = sock->sk; |
2061 | struct sock *other; | 2061 | struct sock *other; |
2062 | 2062 | ||
2063 | mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN); | 2063 | if (mode < SHUT_RD || mode > SHUT_RDWR) |
2064 | 2064 | return -EINVAL; | |
2065 | if (!mode) | 2065 | /* This maps: |
2066 | return 0; | 2066 | * SHUT_RD (0) -> RCV_SHUTDOWN (1) |
2067 | * SHUT_WR (1) -> SEND_SHUTDOWN (2) | ||
2068 | * SHUT_RDWR (2) -> SHUTDOWN_MASK (3) | ||
2069 | */ | ||
2070 | ++mode; | ||
2067 | 2071 | ||
2068 | unix_state_lock(sk); | 2072 | unix_state_lock(sk); |
2069 | sk->sk_shutdown |= mode; | 2073 | sk->sk_shutdown |= mode; |