diff options
author | Jon Maloy <jon.maloy@ericsson.com> | 2018-02-19 12:48:21 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-19 14:38:08 -0500 |
commit | 96c252bf1c5c6d7e2dac3dea42f3f0a9c939d20e (patch) | |
tree | 78a40678d31ea2230b01321bb7c50dc84a30fcb7 | |
parent | cc35b396788814f31d9507fc2454ef4b5c5e7178 (diff) | |
download | linux-96c252bf1c5c6d7e2dac3dea42f3f0a9c939d20e.tar.bz2 |
tipc: fix bug on error path in tipc_topsrv_kern_subscr()
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>
-rw-r--r-- | net/tipc/topsrv.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c index 02013e00f287..25925be1cc08 100644 --- a/net/tipc/topsrv.c +++ b/net/tipc/topsrv.c @@ -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) |