Skip to contentSkip to conversation

posix_acl: de-union a_refcount and a_rcu

PATCH RESEND New Jeff Layton 1 participant 1 message Jul 11, 2016 VFS

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 posix_acl: de-union a_refcount and a_rcu

Currently the two are unioned together, but I don't think that's safe.

It looks like get_cached_acl could race with the last put in posix_acl_release. get_cached_acl calls atomic_inc_not_zero on a_refcount, but that field could have already been clobbered by call_rcu, and may no longer be zero. Fix this by de-unioning the two fields.

Fixes b8a7a3a66747 (posix_acl: Inode acl caching fixes)
---
 include/linux/posix_acl.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

This appears to be a regression from v4.6, so I think we do want this in v4.7.

include/linux/posix_acl.h +2 -4
index 5b5a80cc5926..c818772d9f9d 100644
@@ -43,10 +43,8 @@ struct posix_acl_entry {
 };
 
 struct posix_acl {
-	union {
-		atomic_t		a_refcount;
-		struct rcu_head		a_rcu;
-	};
+	atomic_t		a_refcount;
+	struct rcu_head		a_rcu;
 	unsigned int		a_count;
 	struct posix_acl_entry	a_entries[0];
 };
Signature · 1 line
2.7.4