ChangeSet 1.1043.1.6, 2003/02/16 09:38:54-08:00, duncan.sands@math.u-psud.fr

[PATCH] USB speedtouch: More infrastructure for new speedtouch send path

Add a new structure, udsl_control.  It will live in the sk_buff cb field,
so check there is room for it and bail out during module init if not.


diff -Nru a/drivers/usb/misc/speedtouch.c b/drivers/usb/misc/speedtouch.c
--- a/drivers/usb/misc/speedtouch.c	Tue Feb 18 16:42:48 2003
+++ b/drivers/usb/misc/speedtouch.c	Tue Feb 18 16:42:48 2003
@@ -141,6 +141,17 @@
 	struct udsl_instance_data *instance;
 };
 
+struct udsl_control {
+	struct atm_skb_data atm_data;
+	unsigned int num_cells;
+	unsigned int num_entire;
+	unsigned char cell_header [ATM_CELL_HEADER];
+	unsigned int pdu_padding;
+	unsigned char aal5_trailer [ATM_AAL5_TRAILER];
+};
+
+#define UDSL_SKB(x)		((struct udsl_control *)(x)->cb)
+
 /*
  * UDSL main driver data
  */
@@ -1064,7 +1075,14 @@
 
 static int __init udsl_usb_init (void)
 {
+	struct sk_buff *skb; /* dummy for sizeof */
+
 	PDEBUG ("udsl_usb_init: driver version " DRIVER_VERSION "\n");
+
+	if (sizeof (struct udsl_control) > sizeof (skb->cb)) {
+		printk (KERN_ERR __FILE__ ": unusable with this kernel!\n");
+		return -EIO;
+	}
 
 	return usb_register (&udsl_usb_driver);
 }