aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2008-11-25 08:57:30 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-21 13:27:01 -0500
commite5d85b9ac3133f67460ea5b2d4e33e0473d6eb4b (patch)
tree25824286f481b5878e71e345bc2a60eeb0c23300
parent1c12bf8de7e1557afeedd55d9bcec6b6a6d7b5d1 (diff)
[media] rc: Fix double free in gpio_ir_recv_probe()
At the 'err_request_irq' label, rc_unregister_device(rcdev) frees its argument. So when we fall through to the 'err_gpio_request' label further down and call rc_free_device(rcdev) then that's a double free. Fix that by moving 'rcdev = NULL' from after the call to rc_free_device() to after rc_unregister_device(). That fixes the problem since rc_free_device() just does nothing if passed NULL and there's no further use of 'rcdev' after the call to rc_free_device() so it's not needed there. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/rc/gpio-ir-recv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index ba1a1eb356cf..32db5f59fbc3 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -129,12 +129,12 @@ static int __devinit gpio_ir_recv_probe(struct platform_device *pdev)
129err_request_irq: 129err_request_irq:
130 platform_set_drvdata(pdev, NULL); 130 platform_set_drvdata(pdev, NULL);
131 rc_unregister_device(rcdev); 131 rc_unregister_device(rcdev);
132 rcdev = NULL;
132err_register_rc_device: 133err_register_rc_device:
133err_gpio_direction_input: 134err_gpio_direction_input:
134 gpio_free(pdata->gpio_nr); 135 gpio_free(pdata->gpio_nr);
135err_gpio_request: 136err_gpio_request:
136 rc_free_device(rcdev); 137 rc_free_device(rcdev);
137 rcdev = NULL;
138err_allocate_device: 138err_allocate_device:
139 kfree(gpio_dev); 139 kfree(gpio_dev);
140 return rc; 140 return rc;