r1255 - in trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian: . patches

Christoph Hellwig hch-guest@haydn.debian.org
Thu, 19 Aug 2004 09:11:00 -0600


Author: hch-guest
Date: 2004-08-19 09:10:47 -0600 (Thu, 19 Aug 2004)
New Revision: 1255

Added:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/net-sched-fix.dpatch
Modified:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-3
Log:

  * Add qdisc crash fix (Christoph Hellwig).



Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2004-08-19 13:52:04 UTC (rev 1254)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2004-08-19 15:10:47 UTC (rev 1255)
@@ -15,6 +15,8 @@
   * Fix early boot crash on some oldworld Power Macs. (closes: #266731)
     (Christoph Hellwig).
 
+  * Add qdisc crash fix (Christoph Hellwig).
+
  -- Andres Salomon <dilinger@voxel.net>  Wed, 18 Aug 2004 02:13:56 -0400
 
 kernel-source-2.6.8 (2.6.8-2) unstable; urgency=high

Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-3
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-3	2004-08-19 13:52:04 UTC (rev 1254)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/00list-3	2004-08-19 15:10:47 UTC (rev 1255)
@@ -36,3 +36,4 @@
 scsi-blacklist
 acpi-osname
 pmac-no-of-stdout
+net-sched-fix

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/net-sched-fix.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/net-sched-fix.dpatch	2004-08-19 13:52:04 UTC (rev 1254)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/net-sched-fix.dpatch	2004-08-19 15:10:47 UTC (rev 1255)
@@ -0,0 +1,82 @@
+#! /bin/sh -e 
+## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Description: Fix crash in qdisc code
+## DP: Patch author: David S. Miller <davem@redhat.com>
+## DP: Upstream status: submitted
+
+. $(dirname $0)/DPATCH
+
+@DPATCH@
+# This is a BitKeeper generated diff -Nru style patch.
+#
+# ChangeSet
+#   2004/08/15 19:33:16-07:00 kaber@trash.net 
+#   [PKT_SCHED]: cacheline-align qdisc data in qdisc_create()
+#   
+#   Signed-off-by: Patrick McHardy <kaber@trash.net>
+#   Signed-off-by: David S. Miller <davem@redhat.com>
+# 
+# net/sched/sch_api.c
+#   2004/08/15 19:32:59-07:00 kaber@trash.net +13 -8
+#   [PKT_SCHED]: cacheline-align qdisc data in qdisc_create()
+#   
+#   Signed-off-by: Patrick McHardy <kaber@trash.net>
+#   Signed-off-by: David S. Miller <davem@redhat.com>
+# 
+diff -Nru a/net/sched/sch_api.c b/net/sched/sch_api.c
+--- a/net/sched/sch_api.c	2004-08-19 07:33:10 -07:00
++++ b/net/sched/sch_api.c	2004-08-19 07:33:10 -07:00
+@@ -389,7 +389,8 @@
+ {
+ 	int err;
+ 	struct rtattr *kind = tca[TCA_KIND-1];
+-	struct Qdisc *sch = NULL;
++	void *p = NULL;
++	struct Qdisc *sch;
+ 	struct Qdisc_ops *ops;
+ 	int size;
+ 
+@@ -407,12 +408,18 @@
+ 	if (ops == NULL)
+ 		goto err_out;
+ 
+-	size = sizeof(*sch) + ops->priv_size;
++	/* ensure that the Qdisc and the private data are 32-byte aligned */
++	size = ((sizeof(*sch) + QDISC_ALIGN_CONST) & ~QDISC_ALIGN_CONST);
++	size += ops->priv_size + QDISC_ALIGN_CONST;
+ 
+-	sch = kmalloc(size, GFP_KERNEL);
++	p = kmalloc(size, GFP_KERNEL);
+ 	err = -ENOBUFS;
+-	if (!sch)
++	if (!p)
+ 		goto err_out;
++	memset(p, 0, size);
++	sch = (struct Qdisc *)(((unsigned long)p + QDISC_ALIGN_CONST)
++	                       & ~QDISC_ALIGN_CONST);
++	sch->padded = (char *)sch - (char *)p;
+ 
+ 	/* Grrr... Resolve race condition with module unload */
+ 
+@@ -420,8 +427,6 @@
+ 	if (ops != qdisc_lookup_ops(kind))
+ 		goto err_out;
+ 
+-	memset(sch, 0, size);
+-
+ 	INIT_LIST_HEAD(&sch->list);
+ 	skb_queue_head_init(&sch->q);
+ 
+@@ -470,8 +475,8 @@
+ 
+ err_out:
+ 	*errp = err;
+-	if (sch)
+-		kfree(sch);
++	if (p)
++		kfree(p);
+ 	return NULL;
+ }
+