Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp264253iob; Wed, 18 May 2022 01:30:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqBe37GK54VubtRXu/TAFOJdtoypvTAfgEiV/6BkrfVYjsWvhyVie8uspgF/U7ne6JgJfK X-Received: by 2002:a17:902:ce87:b0:15e:a619:4294 with SMTP id f7-20020a170902ce8700b0015ea6194294mr26379012plg.157.1652862619103; Wed, 18 May 2022 01:30:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652862619; cv=none; d=google.com; s=arc-20160816; b=RbFpN3RlGXX4xzhxzQONWsi+9jzKbIAEMiNIFKqa2K7joq+CLZ3VQONYsXABAEEoqv CfXeK0mYOR/Qg/bN63TyPqHStSAwyMbr10NWOCzw7c3q38hsmq/SNnHP6duGZNHV9BBY Y6o0aVXPaVoZcrEOhaFumEtU75Td0Zoaw1dGwIWUmmn5ruQUDeFB3ISQbstohwSDY7Z9 vL09YlyTVPGA54sK3ruhoRkXtD8QNqqums/v73nX52j1v42OYiBMaGb7eFnWjfY6Ilou qdGovB/bmwJMYyamovp6I+Wym3wZU80cvrExpbxoQgYtv+qtDpkOkf1LigAl+ALD+N/t EpLw== 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 :message-id:date:subject:cc:to:from; bh=7yDBINZJWGsX3IW/gyFiKJoPfSp+4oywGDCKARzgG6M=; b=Gcqmqkdx1nXMlI7re30fyPIJiYFt3crBFHKEi+0YIt1EeTFObCTHbZ0g88y0XhkTQk g/EwJaliq2hWspXRwVqDyn3owMX8fUcM0hayFQzNwcnRycLIqjSz3+ZJwm/+3DzzZMqI iN8jxUbqbqCwcI847L+UFuWa7jdtthq3bg4io8D5JOiWg3ATCSnVNSEo41nROWEIcUuY VwIqWOjSpYSLr3bX3uRRiP/9en1+gEuyCeaKTF7V/yYQnnuS23DF0tDtJYFVUDYSMDLv +QfdTcbdMPUsQFB2jxWkhDjqQG+kGxNJJETLnau/wYOtb4bx+zi3bz9MyCTytuVLnaWO zNfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 5-20020a630f45000000b003a3efba618asi2045765pgp.361.2022.05.18.01.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 01:30:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42206132A0B; Wed, 18 May 2022 01:29:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233170AbiERI3e (ORCPT + 99 others); Wed, 18 May 2022 04:29:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbiERI3b (ORCPT ); Wed, 18 May 2022 04:29:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2845131F1F for ; Wed, 18 May 2022 01:29:28 -0700 (PDT) Received: from kwepemi100004.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L35jv2j3MzgZ08; Wed, 18 May 2022 16:28:51 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by kwepemi100004.china.huawei.com (7.221.188.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 18 May 2022 16:29:26 +0800 Received: from huawei.com (10.175.101.6) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 18 May 2022 16:29:26 +0800 From: Chao Liu To: , CC: , Subject: [PATCH] cpu/hotplug: check the return value of idle_thread_get Date: Mon, 27 Mar 2023 20:37:28 +0000 Message-ID: <20230327203728.159123-1-liuchao173@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_DATE_IN_FUTURE_Q_PLUS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ilde may be ERR_PTR() Signed-off-by: Chao Liu --- kernel/cpu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index d0a9aa0b42e8..8ddf372e8d29 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -590,6 +590,9 @@ static int bringup_cpu(unsigned int cpu) struct task_struct *idle = idle_thread_get(cpu); int ret; + if (IS_ERR(idle)) + return PTR_ERR(idle); + /* * Reset stale stack state from the last time this CPU was online. */ @@ -614,7 +617,12 @@ static int bringup_cpu(unsigned int cpu) static int finish_cpu(unsigned int cpu) { struct task_struct *idle = idle_thread_get(cpu); - struct mm_struct *mm = idle->active_mm; + struct mm_struct *mm = NULL; + + if (IS_ERR(idle)) + return PTR_ERR(idle); + + mm = idle->active_mm; /* * idle_task_exit() will have switched to &init_mm, now -- 2.23.0