Backport patches for e2fsprogs
Signed-off-by: tangyuchen <tangyuchen5@huawei.com> (cherry picked from commit 89d085d027f0733fbd32402f14ef00f0ae69c364)
This commit is contained in:
parent
8716a77782
commit
efa4a07b7b
@ -0,0 +1,46 @@
|
||||
From af03924f5b43b325a436d07ee1222f42e3aa96b6 Mon Sep 17 00:00:00 2001
|
||||
From: wuguanghao <wuguanghao3@huawei.com>
|
||||
Date: Wed, 30 Jun 2021 16:27:18 +0800
|
||||
Subject: [PATCH] append_pathname: check the value returned by realloc
|
||||
|
||||
In append_pathname(), we need to add a new path to save the value
|
||||
returned by realloc, otherwise the name->path may be NULL, causing
|
||||
a segfault.
|
||||
|
||||
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
|
||||
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
---
|
||||
contrib/fsstress.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/contrib/fsstress.c b/contrib/fsstress.c
|
||||
index 2a983482..2136a903 100644
|
||||
--- a/contrib/fsstress.c
|
||||
+++ b/contrib/fsstress.c
|
||||
@@ -599,6 +599,7 @@ void add_to_flist(int ft, int id, int parent)
|
||||
void append_pathname(pathname_t * name, char *str)
|
||||
{
|
||||
int len;
|
||||
+ char *path;
|
||||
|
||||
len = strlen(str);
|
||||
#ifdef DEBUG
|
||||
@@ -609,7 +610,13 @@ void append_pathname(pathname_t * name, char *str)
|
||||
|
||||
}
|
||||
#endif
|
||||
- name->path = realloc(name->path, name->len + 1 + len);
|
||||
+ path = realloc(name->path, name->len + 1 + len);
|
||||
+ if (path == NULL) {
|
||||
+ fprintf(stderr, "fsstress: append_pathname realloc failed\n");
|
||||
+ chdir(homedir);
|
||||
+ abort();
|
||||
+ }
|
||||
+ name->path = path;
|
||||
strcpy(&name->path[name->len], str);
|
||||
name->len += len;
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
From a61bc9e009b4b829f61f1717753b4ee0882d9aba Mon Sep 17 00:00:00 2001
|
||||
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
Date: Wed, 30 Jun 2021 16:27:19 +0800
|
||||
Subject: [PATCH] argv_parse: check return value of malloc in argv_parse()
|
||||
|
||||
In argv_parse(), return value of malloc should be checked
|
||||
whether it is NULL, otherwise, it may cause a segfault error.
|
||||
|
||||
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
|
||||
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
|
||||
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
|
||||
---
|
||||
lib/support/argv_parse.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/lib/support/argv_parse.c b/lib/support/argv_parse.c
|
||||
index d22f6344..1f50f9e5 100644
|
||||
--- a/lib/support/argv_parse.c
|
||||
+++ b/lib/support/argv_parse.c
|
||||
@@ -116,6 +116,8 @@ int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv)
|
||||
if (argv == 0) {
|
||||
argv = malloc(sizeof(char *));
|
||||
free(buf);
|
||||
+ if (!argv)
|
||||
+ return -1;
|
||||
}
|
||||
argv[argc] = 0;
|
||||
if (ret_argc)
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: e2fsprogs
|
||||
Version: 1.45.6
|
||||
Release: 17
|
||||
Release: 18
|
||||
Summary: Second extended file system management tools
|
||||
License: GPLv2 and LGPLv2 and GPLv2+
|
||||
URL: http://e2fsprogs.sourceforge.net/
|
||||
@ -58,6 +58,8 @@ Patch48: 0048-tune2fs-exit-directly-when-fs-freed-in-ext2fs_run_ext3_journal.pat
|
||||
Patch49: 0049-debugfs-fix-repeated-output-problem-with-logdump-O-n.patch
|
||||
Patch50: 0050-mmp-fix-wrong-comparison-in-ext2fs_mmp_stop.patch
|
||||
Patch51: 0051-misc-fsck.c-Processes-may-kill-other-processes.patch
|
||||
Patch52: 0052-append_pathname-check-the-value-returned-by-realloc.patch
|
||||
Patch53: 0053-argv_parse-check-return-value-of-malloc-in-argv_pars.patch
|
||||
|
||||
BuildRequires: gcc pkgconfig texinfo
|
||||
BuildRequires: fuse-devel libblkid-devel libuuid-devel
|
||||
@ -179,6 +181,9 @@ exit 0
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%changelog
|
||||
* Fri Apr 14 tangyuchen <tangyuchen5@huawei.com> - 1.45.6-18
|
||||
- backport 2 patches
|
||||
|
||||
* Fri Mar 31 2023 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 1.45.6-17
|
||||
- fix version error in changelog
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user