Re: [PATCH] PCI: hotplug: set 'thread_finished' flag to be true by default
From: Zheyu Ma
Date: Mon Jul 05 2021 - 01:13:57 EST
On Fri, Jul 2, 2021 at 6:34 AM Bjorn Helgaas <helgaas@xxxxxxxxxx> 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@xxxxxxxxx
>
> 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