diff options
author | Dean Luick <dean.luick@cornelisnetworks.com> | 2023-01-09 12:31:11 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-06 07:46:28 +0100 |
commit | 4f858ddf0301c26f984c549a54d51ed9d0b5e0fe (patch) | |
tree | fe2fd15ea2ae72ee348733d591afe155c9da6b78 | |
parent | 4a945eee146476c9db8d59c69c7b500e82c3959a (diff) | |
download | linux-stable-4f858ddf0301c26f984c549a54d51ed9d0b5e0fe.tar.gz linux-stable-4f858ddf0301c26f984c549a54d51ed9d0b5e0fe.tar.bz2 linux-stable-4f858ddf0301c26f984c549a54d51ed9d0b5e0fe.zip |
IB/hfi1: Reject a zero-length user expected buffer
[ Upstream commit 0a0a6e80472c98947d73c3d13bcd7d101895f55d ]
A zero length user buffer makes no sense and the code
does not handle it correctly. Instead, reject a
zero length as invalid.
Fixes: 97736f36dbeb ("IB/hfi1: Validate page aligned for a given virtual addres")
Signed-off-by: Dean Luick <dean.luick@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Link: https://lore.kernel.org/r/167328547120.1472310.6362802432127399257.stgit@awfm-02.cornelisnetworks.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/infiniband/hw/hfi1/user_exp_rcv.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.c b/drivers/infiniband/hw/hfi1/user_exp_rcv.c index c6d085e1c10d..056ffab86a06 100644 --- a/drivers/infiniband/hw/hfi1/user_exp_rcv.c +++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.c @@ -323,6 +323,8 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, if (!PAGE_ALIGNED(tinfo->vaddr)) return -EINVAL; + if (tinfo->length == 0) + return -EINVAL; tidbuf = kzalloc(sizeof(*tidbuf), GFP_KERNEL); if (!tidbuf) |