Skip to contentSkip to conversation

iwlwifi: dbg_ini: fix memory leak in alloc_sgtable

PATCH In review Navid Emamdoost 2 participants 2 messages Sep 13, 2019 – Sep 30, 2019

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

PATCH 1/1 iwlwifi: dbg_ini: fix memory leak in alloc_sgtable

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

---
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1 -0
index 4d81776f576d..db41abb3361d 100644
@@ -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);
Signature · 1 line
2.17.1
#1 lore raw
Quoted 7 lines · Navid Emamdoost

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

---
 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.