diff --git a/0007-exportfs-fix-unexporting-of-root.patch b/0007-exportfs-fix-unexporting-of-root.patch new file mode 100644 index 0000000000000000000000000000000000000000..6697b57ca208406c5753574b5826ba02773671d5 --- /dev/null +++ b/0007-exportfs-fix-unexporting-of-root.patch @@ -0,0 +1,49 @@ +From ac266e2edc4f40eef810d52c72657b645e4010db Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Tue, 6 Apr 2021 15:57:37 -0400 +Subject: [PATCH] exportfs: fix unexporting of '/' + +The code that has been added to strip trailing slashes from path in +unexportfs_parsed() forgot to account for the case of the root +directory, which is simply '/'. In that case it accesses path[-1] and +reduces the path to an empty string, which then fails to match any +export. + +Fix it by stopping the stripping when the path is just a single +character - it doesn't matter if it's a '/' or not, we want to keep it +either way in that case. + +Reproducer: + + exportfs localhost:/ + exportfs -u localhost:/ + +Without this patch, the unexport step fails with "exportfs: Could not +find 'localhost:/' to unexport." + +Fixes: a9a7728d8743 ("exportfs: Deal with path's trailing "/" in unexportfs_parsed()") +Link: https://bugzilla.redhat.com/show_bug.cgi?id=1941171 + +Signed-off-by: Ondrej Mosnacek +Signed-off-by: Steve Dickson +Reference:https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=patch;h=ac266e2edc4f40eef810d52c72657b645e4010db +--- + utils/exportfs/exportfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index a04a789..6f17c22 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -365,7 +365,7 @@ unexportfs_parsed(char *hname, char *path, int verbose) + * so need to deal with it. + */ + size_t nlen = strlen(path); +- while (path[nlen - 1] == '/') ++ while ((nlen > 1) && (path[nlen - 1] == '/')) + nlen--; + + for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) { +-- +2.27.0 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 941e13749340694fa620a3499215c097ab00fd2b..99c30ebfad7fa9584d943892a9632980c1e0fa35 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -4,7 +4,7 @@ Name: nfs-utils Version: 2.5.1 -Release: 9 +Release: 10 Epoch: 1 Summary: The Linux NFS userland utility package License: MIT and GPLv2 and GPLv2+ and BSD @@ -19,6 +19,7 @@ Patch3: 0003-nfs-utils-set-use-gss-proxy-1-to-enable-gss-proxy-by.patch Patch4: 0004-nfs-blkmaped-Fix-the-error-status-when-nfs_blkmapd-s.patch Patch5: 0005-nfs-blkmapd-PID-file-read-by-systemd-failed.patch Patch6: 0006-gssd-fix-the-possible-buffer-overflow-in-get_full_hostname.patch +Patch7: 0007-exportfs-fix-unexporting-of-root.patch BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 @@ -227,6 +228,9 @@ fi %{_mandir}/*/* %changelog +* Sun Sep 28 2025 zhangyaqi - 1:2.5.1-10 +- exportfs: fix unexporting of '/' + * Fri Sep 26 2025 zhangyaqi - 1:2.5.1-9 - gssd:fix the possible buffer overflow in get_full_hostname