diff options
author | Julia Lawall <julia@diku.dk> | 2009-12-22 15:31:23 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:33 -0500 |
commit | ed0ee8e1fbab49b494ef2994be92e7832dd6673c (patch) | |
tree | c162c47226806b6dc5ca25821ce58b9856764dfc | |
parent | e0572325d23b8c89930a08e0b8b3850a6fe75d7d (diff) |
V4L/DVB (13948): radio: Correct use after free
It is not clear how to share the unlock in the case where the structure
containing the lock has to be freed. So the unlock is now duplicated, with
one copy moved before the free. The unlock label furthermore is no longer
useful and is thus deleted.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,e;
identifier f;
iterator I;
statement S;
@@
*kfree(x);
... when != &x
when != x = e
when != I(x,...) S
*x->f
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/radio/si470x/radio-si470x-usb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index a96e1b9dd646..a0a79c70dd5b 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c | |||
@@ -590,8 +590,9 @@ int si470x_fops_release(struct file *file) | |||
590 | video_unregister_device(radio->videodev); | 590 | video_unregister_device(radio->videodev); |
591 | kfree(radio->int_in_buffer); | 591 | kfree(radio->int_in_buffer); |
592 | kfree(radio->buffer); | 592 | kfree(radio->buffer); |
593 | mutex_unlock(&radio->disconnect_lock); | ||
593 | kfree(radio); | 594 | kfree(radio); |
594 | goto unlock; | 595 | goto done; |
595 | } | 596 | } |
596 | 597 | ||
597 | /* cancel read processes */ | 598 | /* cancel read processes */ |
@@ -601,7 +602,6 @@ int si470x_fops_release(struct file *file) | |||
601 | retval = si470x_stop(radio); | 602 | retval = si470x_stop(radio); |
602 | usb_autopm_put_interface(radio->intf); | 603 | usb_autopm_put_interface(radio->intf); |
603 | } | 604 | } |
604 | unlock: | ||
605 | mutex_unlock(&radio->disconnect_lock); | 605 | mutex_unlock(&radio->disconnect_lock); |
606 | done: | 606 | done: |
607 | return retval; | 607 | return retval; |