- add fix for bug 2145251.

This commit is contained in:
Ian Kent 2022-11-30 10:30:36 +08:00
parent 4c6235a8ea
commit 270e1fdc3e
2 changed files with 97 additions and 1 deletions

View File

@ -0,0 +1,88 @@
autofs-5.1.8 - fix minus only option handling in concat_options()
From: Ian Kent <raven@themaw.net>
While a '-' alone isn't strictly valid it hadn't previously cuased a
parse error. So commit 9047e91ffa69 (autofs-5.1.7 - fix concat_options()
error handling) introduced a regression by no longer allowing this.
Fix this regression by only failing if errno is set to a non-zero value
on return from concat_options() as well as returning NULL.
Fixes: 9047e91ffa69 (autofs-5.1.7 - fix concat_options() error handling)
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_sun.c | 25 +++++++++++++++++++------
2 files changed, 20 insertions(+), 6 deletions(-)
--- autofs-5.1.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -110,6 +110,7 @@
- fix hosts map deadlock on restart.
- fix deadlock with hosts map reload.
- fix memory leak in update_hosts_mounts().
+- fix minus only option handling in concat_options().
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/modules/parse_sun.c
+++ autofs-5.1.7/modules/parse_sun.c
@@ -376,10 +376,16 @@ static int do_init(int argc, const char
if (gbl_options) {
append_options = defaults_get_append_options();
if (append_options) {
- char *tmp = concat_options(gbl_options, ctxt->optstr);
+ char *tmp;
+
+ errno = 0;
+ tmp = concat_options(gbl_options, ctxt->optstr);
if (!tmp) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr(MODPREFIX "concat_options: %s", estr);
+ /* Ignore non-error NULL return */
+ if (errno) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ logerr(MODPREFIX "concat_options: %s", estr);
+ }
/* freed in concat_options */
ctxt->optstr = NULL;
} else
@@ -1007,9 +1013,12 @@ static int parse_mapent(const char *ent,
free(myoptions);
myoptions = newopt;
} else if (newopt) {
+ errno = 0;
tmp = concat_options(myoptions, newopt);
- if (!tmp) {
+ /* Ignore non-error NULL return */
+ if (!tmp && errno) {
char *estr;
+
estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(logopt, MODPREFIX
"concat_options: %s", estr);
@@ -1381,8 +1390,10 @@ dont_expand:
free(mnt_options);
mnt_options = noptions;
} else if (noptions) {
+ errno = 0;
tmp = concat_options(mnt_options, noptions);
- if (!tmp) {
+ /* Ignore non-error NULL return */
+ if (!tmp && errno) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt,
MODPREFIX "concat_options: %s", estr);
@@ -1406,8 +1417,10 @@ dont_expand:
free(options);
options = mnt_options;
} else if (mnt_options) {
+ errno = 0;
tmp = concat_options(options, mnt_options);
- if (!tmp) {
+ /* Ignore non-error NULL return */
+ if (!tmp && errno) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, MODPREFIX "concat_options: %s", estr);
free(pmapent);

View File

@ -12,7 +12,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.7
Release: 34%{?dist}
Release: 35%{?dist}
Epoch: 1
License: GPLv2+
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz
@ -136,6 +136,7 @@ Patch108: autofs-5.1.8-coverity-fix-for-invalid-access.patch
Patch109: autofs-5.1.8-fix-hosts-map-deadlock-on-restart.patch
Patch110: autofs-5.1.8-fix-deadlock-with-hosts-map-reload.patch
Patch111: autofs-5.1.8-fix-memory-leak-in-update_hosts_mounts.patch
Patch112: autofs-5.1.8-fix-minus-only-option-handling-in-concat_options.patch
%if %{with_systemd}
BuildRequires: systemd-units
@ -316,6 +317,7 @@ echo %{version}-%{release} > .version
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%build
LDFLAGS=-Wl,-z,now
@ -424,6 +426,12 @@ fi
%dir /etc/auto.master.d
%changelog
* Wed Nov 30 2022 Ian Kent <ikent@redhat.com> - 1:5.1.7-35
- bz2145251 - RHEL9: automount does not handle null option string after
"-" anymore
- fix minus only option handling in concat_options().
- Resolves: rhbz#2145251
* Tue Nov 29 2022 Ian Kent <ikent@redhat.com> - 1:5.1.7-34
- bz2147491 - segfault due to lookup_mod->context address being freed
and reused while multiple threads were using it