[PATCH v2 RESEND] mtd: parsers: Fix potential memory leak in mtd_parser_tplink_safeloader_parse()

Yuan Can yuancan at huawei.com
Thu Dec 8 04:03:24 PST 2022


在 2022/12/8 19:53, Dan Carpenter 写道:
> On Thu, Dec 08, 2022 at 11:36:20AM +0000, Yuan Can wrote:
>> The parts needs to be freed with all its elements, otherwise it will be
>> leaked.
>>
>> Fixes: 00a3588084be ("mtd: parsers: add TP-Link SafeLoader partitions table parser")
>> Signed-off-by: Yuan Can <yuancan at huawei.com>
>> ---
>> Changes in v2:
>> - Add a new label err_free_parts and jumps to it when
>>    mtd_parser_tplink_safeloader_read_table() failed to avoid leaking parts.
>>
> Reviewed-by: Dan Carpenter <error27 at gmail.com>
>
> This is the same code as v2 but with an explanation added.
>
> I spotted that the explanation was missing but knew what the explanation
> was so I didn't mention it.  For me, a lot of patches have minor flaws
> and if I complained about everything the whole kernel development
> process would grind to a halt.  Greg is more picky about explanations
> for new versions because he has to deal with a lot of patches and
> because he is trying to teach newbies how to follow the process.
>
> Although minutes ago I just criticized someone else for not putting the
> note under the cut off but that's because I had no idea why they were
> resending.
>
> Next time please avoid putting RESEND in the subject because that means
> there was no changes because your patch was perfect as-is.  Instead put
> v3:
>
> v2: blah blah
> v3: add this explanatory message.
>
> But don't do that in this case, for now the patch is fine.  :P  I'm
> just telling you the process for next time.
Ok, thanks for your explanation!

-- 
Best regards,
Yuan Can




More information about the linux-mtd mailing list