lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f5tby75ifujq2ka3ku76ezuzar4i7ok7a7etygygdpt2k6n4ar@wful3braajua>
Date: Fri, 1 Aug 2025 06:35:19 -0700
From: Breno Leitao <leitao@...ian.org>
To: Bjorn Helgaas <helgaas@...nel.org>, pandoh@...gle.com
Cc: linux-pci@...r.kernel.org, 
	Karolina Stolarek <karolina.stolarek@...cle.com>, Weinan Liu <wnliu@...gle.com>, 
	Martin Petersen <martin.petersen@...cle.com>, Ben Fuller <ben.fuller@...cle.com>, 
	Drew Walton <drewwalton@...rosoft.com>, Anil Agrawal <anilagrawal@...a.com>, 
	Tony Luck <tony.luck@...el.com>, Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>, 
	Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@...ux.intel.com>, Lukas Wunner <lukas@...ner.de>, 
	Jonathan Cameron <Jonathan.Cameron@...wei.com>, Sargun Dhillon <sargun@...a.com>, 
	"Paul E . McKenney" <paulmck@...nel.org>, Mahesh J Salgaonkar <mahesh@...ux.ibm.com>, 
	Oliver O'Halloran <oohall@...il.com>, Kai-Heng Feng <kaihengf@...dia.com>, 
	Keith Busch <kbusch@...nel.org>, Robert Richter <rrichter@....com>, 
	Terry Bowman <terry.bowman@....com>, Shiju Jose <shiju.jose@...wei.com>, 
	Dave Jiang <dave.jiang@...el.com>, linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org, 
	Bjorn Helgaas <bhelgaas@...gle.com>, kernel-team@...a.com, gustavold@...il.com
Subject: Re: [PATCH v8 18/20] PCI/AER: Ratelimit correctable and non-fatal
 error logging

On Fri, Aug 01, 2025 at 06:16:29AM -0700, Breno Leitao wrote:
> Hello Jon, Bjorn,
> 
> On Thu, May 22, 2025 at 06:21:24PM -0500, Bjorn Helgaas wrote:
> > @@ -790,6 +818,9 @@ void pci_print_aer(struct pci_dev *dev, int aer_severity,
> >  	trace_aer_event(pci_name(dev), (status & ~mask),
> >  			aer_severity, tlp_header_valid, &aer->header_log);
> >  
> > +	if (!aer_ratelimit(dev, info.severity))
> > +		return;
> 
> I am seeing a kernel NULL pointer in the aer_ratelimit(), where
> dev->aer_info is NULL. This is happening on linus final 6.16 commit id.

Upon closer examination of the code, it appears we can replicate the
functionality of `pci_dev_aer_stats_incr()`, which is similarly invoked
within this code path.

commit 1b4ef90e8397eaf2bc4d0f8a2127d2d75c7ff5e0
Author: Breno Leitao <leitao@...ian.org>
Date:   Fri Aug 1 06:32:26 2025 -0700

    PCI/AER: Check for NULL aer_info before ratelimiting in pci_print_aer()
    
    Similarly to pci_dev_aer_stats_incr(), pci_print_aer() may be called
    when dev->aer_info is NULL. Add a NULL check before proceeding to avoid
    calling aer_ratelimit() with a NULL aer_info pointer, returning 1, which
    does not rate limit, given this is fatal.
    
    This prevents a kernel crash triggered by dereferencing a NULL pointer
    in aer_ratelimit(), ensuring safer handling of PCI devices that lack
    AER info. This change aligns pci_print_aer() with pci_dev_aer_stats_incr()
    which already performs this NULL check.
    
    Signed-off-by: Breno Leitao <leitao@...ian.org>
    Fixes: a57f2bfb4a5863 ("PCI/AER: Ratelimit correctable and non-fatal
    error logging")

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 70ac661883672..b5f96fde4dcda 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -786,6 +786,9 @@ static void pci_rootport_aer_stats_incr(struct pci_dev *pdev,
 
 static int aer_ratelimit(struct pci_dev *dev, unsigned int severity)
 {
+	if (!dev->aer_info)
+		return 1;
+
 	switch (severity) {
 	case AER_NONFATAL:
 		return __ratelimit(&dev->aer_info->nonfatal_ratelimit);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ