[PATCH] Bluetooth: Fix Adv Monitor msft_add/remove_monitor_sync()

Manish Mandlik posted 1 patch 4 years, 1 month ago
net/bluetooth/msft.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] Bluetooth: Fix Adv Monitor msft_add/remove_monitor_sync()
Posted by Manish Mandlik 4 years, 1 month ago
Do not call skb_pull() in msft_add_monitor_sync() as
msft_le_monitor_advertisement_cb() expects 'status' to be
part of the skb.

Same applies for msft_remove_monitor_sync().

Signed-off-by: Manish Mandlik <mmandlik@google.com>
---

 net/bluetooth/msft.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index f43994523b1f..9990924719aa 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -387,7 +387,6 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
 		return PTR_ERR(skb);
 
 	status = skb->data[0];
-	skb_pull(skb, 1);
 
 	msft_le_cancel_monitor_advertisement_cb(hdev, status, hdev->msft_opcode,
 						skb);
@@ -506,7 +505,6 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
 		return PTR_ERR(skb);
 
 	status = skb->data[0];
-	skb_pull(skb, 1);
 
 	msft_le_monitor_advertisement_cb(hdev, status, hdev->msft_opcode, skb);
 
-- 
2.36.0.512.ge40c2bad7a-goog
Re: [PATCH] Bluetooth: Fix Adv Monitor msft_add/remove_monitor_sync()
Posted by Luiz Augusto von Dentz 4 years, 1 month ago
Hi Manish,

On Mon, May 9, 2022 at 2:05 PM Manish Mandlik <mmandlik@google.com> wrote:
>
> Do not call skb_pull() in msft_add_monitor_sync() as
> msft_le_monitor_advertisement_cb() expects 'status' to be
> part of the skb.
>
> Same applies for msft_remove_monitor_sync().
>
> Signed-off-by: Manish Mandlik <mmandlik@google.com>
> ---
>
>  net/bluetooth/msft.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
> index f43994523b1f..9990924719aa 100644
> --- a/net/bluetooth/msft.c
> +++ b/net/bluetooth/msft.c
> @@ -387,7 +387,6 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
>                 return PTR_ERR(skb);
>
>         status = skb->data[0];
> -       skb_pull(skb, 1);
>
>         msft_le_cancel_monitor_advertisement_cb(hdev, status, hdev->msft_opcode,
>                                                 skb);
> @@ -506,7 +505,6 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
>                 return PTR_ERR(skb);
>
>         status = skb->data[0];
> -       skb_pull(skb, 1);

Well if it expects it to be part of the skb then there is no reason to
pass it as argument in addition to the skb itself.

>         msft_le_monitor_advertisement_cb(hdev, status, hdev->msft_opcode, skb);
>
> --
> 2.36.0.512.ge40c2bad7a-goog
>


-- 
Luiz Augusto von Dentz
Re: [PATCH] Bluetooth: Fix Adv Monitor msft_add/remove_monitor_sync()
Posted by Paul Menzel 4 years, 1 month ago
Dear Manish,


Thank you for your patch.

Am 09.05.22 um 23:05 schrieb Manish Mandlik:
> Do not call skb_pull() in msft_add_monitor_sync() as
> msft_le_monitor_advertisement_cb() expects 'status' to be
> part of the skb.

Please reflow for 75 characters per line.

> Same applies for msft_remove_monitor_sync().

Was this found by code review, or were there noticeable problems? If the 
later, please add a note, how to reproduce it.

Also, maybe also add a Fixes tag, referencing the commit introducing the 
problem.


Kind regards,

Paul


> Signed-off-by: Manish Mandlik <mmandlik@google.com>
> ---
> 
>   net/bluetooth/msft.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
> index f43994523b1f..9990924719aa 100644
> --- a/net/bluetooth/msft.c
> +++ b/net/bluetooth/msft.c
> @@ -387,7 +387,6 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
>   		return PTR_ERR(skb);
>   
>   	status = skb->data[0];
> -	skb_pull(skb, 1);
>   
>   	msft_le_cancel_monitor_advertisement_cb(hdev, status, hdev->msft_opcode,
>   						skb);
> @@ -506,7 +505,6 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
>   		return PTR_ERR(skb);
>   
>   	status = skb->data[0];
> -	skb_pull(skb, 1);
>   
>   	msft_le_monitor_advertisement_cb(hdev, status, hdev->msft_opcode, skb);
>