mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH 2/4] erofs: fix incorrect early exits in volume label handling
Date: Mon, 29 Dec 2025 17:29:47 +0800	[thread overview]
Message-ID: <20251229092949.2316075-2-hsiangkao@linux.alibaba.com> (raw)
In-Reply-To: <20251229092949.2316075-1-hsiangkao@linux.alibaba.com>

Crafted EROFS images containing valid volume labels can trigger
incorrect early returns, leading to folio reference leaks.

However, this does not cause system crashes or other severe issues.

Fixes: 1cf12c717741 ("erofs: Add support for FS_IOC_GETFSLABEL")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/super.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 2e4d0ea2ffa1..0d4f736ae1f1 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -347,8 +347,10 @@ static int erofs_read_superblock(struct super_block *sb)
 	if (dsb->volume_name[0]) {
 		sbi->volume_name = kstrndup(dsb->volume_name,
 					    sizeof(dsb->volume_name), GFP_KERNEL);
-		if (!sbi->volume_name)
-			return -ENOMEM;
+		if (!sbi->volume_name) {
+			ret = -ENOMEM;
+			goto out;
+		}
 	}
 
 	/* parse on-disk compression configurations */
-- 
2.43.5


  reply	other threads:[~2025-12-29  9:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29  9:29 [PATCH 1/4] erofs: fix incorrect early exits for invalid metabox-enabled images Gao Xiang
2025-12-29  9:29 ` Gao Xiang [this message]
2026-01-22  9:07   ` [PATCH 2/4] erofs: fix incorrect early exits in volume label handling Chao Yu
2025-12-29  9:29 ` [PATCH 3/4] erofs: unexport erofs_getxattr() Gao Xiang
2026-01-22  9:07   ` Chao Yu
2025-12-29  9:29 ` [PATCH 4/4] erofs: unexport erofs_xattr_prefix() Gao Xiang
2025-12-31  4:57   ` [PATCH v2 " Gao Xiang
2026-01-22  9:08     ` Chao Yu
2026-01-22  9:06 ` [PATCH 1/4] erofs: fix incorrect early exits for invalid metabox-enabled images Chao Yu
2026-01-22  9:17   ` Gao Xiang

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=20251229092949.2316075-2-hsiangkao@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®