Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-05-17 06:38:43 +0200
committerJiri Slaby <jslaby@suse.cz>2019-05-17 06:38:46 +0200
commite4e2183b4a7aca76422135b75440c996545bfbd2 (patch)
tree193f7da69aca49a6925274494443cbec534ab67e
parent34feaf77101616d17459d56af9e5dd52faeb2be2 (diff)
kernfs: fix barrier usage in __kernfs_new_node() (bnc#1012628).
-rw-r--r--patches.kernel.org/5.1.3-008-kernfs-fix-barrier-usage-in-__kernfs_new_node.patch43
-rw-r--r--series.conf1
2 files changed, 44 insertions, 0 deletions
diff --git a/patches.kernel.org/5.1.3-008-kernfs-fix-barrier-usage-in-__kernfs_new_node.patch b/patches.kernel.org/5.1.3-008-kernfs-fix-barrier-usage-in-__kernfs_new_node.patch
new file mode 100644
index 0000000000..0ba56c9b52
--- /dev/null
+++ b/patches.kernel.org/5.1.3-008-kernfs-fix-barrier-usage-in-__kernfs_new_node.patch
@@ -0,0 +1,43 @@
+From: Andrea Parri <andrea.parri@amarulasolutions.com>
+Date: Tue, 16 Apr 2019 14:17:11 +0200
+Subject: [PATCH] kernfs: fix barrier usage in __kernfs_new_node()
+References: bnc#1012628
+Patch-mainline: 5.1.3
+Git-commit: 998267900cee901c5d1dfa029a6304d00acbc29f
+
+commit 998267900cee901c5d1dfa029a6304d00acbc29f upstream.
+
+smp_mb__before_atomic() can not be applied to atomic_set(). Remove the
+barrier and rely on RELEASE synchronization.
+
+Fixes: ba16b2846a8c6 ("kernfs: add an API to get kernfs node from inode number")
+Cc: stable@vger.kernel.org
+Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
+Acked-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ fs/kernfs/dir.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
+index b84d635567d3..1e7a74b8e064 100644
+--- a/fs/kernfs/dir.c
++++ b/fs/kernfs/dir.c
+@@ -650,11 +650,10 @@ static struct kernfs_node *__kernfs_new_node(struct kernfs_root *root,
+ kn->id.generation = gen;
+
+ /*
+- * set ino first. This barrier is paired with atomic_inc_not_zero in
++ * set ino first. This RELEASE is paired with atomic_inc_not_zero in
+ * kernfs_find_and_get_node_by_ino
+ */
+- smp_mb__before_atomic();
+- atomic_set(&kn->count, 1);
++ atomic_set_release(&kn->count, 1);
+ atomic_set(&kn->active, KN_DEACTIVATED_BIAS);
+ RB_CLEAR_NODE(&kn->rb);
+
+--
+2.21.0
+
diff --git a/series.conf b/series.conf
index ff6e1dd39f..18581b8f5e 100644
--- a/series.conf
+++ b/series.conf
@@ -93,6 +93,7 @@
patches.kernel.org/5.1.3-005-hwmon-occ-Fix-extended-status-bits.patch
patches.kernel.org/5.1.3-006-selftests-seccomp-Handle-namespace-failures-gra.patch
patches.kernel.org/5.1.3-007-i2c-core-ratelimit-transfer-when-suspended-erro.patch
+ patches.kernel.org/5.1.3-008-kernfs-fix-barrier-usage-in-__kernfs_new_node.patch
########################################################
# Build fixes that apply to the vanilla kernel too.