Skip to content

Commit

Permalink
[media] rc: Fix double free in gpio_ir_recv_probe()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jjuhl authored and Mauro Carvalho Chehab committed Dec 21, 2012
1 parent 1c12bf8 commit e5d85b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/rc/gpio-ir-recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ static int __devinit gpio_ir_recv_probe(struct platform_device *pdev)
err_request_irq:
platform_set_drvdata(pdev, NULL);
rc_unregister_device(rcdev);
rcdev = NULL;
err_register_rc_device:
err_gpio_direction_input:
gpio_free(pdata->gpio_nr);
err_gpio_request:
rc_free_device(rcdev);
rcdev = NULL;
err_allocate_device:
kfree(gpio_dev);
return rc;
Expand Down

0 comments on commit e5d85b9

Please sign in to comment.