Skip to content

Commit 29eb315

Browse files
HBh25Ydavem330
authored andcommitted
yam: fix a memory leak in yam_siocdevprivate()
ym needs to be free when ym->cmd != SIOCYAMSMCS. Fixes: 0781168 ("yam: fix a missing-check bug") Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c74ead2 commit 29eb315

File tree

1 file changed

+1
-3
lines changed
  • drivers/net/hamradio

1 file changed

+1
-3
lines changed

Diff for: drivers/net/hamradio/yam.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -950,9 +950,7 @@ static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __
950950
ym = memdup_user(data, sizeof(struct yamdrv_ioctl_mcs));
951951
if (IS_ERR(ym))
952952
return PTR_ERR(ym);
953-
if (ym->cmd != SIOCYAMSMCS)
954-
return -EINVAL;
955-
if (ym->bitrate > YAM_MAXBITRATE) {
953+
if (ym->cmd != SIOCYAMSMCS || ym->bitrate > YAM_MAXBITRATE) {
956954
kfree(ym);
957955
return -EINVAL;
958956
}

0 commit comments

Comments
 (0)