1. 31 3月, 2017 1 次提交
  2. 17 3月, 2017 1 次提交
    • J
      tty: serial_core, remove state checks in uart_poll* · 22077b09
      Jiri Slaby 提交于
      Coverity complains about uart_state checks in polling functions. And it
      is indeed correct. We do something like this:
      	struct uart_state *state = drv->state + line;
      	if (!state)
      		return;
      
      Adding 'line' to drv->state would move the potential NULL pointer to
      something near NULL and the check is useless. Even if we checked pure
      drv->state, nothing guarantees it is not freed and NULLed after the
      check. So if the only user of this interface (kgdboc) needs to assure
      something, this is neither the correct thing, nor place to do so.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Cc: kgdb-bugreport@lists.sourceforge.net
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22077b09
  3. 02 3月, 2017 1 次提交
  4. 25 12月, 2016 1 次提交
  5. 28 11月, 2016 1 次提交
  6. 28 10月, 2016 2 次提交
    • R
      tty: serial_core: fix NULL struct tty pointer access in uart_write_wakeup · d0f4bce2
      Rob Herring 提交于
      Since commit 761ed4a9 ("tty: serial_core: convert uart_close to
      use tty_port_close"), the serial console is broken on various systems
      and typing "reboot" splats the following on the serial console:
      
      INIT: Sending p[  427.863916] BUG: unable to handle kernel NULL pointer dereference at 00000000000001e0
      [  427.885156] IP: [] tty_wakeup+0xc/0x70
      [  427.898337] PGD 0 [  427.902051]
      [  427.907498] Oops: 0000 [#1] PREEMPT SMP
      [  427.917635] Modules linked in: nfsv3 nfs_acl nfs fscache lockd
      sunrpc grace edd af_packet cpufreq_conservative cpufreq_userspace
      cpufreq_powersave fuse loop md_mod dm_mod joydev hid_generic usbhid
      ipmi_ssif ohci_pci ohci_hcd ehci_pci ehci_hcd e1000e ptp firewire_ohci
      edac_core pps_core tpm_infineon sp5100_tco firewire_core acpi_cpufreq
      serio_raw pcspkr fjes usbcore shpchp edac_mce_amd tpm_tis ipmi_si
      tpm_tis_core i2c_piix4 k10temp sg ipmi_msghandler tpm sr_mod button
      cdrom kvm_amd kvm irqbypass crc_itu_t ast ttm drm_kms_helper drm
      fb_sys_fops sysimgblt sysfillrect syscopyarea i2c_algo_bit scsi_dh_rdac
      scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw ata_generic pata_atiixp
      [  428.054179] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.0-rc1-1.g73e3f23-default #1
      [  428.072868] Hardware name: System manufacturer System Product Name/KGP(M)E-D16, BIOS 0902    12/03/2010
      [  428.094755] task: ffffffffa2c0d500 task.stack: ffffffffa2c00000
      [  428.109717] RIP: 0010:[]  [] tty_wakeup+0xc/0x70
      [  428.128407] RSP: 0018:ffff9a1a5fc03df8  EFLAGS: 00010086
      [  428.142184] RAX: ffff9a1857258000 RBX: ffffffffa3050ea0 RCX: 0000000000000000
      [  428.159649] RDX: 000000000000001b RSI: 0000000000000000 RDI: 0000000000000000
      [  428.177109] RBP: ffff9a1a5fc03e08 R08: 0000000000000000 R09: 0000000000000000
      [  428.194547] R10: 0000000000021c77 R11: 0000000000000000 R12: ffff9a1857258000
      [  428.212002] R13: 0000000000000000 R14: 0000000000000020 R15: 0000000000000020
      [  428.229481] FS:  0000000000000000(0000) GS:ffff9a1a5fc00000(0000) knlGS:0000000000000000
      [  428.248938] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  428.263726] CR2: 00000000000001e0 CR3: 0000000390c06000 CR4: 00000000000006f0
      [  428.281331] Stack:
      [  428.288696]  ffffffffa3050ea0 ffff9a1857258000 ffff9a1a5fc03e18 ffffffffa24e0ab1
      [  428.307064]  ffff9a1a5fc03e40 ffffffffa24e8865 ffffffffa3050ea0 00000000000000c2
      [  428.325456]  0000000000000046 ffff9a1a5fc03e78 ffffffffa24e8a5f ffffffffa3050ea0
      [  428.343905] Call Trace:
      [  428.352319]   [  428.356216]  [] uart_write_wakeup+0x21/0x30
      
      The problem is for console ports, the serial port is not shutdown and
      interrupts may fire after the struct tty is gone. Simply calling the
      tty_port helper tty_port_tty_wakeup instead of tty_wakeup directly will
      ensure there is a valid struct tty.
      
      Fixes: 761ed4a9 ("tty: serial_core: convert uart_close to use tty_port_close")
      Reported-by: NBorislav Petkov <bp@alien8.de>
      Reported-by: NMike Galbraith <mgalbraith@suse.de>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-serial@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0f4bce2
    • G
      tty: serial_core: Fix serial console crash on port shutdown · 4dda864d
      Geert Uytterhoeven 提交于
      The port->console flag is always false, as uart_console() is called
      before the serial console has been registered.
      
      Hence for a serial port used as the console, uart_tty_port_shutdown()
      will still be called when userspace closes the port, powering it down.
      This may lead to a system lock up when the serial console driver writes
      to the serial port's registers.
      
      To fix this, move the setting of port->console after the call to
      uart_configure_port(), which registers the serial console.
      
      Fixes: 761ed4a9 ("tty: serial_core: convert uart_close to use tty_port_close")
      Reported-by: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: NRob Herring <robh@kernel.org>
      Tested-by: NMugunthan V N <mugunthanvnm@ti.com>
      Tested-by: NNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      [robh: rebased on tty-linus]
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4dda864d
  7. 27 10月, 2016 1 次提交
  8. 15 9月, 2016 1 次提交
  9. 14 9月, 2016 1 次提交
  10. 02 9月, 2016 1 次提交
  11. 31 8月, 2016 2 次提交
  12. 26 6月, 2016 1 次提交
  13. 04 5月, 2016 1 次提交
  14. 01 5月, 2016 9 次提交
  15. 07 2月, 2016 1 次提交
  16. 29 1月, 2016 9 次提交
  17. 14 12月, 2015 2 次提交
  18. 18 10月, 2015 1 次提交
  19. 05 10月, 2015 1 次提交
    • M
      serial_core: support native endianness · d215d809
      Max Filippov 提交于
      There are three natural ways in which devices may be wired to the system:
      little endian (device receives correctly ordered bits of a word written
      by little-endian CPU to its register, but big-endian CPU needs to swap
      bytes of a word before writing it), big endian (same, but with big-endian
      CPU in more favourable position) and native endian (CPU of either
      endianness may do word-sized I/O without need for byteswapping).
      
      Adding an option for native endianness allows using single kernel command
      line for boards with native-endian serial ports on bi-endian
      architectures. This goes in parallel with 'native-endian' DTS attribute.
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d215d809
  20. 05 8月, 2015 2 次提交