Skip to content

Commit dd4e714

Browse files
jhovoldgregkh
authored andcommitted
rfkill: gpio: fix memory leak in probe error path
commit 4bf01ca upstream. Make sure to free the rfkill device in case registration fails during probe. Fixes: 5e7ca39 ("net: rfkill: gpio: convert to resource managed allocation") Cc: stable <stable@vger.kernel.org> # 3.13 Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 63e2ae9 commit dd4e714

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

net/rfkill/rfkill-gpio.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,18 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
138138

139139
ret = rfkill_register(rfkill->rfkill_dev);
140140
if (ret < 0)
141-
return ret;
141+
goto err_destroy;
142142

143143
platform_set_drvdata(pdev, rfkill);
144144

145145
dev_info(&pdev->dev, "%s device registered.\n", rfkill->name);
146146

147147
return 0;
148+
149+
err_destroy:
150+
rfkill_destroy(rfkill->rfkill_dev);
151+
152+
return ret;
148153
}
149154

150155
static int rfkill_gpio_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)