Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp105194pxb; Mon, 13 Sep 2021 14:13:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqAejodNIsTfEcYKhhiyMP2cxe61g5SnfLib27Y+HxYEFAnVVQ+p5nXrZahkSuxu9MtMDl X-Received: by 2002:a17:906:d541:: with SMTP id cr1mr15573571ejc.81.1631567639382; Mon, 13 Sep 2021 14:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631567639; cv=none; d=google.com; s=arc-20160816; b=vD9g9w0sgEhrnDR7JRP7Bw3EKtJ6EFD5hDVXnPsCjSWTd8EWYEq8K6DokeqrUEObwi Tv78/pM3qrbs+eFh4cUlyjN44kovkT6GR02epFrIs6NmaS+/oaaAd1WPf4/33tRSd1j2 hndlDW7Gsx4XKLjSk1v+GFKgYTIFJg/NXDrhE0dWvBxC2ItpSkyxj6MmzFEhDIi9al4N YylG4sPcX1/D9kYd5nhy5XyN1UPIT6xDY+c29VrlQc4XTVoRt9gRrXbhulc5G4bKBK1d CgCsOA0QjsXchmSA66p4kGgcYpINjh+qIqGVtHFH0r/LeN1+5s+GePjIM6Sc2NU7mDp3 l3Kg== 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=GYkGtIS3XWmuyH8jql7rxkV/b+m5jFDN16gDKXWQJMc=; b=IZGsF8xUACf2JKvV30J9Z2lmCnL6jYozsr0ziHAF0MytTklBlBIsc44ImWf5T4gsRO o/EEt7LJTevfA16SeRo5fAO7qOgzicT2AQ6nTk7/uedrTQKieXZBNJSLIkYAinjrikRG 2x0/7MnM8gaNiKnHYOnfFBVPyxEqvUxH2x8Lloaiie8aL0kdaUMfmqhXvy3J1TTXV2N9 OBFr+5AdMTEjkj9/Rbvdpx/biXHNPpA58dr+5ZLq3+4X7lEIioKLbQzT8ouDBTgv6NLZ XBdaw3sJq+ysfORVPvKmQdeKqzd+h0d4im2D1J+6bStKcvs+5VBkqtS01Td4/4U7LAC0 azUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1pj8AzTd; 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 n17si40274ejl.475.2021.09.13.14.13.35; Mon, 13 Sep 2021 14:13:59 -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=1pj8AzTd; 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 S244536AbhIMNw7 (ORCPT + 99 others); Mon, 13 Sep 2021 09:52:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:51886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243657AbhIMNs4 (ORCPT ); Mon, 13 Sep 2021 09:48:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A28F6615A4; Mon, 13 Sep 2021 13:33:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539985; bh=rYKxPOJ0vw3+hHn39pu2Ec6Aukykd3lS/Y8UT3w1ynw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1pj8AzTdIh2ZOJTkBp/kbaQOs6gIXR/eQP2qYrVzohJeMkIRV7HZZiPf437Jz85v7 Sg5P4BFXNihHtUd1XaTnXAcGxFh1cmaftK60G8nX8zyiHJ0eeIqEdZWqxZiFfyOzsi uulsSABuBCkVHQeg5D9KCbop7zZe3mWtEvT9ZzbI= 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 5.10 209/236] net: sched: Fix qdisc_rate_table refcount leak when get tcf_block failed Date: Mon, 13 Sep 2021 15:15:14 +0200 Message-Id: <20210913131107.488860945@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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 53d45e029c36..4a78fcf5d4f9 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c @@ -1614,7 +1614,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