]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
RapidIO: fix potential null deref in rio_setup_device()
authorAlexandre Bounine <alexandre.bounine@idt.com>
Wed, 5 Oct 2011 00:43:56 +0000 (11:43 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 11 Oct 2011 08:44:17 +0000 (19:44 +1100)
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>
drivers/rapidio/rio-scan.c

index 0914f49b0a5344721055c282c0135899701b6317..2bebd791a09243703da9d531eda1cec3ebd0941d 100644 (file)
@@ -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);