All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/msync: exit early when the flags is an MS_ASYNC and start < vm_start
@ 2020-10-12 16:09 Nikita Ermakov
  2020-10-20 10:19 ` Vlastimil Babka
  0 siblings, 1 reply; 9+ messages in thread
From: Nikita Ermakov @ 2020-10-12 16:09 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrew Morton, Nikita Ermakov

Exit from the loop over the VMA in the case when the flags
contain only an MS_ASYNC and start < vm_start. In this case msync()
would return with -ENOMEM anyway so make it return early.

Signed-off-by: Nikita Ermakov <sh1r4s3@mail.si-head.nl>
---
 mm/msync.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/msync.c b/mm/msync.c
index 69c6d2029531..ed20c3621d4c 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -69,6 +69,8 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
 			goto out_unlock;
 		/* Here start < vma->vm_end. */
 		if (start < vma->vm_start) {
+			if (flags == MS_ASYNC)
+				goto out_unlock;
 			start = vma->vm_start;
 			if (start >= end)
 				goto out_unlock;

base-commit: 6824a8a9b4861d7df7ee132a952bdf6f84a99cb8
-- 
2.28.0



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-10-25  9:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 16:09 [PATCH] mm/msync: exit early when the flags is an MS_ASYNC and start < vm_start Nikita Ermakov
2020-10-20 10:19 ` Vlastimil Babka
2020-10-20 14:38   ` Nikita
2020-10-20 15:03     ` Vlastimil Babka
2020-10-20 16:19       ` Nikita
2020-10-20 20:56         ` [PATCH v2] " Nikita Ermakov
2020-10-23 11:12           ` Vlastimil Babka
2020-10-25  9:29             ` [PATCH v3] " Nikita Ermakov
2020-10-25  9:38             ` [PATCH v2] " Nikita Ermakov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.