[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160831132557.c5cf0985e3da5f2850a10b1d@linux-foundation.org>
Date: Wed, 31 Aug 2016 13:25:57 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Reza Arbab <arbab@...ux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Yaowei Bai <baiyaowei@...s.chinamobile.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Dan Williams <dan.j.williams@...el.com>,
Xishi Qiu <qiuxishi@...wei.com>,
David Vrabel <david.vrabel@...rix.com>,
Chen Yucong <slaoub@...il.com>,
Andrew Banman <abanman@....com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH v2] memory-hotplug: fix store_mem_state() return
value
On Wed, 31 Aug 2016 10:44:01 -0500 Reza Arbab <arbab@...ux.vnet.ibm.com> wrote:
> Attempting to online memory which is already online will cause this:
>
> 1. store_mem_state() called with buf="online"
> 2. device_online() returns 1 because device is already online
> 3. store_mem_state() returns 1
> 4. calling code interprets this as 1-byte buffer read
> 5. store_mem_state() called again with buf="nline"
> 6. store_mem_state() returns -EINVAL
>
> Example:
>
> $ cat /sys/devices/system/memory/memory0/state
> online
> $ echo online > /sys/devices/system/memory/memory0/state
> -bash: echo: write error: Invalid argument
>
> Fix the return value of store_mem_state() so this doesn't happen.
So.. what *does* happen after the patch? Is some sort of failure still
reported? Or am I correct in believing that the operation will appear
to have succeeded? If so, is that desirable?
Powered by blists - more mailing lists