aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2010-06-29 18:05:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-06-29 18:29:32 -0400
commitf4985dc714d7ab1920c5aa502b7f4073fa1b4177 (patch)
tree4e8385c3d0c95f02623f5712a875742664701822 /fs
parentfb967ecc584c20c74a007de749ca597068b0fcac (diff)
fs/fcntl.c:kill_fasync_rcu() fa_lock must be IRQ-safe
Fix a lockdep-splat-causing regression introduced by commit 989a2979205d ("fasync: RCU and fine grained locking"). kill_fasync() can be called from both process and hard-irq context, so fa_lock must be taken with IRQs disabled. Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16230 Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reported-by: Dominik Brodowski <linux@dominikbrodowski.net> Tested-by: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Maciej Rutecki <maciej.rutecki@gmail.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: "David S. Miller" <davem@davemloft.net> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/fcntl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 51e11bf5708f..9d175d623aab 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -733,12 +733,14 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
733{ 733{
734 while (fa) { 734 while (fa) {
735 struct fown_struct *fown; 735 struct fown_struct *fown;
736 unsigned long flags;
737
736 if (fa->magic != FASYNC_MAGIC) { 738 if (fa->magic != FASYNC_MAGIC) {
737 printk(KERN_ERR "kill_fasync: bad magic number in " 739 printk(KERN_ERR "kill_fasync: bad magic number in "
738 "fasync_struct!\n"); 740 "fasync_struct!\n");
739 return; 741 return;
740 } 742 }
741 spin_lock(&fa->fa_lock); 743 spin_lock_irqsave(&fa->fa_lock, flags);
742 if (fa->fa_file) { 744 if (fa->fa_file) {
743 fown = &fa->fa_file->f_owner; 745 fown = &fa->fa_file->f_owner;
744 /* Don't send SIGURG to processes which have not set a 746 /* Don't send SIGURG to processes which have not set a
@@ -747,7 +749,7 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)
747 if (!(sig == SIGURG && fown->signum == 0)) 749 if (!(sig == SIGURG && fown->signum == 0))
748 send_sigio(fown, fa->fa_fd, band); 750 send_sigio(fown, fa->fa_fd, band);
749 } 751 }
750 spin_unlock(&fa->fa_lock); 752 spin_unlock_irqrestore(&fa->fa_lock, flags);
751 fa = rcu_dereference(fa->fa_next); 753 fa = rcu_dereference(fa->fa_next);
752 } 754 }
753} 755}