From: atull <atull@opensource.altera.com>
To: Tobias Klauser <tklauser@distanz.ch>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Moritz Fischer <moritz.fischer@ettus.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fpga manager: Fix firmware resource leak on error
Date: Wed, 18 Nov 2015 09:23:18 -0600 [thread overview]
Message-ID: <alpine.DEB.2.02.1511180921470.9049@linuxheads99> (raw)
In-Reply-To: <1447840096-23236-1-git-send-email-tklauser@distanz.ch>
On Wed, 18 Nov 2015, Tobias Klauser wrote:
> If fpga_mgr_buf_load() fails, the firmware resource previously allocated
> by request_firmware() is leaked. Fix it by calling release_firmware()
> regardless of the return value of fpga_mgr_buf_load().
>
> Found by the Coverity scanner (CID 1339653).
>
> Fixes: 6a8c3be7ec8e ("add FPGA manager core")
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
> drivers/fpga/fpga-mgr.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
> index a24f5cb877e0..aad6439c3692 100644
> --- a/drivers/fpga/fpga-mgr.c
> +++ b/drivers/fpga/fpga-mgr.c
> @@ -122,12 +122,10 @@ int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
> }
>
> ret = fpga_mgr_buf_load(mgr, flags, fw->data, fw->size);
> - if (ret)
> - return ret;
>
> release_firmware(fw);
>
> - return 0;
> + return ret;
> }
> EXPORT_SYMBOL_GPL(fpga_mgr_firmware_load);
>
> --
> 2.6.3.368.gf34be46.dirty
>
>
>
Thanks Tobias!
Acked-by: Alan Tull <atull@opensource.altera.com>
Alan
prev parent reply other threads:[~2015-11-18 15:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-18 9:48 Tobias Klauser
2015-11-18 15:23 ` atull [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=alpine.DEB.2.02.1511180921470.9049@linuxheads99 \
--to=atull@opensource.altera.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=moritz.fischer@ettus.com \
--cc=tklauser@distanz.ch \
/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®