Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2564460lkm; Mon, 20 Sep 2021 18:50:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyKkTnuiEtFwFXmU3+OTTnZ+6ajfj8QmKGleaNrRdl0CEICI1UhyxwZDj8X+bGVKGyZHf6 X-Received: by 2002:a02:630f:: with SMTP id j15mr21558739jac.62.1632188926949; Mon, 20 Sep 2021 18:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188926; cv=none; d=google.com; s=arc-20160816; b=GY/KOj1HJeEU89RnNmaK/+U9NYAOyq3JWcFKMs1KaJq+t/ZNx0CnNkKhE5j+8FJ2P8 5jFPSS04qIp+55gYLGH83awVSz71z9YamDZ1oWP9mMyU7mrimjRRYDacge7hglh/D6xu QwELHRC+WFv+aYCOUyviX2iERghz6uWRiXnNLzalVXE0cDLNa4X42OQLT90SZYxOYS5T OQcgUwz0qjxurcmi9O5REpsQh9CcQOyTFpaeCJ8Pj2naCDNW5Jkfk2LK8fR5/imltA0V rkugOp0t9fQOjS6pOxCdsw57FKENR/xPQ2ELFjYIw2/4J0s/esMsWx+vdKcAj9IH0sR8 Dwow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZYvxqMNzcvJMM6r6aatcg++QvJmsR88c3wlmPcseiEQ=; b=dn9n8ghk1Ojil34IDkqY/A3PRQ+YYtgj/87RVitp/denoOyJkuRoDbANyzYS1c8RxG pSr78lkAUU5rqptUdTiX9F09RH726ZSpXZzz5gYnBLd4mvm36T7CjaxmTk8unFyAqXDK kjtAt7G1Q92/pDcizLhQzaIgJtGYE0cSnGLkENkg2VLB4NnPaSW6JfnrRCT0nuscc71u GydWzSWP2wUDAYgqvZBUCSHXEQ72e+Y5Ep5MKUXnzMGUp/5N/tAEuxnmeMz92bce5gtu EPZPGLgOlvYDRUZaISwrz1FwmCry5Zfdt3K1N2xOHMGdQAkSY/LmR3Qqe5AO6UFyHaNq Rdww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d4v08htx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si17661817jav.64.2021.09.20.18.48.36; Mon, 20 Sep 2021 18:48:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d4v08htx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349326AbhITRqE (ORCPT + 99 others); Mon, 20 Sep 2021 13:46:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:49428 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353192AbhITRoH (ORCPT ); Mon, 20 Sep 2021 13:44:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DBC9561B96; Mon, 20 Sep 2021 17:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157772; bh=nEeG0PuNY9HGJQDDbcpqwuUiiLVyOFTeNieVCtb0RKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d4v08htxxBFzDG4ZoRmV5Mp9kTVsTDsuHWkYNHPyY4ZT3qeWfMFRNvbN/y7QWgwzh hC9OvtbHMDXJ16wj7ndkWmslFyzLIMPaXGGVK0MzRVQtua3tZkU/PitYXEpux3JTsK O6WIbE+BaSoa6SMUeCCRp/y8HayBatdtAP+JxT10= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiyu Yang , Cong Wang , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 102/293] net: sched: Fix qdisc_rate_table refcount leak when get tcf_block failed Date: Mon, 20 Sep 2021 18:41:04 +0200 Message-Id: <20210920163936.752445327@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiyu Yang [ Upstream commit c66070125837900163b81a03063ddd657a7e9bfb ] The reference counting issue happens in one exception handling path of cbq_change_class(). When failing to get tcf_block, the function forgets to decrease the refcount of "rtab" increased by qdisc_put_rtab(), causing a refcount leak. Fix this issue by jumping to "failure" label when get tcf_block failed. Fixes: 6529eaba33f0 ("net: sched: introduce tcf block infractructure") Signed-off-by: Xiyu Yang Reviewed-by: Cong Wang Link: https://lore.kernel.org/r/1630252681-71588-1-git-send-email-xiyuyang19@fudan.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_cbq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index ebc3c8c7e666..bc62e1b24653 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c @@ -1616,7 +1616,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack); if (err) { kfree(cl); - return err; + goto failure; } if (tca[TCA_RATE]) { -- 2.30.2