diff mbox series

[BlueZ] mesh: Fix regression error in HB subscription set

Message ID 20201118195600.30267-1-inga.stotland@intel.com (mailing list archive)
State New, archived
Headers show
Series [BlueZ] mesh: Fix regression error in HB subscription set | expand

Commit Message

Stotland, Inga Nov. 18, 2020, 7:56 p.m. UTC
This fixes a regression introduced in commit c77bb848a9fb
("mesh: Refactor heartbeat pub/sub"):
Heartbeat subscription should be enabled unless either source or
destination are unassigned addresses or period log is zero.

Also, decrement ref count on group destination address if period log
is zer since the subscription is not supposed to be processed.
---
 mesh/net.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

bluez.test.bot@gmail.com Nov. 18, 2020, 8:26 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=387073

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth
Brian Gix Nov. 19, 2020, 4:41 p.m. UTC | #2
Applied.

On Wed, 2020-11-18 at 11:56 -0800, Inga Stotland wrote:
> This fixes a regression introduced in commit c77bb848a9fb
> ("mesh: Refactor heartbeat pub/sub"):
> Heartbeat subscription should be enabled unless either source or
> destination are unassigned addresses or period log is zero.
> 
> Also, decrement ref count on group destination address if period log
> is zer since the subscription is not supposed to be processed.
> ---
>  mesh/net.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/mesh/net.c b/mesh/net.c
> index 9e0ea860f..b24cdba77 100644
> --- a/mesh/net.c
> +++ b/mesh/net.c
> @@ -3582,16 +3582,21 @@ int mesh_net_set_heartbeat_sub(struct mesh_net *net, uint16_t src, uint16_t dst,
>  		sub->max_hops = 0;
>  
>  	} else if (!period_log && src == sub->src && dst == sub->dst) {
> +		if (IS_GROUP(sub->dst))
> +			mesh_net_dst_unreg(net, sub->dst);
> +
>  		/* Preserve collected data, but disable */
>  		sub->enabled = false;
>  		sub->period = 0;
>  
> -	} else if (sub->dst != dst) {
> -		if (IS_GROUP(sub->dst))
> -			mesh_net_dst_unreg(net, sub->dst);
> +	} else {
> +		if (sub->dst != dst) {
> +			if (IS_GROUP(sub->dst))
> +				mesh_net_dst_unreg(net, sub->dst);
>  
> -		if (IS_GROUP(dst))
> -			mesh_net_dst_reg(net, dst);
> +			if (IS_GROUP(dst))
> +				mesh_net_dst_reg(net, dst);
> +		}
>  
>  		sub->enabled = !!period_log;
>  		sub->src = src;
diff mbox series

Patch

diff --git a/mesh/net.c b/mesh/net.c
index 9e0ea860f..b24cdba77 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -3582,16 +3582,21 @@  int mesh_net_set_heartbeat_sub(struct mesh_net *net, uint16_t src, uint16_t dst,
 		sub->max_hops = 0;
 
 	} else if (!period_log && src == sub->src && dst == sub->dst) {
+		if (IS_GROUP(sub->dst))
+			mesh_net_dst_unreg(net, sub->dst);
+
 		/* Preserve collected data, but disable */
 		sub->enabled = false;
 		sub->period = 0;
 
-	} else if (sub->dst != dst) {
-		if (IS_GROUP(sub->dst))
-			mesh_net_dst_unreg(net, sub->dst);
+	} else {
+		if (sub->dst != dst) {
+			if (IS_GROUP(sub->dst))
+				mesh_net_dst_unreg(net, sub->dst);
 
-		if (IS_GROUP(dst))
-			mesh_net_dst_reg(net, dst);
+			if (IS_GROUP(dst))
+				mesh_net_dst_reg(net, dst);
+		}
 
 		sub->enabled = !!period_log;
 		sub->src = src;