Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f95646c authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: line6: Add yet more sanity checks for invalid EPs



There are a few other places calling usb_submit_urb() with the URB
composed from the fixed endpoint without validation.  For avoiding the
spurious kernel warnings, add the sanity checks to appropriate
places.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 96cd7962
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -175,9 +175,19 @@ static int line6_send_raw_message_async_part(struct message *msg,
	}

	msg->done += bytes;

	/* sanity checks of EP before actually submitting */
	retval = usb_urb_ep_type_check(urb);
	if (retval < 0)
		goto error;

	retval = usb_submit_urb(urb, GFP_ATOMIC);
	if (retval < 0)
		goto error;

	if (retval < 0) {
	return 0;

 error:
	dev_err(line6->ifcdev, "%s: usb_submit_urb failed (%d)\n",
		__func__, retval);
	usb_free_urb(urb);
@@ -185,9 +195,6 @@ static int line6_send_raw_message_async_part(struct message *msg,
	return retval;
}

	return 0;
}

/*
	Setup and start timer.
*/
+11 −6
Original line number Diff line number Diff line
@@ -130,18 +130,23 @@ static int send_midi_async(struct usb_line6 *line6, unsigned char *data,
			 transfer_buffer, length, midi_sent, line6,
			 line6->interval);
	urb->actual_length = 0;
	retval = usb_urb_ep_type_check(urb);
	if (retval < 0)
		goto error;

	retval = usb_submit_urb(urb, GFP_ATOMIC);
	if (retval < 0)
		goto error;

	++line6->line6midi->num_active_send_urbs;
	return 0;

	if (retval < 0) {
 error:
	dev_err(line6->ifcdev, "usb_submit_urb failed\n");
	usb_free_urb(urb);
	return retval;
}

	++line6->line6midi->num_active_send_urbs;
	return 0;
}

static int line6_midi_output_open(struct snd_rawmidi_substream *substream)
{
	return 0;