* [PATCH 1/2] fs: pstore: don't claim uImages
@ 2026-11-03 14:32 Ahmad Fatoum
2026-11-03 14:32 ` [PATCH 2/2] fs: jffs2: refuse to mount non-MTD devices Ahmad Fatoum
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-11-03 14:32 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
From: Ahmad Fatoum <a.fatoum@barebox.org>
pstore_driver sets .type = filetype_uimage, likely copied from uimagefs.
pstore doesn't read from a device at all, so it shouldn't claim a type.
This is harmless so far, because file system detection never reports
uImages, but if it did, mounting a uImage without uimagefs enabled would
mount pstore instead. Let's drop the type. Startup code mounts pstore
with an explicit type, so it's not affected.
Assisted-by: Claude:opus-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
fs/pstore/fs.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/pstore/fs.c b/fs/pstore/fs.c
index 88951632138a..42825d01ce76 100644
--- a/fs/pstore/fs.c
+++ b/fs/pstore/fs.c
@@ -288,7 +288,6 @@ static const struct fs_legacy_ops pstore_ops = {
static struct fs_driver pstore_driver = {
.legacy_ops = &pstore_ops,
- .type = filetype_uimage,
.drv = {
.probe = pstore_probe,
.remove = pstore_remove,
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] fs: jffs2: refuse to mount non-MTD devices
2026-11-03 14:32 [PATCH 1/2] fs: pstore: don't claim uImages Ahmad Fatoum
@ 2026-11-03 14:32 ` Ahmad Fatoum
0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2026-11-03 14:32 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
From: Ahmad Fatoum <a.fatoum@barebox.org>
jffs2 only works on MTD, but nothing keeps it from being probed for
other devices. mount -t jffs2 on a block device leaves the MTD pointer
NULL and jffs2_do_fill_super() dereferences it right away.
Let's fail the probe instead, like ubifs does when it's not given a UBI
volume.
Fixes: 831b3312e5fe ("fs: jffs2: add initial support for reading jffs2")
Assisted-by: Claude:opus-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
fs/jffs2/fs.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 84f39a0f2a24..8cbe15850e37 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -407,6 +407,11 @@ static int jffs2_probe(struct device *dev)
if (ret)
goto err_out;
+ if (!fsdev->cdev->mtd) {
+ dev_err(dev, "%s is not an MTD device\n", fsdev->backingstore);
+ return -EINVAL;
+ }
+
ctx = kzalloc(sizeof(struct jffs2_sb_info), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-03 14:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 14:32 [PATCH 1/2] fs: pstore: don't claim uImages Ahmad Fatoum
2026-11-03 14:32 ` [PATCH 2/2] fs: jffs2: refuse to mount non-MTD devices Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox