From: Robin Murphy <robin.murphy@arm.com>
To: Souptick Joarder <jrdr.linux@gmail.com>,
Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>, Heiko Stuebner <heiko@sntech.de>,
Peter Zijlstra <peterz@infradead.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Linux-MM <linux-mm@kvack.org>,
linux1394-devel@lists.sourceforge.net,
Marek Szyprowski <m.szyprowski@samsung.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
oleksandr_andrushchenko@epam.com, joro@8bytes.org,
Russell King - ARM Linux <linux@armlinux.org.uk>,
iommu@lists.linux-foundation.org, airlied@linux.ie,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, treding@nvidia.com,
linux-media@vger.kernel.org, Kees Cook <keescook@chromium.org>,
pawel@osciak.com, Rik van Riel <riel@surriel.com>,
rppt@linux.vnet.ibm.com,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
mchehab@kernel.org, iamjoonsoo.kim@lge.com, vbabka@suse.cz,
Juergen Gross <jgross@suse.com>,
hjc@rock-chips.com, xen-devel@lists.xen.org,
Kyungmin Park <kyungmin.park@samsung.com>,
stefanr@s5r6.in-berlin.de,
Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH v3 1/9] mm: Introduce new vm_insert_range API
Date: Fri, 7 Dec 2018 21:10:00 +0000 [thread overview]
Message-ID: <67495f8f-2092-e42d-321e-5216c346513f@arm.com> (raw)
In-Reply-To: <CAFqt6zYCWOK-uS85GqCzcgT=+YKn1nBrRPq+M9y6eJjmXEKH+g@mail.gmail.com>
On 2018-12-07 7:28 pm, Souptick Joarder wrote:
> On Fri, Dec 7, 2018 at 10:41 PM Matthew Wilcox <willy@infradead.org> wrote:
>>
>> On Fri, Dec 07, 2018 at 03:34:56PM +0000, Robin Murphy wrote:
>>>> +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
>>>> + struct page **pages, unsigned long page_count)
>>>> +{
>>>> + unsigned long uaddr = addr;
>>>> + int ret = 0, i;
>>>
>>> Some of the sites being replaced were effectively ensuring that vma and
>>> pages were mutually compatible as an initial condition - would it be worth
>>> adding something here for robustness, e.g.:
>>>
>>> + if (page_count != vma_pages(vma))
>>> + return -ENXIO;
>>
>> I think we want to allow this to be used to populate part of a VMA.
>> So perhaps:
>>
>> if (page_count > vma_pages(vma))
>> return -ENXIO;
>
> Ok, This can be added.
>
> I think Patch [2/9] is the only leftover place where this
> check could be removed.
Right, 9/9 could also have relied on my stricter check here, but since
it's really testing whether it actually managed to allocate vma_pages()
worth of pages earlier, Matthew's more lenient version won't help for
that one. (Why privcmd_buf_mmap() doesn't clean up and return an error
as soon as that allocation loop fails, without taking the mutex under
which it still does a bunch more pointless work to only undo it again,
is a mind-boggling mystery, but that's not our problem here...)
Robin.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2018-12-07 21:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 18:39 [PATCH v3 1/9] mm: Introduce new vm_insert_range API Souptick Joarder
2018-12-07 14:47 ` Mauro Carvalho Chehab
2018-12-07 15:34 ` Robin Murphy
2018-12-07 17:11 ` Matthew Wilcox
2018-12-07 19:28 ` Souptick Joarder
2018-12-07 21:10 ` Robin Murphy [this message]
2018-12-07 21:48 ` Souptick Joarder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67495f8f-2092-e42d-321e-5216c346513f@arm.com \
--to=robin.murphy@arm.com \
--cc=airlied@linux.ie \
--cc=akpm@linux-foundation.org \
--cc=boris.ostrovsky@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jgross@suse.com \
--cc=joro@8bytes.org \
--cc=jrdr.linux@gmail.com \
--cc=keescook@chromium.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=linux@armlinux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@kernel.org \
--cc=mhocko@suse.com \
--cc=oleksandr_andrushchenko@epam.com \
--cc=pawel@osciak.com \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=stefanr@s5r6.in-berlin.de \
--cc=treding@nvidia.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).