Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:37523 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933900AbcGKPBi (ORCPT ); Mon, 11 Jul 2016 11:01:38 -0400 From: Andreas Gruenbacher To: Linus Torvalds Cc: Jeff Layton , Alexander Viro , Thorsten Leemhuis , linux-fsdevel@vger.kernel.org, Andreas Gruenbacher Subject: [PATCH] posix_acl: de-union a_refcount and a_rcu Date: Mon, 11 Jul 2016 17:01:28 +0200 Message-Id: <1468249288-16086-1-git-send-email-agruenba@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Jeff Layton 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 (v4.7-rc1, posix_acl: Inode acl caching fixes) Signed-off-by: Jeff Layton Acked-by: David Howells Signed-off-by: Andreas Gruenbacher --- include/linux/posix_acl.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h index 5b5a80c..c818772 100644 --- a/include/linux/posix_acl.h +++ b/include/linux/posix_acl.h @@ -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]; }; -- 2.5.5