X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Faudit_watch.c;h=4b4b9d5506f5ae5e11961a20cb6f9436f8c34522;hb=ccaa16ab073a8e0b94ce1d32d9da1199adf712df;hp=e683869365d9bdaf60abcb44e37da05506ab5672;hpb=f0a2b0cb71e652ae9f0feeea91e5320e4faf25dc;p=pandora-kernel.git diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index e683869365d9..4b4b9d5506f5 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c @@ -471,13 +471,15 @@ void audit_remove_watch_rule(struct audit_krule *krule) list_del(&krule->rlist); if (list_empty(&watch->rules)) { + /* + * audit_remove_watch() drops our reference to 'parent' which + * can get freed. Grab our own reference to be safe. + */ + audit_get_parent(parent); audit_remove_watch(watch); - - if (list_empty(&parent->watches)) { - audit_get_parent(parent); + if (list_empty(&parent->watches)) fsnotify_destroy_mark(&parent->mark); - audit_put_parent(parent); - } + audit_put_parent(parent); } }