Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5040780pxb; Mon, 15 Feb 2021 08:02:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfPFDGrGbRbO/beK11jTNUyD0vd5DdTAXaUUF5Dm7REIizKLeR6nbQyVNl0bDz2lnLOGKV X-Received: by 2002:a2e:b8d5:: with SMTP id s21mr10144020ljp.408.1613404975360; Mon, 15 Feb 2021 08:02:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613404975; cv=none; d=google.com; s=arc-20160816; b=yXG3ntDM3sympZtS6RfB80dOZNlL3CPYkdpuEemeBnKtz0yy7UL3uYIdjq9IkHhn3s kxrSuKzdHbgwmLBMSmYnEspEn+MPLkBidycCDw8GRd3Zr+GQy6QxOZQXOsOk3LzScg0T CRNz/Sgz2aAlZxArW8Mp7+wI9IsRbHzkpNGOfd91lD3OP/K+AJaeEXuafE4iYgqit4hW xiV7L4GNVcDAHClIH5EHIv9cAAZxjylC7BDDrWwnUDrDCUC8VsLeqwCJ7aBLkxehcrxJ 1QgQAnhvWJA5TinMaDLNoVYtsJs6nnsrwjorseQiVSbFpykX1WIVg9110q4b4RbTcEq7 YCFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FU38b4bkiwx6a59MZjpKLLaVmg4NelStbLj2aGAM6A8=; b=Ce/BZ6PqdwMqmZu+GgMM711+RErqOYsBmFKu+TLczhdQcICBrMFaNYJ0WDbGJgz1iw zHC1aXF/DjEtbqyWw22MOCRZ2nC6wNjN3Jf4URChPJM7jXYuoGGQNMJ/uDPo8mZNBSQE 0bnGVEcZRb+d9vv48qDCjf4eLctTEWy5OOs8PrQ5havo9mjRR1X8rucg7yT6h+qq6JHT pSvjIdU6y4IH3JQbmEziObyArwdh4vKVF4qFbApysEs4hFWocA2ki2smwO4kbIliljes XrbxFEir4vkWYsm0pVjkoDGD3aLsRpGW2YnSv9aYAB5w3bGOHs9vKHIYWf8ipCbynkze c19Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k2UPvSjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si1513433edl.5.2021.02.15.08.02.30; Mon, 15 Feb 2021 08:02:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k2UPvSjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232572AbhBOP6z (ORCPT + 99 others); Mon, 15 Feb 2021 10:58:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:45592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbhBOPdA (ORCPT ); Mon, 15 Feb 2021 10:33:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F2D0264EAD; Mon, 15 Feb 2021 15:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403017; bh=/WPAYCPcBpyTcmkwy/aSFnnUajeeQC5eHR35ZVtn90Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k2UPvSjQBNJ2B/4tzg5iOg/yqfD57aQlmqOe73Bv2OFjMAhvv4WJ0pwSMzKsWPxmA Zctjo8SmHRC3szjfUCgjUgX1eh1e0LMVylQV87wTruQqjpllVThrQKl3cXYJRww+nR DRWdintMlyTysPpgV/vcPFYxrSOMaHDCrbRyVttY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Eric W. Biederman" , Miklos Szeredi , Sasha Levin Subject: [PATCH 5.4 11/60] ovl: perform vfs_getxattr() with mounter creds Date: Mon, 15 Feb 2021 16:26:59 +0100 Message-Id: <20210215152715.740229487@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152715.401453874@linuxfoundation.org> References: <20210215152715.401453874@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miklos Szeredi [ Upstream commit 554677b97257b0b69378bd74e521edb7e94769ff ] The vfs_getxattr() in ovl_xattr_set() is used to check whether an xattr exist on a lower layer file that is to be removed. If the xattr does not exist, then no need to copy up the file. This call of vfs_getxattr() wasn't wrapped in credential override, and this is probably okay. But for consitency wrap this instance as well. Reported-by: "Eric W. Biederman" Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin --- fs/overlayfs/inode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index bb980721502dd..56b55397a7a00 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c @@ -337,7 +337,9 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name, goto out; if (!value && !upperdentry) { + old_cred = ovl_override_creds(dentry->d_sb); err = vfs_getxattr(realdentry, name, NULL, 0); + revert_creds(old_cred); if (err < 0) goto out_drop_write; } -- 2.27.0