From patchwork Thu Apr 13 14:34:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiongwei Song X-Patchwork-Id: 13210356 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC388C77B6E for ; Thu, 13 Apr 2023 14:35:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 473356B0078; Thu, 13 Apr 2023 10:35:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 42270900003; Thu, 13 Apr 2023 10:35:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EAA0900002; Thu, 13 Apr 2023 10:35:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1FF3C6B0078 for ; Thu, 13 Apr 2023 10:35:40 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D4D81A023A for ; Thu, 13 Apr 2023 14:35:39 +0000 (UTC) X-FDA: 80676616398.08.1101B91 Received: from pv50p00im-ztdg10011301.me.com (pv50p00im-ztdg10011301.me.com [17.58.6.40]) by imf12.hostedemail.com (Postfix) with ESMTP id 109B04000E for ; Thu, 13 Apr 2023 14:35:37 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=me.com header.s=1a1hai header.b=OxAmEuHT; spf=pass (imf12.hostedemail.com: domain of sxwjean@me.com designates 17.58.6.40 as permitted sender) smtp.mailfrom=sxwjean@me.com; dmarc=pass (policy=quarantine) header.from=me.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681396538; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rfau5OufM0BiNWhby4onOK71jyUiBVhrPZSigYK+sks=; b=e0/IGCb/u2pO7PyJyrrT7+H+xCIg+0BXMARLRq0NSUhkVzsVU9g3oS1PjuBMzBlwGf9Ao5 jwJEzgG5KdVSJYrykawxS24AS5lkM7GUC77RiizVf5W/nzvxPM2q8qwm5pDTQVdHhwk2gl 55b4HcfTHuNs7TyYm/cymKMJ6wKE79g= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=me.com header.s=1a1hai header.b=OxAmEuHT; spf=pass (imf12.hostedemail.com: domain of sxwjean@me.com designates 17.58.6.40 as permitted sender) smtp.mailfrom=sxwjean@me.com; dmarc=pass (policy=quarantine) header.from=me.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681396538; a=rsa-sha256; cv=none; b=Q0TYp+Ovc/OwV4CPBDH6ymwbY0LWTnu9TxnXeQUcCMZAa4lYMfNZQFWK0LytfSPk4mfK5v fuA4ZoLzpNjpxddFvbDB/AsE507H960GUYwoNemDjoZg4MuxvHeN+EPJPI+r29AaCfQg/x n1jBY6Cnx19BQBpfReDL3cCxUY+OzA0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1681396536; bh=rfau5OufM0BiNWhby4onOK71jyUiBVhrPZSigYK+sks=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=OxAmEuHTfbSVCKdAfkQv02ZaI1VeZo+oqjWjiC0NDnzKYZ3QYcB9qQyCqVjceU2ns rxhuI69vMigg8bi+XZKz1aHRqvd2Fh79cHKvc0lQ77ndsMQ05s7rXerNHiGe+prOm1 gOsnVWdqjcuh0XBYfv+WIC50Ias0u2u6N7+9OgmvK90VpGloW7Ibfedr8mrjBZ6jDz AowZ4/ypEnQjcdRWoM2TE4resLxelcNFFJZl/CWzbHUKZRTSPNDZ9ODt+1/nfQv6xg 6hLraqC7BpImr5CalHFlNHbXvDZAuL1MHtuYMiiJly2ZfZGeuwTLB36ChB3fqlHhkG RAmlX0Fi5l1hQ== Received: from xiongwei.. (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10011301.me.com (Postfix) with ESMTPSA id 540711805A0; Thu, 13 Apr 2023 14:35:30 +0000 (UTC) From: sxwjean@me.com To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, keescook@chromium.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Xiongwei Song Subject: [PATCH 1/5] slub: Correct the error code when slab_kset is NULL Date: Thu, 13 Apr 2023 22:34:48 +0800 Message-Id: <20230413143452.211250-2-sxwjean@me.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230413143452.211250-1-sxwjean@me.com> References: <20230413143452.211250-1-sxwjean@me.com> MIME-Version: 1.0 X-Proofpoint-GUID: 51lpZUJemfRvfvuXf7GNT1NeHV8UTyvG X-Proofpoint-ORIG-GUID: 51lpZUJemfRvfvuXf7GNT1NeHV8UTyvG X-Proofpoint-Virus-Version: =?utf-8?q?vendor=3Dfsecure_engine=3D1=2E1=2E170-?= =?utf-8?q?22c6f66c430a71ce266a39bfe25bc2903e8d5c8f=3A6=2E0=2E517=2C18=2E0?= =?utf-8?q?=2E883=2C17=2E0=2E605=2E474=2E0000000_definitions=3D2022-06-21=5F?= =?utf-8?q?08=3A2022-06-21=5F01=2C2022-06-21=5F08=2C2020-01-23=5F02_signatur?= =?utf-8?q?es=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 clxscore=1015 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxlogscore=989 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2304130130 X-Stat-Signature: 8hod51pj6qrapwmafgi67cygne73hwcr X-Rspam-User: X-Rspamd-Queue-Id: 109B04000E X-Rspamd-Server: rspam06 X-HE-Tag: 1681396537-346466 X-HE-Meta: U2FsdGVkX1/xW6qkxl8hjtnXWjCOJ3fB7MKtMYnAKBI8gjUD+tGfPS3T25aG/zsmZnzMn2qzkG+Ls3KzEKWbFU8cTAZMXq26hTOfmM9aiqatj9awu2YWYG3FJjrGVQqiHQVc3SDTNTMMw+77BpeXcyuYrpAcTXPGcALgvada4vknBbB0SlplcxikbHPIoQRwfnwM1EjffcNPJmMLgbixeYAXIyDeU6DK0flStpzgK5DmqgQ4iyTKZJw06yuBnIXtjjkgxzj9XZtwc6ZuNUzVcAjKbt7LcgqNNR3antRUMuq2tRPVVUrv6D61yZcQ5xQp8JHnuAXM3HdB03o9SibHTrGOIVdEtRXHWSWJEpVFYJJAtlAUp8gIQba+kl/Lnjk3W/KExDaHLJ5tYnntQNrqnegbop1zAOwgsZINy4jOzzuopv8TM3Vvgu2KqtPaNH6iTrkWu5vGc3MSEmcDNcokAd18/BdmQl02xq6QaSCuev3GlZTSk1cREpMb8CPPHnASVoRoRZ7ymjRQEwZXcLpUUsKUOR1Vxv5PTvbm2j3K1wGx011i2U5EuKX6MP0TJx6aQHjw9+EljcnKHqvahSqnN/dh12HO9T5vRVSmA2qfHe2W45CvriAPPGdOkDmWxx3tX1xNnnlhbg0X/QCBfGW1xCcUjMQliUFHTN4MezN7A7SfFjIhBgx12XdiMJSsPntFgEAeAGhcv897iNx5nqZt/0q8Rm/0Yp54zl2FKz/Sqc0/kAp0DEQKD1vfzE6/YMBgJFlUmVZBlhsgUtY5pKKDn3XnE+5WlgHbpO/dV5xjBdmZlOsQoZKHHAJjj5SdfTUSsKS8C0AMBO1vVWVbhX4gcjP/YutXei8gPlX5XMfmkk+MAtn1iomqCkZRtUGvd6YUu0qbkUjAXS2mePoSQn/UH8r6VBkWjoPYEmORyNEm5Q6rDmGbs97WiNpQPEUPFhf4iF1kShO+1QHH1Dex9lb jBU7ISxD PCBr5T9XniRrLDewXZdYuDXD0VRxxkHGnWjij4glsurShzZZUG1kNawotLlqXbZWb9vJnPhUQqs7dWymbWKX3f2eAXGXQKWbccLm9TiJzPaorKTUYhOHQyEuj/spjf+nN9Gl3Fr8C9P/PySByYiSD9c+ejKXnilB/MdSMxmTOdV5SFP4jrpgLdD1pe9ZWPEV1kI/n00FVHlLjl9HYaw3budtwsX4ZhZEdRJRENX0Rf8lEktmOTht/JsUb+fU4nbv9sfTt0+0cvvTyfbKuxg/4LizpSD/bHMjiDTw0APZSdbB1GY1eaCDZLTs9UtKsVHEaDRdFDqGCK8fTmeYcB5S8nTVLua6zCX5OTZLU+IJ5axQcIHLOZKTv1nW49VaCH/YBAL5Va1PCepMjfoLki0TUHBeFsg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Xiongwei Song The -ENOSYS is inproper when kset_create_and_add call returns a NULL pointer, the failure more likely is because lacking memory, hence returning -ENOMEM is better. Signed-off-by: Xiongwei Song --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 28ca576d988d..5cc56f780241 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -6225,7 +6225,7 @@ static int __init slab_sysfs_init(void) if (!slab_kset) { mutex_unlock(&slab_mutex); pr_err("Cannot register slab subsystem.\n"); - return -ENOSYS; + return -ENOMEM; } slab_state = FULL;