From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753589AbdKJSen (ORCPT ); Fri, 10 Nov 2017 13:34:43 -0500 Received: from dougal.metanate.com ([90.155.101.14]:64845 "EHLO metanate.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753164AbdKJSel (ORCPT ); Fri, 10 Nov 2017 13:34:41 -0500 Date: Fri, 10 Nov 2017 18:34:08 +0000 From: John Keeping To: Felipe Balbi Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Vincent Pelletier , Jim Lin , Janusz Dziedzic , stable@vger.kernel.org Subject: Re: [PATCH] usb: f_fs: Drop check on Reserved1 field on OS_DESC_EXT_COMPAT Message-ID: <20171110183408.4fc19913.john@metanate.com> In-Reply-To: <874lq2zaag.fsf@linux.intel.com> References: <20171109163429.8697-1-john@metanate.com> <874lq2zaag.fsf@linux.intel.com> Organization: Metanate Ltd X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Nov 2017 12:40:39 +0200, Felipe Balbi wrote: > John Keeping writes: > > This check has gone through several incompatible variations in commits > > 53642399aa71 ("usb: gadget: f_fs: Fix wrong check on reserved1 of > > OS_DESC_EXT_COMPAT"), 354bc45bf329 ("usb: gadget: f_fs: Fix ExtCompat > > descriptor validation") and 3ba534df815f ("Revert "usb: gadget: f_fs: > > Fix ExtCompat descriptor validation"") after initially being introduced > > in commit f0175ab51993 ("usb: gadget: f_fs: OS descriptors support"). > > > > The various changes make it impossible for a single userspace > > implementation to work with different kernel versions, so let's just > > drop the condition to avoid breaking userspace. > > > > Fixes: 53642399aa71 ("usb: gadget: f_fs: Fix wrong check on reserved1 of OS_DESC_EXT_COMPAT") > > Cc: stable@vger.kernel.org # v4.7+ > > Signed-off-by: John Keeping > > --- > > drivers/usb/gadget/function/f_fs.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c > > index 652397eda6d6..0d9962834345 100644 > > --- a/drivers/usb/gadget/function/f_fs.c > > +++ b/drivers/usb/gadget/function/f_fs.c > > @@ -2282,8 +2282,7 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, > > int i; > > > > if (len < sizeof(*d) || > > - d->bFirstInterfaceNumber >= ffs->interfaces_count || > > - !d->Reserved1) > > + d->bFirstInterfaceNumber >= ffs->interfaces_count) > > return -EINVAL; > > for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) > > if (d->Reserved2[i]) > > Sorry, but no. We want to be compliant with the specification. If there > are older still-maintained stable trees which are not working, we need > to backport a fix to them, but we're not allowing uncompliant > implementations. Aren't we allowing non-compliant implementations now? The spec says the value must be 1 but since v4.7 this code has allowed all non-zero values. At this point I don't think the kernel can disallow any values of Reserved1 without breaking someone's userspace.