Skip to content

Commit 166c050

Browse files
Alexandre Bouninetorvalds
authored andcommitted
RapidIO: fix potential null deref in rio_setup_device()
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>
1 parent 48618fb commit 166c050

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/rapidio/rio-scan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static struct rio_dev __devinit *rio_setup_device(struct rio_net *net,
516516
return rdev;
517517

518518
cleanup:
519-
if (rio_is_switch(rdev))
519+
if (rswitch)
520520
kfree(rswitch->route_table);
521521

522522
kfree(rdev);

0 commit comments

Comments
 (0)