linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-mm@kvack.org
Subject: Re: [bug report] mm: change failure of MAP_FIXED to restoring the gap on failure
Date: Tue, 27 Aug 2024 12:09:52 -0400	[thread overview]
Message-ID: <vpg25h3qflmuqvx4c73fleve5dqzz7taxr5ebx3fjuyhwmuuup@hq6ipfvd633f> (raw)
In-Reply-To: <14c0c2ff-e414-4e6d-9029-b738febd4922@stanley.mountain>

* Dan Carpenter <dan.carpenter@linaro.org> [240827 06:22]:
> Hello Liam R. Howlett,
> 
> Commit 131e4ef350fa ("mm: change failure of MAP_FIXED to restoring
> the gap on failure") from Aug 22, 2024 (linux-next), leads to the
> following Smatch static checker warning:
> 
> 	mm/vma.h:240 vms_abort_munmap_vmas()
> 	error: NULL dereference inside function
> 
> mm/vma.h
>     226 static inline void vms_abort_munmap_vmas(struct vma_munmap_struct *vms,
>     227                 struct ma_state *mas_detach)
>     228 {
>     229         if (!vms->nr_pages)
>     230                 return;
>     231 
>     232         if (vms->clear_ptes)
>     233                 return reattach_vmas(mas_detach);
>     234 
>     235         /*
>     236          * Aborting cannot just call the vm_ops open() because they are often
>     237          * not symmetrical and state data has been lost.  Resort to the old
>     238          * failure method of leaving a gap where the MAP_FIXED mapping failed.
>     239          */
> --> 240         if (unlikely(vma_iter_store_gfp(vms->vmi, NULL, GFP_KERNEL))) {
>                                                           ^^^^
> Passing a NULL "vma" pointer will lead to a crash.

Ah, yes it will.

I need to use vma_iter_clear(vms->vmi);


Thanks,
Liam


      reply	other threads:[~2024-08-27 16:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 10:22 Dan Carpenter
2024-08-27 16:09 ` Liam R. Howlett [this message]

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=vpg25h3qflmuqvx4c73fleve5dqzz7taxr5ebx3fjuyhwmuuup@hq6ipfvd633f \
    --to=liam.howlett@oracle.com \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-mm@kvack.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