linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] [media] em28xx: use after free in em28xx_v4l2_close()
@ 2012-08-14  6:58 Dan Carpenter
  2012-08-14 10:50 ` Ezequiel Garcia
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2012-08-14  6:58 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Ezequiel Garcia, Hans Verkuil, Hans de Goede, Gianluca Gennari,
	linux-media, kernel-janitors

We need to move the unlock before the kfree(dev);

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Applies to linux-next.

diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index ecb23df..78d6ebd 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -2264,9 +2264,9 @@ static int em28xx_v4l2_close(struct file *filp)
 		if (dev->state & DEV_DISCONNECTED) {
 			em28xx_release_resources(dev);
 			kfree(dev->alt_max_pkt_size);
+			mutex_unlock(&dev->lock);
 			kfree(dev);
 			kfree(fh);
-			mutex_unlock(&dev->lock);
 			return 0;
 		}
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-14 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14  6:58 [patch] [media] em28xx: use after free in em28xx_v4l2_close() Dan Carpenter
2012-08-14 10:50 ` Ezequiel Garcia
2012-08-14 11:05   ` Dan Carpenter
2012-08-14 11:15     ` Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).