[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <97e8c186-3c4f-a3ff-8389-e15ea476280e@codeaurora.org>
Date: Sun, 14 Nov 2021 20:46:25 +0800
From: Zijun Hu <zijuhu@...eaurora.org>
To: marcel@...tmann.org, johan.hedberg@...il.com, luiz.dentz@...il.com
Cc: linux-kernel@...r.kernel.org, linux-bluetooth@...r.kernel.org,
linux-arm-msm@...r.kernel.org, c-hbandi@...eaurora.org,
hemantg@...eaurora.org, rjliao@...eaurora.org,
Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v1] Bluetooth: hci_h4: Fix padding calculation error
within h4_recv_buf()
could you please code review for this patch?
On 11/10/2021 8:09 PM, Zijun Hu wrote:
> From: Zijun Hu <quic_zijuhu@...cinc.com>
>
> it is erroneous to calculate padding by subtracting length of type
> indication from skb->len, it will cause data analysis error for
> alignment which is greater than 1, so fixed by adding length of type
> indication with skb->len.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
> ---
> drivers/bluetooth/hci_h4.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
> index 4b3b14a34794..1d0cdf023243 100644
> --- a/drivers/bluetooth/hci_h4.c
> +++ b/drivers/bluetooth/hci_h4.c
> @@ -252,7 +252,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
> }
>
> if (!dlen) {
> - hu->padding = (skb->len - 1) % alignment;
> + hu->padding = (skb->len + 1) % alignment;
> hu->padding = (alignment - hu->padding) % alignment;
>
> /* No more data, complete frame */
> @@ -260,7 +260,7 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
> skb = NULL;
> }
> } else {
> - hu->padding = (skb->len - 1) % alignment;
> + hu->padding = (skb->len + 1) % alignment;
> hu->padding = (alignment - hu->padding) % alignment;
>
> /* Complete frame */
>
Powered by blists - more mailing lists