From: Mathieu Segaud it is the latest Robert Love posted against -mm kernels, but in inotify_ignore(): static int inotify_ignore(struct inotify_device *dev, s32 wd) { struct inotify_watch *watch; int ret =3D 0; spin_lock(&dev->lock); watch =3D dev_find_wd(dev, wd); spin_unlock(&dev->lock); <------------- lock is released, but if (!watch) { ret =3D -EINVAL; goto out; } __remove_watch(watch, dev); <---------- must be called with lock held out: spin_unlock(&dev->lock); <------------- anyway, lock is=20 return ret; released and sub_preempt_count } BUG's on SMP and PREEMPT __remove_watch() must be called with ->lock held on dev. Anyway, ->lock is released after label out. Signed-off-by: Mathieu Segaud Signed-off-by: Andrew Morton --- 25-akpm/drivers/char/inotify.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -puN drivers/char/inotify.c~inotify-locking-fix drivers/char/inotify.c --- 25/drivers/char/inotify.c~inotify-locking-fix Thu Feb 24 16:29:30 2005 +++ 25-akpm/drivers/char/inotify.c Thu Feb 24 16:29:30 2005 @@ -952,7 +952,7 @@ static int inotify_ignore(struct inotify spin_lock(&dev->lock); watch = dev_find_wd(dev, wd); - spin_unlock(&dev->lock); + if (!watch) { ret = -EINVAL; goto out; _