From: Johan Hovold <johan@kernel.org> To: "Philippe Mathieu-Daudé" <philmd@redhat.com> Cc: Miaoqian Lin <linmq006@gmail.com>, Qiushi Wu <wu000273@umn.edu>, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, Gabriel Somlo <somlo@cmu.edu>, "Michael S. Tsirkin" <mst@redhat.com> Subject: Re: [PATCH] fw_cfg: Fix memory leak in fw_cfg_register_file Date: Tue, 30 Nov 2021 18:18:24 +0100 [thread overview] Message-ID: <YaZc4LbX5hrJDnec@hovoldconsulting.com> (raw) In-Reply-To: <2ced2fae-2ffd-3a70-f02c-175662baf7bc@redhat.com> On Tue, Nov 16, 2021 at 04:28:34PM +0100, Philippe Mathieu-Daudé wrote: > On 11/16/21 12:42, Miaoqian Lin wrote: > > When kobject_init_and_add() fails, entry should be freed just like > > when sysfs_create_bin_file() fails. > > > > Fixes: fe3c60684377 ("firmware: Fix a reference count leak.") > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> No, no. This patch is completely bogus and would introduce a double free. > > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> > > --- > > drivers/firmware/qemu_fw_cfg.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c > > index 172c751a4f6c..0f404777f016 100644 > > --- a/drivers/firmware/qemu_fw_cfg.c > > +++ b/drivers/firmware/qemu_fw_cfg.c > > @@ -608,6 +608,7 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f) > > fw_cfg_sel_ko, "%d", entry->select); > > if (err) { > > kobject_put(&entry->kobj); > > + kfree(entry); entry would already have been freed by kobject_put() and fw_cfg_sysfs_release_entry() here. > > return err; > > } > > > > Doesn't look like this patch has been picked up yet, so: NAK. Johan
WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org> To: "Philippe Mathieu-Daudé" <philmd@redhat.com> Cc: Miaoqian Lin <linmq006@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Gabriel Somlo <somlo@cmu.edu>, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, Qiushi Wu <wu000273@umn.edu> Subject: Re: [PATCH] fw_cfg: Fix memory leak in fw_cfg_register_file Date: Tue, 30 Nov 2021 18:18:24 +0100 [thread overview] Message-ID: <YaZc4LbX5hrJDnec@hovoldconsulting.com> (raw) In-Reply-To: <2ced2fae-2ffd-3a70-f02c-175662baf7bc@redhat.com> On Tue, Nov 16, 2021 at 04:28:34PM +0100, Philippe Mathieu-Daudé wrote: > On 11/16/21 12:42, Miaoqian Lin wrote: > > When kobject_init_and_add() fails, entry should be freed just like > > when sysfs_create_bin_file() fails. > > > > Fixes: fe3c60684377 ("firmware: Fix a reference count leak.") > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> No, no. This patch is completely bogus and would introduce a double free. > > Signed-off-by: Miaoqian Lin <linmq006@gmail.com> > > --- > > drivers/firmware/qemu_fw_cfg.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c > > index 172c751a4f6c..0f404777f016 100644 > > --- a/drivers/firmware/qemu_fw_cfg.c > > +++ b/drivers/firmware/qemu_fw_cfg.c > > @@ -608,6 +608,7 @@ static int fw_cfg_register_file(const struct fw_cfg_file *f) > > fw_cfg_sel_ko, "%d", entry->select); > > if (err) { > > kobject_put(&entry->kobj); > > + kfree(entry); entry would already have been freed by kobject_put() and fw_cfg_sysfs_release_entry() here. > > return err; > > } > > > > Doesn't look like this patch has been picked up yet, so: NAK. Johan
next prev parent reply other threads:[~2021-11-30 17:18 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-16 11:42 [PATCH] fw_cfg: Fix memory leak in fw_cfg_register_file Miaoqian Lin 2021-11-16 11:42 ` Miaoqian Lin 2021-11-16 15:28 ` Philippe Mathieu-Daudé 2021-11-16 15:28 ` Philippe Mathieu-Daudé 2021-11-30 17:18 ` Johan Hovold [this message] 2021-11-30 17:18 ` Johan Hovold
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=YaZc4LbX5hrJDnec@hovoldconsulting.com \ --to=johan@kernel.org \ --cc=linmq006@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mst@redhat.com \ --cc=philmd@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=somlo@cmu.edu \ --cc=wu000273@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.