summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2023-09-20 04:28:16 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2024-02-25 08:10:32 +0100
commit0511fdb4a378183ca18a9678d3d9044c8ec592c2 (patch)
tree55e72a5e51f4d63220b8887f66a717c850d3206c /fs
parentfuse: fix UAF in rcu pathwalks (diff)
downloadlinux-0511fdb4a378183ca18a9678d3d9044c8ec592c2.tar.xz
linux-0511fdb4a378183ca18a9678d3d9044c8ec592c2.zip
cifs_get_link(): bail out in unsafe case
->d_revalidate() bails out there, anyway. It's not enough to prevent getting into ->get_link() in RCU mode, but that could happen only in a very contrieved setup. Not worth trying to do anything fancy here unless ->d_revalidate() stops kicking out of RCU mode at least in some cases. Reviewed-by: Christian Brauner <brauner@kernel.org> Acked-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/client/cifsfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index e902de4e475a..630e74628dfe 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1172,6 +1172,9 @@ const char *cifs_get_link(struct dentry *dentry, struct inode *inode,
{
char *target_path;
+ if (!dentry)
+ return ERR_PTR(-ECHILD);
+
target_path = kmalloc(PATH_MAX, GFP_KERNEL);
if (!target_path)
return ERR_PTR(-ENOMEM);