1. 20 Nov, 2013 7 commits
    • Steven Rostedt's avatar
      tracing: Fix potential out-of-bounds in trace_get_user() · af15b769
      Steven Rostedt authored
      commit 057db848 upstream.
      
      Andrey reported the following report:
      
      ERROR: AddressSanitizer: heap-buffer-overflow on address ffff8800359c99f3
      ffff8800359c99f3 is located 0 bytes to the right of 243-byte region [ffff8800359c9900, ffff8800359c99f3)
      Accessed by thread T13003:
        #0 ffffffff810dd2da (asan_report_error+0x32a/0x440)
        #1 ffffffff810dc6b0 (asan_check_region+0x30/0x40)
        #2 ffffffff810dd4d3 (__tsan_write1+0x13/0x20)
        #3 ffffffff811cd19e (ftrace_regex_release+0x1be/0x260)
        #4 ffffffff812a1065 (__fput+0x155/0x360)
        #5 ffffffff812a12de (____fput+0x1e/0x30)
        #6 ffffffff8111708d (task_work_run+0x10d/0x140)
        #7 ffffffff810ea043 (do_exit+0x433/0x11f0)
        #8 ffffffff810eaee4 (do_group_exit+0x84/0x130)
        #9 ffffffff810eafb1 (SyS_exit_group+0x21/0x30)
        #10 ffffffff81928782 (system_call_fastpath+0x16/0x1b)
      
      Allocated by thread T5167:
        #0 ffffffff810dc778 (asan_slab_alloc+0x48/0xc0)
        #1 ffffffff8128337c (__kmalloc+0xbc/0x500)
        #2 ffffffff811d9d54 (trace_parser_get_init+0x34/0x90)
        #3 ffffffff811cd7b3 (ftrace_regex_open+0x83/0x2e0)
        #4 ffffffff811cda7d (ftrace_filter_open+0x2d/0x40)
        #5 ffffffff8129b4ff (do_dentry_open+0x32f/0x430)
        #6 ffffffff8129b668 (finish_open+0x68/0xa0)
        #7 ffffffff812b66ac (do_last+0xb8c/0x1710)
        #8 ffffffff812b7350 (path_openat+0x120/0xb50)
        #9 ffffffff812b8884 (do_filp_open+0x54/0xb0)
        #10 ffffffff8129d36c (do_sys_open+0x1ac/0x2c0)
        #11 ffffffff8129d4b7 (SyS_open+0x37/0x50)
        #12 ffffffff81928782 (system_call_fastpath+0x16/0x1b)
      
      Shadow bytes around the buggy address:
        ffff8800359c9700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        ffff8800359c9780: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
        ffff8800359c9800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      =>ffff8800359c9980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[03]fb
        ffff8800359c9a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        ffff8800359c9b00: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
        ffff8800359c9b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        ffff8800359c9c00: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07
        Heap redzone:          fa
        Heap kmalloc redzone:  fb
        Freed heap region:     fd
        Shadow gap:            fe
      
      The out-of-bounds access happens on 'parser->buffer[parser->idx] = 0;'
      
      Although the crash happened in ftrace_regex_open() the real bug
      occurred in trace_get_user() where there's an incrementation to
      parser->idx without a check against the size. The way it is triggered
      is if userspace sends in 128 characters (EVENT_BUF_SIZE + 1), the loop
      that reads the last character stores it and then breaks out because
      there is no more characters. Then the last character is read to determine
      what to do next, and the index is incremented without checking size.
      
      Then the caller of trace_get_user() usually nulls out the last character
      with a zero, but since the index is equal to the size, it writes a nul
      character after the allocated space, which can corrupt memory.
      
      Luckily, only root user has write access to this file.
      
      Link: http://lkml.kernel.org/r/20131009222323.04fd1a0d@gandalf.local.homeReported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af15b769
    • Patrick McHardy's avatar
      netfilter: nf_ct_sip: don't drop packets with offsets pointing outside the packet · 9736cb3f
      Patrick McHardy authored
      commit 3a7b21ea upstream.
      
      Some Cisco phones create huge messages that are spread over multiple packets.
      After calculating the offset of the SIP body, it is validated to be within
      the packet and the packet is dropped otherwise. This breaks operation of
      these phones. Since connection tracking is supposed to be passive, just let
      those packets pass unmodified and untracked.
      Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Cc: William Roberts <bill.c.roberts@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9736cb3f
    • Takashi Iwai's avatar
      ALSA: hda - Move one-time init codes from generic_hdmi_init() · 1ddb811a
      Takashi Iwai authored
      commit 8b8d654b upstream.
      
      The codes to initialize work struct or create a proc interface should
      be called only once and never although it's called many times through
      the init callback.  Move that stuff into patch_generic_hdmi() so that
      it's called only once.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      BugLink: https://bugs.launchpad.net/bugs/1212160Signed-off-by: default avatarDavid Henningsson <david.henningsson@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ddb811a
    • Rui li's avatar
      USB: add new zte 3g-dongle's pid to option.c · a2757768
      Rui li authored
      commit 0636fc50 upstream.
      Signed-off-by: default avatarRui li <li.rui27@zte.com.cn>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2757768
    • Nikhil P Rao's avatar
      PCI: fix truncation of resource size to 32 bits · c1014109
      Nikhil P Rao authored
      commit d6776e6d upstream.
      
      _pci_assign_resource() took an int "size" argument, which meant that
      sizes larger than 4GB were truncated.  Change type to resource_size_t.
      
      [bhelgaas: changelog]
      Signed-off-by: default avatarNikhil P Rao <nikhil.rao@intel.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1014109
    • Jason Wang's avatar
      net: flow_dissector: fail on evil iph->ihl · 161f4a45
      Jason Wang authored
      [ Upstream commit 6f092343 ]
      
      We don't validate iph->ihl which may lead a dead loop if we meet a IPIP
      skb whose iph->ihl is zero. Fix this by failing immediately when iph->ihl
      is evil (less than 5).
      
      This issue were introduced by commit ec5efe79
      (rps: support IPIP encapsulation).
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Petr Matousek <pmatouse@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Daniel Borkmann <dborkman@redhat.com>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      161f4a45
    • Wei Liu's avatar
      xen-netback: use jiffies_64 value to calculate credit timeout · 2b58df72
      Wei Liu authored
      [ Upstream commit 059dfa6a ]
      
      time_after_eq() only works if the delta is < MAX_ULONG/2.
      
      For a 32bit Dom0, if netfront sends packets at a very low rate, the time
      between subsequent calls to tx_credit_exceeded() may exceed MAX_ULONG/2
      and the test for timer_after_eq() will be incorrect. Credit will not be
      replenished and the guest may become unable to send packets (e.g., if
      prior to the long gap, all credit was exhausted).
      
      Use jiffies_64 variant to mitigate this problem for 32bit Dom0.
      Suggested-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarWei Liu <wei.liu2@citrix.com>
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Cc: Ian Campbell <ian.campbell@citrix.com>
      Cc: Jason Luan <jianhai.luan@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b58df72
  2. 13 Nov, 2013 27 commits
  3. 04 Nov, 2013 6 commits