Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1238683pxu; Mon, 23 Nov 2020 15:37:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfC6r9JTV2P6cxVKtpeOoH69fRfHnLVaN6Whj0h1Br6hcz37DEWceFT8JL7s3XV4JQIXol X-Received: by 2002:a17:906:2e0f:: with SMTP id n15mr1797281eji.486.1606174639748; Mon, 23 Nov 2020 15:37:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174639; cv=none; d=google.com; s=arc-20160816; b=ctzcTrrltVhy/CKDDqAUER5CELRM2/1jxRaqPwygATUfhDd3dtpuEPt4aVD7859mJT gjZpY7KLDL3eiuoN6m7EIS+XQG0UT19h5S9/3lauJrdWCF5Qq4lYHh6DOyVvcb7myqrw QEIXBlp43Y2mOmGttQZXmSoxx03MmzA2sUny8xXNqfuDMxmHMVVjDpHnWtGiFlWOHGTK tGniFlAKhij7gu5Tm+dpMoMeLNCjfX8X1eZgBn155QXxZ5VD/4unE9kzRiBCH1i58zKY 1P21RqCZbNDcffS9UhGQk1a7UWXcXqOmgmfIT44EvYC4+nQe+XIcLe9XM8Vtdvb5yEBS 4wyg== 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=X+2f87loBkRpPpcUhliPTr+okXIN3RYopZP5r70SqpQ=; b=mC+UpRIZOYWfNNk3IRLPFs4YQ+NC+pzXMR1AnMeXIxuvmxjRP+HlsHwyNR1jWBUfEm 08RnaCl3FcX1+5FGd0IyxDWQ9vvVGBiipNseZb63MhI2YEzGq++X/HFL4RFS7tPK1c9j edoVokuZ8a44TpclfauusgYUOz//IVpm7BFMHavg0nclcfrtoNEDHaVVT7yuQrsxwoJA KbqDhilK8zbE6aKn3K7iBtfbHoS5xCpUJiYTs1WgRhLS8AXt1KcoUhbEp2obcQQm/E0l 8Pi4sWp4AYQRdDIMygr8ek3svoNBDCMUijnsatCidzBkPr6a3lDtvHF7taUuF6XSzRbX nAAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PU9lqKwc; 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 cz9si7380419edb.289.2020.11.23.15.36.57; Mon, 23 Nov 2020 15:37:19 -0800 (PST) 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=PU9lqKwc; 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 S1731410AbgKWMek (ORCPT + 99 others); Mon, 23 Nov 2020 07:34:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:46426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731395AbgKWMeh (ORCPT ); Mon, 23 Nov 2020 07:34:37 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5158920721; Mon, 23 Nov 2020 12:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134875; bh=wkbW9bjaIoV+TbmNBkWqSH0v0BtyzWg+O1IKBRV5V6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PU9lqKwcpNas3oYirZqYwkZuPXo3Eb7uST/B/RMWg8Hou9OzAVTKyRx8h9GaQS7pw yOvY2orVEFOaAFraWmzBZsXJuh7KK8StlQteqoQQCsMid9oi+XBrVy+IvHXPkBgpu5 TLqkXSeZ+D2kuDNfoPgf/7ReCgu2ZbvKdSmXcTTI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Hai , Jakub Kicinski Subject: [PATCH 5.4 004/158] devlink: Add missing genlmsg_cancel() in devlink_nl_sb_port_pool_fill() Date: Mon, 23 Nov 2020 13:20:32 +0100 Message-Id: <20201123121820.159883286@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@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: Wang Hai [ Upstream commit 849920c703392957f94023f77ec89ca6cf119d43 ] If sb_occ_port_pool_get() failed in devlink_nl_sb_port_pool_fill(), msg should be canceled by genlmsg_cancel(). Fixes: df38dafd2559 ("devlink: implement shared buffer occupancy monitoring interface") Reported-by: Hulk Robot Signed-off-by: Wang Hai Link: https://lore.kernel.org/r/20201113111622.11040-1-wanghai38@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/devlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -1144,7 +1144,7 @@ static int devlink_nl_sb_port_pool_fill( err = ops->sb_occ_port_pool_get(devlink_port, devlink_sb->index, pool_index, &cur, &max); if (err && err != -EOPNOTSUPP) - return err; + goto sb_occ_get_failure; if (!err) { if (nla_put_u32(msg, DEVLINK_ATTR_SB_OCC_CUR, cur)) goto nla_put_failure; @@ -1157,8 +1157,10 @@ static int devlink_nl_sb_port_pool_fill( return 0; nla_put_failure: + err = -EMSGSIZE; +sb_occ_get_failure: genlmsg_cancel(msg, hdr); - return -EMSGSIZE; + return err; } static int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb,