Commit aed328fe authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/usb-ep-check-v2' into for-next

Pull another fix of URB EP type check.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parents 727dede0 f9a1c372
...@@ -56,7 +56,7 @@ static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb) ...@@ -56,7 +56,7 @@ static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb)
lb, s->period_size); lb, s->period_size);
} }
static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, static int init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
struct urb **urbs, char *transfer, struct urb **urbs, char *transfer,
struct usb_device *dev, int pipe) struct usb_device *dev, int pipe)
{ {
...@@ -77,6 +77,8 @@ static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, ...@@ -77,6 +77,8 @@ static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
urb->interval = 1; urb->interval = 1;
if (usb_pipeout(pipe)) if (usb_pipeout(pipe))
continue; continue;
if (usb_urb_ep_type_check(urb))
return -EINVAL;
urb->transfer_buffer_length = transfer_length; urb->transfer_buffer_length = transfer_length;
desc = urb->iso_frame_desc; desc = urb->iso_frame_desc;
...@@ -87,9 +89,11 @@ static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, ...@@ -87,9 +89,11 @@ static void init_pipe_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
desc[p].length = maxpacket; desc[p].length = maxpacket;
} }
} }
return 0;
} }
static void init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, static int init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
struct usb_device *dev, int in_pipe, int out_pipe) struct usb_device *dev, int in_pipe, int out_pipe)
{ {
struct usb_stream *s = sk->s; struct usb_stream *s = sk->s;
...@@ -103,9 +107,12 @@ static void init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize, ...@@ -103,9 +107,12 @@ static void init_urbs(struct usb_stream_kernel *sk, unsigned use_packsize,
sk->outurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL); sk->outurb[u] = usb_alloc_urb(sk->n_o_ps, GFP_KERNEL);
} }
init_pipe_urbs(sk, use_packsize, sk->inurb, indata, dev, in_pipe); if (init_pipe_urbs(sk, use_packsize, sk->inurb, indata, dev, in_pipe) ||
init_pipe_urbs(sk, use_packsize, sk->outurb, sk->write_page, dev, init_pipe_urbs(sk, use_packsize, sk->outurb, sk->write_page, dev,
out_pipe); out_pipe))
return -EINVAL;
return 0;
} }
...@@ -226,7 +233,11 @@ struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk, ...@@ -226,7 +233,11 @@ struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk,
else else
sk->freqn = get_usb_high_speed_rate(sample_rate); sk->freqn = get_usb_high_speed_rate(sample_rate);
init_urbs(sk, use_packsize, dev, in_pipe, out_pipe); if (init_urbs(sk, use_packsize, dev, in_pipe, out_pipe) < 0) {
usb_stream_free(sk);
return NULL;
}
sk->s->state = usb_stream_stopped; sk->s->state = usb_stream_stopped;
out: out:
return sk->s; return sk->s;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment