Skip to content

Commit

Permalink
tipc: fix bug on error path in tipc_topsrv_kern_subscr()
Browse files Browse the repository at this point in the history
In commit cc1ea9ffadf7 ("tipc: eliminate struct tipc_subscriber") we
re-introduced an old bug on the error path in the function
tipc_topsrv_kern_subscr(). We now re-introduce the correction too.

Reported-by: syzbot+f62e0f2a0ef578703946@syzkaller.appspotmail.com
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jon Maloy authored and David S. Miller committed Feb 19, 2018
1 parent cc35b39 commit 96c252b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/tipc/topsrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,10 @@ bool tipc_topsrv_kern_subscr(struct net *net, u32 port, u32 type, u32 lower,
*conid = con->conid;
con->sock = NULL;
rc = tipc_conn_rcv_sub(tipc_topsrv(net), con, &sub);
if (rc < 0)
tipc_conn_close(con);
return !rc;
if (rc >= 0)
return true;
conn_put(con);
return false;
}

void tipc_topsrv_kern_unsubscr(struct net *net, int conid)
Expand Down

0 comments on commit 96c252b

Please sign in to comment.