The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear 
at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.7
------>
commit 682edc8fe66b5d4c91dfc3823f7e25337faae94c
Author: Jacob Keller <[email protected]>
Date:   Tue Nov 10 17:44:22 2015 +0400

    ms/ixgbe: fix use of list_for_each in ixgbe_enumerate_functions
    
    Fix a bug in the misuse of the list_for_each macro to loop over every
    entry in the bus_list. Instead of attempting to loop over the list from
    a random entry point, go up to the bus and use the real list_head entry
    point. This prevents the possible read or write of unallocated or
    incorrectly addressed memory.
    
    Signed-off-by: Jacob Keller <[email protected]>
    Tested-by: Phil Schmitt <[email protected]>
    Signed-off-by: Jeff Kirsher <[email protected]>
    
    https://jira.sw.ru/browse/PSBM-41133
    
    (cherry picked from commit 8818970d8d361e358dd61e5d5774e67794cde791)
    Signed-off-by: Andrey Ryabinin <[email protected]>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 9fe8787..c83cf98 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7525,23 +7525,20 @@ static const struct net_device_ops ixgbe_netdev_ops = {
  **/
 static inline int ixgbe_enumerate_functions(struct ixgbe_adapter *adapter)
 {
-       struct list_head *entry;
+       struct pci_dev *entry;
        int physfns = 0;
 
        /* Some cards can not use the generic count PCIe functions method,
         * because they are behind a parent switch, so we hardcode these with
         * the correct number of functions.
         */
-       if (ixgbe_pcie_from_parent(&adapter->hw)) {
+       if (ixgbe_pcie_from_parent(&adapter->hw))
                physfns = 4;
-       } else {
-               list_for_each(entry, &adapter->pdev->bus_list) {
-                       struct pci_dev *pdev =
-                               list_entry(entry, struct pci_dev, bus_list);
-                       /* don't count virtual functions */
-                       if (!pdev->is_virtfn)
-                               physfns++;
-               }
+
+       list_for_each_entry(entry, &adapter->pdev->bus->devices, bus_list) {
+               /* don't count virtual functions */
+               if (!entry->is_virtfn)
+                       physfns++;
        }
 
        return physfns;
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to