From 90396a4a4cbf73d46f7a23757c31e643ef2a1db6 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mar 20 2024 01:33:02 +0000 Subject: NFS: Fix an off by one in root_nfs_cat() (git-fixes). --- diff --git a/patches.suse/NFS-Fix-an-off-by-one-in-root_nfs_cat.patch b/patches.suse/NFS-Fix-an-off-by-one-in-root_nfs_cat.patch new file mode 100644 index 0000000..cc567cb --- /dev/null +++ b/patches.suse/NFS-Fix-an-off-by-one-in-root_nfs_cat.patch @@ -0,0 +1,36 @@ +From: Christophe JAILLET +Date: Sun, 18 Feb 2024 22:16:53 +0100 +Subject: [PATCH] NFS: Fix an off by one in root_nfs_cat() +Git-commit: 698ad1a538da0b6bf969cfee630b4e3a026afb87 +Patch-mainline: v6.9-rc1 +References: git-fixes + +The intent is to check if 'dest' is truncated or not. So, >= should be +used instead of >, because strlcat() returns the length of 'dest' and 'src' +excluding the trailing NULL. + +Fixes: 56463e50d1fc ("NFS: Use super.c for NFSROOT mount option parsing") +Signed-off-by: Christophe JAILLET +Reviewed-by: Benjamin Coddington +Signed-off-by: Trond Myklebust +Acked-by: NeilBrown + +--- + fs/nfs/nfsroot.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/nfs/nfsroot.c ++++ b/fs/nfs/nfsroot.c +@@ -175,10 +175,10 @@ static int __init root_nfs_cat(char *des + size_t len = strlen(dest); + + if (len && dest[len - 1] != ',') +- if (strlcat(dest, ",", destlen) > destlen) ++ if (strlcat(dest, ",", destlen) >= destlen) + return -1; + +- if (strlcat(dest, src, destlen) > destlen) ++ if (strlcat(dest, src, destlen) >= destlen) + return -1; + return 0; + } diff --git a/series.conf b/series.conf index 160e554..c97061b 100644 --- a/series.conf +++ b/series.conf @@ -45694,6 +45694,7 @@ patches.suse/net-sunrpc-Fix-an-off-by-one-in-rpc_sockaddr2uaddr.patch patches.suse/NFSv4.2-fix-nfs4_listxattr-kernel-BUG-at-mm-usercopy.patch patches.suse/NFSv4.2-fix-listxattr-maximum-XDR-buffer-size.patch + patches.suse/NFS-Fix-an-off-by-one-in-root_nfs_cat.patch # jejb/scsi for-next patches.suse/scsi-lpfc-Initialize-status-local-variable-in-lpfc_s.patch