3ad4b3ec23
rt2800lib: fix wrong -128dBm when signal is stronger than -12dBm iwlwifi: make "Tx aggregation enabled on ra =" be at DEBUG level ssb: fix cardbus slot in hostmode mac80211: timeout a single frame in the rx reorder buffer
52 lines
1.3 KiB
Diff
52 lines
1.3 KiB
Diff
From f9721ed2707661af75a414d09cdcd71f99a13f62 Mon Sep 17 00:00:00 2001
|
|
From: Jesper Juhl <jj@chaosbits.net>
|
|
Date: Sun, 29 Jan 2012 21:34:04 +0100
|
|
Subject: [PATCH] bcma: Fix mem leak in bcma_bus_scan()
|
|
|
|
bcma_bus_scan() leaks 'struct bcma_device' bytes if
|
|
bcma_get_next_core() returns error.
|
|
|
|
Restructure the code so we always kfree() the memory we allocate to
|
|
the variable 'core' before it goes out of scope.
|
|
|
|
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
|
|
Signed-off-by: John W. Linville <linville@tuxdriver.com>
|
|
---
|
|
drivers/bcma/scan.c | 19 +++++++++++--------
|
|
1 files changed, 11 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
|
|
index cad9948..3a2f672 100644
|
|
--- a/drivers/bcma/scan.c
|
|
+++ b/drivers/bcma/scan.c
|
|
@@ -399,15 +399,18 @@ int bcma_bus_scan(struct bcma_bus *bus)
|
|
core->bus = bus;
|
|
|
|
err = bcma_get_next_core(bus, &eromptr, NULL, core_num, core);
|
|
- if (err == -ENODEV) {
|
|
- core_num++;
|
|
- continue;
|
|
- } else if (err == -ENXIO)
|
|
- continue;
|
|
- else if (err == -ESPIPE)
|
|
- break;
|
|
- else if (err < 0)
|
|
+ if (err < 0) {
|
|
+ kfree(core);
|
|
+ if (err == -ENODEV) {
|
|
+ core_num++;
|
|
+ continue;
|
|
+ } else if (err == -ENXIO) {
|
|
+ continue;
|
|
+ } else if (err == -ESPIPE) {
|
|
+ break;
|
|
+ }
|
|
return err;
|
|
+ }
|
|
|
|
core->core_index = core_num++;
|
|
bus->nr_cores++;
|
|
--
|
|
1.7.4.4
|
|
|