IB/core: Fix memory corruption in ib_cache_gid_set_default_gid
authorDoron Tsur <doront@mellanox.com>
Thu, 15 Oct 2015 12:01:02 +0000 (15:01 +0300)
committerDoug Ledford <dledford@redhat.com>
Thu, 15 Oct 2015 16:35:54 +0000 (12:35 -0400)
commit17b38fb89055bf5df402980c9546a8b046552f2b
tree292d5bc17607c3ca26d12fc1a612f007af0015bb
parent0b5c9279e568d90903acedc2b9b832d8d78e8288
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>
drivers/infiniband/core/cache.c