Commit 166c050b authored by Alexandre Bounine's avatar Alexandre Bounine Committed by Linus Torvalds

RapidIO: fix potential null deref in rio_setup_device()

The "goto cleanup" path can deference "rswitch" when it is NULL.
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarAlexandre 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 48618fb4
...@@ -516,7 +516,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net, ...@@ -516,7 +516,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
return rdev; return rdev;
cleanup: cleanup:
if (rio_is_switch(rdev)) if (rswitch)
kfree(rswitch->route_table); kfree(rswitch->route_table);
kfree(rdev); kfree(rdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment