From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: linux-mm@kvack.org
Subject: [bug report] mm: change failure of MAP_FIXED to restoring the gap on failure
Date: Tue, 27 Aug 2024 13:22:11 +0300 [thread overview]
Message-ID: <14c0c2ff-e414-4e6d-9029-b738febd4922@stanley.mountain> (raw)
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.
241 pr_warn_once("%s: (%d) Unable to abort munmap() operation\n",
242 current->comm, current->pid);
243 /* Leaving vmas detached and in-tree may hamper recovery */
244 reattach_vmas(mas_detach);
245 } else {
246 /* Clean up the insertion of unfortunate the gap */
247 vms_complete_munmap_vmas(vms, mas_detach);
248 }
249 }
regards,
dan carpenter
next reply other threads:[~2024-08-27 10:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 10:22 Dan Carpenter [this message]
2024-08-27 16:09 ` Liam R. Howlett
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=14c0c2ff-e414-4e6d-9029-b738febd4922@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=Liam.Howlett@oracle.com \
--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