Skip to contentSkip to conversation

FAILED: patch "[PATCH] firmware: Always initialize the fw_priv list object" failed to apply to 4.9-stable tree

PATCH [email protected] 1 participant 1 message Oct 9, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 7012040576c6ae25a47035659ee48673612c2c27 Mon Sep 17 00:00:00 2001

From: Bjorn Andersson <[email protected]>
Date: Wed, 19 Sep 2018 18:09:38 -0700
Subject: [PATCH] firmware: Always initialize the fw_priv list object

When freeing the fw_priv the item is taken off the list. This causes an oops in the FW_OPT_NOCACHE case as the list object is not initialized.

Make sure to initialize the list object regardless of this flag.

Fixes 422b3db2a503 ("firmware: Fix security issue with request_firmware_into_buf()")
Cc Rishabh Bhatnagar <[email protected]>
drivers/base/firmware_loader/main.c +5 -2
index b3c0498ee433..8e9213b36e31 100644
@@ -226,8 +226,11 @@ static int alloc_lookup_fw_priv(const char *fw_name,
 	}
 
 	tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size);
-	if (tmp && !(opt_flags & FW_OPT_NOCACHE))
-		list_add(&tmp->list, &fwc->head);
+	if (tmp) {
+		INIT_LIST_HEAD(&tmp->list);
+		if (!(opt_flags & FW_OPT_NOCACHE))
+			list_add(&tmp->list, &fwc->head);
+	}
 	spin_unlock(&fwc->lock);
 
 	*fw_priv = tmp;