lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <08c38d22-196d-a12e-f3e1-bc67f5912cb5@linux.alibaba.com>
Date:   Wed, 20 Nov 2019 21:46:00 +0800
From:   Wen Yang <wenyang@...ux.alibaba.com>
To:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:     zhiche.yy@...baba-inc.com, xlpang@...ux.alibaba.com,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] intel_th: avoid double free in error flow


On 2019/11/20 9:38 下午, Alexander Shishkin wrote:
> Wen Yang <wenyang@...ux.alibaba.com> writes:
>
>> Another example after a few lines lower:
>>
>>           err = device_add(&thdev->dev);
>>
>>           if (err) {
>>                    put_device(&thdev->dev);
>>                    goto fail_free_res;
>>
>>            }
>>
>> device_add() has increased the reference count,
>>
>> so when it returns an error, an additional call to put_device()
>>
>> is needed here to reduce the reference count.
>>
>> So the code in this place is correct.
> No, device_add() drops its own extra reference in case of error (as it
> should), so in "if (err) ..." branch we still only have just one
> reference before it goes free.
>
> Regards,
> --
> Alex



Well, ok, you are right.

We just checked the code and device_add() does release the reference count.

Thank you.


--

Regards,

Wen




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ