Skip to contentSkip to conversation

tipc: fix a potental access after delete in tipc_sk_join()

PATCH Applied Jon Maloy 2 participants 2 messages Jan 10, 2018 – Jan 15, 2018

Subsystems (3)
lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

PATCH 1/1 tipc: fix a potental access after delete in tipc_sk_join()

In commit d12d2e12cec2 "tipc: send out join messages as soon as new member is discovered") we added a call to the function tipc_group_join() without considering the case that the preceding tipc_sk_publish() might have failed, and the group item already deleted.

We fix this by returning from tipc_sk_join() directly after the failed tipc_sk_publish.

---
 net/tipc/socket.c | 1 +
 1 file changed, 1 insertion(+)
net/tipc/socket.c +1 -0
index 1f23627..f38264d 100644
@@ -2774,6 +2774,7 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq)
 	if (rc) {
 		tipc_group_delete(net, grp);
 		tsk->group = NULL;
+		return rc;
 	}
 	/* Eliminate any risk that a broadcast overtakes sent JOINs */
 	tsk->mc_method.rcast = true;
Signature · 1 line
2.1.4
maintainer Applied
#1 lore raw

From: Jon Maloy <[email protected]>
Date: Wed, 10 Jan 2018 21:08:50 +0100

Quoted 10 lines

In commit d12d2e12cec2 "tipc: send out join messages as soon as new member is discovered") we added a call to the function tipc_group_join() without considering the case that the preceding tipc_sk_publish() might have failed, and the group item already deleted.

We fix this by returning from tipc_sk_join() directly after the failed tipc_sk_publish.

Applied, thanks Jon.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot