Skip to content

Commit

Permalink
NetLabel: correct locking in selinux_netlbl_socket_setsid()
Browse files Browse the repository at this point in the history
The spinlock protecting the update of the "sksec->nlbl_state" variable is not
currently softirq safe which can lead to problems.  This patch fixes this by
changing the spin_{un}lock() functions into spin_{un}lock_bh() functions.

Signed-off-by: Paul Moore <paul.moore@hp.com>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
Paul Moore authored and David S. Miller committed Jan 9, 2007
1 parent 86112ff commit 7979512
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -2491,9 +2491,9 @@ static int selinux_netlbl_socket_setsid(struct socket *sock, u32 sid)

rc = netlbl_socket_setattr(sock, &secattr);
if (rc == 0) {
spin_lock(&sksec->nlbl_lock);
spin_lock_bh(&sksec->nlbl_lock);
sksec->nlbl_state = NLBL_LABELED;
spin_unlock(&sksec->nlbl_lock);
spin_unlock_bh(&sksec->nlbl_lock);
}

netlbl_socket_setsid_return:
Expand Down

0 comments on commit 7979512

Please sign in to comment.