Skip to content

Commit 9046625

Browse files
JeffreyMitchellSLtyhicks
authored andcommitted
ecryptfs: fix kernel panic with null dev_name
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: 237fead ("[PATCH] ecryptfs: fs/Makefile and fs/Kconfig") Cc: [email protected] Signed-off-by: Jeffrey Mitchell <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
1 parent 7f06ecd commit 9046625

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/ecryptfs/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
492492
goto out;
493493
}
494494

495+
if (!dev_name) {
496+
rc = -EINVAL;
497+
err = "Device name cannot be null";
498+
goto out;
499+
}
500+
495501
rc = ecryptfs_parse_options(sbi, raw_data, &check_ruid);
496502
if (rc) {
497503
err = "Error parsing options";

0 commit comments

Comments
 (0)