lkml.org 
[lkml]   [2024]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC 8/9] PCI/pwrctl: add PCI power control core code
On Fri, Feb 2, 2024 at 4:53 AM Bjorn Andersson <andersson@kernel.org> wrote:
>

[snip]

>
> > + break;
> > + case BUS_NOTIFY_BOUND_DRIVER:
> > + pwrctl->link = device_link_add(dev, pwrctl->dev,
> > + DL_FLAG_AUTOREMOVE_CONSUMER);
> > + if (!pwrctl->link)
> > + dev_err(pwrctl->dev, "Failed to add device link\n");
> > + break;
> > + case BUS_NOTIFY_UNBOUND_DRIVER:
> > + device_link_del(pwrctl->link);
>
> This might however become a NULL-pointer dereference, if dev was bound
> to its driver before the pci_pwrctl_notify() was registered for the
> pwrctl and then the PCI device is unbound.
>

Right. And it also makes me think that right after registering with
the notifier, we should iterate over the PCI bus devices and see if
the relevant one is already there.

> This would also happen if device_link_add() failed when the PCI device
> was bound...
>

Right.

Bart

[snip]

\
 
 \ /
  Last update: 2024-05-27 15:02    [W:0.185 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site