linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>
Subject: [PATCH/RFC] usb: gadget: function: printer: avoid wrong list handling in printer_write()
Date: Mon, 21 May 2018 13:18:50 +0300	[thread overview]
Message-ID: <87wovx71md.fsf@linux.intel.com> (raw)

Hi,

Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> writes:
> Hi,
>
>> From: Felipe Balbi, Sent: Monday, May 21, 2018 5:05 PM
> <snip>
>> seems like it would be better to just move this like before
>> usb_ep_queue():
>> 
>> modified   drivers/usb/gadget/function/f_printer.c
>> @@ -631,19 +631,19 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
>>  			return -EAGAIN;
>>  		}
>> 
>> +		list_add(&req->list, &dev->tx_reqs_active);
>> +
>>  		/* here, we unlock, and only unlock, to avoid deadlock. */
>>  		spin_unlock(&dev->lock);
>>  		value = usb_ep_queue(dev->in_ep, req, GFP_ATOMIC);
>>  		spin_lock(&dev->lock);
>>  		if (value) {
>> +			list_del(&req->list);
>>  			list_add(&req->list, &dev->tx_reqs);
>>  			spin_unlock_irqrestore(&dev->lock, flags);
>>  			mutex_unlock(&dev->lock_printer_io);
>>  			return -EAGAIN;
>>  		}
>> -
>> -		list_add(&req->list, &dev->tx_reqs_active);
>> -
>>  	}
>> 
>>  	spin_unlock_irqrestore(&dev->lock, flags);
>> 
>> --
>
> Thank you very much for your patch! This could resolve the issue.
> So, should I submit this your patch as your author?

you can send it with your authorship, it's totally fine :-)

You can also add my:

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

thanks

             reply	other threads:[~2018-05-21 10:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21 10:18 Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-21 11:16 [PATCH/RFC] usb: gadget: function: printer: avoid wrong list handling in printer_write() Yoshihiro Shimoda
2018-05-21  8:57 Yoshihiro Shimoda
2018-05-21  8:04 Felipe Balbi
2018-05-21  7:57 Yoshihiro Shimoda
2018-05-21  6:57 Felipe Balbi
2018-05-18  8:37 Yoshihiro Shimoda

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=87wovx71md.fsf@linux.intel.com \
    --to=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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 NNTP newsgroup(s).