RDMA/cma: Rollback source IP address if failing to acquire device
authorMyungho Jung <mhjungk@gmail.com>
Thu, 10 Jan 2019 06:27:31 +0000 (22:27 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Mar 2019 05:17:58 +0000 (14:17 +0900)
commit648562c0a9583ec4927c7d5eba5259fe7785d314
tree67f532effd7a17a5717d8cd9954c17374c77dc2b
parent244594c5f5c80c6505b4dd6a94bd1b847d24f38e
RDMA/cma: Rollback source IP address if failing to acquire device

commit 5fc01fb846bce8fa6d5f95e2625b8ce0f8e86810 upstream.

If cma_acquire_dev_by_src_ip() returns error in addr_handler(), the
device state changes back to RDMA_CM_ADDR_BOUND but the resolved source
IP address is still left. After that, if rdma_destroy_id() is called
after rdma_listen(), the device is freed without removed from
listen_any_list in cma_cancel_operation(). Revert to the previous IP
address if acquiring device fails.

Reported-by: syzbot+f3ce716af730c8f96637@syzkaller.appspotmail.com
Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/cma.c