[ewg] [PATCH] kernel_fixes: import a patch to fix bugzilla 1664

Moni Shoua monis at Voltaire.COM
Wed Sep 23 07:57:17 PDT 2009


Add commit 5e47596bee12597824a3b5b21e20f80b61e58a35 to kernel fixes.
This will fix https://bugs.openfabrics.org/show_bug.cgi?id=1664.

Signed-off-by: Moni Shoua <monis at voltaire.com>
---
 kernel_patches/fixes/ipoib_0550_check_multicast_address_format.patch |   51 ++++++++++
 1 file changed, 51 insertions(+)

diff --git a/kernel_patches/fixes/ipoib_0550_check_multicast_address_format.patch b/kernel_patches/fixes/ipoib_0550_check_multicast_address_format.patch
new file mode 100644
index 0000000..a98e591
--- /dev/null
+++ b/kernel_patches/fixes/ipoib_0550_check_multicast_address_format.patch
@@ -0,0 +1,51 @@
+commit 5e47596bee12597824a3b5b21e20f80b61e58a35
+Author: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
+Date:   Sat Sep 5 20:23:40 2009 -0700
+
+    IPoIB: Check multicast address format
+    
+    Check that the format of multicast link addresses is correct before
+    taking them from dev->mc_list to priv->multicast_list.  This way we
+    never try to send a bogus address to the SA, which prevents badness
+    from erronous 'ip maddr addr add', broken bonding drivers, etc.
+    
+    Signed-off-by: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
+    Signed-off-by: Roland Dreier <rolandd at cisco.com>
+
+diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+index a0825fe..25874fc 100644
+--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+@@ -760,6 +760,20 @@ void ipoib_mcast_dev_flush(struct net_device *dev)
+ 	}
+ }
+ 
++static int ipoib_mcast_addr_is_valid(const u8 *addr, unsigned int addrlen,
++				     const u8 *broadcast)
++{
++	if (addrlen != INFINIBAND_ALEN)
++		return 0;
++	/* reserved QPN, prefix, scope */
++	if (memcmp(addr, broadcast, 6))
++		return 0;
++	/* signature lower, pkey */
++	if (memcmp(addr + 7, broadcast + 7, 3))
++		return 0;
++	return 1;
++}
++
+ void ipoib_mcast_restart_task(struct work_struct *work)
+ {
+ 	struct ipoib_dev_priv *priv =
+@@ -793,6 +807,11 @@ void ipoib_mcast_restart_task(struct work_struct *work)
+ 	for (mclist = dev->mc_list; mclist; mclist = mclist->next) {
+ 		union ib_gid mgid;
+ 
++		if (!ipoib_mcast_addr_is_valid(mclist->dmi_addr,
++					       mclist->dmi_addrlen,
++					       dev->broadcast))
++			continue;
++
+ 		memcpy(mgid.raw, mclist->dmi_addr + 4, sizeof mgid);
+ 
+ 		mcast = __ipoib_mcast_find(dev, &mgid);



More information about the ewg mailing list