Octavian Purdila wrote: > On Tuesday 08 July 2008, Hinko Kocevar wrote: > > Hi Hinko, > >> >> -MODULE_PARM(ussp_debug, "i"); >> -MODULE_PARM(ussp_set_lowlatency, "i"); >> +//MODULE_PARM(ussp_debug, "i"); >> +//MODULE_PARM(ussp_set_lowlatency, "i"); >> +/* what is wrong with this lines ??? */ >> +//module_parm(ussp_debug, int, 0); >> +//module_parm(ussp_set_lowlatency, int, 0); >> > > Should be module_param(...). > :) > >> break; >> case TIOCSSOFTCAR: >> - if ((rc = verify_area(VERIFY_READ, (void *) arg, >> + /* verify_area() function will go away soon - use >> access_ok() instead */ +/* if ((rc = verify_area(VERIFY_READ, >> (void *) arg, >> sizeof(int))) == 0) { >> get_user(ival, (unsigned int *) arg); >> tty->termios->c_cflag = >> (tty->termios->c_cflag & ~CLOCAL) | >> (ival ? CLOCAL : 0); >> } >> +*/ >> break; > > You can skip the verify_area / access_ok, just use get_user. BTW, why is this > section commented. I'll dump verify_area() - it's commented to make it compile.. > > >> ussp_dprintk (DEBUG_IOCTL, "USSP_READ %d\n", (int)op.len); >> - rc = copy_from_user (port->tty->flip.char_buf_ptr, buf + >> sizeof(struct ussp_operation), op.len); - >> memset(port->tty->flip.flag_buf_ptr, TTY_NORMAL, op.len); - >> port->tty->flip.count += op.len; >> - port->tty->flip.char_buf_ptr += op.len; >> - port->tty->flip.flag_buf_ptr += op.len; >> + buff = kmalloc((int)op.len, GFP_KERNEL); >> +// rc = copy_from_user (port->tty->flip.char_buf_ptr, buf + >> sizeof(struct ussp_operation), op.len); +// >> memset(port->tty->flip.flag_buf_ptr, TTY_NORMAL, op.len); +// >> port->tty->flip.count += op.len; >> +// port->tty->flip.char_buf_ptr += op.len; >> +// port->tty->flip.flag_buf_ptr += op.len; >> + rc = tty_buffer_request_room(port->tty, (int)op.len); >> + if (rc > 0) >> + tty_insert_flip_string(port->tty, buff, >> (int)op.len); + tty_insert_flip_char(port->tty, 0, >> TTY_NORMAL); >> tty_flip_buffer_push (port->tty); >> port->stats.rxcount += op.len; >> + kfree(buff); >> break; > > Check the buff usage, it does not seem right to me. But since I don't have any > context about USSP_READ I can't tell more. I just noticed missing copy_from_user() above. USSP_READ/USSP_WRITE definitions go like this: Write: (kernel -> Userspace) op = USSP_WRITE; len = length of data. data[] holds the data. Read: (Userspace -> kernel) op = USSP_READ; len = length of data. data[] holds the data. Since I can't access internal flip buffer port->tty->flip.char_buf_ptr I used temp buffer (buff) for userspace data before handing it over to the tty layer via tty_insert_flip_string(). > > >> +/* >> + >> ussp_dprintk (DEBUG_OPEN, "current->signal->leader: %d >> current->signal->tty: %d tty->session: %d\n", (int)current->signal->leader, >> (int)current->signal->tty, (int)tty->session); if (current->signal->leader >> && !current->signal->tty && tty->session == 0){ ussp_dprintk (DEBUG_OPEN, >> "setting!\n"); >> @@ -680,7 +704,7 @@ >> tty->session = current->signal->session; >> tty->pgrp = process_group(current); >> } >> - >> +*/ > > I think you can discard this part. Will do. Thanks for your comments. Hinko -- ČETRTA POT, d.o.o., Kranj Planina 3 4000 Kranj Slovenia, Europe Tel. +386 (0) 4 280 66 03 E-mail: hinko.kocevar@xxxxxxxxxxxx Http: www.cetrtapot.si -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ