Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3931056imm; Mon, 8 Oct 2018 11:53:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV61ZP1ZYJ3jPjwZa/s18/7ChfUr/QeHroJcCOfc28wDxFVZ9YOW4Nm/JJwzea3V7QoE+3MTz X-Received: by 2002:a63:ea43:: with SMTP id l3-v6mr22489636pgk.427.1539024801513; Mon, 08 Oct 2018 11:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024801; cv=none; d=google.com; s=arc-20160816; b=nTuCjxBPpDVvqxqO/fdrUO0xUXFY7pGp9QtKdHwKFfNl5DpvOt7gayq8rztaYqTZ/d vzXCoQyGtQmszQ150VYrlRLuRWrLOvB4Q1y5IPfXzzx8Nfcrl6+2lFOklauodTaF6rw+ YmeHuWgZkdcFy8S1cOxKqzSOSK/i6KyHCBasU0KaCVYt/2QQ+2iHzl9hdOn/fd3+3SmP r8H5yNVNumq8s9jMIa4fQ4WNeL1dYxgQdXS4IRUmiEKo/V5lijGh0T7cIkchUztdg5/U J1TNyB4M9pVYcwC+RnCgl2KAN2sncqkc8jwbc2AUf4giZNOPijpYQzdfv+S96rd7SaFe Id7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=egRYXamZOs4ixuGsm3hh6hfYqWczX6Apcf3o2EQeXGc=; b=q9UH/qrHF+IOLsnft3lCy+/YURB62TITpP+8qlevog6eSlUfR0DTKoT0XkJYlNFHyg TCe+6O0zi9bThJ3Y4hvs90xB3dwGwcJKMzmVkf0d6qMPeyVVlkYJ+OvrP+Sgb9ViScQ6 OkzIOc2ukBMJKecwfqO9754/arcoNWuSc/DSrzaf5a0R8KfGXzCbrmLG9DssJ9tgwWD0 XNcanubl2N5oGjY3CTQhOPsubdamyqipLXeiVcNW/sBcCHQf3KFYfpS/FWvQmEgIShPU 829SN/hBA6+jGJ0D29J8lgYLpdOZgKVgf3gNerIjwCHiUXli8XDEDgRhkdTLKVIMhF4Q pGmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HSqgOWPJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18-v6si19021538plq.104.2018.10.08.11.53.06; Mon, 08 Oct 2018 11:53:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HSqgOWPJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732638AbeJICGE (ORCPT + 99 others); Mon, 8 Oct 2018 22:06:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:56298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729209AbeJICGE (ORCPT ); Mon, 8 Oct 2018 22:06:04 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0305B204FD; Mon, 8 Oct 2018 18:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024776; bh=GIidu9tuPJ0eMqHmckWvxQ+B4MHm2hP2/9lTi50CveQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSqgOWPJS/Kogi2LUdsxOG4FSXv2FZlM3QnrsLrVggL3ve8VshKlvhtoI/IjwW8cg csdqdu+QO5e9TVnxNzCipv8ON4I+U3BKvL/Tu7fvytRf/o49lfdGVG6mweQVvoT/Bl kw+TjwrxFpp1k+d7lAe2p776mbsmbHx37DaEyvCk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Marc=20Aur=C3=A8le=20La=20France?= , Andreas Gruenbacher , Al Viro Subject: [PATCH 4.18 150/168] sysfs: Do not return POSIX ACL xattrs via listxattr Date: Mon, 8 Oct 2018 20:32:10 +0200 Message-Id: <20181008175625.742222066@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andreas Gruenbacher commit ffc4c92227db5699493e43eb140b4cb5904c30ff upstream. Commit 786534b92f3c introduced a regression that caused listxattr to return the POSIX ACL attribute names even though sysfs doesn't support POSIX ACLs. This happens because simple_xattr_list checks for NULL i_acl / i_default_acl, but inode_init_always initializes those fields to ACL_NOT_CACHED ((void *)-1). For example: $ getfattr -m- -d /sys /sys: system.posix_acl_access: Operation not supported /sys: system.posix_acl_default: Operation not supported Fix this in simple_xattr_list by checking if the filesystem supports POSIX ACLs. Fixes: 786534b92f3c ("tmpfs: listxattr should include POSIX ACL xattrs") Reported-by: Marc Aurèle La France Tested-by: Marc Aurèle La France Signed-off-by: Andreas Gruenbacher Cc: stable@vger.kernel.org # v4.5+ Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/xattr.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) --- a/fs/xattr.c +++ b/fs/xattr.c @@ -949,17 +949,19 @@ ssize_t simple_xattr_list(struct inode * int err = 0; #ifdef CONFIG_FS_POSIX_ACL - if (inode->i_acl) { - err = xattr_list_one(&buffer, &remaining_size, - XATTR_NAME_POSIX_ACL_ACCESS); - if (err) - return err; - } - if (inode->i_default_acl) { - err = xattr_list_one(&buffer, &remaining_size, - XATTR_NAME_POSIX_ACL_DEFAULT); - if (err) - return err; + if (IS_POSIXACL(inode)) { + if (inode->i_acl) { + err = xattr_list_one(&buffer, &remaining_size, + XATTR_NAME_POSIX_ACL_ACCESS); + if (err) + return err; + } + if (inode->i_default_acl) { + err = xattr_list_one(&buffer, &remaining_size, + XATTR_NAME_POSIX_ACL_DEFAULT); + if (err) + return err; + } } #endif