提交 219d1d28 编写于 作者: H Hangyu Hua 提交者: Zheng Zengkai

yam: fix a memory leak in yam_siocdevprivate()

mainline inclusion
from mainline-v5.17-rc2
commit 29eb3154
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4U4NY
CVE: CVE-2022-24959

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

ym needs to be free when ym->cmd != SIOCYAMSMCS.

Fixes: 0781168e ("yam: fix a missing-check bug")
Signed-off-by: NHangyu Hua <hbh25y@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>

conflict:
	The bug is in function yam_siocdevprivate() in mainline,
but it is in function yam_ioctl() because the function name is
changed in 25ec92fb("hamradio: use ndo_siocdevprivate") in
mainline.
Signed-off-by: NLu Wei <luwei32@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Reviewed-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 00b006d8
......@@ -951,9 +951,7 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
sizeof(struct yamdrv_ioctl_mcs));
if (IS_ERR(ym))
return PTR_ERR(ym);
if (ym->cmd != SIOCYAMSMCS)
return -EINVAL;
if (ym->bitrate > YAM_MAXBITRATE) {
if (ym->cmd != SIOCYAMSMCS || ym->bitrate > YAM_MAXBITRATE) {
kfree(ym);
return -EINVAL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册