On 2/19/21 3:58 AM, akpm@xxxxxxxxxxxxxxxxxxxx wrote: > From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > Subject: mm-memory_hotplug-prevalidate-the-address-range-being-added-with-platform-fix > > make pagemap_range() return -EINVAL when mhp_range_allowed() fails > > Reported-by: kernel test robot <lkp@xxxxxxxxx> > Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx> > Cc: Ard Biesheuvel <ardb@xxxxxxxxxx> > Cc: Catalin Marinas <catalin.marinas@xxxxxxx> > Cc: David Hildenbrand <david@xxxxxxxxxx> > Cc: Heiko Carstens <hca@xxxxxxxxxxxxx> > Cc: Jason Wang <jasowang@xxxxxxxxxx> > Cc: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> > Cc: Mark Rutland <mark.rutland@xxxxxxx> > Cc: "Michael S. Tsirkin" <mst@xxxxxxxxxx> > Cc: Michal Hocko <mhocko@xxxxxxxxxx> > Cc: Oscar Salvador <osalvador@xxxxxxx> > Cc: Pankaj Gupta <pankaj.gupta@xxxxxxxxxxxxxxx> > Cc: Pankaj Gupta <pankaj.gupta.linux@xxxxxxxxx> > Cc: teawater <teawaterz@xxxxxxxxxxxxxxxxx> > Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx> > Cc: Wei Yang <richard.weiyang@xxxxxxxxxxxxxxxxx> > Cc: Will Deacon <will@xxxxxxxxxx> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > --- > > mm/memremap.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > --- a/mm/memremap.c~mm-memory_hotplug-prevalidate-the-address-range-being-added-with-platform-fix > +++ a/mm/memremap.c > @@ -266,8 +266,10 @@ static int pagemap_range(struct dev_page > if (error) > goto err_pfn_remap; > > - if (!mhp_range_allowed(range->start, range_len(range), !is_private)) > + if (!mhp_range_allowed(range->start, range_len(range), !is_private)) { > + error = -EINVAL; > goto err_pfn_remap; > + } > > mem_hotplug_begin(); Hello Andrew, I some how missed the original error report about this on the list. But this looks good. Would you fold this back to the first patch in the series while merging OR should I resend the series with this fix ? - Anshuman