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]
Date:   Thu, 28 Jul 2022 09:36:48 +0800
From:   Yongqiang Liu <liuyongqiang13@...wei.com>
To:     William Kucharski <william.kucharski@...cle.com>
CC:     Matthew Wilcox <willy@...radead.org>,
        "dhowells@...hat.com" <dhowells@...hat.com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "zhangxiaoxu5@...wei.com" <zhangxiaoxu5@...wei.com>,
        "yanaijie@...wei.com" <yanaijie@...wei.com>,
        "vbabka@...e.cz" <vbabka@...e.cz>,
        "wangkefeng.wang@...wei.com" <wangkefeng.wang@...wei.com>
Subject: Re: [PATCH] mm/folio-compact: fix potential NULL pointer in
 pagecache_get_page

Understood, thanks for your explanation :)

在 2022/7/27 19:40, William Kucharski 写道:
> This isn't a NULL pointer dereference; returning &(0->page) is completely legal
> as was discussed regarding this exact code back in April:
>
> https://lore.kernel.org/lkml/YmfgqKcMmstgfz+0@casper.infradead.org/
>
>> On Jul 27, 2022, at 12:46 AM, Yongqiang Liu <liuyongqiang13@...wei.com> wrote:
>>
>> When __filemap_get_folio() failed and returned NULL, we would
>> get a NULL pointer dereference in pagecache_get_page.
>>
>> Fixes: 3f0c6a07fee6 ("mm/filemap: Add filemap_get_folio")
>> Signed-off-by: Yongqiang Liu <liuyongqiang13@...wei.com>
>> Cc: <stable@...r.kernel.org> # 5.16
>> ---
>> mm/folio-compat.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/folio-compat.c b/mm/folio-compat.c
>> index 20bc15b57d93..7b21393480e0 100644
>> --- a/mm/folio-compat.c
>> +++ b/mm/folio-compat.c
>> @@ -124,7 +124,9 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
>> struct folio *folio;
>>
>> folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
>> - if ((fgp_flags & FGP_HEAD) || !folio || xa_is_value(folio))
>> + if (!folio)
>> + return NULL;
>> + if ((fgp_flags & FGP_HEAD) || xa_is_value(folio))
>> return &folio->page;
>> return folio_file_page(folio, index);
>> }
>> -- 
>> 2.25.1
>>
>>
> .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ