public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Viehmann <tv@beamnet.de>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-usb-devel@lists.sourceforge.net>
Subject: [PATCH] usb-serial: fix oti6858.c segfault in termios handling
Date: Wed, 25 Jul 2007 10:21:21 +0200	[thread overview]
Message-ID: <12789.1185351681.852842@server2.beamnet.de> (raw)

The oti6858 usb serial driver should use 
kernel_termios_to_user_termios/
user_termios_to_kernel_termios to avoid segfaults because the kernel
uses a structure differing from that of user space with a different 
size.

Signed-off-by: Thomas Viehmann <tv@beamnet.de>
---
I'm don't know the least thing about the type casting (it is lifted
from kobil_sct.c), but I do get better success with the patch...
--- linux-2.6.23-rc1/drivers/usb/serial/oti6858.c.orig
+++ linux-2.6.23-rc1/drivers/usb/serial/oti6858.c
@@ -818,19 +818,22 @@

        switch (cmd) {
                case TCGETS:
-                       if (copy_to_user(user_arg, port->tty->termios,
-                                               sizeof(struct 
ktermios))) {
+                       if (kernel_termios_to_user_termios(
+                                            (struct ktermios __user 
*)arg,
+                                            port->tty->termios))
                                return -EFAULT;
-                       }
                        return 0;

                case TCSETS:
                case TCSETSW:                  case TCSETSF:   -      
                  if (copy_from_user(port->tty->termios, user_arg,
-                                               sizeof(struct 
ktermios))) {
+                       if 
(user_termios_to_kernel_termios(port->tty->termios,
+                                               (struct ktermios 
__user *)arg))
                                return -EFAULT;
-                       }
                        oti6858_set_termios(port, NULL);
                        return 0;

--
Thomas Viehmann, http://thomas.viehmann.net/

                 reply	other threads:[~2007-07-25  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12789.1185351681.852842@server2.beamnet.de \
    --to=tv@beamnet.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox