Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3517050pxv; Sun, 4 Jul 2021 22:15:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQMiEYZ6aGIK5jLpWWvXzLs0o8U1HQRimJ0iYUTFzZUMqewOD7gwI5Us7XCZspHEmvStAq X-Received: by 2002:aa7:c3d8:: with SMTP id l24mr13854396edr.172.1625462114384; Sun, 04 Jul 2021 22:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625462114; cv=none; d=google.com; s=arc-20160816; b=BzgqPJh+G+0l4UeY+TXCZHsKQoVNL+V2jL71XRctFYfNJx+zivnUC9+rJ9zgJ46MMi eUfDe1zilWtBfPYpooEYka0k2TLRbJPbU/Rh3F8g7LPvi+jGpcTuRQzuF9rwzLVCQnK6 4ksZsaubH3AXz/eu6jwVQfepmtOWAB31FmhVOCeXYDVkMJFbivbY7oOR8Eyzb0Kk30Ax qooq9P21wxqiN/kPBLVUDnHt5Q+K04CcU362OEdWxw7JpkMPaNiNGyTtnNr/EBCTKdbA zI17nncC3HFmcyJc1DRjKjptrUF4vQq36RBoZVyxh5kNgUZYc9Ls2pgcKF8vYAfIdLQs eaWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6+VkB/bnz8785c81a+SwRBAk920PLP5ZGWYbA1JiHcE=; b=0gaunhWmAVyY1QrmhhlOM4a8wSthiQnWFpuZarOEkHZRh5egwg/VEBNBES0JZRNjwB P1T0JS+hOsu25OzhUOyBa4DXmqp7DKVYuEtMCC7i7G9vKZCLfKwovupgjC++DRHMmfy4 m2zGOrgbl9mG1FsINMQ1zjLY6o9Qm/3+aYGnXtWEgMnoFgnwVT4ATHDFxtpY53BJDR2P bmUp0YtNPO4Rmh/FuWTgdja3CnMSSKAKEhQyhZa4QHySAX1Fdj6a5WYpZWA09X0kxsl3 xbXYBhSgOugfykMNTrEArJFO6JM9sfxfWSPuz3/+St7W66iNF4Z1IwdWBh8AMLpFzWQW bzaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s0uL3AS3; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si6596488edq.411.2021.07.04.22.14.51; Sun, 04 Jul 2021 22:15:14 -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=@gmail.com header.s=20161025 header.b=s0uL3AS3; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbhGEFQc (ORCPT + 99 others); Mon, 5 Jul 2021 01:16:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbhGEFQb (ORCPT ); Mon, 5 Jul 2021 01:16:31 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9D88C061574; Sun, 4 Jul 2021 22:13:54 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id r4-20020a0568301204b029047d1030ef5cso10215152otp.12; Sun, 04 Jul 2021 22:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6+VkB/bnz8785c81a+SwRBAk920PLP5ZGWYbA1JiHcE=; b=s0uL3AS3xXGDcWhZVTmmu6jCfJfwPK5PiGh3tqu3GzTytFy0/vC9amvNlth+OTzaSb eIvEm4WJufO3O0zsQSOYPtZlQF2v4ixqCkjYX2/2ljFBZaG4q75tjF3XYTmgoIFn6KnE DmHLPZ3iUbe6OM+huXwgpAm1cNYazdI2KRT6jrQZoJw3eVLDYBKCEhwIwz5qlytgb+8V ulV7AoZ6MuVkEXmjSQfOYOoWB3QIm8FL9Fqhx3jPe8tJEmYO118Tqb4+qNtv+uSGAlWW AgOUB5Xept9wnOf4ed9JGqI/XkkrD6l2LF/18yIOvO2AWdl9uqahGLvEVVHsdvpBOHoj BRvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6+VkB/bnz8785c81a+SwRBAk920PLP5ZGWYbA1JiHcE=; b=JTS3/ovBQrXmocdWUhc0uPcE2aK64tsaR/JD6GoFkuuiVoAXPGn0Yum164HXhfrXFz lbCJrrfzCyGURj3D4Zl+Mk+PEkXOsGmn3C5V1+OAYffnLcjM1MpekW3CFmWwOyhRdrRL mufLMK9eZ/xQGeZ1VpMOxvVz8VAlKSHqEiyf3zqDckVBQTZ7pUH2tHSZatStXvVp1Vzn Tzdmimtru6FYT2Xtsn8s9ovKyiRhcMPNim0LsN8uRnRSBq+S0/PfRj4XYvvvpNACVVqF OHSA0c6oDe62dN4rG3YmBNoeBJXZ3KPYE3UsXQS0Y0jAdB9HnnzeTRBHCLAuMP0e4S6S VHfQ== X-Gm-Message-State: AOAM531oJu9BjjZA6LahdeoQs1A062S/ruK6ShKOv8XeGdtJXIt5kz7j /yacHxy0GF43Hn6MaM8FxnGg96Dhp1chs46Ixw== X-Received: by 2002:a9d:ecf:: with SMTP id 73mr9867041otj.5.1625462033929; Sun, 04 Jul 2021 22:13:53 -0700 (PDT) MIME-Version: 1.0 References: <1623294161-7917-1-git-send-email-zheyuma97@gmail.com> <20210701223407.GA104070@bjorn-Precision-5520> In-Reply-To: <20210701223407.GA104070@bjorn-Precision-5520> From: Zheyu Ma Date: Mon, 5 Jul 2021 13:13:42 +0800 Message-ID: Subject: Re: [PATCH] PCI: hotplug: set 'thread_finished' flag to be true by default To: Bjorn Helgaas Cc: scott@spiteful.org, Bjorn Helgaas , linux-pci@vger.kernel.org, Linux Kernel Mailing List , Tong Zhang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 2, 2021 at 6:34 AM Bjorn Helgaas wrote: > > [+cc Tong] > > On Thu, Jun 10, 2021 at 03:02:41AM +0000, Zheyu Ma wrote: > > In the process of probing the driver 'cpcihp_zt5550', function > > 'pci_get_device' may fail, at this time 'cpci_hp_unregister_controller' > > will be called. Since the default value of 'thread_finished' is 0, > > 'cpci_stop_thread' will be executed, but at this time 'cpci_thread' has > > not been allocated, which leads to a null pointer dereference. > > This looks like the same problem Tong reported here: > > https://lore.kernel.org/r/20210321055109.322496-1-ztong0001@gmail.com > > I responded to Tong in that thread, and my response to this patch is > basically the same: I think "thread_finished" is a hack and we can do > better. OK, I will reconsider the patch and send the next version to you. > > Fix this by set 'thread_finished' to be true by default. > > > > This log reveals it: > > It's good to have the essential details from the log, but most of this > is not relevant to the problem and should be omitted. Thanks for your advice, I will delete it in the next patch. Regards, Zheyu Ma