Commit 29eb3154 authored by Hangyu Hua's avatar Hangyu Hua Committed by David S. Miller

yam: fix a memory leak in yam_siocdevprivate()

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

Fixes: 0781168e ("yam: fix a missing-check bug")
Signed-off-by: default avatarHangyu Hua <hbh25y@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c74ead22
...@@ -950,9 +950,7 @@ static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __ ...@@ -950,9 +950,7 @@ static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __
ym = memdup_user(data, sizeof(struct yamdrv_ioctl_mcs)); ym = memdup_user(data, 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;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment