pci-v6.13-fixes-3

-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAmeGsZYUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vwu6RAAreLLwBLB0bb2nHoGTL0OjfG+u9PU
 2lDkRD1A6g53YHMRLo67qC6TKD6+9e5N5xCxO+VjLBzE/KbPuD8cIacV+oYCv7r+
 BlIkQUnmmEOIrcO4wc+DuH3cYpRCDGerp8L8TI/+bkuVzGoc0nvSOuvfe++hqbDP
 fkt5jcFUSN5NYmXQmfe5bdh41YC/uHAUw0+PpP+bt1ygdG4jfsMXbUOE7NVUa79Y
 Ovg+SSrUKdnTtKJqjIkpvapZkeXl4Pn4vcxiIo1AX+KfMYpNX0CYm2ByN5UIICa7
 S0KE4Ac4Di7qg9jhFTTp8180sbgIxo6XCbIszRDyDvWJpVWFdZB5L1BNeZHgIDut
 4JsDXCH0u75IdmLLwK2yTWbNaQSYUQcZfuMLybjso7sMUGnubjQT7e4k5qvEsWZj
 pY+uCByowDMh8gkrkdSsGwf8pPX/4ka/bKgNyAstOkkXERHMV5NPWv7Ex0zfwjK6
 9QsJ8Wjfn0d3HqkHd+rD2cQWNYm2a3N5MhGZLK7vUQYulLa6MSwxEEjG4cv+E+aI
 T+MdhtX8mes45xfxzgMMY7JJBMEp3M9TQM6DjgtrWdig7sGDB93oNK2aCeg1zqvB
 Fvsn+izJCs2Ocks6+BWCIEaDYPAeTKnmat/7ZaUfLs/uw8nPS9RGE3/0OeiUJeGK
 EvT1mE6DYhVa1cY=
 =e6ty
 -----END PGP SIGNATURE-----

Merge tag 'pci-v6.13-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull pci fix from Bjorn Helgaas:

 - Prevent bwctrl NULL pointer dereference that caused hangs on shutdown
   on ASUS ROG Strix SCAR 17 G733PYV (Lukas Wunner)

* tag 'pci-v6.13-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
  PCI/bwctrl: Fix NULL pointer deref on unbind and bind
This commit is contained in:
Linus Torvalds 2025-01-14 11:32:14 -08:00
commit 7f5b6a8ec1

View File

@ -303,14 +303,17 @@ static int pcie_bwnotif_probe(struct pcie_device *srv)
if (ret)
return ret;
ret = devm_request_irq(&srv->device, srv->irq, pcie_bwnotif_irq,
IRQF_SHARED, "PCIe bwctrl", srv);
if (ret)
return ret;
scoped_guard(rwsem_write, &pcie_bwctrl_setspeed_rwsem) {
scoped_guard(rwsem_write, &pcie_bwctrl_lbms_rwsem) {
port->link_bwctrl = no_free_ptr(data);
port->link_bwctrl = data;
ret = request_irq(srv->irq, pcie_bwnotif_irq,
IRQF_SHARED, "PCIe bwctrl", srv);
if (ret) {
port->link_bwctrl = NULL;
return ret;
}
pcie_bwnotif_enable(srv);
}
}
@ -331,11 +334,15 @@ static void pcie_bwnotif_remove(struct pcie_device *srv)
pcie_cooling_device_unregister(data->cdev);
pcie_bwnotif_disable(srv->port);
scoped_guard(rwsem_write, &pcie_bwctrl_setspeed_rwsem) {
scoped_guard(rwsem_write, &pcie_bwctrl_lbms_rwsem) {
pcie_bwnotif_disable(srv->port);
free_irq(srv->irq, srv);
scoped_guard(rwsem_write, &pcie_bwctrl_setspeed_rwsem)
scoped_guard(rwsem_write, &pcie_bwctrl_lbms_rwsem)
srv->port->link_bwctrl = NULL;
}
}
}
static int pcie_bwnotif_suspend(struct pcie_device *srv)