* [PATCH] igb: Fix null pointer dereference
@ 2013-03-12 20:09 Alex Williamson
2013-03-13 7:51 ` Jeff Kirsher
0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2013-03-12 20:09 UTC (permalink / raw)
To: gregory.v.rose, jeffrey.t.kirsher; +Cc: netdev, ddutile, linux-kernel, sassmann
The max_vfs= option has always been self limiting to the number of VFs
supported by the device. fa44f2f1 added SR-IOV configuration via
sysfs, but in the process broke this self correction factor. The
failing path is:
igb_probe
igb_sw_init
if (max_vfs > 7) {
adapter->vfs_allocated_count = 7;
...
igb_probe_vfs
igb_enable_sriov(, max_vfs)
if (num_vfs > 7) {
err = -EPERM;
...
This leaves vfs_allocated_count = 7 and vf_data = NULL, so we bomb out
when igb_probe finally calls igb_reset. It seems like a really bad
idea, and somewhat pointless, to set vfs_allocated_count separate from
vf_data, but limiting max_vfs is enough to avoid the null pointer.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index ed79a1c..d5b8289 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -2656,7 +2656,7 @@ static int igb_sw_init(struct igb_adapter *adapter)
if (max_vfs > 7) {
dev_warn(&pdev->dev,
"Maximum of 7 VFs per PF, using max\n");
- adapter->vfs_allocated_count = 7;
+ max_vfs = adapter->vfs_allocated_count = 7;
} else
adapter->vfs_allocated_count = max_vfs;
if (adapter->vfs_allocated_count)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] igb: Fix null pointer dereference
2013-03-12 20:09 [PATCH] igb: Fix null pointer dereference Alex Williamson
@ 2013-03-13 7:51 ` Jeff Kirsher
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Kirsher @ 2013-03-13 7:51 UTC (permalink / raw)
To: Alex Williamson; +Cc: gregory.v.rose, netdev, ddutile, linux-kernel, sassmann
[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]
On Tue, 2013-03-12 at 14:09 -0600, Alex Williamson wrote:
> The max_vfs= option has always been self limiting to the number of VFs
> supported by the device. fa44f2f1 added SR-IOV configuration via
> sysfs, but in the process broke this self correction factor. The
> failing path is:
>
> igb_probe
> igb_sw_init
> if (max_vfs > 7) {
> adapter->vfs_allocated_count = 7;
> ...
> igb_probe_vfs
> igb_enable_sriov(, max_vfs)
> if (num_vfs > 7) {
> err = -EPERM;
> ...
>
> This leaves vfs_allocated_count = 7 and vf_data = NULL, so we bomb out
> when igb_probe finally calls igb_reset. It seems like a really bad
> idea, and somewhat pointless, to set vfs_allocated_count separate from
> vf_data, but limiting max_vfs is enough to avoid the null pointer.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I have added the patch to my igb queue, thanks!
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-13 7:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12 20:09 [PATCH] igb: Fix null pointer dereference Alex Williamson
2013-03-13 7:51 ` Jeff Kirsher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).