[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1511180921470.9049@linuxheads99>
Date: Wed, 18 Nov 2015 09:23:18 -0600
From: atull <atull@...nsource.altera.com>
To: Tobias Klauser <tklauser@...tanz.ch>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Moritz Fischer <moritz.fischer@...us.com>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fpga manager: Fix firmware resource leak on error
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@...tanz.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@...nsource.altera.com>
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists