IB/core: Fix use after free in send_leave function
authorErez Shitrit <erezsh@mellanox.com>
Sun, 28 Aug 2016 07:58:30 +0000 (10:58 +0300)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Feb 2017 10:03:37 +0000 (11:03 +0100)
commit4f0992c3ce721d9820d6450ebd70dd60aa9ea387
treec52d92d86492af114982c209280356a128715f0a
parent27816fef78ae4c88cb91a5cedfc159fe2a4464b0
IB/core: Fix use after free in send_leave function

commit 68c6bcdd8bd00394c234b915ab9b97c74104130c upstream.

The function send_leave sets the member: group->query_id
(group->query_id = ret) after calling the sa_query, but leave_handler
can be executed before the setting and it might delete the group object,
and will get a memory corruption.

Additionally, this patch gets rid of group->query_id variable which is
not used.

Fixes: faec2f7b96b5 ('IB/sa: Track multicast join/leave requests')
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
drivers/infiniband/core/multicast.c