]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()
authorFan Guo <guofan5@huawei.com>
Fri, 12 Jun 2020 06:38:24 +0000 (14:38 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 19 Jun 2020 12:23:30 +0000 (09:23 -0300)
commit7325dc7acf9c16b3a101fb55dd36dc9430d694c3
tree230426217dfa3e6f949c573726742bfb57f0e3eb
parent42113e3d0b4c363435e10e7a9ca744d84a57b71a
RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()

If ib_dma_mapping_error() returns non-zero value,
ib_mad_post_receive_mads() will jump out of loops and return -ENOMEM
without freeing mad_priv. Fix this memory-leak problem by freeing mad_priv
in this case.

Fixes: 9b61206acb4d ("IB/mad: Check and handle potential DMA mapping errors")
Link: https://lore.kernel.org/r/20200612063824.180611-1-guofan5@huawei.com
Signed-off-by: Fan Guo <guofan5@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/mad.c