mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
IB/core: type promotion bug in rdma_rw_init_one_mr()
[ Upstream commitc2d7c8ff89] "nents" is an unsigned int, so if ib_map_mr_sg() returns a negative error code then it's type promoted to a high unsigned int which is treated as success. Fixes:a060b5629a("IB/core: generic RDMA READ/WRITE API") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
eca8598823
commit
0ca45668ec
@@ -87,7 +87,7 @@ static int rdma_rw_init_one_mr(struct ib_qp *qp, u8 port_num,
|
||||
}
|
||||
|
||||
ret = ib_map_mr_sg(reg->mr, sg, nents, &offset, PAGE_SIZE);
|
||||
if (ret < nents) {
|
||||
if (ret < 0 || ret < nents) {
|
||||
ib_mr_pool_put(qp, &qp->rdma_mrs, reg->mr);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user