Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp239433pxa; Wed, 26 Aug 2020 09:18:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz39ei7ipxzearbM88HSrrD0PVJLGrtdoyuAyydx8zWsgf6jZSObX7o23lWSV66Q31n5KbG X-Received: by 2002:a05:6402:45a:: with SMTP id p26mr16566901edw.8.1598458698573; Wed, 26 Aug 2020 09:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598458698; cv=none; d=google.com; s=arc-20160816; b=0/ca7Jmt/7+XyfUj/N4JzMUSn7poIPfu00p74SJnFiRfpJgWpL07XERfsjQPj6q6hb qFLe1Z2FbUxp8cyfvdxQScHVfKYO4TCQxh2EhCNzQSY4/PkBJp70xs9K0UcC2KK0Qunq nwL5IhURNNswzSSZ0w11TS+cY+I7tT3NYhSqRse0pU8AQFQ4iVDTBMecat5VF1CibeoK fZmJkhMEgHSIMM1s8DehCrlyPrPjazocWc+7wfcnT5JGomLFckezfrNWXNwlthSlacd/ a5lMNTnHdo2LurYCqEee7eSuD/aP36MFnFBSFN3AhVuIjxn63nx5GEmNdZMOiza/Ct1I tkCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=EnHO5StQCP9RbKm9qw03hmjgbTrZgzw3DLo6Qo1ZjmY=; b=NX/kCbdUASIPUZ+kXbcD99pj/ULoa4q0GKYq7bES082jWb3+deXcfR75XNQaug0Q1S r1jA07X/BHf83CsYryGhw+WSzEfhjOmn4I5GoW1TqNOnaO28m8I/V5dLjUSKizTic3yv To5x42/iAROwT711UOnv8IhhWVs2DBvWUVDxYqJ1XqhhsdsYa3HBaWolthggKrlBBQD7 zlIw9c28V9EZ5Yhr5m6Fs9Pe2vE7izIVKi+c9NlnNIwRLLDAwoKBgrx/n/iF3pwN74Rq 2p+Meh5KhLTZ3i2lNxeXMOHiSr5FLT8g5h+w9UNwiiqH7+EaZFNdhX4gEo0M7FwBq5JN 94eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B3Xa4WrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw14si1782110ejb.728.2020.08.26.09.17.54; Wed, 26 Aug 2020 09:18:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B3Xa4WrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbgHZQQP (ORCPT + 99 others); Wed, 26 Aug 2020 12:16:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:47714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726739AbgHZQPy (ORCPT ); Wed, 26 Aug 2020 12:15:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 05D45206FA; Wed, 26 Aug 2020 16:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598458553; bh=YnC0T6YHps9t//zybcn9H28Fjm7tLDjaqQrBrZhupuo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B3Xa4WrU/FL0+quHw+v0L1nG+bsFcR/3UdvpLzzRlJ/6+8XnjTA/FjFCSM8A6aBZk /XGMm9tBf9QRDKpkm5IFEdihP99p3hdUmqkI14JKSOR6Q4BJbg3YuvygpRxLGwj6OC KeVgXhfw/6LNV4qHepWb6zNScRcYRbblHc88v12o= Date: Wed, 26 Aug 2020 18:16:08 +0200 From: Greg KH To: Andy Shevchenko Cc: Marek Szyprowski , Brooke Basile , Linus Torvalds , Andrew Morton , Linux Kernel Mailing List , USB , Ilja Van Sprundel , Kees Cook , Felipe Balbi , Bartlomiej Zolnierkiewicz Subject: Re: [GIT PULL] USB fixes for 5.9-rc3 Message-ID: <20200826161608.GA1684@kroah.com> References: <20200826134315.GA3882506@kroah.com> <1425ab4f-ef7e-97d9-238f-0328ab51eb35@samsung.com> <20200826153347.GB4187816@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 26, 2020 at 06:53:02PM +0300, Andy Shevchenko wrote: > On Wed, Aug 26, 2020 at 6:36 PM Greg KH wrote: > > On Wed, Aug 26, 2020 at 05:02:38PM +0200, Marek Szyprowski wrote: > > > On 26.08.2020 15:43, Greg KH wrote: > > > > > Brooke Basile (2): > > > > USB: gadget: u_f: add overflow checks to VLA macros > > > > > > Sorry, but the above patch breaks USB Ethernet Gadget operation. It also > > > didn't get the proper testing in linux-next (next-20200826 is the first > > > one with this patch). > > > > > > This is how it explodes on Samsung Exynos (ARM 32bit) based board with > > > g_ether module loaded: > > > Odd, for a "normal" descriptor, the logic should have remained the same > > as without this patch. > > > Brooke, any ideas? > > I have an idea. > > Does below fix this? > > > -- > With Best Regards, > Andy Shevchenko > diff --git a/drivers/usb/gadget/u_f.h b/drivers/usb/gadget/u_f.h > index df4e1dcb357d..0b5c5f0dd073 100644 > --- a/drivers/usb/gadget/u_f.h > +++ b/drivers/usb/gadget/u_f.h > @@ -25,8 +25,8 @@ > size_t offset = 0; \ > if (groupname##__next != SIZE_MAX) { \ > size_t align_mask = __alignof__(type) - 1; \ > - size_t offset = (groupname##__next + align_mask) \ > - & ~align_mask; \ > + offset = (groupname##__next + align_mask) & \ > + ~align_mask; \ > size_t size = array_size(n, sizeof(type)); \ > if (check_add_overflow(offset, size, \ > &groupname##__next)) { \ > @@ -43,8 +43,8 @@ > size_t offset = 0; \ > if (groupname##__next != SIZE_MAX) { \ > size_t align_mask = __alignof__(type) - 1; \ > - size_t offset = (groupname##__next + align_mask) \ > - & ~align_mask; \ > + offset = (groupname##__next + align_mask) & \ > + ~align_mask; \ > if (check_add_overflow(offset, groupname##_##name##__sz,\ > &groupname##__next)) { \ > groupname##__next = SIZE_MAX; \ Oh wow, yeah, that should fix the problem, but would be good to get confirmation... thanks, greg k-h