[PATCH 2/6] drivers/media/radio: Correct use after free

From: Julia Lawall
Date: Tue Dec 22 2009 - 15:31:34 EST

From: Julia Lawall <julia@xxxxxxx>

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;

... when != &x
when != x = e
when != I(x,...) S
// </smpl>

Signed-off-by: Julia Lawall <julia@xxxxxxx>

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 a96e1b9..a0a79c7 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)
+ mutex_unlock(&radio->disconnect_lock);
- goto unlock;
+ goto done;

/* cancel read processes */
@@ -601,7 +602,6 @@ int si470x_fops_release(struct file *file)
retval = si470x_stop(radio);
return retval;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/