summaryrefslogtreecommitdiff
path: root/fs/ntfs3/namei.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-17 11:54:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-17 11:54:00 +0200
commit163435e5510875336ec4120883b71380533e001d (patch)
treeea087eddb8cdf3aef685890d9c07366583b33916 /fs/ntfs3/namei.c
parent11dd1b7778d07f6a9e8996e68e1fc6e175352ecb (diff)
parentfa74641fb6b93a19ccb50579886ecc98320230f9 (diff)
downloadlinux-stable-163435e5510875336ec4120883b71380533e001d.tar.gz
Merge v6.1.29linux-rolling-lts
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ntfs3/namei.c')
-rw-r--r--fs/ntfs3/namei.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index bc22cc321a74..a9549e73081f 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -86,6 +86,16 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry,
__putname(uni);
}
+ /*
+ * Check for a null pointer
+ * If the MFT record of ntfs inode is not a base record, inode->i_op can be NULL.
+ * This causes null pointer dereference in d_splice_alias().
+ */
+ if (!IS_ERR_OR_NULL(inode) && !inode->i_op) {
+ iput(inode);
+ inode = ERR_PTR(-EINVAL);
+ }
+
return d_splice_alias(inode, dentry);
}