Skip to contentSkip to conversation

mei: free read cb on ctrl_wr list flush

char-misc for v5.0 Tomas Winkler 1 participant 1 message Jan 30, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: Alexander Usyskin <[email protected]>

There is a little window during disconnection flow when read cb is moved between lists and may be not freed. Remove moving read cbs explicitly during flash fixes this memory leak.

---
 drivers/misc/mei/client.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/misc/mei/client.c +4 -1
index 1fc8ea0f519b..ca4c9cc218a2 100644
@@ -401,8 +401,11 @@ static void mei_io_list_flush_cl(struct list_head *head,
 	struct mei_cl_cb *cb, *next;
 
 	list_for_each_entry_safe(cb, next, head, list) {
-		if (cl == cb->cl)
+		if (cl == cb->cl) {
 			list_del_init(&cb->list);
+			if (cb->fop_type == MEI_FOP_READ)
+				mei_io_cb_free(cb);
+		}
 	}
 }
 
Signature · 1 line
2.20.1