Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3882690pxv; Mon, 28 Jun 2021 15:36:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEoD5Nkj/DO+7ZQSCdI5tWNRCVBCUhiBEhy8P31V+nLitpxSQFO92AEr1+aQv6ZXLuynIx X-Received: by 2002:a05:6638:3594:: with SMTP id v20mr1555703jal.25.1624919769540; Mon, 28 Jun 2021 15:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624919769; cv=none; d=google.com; s=arc-20160816; b=XAWpKCsiJuIHeLUkoGjGvTELlK9MH9kN0sGrzXANyYnnSOV4ycdli8NoAAx6uC4Wsl xRBElK0vpjPgWzG40lmSNpM/DavCSzM0XVcRFkIuJgE/4LAZvBAJyGXY+4URfpiBVfbs eFHdE6IB4yZsTsNJwXabreW5K7Hqen4nQ28bXFGQq0Jvtdf+CzSZBSV3ZdKyvMQpnYc5 iXO5hGGqeSEBoHrvxtrxBVUqQp96Fqerzv5ZOiQudzCGWGHneK6oAGcf3exZOH0k3i4J PM5qGW10F0BQyRuqsru/GDtKs8dFcdSvbD6z1k98VRxKmQ/LkywcmzozUL+KI7oZkBgq jDMQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VgJU+UhRKzHRNmSLCZIRzyHMGIW1rYVdux4FOuv/VH0=; b=jY/oSyMRCx/iJWivQsUGa0QPtnEJcJiIERHtNAvlxjctqpQokJRya6rIicudvqklJR cg4Opi5pJgm1JpvUg8Fgk01d/Sm31HYqHpThcuizXYfP9Xt+QmJZCVr3ppDCx78n9Yso 9IkSh8KB38SUa/CRrKUYoMnUgEsWbTPKoI0ZuHsYcKhvyZzJyAVv4HjdXEO3ZiA7BDyI cVLkI+nJimi7IWV0hDQqgfmtn3f3KmDLTyWz5W27IU8/luefitWwJjuqY3uQqxVLh4Tx /mOssmNC57lJMNJDlm2jQD+0Dl6GHmYiT8qcZGWYlRiwU5zB0IVtXJqih4/gFToEMslX QVqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=scnm1KYV; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si20597009ili.36.2021.06.28.15.35.57; Mon, 28 Jun 2021 15:36:09 -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=@kernel.org header.s=k20201202 header.b=scnm1KYV; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237687AbhF1P2L (ORCPT + 99 others); Mon, 28 Jun 2021 11:28:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:37050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235449AbhF1PEB (ORCPT ); Mon, 28 Jun 2021 11:04:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 204D261CE0; Mon, 28 Jun 2021 14:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891388; bh=EyAeVTxl7z/TcPRc3l9mcPi1JNy+97IFS7L7Wibe2V4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scnm1KYVTLtHpaIc70OwI6RWpsmZOI3sm00iYuAEklOqoMXFd2F+WkbndqpVXrpO5 WWo8jM0gJFKEuMAbJ83c/ps55temtT5jQGY+NBNJA4oFbbNRqdsWy2DAWiyB7uXm9l Yaz77ijeRDyfyfIw8AmbUueHAz/lHW84yaQ3gfUKLrkxnLHA1uPeL1cet0bkMeieZY KyB7OGaETi5XNDNM34avJav379WHxb/njcSHH2m+GNHD7niwcXAs1cA70LYVtMmRl0 piRmUoqraySdTsxYghiJfF9fqL8HtIFpE+K4EAJhdErjOzpihIfbfPBnxsJcleWtKb stG44ZXMoHTfw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zheng Yongjun , "David S . Miller" , Sasha Levin Subject: [PATCH 4.4 12/57] net: Return the correct errno code Date: Mon, 28 Jun 2021 10:42:11 -0400 Message-Id: <20210628144256.34524-13-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628144256.34524-1-sashal@kernel.org> References: <20210628144256.34524-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.274-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.4.274-rc1 X-KernelTest-Deadline: 2021-06-30T14:42+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zheng Yongjun [ Upstream commit 49251cd00228a3c983651f6bb2f33f6a0b8f152e ] When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF. Signed-off-by: Zheng Yongjun Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/compat.c b/net/compat.c index 20c5e5f215f2..14459a87fdbc 100644 --- a/net/compat.c +++ b/net/compat.c @@ -159,7 +159,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk, if (kcmlen > stackbuf_size) kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL); if (kcmsg == NULL) - return -ENOBUFS; + return -ENOMEM; /* Now copy them over neatly. */ memset(kcmsg, 0, kcmlen); -- 2.30.2