lkml.org 
[lkml]   [2021]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 167/190] Revert "gdrom: fix a memory leak bug"
From
Date
On 4/22/21 3:29 PM, Peter Rosin wrote:
>> This reverts commit 093c48213ee37c3c3ff1cf5ac1aa2a9d8bc66017.
>
> The reverted patch looks fishy.
>
> gc.cd_info is kzalloc:ed on probe. In case probe fails after this allocation, the
> memory is kfree:d but the variable is NOT zeroed out.
>
> AFAICT, the above leads to a double-free on exit by the added line.
>
> I believe gd.cd_info should be kfree:d on remove instead.
>
> However, might not gc.toc also be kfree:d twice for similar reasons?
>
> I could easily be mistaken.

From taking a quick look the other day, that's my conclusion too. I
don't think the patch is correct, but I don't think the surrounding code
is correct right now either.

--
Jens Axboe

\
 
 \ /
  Last update: 2021-04-23 16:21    [W:1.337 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site