From nobody Sat Jul 25 16:48:59 2026 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6192227F75C for ; Thu, 16 Jul 2026 02:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784170757; cv=none; b=Bg0JSRiojevwlZJeiqsKjnEAsV9Fh0IEXbWlu0Zh8R0CiE8epTIqGq+PkPHsldUQbvBiLwrW7LMUOmPoajsNI2VpdVEp1n1abMPfRDrQX1mMsyqCCEhYHig/pgPzjbmKd2dbPZdt5nb5xwVPa3gvQ8c/XTw1BJU5SZMslMD2LBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784170757; c=relaxed/simple; bh=xJQVBstrpp90gUhqAaKJVzjTXXjMLAJp5c7rkABifvM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SRJQ2r4VFNp6ZyDoI72j0C2kZzttm/nDAgVJ6AyQl1RL3HNmFXgNUAQrKsQUjZqfEpTfmrdOBsUdXCG5kP+Nbz/oacUEmm8g6OMx5na7j0/DYNhnGXJCaAkx7UdteyhjnbrSY+GmjyooecVxac995WvoH0v3BBTWPLk8fPgalIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mz+hrCiv; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mz+hrCiv" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2cc73e322dbso74739215ad.1 for ; Wed, 15 Jul 2026 19:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784170756; x=1784775556; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=Sea8lelRxE+zBLv16TImL7g/EOZ5/pZo8t/0pWuCD78=; b=Mz+hrCivQTA+Dyu7lCgP7XlvSSjUO5sWVenyydJG0aM0T82oIAqYxCEYNT1eJWXHyi OEhN+xZAs2lrXH8z2Z+O80kLgU6ppDLDAXjsqy1/WAP5GVeqTD7Z6TGZvaNQk7vWa6ih ywFXtOtMCTngzYegBQ+pSKi5rbgcZi6lQ1AWGqP/XJTDQZ4BHi0hh2Q2KXaubpuwVM6q c4JIV4vwi4FYaVUUDQUVnxhVHF//rDlXi5KUzURU7jslQxSP/llh1oLGptJ+YMllHSf/ U/uTJAR+R0UXAvJCpyPHBVPcndEJ8zefchpCQjJ3WtP8IfgdPA/pJFSoY9lmntM5us8j p2DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784170756; x=1784775556; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Sea8lelRxE+zBLv16TImL7g/EOZ5/pZo8t/0pWuCD78=; b=hOgbtYejIOkgsu63x09qUupHHUP6k6cfZf2SJEVIRHcL8ru+hGHYb4a1mqzuDniX5N GTSEuAcAnl4/I0lKjdZDgqhNtGRn1gAA6Ulhn96Wp1FNRHMH4nawp2/3l3wx6NShfRHy pqm9XyEGJjKXWGhKeO8XyRAtSdhq7Q8KzUuhRoCoGVSkR9tTtlA7UHPcaf4XLAgzSwDL 6A7Ot1+6x62DlXAZ6hg/ANgmntfXp3MTwVbSjyaMiD53c3QryHsdeze/131guhRzwNlM whJzGAg8D8Vohi2HxfNHiDE0gEWPRdCHq1EfU7U1lLg/AQEAGxaaKdGZk0iCqh81YAmS mA6A== X-Forwarded-Encrypted: i=1; AHgh+RoyuVxM6Fx57ZKL+jiNuXb1N6jf0NgegfQ35RWJDf+xBsvnHS+d/yRoHLrK0Vjm8nCcqvA4pq8Xco8mRic=@vger.kernel.org X-Gm-Message-State: AOJu0YyVDlIFIF+FAB8j708GW5fc/HNnmNr5BcohVV1eTw6DVU0B+GuC lyAGbXgTMcVFiC7NJLdNMuOPeyhdookR8Au1Tz5f1EoQdXN8xA1jbhLp X-Gm-Gg: AfdE7cnaTGGf1tMSoATBQfPIklBGZgJQIXQxrAqrPZILnB2e0KxJOiY7H0VoLZEMFc1 VxtrnCxhsepOzDSu8O92bXZ4tntHc37gy+2fYZm3w3Q35EYzFekb2nxqW8Jn0MCbQnSLeYXKdZA PW9vKN36PTl/gj4kYSvfIbK3azb2Pb6AqcTgw7K1VjmryWuIvqjQp6BJ3BBWcefUPYMjWNiXEBM 34c1X/pSU9+8huGXO/jPKpWp2yxbWaAfd+4HAUvghWhTvmFvcr7T3vJvZoEGwrRiiN6z+Sbgz5A fPRxYwIvaSU/T7l4xYvLZlpDDarAdUthi1t8xJl/Ario2PClQic6nJVlFAvHlNjdTYYvQPWs2Il /0oY6YwXaDjB9wUoeMYdBbsn0s5lid0Fcp74t2Wf4hR4djuanpI/kPI9zyCv2/lgbQ/VmmZyLiL N5fKYp7fpUrCoWrw== X-Received: by 2002:a17:903:1a84:b0:2c9:d8c6:1dc3 with SMTP id d9443c01a7336-2cf03aee8cdmr48274875ad.0.1784170755668; Wed, 15 Jul 2026 19:59:15 -0700 (PDT) Received: from osman.mioffice.cn ([43.224.245.178]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf10731540sm11688685ad.81.2026.07.15.19.59.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2026 19:59:14 -0700 (PDT) From: Zhan Xusheng X-Google-Original-From: Zhan Xusheng To: Jaegeuk Kim , Chao Yu Cc: Christian Brauner , Pedro Falcato , Jan Kara , linux-f2fs-devel@lists.sourceforge.net, stable@vger.kernel.org, linux-kernel@vger.kernel.org, Zhan Xusheng Subject: [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set() Date: Thu, 16 Jul 2026 10:59:08 +0800 Message-ID: <20260716025908.608098-1-zhanxusheng@xiaomi.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" f2fs_xattr_advise_set() calls inode_owner_or_capable() with &nop_mnt_idmap before allowing the "system.advise" xattr to be set, instead of the idmap that the VFS passes to the ->set() handler. f2fs supports idmapped mounts, so on such a mount this checks the caller's fsuid against the unmapped on-disk owner rather than the mapped owner: the actual owner can be wrongly denied with -EPERM and an unrelated caller wrongly allowed. Pass the handler's idmap instead. Fixes: 01beba7957a2 ("fs: port inode_owner_or_capable() to mnt_idmap") Cc: stable@vger.kernel.org Signed-off-by: Zhan Xusheng --- fs/f2fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index ed33e5110f2a..6728d1488cad 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -119,7 +119,7 @@ static int f2fs_xattr_advise_set(const struct xattr_han= dler *handler, unsigned char old_advise =3D F2FS_I(inode)->i_advise; unsigned char new_advise; =20 - if (!inode_owner_or_capable(&nop_mnt_idmap, inode)) + if (!inode_owner_or_capable(idmap, inode)) return -EPERM; if (value =3D=3D NULL) return -EINVAL; --=20 2.43.0