Skip to content

Commit

Permalink
rapidio: fix potential null deref on failure path
Browse files Browse the repository at this point in the history
If rio is not a switch then "rswitch" is null.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dan Carpenter authored and Linus Torvalds committed Mar 24, 2011
1 parent c1256eb commit ad4ac17
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 @@ -517,7 +517,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
return rdev;

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

kfree(rdev);
Expand Down

0 comments on commit ad4ac17

Please sign in to comment.