diff options
Diffstat (limited to 'net/unix/af_unix.c')
| -rw-r--r-- | net/unix/af_unix.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index e4768c180da..5b5c876c80e 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -441,7 +441,7 @@ static int unix_release_sock(struct sock *sk, int embrion) | |||
| 441 | /* ---- Socket is dead now and most probably destroyed ---- */ | 441 | /* ---- Socket is dead now and most probably destroyed ---- */ |
| 442 | 442 | ||
| 443 | /* | 443 | /* |
| 444 | * Fixme: BSD difference: In BSD all sockets connected to use get | 444 | * Fixme: BSD difference: In BSD all sockets connected to us get |
| 445 | * ECONNRESET and we die on the spot. In Linux we behave | 445 | * ECONNRESET and we die on the spot. In Linux we behave |
| 446 | * like files and pipes do and wait for the last | 446 | * like files and pipes do and wait for the last |
| 447 | * dereference. | 447 | * dereference. |
| @@ -481,7 +481,6 @@ static int unix_listen(struct socket *sock, int backlog) | |||
| 481 | struct sock *sk = sock->sk; | 481 | struct sock *sk = sock->sk; |
| 482 | struct unix_sock *u = unix_sk(sk); | 482 | struct unix_sock *u = unix_sk(sk); |
| 483 | struct pid *old_pid = NULL; | 483 | struct pid *old_pid = NULL; |
| 484 | const struct cred *old_cred = NULL; | ||
| 485 | 484 | ||
| 486 | err = -EOPNOTSUPP; | 485 | err = -EOPNOTSUPP; |
| 487 | if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) | 486 | if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET) |
| @@ -503,8 +502,6 @@ static int unix_listen(struct socket *sock, int backlog) | |||
| 503 | out_unlock: | 502 | out_unlock: |
| 504 | unix_state_unlock(sk); | 503 | unix_state_unlock(sk); |
| 505 | put_pid(old_pid); | 504 | put_pid(old_pid); |
| 506 | if (old_cred) | ||
| 507 | put_cred(old_cred); | ||
| 508 | out: | 505 | out: |
| 509 | return err; | 506 | return err; |
| 510 | } | 507 | } |
| @@ -1450,7 +1447,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1450 | if (NULL == siocb->scm) | 1447 | if (NULL == siocb->scm) |
| 1451 | siocb->scm = &tmp_scm; | 1448 | siocb->scm = &tmp_scm; |
| 1452 | wait_for_unix_gc(); | 1449 | wait_for_unix_gc(); |
| 1453 | err = scm_send(sock, msg, siocb->scm); | 1450 | err = scm_send(sock, msg, siocb->scm, false); |
| 1454 | if (err < 0) | 1451 | if (err < 0) |
| 1455 | return err; | 1452 | return err; |
| 1456 | 1453 | ||
| @@ -1619,7 +1616,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
| 1619 | if (NULL == siocb->scm) | 1616 | if (NULL == siocb->scm) |
| 1620 | siocb->scm = &tmp_scm; | 1617 | siocb->scm = &tmp_scm; |
| 1621 | wait_for_unix_gc(); | 1618 | wait_for_unix_gc(); |
| 1622 | err = scm_send(sock, msg, siocb->scm); | 1619 | err = scm_send(sock, msg, siocb->scm, false); |
| 1623 | if (err < 0) | 1620 | if (err < 0) |
| 1624 | return err; | 1621 | return err; |
| 1625 | 1622 | ||
| @@ -2060,10 +2057,14 @@ static int unix_shutdown(struct socket *sock, int mode) | |||
| 2060 | struct sock *sk = sock->sk; | 2057 | struct sock *sk = sock->sk; |
| 2061 | struct sock *other; | 2058 | struct sock *other; |
| 2062 | 2059 | ||
| 2063 | mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN); | 2060 | if (mode < SHUT_RD || mode > SHUT_RDWR) |
| 2064 | 2061 | return -EINVAL; | |
| 2065 | if (!mode) | 2062 | /* This maps: |
| 2066 | return 0; | 2063 | * SHUT_RD (0) -> RCV_SHUTDOWN (1) |
| 2064 | * SHUT_WR (1) -> SEND_SHUTDOWN (2) | ||
| 2065 | * SHUT_RDWR (2) -> SHUTDOWN_MASK (3) | ||
| 2066 | */ | ||
| 2067 | ++mode; | ||
| 2067 | 2068 | ||
| 2068 | unix_state_lock(sk); | 2069 | unix_state_lock(sk); |
| 2069 | sk->sk_shutdown |= mode; | 2070 | sk->sk_shutdown |= mode; |
