Skip to content

Commit

Permalink
[media] drivers/media/IR/ene_ir.c: fix NULL dereference
Browse files Browse the repository at this point in the history
When 'dev' allocation fails in ene_probe we jump to error label where we
dereference the 'dev'.  Fix it by jumping few lines below.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jiri Slaby authored and Mauro Carvalho Chehab committed Oct 21, 2010
1 parent 92d0d66 commit 2e75bce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/IR/ene_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL);

if (!input_dev || !ir_props || !dev)
goto error;
goto error1;

/* validate resources */
error = -ENODEV;
Expand Down Expand Up @@ -1056,7 +1056,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
free_irq(dev->irq, dev);
if (dev && dev->hw_io >= 0)
release_region(dev->hw_io, ENE_IO_SIZE);

error1:
input_free_device(input_dev);
kfree(ir_props);
kfree(dev);
Expand Down

0 comments on commit 2e75bce

Please sign in to comment.