lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211012034955.2802626-1-mudongliangabcd@gmail.com>
Date:   Tue, 12 Oct 2021 11:49:54 +0800
From:   Dongliang Mu <mudongliangabcd@...il.com>
To:     Denis Efremov <efremov@...ux.com>, Jens Axboe <axboe@...nel.dk>
Cc:     Dongliang Mu <mudongliangabcd@...il.com>,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] driver: floppy: fix warning in __alloc_pages

If the user-provided length (ptr->length) is longer than one threshold,
it will trigger a warning in __alloc_pages.

Fix this by checking get_order(ptr->length) >= MAX_ORDER.

Signed-off-by: Dongliang Mu <mudongliangabcd@...il.com>
---
 drivers/block/floppy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index fef79ea52e3e..8b88960e2784 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3109,6 +3109,8 @@ static int raw_cmd_copyin(int cmd, void __user *param,
 	if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) {
 		if (ptr->length <= 0)
 			return -EINVAL;
+		if (get_order(ptr->length) >= MAX_ORDER)
+			return -EINVAL;
 		ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length);
 		fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length);
 		if (!ptr->kernel_data)
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ