Commit ad4ac17a authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Torvalds

rapidio: fix potential null deref on failure path

If rio is not a switch then "rswitch" is null.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c1256ebe
......@@ -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);
......
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