lkml.org 
[lkml]   [2016]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] qed: fix memory leak of a qed_spq_entry on error failure paths
From
From: "Mintz, Yuval" <Yuval.Mintz@cavium.com>
Date: Sun, 18 Dec 2016 06:33:50 +0000

>> From: Colin Ian King <colin.king@canonical.com>
>>
>> A qed_spq_entry entry is allocated by qed_sp_init_request but is not kfree'd
>> if an error occurs, causing a memory leak. Fix this by kfree'ing it and also
>> setting *pp_ent to NULL to be safe.
>>
>> Found with static analysis by CoverityScan, CIDs 1389468-1389470
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ...
>> +err:
>> + kfree(*pp_ent);
>> + *pp_ent = NULL;
>> +
>> + return rc;
>> }
>
> Hi Colin - thanks for this.
> It would have been preferable to return the previously allocated spq entry.
> I.e., do:
>
> +err:
> + qed_spq_return_entry(p_hwfn, *pp_ent);
> + *pp_ent = NULL;
> + return rc;

Looking at this last night, I came to the same conclusion.

\
 
 \ /
  Last update: 2016-12-18 16:38    [W:0.062 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site