From: Anatoly Pugachev <matorola@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] libext2fs: Extends commit c9a8c53b, with the same fix for ext2fs_flush2() and ext2fs_image_super_write() on a Big Endian systems.
Date: Fri, 10 Jan 2020 11:52:17 +0300 [thread overview]
Message-ID: <20200110085217.GA7307@yogzotot> (raw)
libext2fs: extends commit c9a8c53b, with the same fix for ext2fs_flush2() and
ext2fs_image_super_write() on a Big Endian systems.
As follow-up to previous discussion 'dumpe2fs / mke2fs sigserv on sparc64'
Used find for files which refer to:
e2fsprogs.git$ find . -name \*.c | xargs grep -cl 'gdp = ext2fs_group_desc'
./lib/ext2fs/closefs.c
./lib/ext2fs/openfs.c
./lib/ext2fs/imager.c
And applied the same check for a null pointer.
Tested on a debian linux with sparc64 LDOM and ppc64 LPAR.
Fixes sigserv with test suite in "i_bitmaps" test.
Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/ext2fs/closefs.c | 3 ++-
lib/ext2fs/imager.c | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 1d4d5b7f..58fdd5c6 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -339,7 +339,8 @@ errcode_t ext2fs_flush2(ext2_filsys fs, int flags)
ext2fs_swap_super(super_shadow);
for (j = 0; j < fs->group_desc_count; j++) {
gdp = ext2fs_group_desc(fs, group_shadow, j);
- ext2fs_swap_group_desc2(fs, gdp);
+ if (gdp)
+ ext2fs_swap_group_desc2(fs, gdp);
}
#else
super_shadow = fs->super;
diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c
index 7fd06f74..b40fd826 100644
--- a/lib/ext2fs/imager.c
+++ b/lib/ext2fs/imager.c
@@ -245,7 +245,8 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
gdp = (struct ext2_group_desc *) cp;
for (j=0; j < groups_per_block*fs->desc_blocks; j++) {
gdp = ext2fs_group_desc(fs, fs->group_desc, j);
- ext2fs_swap_group_desc2(fs, gdp);
+ if (gdp)
+ ext2fs_swap_group_desc2(fs, gdp);
}
#endif
@@ -257,7 +258,8 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd,
gdp = (struct ext2_group_desc *) cp;
for (j=0; j < groups_per_block*fs->desc_blocks; j++) {
gdp = ext2fs_group_desc(fs, fs->group_desc, j);
- ext2fs_swap_group_desc2(fs, gdp);
+ if (gdp)
+ ext2fs_swap_group_desc2(fs, gdp);
}
#endif
--
2.25.0.rc1
next reply other threads:[~2020-01-10 8:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 8:52 Anatoly Pugachev [this message]
2020-01-10 17:34 ` [PATCH] libext2fs: Extends commit c9a8c53b, with the same fix for ext2fs_flush2() and ext2fs_image_super_write() on a Big Endian systems Theodore Y. Ts'o
2020-01-11 0:13 ` Anatoly Pugachev
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=20200110085217.GA7307@yogzotot \
--to=matorola@gmail.com \
--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