Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1288231 > unrolled thread

Re: [PATCHv3] Input: xpad - Fix double URB submission races

Started byDmitry Torokhov <dmitry.torokhov@gmail.com>
First post2015-12-10 07:50 +0100
Last post2015-12-10 07:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCHv3] Input: xpad - Fix double URB submission races Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2015-12-10 07:50 +0100

#1288231 — Re: [PATCHv3] Input: xpad - Fix double URB submission races

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2015-12-10 07:50 +0100
SubjectRe: [PATCHv3] Input: xpad - Fix double URB submission races
Message-ID<qE3d7-2tB-3@gated-at.bofh.it>
Hi Laura,

On Mon, Nov 16, 2015 at 02:47:13PM -0800, Laura Abbott wrote:
> +static int __xpad_submit_urb(struct usb_xpad *xpad,
> +			unsigned char odata[XPAD_PKT_LEN], int transfer_length,
> +			int type, bool safe_submit)
> +{
> +	int ret;
> +
> +	if (safe_submit || xpad->submit_state == OUT_IRQ_AVAILABLE) {
> +		memcpy(xpad->odata, odata, transfer_length);
> +		xpad->irq_out->transfer_buffer_length = transfer_length;
> +		ret = usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
> +		xpad->submit_state = OUT_IRQ_QUEUE_EMPTY;
> +		xpad->out_submitter = type;
> +	} else {
> +		/*
> +		 * The goal here is to prevent starvation of any other type.
> +		 * If this type matches what is being submitted and there is
> +		 * another type in the queue, don't ovewrite it
> +		 */
> +		if (xpad->submit_state != OUT_IRQ_QUEUE_EMPTY &&
> +		    xpad->out_submitter == type &&
> +		    xpad->queue_submitter != type) {
> +			ret = -EBUSY;
> +			goto out;

No, we do not want to return "busy" here. We should save the most
up-to-date request of given type and re-submit it when URB is no longer
busy.

I CCed you on another patch addressing the same issue, please take a
look when you have a chance.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web