1. 14 8月, 2012 24 次提交
  2. 11 8月, 2012 16 次提交
    • 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
    • J
      misc: pti, use tty_port_register_device · c565ee07
      Jiri Slaby 提交于
      So now we have enough of tty_ports, so we can signal the TTY layer to
      use them by tty_port_register_device.
      
      The upside is that we look like we can introduce tty_port_easy_open
      and put it directly as tty_operations->open to drivers doing nothing
      in open and using tty_port_register_device. Because the easy open can
      obtain a tty_port rather easily from a tty now. Heh, what a nice
      by-product.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c565ee07
    • J
      misc: pti, fix tty_port count · 5bd42000
      Jiri Slaby 提交于
      We now have *one* tty_port for both TTYs. How this was supposed to
      work? Change it to have a tty_port for each of TTYs.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5bd42000
    • J
      misc: pti, fix fail paths · fbf1c247
      Jiri Slaby 提交于
      Fail paths in ->probe and pti_init are incomplete. Fix that by adding
      proper clean-up paths.
      
      Note that we used to leak tty_driver on module unload. This is fixed
      here too.
      
      tty_unregister_driver needs not retval checking, so remove that.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fbf1c247
    • J
      misc: pti, do the opposite of ->probe in ->remove · 3140bae2
      Jiri Slaby 提交于
      Currently, probe initializes some parts. Then, some of them are
      unwound in ->remove, some in module_exit. Let us do the opposite of
      whole ->probe in ->remove.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3140bae2
    • J
      misc: pti, move ->remove to the PCI code · 065185f6
      Jiri Slaby 提交于
      The function is lost somewhere in the forest. Move it to have it along
      with probe and other pci_driver stuff.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      065185f6
    • J
      misc: pti, stop using iomap's unmap on ioremap space · dda3f32c
      Jiri Slaby 提交于
      Ioremap space is different to iomap. ->probe function uses ioremap,
      but ->remove calls pci_iounmap. That one is illegal. Fix that by using
      iounmap.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dda3f32c
    • J
      misc: pti, pci drvdata cannot be NULL in ->remove · c6333cc6
      Jiri Slaby 提交于
      As we set drvdata unconditionally in ->probe, we need not check if it
      is NULL. Let us remove the check.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c6333cc6
    • J
      misc: pti, add const to pci_device_id table · d1568422
      Jiri Slaby 提交于
      It is annotated as __devinitconst. Despite the annotation is useless
      in most cases, const keyword is misssing there. So we are placing
      non-const data into rodata section. Fix that now.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: J Freyensee <james_p_freyensee@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1568422
    • J
      TTY: n_gsm, use tty_port_install · 86176ed9
      Jiri Slaby 提交于
      We need to link a port to a tty in install. And since dlci is
      allocated even in open, we need to create gsmtty_install, allocate
      dlci there and create also the link.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      86176ed9
    • J
      TTY: 68328serial, fix compilation · 3dd332c5
      Jiri Slaby 提交于
      tty_struct->termios is no longer a pointer. This was changed recently
      by "tty: move the termios object into the tty". But 68328serial was
      not changed, so we now have a compilation error:
      68328serial.c: In function 'change_speed':
      68328serial.c:518:22: error: invalid type argument of '->' (have 'struct ktermios')
      68328serial.c: In function 'rs_set_ldisc':
      68328serial.c:620:31: error: invalid type argument of '->' (have 'struct ktermios')
      68328serial.c: In function 'rs_set_termios':
      68328serial.c:988:20: error: invalid type argument of '->' (have 'struct ktermios')
      
      Fix that now.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3dd332c5