Skip to content

Commit 0a0a6e8

Browse files
DeanLuickrleon
authored andcommitted
IB/hfi1: Reject a zero-length user expected buffer
A zero length user buffer makes no sense and the code does not handle it correctly. Instead, reject a zero length as invalid. Fixes: 97736f3 ("IB/hfi1: Validate page aligned for a given virtual addres") Signed-off-by: Dean Luick <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Link: https://lore.kernel.org/r/167328547120.1472310.6362802432127399257.stgit@awfm-02.cornelisnetworks.com Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 0afec5e commit 0a0a6e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/infiniband/hw/hfi1/user_exp_rcv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,
256256

257257
if (!PAGE_ALIGNED(tinfo->vaddr))
258258
return -EINVAL;
259+
if (tinfo->length == 0)
260+
return -EINVAL;
259261

260262
tidbuf = kzalloc(sizeof(*tidbuf), GFP_KERNEL);
261263
if (!tidbuf)

0 commit comments

Comments
 (0)