Thread (3 messages) flat view 3 messages, 3 authors, 2016-12-18

RE: [PATCH] qed: fix memory leak of a qed_spq_entry on error failure paths

From: Mintz, Yuval <hidden>
Date: 2016-12-18 06:49:24
Also in: lkml

From: Colin Ian King <redacted>

A qed_spq_entry entry is allocated by qed_sp_init_request but is not kfree'd
if an error occurs, causing a memory leak. Fix this by kfree'ing it and also
setting *pp_ent to NULL to be safe.

Found with static analysis by CoverityScan, CIDs 1389468-1389470

Signed-off-by: Colin Ian King <redacted>
...
+err:
+	kfree(*pp_ent);
+	*pp_ent = NULL;
+
+	return rc;
 }
Hi Colin - thanks for this.
It would have been preferable to return the previously allocated spq entry.
I.e., do:

+err:
+	qed_spq_return_entry(p_hwfn, *pp_ent);
+	*pp_ent = NULL;
+	return rc;

Thanks,
Yuval
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help