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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 19 Sep 2023 13:56:33 +0800
From:   "Huang, Ying" <ying.huang@...el.com>
To:     Alistair Popple <apopple@...dia.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>, Bharata B Rao <bharata@....com>,
        "Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
        Wei Xu <weixugc@...gle.com>,
        "Dan Williams" <dan.j.williams@...el.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Davidlohr Bueso <dave@...olabs.net>,
        Johannes Weiner <hannes@...xchg.org>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Michal Hocko <mhocko@...nel.org>,
        Yang Shi <shy828301@...il.com>,
        Dave Jiang <dave.jiang@...el.com>,
        Rafael J Wysocki <rafael.j.wysocki@...el.com>
Subject: Re: [PATCH -V3 4/4] dax, kmem: calculate abstract distance with
 general interface

Alistair Popple <apopple@...dia.com> writes:

> Huang Ying <ying.huang@...el.com> writes:
>
>> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
>> index fa1a8b418f9a..ca68ef17554b 100644
>> --- a/mm/memory-tiers.c
>> +++ b/mm/memory-tiers.c
>> @@ -586,7 +586,7 @@ EXPORT_SYMBOL_GPL(init_node_memory_type);
>>  void clear_node_memory_type(int node, struct memory_dev_type *memtype)
>>  {
>>  	mutex_lock(&memory_tier_lock);
>> -	if (node_memory_types[node].memtype == memtype)
>> +	if (node_memory_types[node].memtype == memtype || !memtype)
>>  		node_memory_types[node].map_count--;
>>
>>  	/*
>>  	 * If we umapped all the attached devices to this node,
>
> This implies it's possible memtype == NULL. Yet we have this:
>
> 	 * clear the node memory type.
> 	 */
> 	if (!node_memory_types[node].map_count) {
> 		node_memory_types[node].memtype = NULL;
> 		put_memory_type(memtype);
> 	}
>
> It's not safe to call put_memory_type(NULL), so what condition guarantees
> map_count > 1 when called with memtype == NULL? Thanks.

Nothing guarantees that.  Thanks for pointing this out.  I will revise
the code to put_memory_type(node_memory_types[node].memtype) firstly.

--
Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ