From ad4ac17ad1e2f0bd0ce38b2585c5d7fa2b0780dc Mon Sep 17 00:00:00 2001 From: Dan Carpenter <[error27@gmail.com]> Date: Wed, 23 Mar 2011 16:43:07 -0700 Subject: [PATCH] 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 --- drivers/rapidio/rio-scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- GitLab