linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
To: alex.dewar90@gmail.com
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, snovitoll@gmail.com,
	syzbot+15ec7391f3d6a1a7cc7d@syzkaller.appspotmail.com
Subject: [PATCH v3] drivers/misc/vmw_vmci: restrict too big queue size in
Date: Tue,  9 Feb 2021 15:45:25 +0600	[thread overview]
Message-ID: <20210209094525.2099687-1-snovitoll@gmail.com> (raw)
In-Reply-To: <a10296cf-4545-c7f3-1d3c-31fbd05c3f6c@gmail.com>

> syzbot found WARNING in qp_broker_alloc[1] in qp_host_alloc_queue()
> when num_pages is 0x100001, giving queue_size + queue_page_size
> bigger than KMALLOC_MAX_SIZE for kzalloc(), resulting order >= MAX_ORDER
> condition.
>
> queue_size + queue_page_size=0x8000d8, where KMALLOC_MAX_SIZE=0x400000.
>
Reported-by: syzbot+15ec7391f3d6a1a7cc7d@syzkaller.appspotmail.com
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
> ---
>>> As this is controllable by userspace, you just provided a way to flood
>>> the kernel logs.
>>>
>>> Please make this a dev_dbg() call instead, if you really want to see it.
>>> Otherwise just return NULL, no need to report anything, right?
>> Thanks, removed pr_warn().

>Looks like you forgot to take out the opening brace.

Cringe moment. Sorry, should've checked it properly first.

v3: Removed opening brace.
---
 drivers/misc/vmw_vmci/vmci_queue_pair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
index ea16df73cde0..024dcdbd9d01 100644
--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -537,7 +537,7 @@ static struct vmci_queue *qp_host_alloc_queue(u64 size)
 
 	queue_page_size = num_pages * sizeof(*queue->kernel_if->u.h.page);
 
-	if (queue_size + queue_page_size > KMALLOC_MAX_SIZE) {
+	if (queue_size + queue_page_size > KMALLOC_MAX_SIZE)
 		return NULL;
 
 	queue = kzalloc(queue_size + queue_page_size, GFP_KERNEL);
-- 
2.25.1


  reply	other threads:[~2021-02-09  9:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-06  5:34 [PATCH] drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue Sabyrzhan Tasbolatov
2021-02-09  8:38 ` Greg KH
2021-02-09  9:31   ` [PATCH v2] drivers/misc/vmw_vmci: restrict too big queue size in Sabyrzhan Tasbolatov
2021-02-09  9:32     ` Alex Dewar
2021-02-09  9:45       ` Sabyrzhan Tasbolatov [this message]
2021-02-09  9:54         ` [PATCH v3] " Greg KH
2021-02-09 10:26           ` [PATCH v4] drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue Sabyrzhan Tasbolatov
2021-02-09  9:49     ` [PATCH v2] drivers/misc/vmw_vmci: restrict too big queue size in Greg KH

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=20210209094525.2099687-1-snovitoll@gmail.com \
    --to=snovitoll@gmail.com \
    --cc=alex.dewar90@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+15ec7391f3d6a1a7cc7d@syzkaller.appspotmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).