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

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