Message ID | 84d7cd03-1cf8-401a-8edf-2524db0bd6d5@oppo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-84701-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3215742dyb; Wed, 28 Feb 2024 00:50:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUYLcl0WrZ6/PzEiBXHH0vHF/yXEyPXlUyS3+Bx1Zzmy2jlItnpAN4j4LaQEyxrb9A4Hys+s/gQcdliIP4yozYHRbPESg== X-Google-Smtp-Source: AGHT+IGmcAQWRTXOVsW0T/gD7AKcbhYmOafU9ucZ56CYv04vNnLDirLO0Cgx3zVgft+AQzJx3V0T X-Received: by 2002:a17:906:8414:b0:a43:76d4:806c with SMTP id n20-20020a170906841400b00a4376d4806cmr4553793ejx.74.1709110239563; Wed, 28 Feb 2024 00:50:39 -0800 (PST) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a23-20020a1709062b1700b00a3f57432953si1553037ejg.437.2024.02.28.00.50.39 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:50:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84701-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@oppo.com header.s=selector1 header.b=dd1bLmPp; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-84701-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84701-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oppo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 074C91F24893 for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 08:50:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 492772E647; Wed, 28 Feb 2024 08:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b="dd1bLmPp" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2132.outbound.protection.outlook.com [40.107.255.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 540862D056 for <linux-kernel@vger.kernel.org>; Wed, 28 Feb 2024 08:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.132 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110222; cv=fail; b=V4UsNpS5Q/wCLem0OU2gnwIFzIldNuXuZ4EOKjOXMXPP8TuDzdPiX6juHjdDf2+JVCE0JYnTkTkYzlz9QzImMZZgkaoV5IpVwlyt9q225/GVQIvT6yaC7qz59cGbLUYtGUQfN6tkl2ICTikqmD6BYruglvdSIVkiPFNshLTe1Ik= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110222; c=relaxed/simple; bh=5N7FqwmmZvqN09JjQRn6vDNUpQVIPMwU9aMA0Nx77NI=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=C+8Dm38u9rDJ0ro8wSWFovmek27Wf656bXwpPNXsWX9IJIElqt+EHFnlDjYSoq5fSrRl8mmfiRE/7/F7ijM4/cI3FduuX/iaA7oLcqR9IREQcMMM1YQ8jfWRf7nIgVFCJShliATo1k1nUq++88hwiLzxcaFi5tj28pxa1JEhib4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com; spf=pass smtp.mailfrom=oppo.com; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b=dd1bLmPp; arc=fail smtp.client-ip=40.107.255.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oppo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k8Qum3/p14PBnh5u4JO9Uv5f41Wz09I8I+57dmfuRg8+aQYcH2wxbPELGv+x4oUrEMsB1jdd1YuP2jfB3uuMituLmYWcVA2S8SsjWawscCNHceAqeLtXxeSTM1EiEvmUuNjSOHshXx+hoxXx3SvrVPyvvsSYXoTJSj7PKBl2QtNiIlBjhYAzXN/5G0L3Q4I6h2WmYAGn6Br+9dMae3bOm2lZEibK73rg9I2pWMAsTCy7dDgYYj1kLRTtxtTugAE+PBRNP9jArTl2medBCiNDy7hLcqLvEXG+Zk25lrjjJTv7g9TZkElvKisUUqMbtcHG94QVMVpIcJH6zrk3TdqFxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5N7FqwmmZvqN09JjQRn6vDNUpQVIPMwU9aMA0Nx77NI=; b=l8VuzxG4t49IePNw3TyZsV6PoPmTtr/LrDPhs8+kJJ7GfV1S1biUnLQwNe8/moiaxashjyLJdGY3Oir/Rz9oWVz6waGexJgb+G1/qJWfPIQTivesP0xM/FpsFipqLQIMlP/PBCDYYsAH6XaNyxdGk3bPfFifROneqhZ1ywrBh1jmTYpdgpcSpG12FH4uDAoSjweL/d7l0lqhSXQiddxTm4XaRKnHcxy8jCZ3wJLV4N/zOha6CfOREkb6tRM7+8S4XVuDYcDd4ZqTLAuVI0tPf9EuxoprYDVFLgfzWcAryXvBuFfzcmZIkvRoZ3S3vZyCsI+P6rNi7KNMux+d+TU4nA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5N7FqwmmZvqN09JjQRn6vDNUpQVIPMwU9aMA0Nx77NI=; b=dd1bLmPpIYvZ33DHrP2ECD9I8TFY58qkVhZ8xS1LMw+edJkEVXrh3qdSXSUNcmUVWe0EY4oRMQEXVcDE87jhHbRuSqFaFrRN+Y74KVvg1pQX030pQNL2IvEzaNgPw5iLSEWLJuPeOXMp1Qr2eN5bSu43+S4ZIZmLlLAR7TGafOk= Received: from SEZPR02MB7164.apcprd02.prod.outlook.com (2603:1096:101:194::8) by SEZPR02MB7073.apcprd02.prod.outlook.com (2603:1096:101:19e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.38; Wed, 28 Feb 2024 08:50:14 +0000 Received: from SEZPR02MB7164.apcprd02.prod.outlook.com ([fe80::c54f:7115:e36a:591d]) by SEZPR02MB7164.apcprd02.prod.outlook.com ([fe80::c54f:7115:e36a:591d%3]) with mapi id 15.20.7316.035; Wed, 28 Feb 2024 08:50:14 +0000 From: =?utf-8?b?5YiY5rW36b6ZKExhb0xpdSk=?= <liuhailong@oppo.com> To: "akpm@linux-foundation.org" <akpm@linux-foundation.org>, "urezki@gmail.com" <urezki@gmail.com>, "hch@infradead.org" <hch@infradead.org>, "lstoakes@gmail.com" <lstoakes@gmail.com>, "linux-mm@kvack.org" <linux-mm@kvack.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: [PATCH] mm/vmalloc: Fix return value check for vb_alloc Thread-Topic: [PATCH] mm/vmalloc: Fix return value check for vb_alloc Thread-Index: AQHaaiMl/BXt6+jxSE2MrtR/YdMwFg== Date: Wed, 28 Feb 2024 08:50:14 +0000 Message-ID: <84d7cd03-1cf8-401a-8edf-2524db0bd6d5@oppo.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SEZPR02MB7164:EE_|SEZPR02MB7073:EE_ x-ms-office365-filtering-correlation-id: 11cdcb2c-3f9a-4b03-2476-08dc383a47c7 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: k2qcM6jbBYiAX8Zod+9UsL3BSA3sFqd69s3vk4inmpY69HPSzhCxj7DhmZIr6viTAQ3YyGLrRxujnY70dBDUqtKWkml4jmCRRp4vanzNDO+Mrlk1h1PhNXrloMZAoACrKtD1rc3GjxEiJeN1AMXTxB/dACZzjNyUlssJ4o20n89Wr5Rn0UqVT2lTr5JoyuGPPw8oHRUtp7EJG2z4kiKDGILQDeVp6X0kXpVsWf+YiPtlwEbPDbdxQn8U2ITMkmLIfT+oXdowtBF4acsv08/3nTP3prX0EZjRmzPFNBd4KblVyRKzU9xThzEwfChs5Dswway0e6BpIBaaFr7KYseDC/MhuGyix7G5n3RKHvLmP54CZEbd7XZhgD9WqJkiwFuwxmqRmzClODNLAgMoM9q97qiisMKxevWH4XlX/ExznDAKRz5Cpb6ibCa+i0FcxJFH94M/EC8Ww5mHDqZ+KR3ROZJV37/T5WyTwRl3m6+OvEUK0MJEBysfS0ncKUOOiV+Fd8RgqD1oS6sO75zJqNA8SzaKNS6FKISPot3pv97MIDkD/Uj4elzoH/mQ9duZo7pg4CvyQAo083B+TE6h/mn50IueWUICEDf1TTZhsy8YqSQHCWIhOXMDgVE6hrHZsHtcaidQ1U3/iYZUxzy+vDWoySRBVK2+mVVoRqjcVVa7K85N3h1nHbGHHs5kzSWcjW4KZGGFhGosy5opl8qekk6lUqLXy9r3cX/cDciLF82Ckk8= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR02MB7164.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38070700009);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?3+GUdRumHGfuDkGVMuU3w4xZ/128?= =?utf-8?q?gb/t9XHgMbXXN39YX0NAnhv8UKUPOo1879HDKsMVUszyl92upCFsOShu/sYDYeehi?= =?utf-8?q?HJSynaBy3roPLvnZ8FgBydlpZYCsinoyN1EW1z5YQDBtCkoOzImqVXvE1v1ogD4HH?= =?utf-8?q?ID7mk/4MhKfvi34ryIUbIwJcBVQVCXnhbHCf0GJ0Kd1LX7sbCEGAG8uaS6KLxY01d?= =?utf-8?q?aNncbSNMeQmi14ce4igFPWsBp5sAnI14bM4IO8XZZsuPm/DGUgyWDC2S7cNgz/ofr?= =?utf-8?q?1UfMYmlxYdCCuIkbARP4u8FN3B7UFhB1Wun5fjdnA91XM3RawyqkKvQpyV0KORUCd?= =?utf-8?q?Z8Vg+pSzyrD/a5jHgasW4ju52tcfumiPdMfRcXjseUNRMZdzVWlETKZO5CIKSEo+R?= =?utf-8?q?lkzpMcSM/YN5K/q/oswxINv2Nezg5OiUo064aooESO9W9kbUhTVE4p5cmgadUzu/w?= =?utf-8?q?SPKwybdahP4U3n5qA/YPDtavTmSX7u7N3WvBXFs3/MzHqlEJ9MyzAeY/GOiGR7tuT?= =?utf-8?q?KbAFLfoc7mst8gQO4DetI+TgRtG+zT9asU1cVE4QjJgGGWXdnUpMl+FeiBMfoI5DO?= =?utf-8?q?hIdijraSeMOdu/3NQ1GIxaoesADZgAjHbHpl1p5N3SNlCgZju6VU8JyMkeItxYsuu?= =?utf-8?q?aJu+09RuteW7n27cU7O67dVuglPVDLPZcHV0odV8mEbb+CpU4cJ4yMUWKMLLWVoV7?= =?utf-8?q?KLrdT0i2zzmS7VV6wM2v+bnRpU05YAPP3EU97bE8kiAGatZ0j+Tg4q7BvDMFs8bW1?= =?utf-8?q?uXad/8lcnj5ejc0nfyxdq5lgH7nCeevh1Znyn3Ft6CGGSzWSMtPULTeRRUKzgIqv0?= =?utf-8?q?sCmWh7xbuIxCDJ5tu6I80NOsKtccdjZsuso3eHpd84vcR7qu24DFEiwk3wSL/tN1C?= =?utf-8?q?d+qg4YxfKr2ROxmaRejM5pmCtqvPgvrOAhbmn7QWOVBjMXBYXkui2CP0IpV14Stz2?= =?utf-8?q?m8XZHurQR0gGC/husIHUNV3sKvE05Ohe2eH2qhQ90AijRbTf1VIExh0kHtpsJTaMy?= =?utf-8?q?WuY0XhPyURUUgoy+MjdrD9i6mbsQCbAoK7HTtKagO2cW75J7rF+lQnguh7iWNctE5?= =?utf-8?q?KIQyhkIvl18xIvQ11rHue0vX1Xl5K3hwwYz49UGGza4UyH72HwBvOyuqGHXujXiI3?= =?utf-8?q?B04Kx1MFtHxBJw7kyUnJKMzZVH8rGXgBJyib4nNHeSAfWNrocmdPCTFszNpsPznqy?= =?utf-8?q?tSMwVcHFVmyw03WPSsuTZ7PRgL+ABQCnscrAfxRez5x5KMOWHHCPMwFlI/68VBYQw?= =?utf-8?q?xwa7SucIcWLHAi8BPHakGarWZD3rZPT1HV3I93wHTFeFaC7N7N2UYsYdcTLbd0C24?= =?utf-8?q?UNDLH/FQKUHxhE78XIIppmxVJIKxUfGg8bCzYGTkWVPBfjia6Ua2o9RFcezU5U1OT?= =?utf-8?q?BeF7zoMJ+LbTc0sXZyywo5pttNC/87wdq8R+hT79MLLPEreFcR1KuYyQWTHtAMdvt?= =?utf-8?q?duUO0L72Ys7DH8+cXybzrWr/M8PTZbq/sm5Wz2X0N3DAuMy3trOFSFQVgM4CgTFiV?= =?utf-8?q?E/3/1274ZbP5?= Content-Type: text/plain; charset="utf-8" Content-ID: <F0ABAA4C1D45EF4FAF85C1B8F1DFCCD1@apcprd02.prod.outlook.com> Content-Transfer-Encoding: base64 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SEZPR02MB7164.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11cdcb2c-3f9a-4b03-2476-08dc383a47c7 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2024 08:50:14.3095 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TOJVvBilI0oBwEmmdSu/o68AvRPTQb23YBjAl9kqetDzkWoyPUrwipK7oGPPEH2oxpbor7/NksL1qFVfXRmBvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR02MB7073 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792131978555770879 X-GMAIL-MSGID: 1792131978555770879 |
Series |
mm/vmalloc: Fix return value check for vb_alloc
|
|
Commit Message
刘海龙(LaoLiu)
Feb. 28, 2024, 8:50 a.m. UTC
If vm_map_ram(page, 0, 0) would cause panic by vmap_pages_range_noflush, so
change IS_ERR to IS_ERR_OR_NULL to fix this.
Signed-off-by: Hailong.Liu <liuhailong@oppo.com>
---
mm/vmalloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
} else {
--
2.34.1
Comments
On Wed, Feb 28, 2024 at 9:51 PM 刘海龙(LaoLiu) <liuhailong@oppo.com> wrote: > > If vm_map_ram(page, 0, 0) would cause panic by vmap_pages_range_noflush, so > change IS_ERR to IS_ERR_OR_NULL to fix this. > > Signed-off-by: Hailong.Liu <liuhailong@oppo.com> > --- > mm/vmalloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index d12a17fc0c17..109732006cf7 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -2387,7 +2387,7 @@ void *vm_map_ram(struct page **pages, unsigned int > count, int node) > > if (likely(count <= VMAP_MAX_ALLOC)) { > mem = vb_alloc(size, GFP_KERNEL); > - if (IS_ERR(mem)) > + if (IS_ERR_OR_NULL(mem)) it seems the only case for vb_alloc to return NULL is size = 0, isn't it a bug of caller? > return NULL; > addr = (unsigned long)mem; > } else { > -- > 2.34.1 Thanks Barry
On Wed, Feb 28, 2024 at 10:34 PM Barry Song <21cnbao@gmail.com> wrote: > > On Wed, Feb 28, 2024 at 9:51 PM 刘海龙(LaoLiu) <liuhailong@oppo.com> wrote: > > > > If vm_map_ram(page, 0, 0) would cause panic by vmap_pages_range_noflush, so > > change IS_ERR to IS_ERR_OR_NULL to fix this. > > > > Signed-off-by: Hailong.Liu <liuhailong@oppo.com> > > --- > > mm/vmalloc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > index d12a17fc0c17..109732006cf7 100644 > > --- a/mm/vmalloc.c > > +++ b/mm/vmalloc.c > > @@ -2387,7 +2387,7 @@ void *vm_map_ram(struct page **pages, unsigned int > > count, int node) > > > > if (likely(count <= VMAP_MAX_ALLOC)) { > > mem = vb_alloc(size, GFP_KERNEL); > > - if (IS_ERR(mem)) > > + if (IS_ERR_OR_NULL(mem)) > > it seems the only case for vb_alloc to return NULL is size = 0, isn't > it a bug of > caller? what about the below? diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 25a8df497255..640157221c95 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2834,6 +2834,9 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node) unsigned long addr; void *mem; + if (unlikely(count == 0)) + return NULL; + if (likely(count <= VMAP_MAX_ALLOC)) { mem = vb_alloc(size, GFP_KERNEL); if (IS_ERR(mem)) > > > return NULL; > > addr = (unsigned long)mem; > > } else { > > -- > > 2.34.1 Thanks Barry
On 2024/2/28 17:34, Barry Song wrote: > On Wed, Feb 28, 2024 at 9:51 PM 刘海龙(LaoLiu) <liuhailong@oppo.com> wrote: >> >> If vm_map_ram(page, 0, 0) would cause panic by vmap_pages_range_noflush, so >> change IS_ERR to IS_ERR_OR_NULL to fix this. >> >> Signed-off-by: Hailong.Liu <liuhailong@oppo.com> >> --- >> mm/vmalloc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/vmalloc.c b/mm/vmalloc.c >> index d12a17fc0c17..109732006cf7 100644 >> --- a/mm/vmalloc.c >> +++ b/mm/vmalloc.c >> @@ -2387,7 +2387,7 @@ void *vm_map_ram(struct page **pages, unsigned int >> count, int node) >> >> if (likely(count <= VMAP_MAX_ALLOC)) { >> mem = vb_alloc(size, GFP_KERNEL); >> - if (IS_ERR(mem)) >> + if (IS_ERR_OR_NULL(mem)) > > it seems the only case for vb_alloc to return NULL is size = 0, isn't > it a bug of > caller? vb_alloc had already checked the size == 0, so it should be return NULL to caller or not panic here. In fact, we encounter z_erofs_lz4_decompress issue. [54032.383633][T25392] vmap_pages_range_noflush+0x790/0x8f8 [54032.383637][T25392] vm_map_ram+0x1c8/0x10b0 [54032.383642][T25392] z_erofs_lz4_decompress+0x60/0x1e8 [54032.383648][T25392] z_erofs_decompress_pcluster+0x624/0x9fc [54032.383653][T25392] z_erofs_decompress_kickoff+0x18c/0x224 [54032.383658][T25392] z_erofs_decompressqueue_endio+0x1a8/0x1e0 [54032.383663][T25392] bio_endio+0x188/0x47c [54032.383667][T25392] clone_endio+0x1a0/0x550 [54032.383674][T25392] bio_endio+0x14c/0x47c [54032.383678][T25392] verity_work.60258+0x7c/0x13c [54032.383682][T25392] process_one_work+0x1b8/0xa98 [54032.383687][T25392] worker_thread+0x160/0x6c0 [54032.383691][T25392] kthread+0x15c/0x1d0 [54032.383696][T25392] ret_from_fork+0x10/0x20 z_erofs_lz4_decompress has checked the return value, so it's reasonable to return NULL if size == 0. Brs, Hailong. > >> return NULL; >> addr = (unsigned long)mem; >> } else { >> -- >> 2.34.1 > > Thanks > Barry
On Wed, Feb 28, 2024 at 11:02 PM 刘海龙(LaoLiu) <liuhailong@oppo.com> wrote: > > On 2024/2/28 17:34, Barry Song wrote: > > On Wed, Feb 28, 2024 at 9:51 PM 刘海龙(LaoLiu) <liuhailong@oppo.com> wrote: > >> > >> If vm_map_ram(page, 0, 0) would cause panic by vmap_pages_range_noflush, so > >> change IS_ERR to IS_ERR_OR_NULL to fix this. > >> > >> Signed-off-by: Hailong.Liu <liuhailong@oppo.com> > >> --- > >> mm/vmalloc.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/mm/vmalloc.c b/mm/vmalloc.c > >> index d12a17fc0c17..109732006cf7 100644 > >> --- a/mm/vmalloc.c > >> +++ b/mm/vmalloc.c > >> @@ -2387,7 +2387,7 @@ void *vm_map_ram(struct page **pages, unsigned int > >> count, int node) > >> > >> if (likely(count <= VMAP_MAX_ALLOC)) { > >> mem = vb_alloc(size, GFP_KERNEL); > >> - if (IS_ERR(mem)) > >> + if (IS_ERR_OR_NULL(mem)) > > > > it seems the only case for vb_alloc to return NULL is size = 0, isn't > > it a bug of > > caller? > vb_alloc had already checked the size == 0, so it should be return NULL > to caller or not panic here. > > In fact, we encounter z_erofs_lz4_decompress issue. > > [54032.383633][T25392] vmap_pages_range_noflush+0x790/0x8f8 > [54032.383637][T25392] vm_map_ram+0x1c8/0x10b0 > [54032.383642][T25392] z_erofs_lz4_decompress+0x60/0x1e8 > [54032.383648][T25392] z_erofs_decompress_pcluster+0x624/0x9fc > [54032.383653][T25392] z_erofs_decompress_kickoff+0x18c/0x224 > [54032.383658][T25392] z_erofs_decompressqueue_endio+0x1a8/0x1e0 > [54032.383663][T25392] bio_endio+0x188/0x47c > [54032.383667][T25392] clone_endio+0x1a0/0x550 > [54032.383674][T25392] bio_endio+0x14c/0x47c > [54032.383678][T25392] verity_work.60258+0x7c/0x13c > [54032.383682][T25392] process_one_work+0x1b8/0xa98 > [54032.383687][T25392] worker_thread+0x160/0x6c0 > [54032.383691][T25392] kthread+0x15c/0x1d0 > [54032.383696][T25392] ret_from_fork+0x10/0x20 > > z_erofs_lz4_decompress has checked the return value, so it's reasonable > to return NULL if size == 0. I agree. but there is no reason to activate a WARN_ON in vb_alloc as obviously it doesn't like it. so fix it earlier. I even feel z_erofs_lz4_decompress is a better place than vm_map_ram according to your description. but at least vm_map_ram is better than checking a vb_alloc's ret after it gives a parameter obviously hated and causes complaints. > > Brs, > Hailong. > > > >> return NULL; > >> addr = (unsigned long)mem; > >> } else { > >> -- > >> 2.34.1 > > Thanks Barry
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index d12a17fc0c17..109732006cf7 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2387,7 +2387,7 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node) if (likely(count <= VMAP_MAX_ALLOC)) { mem = vb_alloc(size, GFP_KERNEL); - if (IS_ERR(mem)) + if (IS_ERR_OR_NULL(mem)) return NULL; addr = (unsigned long)mem;