Skip to content

Commit

Permalink
RapidIO: fix potential null deref in rio_setup_device()
Browse files Browse the repository at this point in the history
The "goto cleanup" path can deference "rswitch" when it is NULL.

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Chul Kim <chul.kim@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alexandre Bounine authored and Linus Torvalds committed Nov 2, 2011
1 parent 48618fb commit 166c050
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/rapidio/rio-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
return rdev;

cleanup:
if (rio_is_switch(rdev))
if (rswitch)
kfree(rswitch->route_table);

kfree(rdev);
Expand Down

0 comments on commit 166c050

Please sign in to comment.