From a3df1e65d03113823612cd93499aa72f1563d962 Mon Sep 17 00:00:00 2001 From: linqiheng Date: Tue, 10 Jan 2023 07:42:46 +0000 Subject: [PATCH] hmdfs: fix nullptr dereference of kern_path(dev_name) in hmdfs_fill_super Signed-off-by: linqiheng --- fs/hmdfs/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/hmdfs/main.c b/fs/hmdfs/main.c index d0a41061bb2f..4ba5a84d9a3f 100644 --- a/fs/hmdfs/main.c +++ b/fs/hmdfs/main.c @@ -954,6 +954,10 @@ static struct dentry *hmdfs_mount(struct file_system_type *fs_type, int flags, .dev_name = dev_name, .raw_data = raw_data, }; + + /* hmdfs needs a valid dev_name to get the lower_sb's metadata */ + if (!dev_name || !*dev_name) + return ERR_PTR(-EINVAL); return mount_nodev(fs_type, flags, &priv, hmdfs_fill_super); } -- Gitee