Skip to content

Commit

Permalink
Merge branch android-msm-sunfish-4.14-android13-qpr2 (android-13.0.0_…
Browse files Browse the repository at this point in the history
…r0.66)

Signed-off-by: engstk <[email protected]>
  • Loading branch information
engstk committed Apr 14, 2023
1 parent c459f37 commit 04fbb73
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/configfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#endif

#ifdef CONFIG_USB_CONFIGFS_F_ACC
extern int acc_ctrlrequest(struct usb_composite_dev *cdev,
extern int acc_ctrlrequest_composite(struct usb_composite_dev *cdev,
const struct usb_ctrlrequest *ctrl);
void acc_disconnect(void);
#endif
Expand Down Expand Up @@ -1645,7 +1645,7 @@ static int android_setup(struct usb_gadget *gadget,

#ifdef CONFIG_USB_CONFIGFS_F_ACC
if (value < 0)
value = acc_ctrlrequest(cdev, c);
value = acc_ctrlrequest_composite(cdev, c);
#endif

if (value < 0)
Expand Down
20 changes: 20 additions & 0 deletions drivers/usb/gadget/function/f_accessory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,26 @@ int acc_ctrlrequest(struct usb_composite_dev *cdev,
}
EXPORT_SYMBOL_GPL(acc_ctrlrequest);

int acc_ctrlrequest_composite(struct usb_composite_dev *cdev,
const struct usb_ctrlrequest *ctrl)
{
u16 w_length = le16_to_cpu(ctrl->wLength);

if (w_length > USB_COMP_EP0_BUFSIZ) {
if (ctrl->bRequestType & USB_DIR_IN) {
/* Cast away the const, we are going to overwrite on purpose. */
__le16 *temp = (__le16 *)&ctrl->wLength;

*temp = cpu_to_le16(USB_COMP_EP0_BUFSIZ);
w_length = USB_COMP_EP0_BUFSIZ;
} else {
return -EINVAL;
}
}
return acc_ctrlrequest(cdev, ctrl);
}
EXPORT_SYMBOL_GPL(acc_ctrlrequest_composite);

static int
__acc_function_bind(struct usb_configuration *c,
struct usb_function *f, bool configfs)
Expand Down
4 changes: 4 additions & 0 deletions sound/core/control_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ static int ctl_elem_read_user(struct snd_card *card,
err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (err < 0)
goto error;
down_read(&card->controls_rwsem);
err = snd_ctl_elem_read(card, data);
up_read(&card->controls_rwsem);
if (err < 0)
goto error;
err = copy_ctl_value_to_user(userdata, valuep, data, type, count);
Expand Down Expand Up @@ -347,7 +349,9 @@ static int ctl_elem_write_user(struct snd_ctl_file *file,
err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (err < 0)
goto error;
down_write(&card->controls_rwsem);
err = snd_ctl_elem_write(card, file, data);
up_write(&card->controls_rwsem);
if (err < 0)
goto error;
err = copy_ctl_value_to_user(userdata, valuep, data, type, count);
Expand Down

0 comments on commit 04fbb73

Please sign in to comment.