提交 26a16fc4 编写于 作者: J José Expósito 提交者: Zheng Zengkai

IB/qib: Fix memory leak in qib_user_sdma_queue_pkts()

stable inclusion
from stable-v5.10.89
commit 7cf6466e00a77b0a914b7b2c28a1fc7947d55e59
bugzilla: 186140 https://gitee.com/openeuler/kernel/issues/I4S8HA

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

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

[ Upstream commit bee90911 ]

The wrong goto label was used for the error case and missed cleanup of the
pkt allocation.

Fixes: d39bf40e ("IB/qib: Protect from buffer overflow in struct qib_user_sdma_pkt fields")
Link: https://lore.kernel.org/r/20211208175238.29983-1-jose.exposito89@gmail.com
Addresses-Coverity-ID: 1493352 ("Resource leak")
Signed-off-by: NJosé Expósito <jose.exposito89@gmail.com>
Acked-by: NMike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d5ce39c4
...@@ -941,7 +941,7 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd, ...@@ -941,7 +941,7 @@ static int qib_user_sdma_queue_pkts(const struct qib_devdata *dd,
&addrlimit) || &addrlimit) ||
addrlimit > type_max(typeof(pkt->addrlimit))) { addrlimit > type_max(typeof(pkt->addrlimit))) {
ret = -EINVAL; ret = -EINVAL;
goto free_pbc; goto free_pkt;
} }
pkt->addrlimit = addrlimit; pkt->addrlimit = addrlimit;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册