The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Zi Yan" <ziy@nvidia.com>
To: "Alan Stern" <stern@rowland.harvard.edu>
Cc: "Vlastimil Babka" <vbabka@kernel.org>,
	"Harry Yoo" <harry@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Hao Li" <hao.li@linux.dev>, "Christoph Lameter" <cl@gentwo.org>,
	"David Rientjes" <rientjes@google.com>,
	"Roman Gushchin" <roman.gushchin@linux.dev>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>,
	<syzbot+805630f1453e490427fa@syzkaller.appspotmail.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH] mm/slab: reject unsupported kmalloc sizes
Date: Tue, 18 Aug 2026 19:46:44 -0400	[thread overview]
Message-ID: <DKSGY288L1AM.3S7CDZZ3AAGD@nvidia.com> (raw)
In-Reply-To: <3ec57a22-3096-418f-b10f-b0993a352007@rowland.harvard.edu>

On Mon Aug 17, 2026 at 10:59 PM EDT, Alan Stern wrote:
> On Mon, Aug 17, 2026 at 04:40:18PM -0400, Zi Yan wrote:
>> kmalloc is used to allocate physically contiguous memory for kernel
>> allocations. For requests larger than KMALLOC_MAX_CACHE_SIZE, kmalloc uses
>> the page allocator and can only support up to KMALLOC_MAX_SIZE. For request
>> sizes bigger than KMALLOC_MAX_SIZE, the page allocator can emit a WARN
>> because kmalloc allocates an order greater than MAX_PAGE_ORDER. Systems
>> with panic_on_warn=1 crash because of this WARN. Fix it by rejecting any
>> kmalloc size bigger than KMALLOC_MAX_SIZE.
>> 
>> Fixes: aadb4bc4a1f9 ("SLUB: direct pass through of page size or higher kmalloc requests")
>> Reported-by: syzbot+805630f1453e490427fa@syzkaller.appspotmail.com
>> Closes: https://lore.kernel.org/all/6a820ebc.9ebadd4d.20b15e.001b.GAE@google.com/
>> Tested-by: syzbot+805630f1453e490427fa@syzkaller.appspotmail.com
>> Signed-off-by: Zi Yan <ziy@nvidia.com>
>> Cc: stable@vger.kernel.org
>> ---
>> It fixes a page allocator warning (order > MAX_PAGE_ORDER) when gadgetfs
>> requests excessively large memory from kmalloc. Instead of adding
>> __GFP_NOWARN to suppress the warning, as was done for usbfs[1], change
>> kmalloc to return NULL without a warning for this specific issue.
>> 
>> [1] commit 4f2629ea67e72 ("USB: usbfs: Don't WARN about excessively large memory allocations")
>
> Thanks for doing this.  If you like, I can write a follow-up patch to 
> remove the __GFP_NOWARN added in 4f2629ea67e72, now that it isn't needed 
> any more.

Sure. Once the patch gets an Ack or Rb from a maintainer and Andrew
picks it up, feel free to send a cleanup patch. Thanks.

-- 
Best Regards,
Yan, Zi


      reply	other threads:[~2026-08-18 23:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 20:40 [PATCH] mm/slab: reject unsupported kmalloc sizes Zi Yan
2026-08-18  2:59 ` Alan Stern
2026-08-18 23:46   ` Zi Yan [this message]

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=DKSGY288L1AM.3S7CDZZ3AAGD@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=syzbot+805630f1453e490427fa@syzkaller.appspotmail.com \
    --cc=vbabka@kernel.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