- update patch "eliminate-some-more-alloca-usage" for bug 1984813.

This commit is contained in:
Ian Kent 2021-08-02 07:54:03 +08:00
parent 03cd024ae2
commit 866aebf59c
2 changed files with 46 additions and 10 deletions

View File

@ -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 <raven@themaw.net>
---
autofs-5.1.7 - eliminate some more alloca usage
From: Ian Kent <raven@themaw.net>
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 <raven@themaw.net>
---
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 <raven@themaw.net>
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 <raven@themaw.net>
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 <raven@themaw.net>
}
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;

View File

@ -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 <ikent@redhat.com> - 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 <ikent@redhat.com> - 1:5.1.7-22
- bz1984813 - autofs: FTBFS due to dynamic PTHREAD_STACK_MIN (glibc 2.34 related)
- eliminate some more alloca usage.