[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131211012040.30655.381.stgit@birch.djwong.org>
Date: Tue, 10 Dec 2013 17:20:40 -0800
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: tytso@....edu, darrick.wong@...cle.com
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 21/74] e4defrag: don't crash if umounts the filesystem races
with us
If someone umounts the filesystem between statfs64 and the getmntent()
iteration, we can exit the loop having never set mnt_type, and strcmp
can crash. Fix the potential NULL deref.
Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
misc/e4defrag.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/e4defrag.c b/misc/e4defrag.c
index 4b31d03..b6e2e31 100644
--- a/misc/e4defrag.c
+++ b/misc/e4defrag.c
@@ -374,7 +374,7 @@ static int is_ext4(const char *file, char *devname)
}
endmntent(fp);
- if (strcmp(mnt_type, FS_EXT4) == 0) {
+ if (mnt_type && strcmp(mnt_type, FS_EXT4) == 0) {
FREE(mnt_type);
return 0;
} else {
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists