mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
yam: fix a memory leak in yam_siocdevprivate()
[ Upstream commit29eb315427] ym needs to be free when ym->cmd != SIOCYAMSMCS. Fixes:0781168e23("yam: fix a missing-check bug") Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
93a6e920d8
commit
729e54636b
|
|
@ -951,9 +951,7 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||||
sizeof(struct yamdrv_ioctl_mcs));
|
sizeof(struct yamdrv_ioctl_mcs));
|
||||||
if (IS_ERR(ym))
|
if (IS_ERR(ym))
|
||||||
return PTR_ERR(ym);
|
return PTR_ERR(ym);
|
||||||
if (ym->cmd != SIOCYAMSMCS)
|
if (ym->cmd != SIOCYAMSMCS || ym->bitrate > YAM_MAXBITRATE) {
|
||||||
return -EINVAL;
|
|
||||||
if (ym->bitrate > YAM_MAXBITRATE) {
|
|
||||||
kfree(ym);
|
kfree(ym);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user