From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADDAA3955FC for ; Sun, 16 Aug 2026 23:32:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786923141; cv=none; b=hW/k1lxhLQYtkokZkP6vmB0g3bG523YvondQ+m4naz7GXidQibjSVc0NYc0fimF6zp/X+G4ByJpWgqL+LiOfR52KnjZVPONwcMItepYRe0TiU7PmkW7yjot0EQA3rUNyN+09VXlU3sSaXzrcYewAcnVH4ElmktBTFOQ4g8llPRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786923141; c=relaxed/simple; bh=reTFMbdkq+lZ/iEzv6ZNkxXctSdjmsEoiDTX0+6ssZw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OuyWPeXAdCrXfHNxIUR7z+bVRK22P3YwKjccSlmm/mAflS6b/BI+ySKIm43Iv8N1J/EQfGVcYdxVxQQj6Bd6S5Oq6YeNa185+VVW0FBCj5cK9L86MazikeEL0J2ehcfEMMW/fPI+iTzMtIOS9zejDydFgP8nhIZPesxP2WWScC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu; spf=fail smtp.mailfrom=g.harvard.edu; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b=TEQ2zm7r; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=g.harvard.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b="TEQ2zm7r" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-92e5c9211d2so223129185a.1 for ; Sun, 16 Aug 2026 16:32:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rowland.harvard.edu; s=google; t=1786923136; x=1787527936; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=BioqsUd1GnS7GvqtNJ5JnjYlksYkVofgrlCf+OKGs8k=; b=TEQ2zm7rD1gNZOd8Mb40y4c+T4H1DJE07tRBCBv/A/sgEw+4DwVYmbBqrRgSyWMAfA LcmNnwDVMmOTinA1E3UJ6XOEWiE3bRRGqrLOvlDkkRe+QAVLXusYuHOR6YtvnicjTr0D SloQsHwsuXTjychZDunyMSU1YTICxVaMcKkkvwaRS7PjA9HpNTKh3DUB5aA0jy4WEmMl QQBK4pTnZRjBlBfcJ+tIt3emjbM1vC8PTRiAWHou9FlK9qPdbl4hT/yZQS+RTtxyZJ+p 7tTYIgVdidkup8YGh8oYvTK0rLgufje6gR7AiyfPqkx1xZS60acc1BG9BCzQUtEg/pCz Htkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786923136; x=1787527936; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=BioqsUd1GnS7GvqtNJ5JnjYlksYkVofgrlCf+OKGs8k=; b=GQg5vzDKYXWj6D3xmw1waqbmKiH1yT6GKP1T5I709z1zWFiFtxGXFEAz9tpKhNxdn5 w5qIx19s8+rsOjvGX4u1EP4KRxsyLC0KYC4JSc3XGoG08Rz3jahEfPLz+JYp+ovJOAZq vBEdl/D4i2OlHhtjPGEQa8ubyjTfNFi6GFM4Q4fgoEWEgy7A2352/SexmtvSr1YrLD// Xm2JxCQy0fCsu22CkkJPb/3lA/Gw5+shajXsKoFRv13LMw67Tepo9LtSs0W83dIeVxrW BLZpo4EcBqRk6gs146diD0GeXJXZWykUKk6KqpbzA8nAG79h0v66yNYsl8e9p5N32Kgl K6Mw== X-Forwarded-Encrypted: i=1; AHgh+RoNRb+CBAuRYgpF5z8HetWFX4+X8ZOQ50QJOMU2X4iy+X4HwZwLhRa6ywTVkUe0XMqFjBFgXxFB9GuGd5A=@vger.kernel.org X-Gm-Message-State: AOJu0Yw92h59yatC7nPeH/mFJOCxbPdEuk2vjl5D5VDuUHV74EdfNDSh RwbLYNJBV6rkFICpcmVybyrH9OAlWQErgEO07bgIQLxfZCH3T7gCMMBRwFUFN7e1+w== X-Gm-Gg: AR+sD11B1nv40iOxYIcuGkJBymIx3+rOM+O6rLi/q/N9qndJuGDJl8WukKW23NPGw2M 61W9JB+vjRaTbYgLbvdgPTZlOJ8RL26CE2IRP1CSyLSb14LoNDxOjgWhVCRAAx3xQxMcWq5ctMU 7mkNYfQLSG+wC2urOUBIbJnfLxxCF3KLCQtBQr7UxOKKeFn0QQ6UEqON3su7lVmwEeDb01d7R3Q 3YxaUWhn+OFjc5MFP5204htCvTfNWv+u/rC6FlaoyfVPR5DxhVfv165Zc022a7wP9W26PsG8kXY 7dEIvf+4e2wcAFRhUH5XTFHuJKmZ1QdGOZ6gHr+1v9soM5gokEUbLvyoH/VLm8WlsiBaGceEnc4 LeTMcVdVqcvV0ItGDJve/XCfjwU51vXkkKtaRrMX3q1TiIEf+MGBVwBDrDKdk0ghQSa0JfMnppm ncuVClHe49DSLjnHLG/XgvduugBE2W7DddwK8i+kyLLtCrLnmVTWfAMkQLMUZ17g== X-Received: by 2002:a05:622a:292:b0:517:6d82:ceff with SMTP id d75a77b69052e-52d853cbab0mr225176651cf.13.1786923135671; Sun, 16 Aug 2026 16:32:15 -0700 (PDT) Received: from rowland.harvard.edu ([2601:19b:d01:d210::dfd8]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-90a9350678esm68674476d6.26.2026.08.16.16.32.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 16:32:15 -0700 (PDT) Date: Sun, 16 Aug 2026 19:32:12 -0400 From: Alan Stern To: Zi Yan Cc: Andrew Morton , syzbot , apopple@nvidia.com, byungchul@sk.com, david@kernel.org, gourry@gourry.net, joshua.hahnjy@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, matthew.brost@intel.com, rakie.kim@sk.com, syzkaller-bugs@googlegroups.com, ying.huang@linux.alibaba.com, Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: Re: [syzbot] [mm?] WARNING in ep_write_iter Message-ID: <02c2e5c7-0d78-4763-90ff-75fa87105fcb@rowland.harvard.edu> References: <6a820ebc.9ebadd4d.20b15e.001b.GAE@google.com> <20260816135201.98590b17b526dda8c4ec9105@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sun, Aug 16, 2026 at 05:47:34PM -0400, Zi Yan wrote: > On Sun Aug 16, 2026 at 4:52 PM EDT, Andrew Morton wrote: > > On Sun, 16 Aug 2026 12:25:48 -0700 syzbot wrote: > > > >> Hello, > >> > >> syzbot found the following issue on: > >> > >> HEAD commit: 3d6d817622b0 Merge tag 'scsi-fixes' of git://git.kernel.or.. > >> git tree: upstream > >> console output: https://syzkaller.appspot.com/x/log.txt?x=15927479580000 > >> kernel config: https://syzkaller.appspot.com/x/.config?x=a59830cba91a1981 > >> dashboard link: https://syzkaller.appspot.com/bug?extid=805630f1453e490427fa > >> compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 > >> > >> Unfortunately, I don't have any reproducer for this issue yet. > >> > >> Downloadable assets: > >> disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-3d6d8176.raw.xz > >> vmlinux: https://storage.googleapis.com/syzbot-assets/d19e0514c02a/vmlinux-3d6d8176.xz > >> kernel image: https://storage.googleapis.com/syzbot-assets/f6da706811f4/bzImage-3d6d8176.xz > >> > >> IMPORTANT: if you fix the issue, please add the following tag to the commit: > >> Reported-by: syzbot+805630f1453e490427fa@syzkaller.appspotmail.com > >> > >> gadgetfs: bound to dummy_udc driver > >> ------------[ cut here ]------------ > >> 1 > >> WARNING: mm/page_alloc.c:5280 at __alloc_frozen_pages_noprof+0x2ce/0x380 mm/page_alloc.c:5280, CPU#0: syz.0.0/5319 > > > > Thanks. drivers/usb/gadget is the offender. > > > > Gemini sums it up well. "ep_write_iter() needs a bounds check prior to > > memory allocation". https://share.gemini.google/5NzjyttO0ULc > > > > I expect an easy fix would be > > Maybe it is better to stop asking kmalloc for unreasonable len: > > > diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c > index d87a8ab515107..20905f254968f 100644 > --- a/drivers/usb/gadget/legacy/inode.c > +++ b/drivers/usb/gadget/legacy/inode.c > @@ -645,6 +645,9 @@ ep_write_iter(struct kiocb *iocb, struct iov_iter *from) > ssize_t value; > char *buf; > > + if (len > KMALLOC_MAX_SIZE) > + return -EINVAL; Is there any reason to think that KMALLOC_MAX_SIZE is a good limit? The allocation could still fail, and you'd still get a WARNing. I prefer Andrew's first suggestion. If the user asks the kernel to copy too much data, just fail -- with no warning. Alan Stern