Skip to contentSkip to conversation

tipc: fix cancellation of topology subscriptions

PATCH Superseded Jon Maloy 2 participants 2 messages Mar 20, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

PATCH 1/1 tipc: fix cancellation of topology subscriptions

From: Erik Hugne <[email protected]>

When cancelling a subscription, we have to clear the cancel bit in the request before iterating over any established subscriptions with memcmp. Otherwise no subscription will ever be found, and it will not be possible to explicitly unsubscribe individual subscriptions.

Fixes 8985ecc7c1e0 ("tipc: simplify endianness handling in topology subscriber")
---
 net/tipc/topsrv.c | 1 +
 1 file changed, 1 insertion(+)
net/tipc/topsrv.c +1 -0
index 4a708a4..b05a89a 100644
@@ -363,6 +363,7 @@ static int tipc_conn_rcv_sub(struct tipc_topsrv *srv,
 	struct tipc_subscription *sub;
 
 	if (tipc_sub_read(s, filter) & TIPC_SUB_CANCEL) {
+		s->filter ^= __constant_ntohl(TIPC_SUB_CANCEL);
 		tipc_conn_delete_sub(con, s);
 		return 0;
 	}
Signature · 1 line
2.1.4
maintainer
#1 lore raw

From: Jon Maloy <[email protected]>
Date: Wed, 20 Mar 2019 10:59:03 +0100

Quoted 6 lines

From: Erik Hugne <[email protected]>

When cancelling a subscription, we have to clear the cancel bit in the request before iterating over any established subscriptions with memcmp. Otherwise no subscription will ever be found, and it will not be possible to explicitly unsubscribe individual subscriptions.

...

net/tipc/topsrv.c static int tipc_conn_rcv_sub(struct tipc_topsrv *srv, · line 367

Quoted 10 lines
net/tipc/topsrv.c +1 -0
index 4a708a4..b05a89a 100644
@@ -363,6 +363,7 @@ static int tipc_conn_rcv_sub(struct tipc_topsrv *srv,
 	struct tipc_subscription *sub;
 
 	if (tipc_sub_read(s, filter) & TIPC_SUB_CANCEL) {
+		s->filter ^= __constant_ntohl(TIPC_SUB_CANCEL);
 		tipc_conn_delete_sub(con, s);

It is confusing to say we have to "clear" some bit in a certain situation and then use a xor operation which "inverts" a bit.

Please use "&= ~VAL" instead.

Thank you.