From 866aebf59cbb23ba02a980b22ed19319c693ae21 Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Mon, 2 Aug 2021 07:54:03 +0800 Subject: [PATCH] - update patch "eliminate-some-more-alloca-usage" for bug 1984813. --- ...1.7-eliminate-some-more-alloca-usage.patch | 48 +++++++++++++++---- autofs.spec | 8 +++- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/autofs-5.1.7-eliminate-some-more-alloca-usage.patch b/autofs-5.1.7-eliminate-some-more-alloca-usage.patch index b4b0c46..092ef9a 100644 --- a/autofs-5.1.7-eliminate-some-more-alloca-usage.patch +++ b/autofs-5.1.7-eliminate-some-more-alloca-usage.patch @@ -6,14 +6,25 @@ Quite a bit of the alloca(3) usage has been eliminated over time. Use malloc(3) for some more cases that might need to allocate a largish amount of storage. +Signed-off-by: Ian Kent +--- + +autofs-5.1.7 - eliminate some more alloca usage + +From: Ian Kent + +Quite a bit of the alloca(3) usage has been eliminated over time. +Use malloc(3) for some more cases that might need to allocate a largish +amount of storage. + Signed-off-by: Ian Kent --- CHANGELOG | 1 + modules/lookup_program.c | 11 ++++++++++- modules/lookup_yp.c | 22 +++++++++++++++++++--- - modules/parse_sun.c | 13 +++++++++++-- - modules/replicated.c | 15 ++++----------- - 5 files changed, 45 insertions(+), 17 deletions(-) + modules/parse_sun.c | 18 ++++++++++++++---- + modules/replicated.c | 19 ++++++------------- + 5 files changed, 50 insertions(+), 21 deletions(-) --- autofs-5.1.7.orig/CHANGELOG +++ autofs-5.1.7/CHANGELOG @@ -138,15 +149,21 @@ Signed-off-by: Ian Kent memcpy(what, loc, loclen); what[loclen] = '\0'; -@@ -709,7 +716,6 @@ static int sun_mount(struct autofs_point - if (!loclen) +@@ -706,10 +713,10 @@ static int sun_mount(struct autofs_point + rv = mount_nfs->mount_mount(ap, root, name, namelen, + what, fstype, options, mount_nfs->context); + } else { +- if (!loclen) ++ if (!loclen) { ++ free(what); what = NULL; - else { +- else { - what = alloca(loclen + 1); ++ } else { if (*loc == ':') { loclen--; memcpy(what, loc + 1, loclen); -@@ -728,6 +734,9 @@ static int sun_mount(struct autofs_point +@@ -728,6 +735,9 @@ static int sun_mount(struct autofs_point /* Generic mount routine */ rv = do_mount(ap, root, name, namelen, what, fstype, options); } @@ -158,8 +175,12 @@ Signed-off-by: Ian Kent if (nonstrict && rv) --- autofs-5.1.7.orig/modules/replicated.c +++ autofs-5.1.7/modules/replicated.c -@@ -1044,22 +1044,15 @@ done: - static int add_path(struct host *hosts, const char *path, int len) +@@ -1041,25 +1041,18 @@ done: + return ret; + } + +-static int add_path(struct host *hosts, const char *path, int len) ++static int add_path(struct host *hosts, const char *path) { struct host *this; - char *tmp, *tmp2; @@ -185,3 +206,12 @@ Signed-off-by: Ian Kent } this = this->next; } +@@ -1188,7 +1181,7 @@ int parse_location(unsigned logopt, stru + } + } + +- if (!add_path(*hosts, path, strlen(path))) { ++ if (!add_path(*hosts, path)) { + free_host_list(hosts); + free(str); + return 0; diff --git a/autofs.spec b/autofs.spec index 4a395a3..ecb94f3 100644 --- a/autofs.spec +++ b/autofs.spec @@ -12,7 +12,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.1.7 -Release: 22%{?dist} +Release: 23%{?dist} Epoch: 1 License: GPLv2+ Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz @@ -356,6 +356,12 @@ fi %dir /etc/auto.master.d %changelog +* Mon Aug 02 2021 Ian Kent - 1:5.1.7-23 +- bz1984813 - autofs: FTBFS due to dynamic PTHREAD_STACK_MIN (glibc 2.34 related) + - fix potential memory leak in "eliminate some more alloca usage" patch. + - remove unused parameter from add_path() in "eliminate some more alloca usage" patch. +- Related: rhbz#1984813 + * Fri Jul 30 2021 Ian Kent - 1:5.1.7-22 - bz1984813 - autofs: FTBFS due to dynamic PTHREAD_STACK_MIN (glibc 2.34 related) - eliminate some more alloca usage.