1. 19 Mar, 2018 5 commits
  2. 03 Mar, 2018 35 commits
    • Ben Hutchings's avatar
      Linux 3.16.55 · 3e50cd97
      Ben Hutchings authored
      3e50cd97
    • James Hogan's avatar
      MIPS: CPS: Fix MIPS_ISA_LEVEL_RAW fallout · 96455112
      James Hogan authored
      commit 8dbc1864 upstream.
      
      Commit 17278a91
      
       ("MIPS: CPS: Fix r1 .set mt assembler warning")
      added .set MIPS_ISA_LEVEL_RAW to silence warnings about .set mt on r1,
      however this can result in a MOVE being encoded as a 64-bit DADDU
      instruction on certain version of binutils (e.g. 2.22), and reserved
      instruction exceptions at runtime on 32-bit hardware.
      
      Reduce the sizes of the push/pop sections to include only instructions
      that are part of the MT ASE or which won't convert to 64-bit
      instructions after .set mips64r2/mips64r6.
      Reported-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
      Fixes: 17278a91
      
       ("MIPS: CPS: Fix r1 .set mt assembler warning")
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: linux-mips@linux-mips.org
      Tested-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
      Patchwork: https://patchwork.linux-mips.org/patch/18578/
      
      
      [bwh: Backported to 3.16: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      96455112
    • Yang Shunyong's avatar
      dmaengine: dmatest: fix container_of member in dmatest_callback · b11db6ef
      Yang Shunyong authored
      commit 66b3bd23 upstream.
      
      The type of arg passed to dmatest_callback is struct dmatest_done.
      It refers to test_done in struct dmatest_thread, not done_wait.
      
      Fixes: 6f6a23a2
      
       ("dmaengine: dmatest: move callback wait ...")
      Signed-off-by: default avatarYang Shunyong <shunyong.yang@hxt-semitech.com>
      Acked-by: default avatarAdam Wallis <awallis@codeaurora.org>
      Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b11db6ef
    • Håkon Bugge's avatar
      rds: Fix NULL pointer dereference in __rds_rdma_map · 39961200
      Håkon Bugge authored
      commit f3069c6d
      
       upstream.
      
      This is a fix for syzkaller719569, where memory registration was
      attempted without any underlying transport being loaded.
      
      Analysis of the case reveals that it is the setsockopt() RDS_GET_MR
      (2) and RDS_GET_MR_FOR_DEST (7) that are vulnerable.
      
      Here is an example stack trace when the bug is hit:
      
      BUG: unable to handle kernel NULL pointer dereference at 00000000000000c0
      IP: __rds_rdma_map+0x36/0x440 [rds]
      PGD 2f93d03067 P4D 2f93d03067 PUD 2f93d02067 PMD 0
      Oops: 0000 [#1] SMP
      Modules linked in: bridge stp llc tun rpcsec_gss_krb5 nfsv4
      dns_resolver nfs fscache rds binfmt_misc sb_edac intel_powerclamp
      coretemp kvm_intel kvm irqbypass crct10dif_pclmul c rc32_pclmul
      ghash_clmulni_intel pcbc aesni_intel crypto_simd glue_helper cryptd
      iTCO_wdt mei_me sg iTCO_vendor_support ipmi_si mei ipmi_devintf nfsd
      shpchp pcspkr i2c_i801 ioatd ma ipmi_msghandler wmi lpc_ich mfd_core
      auth_rpcgss nfs_acl lockd grace sunrpc ip_tables ext4 mbcache jbd2
      mgag200 i2c_algo_bit drm_kms_helper ixgbe syscopyarea ahci sysfillrect
      sysimgblt libahci mdio fb_sys_fops ttm ptp libata sd_mod mlx4_core drm
      crc32c_intel pps_core megaraid_sas i2c_core dca dm_mirror
      dm_region_hash dm_log dm_mod
      CPU: 48 PID: 45787 Comm: repro_set2 Not tainted 4.14.2-3.el7uek.x86_64 #2
      Hardware name: Oracle Corporation ORACLE SERVER X5-2L/ASM,MOBO TRAY,2U, BIOS 31110000 03/03/2017
      task: ffff882f9190db00 task.stack: ffffc9002b994000
      RIP: 0010:__rds_rdma_map+0x36/0x440 [rds]
      RSP: 0018:ffffc9002b997df0 EFLAGS: 00010202
      RAX: 0000000000000000 RBX: ffff882fa2182580 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffffc9002b997e40 RDI: ffff882fa2182580
      RBP: ffffc9002b997e30 R08: 0000000000000000 R09: 0000000000000002
      R10: ffff885fb29e3838 R11: 0000000000000000 R12: ffff882fa2182580
      R13: ffff882fa2182580 R14: 0000000000000002 R15: 0000000020000ffc
      FS:  00007fbffa20b700(0000) GS:ffff882fbfb80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000000000c0 CR3: 0000002f98a66006 CR4: 00000000001606e0
      Call Trace:
       rds_get_mr+0x56/0x80 [rds]
       rds_setsockopt+0x172/0x340 [rds]
       ? __fget_light+0x25/0x60
       ? __fdget+0x13/0x20
       SyS_setsockopt+0x80/0xe0
       do_syscall_64+0x67/0x1b0
       entry_SYSCALL64_slow_path+0x25/0x25
      RIP: 0033:0x7fbff9b117f9
      RSP: 002b:00007fbffa20aed8 EFLAGS: 00000293 ORIG_RAX: 0000000000000036
      RAX: ffffffffffffffda RBX: 00000000000c84a4 RCX: 00007fbff9b117f9
      RDX: 0000000000000002 RSI: 0000400000000114 RDI: 000000000000109b
      RBP: 00007fbffa20af10 R08: 0000000000000020 R09: 00007fbff9dd7860
      R10: 0000000020000ffc R11: 0000000000000293 R12: 0000000000000000
      R13: 00007fbffa20b9c0 R14: 00007fbffa20b700 R15: 0000000000000021
      
      Code: 41 56 41 55 49 89 fd 41 54 53 48 83 ec 18 8b 87 f0 02 00 00 48
      89 55 d0 48 89 4d c8 85 c0 0f 84 2d 03 00 00 48 8b 87 00 03 00 00 <48>
      83 b8 c0 00 00 00 00 0f 84 25 03 00 0 0 48 8b 06 48 8b 56 08
      
      The fix is to check the existence of an underlying transport in
      __rds_rdma_map().
      Signed-off-by: default avatarHåkon Bugge <haakon.bugge@oracle.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      39961200
    • Greg Kroah-Hartman's avatar
      ACPI: sbshc: remove raw pointer from printk() message · 0c257563
      Greg Kroah-Hartman authored
      commit 43cdd1b7
      
       upstream.
      
      There's no need to be printing a raw kernel pointer to the kernel log at
      every boot.  So just remove it, and change the whole message to use the
      correct dev_info() call at the same time.
      Reported-by: default avatarWang Qize <wang_qize@venustech.com.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0c257563
    • Daniel Mentz's avatar
      media: v4l2-compat-ioctl32.c: refactor compat ioctl32 logic · a0b6b578
      Daniel Mentz authored
      commit a1dfb4c4 upstream.
      
      The 32-bit compat v4l2 ioctl handling is implemented based on its 64-bit
      equivalent. It converts 32-bit data structures into its 64-bit
      equivalents and needs to provide the data to the 64-bit ioctl in user
      space memory which is commonly allocated using
      compat_alloc_user_space().
      
      However, due to how that function is implemented, it can only be called
      a single time for every syscall invocation.
      
      Supposedly to avoid this limitation, the existing code uses a mix of
      memory from the kernel stack and memory allocated through
      compat_alloc_user_space().
      
      Under normal circumstances, this would not work, because the 64-bit
      ioctl expects all pointers to point to user space memory. As a
      workaround, set_fs(KERNEL_DS) is called to temporarily disable this
      extra safety check and allow kernel pointers. However, this might
      introduce a security vulnerability: The result of the 32-bit to 64-bit
      conversion is writeable by user space because the output buffer has been
      allocated via compat_alloc_user_space(). A malicious user space process
      could then manipulate pointers inside this output buffer, and due to the
      previous set_fs(KERNEL_DS) call, functions like get_user() or put_user()
      no longer prevent kernel memory access.
      
      The new approach is to pre-calculate the total amount of user space
      memory that is needed, allocate it using compat_alloc_user_space() and
      then divide up the allocated memory to accommodate all data structures
      that need to be converted.
      
      An alternative approach would have been to retain the union type karg
      that they allocated on the kernel stack in do_video_ioctl(), copy all
      data from user space into karg and then back to user space. However, we
      decided against this approach because it does not align with other
      compat syscall implementations. Instead, we tried to replicate the
      get_user/put_user pairs as found in other places in the kernel:
      
          if (get_user(clipcount, &up->clipcount) ||
              put_user(clipcount, &kp->clipcount)) return -EFAULT;
      
      Notes from hans.verkuil@cisco.com:
      
      This patch was taken from:
          https://github.com/LineageOS/android_kernel_samsung_apq8084/commit/97b733953c06e4f0398ade18850f0817778255f7
      
      Clearly nobody could be bothered to upstream this patch or at minimum
      tell us :-( We only heard about this a week ago.
      
      This patch was rebased and cleaned up. Compared to the original I
      also swapped the order of the convert_in_user arguments so that they
      matched copy_in_user. It was hard to review otherwise. I also replaced
      the ALLOC_USER_SPACE/ALLOC_AND_GET by a normal function.
      
      Fixes: 6b5a9492
      
       ("v4l: introduce string control support.")
      Signed-off-by: default avatarDaniel Mentz <danielmentz@google.com>
      Co-developed-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      [bwh: Rebased on top of some earlier fixes]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a0b6b578
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors · 8c04a4f0
      Hans Verkuil authored
      commit d83a8243
      
       upstream.
      
      Some ioctls need to copy back the result even if the ioctl returned
      an error. However, don't do this for the error code -ENOTTY.
      It makes no sense in that cases.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8c04a4f0
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type · 3b764d65
      Hans Verkuil authored
      commit 169f24ca
      
       upstream.
      
      There is nothing wrong with using an unknown buffer type. So
      stop spamming the kernel log whenever this happens. The kernel
      will just return -EINVAL to signal this.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3b764d65
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32 · e05a2d30
      Hans Verkuil authored
      commit a751be5b
      
       upstream.
      
      put_v4l2_window32() didn't copy back the clip list to userspace.
      Drivers can update the clip rectangles, so this should be done.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e05a2d30
    • Daniel Mentz's avatar
      media: v4l2-compat-ioctl32: Copy v4l2_window->global_alpha · 79bd1439
      Daniel Mentz authored
      commit 025a26fa upstream.
      
      Commit b2787845
      
       ("V4L/DVB (5289): Add support for video output
      overlays.") added the field global_alpha to struct v4l2_window but did
      not update the compat layer accordingly. This change adds global_alpha
      to struct v4l2_window32 and copies the value for global_alpha back and
      forth.
      Signed-off-by: default avatarDaniel Mentz <danielmentz@google.com>
      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>
      79bd1439
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: fix ctrl_is_pointer · 606ae3b1
      Hans Verkuil authored
      commit b8c601e8
      
       upstream.
      
      ctrl_is_pointer just hardcoded two known string controls, but that
      caused problems when using e.g. custom controls that use a pointer
      for the payload.
      
      Reimplement this function: it now finds the v4l2_ctrl (if the driver
      uses the control framework) or it calls vidioc_query_ext_ctrl (if the
      driver implements that directly).
      
      In both cases it can now check if the control is a pointer control
      or not.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      [bwh: Rebased on top of some earlier fixes]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      606ae3b1
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32 · e8b35041
      Hans Verkuil authored
      commit 8ed5a59d
      
       upstream.
      
      The struct v4l2_plane32 should set m.userptr as well. The same
      happens in v4l2_buffer32 and v4l2-compliance tests for this.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e8b35041
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: avoid sizeof(type) · e601a9a8
      Hans Verkuil authored
      commit 333b1e9f
      
       upstream.
      
      Instead of doing sizeof(struct foo) use sizeof(*up). There even were
      cases where 4 * sizeof(__u32) was used instead of sizeof(kp->reserved),
      which is very dangerous when the size of the reserved array changes.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      [bwh: Rebased on top of some earlier fixes]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e601a9a8
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32 · f64f7bd5
      Hans Verkuil authored
      commit 486c5215
      
       upstream.
      
      These helper functions do not really help. Move the code to the
      __get/put_v4l2_format32 functions.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      [bwh: Rebased on top of some earlier fixes]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f64f7bd5
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: fix the indentation · 846e2145
      Hans Verkuil authored
      commit b7b957d4
      
       upstream.
      
      The indentation of this source is all over the place. Fix this.
      This patch only changes whitespace.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      [bwh: Rebased on top of some earlier fixes]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      846e2145
    • Hans Verkuil's avatar
      media: v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF · 182f3143
      Hans Verkuil authored
      commit 3ee6d040
      
       upstream.
      
      The result of the VIDIOC_PREPARE_BUF ioctl was never copied back
      to userspace since it was missing in the switch.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      182f3143
    • Ricardo Ribalda's avatar
      vb2: V4L2_BUF_FLAG_DONE is set after DQBUF · a1cdbb82
      Ricardo Ribalda authored
      commit 3171cc2b
      
       upstream.
      
      According to the doc, V4L2_BUF_FLAG_DONE is cleared after DQBUF:
      
      V4L2_BUF_FLAG_DONE 0x00000004  ... After calling the VIDIOC_QBUF or
      VIDIOC_DQBUF it is always cleared ...
      
      Unfortunately, it seems that videobuf2 keeps it set after DQBUF. This
      can be tested with vivid and dev_debug:
      
      [257604.338082] video1: VIDIOC_DQBUF: 71:33:25.00260479 index=3,
      type=vid-cap, flags=0x00002004, field=none, sequence=163,
      memory=userptr, bytesused=460800, offset/userptr=0x344b000,
      length=460800
      
      This patch forces FLAG_DONE to 0 after calling DQBUF.
      Reported-by: default avatarDimitrios Katsaros <patcherwork@gmail.com>
      Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
      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>
      a1cdbb82
    • Hans Verkuil's avatar
      media: v4l2-ioctl.c: don't copy back the result for -ENOTTY · 5e574764
      Hans Verkuil authored
      commit 181a4a2d
      
       upstream.
      
      If the ioctl returned -ENOTTY, then don't bother copying
      back the result as there is no point.
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5e574764
    • 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