1. 03 Mar, 2018 40 commits
    • Hans Verkuil's avatar
      adv7604: use correct drive strength defines · 98dc7e90
      Hans Verkuil authored
      The prefix is ADV7604_, not ADV76XX.
      
      Fixes: f31b62e1
      
       ("adv7604: add hdmi driver strength adjustment")
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      98dc7e90
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: add capabilities field to, v4l2_input32 · f9b33d1f
      Hans Verkuil authored
      commit 037e0865
      
       upstream.
      
      The v4l2_input32 struct wasn't updated when this field was added.
      It didn't cause a failure in the compat code, but it is better to
      keep it in sync with v4l2_input to avoid confusion.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f9b33d1f
    • Tiffany Lin's avatar
      media: v4l2-compat-ioctl32: fix missing reserved field copy in put_v4l2_create32 · bd4e8dc0
      Tiffany Lin authored
      commit baf43c6e
      
       upstream.
      
      In v4l2-compliance utility, test VIDIOC_CREATE_BUFS will check whether reserved
      filed of v4l2_create_buffers filled with zero
      Reserved field is filled with zero in v4l_create_bufs.
      This patch copy reserved field of v4l2_create_buffer from kernel space to user
      space
      Signed-off-by: default avatarTiffany Lin <tiffany.lin@mediatek.com>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      bd4e8dc0
    • Guennadi Liakhovetski's avatar
      V4L2: fix VIDIOC_CREATE_BUFS 32-bit compatibility mode data copy-back · 99d5e1c4
      Guennadi Liakhovetski authored
      commit 6ed9b285
      
       upstream.
      
      Similar to an earlier patch, fixing reading user-space data for the
      VIDIOC_CREATE_BUFS ioctl() in 32-bit compatibility mode, this patch fixes
      writing back of the possibly modified struct to the user. However, unlike
      the former bug, this one is much less harmful, because it only results in
      the kernel failing to write the .type field back to the user, but in fact
      this is likely unneeded, because the kernel will hardly want to change
      that field. Therefore this bug is more of a theoretical nature.
      Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
      Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      99d5e1c4
    • Hans Verkuil's avatar
      v4l2-compat-ioctl32: fix sparse warnings · 64a2bd74
      Hans Verkuil authored
      commit 8ae632b1
      
       upstream.
      
      A lot of these warnings are caused by the fact that we don't generally use
      __user in videodev2.h. Normally the video_usercopy function will copy anything
      pointed to by pointers into kernel space, so having __user in the struct will only
      cause lots of warnings in the drivers. But the flip side of that is that you
      need to add __force casts here.
      
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:337:26: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:337:30: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:338:31: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:338:49: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:343:21: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:346:21: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:349:35: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:349:46: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:352:35: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:352:54: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:363:26: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:363:32: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:364:31: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:364:51: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:371:35: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:371:56: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:376:35: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:376:48: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:430:30: warning: incorrect type in assignment (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:433:48: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:433:56: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:501:24: warning: incorrect type in assignment (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:507:48: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:507:56: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:565:18: warning: incorrect type in assignment (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:670:22: warning: incorrect type in assignment (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:680:29: warning: incorrect type in assignment (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:692:55: warning: incorrect type in initializer (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:773:18: warning: incorrect type in assignment (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:786:30: warning: incorrect type in argument 1 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:786:44: warning: incorrect type in argument 2 (different address spaces)
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:674:37: warning: dereference of noderef expression
      drivers/media/v4l2-core/v4l2-compat-ioctl32.c:718:37: warning: dereference of noderef expression
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      64a2bd74
    • Ming Lei's avatar
      blk-mq: fix race between timeout and freeing request · 7acba7c0
      Ming Lei authored
      commit 0048b483
      
       upstream.
      
      Inside timeout handler, blk_mq_tag_to_rq() is called
      to retrieve the request from one tag. This way is obviously
      wrong because the request can be freed any time and some
      fiedds of the request can't be trusted, then kernel oops
      might be triggered[1].
      
      Currently wrt. blk_mq_tag_to_rq(), the only special case is
      that the flush request can share same tag with the request
      cloned from, and the two requests can't be active at the same
      time, so this patch fixes the above issue by updating tags->rqs[tag]
      with the active request(either flush rq or the request cloned
      from) of the tag.
      
      Also blk_mq_tag_to_rq() gets much simplified with this patch.
      
      Given blk_mq_tag_to_rq() is mainly for drivers and the caller must
      make sure the request can't be freed, so in bt_for_each() this
      helper is replaced with tags->rqs[tag].
      
      [1] kernel oops log
      [  439.696220] BUG: unable to handle kernel NULL pointer dereference at 0000000000000158^M
      [  439.697162] IP: [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M
      [  439.700653] PGD 7ef765067 PUD 7ef764067 PMD 0 ^M
      [  439.700653] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC ^M
      [  439.700653] Dumping ftrace buffer:^M
      [  439.700653]    (ftrace buffer empty)^M
      [  439.700653] Modules linked in: nbd ipv6 kvm_intel kvm serio_raw^M
      [  439.700653] CPU: 6 PID: 2779 Comm: stress-ng-sigfd Not tainted 4.2.0-rc5-next-20150805+ #265^M
      [  439.730500] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011^M
      [  439.730500] task: ffff880605308000 ti: ffff88060530c000 task.ti: ffff88060530c000^M
      [  439.730500] RIP: 0010:[<ffffffff812d89ba>]  [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M
      [  439.730500] RSP: 0018:ffff880819203da0  EFLAGS: 00010283^M
      [  439.730500] RAX: ffff880811b0e000 RBX: ffff8800bb465f00 RCX: 0000000000000002^M
      [  439.730500] RDX: 0000000000000000 RSI: 0000000000000202 RDI: 0000000000000000^M
      [  439.730500] RBP: ffff880819203db0 R08: 0000000000000002 R09: 0000000000000000^M
      [  439.730500] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000202^M
      [  439.730500] R13: ffff880814104800 R14: 0000000000000002 R15: ffff880811a2ea00^M
      [  439.730500] FS:  00007f165b3f5740(0000) GS:ffff880819200000(0000) knlGS:0000000000000000^M
      [  439.730500] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b^M
      [  439.730500] CR2: 0000000000000158 CR3: 00000007ef766000 CR4: 00000000000006e0^M
      [  439.730500] Stack:^M
      [  439.730500]  0000000000000008 ffff8808114eed90 ffff880819203e00 ffffffff812dc104^M
      [  439.755663]  ffff880819203e40 ffffffff812d9f5e 0000020000000000 ffff8808114eed80^M
      [  439.755663] Call Trace:^M
      [  439.755663]  <IRQ> ^M
      [  439.755663]  [<ffffffff812dc104>] bt_for_each+0x6e/0xc8^M
      [  439.755663]  [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M
      [  439.755663]  [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M
      [  439.755663]  [<ffffffff812dc1b3>] blk_mq_tag_busy_iter+0x55/0x5e^M
      [  439.755663]  [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M
      [  439.755663]  [<ffffffff812d8911>] blk_mq_rq_timer+0x5d/0xd4^M
      [  439.755663]  [<ffffffff810a3e10>] call_timer_fn+0xf7/0x284^M
      [  439.755663]  [<ffffffff810a3d1e>] ? call_timer_fn+0x5/0x284^M
      [  439.755663]  [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M
      [  439.755663]  [<ffffffff810a46d6>] run_timer_softirq+0x1ce/0x1f8^M
      [  439.755663]  [<ffffffff8104c367>] __do_softirq+0x181/0x3a4^M
      [  439.755663]  [<ffffffff8104c76e>] irq_exit+0x40/0x94^M
      [  439.755663]  [<ffffffff81031482>] smp_apic_timer_interrupt+0x33/0x3e^M
      [  439.755663]  [<ffffffff815559a4>] apic_timer_interrupt+0x84/0x90^M
      [  439.755663]  <EOI> ^M
      [  439.755663]  [<ffffffff81554350>] ? _raw_spin_unlock_irq+0x32/0x4a^M
      [  439.755663]  [<ffffffff8106a98b>] finish_task_switch+0xe0/0x163^M
      [  439.755663]  [<ffffffff8106a94d>] ? finish_task_switch+0xa2/0x163^M
      [  439.755663]  [<ffffffff81550066>] __schedule+0x469/0x6cd^M
      [  439.755663]  [<ffffffff8155039b>] schedule+0x82/0x9a^M
      [  439.789267]  [<ffffffff8119b28b>] signalfd_read+0x186/0x49a^M
      [  439.790911]  [<ffffffff8106d86a>] ? wake_up_q+0x47/0x47^M
      [  439.790911]  [<ffffffff811618c2>] __vfs_read+0x28/0x9f^M
      [  439.790911]  [<ffffffff8117a289>] ? __fget_light+0x4d/0x74^M
      [  439.790911]  [<ffffffff811620a7>] vfs_read+0x7a/0xc6^M
      [  439.790911]  [<ffffffff8116292b>] SyS_read+0x49/0x7f^M
      [  439.790911]  [<ffffffff81554c17>] entry_SYSCALL_64_fastpath+0x12/0x6f^M
      [  439.790911] Code: 48 89 e5 e8 a9 b8 e7 ff 5d c3 0f 1f 44 00 00 55 89
      f2 48 89 e5 41 54 41 89 f4 53 48 8b 47 60 48 8b 1c d0 48 8b 7b 30 48 8b
      53 38 <48> 8b 87 58 01 00 00 48 85 c0 75 09 48 8b 97 88 0c 00 00 eb 10
      ^M
      [  439.790911] RIP  [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M
      [  439.790911]  RSP <ffff880819203da0>^M
      [  439.790911] CR2: 0000000000000158^M
      [  439.790911] ---[ end trace d40af58949325661 ]---^M
      Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      [bwh: Backported to 3.16:
       - Flush state is in struct request_queue, not struct blk_flush_queue
       - Flush request cloning is done in blk_mq_clone_flush_request() rather
         than blk_kick_flush()
       - Drop changes in bt{,_tags}_for_each()
       - Adjust filename, context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      7acba7c0
    • Andrew Bresticker's avatar
      mac80211_hwsim: fix compiler warning on MIPS · 79e66041
      Andrew Bresticker authored
      commit 5d26b508
      
       upstream.
      
      The dividend in do_div() is expected to be an unsigned 64-bit integer,
      which leads to the following warning when building for 32-bit MIPS:
      
        drivers/net/wireless/mac80211_hwsim.c: In function 'mac80211_hwsim_set_tsf':
        drivers/net/wireless/mac80211_hwsim.c:664:98: warning: comparison of distinct pointer types lacks a cast [enabled by default]
          data->bcn_delta = do_div(delta, bcn_int);
      
      Since we care about the signedness of delta when adjusting tsf_offset
      and bcm_delta, use the absolute value for the division and compare
      the two timestamps to determine the sign.
      Signed-off-by: default avatarAndrew Bresticker <abrestic@chromium.org>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      79e66041
    • Petri Gynther's avatar
      net: bcmgenet: fix bcmgenet_open() · 95b5d4fc
      Petri Gynther authored
      commit fac25940
      
       upstream.
      
      If bcmgenet_init_dma() fails, it cleans up after itself. Rx and Tx
      DMAs are off, and NAPI instances haven't been netif_napi_add()'ed.
      Therefore, we need to skip calling bcmgenet_fini_dma() on the error
      handling path. bcmgenet_resume() already does this correctly.
      Signed-off-by: default avatarPetri Gynther <pgynther@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      95b5d4fc
    • Ben Hutchings's avatar
      of: fdt: Fix return with value in void function · 52f0b4f1
      Ben Hutchings authored
      Commit 49e67dd1
      
       "of: fdt: add missing allocation-failure check"
      added a "return NULL" statement in __unflatten_device_tree().  When
      applied to the 3.16-stable branch, this introduced a compiler warning
      (not an error!) because the function returns void here.
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      52f0b4f1
    • Thomas Gleixner's avatar
      hrtimer: Reset hrtimer cpu base proper on CPU hotplug · 491b0fc4
      Thomas Gleixner authored
      commit d5421ea4 upstream.
      
      The hrtimer interrupt code contains a hang detection and mitigation
      mechanism, which prevents that a long delayed hrtimer interrupt causes a
      continous retriggering of interrupts which prevent the system from making
      progress. If a hang is detected then the timer hardware is programmed with
      a certain delay into the future and a flag is set in the hrtimer cpu base
      which prevents newly enqueued timers from reprogramming the timer hardware
      prior to the chosen delay. The subsequent hrtimer interrupt after the delay
      clears the flag and resumes normal operation.
      
      If such a hang happens in the last hrtimer interrupt before a CPU is
      unplugged then the hang_detected flag is set and stays that way when the
      CPU is plugged in again. At that point the timer hardware is not armed and
      it cannot be armed because the hang_detected flag is still active, so
      nothing clears that flag. As a consequence the CPU does not receive hrtimer
      interrupts and no timers expire on that CPU which results in RCU stalls and
      other malfunctions.
      
      Clear the flag along with some other less critical members of the hrtimer
      cpu base to ensure starting from a clean state when a CPU is plugged in.
      
      Thanks to Paul, Sebastian and Anna-Maria for their help to get down to the
      root cause of that hard to reproduce heisenbug. Once understood it's
      trivial and certainly justifies a brown paperbag.
      
      Fixes: 41d2e494
      
       ("hrtimer: Tune hrtimer_interrupt hang logic")
      Reported-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Sewior <bigeasy@linutronix.de>
      Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
      Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801261447590.2067@nanos
      
      
      [bwh: Backported to 3.16:
       - There's no next_timer field to reset
       - Adjust filename, context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      491b0fc4
    • Alexey Kodanev's avatar
      dccp: don't restart ccid2_hc_tx_rto_expire() if sk in closed state · e67eb710
      Alexey Kodanev authored
      commit dd5684ec upstream.
      
      ccid2_hc_tx_rto_expire() timer callback always restarts the timer
      again and can run indefinitely (unless it is stopped outside), and after
      commit 120e9dab ("dccp: defer ccid_hc_tx_delete() at dismantle time"),
      which moved ccid_hc_tx_delete() (also includes sk_stop_timer()) from
      dccp_destroy_sock() to sk_destruct(), this started to happen quite often.
      The timer prevents releasing the socket, as a result, sk_destruct() won't
      be called.
      
      Found with LTP/dccp_ipsec tests running on the bonding device,
      which later couldn't be unloaded after the tests were completed:
      
        unregister_netdevice: waiting for bond0 to become free. Usage count = 148
      
      Fixes: 2a91aa39
      
       ("[DCCP] CCID2: Initial CCID2 (TCP-Like) implementation")
      Signed-off-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e67eb710
    • Jia Zhang's avatar
      x86/microcode/intel: Extend BDW late-loading further with LLC size check · 3ff8643e
      Jia Zhang authored
      commit 7e702d17 upstream.
      
      Commit b94b7373 ("x86/microcode/intel: Extend BDW late-loading with a
      revision check") reduced the impact of erratum BDF90 for Broadwell model
      79.
      
      The impact can be reduced further by checking the size of the last level
      cache portion per core.
      
      Tony: "The erratum says the problem only occurs on the large-cache SKUs.
      So we only need to avoid the update if we are on a big cache SKU that is
      also running old microcode."
      
      For more details, see erratum BDF90 in document #334165 (Intel Xeon
      Processor E7-8800/4800 v4 Product Family Specification Update) from
      September 2017.
      
      Fixes: b94b7373
      
       ("x86/microcode/intel: Extend BDW late-loading with a revision check")
      Signed-off-by: default avatarJia Zhang <zhang.jia@linux.alibaba.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarTony Luck <tony.luck@intel.com>
      Link: https://lkml.kernel.org/r/1516321542-31161-1-git-send-email-zhang.jia@linux.alibaba.com
      
      
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3ff8643e
    • Guillaume Nault's avatar
      pppoe: take ->needed_headroom of lower device into account on xmit · 7b400f4d
      Guillaume Nault authored
      commit 02612bb0 upstream.
      
      In pppoe_sendmsg(), reserving dev->hard_header_len bytes of headroom
      was probably fine before the introduction of ->needed_headroom in
      commit f5184d26 ("net: Allow netdevices to specify needed head/tailroom").
      
      But now, virtual devices typically advertise the size of their overhead
      in dev->needed_headroom, so we must also take it into account in
      skb_reserve().
      Allocation size of skb is also updated to take dev->needed_tailroom
      into account and replace the arbitrary 32 bytes with the real size of
      a PPPoE header.
      
      This issue was discovered by syzbot, who connected a pppoe socket to a
      gre device which had dev->header_ops->create == ipgre_header and
      dev->hard_header_len == 0. Therefore, PPPoE didn't reserve any
      headroom, and dev_hard_header() crashed when ipgre_header() tried to
      prepend its header to skb->data.
      
      skbuff: skb_under_panic: text:000000001d390b3a len:31 put:24
      head:00000000d8ed776f data:000000008150e823 tail:0x7 end:0xc0 dev:gre0
      ------------[ cut here ]------------
      kernel BUG at net/core/skbuff.c:104!
      invalid opcode: 0000 [#1] SMP KASAN
      Dumping ftrace buffer:
          (ftrace buffer empty)
      Modules linked in:
      CPU: 1 PID: 3670 Comm: syzkaller801466 Not tainted
      4.15.0-rc7-next-20180115+ #97
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 01/01/2011
      RIP: 0010:skb_panic+0x162/0x1f0 net/core/skbuff.c:100
      RSP: 0018:ffff8801d9bd7840 EFLAGS: 00010282
      RAX: 0000000000000083 RBX: ffff8801d4f083c0 RCX: 0000000000000000
      RDX: 0000000000000083 RSI: 1ffff1003b37ae92 RDI: ffffed003b37aefc
      RBP: ffff8801d9bd78a8 R08: 1ffff1003b37ae8a R09: 0000000000000000
      R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff86200de0
      R13: ffffffff84a981ad R14: 0000000000000018 R15: ffff8801d2d34180
      FS:  00000000019c4880(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000208bc000 CR3: 00000001d9111001 CR4: 00000000001606e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
        skb_under_panic net/core/skbuff.c:114 [inline]
        skb_push+0xce/0xf0 net/core/skbuff.c:1714
        ipgre_header+0x6d/0x4e0 net/ipv4/ip_gre.c:879
        dev_hard_header include/linux/netdevice.h:2723 [inline]
        pppoe_sendmsg+0x58e/0x8b0 drivers/net/ppp/pppoe.c:890
        sock_sendmsg_nosec net/socket.c:630 [inline]
        sock_sendmsg+0xca/0x110 net/socket.c:640
        sock_write_iter+0x31a/0x5d0 net/socket.c:909
        call_write_iter include/linux/fs.h:1775 [inline]
        do_iter_readv_writev+0x525/0x7f0 fs/read_write.c:653
        do_iter_write+0x154/0x540 fs/read_write.c:932
        vfs_writev+0x18a/0x340 fs/read_write.c:977
        do_writev+0xfc/0x2a0 fs/read_write.c:1012
        SYSC_writev fs/read_write.c:1085 [inline]
        SyS_writev+0x27/0x30 fs/read_write.c:1082
        entry_SYSCALL_64_fastpath+0x29/0xa0
      
      Admittedly PPPoE shouldn't be allowed to run on non Ethernet-like
      interfaces, but reserving space for ->needed_headroom is a more
      fundamental issue that needs to be addressed first.
      
      Same problem exists for __pppoe_xmit(), which also needs to take
      dev->needed_headroom into account in skb_cow_head().
      
      Fixes: f5184d26
      
       ("net: Allow netdevices to specify needed head/tailroom")
      Reported-by: syzbot+ed0838d0fa4c4f2b528e20286e6dc63effc7c14d@syzkaller.appspotmail.com
      Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
      Reviewed-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      7b400f4d
    • Aaron Ma's avatar
      Input: trackpoint - force 3 buttons if 0 button is reported · 4a6e9e32
      Aaron Ma authored
      commit f5d07b9e
      
       upstream.
      
      Lenovo introduced trackpoint compatible sticks with minimum PS/2 commands.
      They supposed to reply with 0x02, 0x03, or 0x04 in response to the
      "Read Extended ID" command, so we would know not to try certain extended
      commands. Unfortunately even some trackpoints reporting the original IBM
      version (0x01 firmware 0x0e) now respond with incorrect data to the "Get
      Extended Buttons" command:
      
       thinkpad_acpi: ThinkPad BIOS R0DET87W (1.87 ), EC unknown
       thinkpad_acpi: Lenovo ThinkPad E470, model 20H1004SGE
      
       psmouse serio2: trackpoint: IBM TrackPoint firmware: 0x0e, buttons: 0/0
      
      Since there are no trackpoints without buttons, let's assume the trackpoint
      has 3 buttons when we get 0 response to the extended buttons query.
      Signed-off-by: default avatarAaron Ma <aaron.ma@canonical.com>
      Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=196253
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4a6e9e32
    • Oscar Campos's avatar
      Input: trackpoint - assume 3 buttons when buttons detection fails · dd7ae1d0
      Oscar Campos authored
      commit 293b915f
      
       upstream.
      
      Trackpoint buttons detection fails on ThinkPad 570 and 470 series,
      this makes the middle button of the trackpoint to not being recogized.
      As I don't believe there is any trackpoint with less than 3 buttons this
      patch just assumes three buttons when the extended button information
      read fails.
      Signed-off-by: default avatarOscar Campos <oscar.campos@member.fsf.org>
      Acked-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      dd7ae1d0
    • Felix Fietkau's avatar
      net: igmp: fix source address check for IGMPv3 reports · d01262f5
      Felix Fietkau authored
      commit ad23b750 upstream.
      
      Commit "net: igmp: Use correct source address on IGMPv3 reports"
      introduced a check to validate the source address of locally generated
      IGMPv3 packets.
      Instead of checking the local interface address directly, it uses
      inet_ifa_match(fl4->saddr, ifa), which checks if the address is on the
      local subnet (or equal to the point-to-point address if used).
      
      This breaks for point-to-point interfaces, so check against
      ifa->ifa_local directly.
      
      Cc: Kevin Cernekee <cernekee@chromium.org>
      Fixes: a46182b0
      
       ("net: igmp: Use correct source address on IGMPv3 reports")
      Reported-by: default avatarSebastian Gottschall <s.gottschall@dd-wrt.com>
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d01262f5
    • Kevin Cernekee's avatar
      net: igmp: Use correct source address on IGMPv3 reports · d3c38df3
      Kevin Cernekee authored
      commit a46182b0
      
       upstream.
      
      Closing a multicast socket after the final IPv4 address is deleted
      from an interface can generate a membership report that uses the
      source IP from a different interface.  The following test script, run
      from an isolated netns, reproduces the issue:
      
          #!/bin/bash
      
          ip link add dummy0 type dummy
          ip link add dummy1 type dummy
          ip link set dummy0 up
          ip link set dummy1 up
          ip addr add 10.1.1.1/24 dev dummy0
          ip addr add 192.168.99.99/24 dev dummy1
      
          tcpdump -U -i dummy0 &
          socat EXEC:"sleep 2" \
              UDP4-DATAGRAM:239.101.1.68:8889,ip-add-membership=239.0.1.68:10.1.1.1 &
      
          sleep 1
          ip addr del 10.1.1.1/24 dev dummy0
          sleep 5
          kill %tcpdump
      
      RFC 3376 specifies that the report must be sent with a valid IP source
      address from the destination subnet, or from address 0.0.0.0.  Add an
      extra check to make sure this is the case.
      Signed-off-by: default avatarKevin Cernekee <cernekee@chromium.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d3c38df3
    • Thomas Gleixner's avatar
      x86/mce: Make machine check speculation protected · 81619a39
      Thomas Gleixner authored
      commit 6f41c34d
      
       upstream.
      
      The machine check idtentry uses an indirect branch directly from the low
      level code. This evades the speculation protection.
      
      Replace it by a direct call into C code and issue the indirect call there
      so the compiler can apply the proper speculation protection.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarBorislav Petkov <bp@alien8.de>
      Reviewed-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
      Niced-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801181626290.1847@nanos
      
      
      [bwh: Backported to 3.16
       - #include <asm/traps.h> in mce.c
       - Adjust filename, context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      81619a39
    • Johannes Berg's avatar
      cfg80211: fix station info handling bugs · 993d55fc
      Johannes Berg authored
      commit 5762d7d3 upstream.
      
      Fix two places where the structure isn't initialized to zero,
      and thus can't be filled properly by the driver.
      
      Fixes: 4a4b8169 ("cfg80211: Accept multiple RSSI thresholds for CQM")
      Fixes: 9930380f
      
       ("cfg80211: implement IWRATE")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [bwh: Backported to 3.16: drop change in cfg80211_cqm_rssi_update()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      993d55fc
    • Marc Kleine-Budde's avatar
      can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once · 75b43780
      Marc Kleine-Budde authored
      commit d4689846
      
       upstream.
      
      If an invalid CANFD frame is received, from a driver or from a tun
      interface, a Kernel warning is generated.
      
      This patch replaces the WARN_ONCE by a simple pr_warn_once, so that a
      kernel, bootet with panic_on_warn, does not panic. A printk seems to be
      more appropriate here.
      
      Reported-by: syzbot+e3b775f40babeff6e68b@syzkaller.appspotmail.com
      Suggested-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      [bwh: Backported to 3.16:
       - Keep using the 'drop' label, as it has another user
       - Adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      75b43780
    • Marc Kleine-Budde's avatar
      can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once · 0d8fccb2
      Marc Kleine-Budde authored
      commit 8cb68751
      
       upstream.
      
      If an invalid CAN frame is received, from a driver or from a tun
      interface, a Kernel warning is generated.
      
      This patch replaces the WARN_ONCE by a simple pr_warn_once, so that a
      kernel, bootet with panic_on_warn, does not panic. A printk seems to be
      more appropriate here.
      
      Reported-by: syzbot+4386709c0c1284dca827@syzkaller.appspotmail.com
      Suggested-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      [bwh: Backported to 3.16:
       - Keep using the 'drop' label, as it has another user
       - Adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0d8fccb2
    • Christophe Leroy's avatar
      net: fs_enet: do not call phy_stop() in interrupts · 13b9af48
      Christophe Leroy authored
      commit f8b39039 upstream.
      
      In case of TX timeout, fs_timeout() calls phy_stop(), which
      triggers the following BUG_ON() as we are in interrupt.
      
      [92708.199889] kernel BUG at drivers/net/phy/mdio_bus.c:482!
      [92708.204985] Oops: Exception in kernel mode, sig: 5 [#1]
      [92708.210119] PREEMPT
      [92708.212107] CMPC885
      [92708.214216] CPU: 0 PID: 3 Comm: ksoftirqd/0 Tainted: G        W       4.9.61 #39
      [92708.223227] task: c60f0a40 task.stack: c6104000
      [92708.227697] NIP: c02a84bc LR: c02a947c CTR: c02a93d8
      [92708.232614] REGS: c6105c70 TRAP: 0700   Tainted: G        W        (4.9.61)
      [92708.241193] MSR: 00021032 <ME,IR,DR,RI>[92708.244818]   CR: 24000822  XER: 20000000
      [92708.248767]
      GPR00: c02a947c c6105d20 c60f0a40 c62b4c00 00000005 0000001f c069aad8 0001a688
      GPR08: 00000007 00000100 c02a93d8 00000000 000005fc 00000000 c6213240 c06338e4
      GPR16: 00000001 c06330d4 c0633094 00000000 c0680000 c6104000 c6104000 00000000
      GPR24: 00000200 00000000 ffffffff 00000004 00000078 00009032 00000000 c62b4c00
      NIP [c02a84bc] mdiobus_read+0x20/0x74
      [92708.281517] LR [c02a947c] kszphy_config_intr+0xa4/0xc4
      [92708.286547] Call Trace:
      [92708.288980] [c6105d20] [c6104000] 0xc6104000 (unreliable)
      [92708.294339] [c6105d40] [c02a947c] kszphy_config_intr+0xa4/0xc4
      [92708.300098] [c6105d50] [c02a5330] phy_stop+0x60/0x9c
      [92708.305007] [c6105d60] [c02c84d0] fs_timeout+0xdc/0x110
      [92708.310197] [c6105d80] [c035cd48] dev_watchdog+0x268/0x2a0
      [92708.315593] [c6105db0] [c0060288] call_timer_fn+0x34/0x17c
      [92708.321014] [c6105dd0] [c00605f0] run_timer_softirq+0x21c/0x2e4
      [92708.326887] [c6105e50] [c001e19c] __do_softirq+0xf4/0x2f4
      [92708.332207] [c6105eb0] [c001e3c8] run_ksoftirqd+0x2c/0x40
      [92708.337560] [c6105ec0] [c003b420] smpboot_thread_fn+0x1f0/0x258
      [92708.343405] [c6105ef0] [c003745c] kthread+0xbc/0xd0
      [92708.348217] [c6105f40] [c000c400] ret_from_kernel_thread+0x5c/0x64
      [92708.354275] Instruction dump:
      [92708.357207] 7c0803a6 bbc10018 38210020 4e800020 7c0802a6 9421ffe0 54290024 bfc10018
      [92708.364865] 90010024 7c7f1b78 81290008 552902ee <0f090000> 3bc3002c 7fc3f378 90810008
      [92708.372711] ---[ end trace 42b05441616fafd7 ]---
      
      This patch moves fs_timeout() actions into an async worker.
      
      Fixes: commit 48257c4f
      
       ("Add fs_enet ethernet network driver, for several embedded platforms")
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      13b9af48
    • Jeremy Compostella's avatar
      i2c: core-smbus: prevent stack corruption on read I2C_BLOCK_DATA · 4a6efb01
      Jeremy Compostella authored
      commit 89c6efa6
      
       upstream.
      
      On a I2C_SMBUS_I2C_BLOCK_DATA read request, if data->block[0] is
      greater than I2C_SMBUS_BLOCK_MAX + 1, the underlying I2C driver writes
      data out of the msgbuf1 array boundary.
      
      It is possible from a user application to run into that issue by
      calling the I2C_SMBUS ioctl with data.block[0] greater than
      I2C_SMBUS_BLOCK_MAX + 1.
      
      This patch makes the code compliant with
      Documentation/i2c/dev-interface by raising an error when the requested
      size is larger than 32 bytes.
      
      Call Trace:
       [<ffffffff8139f695>] dump_stack+0x67/0x92
       [<ffffffff811802a4>] panic+0xc5/0x1eb
       [<ffffffff810ecb5f>] ? vprintk_default+0x1f/0x30
       [<ffffffff817456d3>] ? i2cdev_ioctl_smbus+0x303/0x320
       [<ffffffff8109a68b>] __stack_chk_fail+0x1b/0x20
       [<ffffffff817456d3>] i2cdev_ioctl_smbus+0x303/0x320
       [<ffffffff81745aed>] i2cdev_ioctl+0x4d/0x1e0
       [<ffffffff811f761a>] do_vfs_ioctl+0x2ba/0x490
       [<ffffffff81336e43>] ? security_file_ioctl+0x43/0x60
       [<ffffffff811f7869>] SyS_ioctl+0x79/0x90
       [<ffffffff81a22e97>] entry_SYSCALL_64_fastpath+0x12/0x6a
      Signed-off-by: default avatarJeremy Compostella <jeremy.compostella@intel.com>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      [bwh: Backported to 3.16: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4a6efb01
    • Lixin Wang's avatar
      i2c: core: decrease reference count of device node in i2c_unregister_device · 3f8470bb
      Lixin Wang authored
      commit e0638fa4
      
       upstream.
      
      Reference count of device node was increased in of_i2c_register_device,
      but without decreasing it in i2c_unregister_device. Then the added
      device node will never be released. Fix this by adding the of_node_put.
      Signed-off-by: default avatarLixin Wang <alan.1.wang@nokia-sbell.com>
      Tested-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3f8470bb
    • Joe Thornber's avatar
      dm btree: fix serious bug in btree_split_beneath() · 8cbb486d
      Joe Thornber authored
      commit bc68d0a4 upstream.
      
      When inserting a new key/value pair into a btree we walk down the spine of
      btree nodes performing the following 2 operations:
      
        i) space for a new entry
        ii) adjusting the first key entry if the new key is lower than any in the node.
      
      If the _root_ node is full, the function btree_split_beneath() allocates 2 new
      nodes, and redistibutes the root nodes entries between them.  The root node is
      left with 2 entries corresponding to the 2 new nodes.
      
      btree_split_beneath() then adjusts the spine to point to one of the two new
      children.  This means the first key is never adjusted if the new key was lower,
      ie. operation (ii) gets missed out.  This can result in the new key being
      'lost' for a period; until another low valued key is inserted that will uncover
      it.
      
      This is a serious bug, and quite hard to make trigger in normal use.  A
      reproducing test case ("thin create devices-in-reverse-order") is
      available as part of the thin-provision-tools project:
        https://github.com/jthornber/thin-provisioning-tools/blob/master/functional-tests/device-mapper/dm-tests.scm#L593
      
      
      
      Fix the issue by changing btree_split_beneath() so it no longer adjusts
      the spine.  Instead it unlocks both the new nodes, and lets the main
      loop in btree_insert_raw() relock the appropriate one and make any
      neccessary adjustments.
      Reported-by: default avatarMonty Pavel <monty_pavel@sina.com>
      Signed-off-by: default avatarJoe Thornber <thornber@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8cbb486d
    • Dennis Yang's avatar
      dm thin metadata: THIN_MAX_CONCURRENT_LOCKS should be 6 · 86aeb765
      Dennis Yang authored
      commit 490ae017
      
       upstream.
      
      For btree removal, there is a corner case that a single thread
      could takes 6 locks which is more than THIN_MAX_CONCURRENT_LOCKS(5)
      and leads to deadlock.
      
      A btree removal might eventually call
      rebalance_children()->rebalance3() to rebalance entries of three
      neighbor child nodes when shadow_spine has already acquired two
      write locks. In rebalance3(), it tries to shadow and acquire the
      write locks of all three child nodes. However, shadowing a child
      node requires acquiring a read lock of the original child node and
      a write lock of the new block. Although the read lock will be
      released after block shadowing, shadowing the third child node
      in rebalance3() could still take the sixth lock.
      (2 write locks for shadow_spine +
       2 write locks for the first two child nodes's shadow +
       1 write lock for the last child node's shadow +
       1 read lock for the last child node)
      Signed-off-by: default avatarDennis Yang <dennisyang@qnap.com>
      Acked-by: default avatarJoe Thornber <thornber@redhat.com>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      86aeb765
    • Tianyu Lan's avatar
      KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs() · 8b5184f9
      Tianyu Lan authored
      commit 37b95951 upstream.
      
      kvm_valid_sregs() should use X86_CR0_PG and X86_CR4_PAE to check bit
      status rather than X86_CR0_PG_BIT and X86_CR4_PAE_BIT. This patch is
      to fix it.
      
      Fixes: f2981033
      
      (KVM/x86: Check input paging mode when cs.l is set)
      Reported-by: default avatarJeremi Piotrowski <jeremi.piotrowski@gmail.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Signed-off-by: default avatarTianyu Lan <Tianyu.Lan@microsoft.com>
      Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8b5184f9
    • Lan Tianyu's avatar
      KVM/x86: Check input paging mode when cs.l is set · c18241c1
      Lan Tianyu authored
      commit f2981033
      
       upstream.
      
      Reported by syzkaller:
          WARNING: CPU: 0 PID: 27962 at arch/x86/kvm/emulate.c:5631 x86_emulate_insn+0x557/0x15f0 [kvm]
          Modules linked in: kvm_intel kvm [last unloaded: kvm]
          CPU: 0 PID: 27962 Comm: syz-executor Tainted: G    B   W        4.15.0-rc2-next-20171208+ #32
          Hardware name: Intel Corporation S1200SP/S1200SP, BIOS S1200SP.86B.01.03.0006.040720161253 04/07/2016
          RIP: 0010:x86_emulate_insn+0x557/0x15f0 [kvm]
          RSP: 0018:ffff8807234476d0 EFLAGS: 00010282
          RAX: 0000000000000000 RBX: ffff88072d0237a0 RCX: ffffffffa0065c4d
          RDX: 1ffff100e5a046f9 RSI: 0000000000000003 RDI: ffff88072d0237c8
          RBP: ffff880723447728 R08: ffff88072d020000 R09: ffffffffa008d240
          R10: 0000000000000002 R11: ffffed00e7d87db3 R12: ffff88072d0237c8
          R13: ffff88072d023870 R14: ffff88072d0238c2 R15: ffffffffa008d080
          FS:  00007f8a68666700(0000) GS:ffff880802200000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: 000000002009506c CR3: 000000071fec4005 CR4: 00000000003626f0
          Call Trace:
           x86_emulate_instruction+0x3bc/0xb70 [kvm]
           ? reexecute_instruction.part.162+0x130/0x130 [kvm]
           vmx_handle_exit+0x46d/0x14f0 [kvm_intel]
           ? trace_event_raw_event_kvm_entry+0xe7/0x150 [kvm]
           ? handle_vmfunc+0x2f0/0x2f0 [kvm_intel]
           ? wait_lapic_expire+0x25/0x270 [kvm]
           vcpu_enter_guest+0x720/0x1ef0 [kvm]
           ...
      
      When CS.L is set, vcpu should run in the 64 bit paging mode.
      Current kvm set_sregs function doesn't have such check when
      userspace inputs sreg values. This will lead unexpected behavior.
      This patch is to add checks for CS.L, EFER.LME, EFER.LMA and
      CR4.PAE when get SREG inputs from userspace in order to avoid
      unexpected behavior.
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Jim Mattson <jmattson@google.com>
      Signed-off-by: default avatarTianyu Lan <tianyu.lan@intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c18241c1
    • Xin Long's avatar
      sctp: do not allow the v4 socket to bind a v4mapped v6 address · 782b8d5e
      Xin Long authored
      commit c5006b8a upstream.
      
      The check in sctp_sockaddr_af is not robust enough to forbid binding a
      v4mapped v6 addr on a v4 socket.
      
      The worse thing is that v4 socket's bind_verify would not convert this
      v4mapped v6 addr to a v4 addr. syzbot even reported a crash as the v4
      socket bound a v6 addr.
      
      This patch is to fix it by doing the common sa.sa_family check first,
      then AF_INET check for v4mapped v6 addrs.
      
      Fixes: 7dab83de
      
       ("sctp: Support ipv6only AF_INET6 sockets.")
      Reported-by: syzbot+7b7b518b1228d2743963@syzkaller.appspotmail.com
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      782b8d5e
    • Xin Long's avatar
      sctp: return error if the asoc has been peeled off in sctp_wait_for_sndbuf · acd29e66
      Xin Long authored
      commit a0ff6600 upstream.
      
      After commit cea0cc80 ("sctp: use the right sk after waking up from
      wait_buf sleep"), it may change to lock another sk if the asoc has been
      peeled off in sctp_wait_for_sndbuf.
      
      However, the asoc's new sk could be already closed elsewhere, as it's in
      the sendmsg context of the old sk that can't avoid the new sk's closing.
      If the sk's last one refcnt is held by this asoc, later on after putting
      this asoc, the new sk will be freed, while under it's own lock.
      
      This patch is to revert that commit, but fix the old issue by returning
      error under the old sk's lock.
      
      Fixes: cea0cc80
      
       ("sctp: use the right sk after waking up from wait_buf sleep")
      Reported-by: syzbot+ac6ea7baa4432811eb50@syzkaller.appspotmail.com
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      acd29e66
    • Xin Long's avatar
      sctp: use the right sk after waking up from wait_buf sleep · 1cff65db
      Xin Long authored
      commit cea0cc80 upstream.
      
      Commit dfcb9f4f
      
       ("sctp: deny peeloff operation on asocs with threads
      sleeping on it") fixed the race between peeloff and wait sndbuf by
      checking waitqueue_active(&asoc->wait) in sctp_do_peeloff().
      
      But it actually doesn't work, as even if waitqueue_active returns false
      the waiting sndbuf thread may still not yet hold sk lock. After asoc is
      peeled off, sk is not asoc->base.sk any more, then to hold the old sk
      lock couldn't make assoc safe to access.
      
      This patch is to fix this by changing to hold the new sk lock if sk is
      not asoc->base.sk, meanwhile, also set the sk in sctp_sendmsg with the
      new sk.
      
      With this fix, there is no more race between peeloff and waitbuf, the
      check 'waitqueue_active' in sctp_do_peeloff can be removed.
      
      Thanks Marcelo and Neil for making this clear.
      
      v1->v2:
        fix it by changing to lock the new sock instead of adding a flag in asoc.
      Suggested-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1cff65db
    • Marc Zyngier's avatar
      arm64: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls · 28155cb0
      Marc Zyngier authored
      commit acfb3b88
      
       upstream.
      
      KVM doesn't follow the SMCCC when it comes to unimplemented calls,
      and inject an UNDEF instead of returning an error. Since firmware
      calls are now used for security mitigation, they are becoming more
      common, and the undef is counter productive.
      
      Instead, let's follow the SMCCC which states that -1 must be returned
      to the caller when getting an unknown function number.
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
      [bwh: Backported to 3.16: use vcpu_reg()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      28155cb0
    • Johannes Berg's avatar
      cfg80211: check dev_set_name() return value · 04066350
      Johannes Berg authored
      commit 59b179b4 upstream.
      
      syzbot reported a warning from rfkill_alloc(), and after a while
      I think that the reason is that it was doing fault injection and
      the dev_set_name() failed, leaving the name NULL, and we didn't
      check the return value and got to rfkill_alloc() with a NULL name.
      Since we really don't want a NULL name, we ought to check the
      return value.
      
      Fixes: fb28ad35
      
       ("net: struct device - replace bus_id with dev_name(), dev_set_name()")
      Reported-by: syzbot+1ddfb3357e1d7bb5b5d3@syzkaller.appspotmail.com
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      04066350
    • Johannes Berg's avatar
      mac80211_hwsim: validate number of different channels · 764e9314
      Johannes Berg authored
      commit 51a1aaa6 upstream.
      
      When creating a new radio on the fly, hwsim allows this
      to be done with an arbitrary number of channels, but
      cfg80211 only supports a limited number of simultaneous
      channels, leading to a warning.
      
      Fix this by validating the number - this requires moving
      the define for the maximum out to a visible header file.
      
      Reported-by: syzbot+8dd9051ff19940290931@syzkaller.appspotmail.com
      Fixes: b59ec8dd
      
       ("mac80211_hwsim: fix number of channels in interface combinations")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      [bwh: Backported to 3.16:
       - Test chans intead of param.channels
       - GENL_SET_ERR_MSG() is not available
       - Adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      764e9314
    • Dominik Brodowski's avatar
      nl80211: take RCU read lock when calling ieee80211_bss_get_ie() · b47ac6da
      Dominik Brodowski authored
      commit 7a94b8c2 upstream.
      
      As ieee80211_bss_get_ie() derefences an RCU to return ssid_ie, both
      the call to this function and any operation on this variable need
      protection by the RCU read lock.
      
      Fixes: 44905265
      
       ("nl80211: don't expose wdev->ssid for most interfaces")
      Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b47ac6da
    • Li Jinyue's avatar
      futex: Prevent overflow by strengthen input validation · 762c02e6
      Li Jinyue authored
      commit fbe0e839
      
       upstream.
      
      UBSAN reports signed integer overflow in kernel/futex.c:
      
       UBSAN: Undefined behaviour in kernel/futex.c:2041:18
       signed integer overflow:
       0 - -2147483648 cannot be represented in type 'int'
      
      Add a sanity check to catch negative values of nr_wake and nr_requeue.
      Signed-off-by: default avatarLi Jinyue <lijinyue@huawei.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: peterz@infradead.org
      Cc: dvhart@infradead.org
      Link: https://lkml.kernel.org/r/1513242294-31786-1-git-send-email-lijinyue@huawei.com
      
      
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      762c02e6
    • Stefan Agner's avatar
      usb: misc: usb3503: make sure reset is low for at least 100us · d95b3638
      Stefan Agner authored
      commit b8626f1d
      
       upstream.
      
      When using a GPIO which is high by default, and initialize the
      driver in USB Hub mode, initialization fails with:
        [  111.757794] usb3503 0-0008: SP_ILOCK failed (-5)
      
      The reason seems to be that the chip is not properly reset.
      Probe does initialize reset low, however some lines later the
      code already set it back high, which is not long enouth.
      
      Make sure reset is asserted for at least 100us by inserting a
      delay after initializing the reset pin during probe.
      Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d95b3638
    • Andrew Honig's avatar
      KVM: x86: Add memory barrier on vmcs field lookup · 87689114
      Andrew Honig authored
      commit 75f139aa
      
       upstream.
      
      This adds a memory barrier when performing a lookup into
      the vmcs_field_to_offset_table.  This is related to
      CVE-2017-5753.
      Signed-off-by: default avatarAndrew Honig <ahonig@google.com>
      Reviewed-by: default avatarJim Mattson <jmattson@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      87689114
    • Takashi Iwai's avatar
      ALSA: pcm: Remove yet superfluous WARN_ON() · 1901ad4e
      Takashi Iwai authored
      commit 23b19b7b
      
       upstream.
      
      muldiv32() contains a snd_BUG_ON() (which is morphed as WARN_ON() with
      debug option) for checking the case of 0 / 0.  This would be helpful
      if this happens only as a logical error; however, since the hw refine
      is performed with any data set provided by user, the inconsistent
      values that can trigger such a condition might be passed easily.
      Actually, syzbot caught this by passing some zero'ed old hw_params
      ioctl.
      
      So, having snd_BUG_ON() there is simply superfluous and rather
      harmful to give unnecessary confusions.  Let's get rid of it.
      
      Reported-by: syzbot+7e6ee55011deeebce15d@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1901ad4e
    • Cong Wang's avatar
      8021q: fix a memory leak for VLAN 0 device · f0e95a37
      Cong Wang authored
      commit 78bbb15f
      
       upstream.
      
      A vlan device with vid 0 is allow to creat by not able to be fully
      cleaned up by unregister_vlan_dev() which checks for vlan_id!=0.
      
      Also, VLAN 0 is probably not a valid number and it is kinda
      "reserved" for HW accelerating devices, but it is probably too
      late to reject it from creation even if makes sense. Instead,
      just remove the check in unregister_vlan_dev().
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Fixes: ad1afb00
      
       ("vlan_dev: VLAN 0 should be treated as "no vlan tag" (802.1p packet)")
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f0e95a37