summaryrefslogtreecommitdiffstats
path: root/drivers/rapidio/rio-scan.c
diff options
context:
space:
mode:
authorDan Carpenter <[error27@gmail.com]>2011-03-24 00:43:07 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-24 03:46:44 +0100
commitad4ac17ad1e2f0bd0ce38b2585c5d7fa2b0780dc (patch)
treecfc612adbeb9a5d0a6b0e1ee35d14eb963058e77 /drivers/rapidio/rio-scan.c
parentrapidio: remove mport resource reservation from common RIO code (diff)
downloadlinux-ad4ac17ad1e2f0bd0ce38b2585c5d7fa2b0780dc.tar.xz
linux-ad4ac17ad1e2f0bd0ce38b2585c5d7fa2b0780dc.zip
rapidio: fix potential null deref on failure path
If rio is not a switch then "rswitch" is null. Signed-off-by: Dan Carpenter <error27@gmail.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rapidio/rio-scan.c')
-rw-r--r--drivers/rapidio/rio-scan.c2
1 files changed, 1 insertions, 1 deletions
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);