summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2016-04-23 02:14:58 +0200
committerDoug Ledford <dledford@redhat.com>2016-04-23 02:26:44 +0200
commitf4e7de63ab273b6a5e35c82eb4fc6363c855ddd4 (patch)
tree143c8803998da1124078565a3dca5d9870285ff1 /drivers/infiniband
parenti40iw: avoid potential uninitialized variable use (diff)
downloadlinux-f4e7de63ab273b6a5e35c82eb4fc6363c855ddd4.tar.xz
linux-f4e7de63ab273b6a5e35c82eb4fc6363c855ddd4.zip
IB/core: Fix oops in ib_cache_gid_set_default_gid
When we fail to find the default gid index, we can't continue processing in this routine or else we will pass a negative index to later routines resulting in invalid memory access attempts and a kernel oops. Fixes: 03db3a2d81e6 (IB/core: Add RoCE GID table management) Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index cb00d59da456..c2e257d97eff 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -691,7 +691,8 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
NULL);
/* Coudn't find default GID location */
- WARN_ON(ix < 0);
+ if (WARN_ON(ix < 0))
+ goto release;
zattr_type.gid_type = gid_type;