1. 06 Aug, 2014 7 commits
    • Dan Carpenter's avatar
      staging: iio/ad7291: fix error code in ad7291_probe() · 77148416
      Dan Carpenter authored
      commit b70e19c2 upstream.
      
      We should be returning a negative error code instead of success here.
      
      This would have been detected by GCC, except that the "ret" variable was
      initialized with a bogus value to disable GCC's uninitialized variable
      warnings.  I've cleaned that up, as well.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      77148416
    • Michal Nazarewicz's avatar
      usb: gadget: f_fs: fix NULL pointer dereference when there are no strings · b7e55b38
      Michal Nazarewicz authored
      commit f0688c8b upstream.
      
      If the descriptors do not need any strings and user space sends empty
      set of strings, the ffs->stringtabs field remains NULL.  Thus
      *ffs->stringtabs in functionfs_bind leads to a NULL pointer
      dereferenece.
      
      The bug was introduced by commit [fd7c9a00: “use usb_string_ids_n()”].
      
      While at it, remove double initialisation of lang local variable in
      that function.
      
      ffs->strings_count does not need to be checked in any way since in
      the above scenario it will remain zero and usb_string_ids_n() is
      a no-operation when colled with 0 argument.
      Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      b7e55b38
    • Linus Walleij's avatar
      usb: musb: ux500: don't propagate the OF node · ec8d5762
      Linus Walleij authored
      commit 82363cf2 upstream.
      
      There is a regression in the upcoming v3.16-rc1, that is caused
      by a problem that has been around for a while but now finally
      hangs the system. The bootcrawl looks like this:
      
      pinctrl-nomadik soc:pinctrl: pin GPIO256_AF28 already
      requested by a03e0000.usb_per5; cannot claim for musb-hdrc.0.auto
      pinctrl-nomadik soc:pinctrl: pin-256 (musb-hdrc.0.auto) status -22
      pinctrl-nomadik soc:pinctrl: could not request pin 256
      (GPIO256_AF28) from group usb_a_1  on device pinctrl-nomadik
      musb-hdrc musb-hdrc.0.auto: Error applying setting, reverse
      things back
      HS USB OTG: no transceiver configured
      musb-hdrc musb-hdrc.0.auto: musb_init_controller failed
      with status -517
      platform musb-hdrc.0.auto: Driver musb-hdrc requests
      probe deferral
      (...)
      
      The ux500 MUSB driver propagates the OF node to the dynamically
      created musb-hdrc device, which is incorrect as it makes the OF
      core believe there are two devices spun from the very same
      DT node, which confuses other parts of the device core, notably
      the pin control subsystem, which will try to apply all the pin
      control settings also to the HDRC device as it gets
      instantiated. (The OMAP2430 for example, does not set the
      of_node member.)
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarLee Jones <lee.jones@linaro.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      ec8d5762
    • Paolo Bonzini's avatar
      KVM: x86: preserve the high 32-bits of the PAT register · 1b3cba6d
      Paolo Bonzini authored
      commit 7cb060a9 upstream.
      
      KVM does not really do much with the PAT, so this went unnoticed for a
      long time.  It is exposed however if you try to do rdmsr on the PAT
      register.
      Reported-by: default avatarValentine Sinitsyn <valentine.sinitsyn@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1b3cba6d
    • Nadav Amit's avatar
      KVM: x86: Increase the number of fixed MTRR regs to 10 · 852e45c8
      Nadav Amit authored
      commit 682367c4 upstream.
      
      Recent Intel CPUs have 10 variable range MTRRs. Since operating systems
      sometime make assumptions on CPUs while they ignore capability MSRs, it is
      better for KVM to be consistent with recent CPUs. Reporting more MTRRs than
      actually supported has no functional implications.
      Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      852e45c8
    • David R. Piegdon's avatar
      ARM: OMAP2+: Fix parser-bug in platform muxing code · ccfb568e
      David R. Piegdon authored
      commit c021f241 upstream.
      
      Fix a parser-bug in the omap2 muxing code where muxtable-entries will be
      wrongly selected if the requested muxname is a *prefix* of their
      m0-entry and they have a matching mN-entry. Fix by additionally checking
      that the length of the m0_entry is equal.
      
      For example muxing of "dss_data2.dss_data2" on omap32xx will fail
      because the prefix "dss_data2" will match the mux-entries "dss_data2" as
      well as "dss_data20", with the suffix "dss_data2" matching m0 (for
      dss_data2) and m4 (for dss_data20). Thus both are recognized as signal
      path candidates:
      
      Relevant muxentries from mux34xx.c:
              _OMAP3_MUXENTRY(DSS_DATA20, 90,
                      "dss_data20", NULL, "mcspi3_somi", "dss_data2",
                      "gpio_90", NULL, NULL, "safe_mode"),
              _OMAP3_MUXENTRY(DSS_DATA2, 72,
                      "dss_data2", NULL, NULL, NULL,
                      "gpio_72", NULL, NULL, "safe_mode"),
      
      This will result in a failure to mux the pin at all:
      
       _omap_mux_get_by_name: Multiple signal paths (2) for dss_data2.dss_data2
      
      Patch should apply to linus' latest master down to rather old linux-2.6
      trees.
      Signed-off-by: default avatarDavid R. Piegdon <lkml@p23q.org>
      [tony@atomide.com: updated description to include full description]
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      ccfb568e
    • Jan Kara's avatar
      ext4: Fix buffer double free in ext4_alloc_branch() · 9df1e32a
      Jan Kara authored
      commit c5c7b8dd upstream.
      
      Error recovery in ext4_alloc_branch() calls ext4_forget() even for
      buffer corresponding to indirect block it did not allocate. This leads
      to brelse() being called twice for that buffer (once from ext4_forget()
      and once from cleanup in ext4_ind_map_blocks()) leading to buffer use
      count misaccounting. Eventually (but often much later because there
      are other users of the buffer) we will see messages like:
      VFS: brelse: Trying to free free buffer
      
      Another manifestation of this problem is an error:
      JBD2 unexpected failure: jbd2_journal_revoke: !buffer_revoked(bh);
      inconsistent data on disk
      
      The fix is easy - don't forget buffer we did not allocate. Also add an
      explanatory comment because the indexing at ext4_alloc_branch() is
      somewhat subtle.
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      9df1e32a
  2. 04 Aug, 2014 6 commits
    • David Vrabel's avatar
      x86/xen: safely map and unmap grant frames when in atomic context · 1cd4dd3a
      David Vrabel authored
      commit b7dd0e35 upstream.
      
      arch_gnttab_map_frames() and arch_gnttab_unmap_frames() are called in
      atomic context but were calling alloc_vm_area() which might sleep.
      
      Also, if a driver attempts to allocate a grant ref from an interrupt
      and the table needs expanding, then the CPU may already by in lazy MMU
      mode and apply_to_page_range() will BUG when it tries to re-enable
      lazy MMU mode.
      
      These two functions are only used in PV guests.
      
      Introduce arch_gnttab_init() to allocates the virtual address space in
      advance.
      
      Avoid the use of apply_to_page_range() by using saving and using the
      array of PTE addresses from the alloc_vm_area() call (which ensures
      that the required page tables are pre-allocated).
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [ David Vrabel: Backported to 3.13.10. ]
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Cc: Stefan Bader <stefan.bader@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1cd4dd3a
    • Mengdong Lin's avatar
      ALSA: hda - verify pin:cvt connection on preparing a stream for Intel HDMI codec · 350cc11e
      Mengdong Lin authored
      commit 2df6742f upstream.
      
      This is a temporary fix for some Intel HDMI codecs to avoid no sound output for
      a resuming playback after S3.
      
      After S3, the audio driver restores pin:cvt connection selections by
      snd_hda_codec_resume_cache(). However this can happen before the gfx side is
      ready and such connect selection is overlooked by HW. After gfx is ready, the
      pins make the default selection again. And this will cause multiple pins share
      a same convertor and mute control will affect each other. Thus a resumed audio
      playback become silent after S3.
      
      This patch verifies pin:cvt connection on preparing a stream, to assure the pin
      selects the right convetor and an assigned convertor is not shared by other
      unused pins. Apply this fix-up on Haswell, Broadwell and Valleyview (Baytrail).
      
      We need this temporary fix before a reliable software communication channel is
      established between audio and gfx, to sync audio/gfx operations.
      Signed-off-by: default avatarMengdong Lin <mengdong.lin@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Cc: David Henningsson <david.henningsson@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      350cc11e
    • Mengdong Lin's avatar
      ALSA: hda - verify pin:converter connection on unsol event for HSW and VLV · 77d080e2
      Mengdong Lin authored
      commit b4f75aea upstream.
      
      This patch will verify the pin's coverter selection for an active stream
      when an unsol event reports this pin becomes available again after a display
      mode change or hot-plug event.
      
      For Haswell+ and Valleyview: display mode change or hot-plug can change the
      transcoder:port connection and make all the involved audio pins share the 1st
      converter. So the stream using 1st convertor will flow to multiple pins
      but active streams using other converters will fail. This workaround
      is to assure the pin selects the right conveter and an assigned converter is
      not shared by other unused pins.
      Signed-off-by: default avatarMengdong Lin <mengdong.lin@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Cc: David Henningsson <david.henningsson@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      77d080e2
    • Mengdong Lin's avatar
      ALSA: hda/hdmi - apply all Haswell fix-ups to Broadwell display codec · fbfc0ce8
      Mengdong Lin authored
      commit 75dcbe4d upstream.
      
      Broadwell and Haswell have the same behavior on display audio. So this patch
      defines is_haswell_plus() to include codecs for both Haswell and its successor
      Broadwell, and apply all Haswell fix-ups to Broadwell.
      Signed-off-by: default avatarMengdong Lin <mengdong.lin@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Cc: David Henningsson <david.henningsson@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      fbfc0ce8
    • Peter Christensen's avatar
      ipvs: Fix panic due to non-linear skb · f8039cdc
      Peter Christensen authored
      commit f44a5f45 upstream.
      
      Receiving a ICMP response to an IPIP packet in a non-linear skb could
      cause a kernel panic in __skb_pull.
      
      The problem was introduced in
      commit f2edb9f7 ("ipvs: implement
      passive PMTUD for IPIP packets").
      Signed-off-by: default avatarPeter Christensen <pch@ordbogen.com>
      Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
      Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
      Cc: Chris J Arges <chris.j.arges@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      f8039cdc
    • Wei-Chun Chao's avatar
      net: fix UDP tunnel GSO of frag_list GRO packets · 8e7967e7
      Wei-Chun Chao authored
      commit 5882a07c upstream.
      
      This patch fixes a kernel BUG_ON in skb_segment. It is hit when
      testing two VMs on openvswitch with one VM acting as VXLAN gateway.
      
      During VXLAN packet GSO, skb_segment is called with skb->data
      pointing to inner TCP payload. skb_segment calls skb_network_protocol
      to retrieve the inner protocol. skb_network_protocol actually expects
      skb->data to point to MAC and it calls pskb_may_pull with ETH_HLEN.
      This ends up pulling in ETH_HLEN data from header tail. As a result,
      pskb_trim logic is skipped and BUG_ON is hit later.
      
      Move skb_push in front of skb_network_protocol so that skb->data
      lines up properly.
      
      kernel BUG at net/core/skbuff.c:2999!
      Call Trace:
      [<ffffffff816ac412>] tcp_gso_segment+0x122/0x410
      [<ffffffff816bc74c>] inet_gso_segment+0x13c/0x390
      [<ffffffff8164b39b>] skb_mac_gso_segment+0x9b/0x170
      [<ffffffff816b3658>] skb_udp_tunnel_segment+0xd8/0x390
      [<ffffffff816b3c00>] udp4_ufo_fragment+0x120/0x140
      [<ffffffff816bc74c>] inet_gso_segment+0x13c/0x390
      [<ffffffff8109d742>] ? default_wake_function+0x12/0x20
      [<ffffffff8164b39b>] skb_mac_gso_segment+0x9b/0x170
      [<ffffffff8164b4d0>] __skb_gso_segment+0x60/0xc0
      [<ffffffff8164b6b3>] dev_hard_start_xmit+0x183/0x550
      [<ffffffff8166c91e>] sch_direct_xmit+0xfe/0x1d0
      [<ffffffff8164bc94>] __dev_queue_xmit+0x214/0x4f0
      [<ffffffff8164bf90>] dev_queue_xmit+0x10/0x20
      [<ffffffff81687edb>] ip_finish_output+0x66b/0x890
      [<ffffffff81688a58>] ip_output+0x58/0x90
      [<ffffffff816c628f>] ? fib_table_lookup+0x29f/0x350
      [<ffffffff816881c9>] ip_local_out_sk+0x39/0x50
      [<ffffffff816cbfad>] iptunnel_xmit+0x10d/0x130
      [<ffffffffa0212200>] vxlan_xmit_skb+0x1d0/0x330 [vxlan]
      [<ffffffffa02a3919>] vxlan_tnl_send+0x129/0x1a0 [openvswitch]
      [<ffffffffa02a2cd6>] ovs_vport_send+0x26/0xa0 [openvswitch]
      [<ffffffffa029931e>] do_output+0x2e/0x50 [openvswitch]
      Signed-off-by: default avatarWei-Chun Chao <weichunc@plumgrid.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      (backported from commit 5882a07c)
      Signed-off-by: default avatarDave Chiluk <chiluk@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      8e7967e7
  3. 29 Jul, 2014 4 commits
    • Hugh Dickins's avatar
      shmem: fix splicing from a hole while it's punched · 760f8da2
      Hugh Dickins authored
      commit b1a36650 upstream.
      
      shmem_fault() is the actual culprit in trinity's hole-punch starvation,
      and the most significant cause of such problems: since a page faulted is
      one that then appears page_mapped(), needing unmap_mapping_range() and
      i_mmap_mutex to be unmapped again.
      
      But it is not the only way in which a page can be brought into a hole in
      the radix_tree while that hole is being punched; and Vlastimil's testing
      implies that if enough other processors are busy filling in the hole,
      then shmem_undo_range() can be kept from completing indefinitely.
      
      shmem_file_splice_read() is the main other user of SGP_CACHE, which can
      instantiate shmem pagecache pages in the read-only case (without holding
      i_mutex, so perhaps concurrently with a hole-punch).  Probably it's
      silly not to use SGP_READ already (using the ZERO_PAGE for holes): which
      ought to be safe, but might bring surprises - not a change to be rushed.
      
      shmem_read_mapping_page_gfp() is an internal interface used by
      drivers/gpu/drm GEM (and next by uprobes): it should be okay.  And
      shmem_file_read_iter() uses the SGP_DIRTY variant of SGP_CACHE, when
      called internally by the kernel (perhaps for a stacking filesystem,
      which might rely on holes to be reserved): it's unclear whether it could
      be provoked to keep hole-punch busy or not.
      
      We could apply the same umbrella as now used in shmem_fault() to
      shmem_file_splice_read() and the others; but it looks ugly, and use over
      a range raises questions - should it actually be per page? can these get
      starved themselves?
      
      The origin of this part of the problem is my v3.1 commit d0823576
      ("mm: pincer in truncate_inode_pages_range"), once it was duplicated
      into shmem.c.  It seemed like a nice idea at the time, to ensure
      (barring RCU lookup fuzziness) that there's an instant when the entire
      hole is empty; but the indefinitely repeated scans to ensure that make
      it vulnerable.
      
      Revert that "enhancement" to hole-punch from shmem_undo_range(), but
      retain the unproblematic rescanning when it's truncating; add a couple
      of comments there.
      
      Remove the "indices[0] >= end" test: that is now handled satisfactorily
      by the inner loop, and mem_cgroup_uncharge_start()/end() are too light
      to be worth avoiding here.
      
      But if we do not always loop indefinitely, we do need to handle the case
      of swap swizzled back to page before shmem_free_swap() gets it: add a
      retry for that case, as suggested by Konstantin Khlebnikov; and for the
      case of page swizzled back to swap, as suggested by Johannes Weiner.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Suggested-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Lukas Czerner <lczerner@redhat.com>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [ luis: backported to 3.11: used hughd's backport to 3.10.50 ]
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      760f8da2
    • Hugh Dickins's avatar
      shmem: fix faulting into a hole, not taking i_mutex · e0533ae3
      Hugh Dickins authored
      commit 8e205f77 upstream.
      
      Commit f00cdc6d ("shmem: fix faulting into a hole while it's
      punched") was buggy: Sasha sent a lockdep report to remind us that
      grabbing i_mutex in the fault path is a no-no (write syscall may already
      hold i_mutex while faulting user buffer).
      
      We tried a completely different approach (see following patch) but that
      proved inadequate: good enough for a rational workload, but not good
      enough against trinity - which forks off so many mappings of the object
      that contention on i_mmap_mutex while hole-puncher holds i_mutex builds
      into serious starvation when concurrent faults force the puncher to fall
      back to single-page unmap_mapping_range() searches of the i_mmap tree.
      
      So return to the original umbrella approach, but keep away from i_mutex
      this time.  We really don't want to bloat every shmem inode with a new
      mutex or completion, just to protect this unlikely case from trinity.
      So extend the original with wait_queue_head on stack at the hole-punch
      end, and wait_queue item on the stack at the fault end.
      
      This involves further use of i_lock to guard against the races: lockdep
      has been happy so far, and I see fs/inode.c:unlock_new_inode() holds
      i_lock around wake_up_bit(), which is comparable to what we do here.
      i_lock is more convenient, but we could switch to shmem's info->lock.
      
      This issue has been tagged with CVE-2014-4171, which will require commit
      f00cdc6d and this and the following patch to be backported: we
      suggest to 3.1+, though in fact the trinity forkbomb effect might go
      back as far as 2.6.16, when madvise(,,MADV_REMOVE) came in - or might
      not, since much has changed, with i_mmap_mutex a spinlock before 3.0.
      Anyone running trinity on 3.0 and earlier? I don't think we need care.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Lukas Czerner <lczerner@redhat.com>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      e0533ae3
    • Hugh Dickins's avatar
      shmem: fix faulting into a hole while it's punched · bca9495d
      Hugh Dickins authored
      commit f00cdc6d upstream.
      
      Trinity finds that mmap access to a hole while it's punched from shmem
      can prevent the madvise(MADV_REMOVE) or fallocate(FALLOC_FL_PUNCH_HOLE)
      from completing, until the reader chooses to stop; with the puncher's
      hold on i_mutex locking out all other writers until it can complete.
      
      It appears that the tmpfs fault path is too light in comparison with its
      hole-punching path, lacking an i_data_sem to obstruct it; but we don't
      want to slow down the common case.
      
      Extend shmem_fallocate()'s existing range notification mechanism, so
      shmem_fault() can refrain from faulting pages into the hole while it's
      punched, waiting instead on i_mutex (when safe to sleep; or repeatedly
      faulting when not).
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Tested-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      bca9495d
    • Sven Wegener's avatar
      x86_32, entry: Store badsys error code in %eax · 5eb2fae2
      Sven Wegener authored
      commit 8142b215 upstream.
      
      Commit 554086d8 ("x86_32, entry: Do syscall exit work on badsys
      (CVE-2014-4508)") introduced a regression in the x86_32 syscall entry
      code, resulting in syscall() not returning proper errors for undefined
      syscalls on CPUs supporting the sysenter feature.
      
      The following code:
      
      > int result = syscall(666);
      > printf("result=%d errno=%d error=%s\n", result, errno, strerror(errno));
      
      results in:
      
      > result=666 errno=0 error=Success
      
      Obviously, the syscall return value is the called syscall number, but it
      should have been an ENOSYS error. When run under ptrace it behaves
      correctly, which makes it hard to debug in the wild:
      
      > result=-1 errno=38 error=Function not implemented
      
      The %eax register is the return value register. For debugging via ptrace
      the syscall entry code stores the complete register context on the
      stack. The badsys handlers only store the ENOSYS error code in the
      ptrace register set and do not set %eax like a regular syscall handler
      would. The old resume_userspace call chain contains code that clobbers
      %eax and it restores %eax from the ptrace registers afterwards. The same
      goes for the ptrace-enabled call chain. When ptrace is not used, the
      syscall return value is the passed-in syscall number from the untouched
      %eax register.
      
      Use %eax as the return value register in syscall_badsys and
      sysenter_badsys, like a real syscall handler does, and have the caller
      push the value onto the stack for ptrace access.
      Signed-off-by: default avatarSven Wegener <sven.wegener@stealer.net>
      Link: http://lkml.kernel.org/r/alpine.LNX.2.11.1407221022380.31021@titan.int.lan.stealer.netReviewed-and-tested-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      5eb2fae2
  4. 24 Jul, 2014 1 commit
  5. 21 Jul, 2014 4 commits
    • Xufeng Zhang's avatar
      sctp: Fix sk_ack_backlog wrap-around problem · 56ac66c9
      Xufeng Zhang authored
      commit d3217b15 upstream.
      
      Consider the scenario:
      For a TCP-style socket, while processing the COOKIE_ECHO chunk in
      sctp_sf_do_5_1D_ce(), after it has passed a series of sanity check,
      a new association would be created in sctp_unpack_cookie(), but afterwards,
      some processing maybe failed, and sctp_association_free() will be called to
      free the previously allocated association, in sctp_association_free(),
      sk_ack_backlog value is decremented for this socket, since the initial
      value for sk_ack_backlog is 0, after the decrement, it will be 65535,
      a wrap-around problem happens, and if we want to establish new associations
      afterward in the same socket, ABORT would be triggered since sctp deem the
      accept queue as full.
      Fix this issue by only decrementing sk_ack_backlog for associations in
      the endpoint's list.
      Fix-suggested-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarXufeng Zhang <xufeng.zhang@windriver.com>
      Acked-by: default avatarDaniel Borkmann <dborkman@redhat.com>
      Acked-by: default avatarVlad Yasevich <vyasevich@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Reference: CVE-2014-4667
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      56ac66c9
    • Nicholas Bellinger's avatar
      target: Explicitly clear ramdisk_mcp backend pages · ff5d076f
      Nicholas Bellinger authored
      [Note that a different patch to address the same issue went in during
      v3.15-rc1 (commit 4442dc8a), but includes a bunch of other changes that
      don't strictly apply to fixing the bug.]
      
      This patch changes rd_allocate_sgl_table() to explicitly clear
      ramdisk_mcp backend memory pages by passing __GFP_ZERO into
      alloc_pages().
      
      This addresses a potential security issue where reading from a
      ramdisk_mcp could return sensitive information, and follows what
      >= v3.15 does to explicitly clear ramdisk_mcp memory at backend
      device initialization time.
      Reported-by: default avatarJorge Daniel Sequeira Matias <jdsm@tecnico.ulisboa.pt>
      Cc: Jorge Daniel Sequeira Matias <jdsm@tecnico.ulisboa.pt>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Reference: CVE-2014-4027
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      ff5d076f
    • Paolo Bonzini's avatar
      KVM: ioapic: fix assignment of ioapic->rtc_status.pending_eoi (CVE-2014-0155) · bad3f63f
      Paolo Bonzini authored
      commit 5678de3f upstream.
      
      QE reported that they got the BUG_ON in ioapic_service to trigger.
      I cannot reproduce it, but there are two reasons why this could happen.
      
      The less likely but also easiest one, is when kvm_irq_delivery_to_apic
      does not deliver to any APIC and returns -1.
      
      Because irqe.shorthand == 0, the kvm_for_each_vcpu loop in that
      function is never reached.  However, you can target the similar loop in
      kvm_irq_delivery_to_apic_fast; just program a zero logical destination
      address into the IOAPIC, or an out-of-range physical destination address.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      bad3f63f
    • Tony Camuso's avatar
      ACPI / PAD: call schedule() when need_resched() is true · a0c72a16
      Tony Camuso authored
      commit 5b59c69e upstream.
      
      The purpose of the acpi_pad driver is to implement the "processor power
      aggregator" device as described in the ACPI 4.0 spec section 8.5. It
      takes requests from the BIOS (via ACPI) to put a specified number of
      CPUs into idle, in order to save power, until further notice.
      
      It does this by creating high-priority threads that try to keep the CPUs
      in a high C-state (using the monitor/mwait CPU instructions). The
      mwait() call is in a loop that checks periodically if the thread should
      end and a few other things.
      
      It was discovered through testing that the power_saving threads were
      causing the system to consume more power than the system was consuming
      before the threads were created. A counter in the main loop of
      power_saving_thread() revealed that it was spinning. The mwait()
      instruction was not keeping the CPU in a high C state very much if at
      all.
      
      Here is a simplification of the loop in function power_saving_thread() in
      drivers/acpi/acpi_pad.c
      
          while (!kthread_should_stop()) {
               :
              try_to_freeze()
               :
              while (!need_resched()) {
                   :
                  if (!need_resched())
                      __mwait(power_saving_mwait_eax, 1);
                   :
                  if (jiffies > expire_time) {
                      do_sleep = 1;
                      break;
                  }
              }
          }
      
      If need_resched() returns true, then mwait() is not called. It was
      returning true because of things like timer interrupts, as in the
      following sequence.
      
      hrtimer_interrupt->__run_hrtimer->tick_sched_timer-> update_process_times->
      rcu_check_callbacks->rcu_pending->__rcu_pending->set_need_resched
      
      Kernels 3.5.0-rc2+ do not exhibit this problem, because a patch to
      try_to_freeze() in include/linux/freezer.h introduces a call to
      might_sleep(), which ultimately calls schedule() to clear the reschedule
      flag and allows the the loop to execute the call to mwait().
      
      However, the changes to try_to_freeze are unrelated to acpi_pad, and it
      does not seem like a good idea to rely on an unrelated patch in a
      function that could later be changed and reintroduce this bug.
      
      Therefore, it seems better to make an explicit call to schedule() in the
      outer loop when the need_resched flag is set.
      Reported-and-tested-by: default avatarStuart Hayes <stuart_hayes@dell.com>
      Signed-off-by: default avatarTony Camuso <tcamuso@redhat.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Leann Ogasawara <leann.ogasawara@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a0c72a16
  6. 18 Jul, 2014 1 commit
  7. 16 Jul, 2014 17 commits
    • Mikulas Patocka's avatar
      iscsi-target: fix iscsit_del_np deadlock on unload · 8c6eac45
      Mikulas Patocka authored
      commit 81a9c5e7 upstream.
      
      On uniprocessor preemptible kernel, target core deadlocks on unload. The
      following events happen:
      * iscsit_del_np is called
      * it calls send_sig(SIGINT, np->np_thread, 1);
      * the scheduler switches to the np_thread
      * the np_thread is woken up, it sees that kthread_should_stop() returns
        false, so it doesn't terminate
      * the np_thread clears signals with flush_signals(current); and goes back
        to sleep in iscsit_accept_np
      * the scheduler switches back to iscsit_del_np
      * iscsit_del_np calls kthread_stop(np->np_thread);
      * the np_thread is waiting in iscsit_accept_np and it doesn't respond to
        kthread_stop
      
      The deadlock could be resolved if the administrator sends SIGINT signal to
      the np_thread with killall -INT iscsi_np
      
      The reproducible deadlock was introduced in commit
      db6077fd, but the thread-stopping code was
      racy even before.
      
      This patch fixes the problem. Using kthread_should_stop to stop the
      np_thread is unreliable, so we test np_thread_state instead. If
      np_thread_state equals ISCSI_NP_THREAD_SHUTDOWN, the thread exits.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      8c6eac45
    • Nicholas Bellinger's avatar
      iscsi-target: Avoid rejecting incorrect ITT for Data-Out · 6bc41c40
      Nicholas Bellinger authored
      commit 97c99b47 upstream.
      
      This patch changes iscsit_check_dataout_hdr() to dump the incoming
      Data-Out payload when the received ITT is not associated with a
      WRITE, instead of calling iscsit_reject_cmd() for the non WRITE
      ITT descriptor.
      
      This addresses a bug where an initiator sending an Data-Out for
      an ITT associated with a READ would end up generating a reject
      for the READ, eventually resulting in list corruption.
      Reported-by: default avatarSantosh Kulkarni <santosh.kulkarni@calsoftinc.com>
      Reported-by: default avatarArshad Hussain <arshad.hussain@calsoftinc.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      6bc41c40
    • Greg Kroah-Hartman's avatar
      lz4: fix another possible overrun · d05c12b6
      Greg Kroah-Hartman authored
      commit 4148c1f6 upstream.
      
      There is one other possible overrun in the lz4 code as implemented by
      Linux at this point in time (which differs from the upstream lz4
      codebase, but will get synced at in a future kernel release.)  As
      pointed out by Don, we also need to check the overflow in the data
      itself.
      
      While we are at it, replace the odd error return value with just a
      "simple" -1 value as the return value is never used for anything other
      than a basic "did this work or not" check.
      Reported-by: default avatar"Don A. Bailey" <donb@securitymouse.com>
      Reported-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d05c12b6
    • Andrzej Zaborowski's avatar
      efi-pstore: Fix an overflow on 32-bit builds · 5122d3c5
      Andrzej Zaborowski authored
      commit 783ee431 upstream.
      
      In generic_id the long int timestamp is multiplied by 100000 and needs
      an explicit cast to u64.
      
      Without that the id in the resulting pstore filename is wrong and
      userspace may have problems parsing it, but more importantly files in
      pstore can never be deleted and may fill the EFI flash (brick device?).
      This happens because when generic pstore code wants to delete a file,
      it passes the id to the EFI backend which reinterpretes it and a wrong
      variable name is attempted to be deleted.  There's no error message but
      after remounting pstore, deleted files would reappear.
      Signed-off-by: default avatarAndrew Zaborowski <andrew.zaborowski@intel.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      5122d3c5
    • Nicholas Bellinger's avatar
      iscsi-target: Explicily clear login response PDU in exception path · ea6f6251
      Nicholas Bellinger authored
      commit 68349756 upstream.
      
      This patch adds a explicit memset to the login response PDU
      exception path in iscsit_tx_login_rsp().
      
      This addresses a regression bug introduced in commit baa4d64b
      where the initiator would end up not receiving the login
      response and associated status class + detail, before closing
      the login connection.
      Reported-by: default avatarChristophe Vu-Brugier <cvubrugier@yahoo.fr>
      Tested-by: default avatarChristophe Vu-Brugier <cvubrugier@yahoo.fr>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      ea6f6251
    • Nicholas Bellinger's avatar
      target: Fix left-over se_lun->lun_sep pointer OOPs · d5e348bd
      Nicholas Bellinger authored
      commit 83ff42fc upstream.
      
      This patch fixes a left-over se_lun->lun_sep pointer OOPs when one
      of the /sys/kernel/config/target/$FABRIC/$WWPN/$TPGT/lun/$LUN/alua*
      attributes is accessed after the $DEVICE symlink has been removed.
      
      To address this bug, go ahead and clear se_lun->lun_sep memory in
      core_dev_unexport(), so that the existing checks for show/store
      ALUA attributes in target_core_fabric_configfs.c work as expected.
      Reported-by: default avatarSebastian Herbszt <herbszt@gmx.de>
      Tested-by: default avatarSebastian Herbszt <herbszt@gmx.de>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d5e348bd
    • Mengdong Lin's avatar
      ALSA: hda - restore BCLK M/N values when resuming HSW/BDW display controller · 72f0c0f4
      Mengdong Lin authored
      commit a07187c9 upstream.
      
      For Intel Haswell/Broadwell display HD-A controller, the 24MHz HD-A link BCLK
      is converted from Core Display Clock (CDCLK): BCLK = CDCLK * M / N
      And there are two registers EM4 and EM5 to program M, N value respectively.
      The EM4/EM5 values will be lost and when the display power well is disabled.
      
      BIOS programs CDCLK selected by OEM and EM4/EM5, but BIOS has no idea about
      display power well on/off at runtime. So the M/N can be wrong if non-default
      CDCLK is used when the audio controller resumes, which results in an invalid
      BCLK and abnormal audio playback rate. So this patch saves and restores valid
      M/N values on controller suspend/resume.
      
      And 'struct hda_intel' is defined to contain standard HD-A 'struct azx' and
      Intel specific fields, as Takashi suggested.
      Signed-off-by: default avatarMengdong Lin <mengdong.lin@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      [ kamal: backport to 3.13-stable: context ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      72f0c0f4
    • Markos Chandras's avatar
      MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region · c278a3b3
      Markos Chandras authored
      commit ab6c15bc upstream.
      
      Previously, the lower limit for the MIPS SC initialization loop was
      set incorrectly allowing one extra loop leading to writes
      beyond the MSC ioremap'd space. More precisely, the value of the 'imp'
      in the last loop increased beyond the msc_irqmap_t boundaries and
      as a result of which, the 'n' variable was loaded with an incorrect
      value. This value was used later on to calculate the offset in the
      MSC01_IC_SUP which led to random crashes like the following one:
      
      CPU 0 Unable to handle kernel paging request at virtual address e75c0200,
      epc == 8058dba4, ra == 8058db90
      [...]
      Call Trace:
      [<8058dba4>] init_msc_irqs+0x104/0x154
      [<8058b5bc>] arch_init_irq+0xd8/0x154
      [<805897b0>] start_kernel+0x220/0x36c
      
      Kernel panic - not syncing: Attempted to kill the idle task!
      
      This patch fixes the problem
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/7118/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c278a3b3
    • Alex Smith's avatar
      recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules · daf05306
      Alex Smith authored
      commit 91ad11d7 upstream.
      
      On MIPS calls to _mcount in modules generate 2 instructions to load
      the _mcount address (and therefore 2 relocations). The mcount_loc
      table should only reference the first of these, so the second is
      filtered out by checking the relocation offset and ignoring ones that
      immediately follow the previous one seen.
      
      However if a module has an _mcount call at offset 0, the second
      relocation would not be filtered out due to old_r_offset == 0
      being taken to mean that the current relocation is the first one
      seen, and both would end up in the mcount_loc table.
      
      This results in ftrace_make_nop() patching both (adjacent)
      instructions to branches over the _mcount call sequence like so:
      
        0xffffffffc08a8000:  04 00 00 10     b       0xffffffffc08a8014
        0xffffffffc08a8004:  04 00 00 10     b       0xffffffffc08a8018
        0xffffffffc08a8008:  2d 08 e0 03     move    at,ra
        ...
      
      The second branch is in the delay slot of the first, which is
      defined to be unpredictable - on the platform on which this bug was
      encountered, it triggers a reserved instruction exception.
      
      Fix by initializing old_r_offset to ~0 and using that instead of 0
      to determine whether the current relocation is the first seen.
      Signed-off-by: default avatarAlex Smith <alex.smith@imgtec.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/7098/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      daf05306
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix races at disconnection and PCM closing · 1cd17669
      Takashi Iwai authored
      commit 92a586bd upstream.
      
      When a USB-audio device is disconnected while PCM is still running, we
      still see some race: the disconnect callback calls
      snd_usb_endpoint_free() that calls release_urbs() and then kfree()
      while a PCM stream would be closed at the same time and calls
      stop_endpoints() that leads to wait_clear_urbs().  That is, the EP
      object might be deallocated while a PCM stream is syncing with
      wait_clear_urbs() with the same EP.
      
      Basically calling multiple wait_clear_urbs() would work fine, also
      calling wait_clear_urbs() and release_urbs() would work, too, as
      wait_clear_urbs() just reads some fields in ep.  The problem is the
      succeeding kfree() in snd_pcm_endpoint_free().
      
      This patch moves out the EP deallocation into the later point, the
      destructor callback.  At this stage, all PCMs must have been already
      closed, so it's safe to free the objects.
      Reported-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1cd17669
    • Maxime Ripard's avatar
      net: allwinner: emac: Add missing free_irq · 2f06796a
      Maxime Ripard authored
      commit b9111328 upstream.
      
      If the mdio probe function fails in emac_open, the interrupt we just requested
      isn't freed. If emac_open is called again, for example because we try to set up
      the interface again, the kernel will oops because the interrupt wasn't properly
      released.
      Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      2f06796a
    • Scott Wood's avatar
      powerpc: Don't skip ePAPR spin-table CPUs · 59a6c7b1
      Scott Wood authored
      commit 6663a4fa upstream.
      
      Commit 59a53afe "powerpc: Don't setup
      CPUs with bad status" broke ePAPR SMP booting.  ePAPR says that CPUs
      that aren't presently running shall have status of disabled, with
      enable-method being used to determine whether the CPU can be enabled.
      
      Fix by checking for spin-table, which is currently the only supported
      enable-method.
      Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
      Cc: Michael Neuling <mikey@neuling.org>
      Cc: Emil Medve <Emilian.Medve@Freescale.com>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      59a6c7b1
    • Scott Mayhew's avatar
      nfs: Fix cache_validity check in nfs_write_pageuptodate() · 22eb5097
      Scott Mayhew authored
      commit 18dd78c4 upstream.
      
      NFS_INO_INVALID_DATA cannot be ignored, even if we have a delegation.
      
      We're still having some problems with data corruption when multiple
      clients are appending to a file and those clients are being granted
      write delegations on open.
      
      To reproduce:
      
      Client A:
      vi /mnt/`hostname -s`
      while :; do echo "XXXXXXXXXXXXXXX" >>/mnt/file; sleep $(( $RANDOM % 5 )); done
      
      Client B:
      vi /mnt/`hostname -s`
      while :; do echo "YYYYYYYYYYYYYYY" >>/mnt/file; sleep $(( $RANDOM % 5 )); done
      
      What's happening is that in nfs_update_inode() we're recognizing that
      the file size has changed and we're setting NFS_INO_INVALID_DATA
      accordingly, but then we ignore the cache_validity flags in
      nfs_write_pageuptodate() because we have a delegation.  As a result,
      in nfs_updatepage() we're extending the write to cover the full page
      even though we've not read in the data to begin with.
      Signed-off-by: default avatarScott Mayhew <smayhew@redhat.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      [ kamal: backport to 3.13-stable ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      22eb5097
    • Benjamin LaHaise's avatar
      aio: fix kernel memory disclosure in io_getevents() introduced in v3.10 · 65cc017e
      Benjamin LaHaise authored
      commit edfbbf38 upstream.
      
      A kernel memory disclosure was introduced in aio_read_events_ring() in v3.10
      by commit a31ad380.  The changes made to
      aio_read_events_ring() failed to correctly limit the index into
      ctx->ring_pages[], allowing an attacked to cause the subsequent kmap() of
      an arbitrary page with a copy_to_user() to copy the contents into userspace.
      This vulnerability has been assigned CVE-2014-0206.  Thanks to Mateusz and
      Petr for disclosing this issue.
      
      This patch applies to v3.12+.  A separate backport is needed for 3.10/3.11.
      Signed-off-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
      Cc: Mateusz Guzik <mguzik@redhat.com>
      Cc: Petr Matousek <pmatouse@redhat.com>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: Jeff Moyer <jmoyer@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      65cc017e
    • Benjamin LaHaise's avatar
      aio: fix aio request leak when events are reaped by userspace · 78e79039
      Benjamin LaHaise authored
      commit f8567a38 upstream.
      
      The aio cleanups and optimizations by kmo that were merged into the 3.10
      tree added a regression for userspace event reaping.  Specifically, the
      reference counts are not decremented if the event is reaped in userspace,
      leading to the application being unable to submit further aio requests.
      This patch applies to 3.12+.  A separate backport is required for 3.10/3.11.
      This issue was uncovered as part of CVE-2014-0206.
      Signed-off-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
      Cc: Kent Overstreet <kmo@daterainc.com>
      Cc: Mateusz Guzik <mguzik@redhat.com>
      Cc: Petr Matousek <pmatouse@redhat.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      78e79039
    • Steve French's avatar
      [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option · edb83595
      Steve French authored
      commit ce36d9ab upstream.
      
      When we SMB3 mounted with mapchars (to allow reserved characters : \ / > < * ?
      via the Unicode Windows to POSIX remap range) empty paths
      (eg when we open "" to query the root of the SMB3 directory on mount) were not
      null terminated so we sent garbarge as a path name on empty paths which caused
      SMB2/SMB2.1/SMB3 mounts to fail when mapchars was specified.  mapchars is
      particularly important since Unix Extensions for SMB3 are not supported (yet)
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      Reviewed-by: default avatarDavid Disseldorp <ddiss@suse.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      edb83595
    • Chris Wilson's avatar
      drm/i915: Hold the table lock whilst walking the file's idr and counting the objects in debugfs · 3e970038
      Chris Wilson authored
      commit 5b5ffff0 upstream.
      
      Fixes an issue whereby we may race with the table updates (before the
      core takes the struct_mutex) and so risk dereferencing a stale pointer in
      the iterator for /debugfs/.../i915_gem_objects. For example,
      
      [ 1524.757545] BUG: unable to handle kernel paging request at f53af748
      [ 1524.757572] IP: [<c1406982>] per_file_stats+0x12/0x100
      [ 1524.757599] *pdpt = 0000000001b13001 *pde = 00000000379fb067 *pte = 80000000353af060
      [ 1524.757621] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC
      [ 1524.757637] Modules linked in: ctr ccm arc4 ath9k ath9k_common ath9k_hw ath snd_hda_codec_conexant mac80211 snd_hda_codec_generic snd_hda_intel snd_hda_controller snd_hda_codec bnep snd_hwdep rfcomm snd_pcm gpio_ich dell_wmi sparse_keymap snd_seq_midi hid_multitouch uvcvideo snd_seq_midi_event dell_laptop snd_rawmidi dcdbas snd_seq videobuf2_vmalloc videobuf2_memops videobuf2_core usbhid videodev snd_seq_device coretemp snd_timer hid joydev kvm_intel cfg80211 ath3k kvm btusb bluetooth serio_raw snd microcode soundcore lpc_ich wmi mac_hid parport_pc ppdev lp parport psmouse ahci libahci
      [ 1524.757825] CPU: 3 PID: 1911 Comm: intel-gpu-overl Tainted: G        W  OE 3.15.0-rc3+ #96
      [ 1524.757840] Hardware name: Dell Inc. Inspiron 1090/Inspiron 1090, BIOS A06 08/23/2011
      [ 1524.757855] task: f52f36c0 ti: f4cbc000 task.ti: f4cbc000
      [ 1524.757869] EIP: 0060:[<c1406982>] EFLAGS: 00210202 CPU: 3
      [ 1524.757884] EIP is at per_file_stats+0x12/0x100
      [ 1524.757896] EAX: 0000002d EBX: 00000000 ECX: f4cbdefc EDX: f53af700
      [ 1524.757909] ESI: c1406970 EDI: f53af700 EBP: f4cbde6c ESP: f4cbde5c
      [ 1524.757922]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      [ 1524.757934] CR0: 80050033 CR2: f53af748 CR3: 356af000 CR4: 000007f0
      [ 1524.757945] Stack:
      [ 1524.757957]  f4cbdefc 00000000 c1406970 f53af700 f4cbdea8 c12e5f15 f4cbdefc c1406970
      [ 1524.757993]  0000ffff f4cbde90 0000002d f5dc5cd0 e4e80438 c1181d59 f4cbded8 f4d89900
      [ 1524.758027]  f5631b40 e5131074 c1903f37 f4cbdf28 c14068e6 f52648a0 c1927748 c1903f37
      [ 1524.758062] Call Trace:
      [ 1524.758084]  [<c1406970>] ? i915_gem_object_info+0x510/0x510
      [ 1524.758106]  [<c12e5f15>] idr_for_each+0xa5/0x100
      [ 1524.758126]  [<c1406970>] ? i915_gem_object_info+0x510/0x510
      [ 1524.758148]  [<c1181d59>] ? seq_vprintf+0x29/0x50
      [ 1524.758168]  [<c14068e6>] i915_gem_object_info+0x486/0x510
      [ 1524.758189]  [<c11823a6>] seq_read+0xd6/0x380
      [ 1524.758208]  [<c116d11d>] ? final_putname+0x1d/0x40
      [ 1524.758227]  [<c11822d0>] ? seq_hlist_next_percpu+0x90/0x90
      [ 1524.758246]  [<c1163e52>] vfs_read+0x82/0x150
      [ 1524.758265]  [<c11645d6>] SyS_read+0x46/0x90
      [ 1524.758285]  [<c16b8d8c>] sysenter_do_call+0x12/0x22
      [ 1524.758298] Code: f5 8f 2a 00 83 c4 6c 31 c0 5b 5e 5f 5d c3 8d 74 26 00 8d bc 27 00 00 00 00 55 89 e5 57 56 53 83 ec 04 3e 8d 74 26 00 83 41 04 01 <8b> 42 48 01 41 08 8b 42 4c 89 d7 85 c0 75 07 8b 42 60 85 c0 74
      [ 1524.758461] EIP: [<c1406982>] per_file_stats+0x12/0x100 SS:ESP 0068:f4cbde5c
      [ 1524.758485] CR2: 00000000f53af748
      Reported-by: default avatarSam Jansen <sam.jansen@starleaf.com>
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Sam Jansen <sam.jansen@starleaf.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      3e970038