fsnotify: don't BUG in fsnotify_destroy_mark()
commita9680ece8e3874382fb2db1b8e247452c306b735
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 12 Jan 2012 16:59:46 +0000 (12 17:59 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 26 Jan 2012 01:24:49 +0000 (25 17:24 -0800)
treeb3aaa55fa5ff97ed253d71d184c25a40e81c9192
parent46a5392ffcb492b8042776ce44b5cc1c07be1b23
fsnotify: don't BUG in fsnotify_destroy_mark()

commit fed474857efbed79cd390d0aee224231ca718f63 upstream.

Removing the parent of a watched file results in "kernel BUG at
fs/notify/mark.c:139".

To reproduce

  add "-w /tmp/audit/dir/watched_file" to audit.rules
  rm -rf /tmp/audit/dir

This is caused by fsnotify_destroy_mark() being called without an
extra reference taken by the caller.

Reported by Francesco Cosoleto here:

  https://bugzilla.novell.com/show_bug.cgi?id=689860

Fix by removing the BUG_ON and adding a comment about not accessing mark after
the iput.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/notify/mark.c