Re: [PATCH] dlm: check negative length in dlm_search_rsb_tree

Joseph Qi <[email protected]> Sun, 17 May 2026 09:30:06 +0800
Newsgroups dev.linux.lists.gfs2,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 5/15/26 9:30 PM, Alexander Aring wrote:
> Hi,
> 
> On Fri, May 15, 2026 at 3:39 AM Joseph Qi <[email protected]> wrote:
>>
>> commit 080e5563f878 only checks for len > DLM_RESNAME_MAXLEN, which does
>> not catch negative values. While the input 'len' can be negative and a
>> negative int passed to memcpy() is implicitly converted to a large
>> size_t, causing a stack buffer overflow on the key[] array.
>>
>> Fix this by also rejecting len <= 0.
> 
> or change the parameter to unsigned?
> 

Yes, it would be fine. I'll work on it and send v2 later.

Thanks,
Joseph