X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=kernel%2Faudit_watch.c;h=4b4b9d5506f5ae5e11961a20cb6f9436f8c34522;hp=e683869365d9bdaf60abcb44e37da05506ab5672;hb=19277917a0db893344f247d2ed4ac920c874f0d6;hpb=0965537308ac3b267ea16e731bd73870a51c53b8 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); } }