The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] erofs: use the opener's credential when verifing metadata accesses
@ 2026-05-05 15:56 Gao Xiang
  2026-05-05 20:15 ` Carlos Llamas
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Gao Xiang @ 2026-05-05 15:56 UTC (permalink / raw)
  To: linux-erofs, Chao Yu
  Cc: LKML, oliver.yang, Gao Xiang, Carlos Llamas, Sandeep Dhavale,
	Tatsuyuki Ishi

Similar to commit 905eeb2b7c33 ("erofs: impersonate the opener's
credentials when accessing backing file"), rw_verify_area() needs
the same too.

Fixes: 307210c262a2 ("erofs: verify metadata accesses for file-backed mounts")
Cc: Carlos Llamas <cmllamas@google.com>
Cc: Sandeep Dhavale <dhavale@google.com>
Cc: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
Can we verify this patch resolve the android-mainline issue?

 fs/erofs/data.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index b2c12c5856ac..51b8e860b6b2 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -40,9 +40,11 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t offset, bool need_kmap)
 	 */
 	if (buf->file) {
 		fpos = (loff_t)index << PAGE_SHIFT;
-		err = rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE);
-		if (err < 0)
-			return ERR_PTR(err);
+		scoped_with_creds(buf->file->f_cred) {
+			err = rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE);
+			if (err < 0)
+				return ERR_PTR(err);
+		}
 	}
 
 	if (buf->page) {
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-05-11 14:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 15:56 [PATCH] erofs: use the opener's credential when verifing metadata accesses Gao Xiang
2026-05-05 20:15 ` Carlos Llamas
2026-05-07  4:28 ` [PATCH v2] erofs: use the opener's credential when verifying " Gao Xiang
2026-05-08  8:20 ` [PATCH] erofs: use the opener's credential when verifing " Christoph Hellwig
2026-05-08  8:25   ` Tatsuyuki Ishi
     [not found]   ` <CABqzrSOaCMPD_QrSq_y_6bXLC3ecm3FZsE_ACrdNbTHG8baMCw@mail.gmail.com>
2026-05-08  8:39     ` Gao Xiang
2026-05-08  8:51       ` Christoph Hellwig
2026-05-08  9:10         ` Gao Xiang
2026-05-11  6:18           ` Christoph Hellwig
2026-05-11  6:52             ` Gao Xiang
2026-05-11 13:51       ` Christian Brauner
2026-05-11 14:42         ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox