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 54885C4332F for ; Mon, 6 Dec 2021 15:00:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345238AbhLFPEH (ORCPT ); Mon, 6 Dec 2021 10:04:07 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:53760 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345064AbhLFPDX (ORCPT ); Mon, 6 Dec 2021 10:03:23 -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 CA26161318; Mon, 6 Dec 2021 14:59:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC16BC341C1; Mon, 6 Dec 2021 14:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1638802794; bh=PeflhP5R7jplL0vPsZLLoMB5jXRX9vaiMqsKOmG+7Q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgdZ5R55dLhwcTTDxj5vIFpkSXxXCVg3YmxVfI+ORkprlvOEAW508r/aNTAibfdXD VdZJEJNkODzRTPcPncre9m4b9TNWNKN/WTkMPb1YePosN/3s5e1pF0/6Px7cqB4RYu XF1oSYXfhqUu51p50twbadQVuQ6P0xqELf1jBmr0= 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.4 35/52] net: return correct error code Date: Mon, 6 Dec 2021 15:56:19 +0100 Message-Id: <20211206145549.094672466@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211206145547.892668902@linuxfoundation.org> References: <20211206145547.892668902@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 2cb8612e7821e..35961ae1d120c 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -2237,7 +2237,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