From: "Gabriel L. Somlo" <somlo@cmu.edu>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andreas Ziegler <andreas.ziegler@fau.de>,
Valentin Rothberg <valentin.rothberg@posteo.net>
Subject: Re: [PATCH] qemu_fw_cfg: don't leak kobj on init error
Date: Wed, 6 Apr 2016 13:16:46 -0400 [thread overview]
Message-ID: <20160406171646.GP2060@HEDWIG.INI.CMU.EDU> (raw)
In-Reply-To: <1459686193-29414-1-git-send-email-mst@redhat.com>
On Sun, Apr 03, 2016 at 03:23:19PM +0300, Michael S. Tsirkin wrote:
> If platform_driver_register fails, we should
> cleanup fw_cfg_top_ko before exiting.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Gabriel Somlo <somlo@cmu.edu>
Thanks,
--Gabriel
> ---
> drivers/firmware/qemu_fw_cfg.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
> index fedbff5..e4c4714 100644
> --- a/drivers/firmware/qemu_fw_cfg.c
> +++ b/drivers/firmware/qemu_fw_cfg.c
> @@ -727,12 +727,18 @@ device_param_cb(mmio, &fw_cfg_cmdline_param_ops, NULL, S_IRUSR);
>
> static int __init fw_cfg_sysfs_init(void)
> {
> + int ret;
> +
> /* create /sys/firmware/qemu_fw_cfg/ top level directory */
> fw_cfg_top_ko = kobject_create_and_add("qemu_fw_cfg", firmware_kobj);
> if (!fw_cfg_top_ko)
> return -ENOMEM;
>
> - return platform_driver_register(&fw_cfg_sysfs_driver);
> + ret = platform_driver_register(&fw_cfg_sysfs_driver);
> + if (ret)
> + fw_cfg_kobj_cleanup(fw_cfg_top_ko);
> +
> + return ret;
> }
>
> static void __exit fw_cfg_sysfs_exit(void)
> --
> MST
prev parent reply other threads:[~2016-04-06 17:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-03 12:23 Michael S. Tsirkin
2016-04-06 17:16 ` Gabriel L. Somlo [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=20160406171646.GP2060@HEDWIG.INI.CMU.EDU \
--to=somlo@cmu.edu \
--cc=andreas.ziegler@fau.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=valentin.rothberg@posteo.net \
/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
all inboxes | Powered by JetHome®