Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1629010 > unrolled thread
| Started by | Pan Bian <bianpan201602@163.com> |
|---|---|
| First post | 2017-04-23 14:10 +0200 |
| Last post | 2017-04-24 22:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 1/1] qlcnic: fix unchecked return value Pan Bian <bianpan201602@163.com> - 2017-04-23 14:10 +0200
Re: [PATCH 1/1] qlcnic: fix unchecked return value David Miller <davem@davemloft.net> - 2017-04-24 22:20 +0200
| From | Pan Bian <bianpan201602@163.com> |
|---|---|
| Date | 2017-04-23 14:10 +0200 |
| Subject | [PATCH 1/1] qlcnic: fix unchecked return value |
| Message-ID | <tzouZ-8hB-3@gated-at.bofh.it> |
From: Pan Bian <bianpan2016@163.com> Function pci_find_ext_capability() may return 0, which is an invalid address. In function qlcnic_sriov_virtid_fn(), its return value is used without validation. This may result in invalid memory access bugs. This patch fixes the bug. Signed-off-by: Pan Bian <bianpan2016@163.com> --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index d710705..2f656f3 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c @@ -128,6 +128,8 @@ static int qlcnic_sriov_virtid_fn(struct qlcnic_adapter *adapter, int vf_id) return 0; pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV); + if (!pos) + return 0; pci_read_config_word(dev, pos + PCI_SRIOV_VF_OFFSET, &offset); pci_read_config_word(dev, pos + PCI_SRIOV_VF_STRIDE, &stride); -- 1.9.1
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-04-24 22:20 +0200 |
| Message-ID | <tzSCL-37e-41@gated-at.bofh.it> |
| In reply to | #1629010 |
aFrom: Pan Bian <bianpan201602@163.com> Date: Sun, 23 Apr 2017 20:04:04 +0800 > From: Pan Bian <bianpan2016@163.com> > > Function pci_find_ext_capability() may return 0, which is an invalid > address. In function qlcnic_sriov_virtid_fn(), its return value is used > without validation. This may result in invalid memory access bugs. This > patch fixes the bug. > > Signed-off-by: Pan Bian <bianpan2016@163.com> Applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web