From: Alexandre Bounine Date: Wed, 5 Oct 2011 00:43:56 +0000 (+1100) Subject: RapidIO: fix potential null deref in rio_setup_device() X-Git-Tag: next-20111011~1^2~34 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bfb0725055ee1e50065b43629a561be95c78709f;p=karo-tx-linux.git RapidIO: fix potential null deref in rio_setup_device() The "goto cleanup" path can deference "rswitch" when it is NULL. Reported-by: Dan Carpenter Signed-off-by: Alexandre Bounine Cc: Dan Carpenter Cc: Kumar Gala Cc: Matt Porter Cc: Chul Kim Signed-off-by: Andrew Morton --- diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index 0914f49b0a53..2bebd791a092 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -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);