[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <699a33f7-2584-8d64-3a5c-668088f0dea4@nfschina.com>
Date: Thu, 25 Jan 2024 15:30:14 +0800
From: Su Hui <suhui@...china.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: jikos@...nel.org, benjamin.tissoires@...hat.com, mail@...thek.com,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] HID: hidraw: fix a problem of memory leak in
hidraw_release()
On 2024/1/25 15:11, Dan Carpenter wrote:
> On Thu, Jan 25, 2024 at 02:32:26PM +0800, Su Hui wrote:
>> 'struct hidraw_list' is a circular queue whose head can be smaller than
>> tail. Using 'list->tail != list->head' to release all memory that should
>> be released.
>>
>> Fixes: a5623a203cff ("HID: hidraw: fix memory leak in hidraw_release()")
>> Signed-off-by: Su Hui <suhui@...china.com>
> This is very clever. How did you find that? Was it through static
> analysis or just review? Perhaps using syzkaller?
Hi,
I just met this bug on a real machine and found this problem by
reviewing the code.
>
> Reviewed-by: Dan Carpenter <dan.carpenter@...aro.org>
>
> I imagine we could write a checker heuristic to identify ->tail and
> ->head struct members and then complain if they were ever used in a <
> or > comparison.
I can't agree any more, great idea!
Su Hui
Powered by blists - more mailing lists