1. 31 Aug, 2017 19 commits
  2. 29 Aug, 2017 18 commits
  3. 28 Aug, 2017 3 commits
    • Okash Khawaja's avatar
      tty: undo export of tty_open_by_driver · a033c3b1
      Okash Khawaja authored
      Since we have tty_kopen, we no longer need to export tty_open_by_driver.
      This patch makes this function static.
      Signed-off-by: default avatarOkash Khawaja <okash.khawaja@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a033c3b1
    • Okash Khawaja's avatar
      staging: speakup: use tty_kopen and tty_kclose · 084a4735
      Okash Khawaja authored
      This patch replaces call to tty_open_by_driver with a tty_kopen and
      uses tty_kclose instead of tty_release_struct to close it.
      Signed-off-by: default avatarOkash Khawaja <okash.khawaja@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      084a4735
    • Okash Khawaja's avatar
      tty: resolve tty contention between kernel and user space · a09ac397
      Okash Khawaja authored
      The commit 12e84c71 ("tty: export tty_open_by_driver") exports
      tty_open_by_device to allow tty to be opened from inside kernel which
      works fine except that it doesn't handle contention with user space or
      another kernel-space open of the same tty. For example, opening a tty
      from user space while it is kernel opened results in failure and a
      kernel log message about mismatch between tty->count and tty's file
      open count.
      
      This patch makes kernel access to tty exclusive, so that if a user
      process or kernel opens a kernel opened tty, it gets -EBUSY. It does
      this by adding TTY_KOPENED flag to tty->flags. When this flag is set,
      tty_open_by_driver returns -EBUSY. Instead of overloading
      tty_open_by_driver for both kernel and user space, this
      patch creates a separate function tty_kopen which closely follows
      tty_open_by_driver. tty_kclose closes the tty opened by tty_kopen.
      
      To address the mismatch between tty->count and #fd's, this patch adds
      #kopen's to the count before comparing it with tty->count. That way
      check_tty_count reflects correct usage count.
      
      Returning -EBUSY on tty open is a change in the interface. I have
      tested this with minicom, picocom and commands like "echo foo >
      /dev/ttyS0". They all correctly report "Device or resource busy" when
      the tty is already kernel opened.
      Signed-off-by: default avatarOkash Khawaja <okash.khawaja@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a09ac397