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: Takashi Iwai <tiwai@suse.de>hifive-unleashed-5.1
parent
96cd79626f
commit
4f95646c80
|
@ -175,17 +175,24 @@ static int line6_send_raw_message_async_part(struct message *msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->done += bytes;
|
msg->done += bytes;
|
||||||
retval = usb_submit_urb(urb, GFP_ATOMIC);
|
|
||||||
|
|
||||||
if (retval < 0) {
|
/* sanity checks of EP before actually submitting */
|
||||||
dev_err(line6->ifcdev, "%s: usb_submit_urb failed (%d)\n",
|
retval = usb_urb_ep_type_check(urb);
|
||||||
__func__, retval);
|
if (retval < 0)
|
||||||
usb_free_urb(urb);
|
goto error;
|
||||||
kfree(msg);
|
|
||||||
return retval;
|
retval = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
}
|
if (retval < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
dev_err(line6->ifcdev, "%s: usb_submit_urb failed (%d)\n",
|
||||||
|
__func__, retval);
|
||||||
|
usb_free_urb(urb);
|
||||||
|
kfree(msg);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -130,16 +130,21 @@ static int send_midi_async(struct usb_line6 *line6, unsigned char *data,
|
||||||
transfer_buffer, length, midi_sent, line6,
|
transfer_buffer, length, midi_sent, line6,
|
||||||
line6->interval);
|
line6->interval);
|
||||||
urb->actual_length = 0;
|
urb->actual_length = 0;
|
||||||
retval = usb_submit_urb(urb, GFP_ATOMIC);
|
retval = usb_urb_ep_type_check(urb);
|
||||||
|
if (retval < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (retval < 0) {
|
retval = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
dev_err(line6->ifcdev, "usb_submit_urb failed\n");
|
if (retval < 0)
|
||||||
usb_free_urb(urb);
|
goto error;
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
++line6->line6midi->num_active_send_urbs;
|
++line6->line6midi->num_active_send_urbs;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
dev_err(line6->ifcdev, "usb_submit_urb failed\n");
|
||||||
|
usb_free_urb(urb);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int line6_midi_output_open(struct snd_rawmidi_substream *substream)
|
static int line6_midi_output_open(struct snd_rawmidi_substream *substream)
|
||||||
|
|
Loading…
Reference in New Issue