ipw driver and linux-2.6.10-gentoo-r6

nicroets

Senior Member
Joined
Apr 14, 2004
Messages
824
Reaction score
334
Location
Tbilisi, Georgia
I've had to modify the driver a little bit to get it working with the 2.6.10 kernel :
Code:
diff -rub /root/ipw-0.2/ipw.c ipw/ipw.c
--- /root/ipw-0.2/ipw.c 2004-03-29 02:43:22.000000000 +0200
+++ ipw/ipw.c   2005-03-01 18:15:53.323645840 +0200
@@ -117,7 +117,7 @@
 /* local function prototypes */
 static int  ipw_open           (struct tty_struct *tty, struct file *filp);
 static void ipw_close          (struct tty_struct *tty, struct file *filp);
-static int  ipw_write          (struct tty_struct *tty, int from_user, const uns
+static int  ipw_write          (struct tty_struct *tty, const unsigned char *buf
 static int  ipw_write_room     (struct tty_struct *tty);
 static int  ipw_chars_in_buffer        (struct tty_struct *tty);
 static void ipw_throttle               (struct tty_struct *tty);
@@ -532,7 +532,7 @@
 }
 
 
-static int ipw_write (struct tty_struct * tty, int from_user, const unsigned cha
+static int ipw_write (struct tty_struct * tty, const unsigned char *buf, int cou
 {
        struct usb_ipw *ipw;
        unsigned char *data;
@@ -540,8 +540,8 @@
        int ret,new_len,data_len;
        unsigned long flags = 0;
 
-       dbg( "ipw_write: TOP: count=%d, from_user=%d, in_interrupt=%ld",
-                        count, from_user, in_interrupt() );
+       dbg( "ipw_write: TOP: count=%d, in_interrupt=%ld",
+                        count, in_interrupt() );
 
 
        ipw = get_ipw_by_index (tty->index);
@@ -570,9 +570,6 @@
        /* copy user data (which can sleep) before getting spin lock */
        count = min( count, ipw->bulk_out_buffer_size );
        count = min( 64, count);
-       if( from_user && copy_from_user( user_buf, buf, count ) ) {
-               return( -EFAULT );
-       }
 
        dbg("%s count now:%d", __FUNCTION__,count);
        
@@ -586,7 +583,7 @@
                /* buffer data if count is 1 (probably put_char) if possible */
                if( count == 1 && ipw->bulk_out_buffer_len < ipw->bulk_out_buffer
                        ipw->bulk_out_buffer[ipw->bulk_out_buffer_len++]
-                               = *(from_user ? user_buf : buf);
+                               = *(buf);
                        new_len = 1;
                } else {
                        new_len = 0;
@@ -613,7 +610,7 @@
        data += ipw->bulk_out_buffer_len;
 
        /* copy in new data */
-       memcpy( data, from_user ? user_buf : buf, new_len );
+       memcpy( data, buf, new_len );
 
        /* build up our urb */
        usb_fill_bulk_urb(ipw->write_urb, ipw->dev, 
@@ -1030,7 +1027,7 @@
 
        for (minor = 0; minor < IPW_TTY_MINORS && ipw_table[minor]; ++minor)
                ;
-       if (ipw_table[minor]) {
+       if (minor >= IPW_TTY_MINORS) {
                err("No more free IPWireless devices");
                return -ENODEV;
        }
@@ -1049,6 +1046,7 @@
 
        ipw->rx_task.func = ipw_rx_tasklet;
        ipw->rx_task.data = (unsigned long) ipw;
+       spin_lock_init (&ipw->lock);
 
 
        /* record the interface number for the control out */
 
Thanks for the fix Nic. The copy_from_user stuff seems to have disappeared from the TTY layer due to a security concern, and I knew I'd forgotten to init a spinlock somewhere. Just hadn't been much bothered with it.

Cheers.
 
Top
Sign up to the MyBroadband newsletter
X