summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-10-06 03:46:09 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-10-06 03:46:08 -0700
commit3b8fc0b7a3fcc809378d82dbf66b417e186af205 (patch)
tree6e44c44ec85ddba4faf8cb108b04c47cb3fc4414 /kernel
parent8f037f0b363b3907444a3a46b90e293284c6da51 (diff)
parentd9a879450e01a53b297876072dfc1e541181862b (diff)
Merge "Merge android-4.4.158 (f9e4134) into msm-4.4"
Diffstat (limited to 'kernel')
-rw-r--r--kernel/audit_watch.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index a162661c9d60..f45a9a5d3e47 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -419,6 +419,13 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
struct path parent_path;
int h, ret = 0;
+ /*
+ * When we will be calling audit_add_to_parent, krule->watch might have
+ * been updated and watch might have been freed.
+ * So we need to keep a reference of watch.
+ */
+ audit_get_watch(watch);
+
mutex_unlock(&audit_filter_mutex);
/* Avoid calling path_lookup under audit_filter_mutex. */
@@ -427,8 +434,10 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
/* caller expects mutex locked */
mutex_lock(&audit_filter_mutex);
- if (ret)
+ if (ret) {
+ audit_put_watch(watch);
return ret;
+ }
/* either find an old parent or attach a new one */
parent = audit_find_parent(d_backing_inode(parent_path.dentry));
@@ -446,6 +455,7 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list)
*list = &audit_inode_hash[h];
error:
path_put(&parent_path);
+ audit_put_watch(watch);
return ret;
}