From: Jan Kara <jack@suse.cz>
To: Ted Tso <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>, Jan Kara <jack@suse.cz>
Subject: [PATCH 1/2] ext2fs: Fix error checking in dx_link()
Date: Mon, 30 Mar 2020 11:09:31 +0200 [thread overview]
Message-ID: <20200330090932.29445-2-jack@suse.cz> (raw)
In-Reply-To: <20200330090932.29445-1-jack@suse.cz>
dx_lookup() uses errcode_t return values. As such anything non-zero is
an error, not values less than zero. Fix the error checking to avoid
crashes on corrupted filesystems.
Signed-off-by: Jan Kara <jack@suse.cz>
---
lib/ext2fs/link.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c
index 6f523aee718c..7b5bb022117c 100644
--- a/lib/ext2fs/link.c
+++ b/lib/ext2fs/link.c
@@ -571,7 +571,7 @@ static errcode_t dx_link(ext2_filsys fs, ext2_ino_t dir,
dx_info.namelen = strlen(name);
again:
retval = dx_lookup(fs, dir, diri, &dx_info);
- if (retval < 0)
+ if (retval)
goto free_buf;
retval = add_dirent_to_buf(fs,
--
2.16.4
next prev parent reply other threads:[~2020-03-30 9:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 9:09 [PATCH 0/2] Fixes for dir_index support in libext2fs Jan Kara
2020-03-30 9:09 ` Jan Kara [this message]
2020-03-30 13:24 ` [PATCH 1/2] ext2fs: Fix error checking in dx_link() Lukas Czerner
2020-03-30 13:48 ` Lukas Czerner
2020-03-30 14:55 ` Jan Kara
2020-04-10 3:52 ` Theodore Y. Ts'o
2020-03-30 9:09 ` [PATCH 2/2] ext2fs: Fix off-by-one in dx_grow_tree() Jan Kara
2020-03-30 13:27 ` Lukas Czerner
2020-03-30 14:55 ` Jan Kara
2020-03-31 11:33 ` Lukas Czerner
2020-03-31 14:30 ` Jan Kara
2020-04-10 4:33 ` Theodore Y. Ts'o
2020-04-10 15:09 ` Jan Kara
2020-04-10 4:32 ` Theodore Y. Ts'o
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=20200330090932.29445-2-jack@suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).