lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 08 Oct 2015 09:31:37 +0200
From:	Bjørn Mork <bjorn@...k.no>
To:	Konstantin Shkolnyy <konstantin.shkolnyy@...il.com>
Cc:	johan@...nel.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] USB: serial: cp210x: Workaround for cp2108 failure due to GET_LINE_CTL bug

Konstantin Shkolnyy <konstantin.shkolnyy@...il.com> writes:

> @@ -343,6 +344,28 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
>  		return result;
>  	}
>  
> +	/* Workaround for swapped bytes in 16-bit value from CP210X_GET_LINE_CTL */
> +	if (spriv->swap_get_line_ctl && request == CP210X_GET_LINE_CTL && size == 2) {
> +		union {
> +			struct {
> +				u8 byte0;
> +				u8 byte1;
> +				u8 byte2;
> +				u8 byte3;
> +			};
> +			u32 as_u32;
> +		} tmp_data;
> +		u8 old_byte0;
> +		u8 old_byte1;
> +
> +		tmp_data.as_u32  = data[0]; /* from caller's buffer */
> +		old_byte0        = tmp_data.byte0;
> +		old_byte1        = tmp_data.byte1;
> +		tmp_data.byte0   = old_byte1;
> +		tmp_data.byte1   = old_byte0;
> +		data[0]          = tmp_data.as_u32; /* to caller's buffer */
> +	}

That looks unnecessarily complicated...  How about:

	if (spriv->swap_get_line_ctl && request == CP210X_GET_LINE_CTL && size == 2)
                swab16s((u16 *)data);


Completely untested...



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ