Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9883a13c72dbf8c518814b6091019643cdb34429
Commit:     9883a13c72dbf8c518814b6091019643cdb34429
Parent:     ec8acb6904fabb8e741f741ec99bb1c18f2b3dee
Author:     Parag Warudkar <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 2 21:09:31 2007 +0100
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Jan 2 13:32:21 2007 -0800

    [PATCH] selinux: fix selinux_netlbl_inode_permission() locking
    
    do not call a sleeping lock API in an RCU read section.
    lock_sock_nested can sleep, its BH counterpart doesn't.
    selinux_netlbl_inode_permission() needs to use the BH counterpart
    unconditionally.
    
    Compile tested.
    
    From: Ingo Molnar <[EMAIL PROTECTED]>
    
    added BH disabling, because this function can be called from non-atomic
    contexts too, so a naked bh_lock_sock() would be deadlock-prone.
    
    Boot-tested the resulting kernel.
    
    Signed-off-by: Parag Warudkar <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 security/selinux/ss/services.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index bdb7070..ee05815 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2660,9 +2660,11 @@ int selinux_netlbl_inode_permission(struct inode *inode, 
int mask)
                rcu_read_unlock();
                return 0;
        }
-       lock_sock(sock->sk);
+       local_bh_disable();
+       bh_lock_sock_nested(sock->sk);
        rc = selinux_netlbl_socket_setsid(sock, sksec->sid);
-       release_sock(sock->sk);
+       bh_unlock_sock(sock->sk);
+       local_bh_enable();
        rcu_read_unlock();
 
        return rc;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to