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: <9CD4A1A7-E378-49A5-85F8-4566B019231A@nvidia.com>
Date: Tue, 09 Jul 2024 08:49:42 -0400
From: Zi Yan <ziy@...dia.com>
To: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
Cc: david@...morbit.com, willy@...radead.org, chandan.babu@...cle.com,
 djwong@...nel.org, brauner@...nel.org, akpm@...ux-foundation.org,
 yang@...amperecomputing.com, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org, john.g.garry@...cle.com, linux-fsdevel@...r.kernel.org,
 hare@...e.de, p.raghav@...sung.com, mcgrof@...nel.org, gost.dev@...sung.com,
 cl@...amperecomputing.com, linux-xfs@...r.kernel.org, hch@....de
Subject: Re: [PATCH v9 04/10] mm: split a folio in minimum folio order chunks

On 9 Jul 2024, at 7:04, Pankaj Raghav (Samsung) wrote:

>>
>> This should be
>>
>> 		if (!folio->mapping) {
>> 			if (folio_test_pmd_mappable(folio))
>> 				count_vm_event(THP_SPLIT_PAGE_FAILED);
>> 			return -EBUSY;
>> 		}
>>
>> Otherwise, a non PMD mappable folio with no mapping will fall through
>> and cause NULL pointer dereference in mapping_min_folio_order().
>
> Ah, of course. I thought I was being "smart" here to avoid another
> nesting. Instead of triple nested ifs, I guess this is better:
>
> int split_folio_to_list(struct folio *folio, struct list_head *list)
> {
>        unsigned int min_order = 0;
>
>        if (folio_test_anon(folio))
>                goto out;
>
>        if (!folio->mapping) {
>                if (folio_test_pmd_mappable(folio))
>                        count_vm_event(THP_SPLIT_PAGE_FAILED);
>                return -EBUSY;
>        }
>
>        min_order = mapping_min_folio_order(folio->mapping);
> out:
>        return split_huge_page_to_list_to_order(&folio->page, list,
>                                                        min_order);
> }
>
> Let me know what you think!

LGTM. Thanks. With this change, feel free to add Reviewed-by: Zi Yan <ziy@...dia.com>

--
Best Regards,
Yan, Zi

Download attachment "signature.asc" of type "application/pgp-signature" (855 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ