lkml.org 
[lkml]   [2017]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.16 065/178] ACM gadget: fix endianness in notifications
    3.16.46-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Oliver Neukum <oneukum@suse.com>

    commit cdd7928df0d2efaa3270d711963773a08a4cc8ab upstream.

    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>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [bwh: Backported to 3.16: adjust filename, context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/usb/gadget/f_acm.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    --- a/drivers/usb/gadget/f_acm.c
    +++ b/drivers/usb/gadget/f_acm.c
    @@ -535,13 +535,15 @@ static int acm_notify_serial_state(struc
    {
    struct usb_composite_dev *cdev = acm->port.func.config->cdev;
    int status;
    + __le16 serial_state;

    spin_lock(&acm->lock);
    if (acm->notify_req) {
    DBG(cdev, "acm ttyGS%d serial state %04x\n",
    acm->port_num, acm->serial_state);
    + serial_state = cpu_to_le16(acm->serial_state);
    status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
    - 0, &acm->serial_state, sizeof(acm->serial_state));
    + 0, &serial_state, sizeof(acm->serial_state));
    } else {
    acm->pending = true;
    status = 0;
    \
     
     \ /
      Last update: 2017-07-16 16:15    [W:3.914 / U:0.384 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site