[PATCH] firmware_class: Avoid pending list corruption

From: Imran Khan
Date: Wed Jan 25 2017 - 07:46:34 EST


Remove firmware buffer from pending list when it is freed.
Once the buffer is free kmalloc can allocate the same slab
object for some other user but as the buffer is still there
in the pending list, we end up with multiple users of the
same slab object using it in different contexts.

Signed-off-by: Imran Khan <kimran@xxxxxxxxxxxxxx>
---
drivers/base/firmware_class.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 4497d26..d09c1aa 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -339,6 +339,9 @@ static void __fw_free_buf(struct kref *ref)
(unsigned int)buf->size);

list_del(&buf->list);
+#ifdef CONFIG_FW_LOADER_USER_HELPER
+ list_del(&buf->pending_list);
+#endif
spin_unlock(&fwc->lock);

#ifdef CONFIG_FW_LOADER_USER_HELPER
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project