From: dinghao.liu@zju.edu.cn
To: "Jiri Kosina" <jikos@kernel.org>
Cc: kjlu@umn.edu,
"Benjamin Tissoires" <benjamin.tissoires@redhat.com>,
"Alexandrov Stansilav" <neko@nya.ai>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH] HID: elan: Fix memleak in elan_input_configured
Date: Mon, 31 Aug 2020 15:56:42 +0800 (GMT+08:00) [thread overview]
Message-ID: <16ff9408.14137.1744384ac0b.Coremail.dinghao.liu@zju.edu.cn> (raw)
In-Reply-To: <nycvar.YFH.7.76.2008310947070.27422@cbobk.fhfr.pm>
> On Mon, 24 Aug 2020, Dinghao Liu wrote:
>
> > When input_mt_init_slots() fails, input should be
> > freed to prevent memleak.
> >
> > Fixes: 9a6a4193d65b8 ("HID: Add driver for USB ELAN Touchpad")
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> > drivers/hid/hid-elan.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/hid/hid-elan.c b/drivers/hid/hid-elan.c
> > index 45c4f888b7c4..858442004258 100644
> > --- a/drivers/hid/hid-elan.c
> > +++ b/drivers/hid/hid-elan.c
> > @@ -188,6 +188,7 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)
> > ret = input_mt_init_slots(input, ELAN_MAX_FINGERS, INPUT_MT_POINTER);
> > if (ret) {
> > hid_err(hdev, "Failed to init elan MT slots: %d\n", ret);
> > + input_free_device(input);
> > return ret;
>
> Good catch, but apparently it's not the only memleak there --
> input_mt_init_slots() allocates the input_mt slots and friends, so we need
> input_mt_destroy_slots() there as well.
>
> Could you please add this to your patch too, while you are at fixing this
> error codepath anyway, and resubmit?
>
Thank you for your advice! I will fix this and resend the patch soon.
Regards,
Dinghao
prev parent reply other threads:[~2020-08-31 7:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 7:23 [PATCH] HID: elan: Fix memleak in elan_input_configured Dinghao Liu
2020-08-31 7:48 ` Jiri Kosina
2020-08-31 7:56 ` dinghao.liu [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=16ff9408.14137.1744384ac0b.Coremail.dinghao.liu@zju.edu.cn \
--to=dinghao.liu@zju.edu.cn \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=kjlu@umn.edu \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neko@nya.ai \
/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;
as well as URLs for NNTP newsgroup(s).