Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908F0C433EF for ; Mon, 6 Dec 2021 15:04:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346360AbhLFPH7 (ORCPT ); Mon, 6 Dec 2021 10:07:59 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:55916 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345865AbhLFPGK (ORCPT ); Mon, 6 Dec 2021 10:06:10 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3223B612A5; Mon, 6 Dec 2021 15:02:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17F35C341C1; Mon, 6 Dec 2021 15:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1638802960; bh=qM6HluBn4RVpT6QWxpRerYmfyBR4ghdWX2iaEal5fb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AMlv7jrOOksJh3v5Ezemp8khHbSNweDOubZjALWn+MFJhS3qEEZ5TXX+S6q0Ae6rB UinGJua6Zqj/LH3ZqKeUvJE5vWv0e5KCvLaQVUiPE2GORZdHXxsX+VV6RVaWWPjCm/ X2yThRpPmZeZqC0AW/0Lk9und3cRn9omuwKx3e74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, liuguoqiang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 40/62] net: return correct error code Date: Mon, 6 Dec 2021 15:56:23 +0100 Message-Id: <20211206145550.579080400@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211206145549.155163074@linuxfoundation.org> References: <20211206145549.155163074@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: liuguoqiang [ Upstream commit 6def480181f15f6d9ec812bca8cbc62451ba314c ] When kmemdup called failed and register_net_sysctl return NULL, should return ENOMEM instead of ENOBUFS Signed-off-by: liuguoqiang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/devinet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 6f3c529431865..7a2442623d6a6 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -2271,7 +2271,7 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name, free: kfree(t); out: - return -ENOBUFS; + return -ENOMEM; } static void __devinet_sysctl_unregister(struct ipv4_devconf *cnf) -- 2.33.0