提交 55c9eca5 编写于 作者: D Dean Luick 提交者: sanglipeng

IB/hfi1: Reject a zero-length user expected buffer

stable inclusion
from stable-v5.10.166
commit 73e5666bf30d74cbc33c5b55f1ab0346a07d99a8
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7TH9O

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=73e5666bf30d74cbc33c5b55f1ab0346a07d99a8

--------------------------------

[ Upstream commit 0a0a6e80 ]

A zero length user buffer makes no sense and the code
does not handle it correctly.  Instead, reject a
zero length as invalid.

Fixes: 97736f36 ("IB/hfi1: Validate page aligned for a given virtual addres")
Signed-off-by: NDean Luick <dean.luick@cornelisnetworks.com>
Signed-off-by: NDennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Link: https://lore.kernel.org/r/167328547120.1472310.6362802432127399257.stgit@awfm-02.cornelisnetworks.comSigned-off-by: NLeon Romanovsky <leon@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: Nsanglipeng <sanglipeng1@jd.com>
上级 1ac0c2ac
...@@ -298,6 +298,8 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd, ...@@ -298,6 +298,8 @@ int hfi1_user_exp_rcv_setup(struct hfi1_filedata *fd,
if (!PAGE_ALIGNED(tinfo->vaddr)) if (!PAGE_ALIGNED(tinfo->vaddr))
return -EINVAL; return -EINVAL;
if (tinfo->length == 0)
return -EINVAL;
tidbuf = kzalloc(sizeof(*tidbuf), GFP_KERNEL); tidbuf = kzalloc(sizeof(*tidbuf), GFP_KERNEL);
if (!tidbuf) if (!tidbuf)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册