Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: alcor_pci: fix inverted branch condition

This patch fixes a trivial mistake that I made in the previous attempt
in fixing the null bridge issue. The branch condition is inverted and we
should call alcor_pci_find_cap_offset() only if bridge is not null.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 3ce3e45cc333 ("misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge")
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20210522043725.602179-1-ztong0001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tong Zhang and committed by
Greg Kroah-Hartman
281e4684 78429edf

+1 -1
+1 -1
drivers/misc/cardreader/alcor_pci.c
··· 144 144 * priv->parent_pdev will be NULL. In this case we don't check its 145 145 * capability and disable ASPM completely. 146 146 */ 147 - if (!priv->parent_pdev) 147 + if (priv->parent_pdev) 148 148 priv->parent_cap_off = alcor_pci_find_cap_offset(priv, 149 149 priv->parent_pdev); 150 150