Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1912367lqa; Tue, 30 Apr 2024 03:06:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzD1JXZrHctUuZ/mFd1hoeHcec2eiKyyMUB/rzzzQqjCLH2TZnvUNqgWjgw8j8OCNqku2G2Bvgbc9RDzB5xdC2BnB3MszOL3OkF9pkJg== X-Google-Smtp-Source: AGHT+IHxytIf0FPLApJvgINc+trXpzT0Om3ogcygN5kbZiN2YYld+6Ngi5yhOAFGmlkNBJ5gMKlB X-Received: by 2002:a17:90b:1944:b0:2b1:b1a1:1310 with SMTP id nk4-20020a17090b194400b002b1b1a11310mr4921692pjb.29.1714471570586; Tue, 30 Apr 2024 03:06:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714471570; cv=pass; d=google.com; s=arc-20160816; b=qyjZENGajomtdUpBsi1K/7XYvMQ/PSZyYmx88Kp0HwFIHUuEuvLigH4zsqVUFVB8Lo BjP4HwVqLYZkqwF6AlVWCT6ek3ej1pYCAK7+1ma4fc9hAfu3x032Mg0DM1IZ+1lP2grZ DYAGV/246Wkue8x/ncXLMBdLZTUzHODOH/FkoXF7ONrTY2lAwNE5X3aiWMufTAKjVQO/ I2fJufcVJ5FmJrkgUxTWN8r9Ftm3UNo4FOJ7EARq9F8q/b2+XKUY8ubucGe6+RZCX2Of qGbrCngGHoi9RXgn0mbuY6e+62babbh8fljH9KhT1G3CiFmk688qeecSem/1I48UpslG Nx+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=lJCKUsi/oK6ctY2D8vY2Tgf0kEaIzXuzBTzPB3Mjz6g=; fh=KVx2zbt1MNWz/qojuRwW0EceKhxLSONlUDUFPY1zdCo=; b=kMWOqDnqVvHnpJn/nfRuLH5SFMZqzIKi0t26H4ljikRkqMsLbDcrIlrcWVeJBWF9xQ Qh97ie05a/MsWekj8qGauvPgwHAgXooRsZzZfJsx8pJ13CapGunwhv0+rXI+efEunu8/ iurcCUTuYeTZfrzJqUOZZwWv3mrGydFwwrXtmOS6W33BkBKSj/TScu3o9uWSMBaBIs2r 9mN2Uxfm8oqPHFqLy9prSZShiO2S5OIRAZ7i6QmByQ36Ab0s7X/zZE7yQQn06p09AytE zJKUKK9xwMn4gw4fzFOpahUaAoDYBu5xohEU81EyD/0ZLzFhRGniOFovpXayWx6bwjTg 8dxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-163741-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163741-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p32-20020a634f60000000b005dca7d50880si21994070pgl.696.2024.04.30.03.06.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 03:06:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163741-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-163741-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163741-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1DB3C283F84 for ; Tue, 30 Apr 2024 10:06:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3E98129E86; Tue, 30 Apr 2024 10:05:56 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE9B41292C8; Tue, 30 Apr 2024 10:05:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714471556; cv=none; b=RwMyuSfzAeP4n66gaaBwCFf4Kb4JWQ/LnDWfrlz1aGQBfWTVdU7/FAA6l+mUWBWW3UEE72CkvfWxEYrS88eG1XAHp8Ow7aeUSEpQojW08E4PQhfuvFBvuoWdqMlPHdur3gdOp0uzJptWdt6FYbyILi+AVvPv/TGx/zuzdyiBIK8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714471556; c=relaxed/simple; bh=dhe9uYcPlH3P2B5i3QKvhg+jgfj9ROJsg9EOJ6MfKYU=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=GQGbdSCQwm92x01bthju9tGELJzA/mOyp69IVE2bPC+9u7AaNhE6vUmM9oanjOwKg1RzCOhm6fXLY3kmzLy9rUileve4KBVdmgaR4LGSJLj4/V18KIO19F4Vmx0LEfaDAf7C1a6Wm25iOaP/syE1OyhGkX4ClfE8vstGrPNQhd0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4VTG3b5NwDz1ymXf; Tue, 30 Apr 2024 18:03:07 +0800 (CST) Received: from dggpeml500012.china.huawei.com (unknown [7.185.36.15]) by mail.maildlp.com (Postfix) with ESMTPS id 46AF9140109; Tue, 30 Apr 2024 18:05:45 +0800 (CST) Received: from [10.67.111.172] (10.67.111.172) by dggpeml500012.china.huawei.com (7.185.36.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 30 Apr 2024 18:05:45 +0800 Message-ID: <83a05d49-6367-9bdd-0702-940e32b072a4@huawei.com> Date: Tue, 30 Apr 2024 18:05:44 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control() Content-Language: en-US To: Sean Young CC: , , , Zheng Yejian References: <20240412135256.1546051-1-zhengyejian1@huawei.com> <5c0359c7-502f-fe8b-c1ee-3470b36b586c@huawei.com> <37581090-ae63-46c4-98c1-76e9138e6b6e@huawei.com> From: Zheng Yejian In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500012.china.huawei.com (7.185.36.15) On 2024/4/30 17:36, Sean Young wrote: > On Tue, Apr 30, 2024 at 05:19:56PM +0800, Zheng Yejian wrote: >> Thanks for your suggestion! >> Do you mean the following change? If it is ok, I'll send a v2! >> >> diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c >> index fbf58012becd..2a8395d6373c 100644 >> --- a/drivers/media/usb/dvb-usb/dvb-usb-init.c >> +++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c >> @@ -23,6 +23,23 @@ static int dvb_usb_force_pid_filter_usage; >> module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444); >> MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0)."); >> >> +static int dvb_usb_clear_halt(struct dvb_usb_device *d, u8 endpoint) > > I don't think this is a good function name; we are checking that the > endpoint is correct and also clearing halts. > > How about: dvb_usb_check_bulk_endpoint() Sure, I'll do it in v2! -- Thank, Zheng Yejian > > Looks good otherwise > > Sean > >> +{ >> + if (endpoint) { >> + int ret; >> + >> + ret = usb_pipe_type_check(d->udev, usb_sndbulkpipe(d->udev, endpoint)); >> + if (ret) >> + return ret; >> + ret = usb_pipe_type_check(d->udev, usb_rcvbulkpipe(d->udev, endpoint)); >> + if (ret) >> + return ret; >> + usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, endpoint)); >> + usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, endpoint)); >> + } >> + return 0; >> +} >> + >> static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) >> { >> struct dvb_usb_adapter *adap; >> @@ -103,10 +120,12 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) >> * when reloading the driver w/o replugging the device >> * sometimes a timeout occurs, this helps >> */ >> - if (d->props.generic_bulk_ctrl_endpoint != 0) { >> - usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); >> - usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); >> - } >> + ret = dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint); >> + if (ret) >> + goto frontend_init_err; >> + ret = dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint_response); >> + if (ret) >> + goto frontend_init_err; >> >> return 0; >> >> -- >> Thanks, >> Zheng Yejian >> >>> Thanks >>> >>> Sean >>