From: Thomas Osterried <thomas@osterried.de>
To: Hangyu Hua <hbh25y@gmail.com>
Cc: jpr@f6fbb.org, davem@davemloft.net, kuba@kernel.org,
wang6495@umn.edu, linux-hams@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] yam: fix a memory leak in yam_siocdevprivate()
Date: Thu, 27 Jan 2022 04:59:56 +0100 [thread overview]
Message-ID: <20220127035956.GE18529@x-berg.in-berlin.de> (raw)
In-Reply-To: <20220124032954.18283-1-hbh25y@gmail.com>
Just a comment: Looks ok for me.
On Mon, Jan 24, 2022 at 11:29:54AM +0800, Hangyu Hua wrote:
> 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>
> ---
> drivers/net/hamradio/yam.c | 4 +---
> 1 file changed, 1 insertion(+), 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;
> }
> --
> 2.25.1
>
prev parent reply other threads:[~2022-01-27 3:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 3:29 [PATCH] yam: fix a memory leak in yam_siocdevprivate() Hangyu Hua
2022-01-25 16:46 ` patchwork-bot+netdevbpf
2022-01-27 3:59 ` Thomas Osterried [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220127035956.GE18529@x-berg.in-berlin.de \
--to=thomas@osterried.de \
--cc=davem@davemloft.net \
--cc=hbh25y@gmail.com \
--cc=jpr@f6fbb.org \
--cc=kuba@kernel.org \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=wang6495@umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox