Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp2754iol; Wed, 8 Jun 2022 19:50:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqPTiDNhv/EumJzuVtHo6bnMAANhcnUiEblFiZzg6MDjWQlQwRqwZUGUWmmYQJ2lJWCojr X-Received: by 2002:a05:6402:40d4:b0:430:97a9:fa53 with SMTP id z20-20020a05640240d400b0043097a9fa53mr29837876edb.158.1654743029599; Wed, 08 Jun 2022 19:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654743029; cv=none; d=google.com; s=arc-20160816; b=qm3HF69CAR94SgZJo/2jDdOkIGGqMoMPB9kAc3jLabKFGq/LXUvU/N2c/FpC9iLH4N uGfZ35nn26lcIw5uNgkbq3+6ZQoQ4EJoBP/yBHqGGluHb2jtAysqh4DAD4a8jb5gHAr2 9oUJMo/Twu5+6hROidNncat/s8BgGItmLjFGENkapyT0/wfRiiPwqEGSO1EsUp1tmOQQ YnWvwOTcC/m5E7G7B1uvE5aGbgQ3Kdx8gqwuGNOuUkAfcsvYK9rTcAZtZAytZzc2K6dI ye/tHxzS/3qHe24kDcjcW788AiktgI2MxhDbS9FIVivmd/wKDh/2k0wHEkKyWD9kR5Ff alPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=W0D6cN8jS/qYdBTypuq5K9ywfnqqlVZ8+NqAm1ZmKmc=; b=OroKqy/44alVNU/HrBnlK1VYzKOJT0zkbhyG+uANmlDvSvjmWY4etkyJzpQnSdznOH unvJ6Z+WffuE+TPmGrqt5kwQULOrfk0CzTdU0qfqIcsW5MkICGhCOTsW+znJG576jI5b NhovFaN/HQl4VSIncERDY3OZz8M+5qVSEA4nsTNkrA2sBrec06Z5gs41CdoCcAYSf18A aW1X9S20kx8c5/1HTtL806vN+jDC/d2WTl0vdmGCwIccHY7gpwPzjH1UuCAsWRDGDeS5 3v3j1J0r9IVT9WyNNjQd4lbSD9GK2H0TBx/iGBF1hmNtF9CMdB7DXVJ6wvYytOpnP+iw 9iZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HiSay6sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170906668b00b0070b361e2bf4si18182151ejo.25.2022.06.08.19.49.45; Wed, 08 Jun 2022 19:50:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HiSay6sx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236099AbiFIBmq (ORCPT + 99 others); Wed, 8 Jun 2022 21:42:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbiFIBmn (ORCPT ); Wed, 8 Jun 2022 21:42:43 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C833B8; Wed, 8 Jun 2022 18:42:42 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id m20so44597303ejj.10; Wed, 08 Jun 2022 18:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W0D6cN8jS/qYdBTypuq5K9ywfnqqlVZ8+NqAm1ZmKmc=; b=HiSay6sxsKO0+hO5tj9o5ilp1GDilE+uZ8igw4cYdaLJh8UiWbG8SAIRLrbhYExmB+ XbPE7ThqXmPWdyk3J4ZRVCYk/dfZsTqmOPVydK+bbCoBQpe+1zD2OxIgtX25yxVIEN4/ bIjGRjBEQnMRqXglRvw/0/JHkdjt9E4FwO4Oh1nWIAXoBML1ZmQpJK+a4PiL0S4PcyyG qqROQxVo1lqHo6pgMEKUNd6xzUV+FS8WNye6Ifsx3wD9KvnT0g19xp9v2qeRreQSqJ/q iB3qQd+wMI4kH3qjctBiOy3UwGj1gX1QBB22As79vDFGeLdSfQfx4otKQkunRkx3ZXsl RF1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W0D6cN8jS/qYdBTypuq5K9ywfnqqlVZ8+NqAm1ZmKmc=; b=acXp6uuGIxGrc3HVfwg/wk6T9KKBfw83PdtlU+rUC+xLbfBIcLT6FxCsn/srbpVpJb qQeJXqyUeCHc9x/qoOkMMuGG8vwcVUd7jQrquCSH4HeeYBMhVpu9U4g/pyH5A7CAxsJo 5lXhlXXnzI/8glqGf7/B5DR6fL4phu6q2//gOdsYKr9y73UFf2XzQ3s4qCNT2G9KNCJV NymB2UgalLN4dBFTeSq8BPDaVEwJsOuwUnRa1iYlt2CJUyRgs4z7JhpCf2lj0nFA/pjZ KbvZl7ZEMXce5R9HSO4enfh7PEoBsVukFoUeqp+JMXViEHxw7gBHdAVDXhEnBQ48uvKo 29CA== X-Gm-Message-State: AOAM532OgCBbBN77t211MNIExj/ZIJS9wdBW2V0fpIrD17VVVFNlqV5q XdqMJqzpYyD+anWDd4Se8dmlhDJdfvWT3agTK7iu6sjSFHyHqQ== X-Received: by 2002:a17:907:7245:b0:711:d1ff:2ca4 with SMTP id ds5-20020a170907724500b00711d1ff2ca4mr16570995ejc.753.1654738961248; Wed, 08 Jun 2022 18:42:41 -0700 (PDT) MIME-Version: 1.0 References: <20220602055027.849014-1-dzm91@hust.edu.cn> In-Reply-To: From: Dongliang Mu Date: Thu, 9 Jun 2022 09:42:15 +0800 Message-ID: Subject: Re: [PATCH] media: flexcop-usb: fix sanity check of bNumEndpoints To: Johan Hovold Cc: Dongliang Mu , Mauro Carvalho Chehab , gushengxian , Hans Verkuil , Oliver Neukum , Sean Young , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 2, 2022 at 2:45 PM Johan Hovold wrote: > > On Thu, Jun 02, 2022 at 01:50:24PM +0800, Dongliang Mu wrote: > > From: Dongliang Mu > > > > Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type > > ") adds a sanity check for endpoint[1], but fails to modify the sanity > > check of bNumEndpoints. > > > > Fix this by modifying the sanity check of bNumEndpoints to 2. > > Are you sure that d725d20e81c2 ("media: flexcop-usb: sanity checking of > endpoint type) was correct? I am not sure if fc_usb->uintf->cur_altsetting->endpoint[1] is right or not. But the sanity check of bNumEndpoints does not match the following dereference. > > > Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type") > > Signed-off-by: Dongliang Mu > > --- > > drivers/media/usb/b2c2/flexcop-usb.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c > > index 7835bb0f32fc..eb54bfdda01f 100644 > > --- a/drivers/media/usb/b2c2/flexcop-usb.c > > +++ b/drivers/media/usb/b2c2/flexcop-usb.c > > @@ -509,7 +509,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb) > > return ret; > > } > > > > - if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 1) > > + if (fc_usb->uintf->cur_altsetting->desc.bNumEndpoints < 2) > > return -ENODEV; > > if (!usb_endpoint_is_isoc_in(&fc_usb->uintf->cur_altsetting->endpoint[1].desc)) > > return -ENODEV; > > It looks like it should have verified the type of endpoint[0] here > instead. This sanity check originally makes sure the fc_usb->uintf->cur_altsetting->endpoint[0] in flexcop_usb_transfer_init. > > Oliver? > > Johan