]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
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)
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>

No differences found