[PATCH] iwlwifi: dbg_ini: fix memory leak in alloc_sgtable

Subsystems: intel wireless wifi link (iwlwifi), the rest

STALE2548d

2 messages, 2 authors, 2019-09-30 · open the first message on its own page

[PATCH] iwlwifi: dbg_ini: fix memory leak in alloc_sgtable

From: Navid Emamdoost <hidden>
Date: 2019-09-13 04:23:56

In alloc_sgtable if alloc_page fails, the alocated table should be
released.

Signed-off-by: Navid Emamdoost <redacted>
---
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
index 4d81776f576d..db41abb3361d 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
@@ -643,6 +643,7 @@ static struct scatterlist *alloc_sgtable(int size)
 				if (new_page)
 					__free_page(new_page);
 			}
+			kfree(table);
 			return NULL;
 		}
 		alloc_size = min_t(int, size, PAGE_SIZE);
-- 
2.17.1

Re: [PATCH] iwlwifi: dbg_ini: fix memory leak in alloc_sgtable

From: Luca Coelho <hidden>
Date: 2019-09-30 06:25:27

On Thu, 2019-09-12 at 23:23 -0500, Navid Emamdoost wrote:
In alloc_sgtable if alloc_page fails, the alocated table should be
released.

Signed-off-by: Navid Emamdoost <redacted>
---
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 1 +
 1 file changed, 1 insertion(+)
Thanks, Navid! I have applied this to our internal tree and it will
reach the mainline following our usual upstreaming process.

--
Cheers,
Luca.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help