]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tipc: fix a potental access after delete in tipc_sk_join()
authorJon Maloy <jon.maloy@ericsson.com>
Wed, 10 Jan 2018 20:08:50 +0000 (21:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Jan 2018 18:43:51 +0000 (13:43 -0500)
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.

Reported-by: syzbot+e3eeae78ea88b8d6d858@syzkaller.appspotmail.com
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/socket.c

index 1f236271766ca7988cc626ee34ee72f056d149cf..f38264db45ae058645bad642d07dc36245f77f51 100644 (file)
@@ -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;