Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1621645
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mm/migrate: check for null vma before dereferencing it |
| Date | 2017-04-11 23:50 +0200 |
| Message-ID | <tvbPH-471-1@gated-at.bofh.it> (permalink) |
| References | <tv3yN-77s-3@gated-at.bofh.it> <tvbwm-3ZY-17@gated-at.bofh.it> <tvbG1-43u-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, 11 Apr 2017 22:31:12 +0100 Colin Ian King <colin.king@canonical.com> wrote:
> On 11/04/17 22:26, Andrew Morton wrote:
> > On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@canonical.com> wrote:
> >
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> check if vma is null before dereferencing it, this avoiding any
> >> potential null pointer dereferences on vma via the is_vm_hugetlb_page
> >> call or the direct vma->vm_flags reference.
> >>
> >> Detected with CoverityScan, CID#1427995 ("Dereference before null check")
> >>
> >> ...
> >>
> >> --- a/mm/migrate.c
> >> +++ b/mm/migrate.c
> >> @@ -2757,10 +2757,10 @@ int migrate_vma(const struct migrate_vma_ops *ops,
> >> /* Sanity check the arguments */
> >> start &= PAGE_MASK;
> >> end &= PAGE_MASK;
> >> - if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> - return -EINVAL;
> >> if (!vma || !ops || !src || !dst || start >= end)
> >> return -EINVAL;
> >> + if (is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_SPECIAL))
> >> + return -EINVAL;
> >> if (start < vma->vm_start || start >= vma->vm_end)
> >> return -EINVAL;
> >> if (end <= vma->vm_start || end > vma->vm_end)
> >
> > I don't know what kernel version this is against but I don't think it's
> > anything recent?
>
> I should have said it was against linux-next
ah, it modifies an HMM patch which I dropped a couple of hours ago. One
for Jerome, please.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] mm/migrate: check for null vma before dereferencing it Colin King <colin.king@canonical.com> - 2017-04-11 15:00 +0200
Re: [PATCH] mm/migrate: check for null vma before dereferencing it Andrew Morton <akpm@linux-foundation.org> - 2017-04-11 23:30 +0200
Re: [PATCH] mm/migrate: check for null vma before dereferencing it Colin Ian King <colin.king@canonical.com> - 2017-04-11 23:40 +0200
Re: [PATCH] mm/migrate: check for null vma before dereferencing it Andrew Morton <akpm@linux-foundation.org> - 2017-04-11 23:50 +0200
csiph-web