]> Git Repo - linux.git/commitdiff
ecryptfs: fix kernel panic with null dev_name
authorJeffrey Mitchell <[email protected]>
Fri, 26 Feb 2021 21:00:23 +0000 (15:00 -0600)
committerTyler Hicks <[email protected]>
Mon, 19 Apr 2021 05:50:32 +0000 (05:50 +0000)
When mounting eCryptfs, a null "dev_name" argument to ecryptfs_mount()
causes a kernel panic if the parsed options are valid. The easiest way to
reproduce this is to call mount() from userspace with an existing
eCryptfs mount's options and a "source" argument of 0.

Error out if "dev_name" is null in ecryptfs_mount()

Fixes: 237fead61998 ("[PATCH] ecryptfs: fs/Makefile and fs/Kconfig")
Cc: [email protected]
Signed-off-by: Jeffrey Mitchell <[email protected]>
Signed-off-by: Tyler Hicks <[email protected]>
fs/ecryptfs/main.c

index 77b96737b1ffbdeea6d22294530e85ce05464dde..d66bbd2df191e5cf69310243a711dd341e3822c7 100644 (file)
@@ -492,6 +492,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
                goto out;
        }
 
+       if (!dev_name) {
+               rc = -EINVAL;
+               err = "Device name cannot be null";
+               goto out;
+       }
+
        rc = ecryptfs_parse_options(sbi, raw_data, &check_ruid);
        if (rc) {
                err = "Error parsing options";
This page took 0.056415 seconds and 4 git commands to generate.