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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <F96C9280-2B85-42A0-A1DB-2C0C231F5C1D@holtmann.org>
Date:	Tue, 16 Aug 2016 09:05:19 +0200
From:	Marcel Holtmann <marcel@...tmann.org>
To:	Sebastian Reichel <sre@...nel.org>
Cc:	Tony Lindgren <tony@...mide.com>, Rob Herring <robh+dt@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.com>, Ville Tervo <ville.tervo@....fi>,
	Filip Matijević <filip.matijevic.pz@...il.com>,
	Aaro Koskinen <aaro.koskinen@....fi>,
	Pavel Machek <pavel@....cz>,
	Pali Rohár <pali.rohar@...il.com>,
	ivo.g.dimitrov.75@...il.com, linux-bluetooth@...r.kernel.org,
	linux-serial@...r.kernel.org, linux-omap@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC 4/7] Bluetooth: hci_uart: Add support for word alignment

Hi Sebatian,

> This will be used by Nokia's H4+ protocol, which
> adds padding to packets to reach word alignment.
> ---
> drivers/bluetooth/hci_h4.c   | 10 ++++++++++
> drivers/bluetooth/hci_uart.h |  1 +
> 2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
> index 635597b6e168..a934e4eb692b 100644
> --- a/drivers/bluetooth/hci_h4.c
> +++ b/drivers/bluetooth/hci_h4.c
> @@ -253,11 +253,21 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
> 			}
> 
> 			if (!dlen) {
> +				if ((&pkts[i])->wordaligned && !(skb->len % 2)) {
> +					buffer++;
> +					count--;
> +				}
> +
> 				/* No more data, complete frame */
> 				(&pkts[i])->recv(hdev, skb);
> 				skb = NULL;
> 			}
> 		} else {
> +			if ((&pkts[i])->wordaligned && !(skb->len % 2)) {
> +				buffer++;
> +				count--;
> +			}
> +
> 			/* Complete frame */
> 			(&pkts[i])->recv(hdev, skb);
> 			skb = NULL;
> diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
> index 839bad1d8152..a7d67aec3632 100644
> --- a/drivers/bluetooth/hci_uart.h
> +++ b/drivers/bluetooth/hci_uart.h
> @@ -121,6 +121,7 @@ struct h4_recv_pkt {
> 	u8  loff;	/* Data length offset in header */
> 	u8  lsize;	/* Data length field size */
> 	u16 maxlen;	/* Max overall packet length */
> +	bool wordaligned;	/* packets are word aligned */

I wonder if not a u8 align would be a way better choice here. We set it to 1 for all existing packet types. And the Nokia driver can use 2 here.

> 	int (*recv)(struct hci_dev *hdev, struct sk_buff *skb);

Regards

Marcel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ