ACM gadget: fix endianness in notifications

The gadget code exports the bitfield for serial status changes
over the wire in its internal endianness. The fix is to convert
to little endian before sending it over the wire.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Tested-by: 家瑋 <momo1208@gmail.com>
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Oliver Neukum and committed by Greg Kroah-Hartman cdd7928d 2e47c535

+3 -1
+3 -1
drivers/usb/gadget/function/f_acm.c
··· 535 { 536 struct usb_composite_dev *cdev = acm->port.func.config->cdev; 537 int status; 538 539 spin_lock(&acm->lock); 540 if (acm->notify_req) { 541 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n", 542 acm->port_num, acm->serial_state); 543 status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE, 544 - 0, &acm->serial_state, sizeof(acm->serial_state)); 545 } else { 546 acm->pending = true; 547 status = 0;
··· 535 { 536 struct usb_composite_dev *cdev = acm->port.func.config->cdev; 537 int status; 538 + __le16 serial_state; 539 540 spin_lock(&acm->lock); 541 if (acm->notify_req) { 542 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n", 543 acm->port_num, acm->serial_state); 544 + serial_state = cpu_to_le16(acm->serial_state); 545 status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE, 546 + 0, &serial_state, sizeof(acm->serial_state)); 547 } else { 548 acm->pending = true; 549 status = 0;