From: Dan Carpenter Date: Thu, 25 Sep 2014 11:39:41 +0000 (-0300) Subject: [media] em28xx-input: NULL dereference on error X-Git-Tag: firefly_0821_release~176^2~2961^2~9 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=34d7c248ad28c5d462182c5063523023604efc12;p=firefly-linux-kernel-4.4.55.git [media] em28xx-input: NULL dereference on error 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 581f6dad4ca9..23f8f6afa2e0 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 */