Skip to contentSkip to conversation

proc-use-strnlen-for-name-validation-in-__proc_create.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message May 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: proc: use strnlen() for name validation in __proc_create
has been removed from the -mm tree. Its filename was
proc-use-strnlen-for-name-validation-in-__proc_create.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Thorsten Blum <[email protected]>
Subject: proc: use strnlen() for name validation in __proc_create
Date: Tue, 21 Apr 2026 14:26:47 +0200

Replace strlen(fn) with strnlen(fn, NAME_MAX + 1) when validating the final path component in __proc_create().

This preserves the existing name limit while bounding the length scan to one byte past the maximum name length. Handle empty names separately, and treat names longer than NAME_MAX as too long.

---

 fs/proc/generic.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
fs/proc/generic.c renamed from fs/proc/generic.c~proc-use-strnlen-for-name-validation-in-__proc_create +7 -3
@@ -427,9 +427,13 @@ static struct proc_dir_entry *__proc_cre
 	if (xlate_proc_name(name, parent, &fn) != 0)
 		goto out;
 	qstr.name = fn;
-	qstr.len = strlen(fn);
-	if (qstr.len == 0 || qstr.len >= 256) {
-		WARN(1, "name len %u\n", qstr.len);
+	qstr.len = strnlen(fn, NAME_MAX + 1);
+	if (qstr.len == 0) {
+		WARN(1, "empty name\n");
+		return NULL;
+	}
+	if (qstr.len > NAME_MAX) {
+		WARN(1, "name too long\n");
 		return NULL;
 	}
 	if (qstr.len == 1 && fn[0] == '.') {

_

Patches currently in -mm which might be from [email protected] are

mm-mseal-use-min-max-in-mseal_apply.patch