[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c105740f-4430-c0fe-28fe-8bc4ef8ac64d@canonical.com>
Date: Tue, 11 Apr 2017 22:31:12 +0100
From: Colin Ian King <colin.king@...onical.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Vlastimil Babka <vbabka@...e.cz>, Minchan Kim <minchan@...nel.org>,
Mel Gorman <mgorman@...hsingularity.net>,
Johannes Weiner <hannes@...xchg.org>,
Jérôme Glisse <jglisse@...hat.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
linux-mm@...ck.org, kernel-janitors@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/migrate: check for null vma before dereferencing it
On 11/04/17 22:26, Andrew Morton wrote:
> On Tue, 11 Apr 2017 13:51:02 +0100 Colin King <colin.king@...onical.com> wrote:
>
>> From: Colin Ian King <colin.king@...onical.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
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Powered by blists - more mailing lists