1. 17 8月, 2012 6 次提交
  2. 16 8月, 2012 1 次提交
    • J
      drivers/tty/moxa.c: fix error return code · 386d95b3
      Julia Lawall 提交于
      Convert a 0 error return code to a negative one, as returned elsewhere in the
      function.
      
      A simplified version of the semantic match that finds this problem is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      identifier ret;
      expression e,e1,e2,e3,e4,x;
      @@
      
      (
      if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
      |
      ret = 0
      )
      ... when != ret = e1
      *x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
      ... when != x = e2
          when != ret = e3
      *if (x == NULL || ...)
      {
        ... when != ret = e4
      *  return ret;
      }
      // </smpl>
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      386d95b3
  3. 15 8月, 2012 1 次提交
  4. 14 8月, 2012 26 次提交
  5. 11 8月, 2012 6 次提交
    • J
      TTY: pass flags to alloc_tty_driver · 7f0bc6a6
      Jiri Slaby 提交于
      We need to allow drivers that use neither tty_port_install nor
      tty_port_register_device to link a tty_port to a tty somehow.  To
      avoid a race with open, this has to be performed before
      tty_register_device. But currently tty_driver->ports is allocated even
      in tty_register_device because we do not know whether this is the PTY
      driver. The PTY driver is special here due to an excessive count of
      lines it declares to handle. We cannot handle tty_ports there this
      way.
      
      To circumvent this, we start passing tty_driver flags to
      alloc_tty_driver already and we create tty_alloc_driver for this
      purpose. There we can allocate tty_driver->ports and do all the magic
      between tty_alloc_driver and tty_register_device. Later we will
      introduce tty_port_link_device function for that purpose.
      
      All drivers should eventually switch to this new tty driver allocation
      interface.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f0bc6a6
    • J
      TTY: tty3270, free tty driver properly · 2312e4f3
      Jiri Slaby 提交于
      On module unload, in tty3270_exit, we forgot to free the tty driver.
      Add there a call to put_tty_driver.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: linux390@de.ibm.com
      Cc: linux-s390@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2312e4f3
    • J
      TTY: ttyprintk, initialize tty_port earlier · 536a3440
      Jiri Slaby 提交于
      After tty_register_driver is called, it is too late to initialize a
      guy with which we operate in open. When a process already called
      open(2) on that node, the structures may be in use uninitialized.
      
      Move the initialization prior to tty_register_driver.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Samo Pogacnik <samo_pogacnik@t-2.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      536a3440
    • J
      TTY: ttyprintk, don't touch behind tty->write_buf · ee8b593a
      Jiri Slaby 提交于
      If a user provides a buffer larger than a tty->write_buf chunk and
      passes '\r' at the end of the buffer, we touch an out-of-bound memory.
      
      Add a check there to prevent this.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: stable@vger.kernel.org (everything maintained past v2.6.37)
      Cc: Samo Pogacnik <samo_pogacnik@t-2.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ee8b593a
    • J
      TTY: ttyprintk, unregister tty driver on failure · f06fb543
      Jiri Slaby 提交于
      When the tty_printk driver fails to create a node in sysfs, the system
      crashes. It is because the driver registers a tty driver and frees it
      without deregistering it first. The fix is easy: add a call to
      tty_unregister_driver to the fail path.
      
      This is very unlikely to happen in usual environment => no need for
      stable.
      
      The crash occurs at some place where we iterate over tty drivers
      first. It may look like this:
      BUG: unable to handle kernel paging request at ffffffffffffff84
      IP: [<ffffffff81278d56>] tty_open+0xd6/0x650
      PGD 1a0d067 PUD 1a0e067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP
      Modules linked in:
      CPU 0
      Pid: 1183, comm: boot.localnet Tainted: G        W    3.5.0-rc7-next-20120716+ #369 Bochs Bochs
      RIP: 0010:[<ffffffff81278d56>]  [<ffffffff81278d56>] tty_open+0xd6/0x650
      RSP: 0018:ffff8800162b3b98  EFLAGS: 00010207
      RAX: 0000000000000000 RBX: ffff880016ba6200 RCX: 0000000000002208
      RDX: 0000000000000000 RSI: 00000000000000d0 RDI: ffffffff81a35080
      RBP: ffff8800162b3c08 R08: ffffffff81276f42 R09: 0000000000400040
      R10: ffff8800161dc005 R11: ffff8800188ee048 R12: 0000000000000000
      R13: ffffffffffffff58 R14: 0000000000400040 R15: 0000000000008000
      FS:  00007f3684abd700(0000) GS:ffff880018e00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: ffffffffffffff84 CR3: 000000001503e000 CR4: 00000000000006f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      Process boot.localnet (pid: 1183, threadinfo ffff8800162b2000, task ffff8800188c5880)
      Stack:
       ffff8800162b3c08 ffffffff81363d63 ffffffff81a62940 ffff8800189b4e88
       ffff8800188c5880 ffffffff81123180 0000000000000000 ffffffff18b20600
       0000000000000000 ffff8800189b4e88 ffff880016ba6200 ffff880018b20600
      Call Trace:
       [<ffffffff81363d63>] ? kobj_lookup+0x103/0x160
       [<ffffffff81123180>] ? mount_fs+0x110/0x110
       [<ffffffff81123a9c>] chrdev_open+0x9c/0x1a0
       [<ffffffff81123a00>] ? cdev_put+0x30/0x30
       [<ffffffff8111de76>] do_dentry_open.isra.19+0x1e6/0x270
       [<ffffffff8111df65>] finish_open+0x65/0xa0
       [<ffffffff8112dc9e>] do_last.isra.52+0x26e/0xd80
       [<ffffffff8112b163>] ? inode_permission+0x13/0x50
       [<ffffffff8112b203>] ? link_path_walk+0x63/0x940
       [<ffffffff8112e85b>] path_openat+0xab/0x3d0
       [<ffffffff8112ef5d>] do_filp_open+0x3d/0xa0
       [<ffffffff8113ba72>] ? alloc_fd+0xd2/0x120
       [<ffffffff8111eee3>] do_sys_open+0xf3/0x1d0
       [<ffffffff8111efdc>] sys_open+0x1c/0x20
       [<ffffffff815b5fe2>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Samo Pogacnik <samo_pogacnik@t-2.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f06fb543
    • J
      mxser: allow overlapping vector · 38daf88a
      Jiri Slaby 提交于
      For many cards, this saves some IO space because interrupt status port
      has precedence over the rest of ports on the card. Hence it can be
      mapped to a hole in I/O ports.
      
      Here we add a kernel parameter which allows that if a user wants to.
      But they need to explicitly enable it by a module parameter.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      38daf88a