Skip to contentSkip to conversation

liveupdate-luo_file-dont-use-invalid-list-iterator.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Dec 9, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: liveupdate: luo_file: don't use invalid list iterator
has been removed from the -mm tree. Its filename was
liveupdate-luo_file-dont-use-invalid-list-iterator.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: Dan Carpenter <[email protected]>
Subject: liveupdate: luo_file: don't use invalid list iterator
Date: Fri, 28 Nov 2025 10:17:07 +0300

If we exit a list_for_each_entry() without hitting a break then the list iterator points to an offset from the list_head. It's a non-NULL but invalid pointer and dereferencing it isn't allowed.

Introduce a new "found" variable to test instead.

---

 kernel/liveupdate/luo_file.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/liveupdate/luo_file.c renamed from kernel/liveupdate/luo_file.c~liveupdate-luo_file-dont-use-invalid-list-iterator +5 -2
@@ -561,17 +561,20 @@ int luo_retrieve_file(struct luo_file_se
 {
 	struct liveupdate_file_op_args args = {0};
 	struct luo_file *luo_file;
+	bool found = false;
 	int err;
 
 	if (list_empty(&file_set->files_list))
 		return -ENOENT;
 
 	list_for_each_entry(luo_file, &file_set->files_list, list) {
-		if (luo_file->token == token)
+		if (luo_file->token == token) {
+			found = true;
 			break;
+		}
 	}
 
-	if (luo_file->token != token)
+	if (!found)
 		return -ENOENT;
 
 	guard(mutex)(&luo_file->mutex);

_

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