]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: Do nothing if too small brk is specified
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Wed, 2 Aug 2023 07:17:51 +0000 (16:17 +0900)
committerRichard Henderson <richard.henderson@linaro.org>
Sun, 6 Aug 2023 23:45:03 +0000 (16:45 -0700)
Linux 6.4.7 does nothing when a value smaller than the initial brk is
specified.

Fixes: 86f04735ac ("linux-user: Fix brk() to release pages")
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-6-akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
linux-user/syscall.c

index f64024273ffde72eb3a1d1d4ddac790621ad1b1c..e1436a39627f4167b1f0e338c5df49849e1f03ad 100644 (file)
@@ -820,14 +820,14 @@ abi_long do_brk(abi_ulong brk_val)
 
     /* brk pointers are always untagged */
 
-    /* return old brk value if brk_val unchanged or zero */
-    if (!brk_val || brk_val == target_brk) {
+    /* return old brk value if brk_val unchanged */
+    if (brk_val == target_brk) {
         return target_brk;
     }
 
     /* do not allow to shrink below initial brk value */
     if (brk_val < initial_target_brk) {
-        brk_val = initial_target_brk;
+        return target_brk;
     }
 
     new_brk = TARGET_PAGE_ALIGN(brk_val);