mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-04 13:21:45 +00:00
RDMA/core: Verify that memory window type is legal
Before calling the provider's alloc_mw function, verify that the given memory type is either IB_MW_TYPE_1 or IB_MW_TYPE_2. Signed-off-by: Noa Osherovich <noaos@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
1882ab8678
commit
d0e02bf6cd
1 changed files with 5 additions and 0 deletions
|
@ -885,6 +885,11 @@ static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs)
|
||||||
goto err_free;
|
goto err_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd.mw_type != IB_MW_TYPE_1 && cmd.mw_type != IB_MW_TYPE_2) {
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto err_put;
|
||||||
|
}
|
||||||
|
|
||||||
mw = pd->device->ops.alloc_mw(pd, cmd.mw_type, &attrs->driver_udata);
|
mw = pd->device->ops.alloc_mw(pd, cmd.mw_type, &attrs->driver_udata);
|
||||||
if (IS_ERR(mw)) {
|
if (IS_ERR(mw)) {
|
||||||
ret = PTR_ERR(mw);
|
ret = PTR_ERR(mw);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue