Revert "af_unix: Remove put_pid()/put_cred() in copy_peercred()."
This reverts commit 7d62680ff2
.
This commit is contained in:
parent
7af2ee528f
commit
0868060b93
1 changed files with 8 additions and 1 deletions
|
@ -603,6 +603,9 @@ static void init_peercred(struct sock *sk)
|
||||||
|
|
||||||
static void copy_peercred(struct sock *sk, struct sock *peersk)
|
static void copy_peercred(struct sock *sk, struct sock *peersk)
|
||||||
{
|
{
|
||||||
|
const struct cred *old_cred;
|
||||||
|
struct pid *old_pid;
|
||||||
|
|
||||||
if (sk < peersk) {
|
if (sk < peersk) {
|
||||||
spin_lock(&sk->sk_peer_lock);
|
spin_lock(&sk->sk_peer_lock);
|
||||||
spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING);
|
spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING);
|
||||||
|
@ -610,12 +613,16 @@ static void copy_peercred(struct sock *sk, struct sock *peersk)
|
||||||
spin_lock(&peersk->sk_peer_lock);
|
spin_lock(&peersk->sk_peer_lock);
|
||||||
spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING);
|
spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING);
|
||||||
}
|
}
|
||||||
|
old_pid = sk->sk_peer_pid;
|
||||||
|
old_cred = sk->sk_peer_cred;
|
||||||
sk->sk_peer_pid = get_pid(peersk->sk_peer_pid);
|
sk->sk_peer_pid = get_pid(peersk->sk_peer_pid);
|
||||||
sk->sk_peer_cred = get_cred(peersk->sk_peer_cred);
|
sk->sk_peer_cred = get_cred(peersk->sk_peer_cred);
|
||||||
|
|
||||||
spin_unlock(&sk->sk_peer_lock);
|
spin_unlock(&sk->sk_peer_lock);
|
||||||
spin_unlock(&peersk->sk_peer_lock);
|
spin_unlock(&peersk->sk_peer_lock);
|
||||||
|
|
||||||
|
put_pid(old_pid);
|
||||||
|
put_cred(old_cred);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unix_listen(struct socket *sock, int backlog)
|
static int unix_listen(struct socket *sock, int backlog)
|
||||||
|
|
Loading…
Reference in a new issue