RDMA/ucma: Fix use-after-free access in ucma_close
authorLeon Romanovsky <leonro@mellanox.com>
Mon, 19 Mar 2018 12:20:15 +0000 (14:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 Apr 2018 10:12:48 +0000 (12:12 +0200)
commita7d0333a87b3a9b68c9d4351fbd9e0f76f6ac913
tree79c753478d66527b55481fb6dd7ca4c48c69459c
parent510d52da02ae6c8ebaa8c760bde50f141906ac87
RDMA/ucma: Fix use-after-free access in ucma_close

commit ed65a4dc22083e73bac599ded6a262318cad7baf upstream.

The error in ucma_create_id() left ctx in the list of contexts belong
to ucma file descriptor. The attempt to close this file descriptor causes
to use-after-free accesses while iterating over such list.

Fixes: 75216638572f ("RDMA/cma: Export rdma cm interface to userspace")
Reported-by: <syzbot+dcfd344365a56fbebd0f@syzkaller.appspotmail.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/ucma.c