From 34d7c248ad28c5d462182c5063523023604efc12 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 25 Sep 2014 08:39:41 -0300 Subject: [media] em28xx-input: NULL dereference on error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We call "kfree(ir->i2c_client);" in the error handling and that doesn't work if "ir" is NULL. Fixes: 78e719a5f30b ('[media] em28xx-input: i2c IR decoders: improve i2c_client handling') Signed-off-by: Dan Carpenter Acked-by: Frank Schäfer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 581f6da..23f8f6a 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -712,8 +712,10 @@ static int em28xx_ir_init(struct em28xx *dev) em28xx_info("Registering input extension\n"); ir = kzalloc(sizeof(*ir), GFP_KERNEL); + if (!ir) + return -ENOMEM; rc = rc_allocate_device(); - if (!ir || !rc) + if (!rc) goto error; /* record handles to ourself */ -- cgit v0.10.2