]> git.openfabrics.org - ~shefty/librdmacm.git/commit
rsocket: Fix race in indexer map
authorSean Hefty <sean.hefty@intel.com>
Wed, 11 Feb 2015 00:50:08 +0000 (16:50 -0800)
committerSean Hefty <sean.hefty@intel.com>
Wed, 11 Feb 2015 00:50:08 +0000 (16:50 -0800)
commit5148ba157e5bb4d73599f8db76236d1f7fcdf9e0
treecc9fe9e0f61b120af8e519dd3c5c3802a7170a6e
parent5e78ef2974ae364cf7682919e5120a1e1bc2a807
rsocket: Fix race in indexer map

Although insertions and removals of rsockets are protected
against accesses to the index map, when reading the map using
a non-rsocket (i.e. normal fd), the reading of the map may
overlap with the removal of an rsocket.  This can result in
accessing freed memory.

We can avoid this by not freeing the memory when rsockets
no longer reference an index array.  This ensures that the
memory is valid, and protects against reading the memory without
adding locking into the read path.

Problem reported by: Sasha Kotchubievsky <sashakot@mellanox.com>

Signed-off-by: Sean Hefty <sean.hefty@intel.com>