Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp836474pxu; Mon, 23 Nov 2020 05:32:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxy18sc2GCPmPWL6zGd1KDql4mJMLuuZmmb8l0UIqLMVcHR+UgTVI9J/Nv9hpdODcHkqnl1 X-Received: by 2002:a17:906:f1d8:: with SMTP id gx24mr42815134ejb.73.1606138329673; Mon, 23 Nov 2020 05:32:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138329; cv=none; d=google.com; s=arc-20160816; b=DSBTj2v6KkVqQgIwrcKu7J02fFmpyVhr585s3p12RGfwASrLtjOpm5hWkGvEvyw6WY RafX63KU2gEEszuHk1W8xzgujpQ8bkJBkkUZzDwhgVUEoa3KPxYH9Y+ifl3qc5luQjLu 3Y+aIhlXQZIYdRYuAX4YbDid1BuRcwfn3tDJ+GQqLspJN1mSg7ZG1IBu62BcH+kW1W2E 9UlkKRRS8KdtAsLFcbMD5idoNvIs0heEEngB3W/tiQ3o3MpPaozyfFTObYQleB6AGUXC 6MDjjjGFKsV/qbgo2O5LAnvAc2J9tSjcv5cBIObu271og8U1QCbFX4V4ME01fWHwzqIC MTVg== 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=osHY6XYZuCHJ57eVSX+ak8a2ydFW8x20EN8uNkevLGA=; b=oGgDh+jb3Ytm4i4+WwpMc8FBZoG0q6kHddgizmqLU3SsnPmbXJG51NCRBhKbws0wkO MQr1rg2em9Zhbm3HlGNB2vLBeAmP4EpSLP3CVGWL5eLBSm/bodxbJKV1BICFR/yHSUc3 ygd6G6W+tE1KdF5xXo7056qXiCQD63YwOfwoHlHwelT4vCl5k1bXRLSBU4KZvfzUrwnb a5mDRcv/4BXPO00NJmBKm7Ma/CgexgeKS2NWtorKSbZNlxf22RKFQpA2vdOoIbEIyVbA bb3R+SKhi8UXS36Qm+k/lrgqPit8S7Exf7MlCpKouKKNKWuJ9CRsR68UyguwHLR2ON9o exBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h2jEJhdj; 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 bo6si6590941edb.67.2020.11.23.05.31.46; Mon, 23 Nov 2020 05:32:09 -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=h2jEJhdj; 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 S2389077AbgKWN2c (ORCPT + 99 others); Mon, 23 Nov 2020 08:28:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:41680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730052AbgKWMan (ORCPT ); Mon, 23 Nov 2020 07:30:43 -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 30D032076E; Mon, 23 Nov 2020 12:30:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134642; bh=3XXRU0SamzwdowKRTgVR/7wc20oNw3fz8/ccqjK87f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2jEJhdjHaILRi6m43fgcn3tfRMfZmgH2gXxKRqSgtzZA2W6KQHCE9BL8Zy3js8Zw sDOnEe+0Lqt/xsF1Hmc1ZgC3pLb4nsgHjg+/ZBGMyoZj0z27bfhyWuFY175pJP1Cn6 lM8T600s9yU/eHeZJhzwgRznfJHoeIp3Lm5TY0So= 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 4.19 04/91] devlink: Add missing genlmsg_cancel() in devlink_nl_sb_port_pool_fill() Date: Mon, 23 Nov 2020 13:21:24 +0100 Message-Id: <20201123121809.511065072@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121809.285416732@linuxfoundation.org> References: <20201123121809.285416732@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 @@ -1113,7 +1113,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; @@ -1126,8 +1126,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,