]> git.ipfire.org Git - people/ms/linux.git/commit
IB/cm: Fix rb-tree duplicate free and use-after-free
authorDoron Tsur <doront@mellanox.com>
Sun, 11 Oct 2015 12:58:17 +0000 (15:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Nov 2015 20:50:26 +0000 (12:50 -0800)
commit0a494af786ed92017825ad11a0351e869d1ff977
tree090150dadd84d7b5b578662b47bad1c975561da1
parenta672d16d8c2adb6f007c28ff76e94bb2eb9fdfe4
IB/cm: Fix rb-tree duplicate free and use-after-free

commit 0ca81a2840f77855bbad1b9f172c545c4dc9e6a4 upstream.

ib_send_cm_sidr_rep could sometimes erase the node from the sidr
(depending on errors in the process). Since ib_send_cm_sidr_rep is
called both from cm_sidr_req_handler and cm_destroy_id, cm_id_priv
could be either erased from the rb_tree twice or not erased at all.
Fixing that by making sure it's erased only once before freeing
cm_id_priv.

Fixes: a977049dacde ('[PATCH] IB: Add the kernel CM implementation')
Signed-off-by: Doron Tsur <doront@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/cm.c