Skip to contentSkip to conversation

pinctrl: bcm2835: Fix memory leak in error path

PATCH New Stefan Wahren 3 participants 3 messages Dec 21, 2015 – Dec 22, 2015

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

PATCH 1/1 pinctrl: bcm2835: Fix memory leak in error path

In case of an invalid pin value bcm2835_pctl_dt_node_to_map() would leak the pull configs of already assigned pins. So avoid this by calling the free map function in error case.

Fixes e1b2dc70cd5b ("pinctrl: add bcm2835 driver")
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/bcm/pinctrl-bcm2835.c +1 -1
index 2e6ca69..75b0d8c 100644
@@ -795,7 +795,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
 	return 0;
 
 out:
-	kfree(maps);
+	bcm2835_pctl_dt_free_map(pctldev, maps, num_pins * maps_per_pin);
 	return err;
 }
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 pinctrl: bcm2835: Fix memory leak in error path

Quoted 6 lines · Stefan Wahren

In case of an invalid pin value bcm2835_pctl_dt_node_to_map() would leak the pull configs of already assigned pins. So avoid this by calling the free map function in error case.

Fixes e1b2dc70cd5b ("pinctrl: add bcm2835 driver")

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151221/dfe30daf/attachment.sig>

#2 lore raw

PATCH 1/1 pinctrl: bcm2835: Fix memory leak in error path

In reply to Stefan Wahren
Quoted 6 lines · Stefan Wahren

In case of an invalid pin value bcm2835_pctl_dt_node_to_map() would leak the pull configs of already assigned pins. So avoid this by calling the free map function in error case.

Fixes e1b2dc70cd5b ("pinctrl: add bcm2835 driver")

Patch applied with Eric's Review tag.

Yours,
Linus Walleij