[PATCH linux dev-4.10 2/3] drivers: fsi: sbefifo: Fix memory leak

Andrew Jeffery andrew at aj.id.au
Thu Oct 19 00:24:05 AEDT 2017


On Tue, 2017-10-17 at 16:35 -0500, Eddie James wrote:
> From: "Edward A. James" <eajames at us.ibm.com>
> 
> Transfers weren't being cleaned up if they were complete but the user
> never finished reading. This is very common.

I'm curious as to why this is common, but regardless, the patch looks
fine given the premise.

Andrew

> 
> Signed-off-by: Edward A. James <eajames at us.ibm.com>
> ---
>  drivers/fsi/fsi-sbefifo.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
> index c914eaf..764d8f3 100644
> --- a/drivers/fsi/fsi-sbefifo.c
> +++ b/drivers/fsi/fsi-sbefifo.c
> @@ -321,6 +321,11 @@ static void sbefifo_client_release(struct kref *kref)
>  
>  	if (!READ_ONCE(sbefifo->rc)) {
>  		list_for_each_entry(xfr, &client->xfrs, client) {
> +			if (test_bit(SBEFIFO_XFR_COMPLETE, &xfr->flags)) {
> +				kfree(xfr);
> +				continue;
> +			}
> +
>  			/*
>  			 * The client left with pending or running xfrs.
>  			 * Cancel them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20171018/63fad76d/attachment.sig>


More information about the openbmc mailing list