All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc
@ 2016-04-07 15:21 Jacob Keller
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names Jacob Keller
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Jacob Keller @ 2016-04-07 15:21 UTC (permalink / raw)
  To: intel-wired-lan

When writing a new default redirection table, we needed to populate
a new RSS table using ethtool_rxfh_indir_default. We populated this
table into a region of memory allocated using kcalloc, but never checked
this for NULL. Fix this by moving the default table generation into
fm10k_write_reta. If this function is passed a table, use it. Otherwise,
generate the default table using ethtool_rxfh_indir_default, 4 at at
time.

Fixes: 0ea7fae44094 ("fm10k: use ethtool_rxfh_indir_default for default redirection table", 2016-02-16)
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---

Notes:
    Testing-hints:
      This is a very unlikely memory failure, but you should test changing the
      number of queues, and the RSS table and make sure it behaves as expected.

 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 26 ++++++++++++++++++------
 drivers/net/ethernet/intel/fm10k/fm10k_main.c    | 14 ++-----------
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 27991348b659..24700a8026ed 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -970,15 +970,29 @@ u32 fm10k_get_reta_size(struct net_device __always_unused *netdev)
 
 void fm10k_write_reta(struct fm10k_intfc *interface, const u32 *indir)
 {
+	u16 rss_i = interface->ring_feature[RING_F_RSS].indices;
 	struct fm10k_hw *hw = &interface->hw;
-	int i;
+	u32 table[4];
+	int i, j;
 
 	/* record entries to reta table */
-	for (i = 0; i < FM10K_RETA_SIZE; i++, indir += 4) {
-		u32 reta = indir[0] |
-			   (indir[1] << 8) |
-			   (indir[2] << 16) |
-			   (indir[3] << 24);
+	for (i = 0; i < FM10K_RETA_SIZE; i++) {
+		u32 reta, n;
+
+		/* generate a new table if we weren't given one */
+		for (j = 0; j < 4; j++) {
+			if (indir)
+				n = indir[i + j];
+			else
+				n = ethtool_rxfh_indir_default(i + j, rss_i);
+
+			table[j] = n;
+		}
+
+		reta = table[0] |
+			(table[1] << 8) |
+			(table[2] << 16) |
+			(table[3] << 24);
 
 		if (interface->reta[i] == reta)
 			continue;
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index 58092e523bbe..aca3e4762da7 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1927,8 +1927,7 @@ static void fm10k_assign_rings(struct fm10k_intfc *interface)
 static void fm10k_init_reta(struct fm10k_intfc *interface)
 {
 	u16 i, rss_i = interface->ring_feature[RING_F_RSS].indices;
-	struct net_device *netdev = interface->netdev;
-	u32 reta, *indir;
+	u32 reta;
 
 	/* If the Rx flow indirection table has been configured manually, we
 	 * need to maintain it when possible.
@@ -1953,16 +1952,7 @@ static void fm10k_init_reta(struct fm10k_intfc *interface)
 	}
 
 repopulate_reta:
-	indir = kcalloc(fm10k_get_reta_size(netdev),
-			sizeof(indir[0]), GFP_KERNEL);
-
-	/* generate redirection table using the default kernel policy */
-	for (i = 0; i < fm10k_get_reta_size(netdev); i++)
-		indir[i] = ethtool_rxfh_indir_default(i, rss_i);
-
-	fm10k_write_reta(interface, indir);
-
-	kfree(indir);
+	fm10k_write_reta(interface, NULL);
 }
 
 /**
-- 
2.8.1.102.ga49ec4a


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names
  2016-04-07 15:21 [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Jacob Keller
@ 2016-04-07 15:21 ` Jacob Keller
  2016-04-13 22:41   ` Singh, Krishneil K
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 3/4] fm10k: fix fm10k_add_ethtool_stats to zero memory Jacob Keller
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Jacob Keller @ 2016-04-07 15:21 UTC (permalink / raw)
  To: intel-wired-lan

Update every header file and other locations to consistently use
Intel(R) instead of just Intel. Also update copyright year of files
which we modified.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---

Notes:
    Testing-hints:
      Ensure all the uses of driver summary are the same.

 drivers/net/ethernet/intel/fm10k/Makefile        | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k.h         | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_common.c  | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_common.h  | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c   | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_iov.c     | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_main.c    | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.c     | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_mbx.h     | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c  | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_pci.c     | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_pf.c      | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_pf.h      | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_tlv.c     | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_tlv.h     | 4 ++--
 drivers/net/ethernet/intel/fm10k/fm10k_type.h    | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c      | 2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_vf.h      | 2 +-
 20 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/Makefile b/drivers/net/ethernet/intel/fm10k/Makefile
index 2aeaa39d9a25..cac645329cea 100644
--- a/drivers/net/ethernet/intel/fm10k/Makefile
+++ b/drivers/net/ethernet/intel/fm10k/Makefile
@@ -1,6 +1,6 @@
 ################################################################################
 #
-# Intel Ethernet Switch Host Interface Driver
+# Intel(R) Ethernet Switch Host Interface Driver
 # Copyright(c) 2013 - 2016 Intel Corporation.
 #
 # This program is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
 ################################################################################
 
 #
-# Makefile for the Intel(R) FM10000 Ethernet Switch Host Interface driver
+# Makefile for the Intel(R) Ethernet Switch Host Interface Driver
 #
 
 obj-$(CONFIG_FM10K) += fm10k.o
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 5efae40698cc..fcf106e545c5 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_common.c b/drivers/net/ethernet/intel/fm10k/fm10k_common.c
index 6cfae6ac04ea..5bbf19cfe29b 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_common.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_common.c
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2014 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_common.h b/drivers/net/ethernet/intel/fm10k/fm10k_common.h
index 45e4e5b1f20a..50f71e997448 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_common.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_common.h
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2014 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c b/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
index 2be4361839db..db4bd8bf9722 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_dcbnl.c
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2015 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c b/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c
index 5d6137faf7d1..5116fd043630 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2015 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index 24700a8026ed..b4870b8ad0bd 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
index bbf7c4bac303..47f0743ec03b 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_iov.c
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2015 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index aca3e4762da7..b875f4243667 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@ const char fm10k_driver_version[] = DRV_VERSION;
 char fm10k_driver_name[] = "fm10k";
 static const char fm10k_driver_string[] = DRV_SUMMARY;
 static const char fm10k_copyright[] =
-	"Copyright (c) 2013 Intel Corporation.";
+	"Copyright (c) 2013 - 2016 Intel Corporation.";
 
 MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>");
 MODULE_DESCRIPTION(DRV_SUMMARY);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
index 98202c3d591c..c9dfa6564fcf 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.c
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2015 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.h b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.h
index 245a0a3dc32e..b7dbc8a84c05 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_mbx.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_mbx.h
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2015 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index bf229d54c20c..2a08d3f5b6df 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 1d833782d917..404f47ae14b6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
index 2105cb8d31cc..5b0ceec361e6 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.c
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pf.h b/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
index d4a34657b861..3336d3c10760 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pf.h
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
index 6b500a6378e0..f8e87bf086b9 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.c
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h
index e1845e0a17d8..a1f1027fe184 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_tlv.h
@@ -1,5 +1,5 @@
-/* Intel Ethernet Switch Host Interface Driver
- * Copyright(c) 2013 - 2015 Intel Corporation.
+/* Intel(R) Ethernet Switch Host Interface Driver
+ * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_type.h b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
index f3f37a49806e..b8bc06183720 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_type.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
index 0440706eeb82..3b06685ea63b 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.h b/drivers/net/ethernet/intel/fm10k/fm10k_vf.h
index f0932f944793..2662f33c0c71 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.h
@@ -1,4 +1,4 @@
-/* Intel Ethernet Switch Host Interface Driver
+/* Intel(R) Ethernet Switch Host Interface Driver
  * Copyright(c) 2013 - 2016 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
-- 
2.8.1.102.ga49ec4a


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH v1 3/4] fm10k: fix fm10k_add_ethtool_stats to zero memory
  2016-04-07 15:21 [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Jacob Keller
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names Jacob Keller
@ 2016-04-07 15:21 ` Jacob Keller
  2016-04-13 22:42   ` Singh, Krishneil K
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 4/4] fm10k: fix incorrect IPv6 extended header checksum Jacob Keller
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Jacob Keller @ 2016-04-07 15:21 UTC (permalink / raw)
  To: intel-wired-lan

The ethtool API does not guarantee zero'd memory, so we need to zero the
stats we skip instead of just skipping them.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---

Notes:
    Testing-hints:
      Ensure that the queue stats don't show random memory values, but always zero
      if they are unused.
    
    Unfortunately, somehow Dave Miller pulled an incorrect version of the original
    for this patch, so this is a follow-on fixup which brings back the bug fix.

 drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
index b4870b8ad0bd..9c0d87503977 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c
@@ -243,9 +243,10 @@ static void fm10k_add_ethtool_stats(u64 **data, void *pointer,
 	unsigned int i;
 	char *p;
 
-	/* simply skip forward if we were not given a valid pointer */
 	if (!pointer) {
-		*data += size;
+		/* memory is not zero allocated so we have to clear it */
+		for (i = 0; i < size; i++)
+			*((*data)++) = 0;
 		return;
 	}
 
-- 
2.8.1.102.ga49ec4a


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH v1 4/4] fm10k: fix incorrect IPv6 extended header checksum
  2016-04-07 15:21 [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Jacob Keller
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names Jacob Keller
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 3/4] fm10k: fix fm10k_add_ethtool_stats to zero memory Jacob Keller
@ 2016-04-07 15:21 ` Jacob Keller
  2016-04-15 22:20 ` [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Keller, Jacob E
  2016-05-31 18:11 ` Singh, Krishneil K
  4 siblings, 0 replies; 8+ messages in thread
From: Jacob Keller @ 2016-04-07 15:21 UTC (permalink / raw)
  To: intel-wired-lan

From: Bruce Allan <bruce.w.allan@intel.com>

Check for and handle IPv6 extended headers so that tx checksum offload
can be done. Also use skb_checksum_help for unexpected cases.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---

Notes:
    Testing-hints:
      Use the testing tool ipv6-exth program supplied by Mark Rustad to verify that
      ipv6 packets with extended headers get proper checksums. When using tcpdump,
      ensure that you only check receive traffic on the link partner, as tcpdump
      will report checksum errors for transmitted traffic if Tx checksum offloads
      are enabled.

 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index b875f4243667..0e166e9c90c8 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -820,6 +820,8 @@ static void fm10k_tx_csum(struct fm10k_ring *tx_ring,
 		struct ipv6hdr *ipv6;
 		u8 *raw;
 	} network_hdr;
+	u8 *transport_hdr;
+	__be16 frag_off;
 	__be16 protocol;
 	u8 l4_hdr = 0;
 
@@ -837,9 +839,11 @@ static void fm10k_tx_csum(struct fm10k_ring *tx_ring,
 			goto no_csum;
 		}
 		network_hdr.raw = skb_inner_network_header(skb);
+		transport_hdr = skb_inner_transport_header(skb);
 	} else {
 		protocol = vlan_get_protocol(skb);
 		network_hdr.raw = skb_network_header(skb);
+		transport_hdr = skb_transport_header(skb);
 	}
 
 	switch (protocol) {
@@ -848,15 +852,17 @@ static void fm10k_tx_csum(struct fm10k_ring *tx_ring,
 		break;
 	case htons(ETH_P_IPV6):
 		l4_hdr = network_hdr.ipv6->nexthdr;
+		if (likely((transport_hdr - network_hdr.raw) ==
+			   sizeof(struct ipv6hdr)))
+			break;
+		ipv6_skip_exthdr(skb, network_hdr.raw - skb->data +
+				      sizeof(struct ipv6hdr),
+				 &l4_hdr, &frag_off);
+		if (unlikely(frag_off))
+			l4_hdr = NEXTHDR_FRAGMENT;
 		break;
 	default:
-		if (unlikely(net_ratelimit())) {
-			dev_warn(tx_ring->dev,
-				 "partial checksum but ip version=%x!\n",
-				 protocol);
-		}
-		tx_ring->tx_stats.csum_err++;
-		goto no_csum;
+		break;
 	}
 
 	switch (l4_hdr) {
@@ -869,9 +875,10 @@ static void fm10k_tx_csum(struct fm10k_ring *tx_ring,
 	default:
 		if (unlikely(net_ratelimit())) {
 			dev_warn(tx_ring->dev,
-				 "partial checksum but l4 proto=%x!\n",
-				 l4_hdr);
+				 "partial checksum, version=%d l4 proto=%x\n",
+				 protocol, l4_hdr);
 		}
+		skb_checksum_help(skb);
 		tx_ring->tx_stats.csum_err++;
 		goto no_csum;
 	}
-- 
2.8.1.102.ga49ec4a


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names Jacob Keller
@ 2016-04-13 22:41   ` Singh, Krishneil K
  0 siblings, 0 replies; 8+ messages in thread
From: Singh, Krishneil K @ 2016-04-13 22:41 UTC (permalink / raw)
  To: intel-wired-lan


-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Thursday, April 7, 2016 8:21 AM
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Subject: [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names

Update every header file and other locations to consistently use
Intel(R) instead of just Intel. Also update copyright year of files which we modified.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---

Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH v1 3/4] fm10k: fix fm10k_add_ethtool_stats to zero memory
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 3/4] fm10k: fix fm10k_add_ethtool_stats to zero memory Jacob Keller
@ 2016-04-13 22:42   ` Singh, Krishneil K
  0 siblings, 0 replies; 8+ messages in thread
From: Singh, Krishneil K @ 2016-04-13 22:42 UTC (permalink / raw)
  To: intel-wired-lan


-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Thursday, April 7, 2016 8:21 AM
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Subject: [Intel-wired-lan] [PATCH v1 3/4] fm10k: fix fm10k_add_ethtool_stats to zero memory

The ethtool API does not guarantee zero'd memory, so we need to zero the stats we skip instead of just skipping them.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---


Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc
  2016-04-07 15:21 [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Jacob Keller
                   ` (2 preceding siblings ...)
  2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 4/4] fm10k: fix incorrect IPv6 extended header checksum Jacob Keller
@ 2016-04-15 22:20 ` Keller, Jacob E
  2016-05-31 18:11 ` Singh, Krishneil K
  4 siblings, 0 replies; 8+ messages in thread
From: Keller, Jacob E @ 2016-04-15 22:20 UTC (permalink / raw)
  To: intel-wired-lan

On Thu, 2016-04-07 at 08:21 -0700, Jacob Keller wrote:
> When writing a new default redirection table, we needed to populate
> a new RSS table using ethtool_rxfh_indir_default. We populated this
> table into a region of memory allocated using kcalloc, but never
> checked
> this for NULL. Fix this by moving the default table generation into
> fm10k_write_reta. If this function is passed a table, use it.
> Otherwise,
> generate the default table using ethtool_rxfh_indir_default, 4 at at
> time.
> 
> Fixes: 0ea7fae44094 ("fm10k: use ethtool_rxfh_indir_default for
> default redirection table", 2016-02-16)
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---


Jeff,

This patch has an issue I will be sending a reworked version, so please
drop this from the queue and don't submit it to net-next yet.

Thanks Krishniel for finding the issue!

Thanks,
Jake

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc
  2016-04-07 15:21 [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Jacob Keller
                   ` (3 preceding siblings ...)
  2016-04-15 22:20 ` [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Keller, Jacob E
@ 2016-05-31 18:11 ` Singh, Krishneil K
  4 siblings, 0 replies; 8+ messages in thread
From: Singh, Krishneil K @ 2016-05-31 18:11 UTC (permalink / raw)
  To: intel-wired-lan


-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Jacob Keller
Sent: Thursday, April 7, 2016 8:21 AM
To: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>
Subject: [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc

When writing a new default redirection table, we needed to populate a new RSS table using ethtool_rxfh_indir_default. We populated this table into a region of memory allocated using kcalloc, but never checked this for NULL. Fix this by moving the default table generation into fm10k_write_reta. If this function is passed a table, use it. Otherwise, generate the default table using ethtool_rxfh_indir_default, 4 at at time.

Fixes: 0ea7fae44094 ("fm10k: use ethtool_rxfh_indir_default for default redirection table", 2016-02-16)
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
---

Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-05-31 18:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-07 15:21 [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Jacob Keller
2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 2/4] fm10k: consistently use Intel(R) for driver names Jacob Keller
2016-04-13 22:41   ` Singh, Krishneil K
2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 3/4] fm10k: fix fm10k_add_ethtool_stats to zero memory Jacob Keller
2016-04-13 22:42   ` Singh, Krishneil K
2016-04-07 15:21 ` [Intel-wired-lan] [PATCH v1 4/4] fm10k: fix incorrect IPv6 extended header checksum Jacob Keller
2016-04-15 22:20 ` [Intel-wired-lan] [PATCH v1 1/4] fm10k: fix possible null pointer deref after kcalloc Keller, Jacob E
2016-05-31 18:11 ` Singh, Krishneil K

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.