Skip to contentSkip to conversation

tipc: fix a dangling pointer

PATCH Applied Cong Wang 3 participants 3 messages Oct 24, 2017 – Oct 26, 2017

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 tipc: fix a dangling pointer

tsk->group is set to grp earlier, but we forget to unset it after grp is freed.

Fixes 75da2163dbb6 ("tipc: introduce communication groups")
Reported-by syzkaller bot
Cc Jon Maloy <[email protected]>
Cc Ying Xue <[email protected]>
---
 net/tipc/socket.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/socket.c +3 -1
index b3b72d8e9543..ea61c32f6b80 100644
@@ -2756,8 +2756,10 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct tipc_group_req *mreq)
 	seq.upper = seq.lower;
 	tipc_nametbl_build_group(net, grp, mreq->type, domain);
 	rc = tipc_sk_publish(tsk, mreq->scope, &seq);
-	if (rc)
+	if (rc) {
 		tipc_group_delete(net, grp);
+		tsk->group = NULL;
+	}
 
 	/* Eliminate any risk that a broadcast overtakes the sent JOIN */
 	tsk->mc_method.rcast = true;
Signature · 1 line
2.13.0
#1 lore raw

Acked. Thank you.

///jon

Quoted 39 lines

-----Original Message-----
From: Cong Wang [mailto:[email protected]]
Sent: Wednesday, October 25, 2017 00:45
To: [email protected]
Cc: Cong Wang <[email protected]>; Jon Maloy <[email protected]>; Ying Xue <[email protected]>
Subject: [Patch net-next] tipc: fix a dangling pointer

tsk->group is set to grp earlier, but we forget to unset it after grp is freed.

Fixes 75da2163dbb6 ("tipc: introduce communication groups")
Reported-by syzkaller bot
Cc Jon Maloy <[email protected]>
Cc Ying Xue <[email protected]>
---
 net/tipc/socket.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/socket.c index renamed from net/tipc/socket.c +0 -0

b3b72d8e9543..ea61c32f6b80 100644

net/tipc/socket.c +3 -1
@@ -2756,8 +2756,10 @@ static int tipc_sk_join(struct tipc_sock *tsk, struct
 tipc_group_req *mreq)
 	seq.upper = seq.lower;
 	tipc_nametbl_build_group(net, grp, mreq->type, domain);
 	rc = tipc_sk_publish(tsk, mreq->scope, &seq);
-	if (rc)
+	if (rc) {
 		tipc_group_delete(net, grp);
+		tsk->group = NULL;
+	}
 
 	/* Eliminate any risk that a broadcast overtakes the sent JOIN */

tsk->mc_method.rcast = true;
--
2.13.0