mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH v2 0/4] fs: return error pointers from ->get_link() on failure
Date: Mon, 02 Nov 2026 10:31:19 +0100	[thread overview]
Message-ID: <20261102-fs-getlink-fixes-v2-0-37df92e4d0d3@pengutronix.de> (raw)

Like in Linux, the callers of ->get_link() expect an error pointer when
the link can't be read: readlinkat() checks the result only with
IS_ERR() before copying from it, and path lookup takes NULL to mean that
the link has already been followed and continues from the directory
containing the link. barebox has no nd_jump_link(), so a NULL from
->get_link() is never legitimate there.

9p and nfs already return error pointers, and the squashfs series posted
separately converts squashfs_get_link(). This series converts the
remaining file systems:

- legacy returned NULL when the driver's readlink failed.
- cramfs and ext4 checked their read helpers for return values these
  never produce, so a link that couldn't be read was returned as a valid,
  partly zeroed link and stayed cached in inode->i_link.

For cramfs, that needs cramfs_read_file() to stop at a block that fails
to decompress in the first place: it stored the error in a size_t and
returned whatever the block buffer held instead, for symlinks and
regular files alike. The first patch fixes that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Changes in v2:
- New patch "fs: cramfs: don't ignore decompression errors": the error
  check in cramfs_read_file() could never fire, so cramfs_get_link()
  couldn't see a failed read either
- Link to v1: https://lore.barebox.org/20261102-fs-getlink-fixes-v1-0-c2816b3f5ca8@pengutronix.de

---
Sascha Hauer (4):
      fs: cramfs: don't ignore decompression errors
      fs: cramfs: return an error pointer from cramfs_get_link()
      fs: ext4: return an error pointer from ext_get_link()
      fs: legacy: return an error pointer from legacy_get_link()

 fs/cramfs/cramfs.c    | 11 +++++++----
 fs/ext4/ext_barebox.c |  3 ++-
 fs/legacy.c           |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)
---
base-commit: f2e574b9c63c6da07a06179a868cae8a471ec176
change-id: 20261102-fs-getlink-fixes-d634fd50d1f9

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




             reply	other threads:[~2026-11-02  9:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  9:31 Sascha Hauer [this message]
2026-11-02  9:31 ` [PATCH v2 1/4] fs: cramfs: don't ignore decompression errors Sascha Hauer
2026-11-02  9:34   ` Sascha Hauer
2026-11-02  9:31 ` [PATCH v2 2/4] fs: cramfs: return an error pointer from cramfs_get_link() Sascha Hauer
2026-11-02  9:31 ` [PATCH v2 3/4] fs: ext4: return an error pointer from ext_get_link() Sascha Hauer
2026-11-02  9:31 ` [PATCH v2 4/4] fs: legacy: return an error pointer from legacy_get_link() Sascha Hauer
2026-11-02 13:25 ` [PATCH v2 0/4] fs: return error pointers from ->get_link() on failure Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261102-fs-getlink-fixes-v2-0-37df92e4d0d3@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox