Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3594909pxv; Mon, 28 Jun 2021 08:11:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6vi7vJBzdTo7ZDIBrqfAOsXcoJKB/Qcr/BuS8jxGftZTIb9IzWlC7lzOvylcS/QPUz2Sm X-Received: by 2002:a17:906:b05:: with SMTP id u5mr7129957ejg.142.1624893099170; Mon, 28 Jun 2021 08:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624893099; cv=none; d=google.com; s=arc-20160816; b=M3es3UGhO04KCF9FsPen1EPiD8jmLrC4R83u7tBiYprRsJd4bO2NNwgrvqFcsZ6TJ5 AOmA5QVEePIHKuLnVfZtWFegwdpq0nR571HDWPhrwwC/UINzbCQLGLmW8ZpfVNwEw1b1 Pe+V3xqlZM1d/5OjISSF1wbjpkkHU3SjVdQZpLoe5TrBFyNewzJkBj4vwoW5ExGxwewh /WJhqXlUZwM5PUcC8ZfOW+NeLB6oxN0PxDPGf8FGcknHk/z9BFXasbihtfLaYAZUfTl9 hhYUIIzyaJyUbfh0LxsB0ST57Tdo2scDjaw/ND+6jSBAT8V6jHeVjoHosilct6NaJhLi vAeg== 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=WXPQ9BvJ/dpNt4QgupzrfNcQhCy9bPmzWaHl2WWtAOE=; b=UVMnAu985A2YwO1iyTJSgvavcvfyqUhHfDQgbFnIlnRZ1folMhGGo45Dr3p2Lnv/Mp VMacpY7+CMPiG6CHlthmzAXTqrZs7n7Whf5muLjtIGf9JP1ChSwaw7PToVE0U69Pp/t3 XAurBNHZjkAH1sM6+qDaUhY3hPefD9Ku3HIgO7e5574KUwMJ3AeMt2hWSSqu0NCOzJvN law9eJGekE9J4f56iV0qmtH3QSfYLCH+j7P5eY0Pwgji/c9xX9YZNDSiVUqy2njqbipz cuvuWGvNdd0RFBT3BzotAmXuv5uHUnJAK3NRYl4Qrr3GYwNEJgGsrzWnK0F2ftnOK/HV KDLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FMyKlZ+a; 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 bz7si13865211ejc.650.2021.06.28.08.11.11; Mon, 28 Jun 2021 08:11:39 -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=FMyKlZ+a; 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 S236194AbhF1PJE (ORCPT + 99 others); Mon, 28 Jun 2021 11:09:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:55974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233950AbhF1Osr (ORCPT ); Mon, 28 Jun 2021 10:48:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3C0261CA6; Mon, 28 Jun 2021 14:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891004; bh=PW9i5nQ9u/7zRXFaJi4+KmTo3QsTKyQlAlfxo6yFvv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMyKlZ+ahyFLoP/PO/PTvLaigDay7i8DEa2zX16YbR7ZgOhaJzB1d9NMYpnUeismp sj5Iwgzj0S6o6pE61x9AEnmWqj5IHuLEorpITeufHRUQlF8gWY+OK6cxl/WqxxAwGX 6HrbsgWywfY1H8dBHZ35AdD+K/2FutThwgRFHHUXEnMGVggiQBNPGMI3dGnQnvzfDv sltD82ON4hbIo7oRC2Kq3+rCJX3CzS+teY3mDay5lRNqrXY3sdCYNgcuE9UGqbk2sx K+tQX3Qgnz4G26Rtf6I5bvoOEcZ/RCjl1vlRdI/SZ94vNyL1MiumB+ixuM9Q69fFY9 ZF8x+xCZ/ZAsQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zheng Yongjun , "David S . Miller" , Sasha Levin Subject: [PATCH 4.14 16/88] net: Return the correct errno code Date: Mon, 28 Jun 2021 10:35:16 -0400 Message-Id: <20210628143628.33342-17-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+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 45349658ed01..2ec822f4e409 100644 --- a/net/compat.c +++ b/net/compat.c @@ -158,7 +158,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