diff options
author | Hangyu Hua <hbh25y@gmail.com> | 2022-01-24 11:29:54 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-01-25 11:04:55 +0000 |
commit | 29eb31542787e1019208a2e1047bb7c76c069536 (patch) | |
tree | a0d9f40a3d45c14be5f54db69bbefbba787399dc /drivers/net/hamradio/yam.c | |
parent | c74ead223deb88bdf18af8c772d7ca5a9b6c3c2b (diff) | |
download | linux-29eb31542787e1019208a2e1047bb7c76c069536.tar.bz2 |
yam: fix a memory leak in yam_siocdevprivate()
ym needs to be free when ym->cmd != SIOCYAMSMCS.
Fixes: 0781168e23a2 ("yam: fix a missing-check bug")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hamradio/yam.c')
-rw-r--r-- | drivers/net/hamradio/yam.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index 6376b8485976..980f2be32f05 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c @@ -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)); 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; } |