yam: fix a memory leak in yam_siocdevprivate()
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/net/hamradio/yam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/hamradio/yam.c +1 -3
@@ -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 ; }
Signature · 1 line
2.25.1
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 7 lines · On Mon, 24 Jan 2022 11:29:54 +0800 you wrote:
ym needs to be free when
ym->cmd!= SIOCYAMSMCS.Fixes 0781168e23a2 ("yam: fix a missing-check bug")Signed-off-by Hangyu Hua <[email protected]>--- drivers/net/hamradio/yam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Here is the summary with links:
- yam: fix a memory leak in yam_siocdevprivate()
https://git.kernel.org/netdev/net/c/29eb31542787
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Just a comment: Looks ok for me.
Quoted 26 lines · Hangyu Hua
ym needs to be free when
ym->cmd!= SIOCYAMSMCS.Fixes 0781168e23a2 ("yam: fix a missing-check bug")Signed-off-by Hangyu Hua <[email protected]>--- drivers/net/hamradio/yam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/hamradio/yam.c +1
-3@@ -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 ; }Signature · 1 line
2.25.1