Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] MEDIA: ttusbir, fix double free

rc_unregister_device already calls rc_free_device to free the passed
device. But in one of ttusbir's probe fail paths, we call
rc_unregister_device _and_ rc_free_device. This is wrong and results
in a double free.
Instead, set rc to NULL resulting in rc_free_device being a noop.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Jiri Slaby and committed by
Mauro Carvalho Chehab
a9bd87c2 fde04ab9

+1
+1
drivers/media/rc/ttusbir.c
··· 347 347 return 0; 348 348 out3: 349 349 rc_unregister_device(rc); 350 + rc = NULL; 350 351 out2: 351 352 led_classdev_unregister(&tt->led); 352 353 out: