linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Vlastimil Babka" <vbabka@suse.cz>,
	"Minchan Kim" <minchan@kernel.org>,
	"Mel Gorman" <mgorman@techsingularity.net>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-mm@kvack.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/migrate: check for null vma before dereferencing it
Date: Tue, 11 Apr 2017 22:31:12 +0100	[thread overview]
Message-ID: <c105740f-4430-c0fe-28fe-8bc4ef8ac64d@canonical.com> (raw)
In-Reply-To: <20170411142633.d01ba0aaeb3e6075d517208c@linux-foundation.org>

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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-04-11 21:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 12:51 Colin King
2017-04-11 21:26 ` Andrew Morton
2017-04-11 21:31   ` Colin Ian King [this message]
2017-04-11 21:46     ` Andrew Morton

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=c105740f-4430-c0fe-28fe-8bc4ef8ac64d@canonical.com \
    --to=colin.king@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=jglisse@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=minchan@kernel.org \
    --cc=vbabka@suse.cz \
    /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