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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140331031233.GA7593@richard>
Date:	Mon, 31 Mar 2014 11:12:33 +0800
From:	Wei Yang <weiyang@...ux.vnet.ibm.com>
To:	Amir Vadai <amirv@...lanox.com>
Cc:	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	Yevgeny Petrilin <yevgenyp@...lanox.com>,
	Or Gerlitz <ogerlitz@...lanox.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Wei Yang <weiyang@...ux.vnet.ibm.com>
Subject: Re: [PATCH net-next] net/mlx4_core: Handle null return by
 pci_match_id()

Thanks Amir and Bjorn,

I missed this code path, we should take dynids carefully.

On Sun, Mar 30, 2014 at 06:26:55PM +0300, Amir Vadai wrote:
>Fix issue introduced by commit: 97a5221 "net/mlx4_core: pass
>pci_device_id.driver_data to __mlx4_init_one during reset".
>
>pci_match_id() might return NULL if someone binds the driver to a device
>manually using /sys/bus/pci/drivers/.../new_id. Need to check 'id'
>before using it.
>
>Thanks to Bjorn who raised the problem.
>
>CC: Bjorn Helgaas <bhelgaas@...gle.com>
>CC: Wei Yang <weiyang@...ux.vnet.ibm.com>
>Signed-off-by: Amir Vadai <amirv@...lanox.com>
>---
> drivers/net/ethernet/mellanox/mlx4/main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
>index f0ae95f..a2f6623 100644
>--- a/drivers/net/ethernet/mellanox/mlx4/main.c
>+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
>@@ -2759,6 +2759,9 @@ static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev)
> 	int ret;
>
> 	id = pci_match_id(mlx4_pci_table, pdev);
>+	if (!id)
>+		return PCI_ERS_RESULT_DISCONNECT;
>+

So when there is really someone create a new dynamic id for this driver, this
change will fail to reset this device. And actually, in general, driver can
reset it. In my mind, we can't say it is disconnected, since we just not find it.

My suggestion is we find it both in dynamic ids and static ids. Will send a
fix soon.

> 	ret = __mlx4_init_one(pdev, id->driver_data);
>
> 	return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
>-- 
>1.8.3.4

-- 
Richard Yang
Help you, Help me

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ