]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
IB/core: Fix oops in ib_cache_gid_set_default_gid
authorDoug Ledford <dledford@redhat.com>
Sat, 23 Apr 2016 00:14:58 +0000 (20:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 May 2016 21:49:08 +0000 (14:49 -0700)
commit f4e7de63ab273b6a5e35c82eb4fc6363c855ddd4 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/cache.c

index 53343ffbff7a1302b03ce5f6a66116b06f1e60b5..1b109b2a235efc22aa788275332973fd932aa98a 100644 (file)
@@ -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;