Skip to content
  1. May 26, 2019
  2. May 23, 2019
  3. May 18, 2019
  4. May 16, 2019
    • Greg Kroah-Hartman's avatar
      Merge 3.18.140 into android-3.18 · 9a298fe0
      Greg Kroah-Hartman authored
      
      
      Changes in 3.18.140
      	MIPS: scall64-o32: Fix indirect syscall number load
      	trace: Fix preempt_enable_no_resched() abuse
      	sched/numa: Fix a possible divide-by-zero
      	ceph: ensure d_name stability in ceph_dentry_hash()
      	sunrpc: don't mark uninitialised items as VALID.
      	slip: make slhc_free() silently accept an error pointer
      	fs/proc/proc_sysctl.c: Fix a NULL pointer dereference
      	NFS: Forbid setting AF_INET6 to "struct sockaddr_in"->sin_family.
      	netfilter: ebtables: CONFIG_COMPAT: drop a bogus WARN_ON
      	Revert "block/loop: Use global lock for ioctl() operation."
      	ipv4: add sanity checks in ipv4_link_failure()
      	team: fix possible recursive locking when add slaves
      	net: stmmac: move stmmac_check_ether_addr() to driver probe
      	qlcnic: Avoid potential NULL pointer dereference
      	usb: gadget: net2280: Fix overrun of OUT messages
      	usb: gadget: net2272: Fix net2272_dequeue()
      	net: ks8851: Dequeue RX packets explicitly
      	net: ks8851: Reassert reset pin if chip ID check fails
      	net: ks8851: Delay requesting IRQ until opened
      	net: ks8851: Set initial carrier state to down
      	net: ibm: fix possible object reference leak
      	scsi: qla4xxx: fix a potential NULL pointer dereference
      	usb: u132-hcd: fix resource leak
      	ceph: fix use-after-free on symlink traversal
      	scsi: zfcp: reduce flood of fcrscn1 trace records on multi-element RSCN
      	libata: fix using DMA buffers on stack
      	kconfig/[mn]conf: handle backspace (^H) key
      	ipv4: ip_do_fragment: Preserve skb_iif during fragmentation
      	ipv6: invert flowlabel sharing check in process and user mode
      	packet: validate msg_namelen in send directly
      	ipv6/flowlabel: wait rcu grace period before put_pid()
      	USB: yurex: Fix protection fault after device removal
      	USB: w1 ds2490: Fix bug caused by improper use of altsetting array
      	USB: core: Fix unterminated string returned by usb_string()
      	USB: media: disable tlg2300 driver
      	USB: core: Fix bug caused by duplicate interface PM usage counter
      	HID: debug: fix race condition with between rdesc_show() and device removal
      	rtc: sh: Fix invalid alarm warning for non-enabled alarm
      	igb: Fix WARN_ONCE on runtime suspend
      	bonding: show full hw address in sysfs for slave entries
      	jffs2: fix use-after-free on symlink traversal
      	scsi: storvsc: Fix calculation of sub-channel count
      	hugetlbfs: fix memory leak for resv_map
      	xsysace: Fix error handling in ace_setup
      	ARM: orion: don't use using 64-bit DMA masks
      	ARM: iop: don't use using 64-bit DMA masks
      	usb: usbip: fix isoc packet num validation in get_pipe
      	staging: iio: adt7316: allow adt751x to use internal vref for all dacs
      	staging: iio: adt7316: fix the dac read calculation
      	staging: iio: adt7316: fix the dac write calculation
      	media: v4l2: i2c: ov7670: Fix PLL bypass register values
      	scsi: libsas: fix a race condition when smp task timeout
      	ASoC:soc-pcm:fix a codec fixup issue in TDM case
      	ASoC: cs4270: Set auto-increment bit for register writes
      	ASoC: tlv320aic32x4: Fix Common Pins
      	scsi: csiostor: fix missing data copy in csio_scsi_err_handler()
      	iommu/amd: Set exclusion range correctly
      	genirq: Prevent use-after-free and work list corruption
      	scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
      	Bluetooth: hidp: fix buffer overflow
      	Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
      	timer/debug: Change /proc/timer_stats from 0644 to 0600
      	netfilter: compat: initialize all fields in xt_init
      	platform/x86: sony-laptop: Fix unintentional fall-through
      	iio: adc: xilinx: fix potential use-after-free on remove
      	HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys
      	s390/dasd: Fix capacity calculation for large volumes
      	s390/3270: fix lockdep false positive on view->lock
      	KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing
      	tools lib traceevent: Fix missing equality check for strcmp
      	init: initialize jump labels before command line option parsing
      	s390: ctcm: fix ctcm_new_device error return code
      	selftests/net: correct the return value for run_netsocktests
      	gpu: ipu-v3: dp: fix CSC handling
      	Don't jump to compute_result state from check_result state
      	USB: serial: use variable for status
      	USB: serial: fix unthrottle races
      	bridge: Fix error path for kobject_init_and_add()
      	net: ucc_geth - fix Oops when changing number of buffers in the ring
      	packet: Fix error path in packet_init
      	vlan: disable SIOCSHWTSTAMP in container
      	ipv4: Fix raw socket lookup for local traffic
      	bonding: fix arp_validate toggling in active-backup mode
      	drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl
      	drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl
      	powerpc/booke64: set RI in default MSR
      	Linux 3.18.140
      
      Change-Id: I1abc77218de1f2e6702b9525f1c90f54608d8867
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      9a298fe0
    • Greg Kroah-Hartman's avatar
      Linux 3.18.140 · 6b1ae527
      Greg Kroah-Hartman authored
      6b1ae527
    • Laurentiu Tudor's avatar
      powerpc/booke64: set RI in default MSR · 36927e41
      Laurentiu Tudor authored
      
      
      commit 5266e58d6cd90ac85c187d673093ad9cb649e16d upstream.
      
      Set RI in the default kernel's MSR so that the architected way of
      detecting unrecoverable machine check interrupts has a chance to work.
      This is inline with the MSR setup of the rest of booke powerpc
      architectures configured here.
      
      Signed-off-by: default avatarLaurentiu Tudor <laurentiu.tudor@nxp.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36927e41
    • Dan Carpenter's avatar
      drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl · db7e5013
      Dan Carpenter authored
      commit 6a024330650e24556b8a18cc654ad00cfecf6c6c upstream.
      
      The "param.count" value is a u64 thatcomes from the user.  The code
      later in the function assumes that param.count is at least one and if
      it's not then it leads to an Oops when we dereference the ZERO_SIZE_PTR.
      
      Also the addition can have an integer overflow which would lead us to
      allocate a smaller "pages" array than required.  I can't immediately
      tell what the possible run times implications are, but it's safest to
      prevent the overflow.
      
      Link: http://lkml.kernel.org/r/20181218082129.GE32567@kadam
      
      
      Fixes: 6db71994 ("drivers/virt: introduce Freescale hypervisor management driver")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Timur Tabi <timur@freescale.com>
      Cc: Mihai Caraman <mihai.caraman@freescale.com>
      Cc: Kumar Gala <galak@kernel.crashing.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db7e5013
    • Dan Carpenter's avatar
      drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl · 3b187319
      Dan Carpenter authored
      commit c8ea3663f7a8e6996d44500ee818c9330ac4fd88 upstream.
      
      strndup_user() returns error pointers on error, and then in the error
      handling we pass the error pointers to kfree().  It will cause an Oops.
      
      Link: http://lkml.kernel.org/r/20181218082003.GD32567@kadam
      
      
      Fixes: 6db71994 ("drivers/virt: introduce Freescale hypervisor management driver")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Timur Tabi <timur@freescale.com>
      Cc: Mihai Caraman <mihai.caraman@freescale.com>
      Cc: Kumar Gala <galak@kernel.crashing.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b187319
    • Jarod Wilson's avatar
      bonding: fix arp_validate toggling in active-backup mode · 66ed3c8b
      Jarod Wilson authored
      
      
      [ Upstream commit a9b8a2b39ce65df45687cf9ef648885c2a99fe75 ]
      
      There's currently a problem with toggling arp_validate on and off with an
      active-backup bond. At the moment, you can start up a bond, like so:
      
      modprobe bonding mode=1 arp_interval=100 arp_validate=0 arp_ip_targets=192.168.1.1
      ip link set bond0 down
      echo "ens4f0" > /sys/class/net/bond0/bonding/slaves
      echo "ens4f1" > /sys/class/net/bond0/bonding/slaves
      ip link set bond0 up
      ip addr add 192.168.1.2/24 dev bond0
      
      Pings to 192.168.1.1 work just fine. Now turn on arp_validate:
      
      echo 1 > /sys/class/net/bond0/bonding/arp_validate
      
      Pings to 192.168.1.1 continue to work just fine. Now when you go to turn
      arp_validate off again, the link falls flat on it's face:
      
      echo 0 > /sys/class/net/bond0/bonding/arp_validate
      dmesg
      ...
      [133191.911987] bond0: Setting arp_validate to none (0)
      [133194.257793] bond0: bond_should_notify_peers: slave ens4f0
      [133194.258031] bond0: link status definitely down for interface ens4f0, disabling it
      [133194.259000] bond0: making interface ens4f1 the new active one
      [133197.330130] bond0: link status definitely down for interface ens4f1, disabling it
      [133197.331191] bond0: now running without any active interface!
      
      The problem lies in bond_options.c, where passing in arp_validate=0
      results in bond->recv_probe getting set to NULL. This flies directly in
      the face of commit 3fe68df9, which says we need to set recv_probe =
      bond_arp_recv, even if we're not using arp_validate. Said commit fixed
      this in bond_option_arp_interval_set, but missed that we can get to that
      same state in bond_option_arp_validate_set as well.
      
      One solution would be to universally set recv_probe = bond_arp_recv here
      as well, but I don't think bond_option_arp_validate_set has any business
      touching recv_probe at all, and that should be left to the arp_interval
      code, so we can just make things much tidier here.
      
      Fixes: 3fe68df9 ("bonding: always set recv_probe to bond_arp_rcv in arp monitor")
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <andy@greyhouse.net>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: netdev@vger.kernel.org
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarJay Vosburgh <jay.vosburgh@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      66ed3c8b
    • David Ahern's avatar
      ipv4: Fix raw socket lookup for local traffic · ae0f0ebd
      David Ahern authored
      
      
      [ Upstream commit 19e4e768064a87b073a4b4c138b55db70e0cfb9f ]
      
      inet_iif should be used for the raw socket lookup. inet_iif considers
      rt_iif which handles the case of local traffic.
      
      As it stands, ping to a local address with the '-I <dev>' option fails
      ever since ping was changed to use SO_BINDTODEVICE instead of
      cmsg + IP_PKTINFO.
      
      IPv6 works fine.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae0f0ebd
    • Hangbin Liu's avatar
      vlan: disable SIOCSHWTSTAMP in container · 860e9181
      Hangbin Liu authored
      
      
      [ Upstream commit 873017af778439f2f8e3d87f28ddb1fcaf244a76 ]
      
      With NET_ADMIN enabled in container, a normal user could be mapped to
      root and is able to change the real device's rx filter via ioctl on
      vlan, which would affect the other ptp process on host. Fix it by
      disabling SIOCSHWTSTAMP in container.
      
      Fixes: a6111d3c ("vlan: Pass SIOC[SG]HWTSTAMP ioctls to real device")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      860e9181
    • YueHaibing's avatar
      packet: Fix error path in packet_init · 97d36ca9
      YueHaibing authored
      
      
      [ Upstream commit 36096f2f4fa05f7678bc87397665491700bae757 ]
      
      kernel BUG at lib/list_debug.c:47!
      invalid opcode: 0000 [#1
      CPU: 0 PID: 12914 Comm: rmmod Tainted: G        W         5.1.0+ #47
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
      RIP: 0010:__list_del_entry_valid+0x53/0x90
      Code: 48 8b 32 48 39 fe 75 35 48 8b 50 08 48 39 f2 75 40 b8 01 00 00 00 5d c3 48
      89 fe 48 89 c2 48 c7 c7 18 75 fe 82 e8 cb 34 78 ff <0f> 0b 48 89 fe 48 c7 c7 50 75 fe 82 e8 ba 34 78 ff 0f 0b 48 89 f2
      RSP: 0018:ffffc90001c2fe40 EFLAGS: 00010286
      RAX: 000000000000004e RBX: ffffffffa0184000 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffff888237a17788 RDI: 00000000ffffffff
      RBP: ffffc90001c2fe40 R08: 0000000000000000 R09: 0000000000000000
      R10: ffffc90001c2fe10 R11: 0000000000000000 R12: 0000000000000000
      R13: ffffc90001c2fe50 R14: ffffffffa0184000 R15: 0000000000000000
      FS:  00007f3d83634540(0000) GS:ffff888237a00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000555c350ea818 CR3: 0000000231677000 CR4: 00000000000006f0
      Call Trace:
       unregister_pernet_operations+0x34/0x120
       unregister_pernet_subsys+0x1c/0x30
       packet_exit+0x1c/0x369 [af_packet
       __x64_sys_delete_module+0x156/0x260
       ? lockdep_hardirqs_on+0x133/0x1b0
       ? do_syscall_64+0x12/0x1f0
       do_syscall_64+0x6e/0x1f0
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      When modprobe af_packet, register_pernet_subsys
      fails and does a cleanup, ops->list is set to LIST_POISON1,
      but the module init is considered to success, then while rmmod it,
      BUG() is triggered in __list_del_entry_valid which is called from
      unregister_pernet_subsys. This patch fix error handing path in
      packet_init to avoid possilbe issue if some error occur.
      
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      97d36ca9
    • Christophe Leroy's avatar
      net: ucc_geth - fix Oops when changing number of buffers in the ring · 9d59fa6e
      Christophe Leroy authored
      
      
      [ Upstream commit ee0df19305d9fabd9479b785918966f6e25b733b ]
      
      When changing the number of buffers in the RX ring while the interface
      is running, the following Oops is encountered due to the new number
      of buffers being taken into account immediately while their allocation
      is done when opening the device only.
      
      [   69.882706] Unable to handle kernel paging request for data at address 0xf0000100
      [   69.890172] Faulting instruction address: 0xc033e164
      [   69.895122] Oops: Kernel access of bad area, sig: 11 [#1]
      [   69.900494] BE PREEMPT CMPCPRO
      [   69.907120] CPU: 0 PID: 0 Comm: swapper Not tainted 4.14.115-00006-g179ade8ce3-dirty #269
      [   69.915956] task: c0684310 task.stack: c06da000
      [   69.920470] NIP:  c033e164 LR: c02e44d0 CTR: c02e41fc
      [   69.925504] REGS: dfff1e20 TRAP: 0300   Not tainted  (4.14.115-00006-g179ade8ce3-dirty)
      [   69.934161] MSR:  00009032 <EE,ME,IR,DR,RI>  CR: 22004428  XER: 20000000
      [   69.940869] DAR: f0000100 DSISR: 20000000
      [   69.940869] GPR00: c0352d70 dfff1ed0 c0684310 f00000a4 00000040 dfff1f68 00000000 0000001f
      [   69.940869] GPR08: df53f410 1cc00040 00000021 c0781640 42004424 100c82b6 f00000a4 df53f5b0
      [   69.940869] GPR16: df53f6c0 c05daf84 00000040 00000000 00000040 c0782be4 00000000 00000001
      [   69.940869] GPR24: 00000000 df53f400 000001b0 df53f410 df53f000 0000003f df708220 1cc00044
      [   69.978348] NIP [c033e164] skb_put+0x0/0x5c
      [   69.982528] LR [c02e44d0] ucc_geth_poll+0x2d4/0x3f8
      [   69.987384] Call Trace:
      [   69.989830] [dfff1ed0] [c02e4554] ucc_geth_poll+0x358/0x3f8 (unreliable)
      [   69.996522] [dfff1f20] [c0352d70] net_rx_action+0x248/0x30c
      [   70.002099] [dfff1f80] [c04e93e4] __do_softirq+0xfc/0x310
      [   70.007492] [dfff1fe0] [c0021124] irq_exit+0xd0/0xd4
      [   70.012458] [dfff1ff0] [c000e7e0] call_do_irq+0x24/0x3c
      [   70.017683] [c06dbe80] [c0006bac] do_IRQ+0x64/0xc4
      [   70.022474] [c06dbea0] [c001097c] ret_from_except+0x0/0x14
      [   70.027964] --- interrupt: 501 at rcu_idle_exit+0x84/0x90
      [   70.027964]     LR = rcu_idle_exit+0x74/0x90
      [   70.037585] [c06dbf60] [20000000] 0x20000000 (unreliable)
      [   70.042984] [c06dbf80] [c004bb0c] do_idle+0xb4/0x11c
      [   70.047945] [c06dbfa0] [c004bd14] cpu_startup_entry+0x18/0x1c
      [   70.053682] [c06dbfb0] [c05fb034] start_kernel+0x370/0x384
      [   70.059153] [c06dbff0] [00003438] 0x3438
      [   70.063062] Instruction dump:
      [   70.066023] 38a00000 38800000 90010014 4bfff015 80010014 7c0803a6 3123ffff 7c691910
      [   70.073767] 38210010 4e800020 38600000 4e800020 <80e3005c> 80c30098 3107ffff 7d083910
      [   70.081690] ---[ end trace be7ccd9c1e1a9f12 ]---
      
      This patch forbids the modification of the number of buffers in the
      ring while the interface is running.
      
      Fixes: ac421852 ("ucc_geth: add ethtool support")
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d59fa6e
    • Tobin C. Harding's avatar
      bridge: Fix error path for kobject_init_and_add() · 28107baf
      Tobin C. Harding authored
      
      
      [ Upstream commit bdfad5aec1392b93495b77b864d58d7f101dc1c1 ]
      
      Currently error return from kobject_init_and_add() is not followed by a
      call to kobject_put().  This means there is a memory leak.  We currently
      set p to NULL so that kfree() may be called on it as a noop, the code is
      arguably clearer if we move the kfree() up closer to where it is
      called (instead of after goto jump).
      
      Remove a goto label 'err1' and jump to call to kobject_put() in error
      return from kobject_init_and_add() fixing the memory leak.  Re-name goto
      label 'put_back' to 'err1' now that we don't use err1, following current
      nomenclature (err1, err2 ...).  Move call to kfree out of the error
      code at bottom of function up to closer to where memory was allocated.
      Add comment to clarify call to kfree().
      
      Signed-off-by: default avatarTobin C. Harding <tobin@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28107baf
    • Johan Hovold's avatar
      USB: serial: fix unthrottle races · c0759c18
      Johan Hovold authored
      
      
      [ Upstream commit 3f5edd58d040bfa4b74fb89bc02f0bc6b9cd06ab ]
      
      Fix two long-standing bugs which could potentially lead to memory
      corruption or leave the port throttled until it is reopened (on weakly
      ordered systems), respectively, when read-URB completion races with
      unthrottle().
      
      First, the URB must not be marked as free before processing is complete
      to prevent it from being submitted by unthrottle() on another CPU.
      
      	CPU 1				CPU 2
      	================		================
      	complete()			unthrottle()
      	  process_urb();
      	  smp_mb__before_atomic();
      	  set_bit(i, free);		  if (test_and_clear_bit(i, free))
      	  					  submit_urb();
      
      Second, the URB must be marked as free before checking the throttled
      flag to prevent unthrottle() on another CPU from failing to observe that
      the URB needs to be submitted if complete() sees that the throttled flag
      is set.
      
      	CPU 1				CPU 2
      	================		================
      	complete()			unthrottle()
      	  set_bit(i, free);		  throttled = 0;
      	  smp_mb__after_atomic();	  smp_mb();
      	  if (throttled)		  if (test_and_clear_bit(i, free))
      	  	  return;			  submit_urb();
      
      Note that test_and_clear_bit() only implies barriers when the test is
      successful. To handle the case where the URB is still in use an explicit
      barrier needs to be added to unthrottle() for the second race condition.
      
      Fixes: d83b4053 ("USB: serial: add support for multiple read urbs")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c0759c18
    • Oliver Neukum's avatar
      USB: serial: use variable for status · 6b612ec2
      Oliver Neukum authored
      
      
      [ Upstream commit 3161da970d38cd6ed2ba8cadec93874d1d06e11e ]
      
      This patch turns status in a variable read once from the URB.
      The long term plan is to deliver status to the callback.
      In addition it makes the code a bit more elegant.
      
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6b612ec2
    • Nigel Croxon's avatar
      Don't jump to compute_result state from check_result state · 466153fc
      Nigel Croxon authored
      
      
      commit 4f4fd7c5798bbdd5a03a60f6269cf1177fbd11ef upstream.
      
      Changing state from check_state_check_result to
      check_state_compute_result not only is unsafe but also doesn't
      appear to serve a valid purpose.  A raid6 check should only be
      pushing out extra writes if doing repair and a mis-match occurs.
      The stripe dev management will already try and do repair writes
      for failing sectors.
      
      This patch makes the raid6 check_state_check_result handling
      work more like raid5's.  If somehow too many failures for a
      check, just quit the check operation for the stripe.  When any
      checks pass, don't try and use check_state_compute_result for
      a purpose it isn't needed for and is unsafe for.  Just mark the
      stripe as in sync for passing its parity checks and let the
      stripe dev read/write code and the bad blocks list do their
      job handling I/O errors.
      
      Repro steps from Xiao:
      
      These are the steps to reproduce this problem:
      1. redefined OPT_MEDIUM_ERR_ADDR to 12000 in scsi_debug.c
      2. insmod scsi_debug.ko dev_size_mb=11000  max_luns=1 num_tgts=1
      3. mdadm --create /dev/md127 --level=6 --raid-devices=5 /dev/sde1 /dev/sde2 /dev/sde3 /dev/sde5 /dev/sde6
      sde is the disk created by scsi_debug
      4. echo "2" >/sys/module/scsi_debug/parameters/opts
      5. raid-check
      
      It panic:
      [ 4854.730899] md: data-check of RAID array md127
      [ 4854.857455] sd 5:0:0:0: [sdr] tag#80 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
      [ 4854.859246] sd 5:0:0:0: [sdr] tag#80 Sense Key : Medium Error [current]
      [ 4854.860694] sd 5:0:0:0: [sdr] tag#80 Add. Sense: Unrecovered read error
      [ 4854.862207] sd 5:0:0:0: [sdr] tag#80 CDB: Read(10) 28 00 00 00 2d 88 00 04 00 00
      [ 4854.864196] print_req_error: critical medium error, dev sdr, sector 11656 flags 0
      [ 4854.867409] sd 5:0:0:0: [sdr] tag#100 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
      [ 4854.869469] sd 5:0:0:0: [sdr] tag#100 Sense Key : Medium Error [current]
      [ 4854.871206] sd 5:0:0:0: [sdr] tag#100 Add. Sense: Unrecovered read error
      [ 4854.872858] sd 5:0:0:0: [sdr] tag#100 CDB: Read(10) 28 00 00 00 2e e0 00 00 08 00
      [ 4854.874587] print_req_error: critical medium error, dev sdr, sector 12000 flags 4000
      [ 4854.876456] sd 5:0:0:0: [sdr] tag#101 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
      [ 4854.878552] sd 5:0:0:0: [sdr] tag#101 Sense Key : Medium Error [current]
      [ 4854.880278] sd 5:0:0:0: [sdr] tag#101 Add. Sense: Unrecovered read error
      [ 4854.881846] sd 5:0:0:0: [sdr] tag#101 CDB: Read(10) 28 00 00 00 2e e8 00 00 08 00
      [ 4854.883691] print_req_error: critical medium error, dev sdr, sector 12008 flags 4000
      [ 4854.893927] sd 5:0:0:0: [sdr] tag#166 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
      [ 4854.896002] sd 5:0:0:0: [sdr] tag#166 Sense Key : Medium Error [current]
      [ 4854.897561] sd 5:0:0:0: [sdr] tag#166 Add. Sense: Unrecovered read error
      [ 4854.899110] sd 5:0:0:0: [sdr] tag#166 CDB: Read(10) 28 00 00 00 2e e0 00 00 10 00
      [ 4854.900989] print_req_error: critical medium error, dev sdr, sector 12000 flags 0
      [ 4854.902757] md/raid:md127: read error NOT corrected!! (sector 9952 on sdr1).
      [ 4854.904375] md/raid:md127: read error NOT corrected!! (sector 9960 on sdr1).
      [ 4854.906201] ------------[ cut here ]------------
      [ 4854.907341] kernel BUG at drivers/md/raid5.c:4190!
      
      raid5.c:4190 above is this BUG_ON:
      
          handle_parity_checks6()
              ...
              BUG_ON(s->uptodate < disks - 1); /* We don't need Q to recover */
      
      Cc: <stable@vger.kernel.org> # v3.16+
      OriginalAuthor: David Jeffery <djeffery@redhat.com>
      Cc: Xiao Ni <xni@redhat.com>
      Tested-by: default avatarDavid Jeffery <djeffery@redhat.com>
      Signed-off-by: default avatarDavid Jeffy <djeffery@redhat.com>
      Signed-off-by: default avatarNigel Croxon <ncroxon@redhat.com>
      Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      466153fc
    • Lucas Stach's avatar
      gpu: ipu-v3: dp: fix CSC handling · 913fbfc3
      Lucas Stach authored
      
      
      [ Upstream commit d4fad0a426c6e26f48c9a7cdd21a7fe9c198d645 ]
      
      Initialize the flow input colorspaces to unknown and reset to that value
      when the channel gets disabled. This avoids the state getting mixed up
      with a previous mode.
      
      Also keep the CSC settings for the background flow intact when disabling
      the foreground flow.
      
      Root-caused-by: default avatarJonathan Marek <jonathan@marek.ca>
      Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      913fbfc3
    • Po-Hsu Lin's avatar
      selftests/net: correct the return value for run_netsocktests · fad36842
      Po-Hsu Lin authored
      
      
      [ Upstream commit 30c04d796b693e22405c38e9b78e9a364e4c77e6 ]
      
      The run_netsocktests will be marked as passed regardless the actual test
      result from the ./socket:
      
          selftests: net: run_netsocktests
          ========================================
          --------------------
          running socket test
          --------------------
          [FAIL]
          ok 1..6 selftests: net: run_netsocktests [PASS]
      
      This is because the test script itself has been successfully executed.
      Fix this by exit 1 when the test failed.
      
      Signed-off-by: default avatarPo-Hsu Lin <po-hsu.lin@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fad36842
    • Arnd Bergmann's avatar
      s390: ctcm: fix ctcm_new_device error return code · 68e8a8d9
      Arnd Bergmann authored
      
      
      [ Upstream commit 27b141fc234a3670d21bd742c35d7205d03cbb3a ]
      
      clang points out that the return code from this function is
      undefined for one of the error paths:
      
      ../drivers/s390/net/ctcm_main.c:1595:7: warning: variable 'result' is used uninitialized whenever 'if' condition is true
            [-Wsometimes-uninitialized]
                      if (priv->channel[direction] == NULL) {
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../drivers/s390/net/ctcm_main.c:1638:9: note: uninitialized use occurs here
              return result;
                     ^~~~~~
      ../drivers/s390/net/ctcm_main.c:1595:3: note: remove the 'if' if its condition is always false
                      if (priv->channel[direction] == NULL) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../drivers/s390/net/ctcm_main.c:1539:12: note: initialize the variable 'result' to silence this warning
              int result;
                        ^
      
      Make it return -ENODEV here, as in the related failure cases.
      gcc has a known bug in underreporting some of these warnings
      when it has already eliminated the assignment of the return code
      based on some earlier optimization step.
      
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      68e8a8d9
    • Dan Williams's avatar
      init: initialize jump labels before command line option parsing · 4ce4b005
      Dan Williams authored
      [ Upstream commit 6041186a32585fc7a1d0f6cfe2f138b05fdc3c82 ]
      
      When a module option, or core kernel argument, toggles a static-key it
      requires jump labels to be initialized early.  While x86, PowerPC, and
      ARM64 arrange for jump_label_init() to be called before parse_args(),
      ARM does not.
      
        Kernel command line: rdinit=/sbin/init page_alloc.shuffle=1 panic=-1 console=ttyAMA0,115200 page_alloc.shuffle=1
        ------------[ cut here ]------------
        WARNING: CPU: 0 PID: 0 at ./include/linux/jump_label.h:303
        page_alloc_shuffle+0x12c/0x1ac
        static_key_enable(): static key 'page_alloc_shuffle_key+0x0/0x4' used
        before call to jump_label_init()
        Modules linked in:
        CPU: 0 PID: 0 Comm: swapper Not tainted
        5.1.0-rc4-next-20190410-00003-g3367c36ce744 #1
        Hardware name: ARM Integrator/CP (Device Tree)
        [<c0011c68>] (unwind_backtrace) from [<c000ec48>] (show_stack+0x10/0x18)
        [<c000ec48>] (show_stack) from [<c07e9710>] (dump_stack+0x18/0x24)
        [<c07e9710>] (dump_stack) from [<c001bb1c>] (__warn+0xe0/0x108)
        [<c001bb1c>] (__warn) from [<c001bb88>] (warn_slowpath_fmt+0x44/0x6c)
        [<c001bb88>] (warn_slowpath_fmt) from [<c0b0c4a8>]
        (page_alloc_shuffle+0x12c/0x1ac)
        [<c0b0c4a8>] (page_alloc_shuffle) from [<c0b0c550>] (shuffle_store+0x28/0x48)
        [<c0b0c550>] (shuffle_store) from [<c003e6a0>] (parse_args+0x1f4/0x350)
        [<c003e6a0>] (parse_args) from [<c0ac3c00>] (start_kernel+0x1c0/0x488)
      
      Move the fallback call to jump_label_init() to occur before
      parse_args().
      
      The redundant calls to jump_label_init() in other archs are left intact
      in case they have static key toggling use cases that are even earlier
      than option parsing.
      
      Link: http://lkml.kernel.org/r/155544804466.1032396.13418949511615676665.stgit@dwillia2-desk3.amr.corp.intel.com
      
      
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Reported-by: default avatarGuenter Roeck <groeck@google.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Russell King <rmk@armlinux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4ce4b005
    • Rikard Falkeborn's avatar
      tools lib traceevent: Fix missing equality check for strcmp · f97fc640
      Rikard Falkeborn authored
      
      
      [ Upstream commit f32c2877bcb068a718bb70094cd59ccc29d4d082 ]
      
      There was a missing comparison with 0 when checking if type is "s64" or
      "u64". Therefore, the body of the if-statement was entered if "type" was
      "u64" or not "s64", which made the first strcmp() redundant since if
      type is "u64", it's not "s64".
      
      If type is "s64", the body of the if-statement is not entered but since
      the remainder of the function consists of if-statements which will not
      be entered if type is "s64", we will just return "val", which is
      correct, albeit at the cost of a few more calls to strcmp(), i.e., it
      will behave just as if the if-statement was entered.
      
      If type is neither "s64" or "u64", the body of the if-statement will be
      entered incorrectly and "val" returned. This means that any type that is
      checked after "s64" and "u64" is handled the same way as "s64" and
      "u64", i.e., the limiting of "val" to fit in for example "s8" is never
      reached.
      
      This was introduced in the kernel tree when the sources were copied from
      trace-cmd in commit f7d82350 ("tools/events: Add files to create
      libtraceevent.a"), and in the trace-cmd repo in 1cdbae6035cei
      ("Implement typecasting in parser") when the function was introduced,
      i.e., it has always behaved the wrong way.
      
      Detected by cppcheck.
      
      Signed-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
      Reviewed-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
      Fixes: f7d82350 ("tools/events: Add files to create libtraceevent.a")
      Link: http://lkml.kernel.org/r/20190409091529.2686-1-rikard.falkeborn@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f97fc640
    • Vitaly Kuznetsov's avatar
      KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing · 72ba8a7a
      Vitaly Kuznetsov authored
      
      
      [ Upstream commit 7a223e06b1a411cef6c4cd7a9b9a33c8d225b10e ]
      
      In __apic_accept_irq() interface trig_mode is int and actually on some code
      paths it is set above u8:
      
      kvm_apic_set_irq() extracts it from 'struct kvm_lapic_irq' where trig_mode
      is u16. This is done on purpose as e.g. kvm_set_msi_irq() sets it to
      (1 << 15) & e->msi.data
      
      kvm_apic_local_deliver sets it to reg & (1 << 15).
      
      Fix the immediate issue by making 'tm' into u16. We may also want to adjust
      __apic_accept_irq() interface and use proper sizes for vector, level,
      trig_mode but this is not urgent.
      
      Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      72ba8a7a
    • Martin Schwidefsky's avatar
      s390/3270: fix lockdep false positive on view->lock · eca5f4de
      Martin Schwidefsky authored
      
      
      [ Upstream commit 5712f3301a12c0c3de9cc423484496b0464f2faf ]
      
      The spinlock in the raw3270_view structure is used by con3270, tty3270
      and fs3270 in different ways. For con3270 the lock can be acquired in
      irq context, for tty3270 and fs3270 the highest context is bh.
      
      Lockdep sees the view->lock as a single class and if the 3270 driver
      is used for the console the following message is generated:
      
      WARNING: inconsistent lock state
      5.1.0-rc3-05157-g5c168033979d #12 Not tainted
      --------------------------------
      inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
      swapper/0/1 [HC0[0]:SC1[1]:HE1:SE0] takes:
      (____ptrval____) (&(&view->lock)->rlock){?.-.}, at: tty3270_update+0x7c/0x330
      
      Introduce a lockdep subclass for the view lock to distinguish bh from
      irq locks.
      
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eca5f4de
    • Peter Oberparleiter's avatar
      s390/dasd: Fix capacity calculation for large volumes · 2f922c45
      Peter Oberparleiter authored
      
      
      [ Upstream commit 2cc9637ce825f3a9f51f8f78af7474e9e85bfa5f ]
      
      The DASD driver incorrectly limits the maximum number of blocks of ECKD
      DASD volumes to 32 bit numbers. Volumes with a capacity greater than
      2^32-1 blocks are incorrectly recognized as smaller volumes.
      
      This results in the following volume capacity limits depending on the
      formatted block size:
      
        BLKSIZE  MAX_GB   MAX_CYL
            512    2047   5843492c
           1024    4095   8676701
           2048    8191  13634816
           4096   16383  23860929
      
      The same problem occurs when a volume with more than 17895697 cylinders
      is accessed in raw-track-access mode.
      
      Fix this problem by adding an explicit type cast when calculating the
      maximum number of blocks.
      
      Signed-off-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
      Reviewed-by: default avatarStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2f922c45
    • Dmitry Torokhov's avatar
      HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys · e172a3b5
      Dmitry Torokhov authored
      
      
      [ Upstream commit 7975a1d6a7afeb3eb61c971a153d24dd8fa032f3 ]
      
      According to HUTRR73 usages 0x79, 0x7a and 0x7c from the consumer page
      correspond to Brightness Up/Down/Toggle keys, so let's add the mappings.
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e172a3b5
    • Sven Van Asbroeck's avatar
      iio: adc: xilinx: fix potential use-after-free on remove · b8f6da2f
      Sven Van Asbroeck authored
      
      
      [ Upstream commit 62039b6aef63380ba7a37c113bbaeee8a55c5342 ]
      
      When cancel_delayed_work() returns, the delayed work may still
      be running. This means that the core could potentially free
      the private structure (struct xadc) while the delayed work
      is still using it. This is a potential use-after-free.
      
      Fix by calling cancel_delayed_work_sync(), which waits for
      any residual work to finish before returning.
      
      Signed-off-by: default avatarSven Van Asbroeck <TheSven73@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b8f6da2f
    • Gustavo A. R. Silva's avatar
      platform/x86: sony-laptop: Fix unintentional fall-through · 23a030f7
      Gustavo A. R. Silva authored
      commit 1cbd7a64959d33e7a2a1fa2bf36a62b350a9fcbd upstream.
      
      It seems that the default case should return AE_CTRL_TERMINATE, instead
      of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK;
      otherwise the line of code at the end of the function is unreachable and
      makes no sense:
      
      return AE_CTRL_TERMINATE;
      
      This fix is based on the following thread of discussion:
      
      https://lore.kernel.org/patchwork/patch/959782/
      
      
      
      Fixes: 33a04454 ("sony-laptop: Add SNY6001 device handling (sonypi reimplementation)")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      23a030f7
    • Francesco Ruggeri's avatar
      netfilter: compat: initialize all fields in xt_init · d2774665
      Francesco Ruggeri authored
      
      
      commit 8d29d16d21342a0c86405d46de0c4ac5daf1760f upstream
      
      If a non zero value happens to be in xt[NFPROTO_BRIDGE].cur at init
      time, the following panic can be caused by running
      
      % ebtables -t broute -F BROUTING
      
      from a 32-bit user level on a 64-bit kernel. This patch replaces
      kmalloc_array with kcalloc when allocating xt.
      
      [  474.680846] BUG: unable to handle kernel paging request at 0000000009600920
      [  474.687869] PGD 2037006067 P4D 2037006067 PUD 2038938067 PMD 0
      [  474.693838] Oops: 0000 [#1] SMP
      [  474.697055] CPU: 9 PID: 4662 Comm: ebtables Kdump: loaded Not tainted 4.19.17-11302235.AroraKernelnext.fc18.x86_64 #1
      [  474.707721] Hardware name: Supermicro X9DRT/X9DRT, BIOS 3.0 06/28/2013
      [  474.714313] RIP: 0010:xt_compat_calc_jump+0x2f/0x63 [x_tables]
      [  474.720201] Code: 40 0f b6 ff 55 31 c0 48 6b ff 70 48 03 3d dc 45 00 00 48 89 e5 8b 4f 6c 4c 8b 47 60 ff c9 39 c8 7f 2f 8d 14 08 d1 fa 48 63 fa <41> 39 34 f8 4c 8d 0c fd 00 00 00 00 73 05 8d 42 01 eb e1 76 05 8d
      [  474.739023] RSP: 0018:ffffc9000943fc58 EFLAGS: 00010207
      [  474.744296] RAX: 0000000000000000 RBX: ffffc90006465000 RCX: 0000000002580249
      [  474.751485] RDX: 00000000012c0124 RSI: fffffffff7be17e9 RDI: 00000000012c0124
      [  474.758670] RBP: ffffc9000943fc58 R08: 0000000000000000 R09: ffffffff8117cf8f
      [  474.765855] R10: ffffc90006477000 R11: 0000000000000000 R12: 0000000000000001
      [  474.773048] R13: 0000000000000000 R14: ffffc9000943fcb8 R15: ffffc9000943fcb8
      [  474.780234] FS:  0000000000000000(0000) GS:ffff88a03f840000(0063) knlGS:00000000f7ac7700
      [  474.788612] CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
      [  474.794632] CR2: 0000000009600920 CR3: 0000002037422006 CR4: 00000000000606e0
      [  474.802052] Call Trace:
      [  474.804789]  compat_do_replace+0x1fb/0x2a3 [ebtables]
      [  474.810105]  compat_do_ebt_set_ctl+0x69/0xe6 [ebtables]
      [  474.815605]  ? try_module_get+0x37/0x42
      [  474.819716]  compat_nf_setsockopt+0x4f/0x6d
      [  474.824172]  compat_ip_setsockopt+0x7e/0x8c
      [  474.828641]  compat_raw_setsockopt+0x16/0x3a
      [  474.833220]  compat_sock_common_setsockopt+0x1d/0x24
      [  474.838458]  __compat_sys_setsockopt+0x17e/0x1b1
      [  474.843343]  ? __check_object_size+0x76/0x19a
      [  474.847960]  __ia32_compat_sys_socketcall+0x1cb/0x25b
      [  474.853276]  do_fast_syscall_32+0xaf/0xf6
      [  474.857548]  entry_SYSENTER_compat+0x6b/0x7a
      
      Signed-off-by: default avatarFrancesco Ruggeri <fruggeri@arista.com>
      Acked-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarZubin Mithra <zsm@chromium.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d2774665
    • Ben Hutchings's avatar
      timer/debug: Change /proc/timer_stats from 0644 to 0600 · b784e7a6
      Ben Hutchings authored
      
      
      The timer_stats facility should filter and translate PIDs if opened
      from a non-initial PID namespace, to avoid leaking information about
      the wider system.  It should also not show kernel virtual addresses.
      Unfortunately it has now been removed upstream (as redundant)
      instead of being fixed.
      
      For stable, fix the leak by restricting access to root only.  A
      similar change was already made for the /proc/timer_list file.
      
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b784e7a6
    • Marcel Holtmann's avatar
      Bluetooth: Align minimum encryption key size for LE and BR/EDR connections · b16a6c99
      Marcel Holtmann authored
      
      
      commit d5bb334a8e171b262e48f378bd2096c0ea458265 upstream.
      
      The minimum encryption key size for LE connections is 56 bits and to
      align LE with BR/EDR, enforce 56 bits of minimum encryption key size for
      BR/EDR connections as well.
      
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b16a6c99
    • Young Xiao's avatar
      Bluetooth: hidp: fix buffer overflow · 9c47ad93
      Young Xiao authored
      
      
      commit a1616a5ac99ede5d605047a9012481ce7ff18b16 upstream.
      
      Struct ca is copied from userspace. It is not checked whether the "name"
      field is NULL terminated, which allows local users to obtain potentially
      sensitive information from kernel stack memory, via a HIDPCONNADD command.
      
      This vulnerability is similar to CVE-2011-1079.
      
      Signed-off-by: default avatarYoung Xiao <YangX92@hotmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9c47ad93
    • Andrew Vasquez's avatar
      scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines · 6ee71083
      Andrew Vasquez authored
      
      
      commit 5cbdae10bf11f96e30b4d14de7b08c8b490e903c upstream.
      
      Commit e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs
      code") incorrectly set 'optrom_region_size' to 'start+size', which can
      overflow option-rom boundaries when 'start' is non-zero.  Continue setting
      optrom_region_size to the proper adjusted value of 'size'.
      
      Fixes: e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs code")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAndrew Vasquez <andrewv@marvell.com>
      Signed-off-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ee71083
    • Prasad Sodagudi's avatar
      genirq: Prevent use-after-free and work list corruption · 43dae3a4
      Prasad Sodagudi authored
      
      
      [ Upstream commit 59c39840f5abf4a71e1810a8da71aaccd6c17d26 ]
      
      When irq_set_affinity_notifier() replaces the notifier, then the
      reference count on the old notifier is dropped which causes it to be
      freed. But nothing ensures that the old notifier is not longer queued
      in the work list. If it is queued this results in a use after free and
      possibly in work list corruption.
      
      Ensure that the work is canceled before the reference is dropped.
      
      Signed-off-by: default avatarPrasad Sodagudi <psodagud@codeaurora.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: marc.zyngier@arm.com
      Link: https://lkml.kernel.org/r/1553439424-6529-1-git-send-email-psodagud@codeaurora.org
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      43dae3a4
    • Joerg Roedel's avatar
      iommu/amd: Set exclusion range correctly · 17f93dcb
      Joerg Roedel authored
      
      
      [ Upstream commit 3c677d206210f53a4be972211066c0f1cd47fe12 ]
      
      The exlcusion range limit register needs to contain the
      base-address of the last page that is part of the range, as
      bits 0-11 of this register are treated as 0xfff by the
      hardware for comparisons.
      
      So correctly set the exclusion range in the hardware to the
      last page which is _in_ the range.
      
      Fixes: b2026aa2 ('x86, AMD IOMMU: add functions for programming IOMMU MMIO space')
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      17f93dcb
    • Varun Prakash's avatar
      scsi: csiostor: fix missing data copy in csio_scsi_err_handler() · 47ebd400
      Varun Prakash authored
      
      
      [ Upstream commit 5c2442fd78998af60e13aba506d103f7f43f8701 ]
      
      If scsi cmd sglist is not suitable for DDP then csiostor driver uses
      preallocated buffers for DDP, because of this data copy is required from
      DDP buffer to scsi cmd sglist before calling ->scsi_done().
      
      Signed-off-by: default avatarVarun Prakash <varun@chelsio.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      47ebd400
    • Annaliese McDermond's avatar
      ASoC: tlv320aic32x4: Fix Common Pins · 0562cef8
      Annaliese McDermond authored
      
      
      [ Upstream commit c63adb28f6d913310430f14c69f0a2ea55eed0cc ]
      
      The common pins were mistakenly not added to the DAPM graph.
      Adding these pins will allow valid graphs to be created.
      
      Signed-off-by: default avatarAnnaliese McDermond <nh6z@nh6z.net>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0562cef8
    • Daniel Mack's avatar
      ASoC: cs4270: Set auto-increment bit for register writes · e0124792
      Daniel Mack authored
      
      
      [ Upstream commit f0f2338a9cfaf71db895fa989ea7234e8a9b471d ]
      
      The CS4270 does not by default increment the register address on
      consecutive writes. During normal operation it doesn't matter as all
      register accesses are done individually. At resume time after suspend,
      however, the regcache code gathers the biggest possible block of
      registers to sync and sends them one on one go.
      
      To fix this, set the INCR bit in all cases.
      
      Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e0124792
    • Rander Wang's avatar
      ASoC:soc-pcm:fix a codec fixup issue in TDM case · 0a635ced
      Rander Wang authored
      
      
      [ Upstream commit 570f18b6a8d1f0e60e8caf30e66161b6438dcc91 ]
      
      On HDaudio platforms, if playback is started when capture is working,
      there is no audible output.
      
      This can be root-caused to the use of the rx|tx_mask to store an HDaudio
      stream tag.
      
      If capture is stared before playback, rx_mask would be non-zero on HDaudio
      platform, then the channel number of playback, which is in the same codec
      dai with the capture, would be changed by soc_pcm_codec_params_fixup based
      on the tx_mask at first, then overwritten by this function based on rx_mask
      at last.
      
      According to the author of tx|rx_mask, tx_mask is for playback and rx_mask
      is for capture. And stream direction is checked at all other references of
      tx|rx_mask in ASoC, so here should be an error. This patch checks stream
      direction for tx|rx_mask for fixup function.
      
      This issue would affect not only HDaudio+ASoC, but also I2S codecs if the
      channel number based on rx_mask is not equal to the one for tx_mask. It could
      be rarely reproduecd because most drivers in kernel set the same channel number
      to tx|rx_mask or rx_mask is zero.
      
      Tested on all platforms using stream_tag & HDaudio and intel I2S platforms.
      
      Signed-off-by: default avatarRander Wang <rander.wang@linux.intel.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0a635ced
    • Jason Yan's avatar
      scsi: libsas: fix a race condition when smp task timeout · ec22b57b
      Jason Yan authored
      
      
      commit b90cd6f2b905905fb42671009dc0e27c310a16ae upstream.
      
      When the lldd is processing the complete sas task in interrupt and set the
      task stat as SAS_TASK_STATE_DONE, the smp timeout timer is able to be
      triggered at the same time. And smp_task_timedout() will complete the task
      wheter the SAS_TASK_STATE_DONE is set or not. Then the sas task may freed
      before lldd end the interrupt process. Thus a use-after-free will happen.
      
      Fix this by calling the complete() only when SAS_TASK_STATE_DONE is not
      set. And remove the check of the return value of the del_timer(). Once the
      LLDD sets DONE, it must call task->done(), which will call
      smp_task_done()->complete() and the task will be completed and freed
      correctly.
      
      Reported-by: default avatarchenxiang <chenxiang66@hisilicon.com>
      Signed-off-by: default avatarJason Yan <yanaijie@huawei.com>
      CC: John Garry <john.garry@huawei.com>
      CC: Johannes Thumshirn <jthumshirn@suse.de>
      CC: Ewan Milne <emilne@redhat.com>
      CC: Christoph Hellwig <hch@lst.de>
      CC: Tomas Henzl <thenzl@redhat.com>
      CC: Dan Williams <dan.j.williams@intel.com>
      CC: Hannes Reinecke <hare@suse.com>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
      Reviewed-by: default avatarJohn Garry <john.garry@huawei.com>
      Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Cc: Guenter Roeck <linux@roeck-us.net
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec22b57b
Loading