From: Dan Carpenter <[error27@gmail.com]> Date: Wed, 23 Mar 2011 23:43:07 +0000 (-0700) Subject: rapidio: fix potential null deref on failure path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ad4ac17ad1e2f0bd0ce38b2585c5d7fa2b0780dc;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git rapidio: fix potential null deref on failure path If rio is not a switch then "rswitch" is null. Signed-off-by: Dan Carpenter Cc: Matt Porter Cc: Kumar Gala Signed-off-by: Alexandre Bounine Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c index a50391b6ba2a..3a59d5f018d3 100644 --- a/drivers/rapidio/rio-scan.c +++ b/drivers/rapidio/rio-scan.c @@ -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);