public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] em28xx-dvb: fix memleak in dvb_fini()
@ 2009-12-31 11:47 Francesco Lavra
  0 siblings, 0 replies; 2+ messages in thread
From: Francesco Lavra @ 2009-12-31 11:47 UTC (permalink / raw)
  To: linux-media

Hi,
this patch fixes a memory leak which occurs when an em28xx card with DVB
extension is unplugged or its DVB extension driver is unloaded. In
dvb_fini(), dev->dvb must be freed before being set to NULL, as is done
in dvb_init() in case of error.
Note that this bug is also present in the latest stable kernel release.
Regards,
Francesco

Signed-off-by: Francesco Lavra <francescolavra@interfree.it>

--- a/linux/drivers/media/video/em28xx/em28xx-dvb.c	2009-12-31 12:23:53.000000000 +0100
+++ b/linux/drivers/media/video/em28xx/em28xx-dvb.c	2009-12-31 12:23:56.000000000 +0100
@@ -607,6 +607,7 @@ static int dvb_fini(struct em28xx *dev)
 
 	if (dev->dvb) {
 		unregister_dvb(dev->dvb);
+		kfree(dev->dvb);
 		dev->dvb = NULL;
 	}
 



^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] em28xx-dvb: fix memleak in dvb_fini()
@ 2010-02-13 11:02 Francesco Lavra
  0 siblings, 0 replies; 2+ messages in thread
From: Francesco Lavra @ 2010-02-13 11:02 UTC (permalink / raw)
  To: linux-media

This patch fixes a memory leak which occurs when an em28xx card with DVB
extension is unplugged or its DVB extension driver is unloaded. In
dvb_fini(), dev->dvb must be freed before being set to NULL, as is done
in dvb_init() in case of error.

Signed-off-by: Francesco Lavra <francescolavra@interfree.it>
Cc: stable <stable@kernel.org>

---

NOTE: this patch has already reached linux-next, but has not been
requested to be pulled for 2.6.33, as it should.

--- a/drivers/media/video/em28xx/em28xx-dvb.c	2009-12-31 12:23:53.000000000 +0100
+++ b/drivers/media/video/em28xx/em28xx-dvb.c	2009-12-31 12:23:56.000000000 +0100
@@ -606,6 +606,7 @@ static int dvb_fini(struct em28xx *dev)

 	if (dev->dvb) {
 		unregister_dvb(dev->dvb);
+		kfree(dev->dvb);
 		dev->dvb = NULL;
 	}
 



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

end of thread, other threads:[~2010-02-13 11:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-31 11:47 [PATCH] em28xx-dvb: fix memleak in dvb_fini() Francesco Lavra
  -- strict thread matches above, loose matches on Subject: below --
2010-02-13 11:02 Francesco Lavra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox