From c3fe0caea51f47a9b4aa6620afc1df1c227daec0 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mar 25 2024 01:19:36 +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..71e8c93 --- /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 +@@ -168,10 +168,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 63d74d3..d2cffa2 100644 --- a/series.conf +++ b/series.conf @@ -65023,6 +65023,7 @@ patches.suse/NFSD-Reset-cb_seq_status-after-NFS4ERR_DELAY.patch patches.suse/NFSD-Retransmit-callbacks-after-client-reconnects.patch patches.suse/net-sunrpc-Fix-an-off-by-one-in-rpc_sockaddr2uaddr.patch + patches.suse/NFS-Fix-an-off-by-one-in-root_nfs_cat.patch # dhowells/linux-fs keys-uefi patches.suse/0001-KEYS-Allow-unrestricted-boot-time-addition-of-keys-t.patch