This is a note to let you know that I've just added the patch titled cifs: use the correct max-length for dentry_path_raw() to the 5.13-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cifs-use-the-correct-max-length-for-dentry_path_raw.patch and it can be found in the queue-5.13 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 981567bd965329df7e64b13e92a54da816c1e0a4 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> Date: Tue, 10 Aug 2021 16:33:55 +1000 Subject: cifs: use the correct max-length for dentry_path_raw() From: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> commit 981567bd965329df7e64b13e92a54da816c1e0a4 upstream. RHBZ: 1972502 PATH_MAX is 4096 but PAGE_SIZE can be >4096 on some architectures such as ppc and would thus write beyond the end of the actual object. Cc: <stable@xxxxxxxxxxxxxxx> Reported-by: Xiaoli Feng <xifeng@xxxxxxxxxx> Suggested-by: Brian foster <bfoster@xxxxxxxxxx> Reviewed-by: Paulo Alcantara (SUSE) <pc@xxxxxx> Signed-off-by: Ronnie Sahlberg <lsahlber@xxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/cifs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -112,7 +112,7 @@ build_path_from_dentry_optional_prefix(s if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) pplen = cifs_sb->prepath ? strlen(cifs_sb->prepath) + 1 : 0; - s = dentry_path_raw(direntry, page, PAGE_SIZE); + s = dentry_path_raw(direntry, page, PATH_MAX); if (IS_ERR(s)) return s; if (!s[1]) // for root we want "", not "/" Patches currently in stable-queue which might be from lsahlber@xxxxxxxxxx are queue-5.13/cifs-use-the-correct-max-length-for-dentry_path_raw.patch