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%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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 a50391b6ba2..3a59d5f018d 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);