]> www.infradead.org Git - users/jedix/linux-maple.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)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:28:29 +0000 (19:28 -0800)
commitcd56fa85ee10031d8fa7fb3305df067062a5dc0e
tree9dd7facc26893f84ff927d0e6c95bf663de64614
parent787135d01f9b455726d28963fc08669dda5d032f
IB/cm: Fix rb-tree duplicate free and use-after-free

Orabug: 22623826

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>
(cherry picked from commit 5a52c0e04133b418583244918b3fda8bd3b87d43)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/infiniband/core/cm.c