From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chuck Lever Subject: [PATCH] tmpfs: Fix simple_set_acl() Date: Tue, 22 Apr 2014 18:08:51 -0400 Message-ID: <20140422220815.3847.82405.stgit@klimt.1015granger.net> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: linux-fsdevel@vger.kernel.org Return-path: Received: from mail-ig0-f181.google.com ([209.85.213.181]:56736 "EHLO mail-ig0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757229AbaDVWIy (ORCPT ); Tue, 22 Apr 2014 18:08:54 -0400 Received: by mail-ig0-f181.google.com with SMTP id h18so261184igc.2 for ; Tue, 22 Apr 2014 15:08:53 -0700 (PDT) Received: from klimt.1015granger.net ([2604:8800:100:81fc:be5f:f4ff:fed6:c3ba]) by mx.google.com with ESMTPSA id lp4sm31355969igb.12.2014.04.22.15.08.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Apr 2014 15:08:53 -0700 (PDT) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Ben Greear reports that NFSD panics in posix_acl_equiv_mode() during an NFSv3 SETACL operation. I have reproduced this using an exported tmpfs and cthon04 with NFSv3. A survey of .set_acl methods suggests that simple_set_acl() must tolerate a NULL "acl" argument. Fixes: feda821e76f3bbbba4bd54d30b4d4005a7848aa5 Signed-off-by: Chuck Lever --- fs/posix_acl.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 9e363e4..0b25aae 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -863,11 +863,13 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type) int error; if (type == ACL_TYPE_ACCESS) { - error = posix_acl_equiv_mode(acl, &inode->i_mode); - if (error < 0) - return 0; - if (error == 0) - acl = NULL; + if (acl) { + error = posix_acl_equiv_mode(acl, &inode->i_mode); + if (error < 0) + return 0; + if (error == 0) + acl = NULL; + } } inode->i_ctime = CURRENT_TIME;