Blame SOURCES/0010-ecryptfs-fix-kernel-panic-with-null-dev_name.patch

Kmods SIG c540c3
From 9046625511ad8dfbc8c6c2de16b3532c43d68d48 Mon Sep 17 00:00:00 2001
Kmods SIG c540c3
From: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>
Kmods SIG c540c3
Date: Fri, 26 Feb 2021 15:00:23 -0600
Kmods SIG c540c3
Subject: [Backport 9046625511ad] ecryptfs: fix kernel panic with null dev_name
Kmods SIG c540c3
Kmods SIG c540c3
When mounting eCryptfs, a null "dev_name" argument to ecryptfs_mount()
Kmods SIG c540c3
causes a kernel panic if the parsed options are valid. The easiest way to
Kmods SIG c540c3
reproduce this is to call mount() from userspace with an existing
Kmods SIG c540c3
eCryptfs mount's options and a "source" argument of 0.
Kmods SIG c540c3
Kmods SIG c540c3
Error out if "dev_name" is null in ecryptfs_mount()
Kmods SIG c540c3
Kmods SIG c540c3
Fixes: 237fead61998 ("[PATCH] ecryptfs: fs/Makefile and fs/Kconfig")
Kmods SIG c540c3
Cc: stable@vger.kernel.org
Kmods SIG c540c3
Signed-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>
Kmods SIG c540c3
Signed-off-by: Tyler Hicks <code@tyhicks.com>
Kmods SIG c540c3
---
Kmods SIG c540c3
 src/main.c | 6 ++++++
Kmods SIG c540c3
 1 file changed, 6 insertions(+)
Kmods SIG c540c3
Kmods SIG c540c3
diff --git a/src/main.c b/src/main.c
Kmods SIG c540c3
index 77b96737b1ffbdeea6d22294530e85ce05464dde..d66bbd2df191e5cf69310243a711dd341e3822c7 100644
Kmods SIG c540c3
--- a/src/main.c
Kmods SIG c540c3
+++ b/src/main.c
Kmods SIG c540c3
@@ -492,6 +492,12 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags
Kmods SIG c540c3
 		goto out;
Kmods SIG c540c3
 	}
Kmods SIG c540c3
 
Kmods SIG c540c3
+	if (!dev_name) {
Kmods SIG c540c3
+		rc = -EINVAL;
Kmods SIG c540c3
+		err = "Device name cannot be null";
Kmods SIG c540c3
+		goto out;
Kmods SIG c540c3
+	}
Kmods SIG c540c3
+
Kmods SIG c540c3
 	rc = ecryptfs_parse_options(sbi, raw_data, &check_ruid);
Kmods SIG c540c3
 	if (rc) {
Kmods SIG c540c3
 		err = "Error parsing options";
Kmods SIG c540c3
-- 
Kmods SIG c540c3
2.31.1
Kmods SIG c540c3