lkml.org 
[lkml]   [2006]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [v4l-dvb-maintainer] [PATCH] V4L/DVB: potential leak in dvb-bt8xx
Trent Piepho wrote:
> I believe that 'state' will be kfree'd by the dst_attach() function if there
> is a failure. Not what you would expect, to have it allocated in the bt8xx
> driver (why do is there??) and freed on error in a different function.
>

Hm, you're right - it is kfreed in dst_attach(). But we're still missing
the kmalloc result check...

Signed-off-by: Florin Malita <fmalita@gmail.com>
---

dvb-bt8xx.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/media/dvb/bt8xx/dvb-bt8xx.c b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
index fb6c4cc..d22ba4e 100644
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c
@@ -665,6 +665,9 @@ static void frontend_init(struct dvb_bt8
case BTTV_BOARD_TWINHAN_DST:
/* DST is not a frontend driver !!! */
state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL);
+ if (!state)
+ break;
+
/* Setup the Card */
state->config = &dst_config;
state->i2c = card->i2c_adapter;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-10-15 18:05    [W:0.065 / U:0.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site