From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Maxim Levitsky <maximlevitsky@gmail.com>,
Alex Dubov <oakad@yahoo.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
Kay Sievers <kay.sievers@vrfy.org>, stable <stable@kernel.org>,
Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Subject: Re: [RESEND PATCH] memstick: fix memory leak if card device is never registered
Date: Tue, 4 Apr 2023 14:03:27 +0200 [thread overview]
Message-ID: <2023040411-outhouse-faceless-60e8@gregkh> (raw)
In-Reply-To: <CAPDyKFq3VUVM2-ATNykGyutMoNDO3EkbT2foZBQjxzKr7cTnFg@mail.gmail.com>
On Tue, Apr 04, 2023 at 01:54:03PM +0200, Ulf Hansson wrote:
> On Sat, 1 Apr 2023 at 22:03, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > When calling dev_set_name() memory is allocated for the name for the
> > struct device. Once that structure device is registered, or attempted
> > to be registerd, with the driver core, the driver core will handle
> > cleaning up that memory when the device is removed from the system.
> >
> > Unfortunatly for the memstick code, there is an error path that causes
> > the struct device to never be registered, and so the memory allocated in
> > dev_set_name will be leaked. Fix that leak by manually freeing it right
> > before the memory for the device is freed.
> >
> > Cc: Maxim Levitsky <maximlevitsky@gmail.com>
> > Cc: Alex Dubov <oakad@yahoo.com>
> > Cc: Ulf Hansson <ulf.hansson@linaro.org>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Cc: Kay Sievers <kay.sievers@vrfy.org>
> > Cc: linux-mmc@vger.kernel.org
> > Fixes: 0252c3b4f018 ("memstick: struct device - replace bus_id with dev_name(),
> > Cc: stable <stable@kernel.org>
> > Co-developed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Co-developed-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
>
> Applied for fixes and by adding Mirsad's sob tag (according to the
> other thread [1]), thanks!
Wonderful, thanks for picking up that tag, and the patch.
greg k-h
prev parent reply other threads:[~2023-04-04 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-01 20:03 [RESEND PATCH] memstick: fix memory leak if card device is never registered Greg Kroah-Hartman
2023-04-03 14:14 ` Mirsad Goran Todorovac
2023-04-04 11:54 ` Ulf Hansson
2023-04-04 12:03 ` Greg Kroah-Hartman [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=2023040411-outhouse-faceless-60e8@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--cc=mirsad.todorovac@alu.unizg.hr \
--cc=oakad@yahoo.com \
--cc=rafael@kernel.org \
--cc=stable@kernel.org \
--cc=ulf.hansson@linaro.org \
/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