diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2019-06-16 08:05:20 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2019-06-20 15:17:59 -0400 |
commit | 836a0fbb3e76f704ad65ddfb57f00725245e509b (patch) | |
tree | 30d961b48c7029a952e6eeb5077d76ce0e4a5221 /drivers/infiniband/core/umem.c | |
parent | 89a6da3cb8f30ee0aeca924d84bef688f22f883e (diff) |
RDMA: Check umem pointer validity prior to release
Update ib_umem_release() to behave similarly to kfree() and allow
submitting NULL pointer as safe input to this function.
Fixes: a52c8e2469c3 ("RDMA: Clean destroy CQ in drivers do not return errors")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/umem.c')
-rw-r--r-- | drivers/infiniband/core/umem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 54628ef879f0..08da840ed7ee 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -361,6 +361,9 @@ static void __ib_umem_release_tail(struct ib_umem *umem) | |||
361 | */ | 361 | */ |
362 | void ib_umem_release(struct ib_umem *umem) | 362 | void ib_umem_release(struct ib_umem *umem) |
363 | { | 363 | { |
364 | if (!umem) | ||
365 | return; | ||
366 | |||
364 | if (umem->is_odp) { | 367 | if (umem->is_odp) { |
365 | ib_umem_odp_release(to_ib_umem_odp(umem)); | 368 | ib_umem_odp_release(to_ib_umem_odp(umem)); |
366 | __ib_umem_release_tail(umem); | 369 | __ib_umem_release_tail(umem); |