From: Paul Moore Date: Fri, 5 Jan 2007 20:08:21 +0000 (-0500) Subject: NetLabel: correct locking in selinux_netlbl_socket_setsid() X-Git-Tag: v2.6.20-rc5~33^2~8 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=797951200679f1d5ea12a2e58cc7bdbc2848764c;p=linux-2.6 NetLabel: correct locking in selinux_netlbl_socket_setsid() 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 Signed-off-by: James Morris --- diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 372eaade3c..3eb1fa9f0d 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -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: