From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sessmg23.ericsson.net ([193.180.251.45]:47074 "EHLO sessmg23.ericsson.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbeBSLs2 (ORCPT ); Mon, 19 Feb 2018 06:48:28 -0500 From: Jon Maloy To: , CC: , , , , , , Subject: [net-next 1/1] tipc: fix bug on error path in tipc_topsrv_kern_subscr() Date: Mon, 19 Feb 2018 12:48:21 +0100 Message-ID: <1519040901-21132-1-git-send-email-jon.maloy@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain Sender: netdev-owner@vger.kernel.org List-ID: 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 --- net/tipc/topsrv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c index 02013e0..25925be 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) -- 2.1.4