Linux-Media Archive mirror
 help / color / mirror / Atom feed
From: Zheng Yejian <zhengyejian1@huawei.com>
To: Sean Young <sean@mess.org>
Cc: <mchehab@kernel.org>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Zheng Yejian <zhengyejian1@huawei.com>
Subject: Re: [PATCH] media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()
Date: Tue, 30 Apr 2024 18:05:44 +0800	[thread overview]
Message-ID: <83a05d49-6367-9bdd-0702-940e32b072a4@huawei.com> (raw)
In-Reply-To: <ZjC7rXU7ViaH60_S@gofer.mess.org>

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
>>


  reply	other threads:[~2024-04-30 10:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 13:52 [PATCH] media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control() Zheng Yejian
2024-04-29 11:24 ` Zheng Yejian
2024-04-30  8:04   ` Sean Young
2024-04-30  9:19     ` Zheng Yejian
2024-04-30  9:36       ` Sean Young
2024-04-30 10:05         ` Zheng Yejian [this message]
2024-04-30 10:41 ` [PATCH v2] " Zheng Yejian
2024-05-03 11:51   ` Sean Young
2024-05-09 12:44     ` [PATCH v3] " Zheng Yejian
2024-05-27  8:27     ` [PATCH v2] " Zheng Yejian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a05d49-6367-9bdd-0702-940e32b072a4@huawei.com \
    --to=zhengyejian1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sean@mess.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).