1. 02 Jul, 2014 40 commits
    • Ezequiel Garcia's avatar
      media: stk1160: Avoid stack-allocated buffer for control URBs · 956ff41a
      Ezequiel Garcia authored
      commit 85ac1a17 upstream.
      
      Currently stk1160_read_reg() uses a stack-allocated char to get the
      read control value. This is wrong because usb_control_msg() requires
      a kmalloc-ed buffer.
      
      This commit fixes such issue by kmalloc'ating a 1-byte buffer to receive
      the read value.
      
      While here, let's remove the urb_buf array which was meant for a similar
      purpose, but never really used.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: default avatarEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      956ff41a
    • Takashi Iwai's avatar
      media: ivtv: Fix Oops when no firmware is loaded · 30d8ffb3
      Takashi Iwai authored
      commit deb29e90 upstream.
      
      When ivtv PCM device is accessed at the state where no firmware is
      loaded, it oopses like:
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000050
        IP: [<ffffffffa049a881>] try_mailbox.isra.0+0x11/0x50 [ivtv]
        Call Trace:
          [<ffffffffa049aa20>] ivtv_api_call+0x160/0x6b0 [ivtv]
          [<ffffffffa049af86>] ivtv_api+0x16/0x40 [ivtv]
          [<ffffffffa049b10c>] ivtv_vapi+0xac/0xc0 [ivtv]
          [<ffffffffa049d40d>] ivtv_start_v4l2_encode_stream+0x19d/0x630 [ivtv]
          [<ffffffffa0530653>] snd_ivtv_pcm_capture_open+0x173/0x1c0 [ivtv_alsa]
          [<ffffffffa04526f1>] snd_pcm_open_substream+0x51/0x100 [snd_pcm]
          [<ffffffffa0452853>] snd_pcm_open+0xb3/0x260 [snd_pcm]
          [<ffffffffa0452a37>] snd_pcm_capture_open+0x37/0x50 [snd_pcm]
          [<ffffffffa033f557>] snd_open+0xa7/0x1e0 [snd]
          [<ffffffff8118a628>] chrdev_open+0x88/0x1d0
          [<ffffffff811840be>] do_dentry_open+0x1de/0x270
          [<ffffffff81193a73>] do_last+0x1c3/0xec0
          [<ffffffff81194826>] path_openat+0xb6/0x670
          [<ffffffff81195b65>] do_filp_open+0x35/0x80
          [<ffffffff81185449>] do_sys_open+0x129/0x210
          [<ffffffff815b782d>] system_call_fastpath+0x1a/0x1f
      
      This patch adds the check of firmware at PCM open callback like other
      open callbacks of this driver.
      
      Bugzilla: https://apibugzilla.novell.com/show_bug.cgi?id=875440Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      30d8ffb3
    • Johan Hovold's avatar
      USB: serial: fix potential runtime pm imbalance at device remove · 957bd4c3
      Johan Hovold authored
      commit c14829fa upstream.
      
      Only call usb_autopm_put_interface() if the corresponding
      usb_autopm_get_interface() was successful.
      
      This prevents a potential runtime PM counter imbalance should
      usb_autopm_get_interface() fail. Note that the USB PM usage counter is
      reset when the interface is unbound, but that the runtime PM counter may
      be left unbalanced.
      
      Also add comment on why we don't need to worry about racing
      resume/suspend on autopm_get failures.
      
      Fixes: d5fd650c ("usb: serial: prevent suspend/resume from racing
      against probe/remove")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      957bd4c3
    • Johan Hovold's avatar
      USB: sierra: fix remote wakeup · 59f8ef8d
      Johan Hovold authored
      commit 80cc0fcb upstream.
      
      Make sure that needs_remote_wake up is always set when there are open
      ports.
      
      Currently close() would unconditionally set needs_remote_wakeup to 0
      even though there might still be open ports. This could lead to blocked
      input and possibly dropped data on devices that do not support remote
      wakeup (and which must therefore not be runtime suspended while open).
      
      Add an open_ports counter (protected by the susp_lock) and only clear
      needs_remote_wakeup when the last port is closed.
      
      Fixes: e6929a90 ("USB: support for autosuspend in sierra while
      online")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      59f8ef8d
    • Johan Hovold's avatar
      USB: sierra: fix urb and memory leak on disconnect · 7e7ccedc
      Johan Hovold authored
      commit 014333f7 upstream.
      
      The delayed-write queue was never emptied on disconnect, something which
      would lead to leaked urbs and transfer buffers if the device is
      disconnected before being runtime resumed due to a write.
      
      Fixes: e6929a90 ("USB: support for autosuspend in sierra while
      online")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      7e7ccedc
    • Johan Hovold's avatar
      USB: sierra: fix urb and memory leak in resume error path · a2aa7319
      Johan Hovold authored
      commit 7fdd26a0 upstream.
      
      Neither the transfer buffer or the urb itself were released in the
      resume error path for delayed writes. Also on errors, the remainder of
      the queue was not even processed, which leads to further urb and buffer
      leaks.
      
      The same error path also failed to balance the outstanding-urb counter,
      something which results in degraded throughput or completely blocked
      writes.
      
      Fix this by releasing urb and buffer and balancing counters on errors,
      and by always processing the whole queue even when submission of one urb
      fails.
      
      Fixes: e6929a90 ("USB: support for autosuspend in sierra while
      online")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      a2aa7319
    • Johan Hovold's avatar
      USB: sierra: fix use after free at suspend/resume · 06974d79
      Johan Hovold authored
      commit 8452727d upstream.
      
      Fix use after free or NULL-pointer dereference during suspend and
      resume.
      
      The port data may never have been allocated (port probe failed)
      or may already have been released by port_remove (e.g. driver is
      unloaded) when suspend and resume are called.
      
      Fixes: e6929a90 ("USB: support for autosuspend in sierra while
      online")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      06974d79
    • Johan Hovold's avatar
      USB: sierra: fix AA deadlock in open error path · 8ae7a23b
      Johan Hovold authored
      commit 353fe198 upstream.
      
      Fix AA deadlock in open error path that would call close() and try to
      grab the already held disc_mutex.
      
      Fixes: b9a44bc1 ("sierra: driver urb handling improvements")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      8ae7a23b
    • Johan Hovold's avatar
      USB: usb_wwan: fix potential blocked I/O after resume · 7a797aa0
      Johan Hovold authored
      commit fb7ad4f9 upstream.
      
      Keep trying to submit urbs rather than bail out on first read-urb
      submission error, which would also prevent I/O for any further ports
      from being resumed.
      
      Instead keep an error count, for all types of failed submissions, and
      let USB core know that something went wrong.
      
      Also make sure to always clear the suspended flag. Currently a failed
      read-urb submission would prevent cached writes as well as any
      subsequent writes from being submitted until next suspend-resume cycle,
      something which may not even necessarily happen.
      
      Note that USB core currently only logs an error if an interface resume
      failed.
      
      Fixes: 383cedc3 ("USB: serial: full autosuspend support for the
      option driver")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      7a797aa0
    • Johan Hovold's avatar
      USB: usb_wwan: fix potential NULL-deref at resume · bfd75a49
      Johan Hovold authored
      commit 9096f1fb upstream.
      
      The interrupt urb was submitted unconditionally at resume, something
      which could lead to a NULL-pointer dereference in the urb completion
      handler as resume may be called after the port and port data is gone.
      
      Fix this by making sure the interrupt urb is only submitted and active
      when the port is open.
      
      Fixes: 383cedc3 ("USB: serial: full autosuspend support for the
      option driver")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      bfd75a49
    • Johan Hovold's avatar
      USB: usb_wwan: fix urb leak at shutdown · 9b71d5c3
      Johan Hovold authored
      commit 79eed03e upstream.
      
      The delayed-write queue was never emptied at shutdown (close), something
      which could lead to leaked urbs if the port is closed before being
      runtime resumed due to a write.
      
      When this happens the output buffer would not drain on close
      (closing_wait timeout), and after consecutive opens, writes could be
      corrupted with previously buffered data, transfered with reduced
      throughput or completely blocked.
      
      Note that unbusy_queued_urb() was simply moved out of CONFIG_PM.
      
      Fixes: 383cedc3 ("USB: serial: full autosuspend support for the
      option driver")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      9b71d5c3
    • Johan Hovold's avatar
      USB: usb_wwan: fix write and suspend race · 09728099
      Johan Hovold authored
      commit 170fad9e upstream.
      
      Fix race between write() and suspend() which could lead to writes being
      dropped (or I/O while suspended) if the device is runtime suspended
      while a write request is being processed.
      
      Specifically, suspend() releases the susp_lock after determining the
      device is idle but before setting the suspended flag, thus leaving a
      window where a concurrent write() can submit an urb.
      
      Fixes: 383cedc3 ("USB: serial: full autosuspend support for the
      option driver")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      09728099
    • xiao jin's avatar
      USB: usb_wwan: fix race between write and resume · 8cba48ef
      xiao jin authored
      commit d9e93c08 upstream.
      
      We find a race between write and resume. usb_wwan_resume run play_delayed()
      and spin_unlock, but intfdata->suspended still is not set to zero.
      At this time usb_wwan_write is called and anchor the urb to delay
      list. Then resume keep running but the delayed urb have no chance
      to be commit until next resume. If the time of next resume is far
      away, tty will be blocked in tty_wait_until_sent during time. The
      race also can lead to writes being reordered.
      
      This patch put play_Delayed and intfdata->suspended together in the
      spinlock, it's to avoid the write race during resume.
      
      Fixes: 383cedc3 ("USB: serial: full autosuspend support for the
      option driver")
      Signed-off-by: default avatarxiao jin <jin.xiao@intel.com>
      Signed-off-by: default avatarZhang, Qi1 <qi1.zhang@intel.com>
      Reviewed-by: default avatarDavid Cohen <david.a.cohen@linux.intel.com>
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      8cba48ef
    • xiao jin's avatar
      USB: usb_wwan: fix urb leak in write error path · 2d08bfbd
      xiao jin authored
      commit db090473 upstream.
      
      When enable usb serial for modem data, sometimes the tty is blocked
      in tty_wait_until_sent because portdata->out_busy always is set and
      have no chance to be cleared.
      
      We find a bug in write error path. usb_wwan_write set portdata->out_busy
      firstly, then try autopm async with error. No out urb submit and no
      usb_wwan_outdat_callback to this write, portdata->out_busy can't be
      cleared.
      
      This patch clear portdata->out_busy if usb_wwan_write try autopm async
      with error.
      
      Fixes: 383cedc3 ("USB: serial: full autosuspend support for the
      option driver")
      Signed-off-by: default avatarxiao jin <jin.xiao@intel.com>
      Signed-off-by: default avatarZhang, Qi1 <qi1.zhang@intel.com>
      Reviewed-by: default avatarDavid Cohen <david.a.cohen@linux.intel.com>
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      2d08bfbd
    • Mikulas Patocka's avatar
      matroxfb: perform a dummy read of M_STATUS · f01bea2e
      Mikulas Patocka authored
      commit 972754cf upstream.
      
      I had occasional screen corruption with the matrox framebuffer driver and
      I found out that the reason for the corruption is that the hardware
      blitter accesses the videoram while it is being written to.
      
      The matrox driver has a macro WaitTillIdle() that should wait until the
      blitter is idle, but it sometimes doesn't work. I added a dummy read
      mga_inl(M_STATUS) to WaitTillIdle() to fix the problem. The dummy read
      will flush the write buffer in the PCI chipset, and the next read of
      M_STATUS will return the hardware status.
      
      Since applying this patch, I had no screen corruption at all.
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      f01bea2e
    • Maurizio Lombardi's avatar
      ext4: fix wrong assert in ext4_mb_normalize_request() · 516bf04c
      Maurizio Lombardi authored
      commit b5b60778 upstream.
      
      The variable "size" is expressed as number of blocks and not as
      number of clusters, this could trigger a kernel panic when using
      ext4 with the size of a cluster different from the size of a block.
      Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      516bf04c
    • Jan Kara's avatar
      ext4: fix zeroing of page during writeback · 7e78f828
      Jan Kara authored
      commit eeece469 upstream.
      
      Tail of a page straddling inode size must be zeroed when being written
      out due to POSIX requirement that modifications of mmaped page beyond
      inode size must not be written to the file. ext4_bio_write_page() did
      this only for blocks fully beyond inode size but didn't properly zero
      blocks partially beyond inode size. Fix this.
      
      The problem has been uncovered by mmap_11-4 test in openposix test suite
      (part of LTP).
      Reported-by: default avatarXiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
      Fixes: 5a0dc736
      Fixes: bd2d0210
      CC: stable@vger.kernel.org
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      7e78f828
    • Namjae Jeon's avatar
      ext4: fix data integrity sync in ordered mode · 76516da4
      Namjae Jeon authored
      commit 1c8349a1 upstream.
      
      When we perform a data integrity sync we tag all the dirty pages with
      PAGECACHE_TAG_TOWRITE at start of ext4_da_writepages.  Later we check
      for this tag in write_cache_pages_da and creates a struct
      mpage_da_data containing contiguously indexed pages tagged with this
      tag and sync these pages with a call to mpage_da_map_and_submit.  This
      process is done in while loop until all the PAGECACHE_TAG_TOWRITE
      pages are synced. We also do journal start and stop in each iteration.
      journal_stop could initiate journal commit which would call
      ext4_writepage which in turn will call ext4_bio_write_page even for
      delayed OR unwritten buffers. When ext4_bio_write_page is called for
      such buffers, even though it does not sync them but it clears the
      PAGECACHE_TAG_TOWRITE of the corresponding page and hence these pages
      are also not synced by the currently running data integrity sync. We
      will end up with dirty pages although sync is completed.
      
      This could cause a potential data loss when the sync call is followed
      by a truncate_pagecache call, which is exactly the case in
      collapse_range.  (It will cause generic/127 failure in xfstests)
      
      To avoid this issue, we can use set_page_writeback_keepwrite instead of
      set_page_writeback, which doesn't clear TOWRITE tag.
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Signed-off-by: default avatarAshish Sangwan <a.sangwan@samsung.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      76516da4
    • Christian Borntraeger's avatar
      s390/lowcore: reserve 96 bytes for IRB in lowcore · 2375be78
      Christian Borntraeger authored
      commit 993072ee upstream.
      
      The IRB might be 96 bytes if the extended-I/O-measurement facility is
      used. This feature is currently not used by Linux, but struct irb
      already has the emw defined. So let's make the irb in lowcore match the
      size of the internal data structure to be future proof.
      We also have to add a pad, to correctly align the paste.
      
      The bigger irb field also circumvents a bug in some QEMU versions that
      always write the emw field on test subchannel and therefore destroy the
      paste definitions of this CPU. Running under these QEMU version broke
      some timing functions in the VDSO and all users of these functions,
      e.g. some JREs.
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      2375be78
    • Lai Jiangshan's avatar
      idr: fix overflow bug during maximum ID calculation at maximum height · 09b6ffbb
      Lai Jiangshan authored
      commit 3afb69cb upstream.
      
      idr_replace() open-codes the logic to calculate the maximum valid ID
      given the height of the idr tree; unfortunately, the open-coded logic
      doesn't account for the fact that the top layer may have unused slots
      and over-shifts the limit to zero when the tree is at its maximum
      height.
      
      The following test code shows it fails to replace the value for
      id=((1<<27)+42):
      
        static void test5(void)
        {
              int id;
              DEFINE_IDR(test_idr);
        #define TEST5_START ((1<<27)+42) /* use the highest layer */
      
              printk(KERN_INFO "Start test5\n");
              id = idr_alloc(&test_idr, (void *)1, TEST5_START, 0, GFP_KERNEL);
              BUG_ON(id != TEST5_START);
              TEST_BUG_ON(idr_replace(&test_idr, (void *)2, TEST5_START) != (void *)1);
              idr_destroy(&test_idr);
              printk(KERN_INFO "End of test5\n");
        }
      
      Fix the bug by using idr_max() which correctly takes into account the
      maximum allowed shift.
      
      sub_alloc() shares the same problem and may incorrectly fail with
      -EAGAIN; however, this bug doesn't affect correct operation because
      idr_get_empty_slot(), which already uses idr_max(), retries with the
      increased @id in such cases.
      
      [tj@kernel.org: Updated patch description.]
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      09b6ffbb
    • Will Deacon's avatar
      arm64: ptrace: change fs when passing kernel pointer to regset code · 177ee132
      Will Deacon authored
      commit c1688707 upstream.
      
      Our compat PTRACE_POKEUSR implementation simply passes the user data to
      regset_copy_from_user after some simple range checking. Unfortunately,
      the data in question has already been copied to the kernel stack by this
      point, so the subsequent access_ok check fails and the ptrace request
      returns -EFAULT. This causes problems tracing fork() with older versions
      of strace.
      
      This patch briefly changes the fs to KERNEL_DS, so that the access_ok
      check passes even with a kernel address.
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      177ee132
    • Matthew Dempsky's avatar
      ptrace: fix fork event messages across pid namespaces · 7b41b264
      Matthew Dempsky authored
      commit 4e52365f upstream.
      
      When tracing a process in another pid namespace, it's important for fork
      event messages to contain the child's pid as seen from the tracer's pid
      namespace, not the parent's.  Otherwise, the tracer won't be able to
      correlate the fork event with later SIGTRAP signals it receives from the
      child.
      
      We still risk a race condition if a ptracer from a different pid
      namespace attaches after we compute the pid_t value.  However, sending a
      bogus fork event message in this unlikely scenario is still a vast
      improvement over the status quo where we always send bogus fork event
      messages to debuggers in a different pid namespace than the forking
      process.
      Signed-off-by: default avatarMatthew Dempsky <mdempsky@chromium.org>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Julien Tinnes <jln@chromium.org>
      Cc: Roland McGrath <mcgrathr@chromium.org>
      Cc: Jan Kratochvil <jan.kratochvil@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 avatarJiri Slaby <jslaby@suse.cz>
      7b41b264
    • Johannes Weiner's avatar
      mm: vmscan: clear kswapd's special reclaim powers before exiting · c25f8a8b
      Johannes Weiner authored
      commit 71abdc15 upstream.
      
      When kswapd exits, it can end up taking locks that were previously held
      by allocating tasks while they waited for reclaim.  Lockdep currently
      warns about this:
      
      On Wed, May 28, 2014 at 06:06:34PM +0800, Gu Zheng wrote:
      >  inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-R} usage.
      >  kswapd2/1151 [HC0[0]:SC0[0]:HE1:SE1] takes:
      >   (&sig->group_rwsem){+++++?}, at: exit_signals+0x24/0x130
      >  {RECLAIM_FS-ON-W} state was registered at:
      >     mark_held_locks+0xb9/0x140
      >     lockdep_trace_alloc+0x7a/0xe0
      >     kmem_cache_alloc_trace+0x37/0x240
      >     flex_array_alloc+0x99/0x1a0
      >     cgroup_attach_task+0x63/0x430
      >     attach_task_by_pid+0x210/0x280
      >     cgroup_procs_write+0x16/0x20
      >     cgroup_file_write+0x120/0x2c0
      >     vfs_write+0xc0/0x1f0
      >     SyS_write+0x4c/0xa0
      >     tracesys+0xdd/0xe2
      >  irq event stamp: 49
      >  hardirqs last  enabled at (49):  _raw_spin_unlock_irqrestore+0x36/0x70
      >  hardirqs last disabled at (48):  _raw_spin_lock_irqsave+0x2b/0xa0
      >  softirqs last  enabled at (0):  copy_process.part.24+0x627/0x15f0
      >  softirqs last disabled at (0):            (null)
      >
      >  other info that might help us debug this:
      >   Possible unsafe locking scenario:
      >
      >         CPU0
      >         ----
      >    lock(&sig->group_rwsem);
      >    <Interrupt>
      >      lock(&sig->group_rwsem);
      >
      >   *** DEADLOCK ***
      >
      >  no locks held by kswapd2/1151.
      >
      >  stack backtrace:
      >  CPU: 30 PID: 1151 Comm: kswapd2 Not tainted 3.10.39+ #4
      >  Call Trace:
      >    dump_stack+0x19/0x1b
      >    print_usage_bug+0x1f7/0x208
      >    mark_lock+0x21d/0x2a0
      >    __lock_acquire+0x52a/0xb60
      >    lock_acquire+0xa2/0x140
      >    down_read+0x51/0xa0
      >    exit_signals+0x24/0x130
      >    do_exit+0xb5/0xa50
      >    kthread+0xdb/0x100
      >    ret_from_fork+0x7c/0xb0
      
      This is because the kswapd thread is still marked as a reclaimer at the
      time of exit.  But because it is exiting, nobody is actually waiting on
      it to make reclaim progress anymore, and it's nothing but a regular
      thread at this point.  Be tidy and strip it of all its powers
      (PF_MEMALLOC, PF_SWAPWRITE, PF_KSWAPD, and the lockdep reclaim state)
      before returning from the thread function.
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Reported-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
      Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: Tang Chen <tangchen@cn.fujitsu.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 avatarJiri Slaby <jslaby@suse.cz>
      c25f8a8b
    • Kees Cook's avatar
      HID: core: fix validation of report id 0 · ebbc3be9
      Kees Cook authored
      commit 1b15d2e5 upstream.
      
      Some drivers use the first HID report in the list instead of using an
      index. In these cases, validation uses ID 0, which was supposed to mean
      "first known report". This fixes the problem, which was causing at least
      the lgff family of devices to stop working since hid_validate_values
      was being called with ID 0, but the devices used single numbered IDs
      for their reports:
      
      0x05, 0x01,         /*  Usage Page (Desktop),                   */
      0x09, 0x05,         /*  Usage (Gamepad),                        */
      0xA1, 0x01,         /*  Collection (Application),               */
      0xA1, 0x02,         /*      Collection (Logical),               */
      0x85, 0x01,         /*          Report ID (1),                  */
      ...
      Reported-by: default avatarSimon Wood <simon@mungewell.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      ebbc3be9
    • Hugh Dickins's avatar
      mm: fix sleeping function warning from __put_anon_vma · 6e74114b
      Hugh Dickins authored
      commit 7f39dda9 upstream.
      
      Trinity reports BUG:
      
        sleeping function called from invalid context at kernel/locking/rwsem.c:47
        in_atomic(): 0, irqs_disabled(): 0, pid: 5787, name: trinity-c27
      
      __might_sleep < down_write < __put_anon_vma < page_get_anon_vma <
      migrate_pages < compact_zone < compact_zone_order < try_to_compact_pages ..
      
      Right, since conversion to mutex then rwsem, we should not put_anon_vma()
      from inside an rcu_read_lock()ed section: fix the two places that did so.
      And add might_sleep() to anon_vma_free(), as suggested by Peter Zijlstra.
      
      Fixes: 88c22088 ("mm: optimize page_lock_anon_vma() fast-path")
      Reported-by: default avatarDave Jones <davej@redhat.com>
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      6e74114b
    • Naoya Horiguchi's avatar
      mm/memory-failure.c: support use of a dedicated thread to handle SIGBUS(BUS_MCEERR_AO) · 79035696
      Naoya Horiguchi authored
      commit 3ba08129 upstream.
      
      Currently memory error handler handles action optional errors in the
      deferred manner by default.  And if a recovery aware application wants
      to handle it immediately, it can do it by setting PF_MCE_EARLY flag.
      However, such signal can be sent only to the main thread, so it's
      problematic if the application wants to have a dedicated thread to
      handler such signals.
      
      So this patch adds dedicated thread support to memory error handler.  We
      have PF_MCE_EARLY flags for each thread separately, so with this patch
      AO signal is sent to the thread with PF_MCE_EARLY flag set, not the main
      thread.  If you want to implement a dedicated thread, you call prctl()
      to set PF_MCE_EARLY on the thread.
      
      Memory error handler collects processes to be killed, so this patch lets
      it check PF_MCE_EARLY flag on each thread in the collecting routines.
      
      No behavioral change for all non-early kill cases.
      
      Tony said:
      
      : The old behavior was crazy - someone with a multithreaded process might
      : well expect that if they call prctl(PF_MCE_EARLY) in just one thread, then
      : that thread would see the SIGBUS with si_code = BUS_MCEERR_A0 - even if
      : that thread wasn't the main thread for the process.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
      Cc: Kamil Iskra <iskra@mcs.anl.gov>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Chen Gong <gong.chen@linux.jf.intel.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 avatarJiri Slaby <jslaby@suse.cz>
      79035696
    • Tony Luck's avatar
      mm/memory-failure.c: don't let collect_procs() skip over processes for MF_ACTION_REQUIRED · dc06ecd4
      Tony Luck authored
      commit 74614de1 upstream.
      
      When Linux sees an "action optional" machine check (where h/w has reported
      an error that is not in the current execution path) we generally do not
      want to signal a process, since most processes do not have a SIGBUS
      handler - we'd just prematurely terminate the process for a problem that
      they might never actually see.
      
      task_early_kill() decides whether to consider a process - and it checks
      whether this specific process has been marked for early signals with
      "prctl", or if the system administrator has requested early signals for
      all processes using /proc/sys/vm/memory_failure_early_kill.
      
      But for MF_ACTION_REQUIRED case we must not defer.  The error is in the
      execution path of the current thread so we must send the SIGBUS
      immediatley.
      
      Fix by passing a flag argument through collect_procs*() to
      task_early_kill() so it knows whether we can defer or must take action.
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Chen Gong <gong.chen@linux.jf.intel.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 avatarJiri Slaby <jslaby@suse.cz>
      dc06ecd4
    • Tony Luck's avatar
      mm/memory-failure.c-failure: send right signal code to correct thread · da0cf80a
      Tony Luck authored
      commit a70ffcac upstream.
      
      When a thread in a multi-threaded application hits a machine check because
      of an uncorrectable error in memory - we want to send the SIGBUS with
      si.si_code = BUS_MCEERR_AR to that thread.  Currently we fail to do that
      if the active thread is not the primary thread in the process.
      collect_procs() just finds primary threads and this test:
      
      	if ((flags & MF_ACTION_REQUIRED) && t == current) {
      
      will see that the thread we found isn't the current thread and so send a
      si.si_code = BUS_MCEERR_AO to the primary (and nothing to the active
      thread at this time).
      
      We can fix this by checking whether "current" shares the same mm with the
      process that collect_procs() said owned the page.  If so, we send the
      SIGBUS to current (with code BUS_MCEERR_AR).
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Reported-by: default avatarOtto Bruggeman <otto.g.bruggeman@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Chen Gong <gong.chen@linux.jf.intel.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 avatarJiri Slaby <jslaby@suse.cz>
      da0cf80a
    • Mel Gorman's avatar
      mm: page_alloc: use word-based accesses for get/set pageblock bitmaps · 4d6dd826
      Mel Gorman authored
      commit e58469ba upstream.
      
      The test_bit operations in get/set pageblock flags are expensive.  This
      patch reads the bitmap on a word basis and use shifts and masks to isolate
      the bits of interest.  Similarly masks are used to set a local copy of the
      bitmap and then use cmpxchg to update the bitmap if there have been no
      other changes made in parallel.
      
      In a test running dd onto tmpfs the overhead of the pageblock-related
      functions went from 1.27% in profiles to 0.5%.
      
      In addition to the performance benefits, this patch closes races that are
      possible between:
      
      a) get_ and set_pageblock_migratetype(), where get_pageblock_migratetype()
         reads part of the bits before and other part of the bits after
         set_pageblock_migratetype() has updated them.
      
      b) set_pageblock_migratetype() and set_pageblock_skip(), where the non-atomic
         read-modify-update set bit operation in set_pageblock_skip() will cause
         lost updates to some bits changed in the set_pageblock_migratetype().
      
      Joonsoo Kim first reported the case a) via code inspection.  Vlastimil
      Babka's testing with a debug patch showed that either a) or b) occurs
      roughly once per mmtests' stress-highalloc benchmark (although not
      necessarily in the same pageblock).  Furthermore during development of
      unrelated compaction patches, it was observed that frequent calls to
      {start,undo}_isolate_page_range() the race occurs several thousands of
      times and has resulted in NULL pointer dereferences in move_freepages()
      and free_one_page() in places where free_list[migratetype] is
      manipulated by e.g.  list_move().  Further debugging confirmed that
      migratetype had invalid value of 6, causing out of bounds access to the
      free_list array.
      
      That confirmed that the race exist, although it may be extremely rare,
      and currently only fatal where page isolation is performed due to
      memory hot remove.  Races on pageblocks being updated by
      set_pageblock_migratetype(), where both old and new migratetype are
      lower MIGRATE_RESERVE, currently cannot result in an invalid value
      being observed, although theoretically they may still lead to
      unexpected creation or destruction of MIGRATE_RESERVE pageblocks.
      Furthermore, things could get suddenly worse when memory isolation is
      used more, or when new migratetypes are added.
      
      After this patch, the race has no longer been observed in testing.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Reported-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Reported-and-tested-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      4d6dd826
    • Mel Gorman's avatar
      mm: vmscan: do not throttle based on pfmemalloc reserves if node has no ZONE_NORMAL · c4c34dd6
      Mel Gorman authored
      commit 675becce upstream.
      
      throttle_direct_reclaim() is meant to trigger during swap-over-network
      during which the min watermark is treated as a pfmemalloc reserve.  It
      throttes on the first node in the zonelist but this is flawed.
      
      The user-visible impact is that a process running on CPU whose local
      memory node has no ZONE_NORMAL will stall for prolonged periods of time,
      possibly indefintely.  This is due to throttle_direct_reclaim thinking the
      pfmemalloc reserves are depleted when in fact they don't exist on that
      node.
      
      On a NUMA machine running a 32-bit kernel (I know) allocation requests
      from CPUs on node 1 would detect no pfmemalloc reserves and the process
      gets throttled.  This patch adjusts throttling of direct reclaim to
      throttle based on the first node in the zonelist that has a usable
      ZONE_NORMAL or lower zone.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      c4c34dd6
    • Naoya Horiguchi's avatar
      hugetlb: restrict hugepage_migration_support() to x86_64 · 79e24e2e
      Naoya Horiguchi authored
      commit c177c81e upstream.
      
      Currently hugepage migration is available for all archs which support
      pmd-level hugepage, but testing is done only for x86_64 and there're
      bugs for other archs.  So to avoid breaking such archs, this patch
      limits the availability strictly to x86_64 until developers of other
      archs get interested in enabling this feature.
      
      Simply disabling hugepage migration on non-x86_64 archs is not enough to
      fix the reported problem where sys_move_pages() hits the BUG_ON() in
      follow_page(FOLL_GET), so let's fix this by checking if hugepage
      migration is supported in vma_migratable().
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Reported-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Tested-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      79e24e2e
    • Johan Hovold's avatar
      USB: option: fix runtime PM handling · c676dde1
      Johan Hovold authored
      commit acf47d4f upstream.
      
      Fix potential I/O while runtime suspended due to missing PM operations
      in send_setup.
      
      Fixes: 383cedc3 ("USB: serial: full autosuspend support for the
      option driver")
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      c676dde1
    • Alan Stern's avatar
      USB: EHCI: avoid BIOS handover on the HASEE E200 · 42103716
      Alan Stern authored
      commit b0a50e92 upstream.
      
      Leandro Liptak reports that his HASEE E200 computer hangs when we ask
      the BIOS to hand over control of the EHCI host controller.  This
      definitely sounds like a bug in the BIOS, but at the moment there is
      no way to fix it.
      
      This patch works around the problem by avoiding the handoff whenever
      the motherboard and BIOS version match those of Leandro's computer.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarLeandro Liptak <leandroliptak@gmail.com>
      Tested-by: default avatarLeandro Liptak <leandroliptak@gmail.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      42103716
    • Paul Bolle's avatar
      ARM: OMAP: replace checks for CONFIG_USB_GADGET_OMAP · 01a0cb5e
      Paul Bolle authored
      commit 77c2f02e upstream.
      
      Commit 193ab2a6 ("usb: gadget: allow multiple gadgets to be built")
      apparently required that checks for CONFIG_USB_GADGET_OMAP would be
      replaced with checks for CONFIG_USB_OMAP. Do so now for the remaining
      checks for CONFIG_USB_GADGET_OMAP, even though these checks have
      basically been broken since v3.1.
      
      And, since we're touching this code, use the IS_ENABLED() macro, so
      things will now (hopefully) also work if USB_OMAP is modular.
      
      Fixes: 193ab2a6 ("usb: gadget: allow multiple gadgets to be built")
      Signed-off-by: default avatarPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      01a0cb5e
    • Felipe Balbi's avatar
      usb: dwc3: gadget: clear stall when disabling endpoint · f32574c5
      Felipe Balbi authored
      commit 687ef981 upstream.
      
      so it seems like DWC3 IP doesn't clear stalls
      automatically when we disable an endpoint, because
      of that, we _must_ make sure stalls are cleared
      before clearing the proper bit in DALEPENA register.
      Reported-by: default avatarJohannes Stezenbach <js@sig21.net>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      f32574c5
    • Paul Bolle's avatar
      usb: gadget: rename CONFIG_USB_GADGET_PXA25X · 4f63298b
      Paul Bolle authored
      commit d30f2065 upstream.
      
      Commit 193ab2a6 ("usb: gadget: allow multiple gadgets to be built")
      basically renamed the Kconfig symbol USB_GADGET_PXA25X to USB_PXA25X. It
      did not rename the related macros in use at that time. Commit
      c0a39151 ("ARM: pxa: fix inconsistent CONFIG_USB_PXA27X") did so for
      all but one macro. Rename that last macro too now.
      
      Fixes: 193ab2a6 ("usb: gadget: allow multiple gadgets to be built")
      Signed-off-by: default avatarPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      4f63298b
    • Alan Stern's avatar
      USB: usbtest: add a timeout for scatter-gather tests · c0c1bcdd
      Alan Stern authored
      commit 32b36eea upstream.
      
      In usbtest, tests 5 - 8 use the scatter-gather library in usbcore
      without any sort of timeout.  If there's a problem in the gadget or
      host controller being tested, the test can hang.
      
      This patch adds a 10-second timeout to the tests, so that they will
      fail gracefully with an ETIMEDOUT error instead of hanging.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarHuang Rui <ray.huang@amd.com>
      Tested-by: default avatarHuang Rui <ray.huang@amd.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      c0c1bcdd
    • Huang Rui's avatar
      usb: usbtest: fix unlink write error with pattern 1 · cdd3452f
      Huang Rui authored
      commit e4d58f5d upstream.
      
      TEST 12 and TEST 24 unlinks the URB write request for N times. When
      host and gadget both initialize pattern 1 (mod 63) data series to
      transfer, the gadget side will complain the wrong data which is not
      expected.  Because in host side, usbtest doesn't fill the data buffer
      as mod 63 and this patch fixed it.
      
      [20285.488974] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready
      [20285.489181] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Not Active
      [20285.489423] dwc3 dwc3.0.auto: ep1out-bulk: req ffff8800aa6cb480 dma aeb50800 length 512 last
      [20285.489727] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Start Transfer' params 00000000 a9eaf000 00000000
      [20285.490055] dwc3 dwc3.0.auto: Command Complete --> 0
      [20285.490281] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready
      [20285.490492] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Active
      [20285.490713] dwc3 dwc3.0.auto: ep1out-bulk: endpoint busy
      [20285.490909] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Complete
      [20285.491117] dwc3 dwc3.0.auto: request ffff8800aa6cb480 from ep1out-bulk completed 512/512 ===> 0
      [20285.491431] zero gadget: bad OUT byte, buf[1] = 0
      [20285.491605] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Set Stall' params 00000000 00000000 00000000
      [20285.491915] dwc3 dwc3.0.auto: Command Complete --> 0
      [20285.492099] dwc3 dwc3.0.auto: queing request ffff8800aa6cb480 to ep1out-bulk length 512
      [20285.492387] dwc3 dwc3.0.auto: ep1out-bulk: Transfer Not Ready
      [20285.492595] dwc3 dwc3.0.auto: ep1out-bulk: reason Transfer Not Active
      [20285.492830] dwc3 dwc3.0.auto: ep1out-bulk: req ffff8800aa6cb480 dma aeb51000 length 512 last
      [20285.493135] dwc3 dwc3.0.auto: ep1out-bulk: cmd 'Start Transfer' params 00000000 a9eaf000 00000000
      [20285.493465] dwc3 dwc3.0.auto: Command Complete --> 0
      Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      cdd3452f
    • Dan Carpenter's avatar
      applicom: dereferencing NULL on error path · 5289d91f
      Dan Carpenter authored
      commit 8bab797c upstream.
      
      This is a static checker fix.  The "dev" variable is always NULL after
      the while statement so we would be dereferencing a NULL pointer here.
      
      Fixes: 819a3eba ('[PATCH] applicom: fix error handling')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      5289d91f
    • Dan Carpenter's avatar
      Staging: rtl8188eu: overflow in update_sta_support_rate() · 6493b822
      Dan Carpenter authored
      commit 9dbd79ae upstream.
      
      The ->SupportedRates[] array has NDIS_802_11_LENGTH_RATES_EX (16)
      elements.  Since "ie_len" comes from then network and can go up to 255
      then it means we should add a range check to prevent memory corruption.
      
      Fixes: d6846af6 ('staging: r8188eu: Add files for new driver - part 7')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      6493b822