Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

IB/core: Fix memory corruption in ib_cache_gid_set_default_gid

When ib_cache_gid_set_default_gid is called from several threads,
updating the table could make find_gid fail, therefore a negative
index will be retruned and an invalid table entry will be used.
Locking find_gid as well fixes this problem.

Fixes: 03db3a2d81e6 ('IB/core: Add RoCE GID table management')
Signed-off-by: Doron Tsur <doront@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Doron Tsur and committed by
Doug Ledford
17b38fb8 0b5c9279

+1 -1
+1 -1
drivers/infiniband/core/cache.c
··· 508 508 memset(&gid_attr, 0, sizeof(gid_attr)); 509 509 gid_attr.ndev = ndev; 510 510 511 + mutex_lock(&table->lock); 511 512 ix = find_gid(table, NULL, NULL, true, GID_ATTR_FIND_MASK_DEFAULT); 512 513 513 514 /* Coudn't find default GID location */ 514 515 WARN_ON(ix < 0); 515 516 516 - mutex_lock(&table->lock); 517 517 if (!__ib_cache_gid_get(ib_dev, port, ix, 518 518 &current_gid, &current_gid_attr) && 519 519 mode == IB_CACHE_GID_DEFAULT_MODE_SET &&