linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.16 000/328] 3.16.62-rc1 review
@ 2018-12-09 21:50 Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 057/328] video: udlfb: Fix unaligned access Ben Hutchings
                   ` (327 more replies)
  0 siblings, 328 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: torvalds, Guenter Roeck, akpm

This is the start of the stable review cycle for the 3.16.62 release.
There are 328 patches in this series, which will be posted as responses
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Fri Dec 14 18:00:00 UTC 2018.
Anything received after that time might be too late.

All the patches have also been committed to the linux-3.16.y-rc branch of
https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable-rc.git .
A shortlog and diffstat can be found below.

Ben.

-------------

Aaron Knister (1):
      IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler
         [816e846c2eb9129a3e0afa5f920c8bbc71efecaa]

Aaron Ma (1):
      Input: elantech - enable middle button of touchpad on ThinkPad P72
         [91a97507323e1ad4bfc10f4a5922e67cdaf8b3cd]

Akihiro Tsukada (1):
      media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able
         [86f65c218123c4e36fd855fbbc38147ffaf29974]

Al Viro (1):
      cachefiles: fix the race between cachefiles_bury_object() and rmdir(2)
         [169b803397499be85bdd1e3d07d6f5e3d4bd669e]

Alan Stern (6):
      USB: fix error handling in usb_driver_claim_interface()
         [bd729f9d67aa9a303d8925bb8c4f06af25f407d1]
      USB: fix the usbfs flag sanitization for control transfers
         [665c365a77fbfeabe52694aedf3446d5f2f1ce42]
      USB: handle NULL config in usb_find_alt_setting()
         [c9a4cb204e9eb7fa7dfbe3f7d3a674fa530aa193]
      USB: leave LPM alone if possible when binding/unbinding interface drivers
         [6fb650d43da3e7054984dc548eaa88765a94d49f]
      USB: net2280: Fix erroneous synchronization change
         [dec3c23c9aa1815f07d98ae0375b4cbc10971e13]
      USB: remove LPM management from usb_driver_claim_interface()
         [c183813fcee44a249339b7c46e1ad271ca1870aa]

Alexander Aring (4):
      mac802154: tx: cleanup crc calculation
         [b7eec52bcb7ab93a8cce0f718f42fa17d6d91745]
      mac802154: tx: use put_unaligned_le16 for copy crc
         [061ef8f915988839b12460c47ebfcf3700e124f0]
      net: 6lowpan: fix reserved space for single frames
         [ac74f87c789af40936a80131c4759f3e72579c3a]
      net: mac802154: tx: expand tailroom if necessary
         [f9c52831133050c6b82aa8b6831c92da2bbf2a0b]

Anand Jain (1):
      btrfs: rename total_bytes to avoid confusion
         [3c1dbdf54a31f4f049a33214c3096595988786bf]

Andi Kleen (2):
      x86/spectre: Add missing family 6 check to microcode check
         [1ab534e85c93945f7862378d8c8adcf408205b19]
      x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+
         [cc51e5428ea54f575d49cfcede1d4cb3a72b4ec4]

Andrei Otcheretianski (1):
      cfg80211: reg: Init wiphy_idx in regulatory_hint_core()
         [24f33e64fcd0d50a4b1a8e5b41bd0257aa66b0e8]

Andrey Ryabinin (1):
      fuse: Don't access pipe->buffers without pipe_lock()
         [a2477b0e67c52f4364a47c3ad70902bc2a61bd4c]

Andy Lutomirski (1):
      x86/vdso: Fix asm constraints on vDSO syscall fallbacks
         [715bd9d12f84d8f5cc8ad21d888f9bc304a8eb0b]

Anssi Hannula (1):
      net: macb: do not disable MDIO bus at open/close time
         [0da70f808029476001109b6cb076737bc04cea2e]

Arunk Khandavalli (1):
      cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE
         [4f0223bfe9c3e62d8f45a85f1ef1b18a8a263ef9]

Ashish Samant (1):
      ocfs2: fix locking for res->tracking and dlm->tracking_list
         [cbe355f57c8074bc4f452e5b6e35509044c6fa23]

Ashok Raj (1):
      x86/microcode/intel: Check microcode revision before updating sibling threads
         [c182d2b7d0ca48e0d6ff16f7d883161238c447ed]

Aurelien Aptel (1):
      smb2: fix missing files in root share directory listing
         [0595751f267994c3c7027377058e4185b3a28e75]

Bart Van Assche (4):
      IB/srpt: Support HCAs with more than two ports
         [e620ebfc228dcbef7519e3d16f43c6c6f1a1d0cb]
      scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock
         [0ee223b2e1f67cb2de9c0e3247c510d846e74d63]
      scsi: sysfs: Introduce sysfs_{un,}break_active_protection()
         [2afc9166f79b8f6da5f347f48515215ceee4ae37]
      scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size
         [35bea5c84fd13c643cce63f0b5cd4b148f8c901d]

Ben Hutchings (1):
      USB: yurex: Fix buffer over-read in yurex_write()
         [7e10f14ebface44a48275c8d6dc1caae3668d5a9]

Benjamin Herrenschmidt (1):
      powerpc/powernv/pci: Work around races in PCI bridge enabling
         [db2173198b9513f7add8009f225afa1f1c79bcc6]

Bhaktipriya Shridhar (1):
      bcache: Remove deprecated create_workqueue
         [81baf90af2dcc8259e99e2f236024524b55313fc]

Bin Yang (1):
      pstore: Fix incorrect persistent ram buffer mapping
         [831b624df1b420c8f9281ed1307a8db23afb72df]

Boris Ostrovsky (1):
      x86/EISA: Don't probe EISA bus for Xen PV guests
         [6a92b11169a65b3f8cc512c75a252cbd0d096ba0]

Borislav Petkov (1):
      x86/microcode/intel: Add a helper which gives the microcode revision
         [4167709bbf826512a52ebd6aafda2be104adaec9]

Catalin Marinas (1):
      cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
         [9bd616e3dbedfc103f158197c8ad93678849b1ed]

Chirantan Ekbote (1):
      9p/net: Fix zero-copy path in the 9p virtio transport
         [d28c756caee6e414d9ba367d0b92da24145af2a8]

Christian Brauner (1):
      getxattr: use correct xattr length
         [82c9a927bc5df6e06b72d206d24a9d10cced4eb5]

Christophe JAILLET (1):
      serial: pxa: Fix an error handling path in 'serial_pxa_probe()'
         [95a0e656580fab3128c7bee5f660c50784f53651]

Christophe Leroy (1):
      serial: cpm_uart: return immediately from console poll
         [be28c1e3ca29887e207f0cbcd294cefe5074bab6]

Claudio Imbrenda (1):
      s390/kvm: fix deadlock when killed by oom
         [306d6c49ac9ded11114cb53b0925da52f2c2ada1]

Colin Ian King (2):
      leds: max8997: use mode when calling max8997_led_set_mode
         [7a5de56db902ea632a0ff0c2b47481d278db645f]
      staging: rts5208: fix missing error check on call to rtsx_write_register
         [c5fae4f4fd28189b1062fb8ef7b21fec37cb8b17]

Corey Minyard (1):
      ipmi: Move BT capabilities detection to the detect call
         [c86ba91be75702c013bbf7379542920b6920e98f]

Dan Carpenter (16):
      CIFS: fix wrapping bugs in num_entries()
         [56446f218af1133c802dad8e9e116f07f381846c]
      cifs: integer overflow in in SMB2_ioctl()
         [2d204ee9d671327915260071c19350d84344e096]
      cifs: prevent integer overflow in nxt_dir_entry()
         [8ad8aa353524d89fa2e09522f3078166ff78ec42]
      drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
         [cd0e0ca69109d025b1a1b6609f70682db62138b0]
      fbdev: omapfb: off by one in omapfb_register_client()
         [5ec1ec35b2979b59d0b33381e7c9aac17e159d16]
      hwmon: (nct6775) Set weight source to zero correctly
         [e3f3d7ab00cd459d0f7a839758a4542f4d4b8ac8]
      mei: bus: type promotion bug in mei_nfc_if_version()
         [b40b3e9358fbafff6a4ba0f4b9658f6617146f9c]
      net: sched: act_ipt: check for underflow in __tcf_ipt_init()
         [aeadd93f2b0a609f603ac33e574b97a9832d1b90]
      pinctrl: freescale: off by one in imx1_pinconf_group_dbg_show()
         [19da44cd33a3a6ff7c97fff0189999ff15b241e4]
      pinctrl: imx: off by one in imx_pinconf_group_dbg_show()
         [b4859f3edb47825f62d1b2efdd75fe7945996f49]
      powerpc: Fix size calculation using resource_size()
         [c42d3be0c06f0c1c416054022aa535c08a1f9b39]
      rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication()
         [ae636fb1554833ee5133ca47bf4b2791b6739c52]
      scsi: aic94xx: fix an error code in aic94xx_init()
         [0756c57bce3d26da2592d834d8910b6887021701]
      uio: potential double frees if __uio_register_device() fails
         [f019f07ecf6a6b8bd6d7853bce70925d90af02d1]
      vmci: type promotion bug in qp_host_get_user_memory()
         [7fb2fd4e25fc1fb10dcb30b5519de257cfeae84c]
      x86/paravirt: Fix some warning messages
         [571d0563c8881595f4ab027aef9ed1c55e3e7b7c]

Daniel Black (1):
      mm: madvise(MADV_DODUMP): allow hugetlbfs pages
         [d41aa5252394c065d1f04d1ceea885b70d00c9c6]

Daniel Borkmann (2):
      bpf, net: add skb_mac_header_len helper
         [0daf4349406074fc03e4889ba5e97e6fb5311bab]
      crypto: memzero_explicit - make sure to clear out sensitive data
         [7185ad2672a7d50bc384de0e38d90b75d99f3d82]

Daniel Drake (1):
      PCI: Reprogram bridge prefetch registers on resume
         [083874549fdfefa629dfa752785e20427dde1511]

Daniel Mack (2):
      libertas: call into generic suspend code before turning off power
         [4f666675cdff0b986195413215eb062b7da6586f]
      libertas: fix suspend and resume for SDIO connected cards
         [7444a8092906ed44c09459780c56ba57043e39b1]

Darrick J. Wong (1):
      xfs: don't fail when converting shortform attr to long form during ATTR_REPLACE
         [7b38460dc8e4eafba06c78f8e37099d3b34d473c]

Dave Chinner (1):
      percpu_counter: batch size aware __percpu_counter_compare()
         [80188b0d77d7426b494af739ac129e0e684acb84]

Dave Martin (1):
      arm64: KVM: Tighten guest core register access from userspace
         [d26c25a9d19b5976b319af528886f89cf455692d]

David Ahern (1):
      net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs
         [4ba4c566ba8448a05e6257e0b98a21f1a0d55315]

Denis Drozdov (1):
      IB/IPoIB: Set ah valid flag in multicast send flow
         [75da96067ade4e7854379ec2f7834f3497652b1a]

Dexuan Cui (1):
      Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()
         [41e270f6898e7502be9fd6920ee0a108ca259d36]

Douglas Anderson (1):
      pinctrl: msm: Fix msm_config_group_get() to be compliant
         [05e0c828955c1cab58dd71a04539442e5375d917]

Emil Lundmark (1):
      drm: udl: Destroy framebuffer only if it was initialized
         [fcb74da1eb8edd3a4ef9b9724f88ed709d684227]

Eric Biggers (5):
      KEYS: encrypted: fix buffer overread in valid_master_desc()
         [794b4bc292f5d31739d89c0202c54e7dc9bc3add]
      crypto: ablkcipher - fix crash flushing dcache in error path
         [318abdfbe708aaaa652c79fb500e9bd60521f9dc]
      crypto: blkcipher - fix crash flushing dcache in error path
         [0868def3e4100591e7a1fdbf3eed1439cc8f7ca3]
      crypto: vmac - require a block cipher with 128-bit block size
         [73bf20ef3df262026c3470241ae4ac8196943ffa]
      crypto: vmac - separate tfm and request context
         [bb29648102335586e9a66289a1d98a0cb392b6e5]

Eric Dumazet (3):
      ipv6: fix possible use-after-free in ip6_xmit()
         [bbd6528d28c1b8e80832b3b018ec402b6f5c3215]
      net: make skb_partial_csum_set() more robust against overflows
         [52b5d6f5dcf0e5201392f7d417148ccb537dbf6f]
      rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096
         [0e1d6eca5113858ed2caea61a5adc03c595f6096]

Eric W. Biederman (1):
      ipv6: Compute net once in raw6_send_hdrinc
         [adb28c9d3371c845c7a28bfd4fb163aca0d0dc37]

Ethan Lien (1):
      btrfs: use correct compare function of dirty_metadata_bytes
         [d814a49198eafa6163698bdd93961302f3a877a4]

Eugeniy Paltsev (1):
      drm: fb-helper: Reject all pixel format changing requests
         [db05c481977599236f12a85e55de9f5ab37b0a2c]

Evgenii Lepikhin (1):
      ISCSI: fix minor memory leak
         [a928d28d4487402e6bd18bea1b8cc2b2ec6e6d8f]

Felipe Balbi (1):
      usb: gadget: udc: net2280: do not rely on 'driver' argument
         [bfd0ed576dbf9cc71af7dbe42841fc9246524961]

Felix Fietkau (1):
      mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys
         [211710ca74adf790b46ab3867fcce8047b573cd1]

Filippo Sironi (1):
      x86/microcode: Update the new microcode revision unconditionally
         [8da38ebaad23fe1b0c4a205438676f6356607cfc]

Florian Fainelli (6):
      asix: Check for supported Wake-on-LAN modes
         [c4ce446e33d7a0e978256ac6fea4c80e59d9de5f]
      ax88179_178a: Check for supported Wake-on-LAN modes
         [5ba6b4aa9a410c5e2c6417df52b5e2118ea9b467]
      r8152: Check for supported Wake-on-LAN Modes
         [f2750df1548bd8a2b060eb609fc43ca82811af4c]
      smsc75xx: Check for Wake-on-LAN modes
         [9c734b2769a73eea2e9e9767c0e0bf839ff23679]
      smsc95xx: Check for Wake-on-LAN modes
         [c530c471ba37bdd9fe1c7185b01455c00ae606fb]
      sr9800: Check for supported Wake-on-LAN modes
         [c5cb93e994ffb43b7b3b1ff10b9f928f54574a36]

Florian Schmaus (1):
      bcache: do not assign in if condition in bcache_init()
         [16c1fdf4cfd6c0091e59b93ec2cb7e99973f8244]

Florian Westphal (1):
      netfilter: nf_tables: fix register ordering
         [d209df3e7f7002d9099fdb0f6df0f972b4386a63]

Geert Uytterhoeven (5):
      spi: rspi: Fix interrupted DMA transfers
         [8dbbaa47b96f6ea5f09f922b4effff3c505cd8cf]
      spi: rspi: Fix invalid SPI use during system suspend
         [c1ca59c22c56930b377a665fdd1b43351887830b]
      spi: rspi: Fix leaking of unused DMA descriptors
         [3819bc8752367eae0d72fa1c473dc88ea45631a7]
      spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully
         [85912a88c1ebcad04a5cfec971771195ce8d6691]
      spi: sh-msiof: Add more register documentation
         [2e2b36872d7b45b1f88a590283b14c67931b777f]

Greg Edwards (2):
      block: move bio_integrity_{intervals,bytes} into blkdev.h
         [359f642700f2ff05d9c94cd9216c97af7b8e9553]
      scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices
         [cdcdcaae8450a975e7d07e1bfec21f9b8c016d0c]

Greg Hackmann (1):
      arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid()
         [5ad356eabc47d26a92140a0c4b20eba471c10de3]

Guenter Roeck (3):
      hwmon: (nct6775) Fix access to fan pulse registers
         [c793279c77035053e67937f5743c6ebfc303e7c5]
      mfd: sm501: Set coherent_dma_mask when creating subdevices
         [2f606da78230f09cf1a71fde6ee91d0c710fa2b2]
      of: unittest: Disable interrupt node tests for old world MAC systems
         [8894891446c9380709451b99ab45c5c53adfd2fc]

Guillaume Nault (1):
      pppoe: fix reception of frames with no mac header
         [8540827ebac6b654ab2f69c8fbce9e4fbd6304a0]

Guoju Fang (1):
      bcache: add separate workqueue for journal_write to avoid deadlock
         [0f843e65d9eef4936929bb036c5f771fb261eea4]

Gustavo A. R. Silva (9):
      ASoC: wm8994: Fix missing break in switch
         [ad0eaee6195db1db1749dd46b9e6f4466793d178]
      ASoC: wm8994: Mark expected switch fall-through
         [2cea1542859bc812f1ec51ea71c06e927e5b922e]
      IB/ucm: Fix Spectre v1 vulnerability
         [0295e39595e1146522f2722715dba7f7fba42217]
      RDMA/ucma: Fix Spectre v1 vulnerability
         [a3671a4f973ee9d9621d60166cc3b037c397d604]
      hwmon: (nct6775) Fix potential Spectre v1
         [d49dbfade96d5b0863ca8a90122a805edd5ef50a]
      misc: hmc6352: fix potential Spectre v1
         [de916736aaaadddbd6061472969f667b14204aa9]
      ptp: fix Spectre v1 vulnerability
         [efa61c8cf2950ab5c0e66cff3cabe2a2b24e81ba]
      tty: vt_ioctl: fix potential Spectre v1
         [e97267cb4d1ee01ca0929638ec0fcbb0904f903d]
      usb: gadget: storage: Fix Spectre v1 vulnerability
         [9ae24af3669111d418242caec8dd4ebd9ba26860]

H. Nikolaus Schaller (2):
      power: generic-adc-battery: check for duplicate properties copied from iio channels
         [a427503edaaed9b75ed9746a654cece7e93e60a8]
      power: generic-adc-battery: fix out-of-bounds write when copying channel properties
         [932d47448c3caa0fa99e84d7f5bc302aa286efd8]

Haishuang Yan (1):
      vxlan: fix a potential issue when create a new vxlan fdb entry.
         [17b463654f41f0aa334efd5a6efeab8a6e9496f7]

Han Xu (1):
      mtd: fsl-quadspi: fix macro collision problems with READ/WRITE
         [04850c4d8613127a9b488321c0ad83bff7519311]

Hangbin Liu (2):
      igmp: fix incorrect unsolicit report count after link down and up
         [ff06525fcb8ae3c302ac1319bf6c07c026dea964]
      igmp: fix incorrect unsolicit report count when join group
         [4fb7253e4f9a8f06a986a3b317e2f79d9b43d552]

Hari Bathini (1):
      powerpc/fadump: handle crash memory ranges array index overflow
         [1bd6a1c4b80a28d975287630644e6b47d0f977a5]

Heiner Kallweit (1):
      r8169: fix NAPI handling under high load
         [6b839b6cf9eada30b086effb51e5d6076bafc761]

Hiromitsu Yamasaki (1):
      spi: sh-msiof: Fix handling of write value for SISTR register
         [31a5fae4c5a009898da6d177901d5328051641ff]

Huacai Chen (1):
      MIPS: Change definition of cpu_relax() for Loongson-3
         [a30718868915fbb991a9ae9e45594b059f28e9ae]

Ido Schimmel (1):
      team: Forbid enslaving team device to itself
         [471b83bd8bbe4e89743683ef8ecb78f7029d8288]

Imre Deak (1):
      drm/i915/bdw: Increase IPS disable timeout to 100ms
         [acb3ef0ee40ea657280a4a11d9f60eb2937c0dca]

Jani Nikula (1):
      drm/i915: set DP Main Stream Attribute for color range on DDI platforms
         [dc5977da99ea28094b8fa4e9bacbd29bedc41de5]

Jann Horn (6):
      RDMA/ucma: check fd type in ucma_migrate_id()
         [0d23ba6034b9cf48b8918404367506da3e4b3ee5]
      mm/vmstat.c: skip NR_TLB_REMOTE_FLUSH* properly
         [58bc4c34d249bf1bc50730a9a209139347cfacfe]
      mtdchar: fix overflows in adjustment of `count`
         [6c6bc9ea84d0008024606bf5ba10519e20d851bf]
      proc: restrict kernel stack dumps to root
         [f8a00cef17206ecd1b30d3d9f99e10d9fa707aa7]
      reiserfs: fix broken xattr handling (heap corruption, bad retval)
         [a13f085d111e90469faf2d9965eb39b11c114d7e]
      x86/process: Don't mix user/kernel regs in 64bit __show_regs()
         [9fe6299dde587788f245e9f7a5a1b296fad4e8c7]

Javier Martinez Canillas (1):
      media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data
         [2ec7debd44b49927a6e2861521994cc075a389ed]

Jean Delvare (1):
      ACPI / bus: Only call dmi_check_system() on X86
         [5d128fbd8b20f8a48cb13c3eced789d1f9573ecd]

Jens Axboe (2):
      bcache: don't embed 'return' statements in closure macros
         [77b5a08427e87514c33730afc18cd02c9475e2c3]
      nbd: don't allow invalid blocksize settings
         [bc811f05d77f47059c197a98b6ad242eb03999cb]

Jeremy Cline (2):
      ext4: fix spectre gadget in ext4_mb_regular_allocator()
         [1a5d5e5d51e75a5bca67dadbcea8c841934b7b85]
      fs/quota: Fix spectre gadget in do_quotactl
         [7b6924d94a60c6b8c1279ca003e8744e6cd9e8b1]

Jia-Ju Bai (2):
      usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame()
         [6d4f268fa132742fe96dad22307c68d237356d88]
      usb: misc: uss720: Fix two sleep-in-atomic-context bugs
         [bc8acc214d3f1cafebcbcd101a695bbac716595d]

Jiangyiwen (1):
      9p/virtio: fix off-by-one error in sg list bounds check
         [23cba9cbde0bba05d772b335fe5f66aa82b9ad19]

Jiri Olsa (2):
      perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic
         [0933840acf7b65d6d30a5b6089d882afea57aca3]
      perf/ring_buffer: Prevent concurent ring buffer access
         [cd6fb677ce7e460c25bdd66f689734102ec7d642]

Joel Fernandes (1):
      mm: shmem.c: Correctly annotate new inodes for lockdep
         [b45d71fb89ab8adfe727b9d0ee188ed58582a647]

Johan Hovold (8):
      EDAC, i7core: Fix memleaks and use-after-free on probe and remove
         [6c974d4dfafe5e9ee754f2a6fba0eb1864f1649e]
      EDAC: Fix memleak in module init error path
         [4708aa85d50cc6e962dfa8acf5ad4e0d290a21db]
      USB: serial: io_ti: fix array underflow in completion handler
         [691a03cfe8ca483f9c48153b869d354e4ae3abef]
      USB: serial: kobil_sct: fix modem-status error handling
         [a420b5d939ee58f1d950f0ea782834056520aeaa]
      USB: serial: simple: add Motorola Tetra MTP6550 id
         [f5fad711c06e652f90f581fc7c2caee327c33d31]
      USB: serial: ti_usb_3410_5052: fix array underflow in completion handler
         [5dfdd24eb3d39d815bc952ae98128e967c9bba49]
      tty: fix termios input-speed encoding
         [fada18c48d774b9e837928ecdce6a5d5fdd11ee7]
      tty: fix termios input-speed encoding when using BOTHER
         [1cee38f0363a88db374e50b232ca17b9a4c12fa0]

John Johansen (1):
      apparmor: remove no-op permission check in policy_unpack
         [c037bd615885f1d9d3bdb48531bace79fae1505d]

John Ogness (1):
      USB: serial: sierra: fix potential deadlock at close
         [e60870012e5a35b1506d7b376fddfb30e9da0b27]

Jon Hunter (1):
      ARM: tegra: Fix Tegra30 Cardhu PCA954x reset
         [6e1811900b6fe6f2b4665dba6bd6ed32c6b98575]

Josef Bacik (1):
      Btrfs: fix btrfs_write_inode vs delayed iput deadlock
         [3c4276936f6fbe52884b4ea4e6cc120b890a0f9f]

Julian Wiedmann (1):
      s390/qdio: reset old sbal_state flags
         [64e03ff72623b8c2ea89ca3cb660094e019ed4ae]

Junxiao Bi (1):
      ocfs2: fix ocfs2 read block panic
         [234b69e3e089d850a98e7b3145bd00e9b52b1111]

K. Y. Srinivasan (1):
      Tools: hv: Fix a bug in the key delete code
         [86503bd35dec0ce363e9fdbf5299927422ed3899]

Kees Cook (1):
      pstore/ram: Fix failure-path memory leak in ramoops_init
         [bac6f6cda206ad7cbe0c73c35e494377ce9c4749]

Kirill Tkhai (1):
      fuse: Add missed unlock_page() to fuse_readpages_fill()
         [109728ccc5933151c68d1106e4065478a487a323]

Ladislav Michl (2):
      video: udlfb: Fix unaligned access
         [115e77597efcc94cb1f6cbb7df5cf7ce8feb8632]
      video: udlfb: Remove noisy warnings
         [de4b74bda8e87a4ed45ebc2c26cc3e2eaae38429]

Lars-Peter Clausen (2):
      iio: ad9523: Fix displayed phase
         [5a4e33c1c53ae7d4425f7d94e60e4458a37b349e]
      iio: ad9523: Fix return value for ad952x_store()
         [9a5094ca29ea9b1da301b31fd377c0c0c4c23034]

Leonard Crestez (1):
      crypto: mxs-dcp - Fix wait logic on chan threads
         [d80771c08363ad7fbf0f56f5301e7ca65065c582]

Li Dongyang (1):
      ext4: don't mark mmp buffer head dirty
         [fe18d649891d813964d3aaeebad873f281627fbc]

Liang Chen (1):
      bcache: explicitly destroy mutex while exiting
         [330a4db89d39a6b43f36da16824eaa7a7509d34d]

Linus Torvalds (2):
      Make file credentials available to the seqfile interfaces
         [34dbbcdbf63360661ff7bda6c5f52f99ac515f92]
      mremap: properly flush TLB before releasing the page
         [eb66ae030829605d61fbef1909ce310e29f78821]

Lior David (1):
      wil6210: missing length check in wmi_set_ie
         [b5a8ffcae4103a9d823ea3aa3a761f65779fbe2a]

Lukas Wunner (3):
      PCI: hotplug: Don't leak pci_slot on registration failure
         [4ce6435820d1f1cc2c2788e232735eb244bcc8a3]
      PCI: pciehp: Fix unprotected list iteration in IRQ handler
         [1204e35bedf4e5015cda559ed8c84789a6dae24e]
      PCI: pciehp: Fix use-after-free on unplug
         [281e878eab191cce4259abbbf1a0322e3adae02c]

Lyude Paul (1):
      drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect()
         [6833fb1ec120bf078e1a527c573a09d4de286224]

Maciej W. Rozycki (3):
      MIPS: Correct the 64-bit DSP accumulator register size
         [f5958b4cf4fc38ed4583ab83fb7c4cd1ab05f47b]
      MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
         [148b9aba99e0bbadf361747d21456e1589015f74]
      binfmt_elf: Respect error return from `regset->active'
         [2f819db565e82e5f73cd42b39925098986693378]

Mahesh Salgaonkar (2):
      powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX.
         [74e96bf44f430cf7a01de19ba6cf49b361cdfd6e]
      powerpc/pseries: Fix endianness while restoring of r3 in MCE handler.
         [cd813e1cd7122f2c261dce5b54d1e0c97f80e1a5]

Marcel Ziswiler (1):
      spi: tegra20-slink: explicitly enable/disable clock
         [7001cab1dabc0b72b2b672ef58a90ab64f5e2343]

Mario Limonciello (1):
      platform/x86: alienware-wmi: Correct a memory leak
         [ff0e9f26288d2daee4950f42b37a3d3d30d36ec1]

Martin Kaiser (1):
      mtd: rawnand: mxc: remove __init qualifier from mxcnd_probe_dt
         [24f0ae995deb728076e3ea93fea1949a9775debf]

Masami Hiramatsu (1):
      kprobes: Make list and blacklist root user read only
         [f2a3ab36077222437b4826fc76111caa14562b7c]

Mathias Nyman (3):
      usb: Avoid use-after-free by flushing endpoints early in usb_set_interface()
         [f9a5b4f58b280c1d26255376713c132f93837621]
      usb: Don't die twice if PCI xhci host is not responding in resume
         [f3dc41c5d22b2ca14a0802a65d8cdc33a3882d4e]
      xhci: Add missing CAS workaround for Intel Sunrise Point xHCI
         [ffe84e01bb1b38c7eb9c6b6da127a6c136d251df]

Mathieu OTHACEHE (1):
      USB: serial: ti_usb_3410_5052: use functions rather than macros
         [d8d841e8332779fae2b18420d39ef407ea3729da]

Matthias Brugger (1):
      tty: fix typo in comment of tty_termios_encode_baud_rate
         [a1d51aa2214cea3f91611893610a2f769cada0e7]

Mauricio Faria de Oliveira (2):
      partitions/aix: append null character to print data from disk
         [d43fdae7bac2def8c4314b5a49822cb7f08a45f1]
      partitions/aix: fix usage of uninitialized lv_info and lvname structures
         [14cb2c8a6c5dae57ee3e2da10fa3db2b9087e39e]

Mauro Carvalho Chehab (1):
      media: rtl28xxu: be sure that it won't go past the array size
         [845b978a871bff3707eee611b32e4be0b9a94dd2]

Max Filippov (2):
      xtensa: increase ranges in ___invalidate_{i,d}cache_all
         [fec3259c9f747c039f90e99570540114c8d81a14]
      xtensa: limit offsets in __loop_cache_{all,page}
         [be75de25251f7cf3e399ca1f584716a95510d24a]

Maxence Duprès (1):
      USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller
         [9b83a1c301ad6d24988a128c69b42cbaaf537d82]

Mian Yousaf Kaukab (1):
      usb: gadget: net2280: fix pullup handling
         [11bece5e063ca567e631c6ea3b1611c10dbc3282]

Michael Bringmann (1):
      powerpc/pseries: Fix unitialized timer reset on migration
         [8604895a34d92f5e186ceb931b0d1b384030ea3d]

Michael Büsch (2):
      b43/leds: Ensure NUL-termination of LED name string
         [2aa650d1950fce94f696ebd7db30b8830c2c946f]
      b43legacy/leds: Ensure NUL-termination of LED name string
         [4d77a89e3924b12f4a5628b21237e57ab4703866]

Mika Båtsman (1):
      media: gl861: fix probe of dvb_usb_gl861
         [48db0089bff6f9154f6bd98ce7a6ae3786fa8ebe]

Mike Christie (1):
      iscsi target: fix session creation failure handling
         [26abc916a898d34c5ad159315a2f683def3c5555]

Mike Snitzer (1):
      dm cache metadata: save in-core policy_hint_size to on-disk superblock
         [fd2fa95416188a767a63979296fa3e169a9ef5ec]

Miklos Szeredi (3):
      fuse: Fix oops at process_init_reply()
         [e8f3bd773d22f488724dffb886a1618da85c2966]
      fuse: don't wake up reserved req in fuse_conn_kill()
         [0c4dd4ba1426c599072511dcf95a15ee5e12725b]
      fuse: flush requests on umount
         [580640ba5d331eb5631a5de46941c98f5ed90886]

Mikulas Patocka (13):
      dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion deadlock
         [432061b3da64e488be3403124a72a9250bbe96d4]
      fb: fix lost console when the user unplugs a USB adapter
         [8c5b044299951acd91e830a688dd920477ea1eda]
      mach64: detect the dot clock divider correctly on sparc
         [76ebebd2464c5c8a4453c98b6dbf9c95a599e810]
      udl-kms: change down_interruptible to down
         [8456b99c16d193c4c3b7df305cf431e027f0189c]
      udl-kms: fix crash due to uninitialized memory
         [09a00abe3a9941c2715ca83eb88172cd2f54d8fd]
      udl-kms: handle allocation failure
         [542bb9788a1f485eb1a2229178f665d8ea166156]
      udlfb: don't switch if we are switching to the same videomode
         [564f1807379298dfdb12ed0d5b25fcb89c238527]
      udlfb: fix display corruption of the last line
         [4e705e17ce3409a1f492cfd5dadcf6a4f6075842]
      udlfb: fix semaphore value leak
         [9d0aa601e4cd9c0892f90d36e8488d79b72f4073]
      udlfb: handle allocation failure
         [080fb5240bdcabed7387b814139c3ea172d59fc5]
      udlfb: make a local copy of fb_ops
         [2c29cfc3eaf11779176bf41475cfca49bccba11c]
      udlfb: set line_length in dlfb_ops_set_par
         [0ac319b7af1bb24a33365d0ec82a2f56a59b2a78]
      udlfb: set optimal write delay
         [bb24153a3f13dd0dbc1f8055ad97fe346d598f66]

Nadav Amit (1):
      x86/mm: Use WRITE_ONCE() when setting PTEs
         [9bc4f28af75a91aea0ae383f50b0a430c4509303]

Nicholas Mc Guire (3):
      ALSA: snd-aoa: add of_node_put() in error path
         [222bce5eb88d1af656419db04bcd84b2419fb900]
      ARM: hisi: handle of_iomap and fix missing of_node_put
         [d396cb185c0337aae5664b250cdd9a73f6eb1503]
      cifs: check kmalloc before use
         [126c97f4d0d1b5b956e8b0740c81a2b2a2ae548c]

Nicholas Piggin (1):
      mm: move tlb_table_flush to tlb_flush_mmu_free
         [db7ddef301128dad394f1c0f77027f86ee9a4edb]

Oliver Neukum (3):
      USB: usbdevfs: restore warning for nonsensical flags
         [81e0403b26d94360abd1f6a57311337973bc82cd]
      USB: usbdevfs: sanitize flags more
         [7a68d9fb851012829c29e770621905529bd9490b]
      usb: uas: add support for more quirk flags
         [42d1c6d4a06a77b3ab206a919b9050c3080f3a71]

Olle Liljenzin (1):
      platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill
         [5d9f40b56630a8702b5f7a61a770f9b73aa07464]

Ondrej Mosnáček (1):
      audit: Fix extended comparison of GID/EGID
         [af85d1772e31fed34165a1b3decef340cf4080c0]

Paolo Abeni (2):
      ip6_tunnel: be careful when accessing the inner header
         [76c0ddd8c3a683f6e2c6e60e11dc1a1558caf4bc]
      ip_tunnel: be careful when accessing the inner header
         [ccfec9e5cb2d48df5a955b7bf47f7782157d3bc2]

Parav Pandit (1):
      RDMA/cma: Protect cma dev list with lock
         [954a8e3aea87e896e320cf648c1a5bbe47de443e]

Paul Mackerras (1):
      KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function
         [46dec40fb741f00f1864580130779aeeaf24fb3d]

Pavel Tikhomirov (1):
      mm: cleancache: fix corruption on missed inode invalidation
         [6ff38bd40230af35e446239396e5fc8ebd6a5248]

Peter Zijlstra (3):
      mm/tlb: Remove tlb_remove_table() non-concurrent condition
         [a6f572084fbee8b30f91465f4a085d7a90901c57]
      perf/core: Fix perf_pmu_unregister() locking
         [a9f9772114c8b07ae75bcb3654bd017461248095]
      x86/percpu: Fix this_cpu_read()
         [b59167ac7bafd804c91e49ad53c6d33a7394d4c8]

Piaojun (1):
      fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed
         [3111784bee81591ea2815011688d28b65df03627]

Prarit Bhargava (1):
      x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
         [370a132bb2227ff76278f98370e0e701d86ff752]

Punit Agrawal (2):
      KVM: arm/arm64: Skip updating PMD entry if no change
         [86658b819cd0a9aa584cd84453ed268a6f013770]
      KVM: arm/arm64: Skip updating PTE entry if no change
         [976d34e2dab10ece5ea8fe7090b7692913f89084]

Rafael J. Wysocki (1):
      PM / core: Clear the direct_complete flag on errors
         [69e445ab8b66a9f30519842ef18be555d3ee9b51]

Rian Hunter (1):
      x86/process: Re-export start_thread()
         [dc76803e57cc86589c4efcb5362918f9b0c0436f]

Richard Weinberger (4):
      ubifs: Check data node size before truncate
         [95a22d2084d72ea067d8323cc85677dba5d97cae]
      ubifs: Check for name being NULL while mounting
         [37f31b6ca4311b94d985fb398a72e5399ad57925]
      ubifs: Fix memory leak in lprobs self-check
         [eef19816ada3abd56d9f20c88794cc2fea83ebb2]
      ubifs: Fix synced_i_size calculation for xattr inodes
         [59965593205fa4044850d35ee3557cf0b7edcd14]

Roopa Prabhu (2):
      vxlan: add new fdb alloc and create helpers
         [25e20e730d56471cffa25419bf2a66078bd55330]
      vxlan: fix default fdb entry netlink notify ordering during netdev create
         [0241b836732f5f43c3f0fd9e9073c1fb24ea6757]

Sabrina Dubroca (2):
      ipv6: fix cleanup ordering for pingv6 registration
         [a03dc36bdca6b614651fedfcd8559cf914d2d21d]
      net: ipv4: update fnhe_pmtu when first hop's MTU changes
         [af7d6cce53694a88d6a1bb60c9a239a6a5144459]

Sagi Grimberg (1):
      iscsi-target: nullify session in failed login sequence
         [a0b3b9b2409b409c677f7eb1e0485b816a5848f7]

Sebastian Ott (1):
      s390/pci: fix out of bounds access during irq setup
         [866f3576a72b2233a76dffb80290f8086dc49e17]

Shahed Shaikh (1):
      qlcnic: fix Tx descriptor corruption on 82xx devices
         [c333fa0c4f220f8f7ea5acd6b0ebf3bf13fd684d]

Shenghui Wang (1):
      dm cache: destroy migration_cache if cache target registration failed
         [c7cd55504a5b0fc826a2cd9540845979d24ae542]

Shuah Khan (1):
      usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control()
         [81f7567c51ad97668d1c3a48e8ecc482e64d4161]

Shubhrajyoti Datta (1):
      i2c: xiic: Make the start and the byte count write atomic
         [ae7304c3ea28a3ba47a7a8312c76c654ef24967e]

Simon Vincent (1):
      ieee802154: 6lowpan: ensure header compression does not corrupt ipv6 header
         [f19f4f9525cf32f97341fac20ce66392e86a1b67]

Steffen Klassert (1):
      xfrm: Validate address prefix lengths in the xfrm selector.
         [07bf7908950a8b14e81aa1807e3c667eab39287a]

Steve French (4):
      SMB3: Backup intent flag missing for directory opens with backupuid mounts
         [5e19697b56a64004e2d0ff1bb952ea05493c088f]
      cifs: add missing debug entries for kconfig options
         [950132afd59385caf6e2b84e5235d069fa10681d]
      smb3: check for and properly advertise directory lease support
         [f801568332321e2b1e7a8bd26c3e4913a312a2ec]
      smb3: fill in statfs fsid and correct namelen
         [21ba3845b59c733a79ed4fe1c4f3732e7ece9df7]

Steve Wise (3):
      RDMA/cxgb4: Only call CQ completion handler if it is armed
         [678ea9b5baab6800692b249bdba77c3c07261d61]
      iw_cxgb4: atomically flush the qp
         [bc52e9ca74b9a395897bb640c6671b2cbf716032]
      iw_cxgb4: only allow 1 flush on user qps
         [308aa2b8f7b7db3332a7d41099fd37851fb793b2]

Steven Rostedt (3):
      tracing/blktrace: Fix to allow setting same value
         [757d9140072054528b13bbe291583d9823cde195]
      tracing: Do not call start/stop() functions when tracing_on does not change
         [f143641bfef9a4a60c57af30de26c63057e7e695]
      uprobes: Use synchronize_rcu() not synchronize_sched()
         [016f8ffc48cb01d1e7701649c728c5d2e737d295]

Sven Eckelmann (8):
      ath10k: prevent active scans on potential unusable channels
         [3f259111583801013cb605bb4414aa529adccf1c]
      batman-adv: Place kref_get for softif_vlan near use
         [df28ca6bb3282a4c8dc5b65f60b0136fc190ee52]
      batman-adv: Prevent duplicated gateway_node entry
         [dff9bc42ab0b2d38c5e90ddd79b238fed5b4c7ad]
      batman-adv: Prevent duplicated global TT entry
         [e7136e48ffdfb9f37b0820f619380485eb407361]
      batman-adv: Prevent duplicated nc_node entry
         [fa122fec8640eb7186ce5a41b83a4c1744ceef8f]
      batman-adv: Prevent duplicated softif_vlan entry
         [94cb82f594ed86be303398d6dfc7640a6f1d45d4]
      batman-adv: Prevent duplicated tvlv handler
         [ae3cdc97dc10c7a3b31f297dab429bfb774c9ccb]
      batman-adv: Use kref_get for batadv_nc_get_nc_node
         [0de32ceee156787429035c974316f4e5098cf722]

Sylwester Nawrocki (1):
      media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()
         [7c1b9a5aeed91bef98988ac0fcf38c8c1f4f9a3a]

Taehee Yoo (1):
      netfilter: nft_set: fix allocation size overflow in privsize callback.
         [4ef360dd6a65f6ef337645e1b65e744034754b19]

Takashi Iwai (9):
      ALSA: cs5535audio: Fix invalid endian conversion
         [69756930f2de0457d51db7d505a1e4f40e9fd116]
      ALSA: memalloc: Don't exceed over the requested size
         [dfef01e150824b0e6da750cacda8958188d29aea]
      ALSA: seq: Fix poll() error return
         [a49a71f6e25da2acc637fcd31e73debd96ca18f8]
      ALSA: virmidi: Fix too long output trigger loop
         [50e9ffb1996a5d11ff5040a266585bad4ceeca0a]
      ALSA: vx222: Fix invalid endian conversions
         [fff71a4c050ba46e305d910c837b99ba1728135e]
      ALSA: vx: Fix possible transfer overflow
         [874e1f6fad9a5184b67f4cee37c1335cd2cc5677]
      ALSA: vxpocket: Fix invalid endian conversions
         [3acd3e3bab95ec3622ff98da313290ee823a0f68]
      EDAC: i7core: Return proper error codes for kzalloc() errors
         [e97d7e38162dc305b4734a316ca758a2bbd1fa6e]
      platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too
         [58e73aa177850babb947555257fd4f79e5275cf1]

Takashi Sakamoto (1):
      ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping
         [493626f2d87a74e6dbea1686499ed6e7e600484e]

Thadeu Lima de Souza Cascardo (1):
      xfrm6: call kfree_skb when skb is toobig
         [215ab0f021c9fea3c18b75e7d522400ee6a49990]

Theodore Ts'o (6):
      ext4: avoid divide by zero fault when deleting corrupted inline directories
         [4d982e25d0bdc83d8c64e66fdeca0b89240b3b85]
      ext4: check for NUL characters in extended attribute's name
         [7d95178c77014dbd8dce36ee40bbbc5e6c121ff5]
      ext4: check to make sure the rename(2)'s destination is not freed
         [b50282f3241acee880514212d88b6049fb5039c8]
      ext4: fix online resize's handling of a too-small final block group
         [f0a459dec5495a3580f8d784555e6f8f3bf7f263]
      ext4: fix online resizing for bigalloc file systems with a 1k block size
         [5f8c10936fab2b69a487400f2872902e597dd320]
      ext4: prevent online resize with backup superblock
         [011fa99404bea3f5d897c4983f6bd51170e3b18f]

Thomas Gleixner (3):
      alarmtimer: Prevent overflow for relative nanosleep
         [5f936e19cc0ef97dbe3a56e9498922ad5ba1edef]
      posix-timers: Sanitize overrun handling
         [78c9c4dfbf8c04883941445a195276bb4bb92c76]
      x86/boot: Move EISA setup to a separate file
         [f7eaf6e00fd581043bb540dfe865f1d81769b189]

Thomas Petazzoni (2):
      ARM: 8799/1: mm: fix pci_ioremap_io() offset check
         [3a58ac65e2d7969bcdf1b6acb70fa4d12a88e53e]
      PCI: mvebu: Fix I/O space end address calculation
         [dfd0309fd7b30a5baffaf47b2fccb88b46d64d69]

Thomas Werschlein (1):
      cifs: connect to servername instead of IP for IPC$ share
         [395a2076b4064f97d3fce03af15210ff2a7bb7f9]

Tim Anderson (1):
      USB: Add quirk to support DJI CineSSD
         [f45681f9becaa65111ed0a691ccf080a0cd5feb8]

Tomas Bortoli (3):
      9p: fix multiple NULL-pointer-dereferences
         [10aa14527f458e9867cf3d2cc6b8cb0f6704448b]
      net/9p/client.c: version pointer uninitialized
         [7913690dcc5e18e235769fd87c34143072f5dbea]
      net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree()
         [430ac66eb4c5b5c4eb846b78ebf65747510b30f1]

Tomi Valkeinen (1):
      fbdev/omapfb: fix omapfb_memory_read infoleak
         [1bafcbf59fed92af58955024452f45430d3898c5]

Tycho Andersen (1):
      uart: fix race between uart_put_char() and uart_shutdown()
         [a5ba1d95e46ecaea638ddd7cd144107c783acb5d]

Vaibhav Nagarnaik (1):
      ring-buffer: Allow for rescheduling when removing pages
         [83f365554e47997ec68dc4eca3f5dce525cd15c3]

Varka Bhadram (1):
      mac802154: common tx error path
         [f55889128a776b51581394b20abd0b470304cf95]

Vignesh R (2):
      pwm: tiehrpwm: Don't use emulation mode bits to control PWM output
         [aa49d628f6e016bcec8c6f8e704b9b18ee697329]
      pwm: tiehrpwm: Fix disabling of output of PWMs
         [38dabd91ff0bde33352ca3cc65ef515599b77a05]

Vineet Gupta (1):
      ARC: clone syscall to setp r25 as thread pointer
         [c58a584f05e35d1d4342923cd7aac07d9c3d3d16]

Vitaly Kuznetsov (2):
      tools: hv: fcopy: set 'error' in case an unknown operation was requested
         [c2d68afba86d1ff01e7300c68bc16a9234dcd8e9]
      xen-netfront: fix queue name setting
         [2d408c0d4574b01b9ed45e02516888bf925e11a9]

Wei Wang (2):
      ipv6: take rcu lock in rawv6_send_hdrinc()
         [a688caa34beb2fd2a92f1b6d33e40cde433ba160]
      l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
         [6d37fa49da1e8db8fb1995be22ac837ca41ac8a8]

Willy Tarreau (1):
      ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO
         [49434c6c575d2008c0abbc93e615019f39e01252]

Yelena Krivosheev (1):
      net: mvneta: fix mtu change on port without link
         [8466baf788ec3e18836bd9c91ba0b1a07af25878]

Young_X (1):
      cdrom: fix improper type cast, which can leat to information leak.
         [e4f3aa2e1e67bb48dfbaaf1cad59013d5a5bc276]

Yu Zhao (1):
      regulator: fix crash caused by null driver data
         [fb6de923ca3358a91525552b4907d4cb38730bdd]

YueHaibing (2):
      pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state
         [b5031b7db77dc47f474f0efc2b2552c32b7bb59d]
      xfrm: fix 'passing zero to ERR_PTR()' warning
         [934ffce1343f22ed5e2d0bd6da4440f4848074de]

 Makefile                                           |   4 +-
 arch/arc/kernel/process.c                          |  20 +
 arch/arm/boot/dts/tegra30-cardhu.dtsi              |   1 +
 arch/arm/kvm/mmu.c                                 |  42 ++-
 arch/arm/mach-hisi/hotplug.c                       |  19 +-
 arch/arm/mm/ioremap.c                              |   2 +-
 arch/arm64/kvm/guest.c                             |  45 +++
 arch/arm64/mm/init.c                               |   6 +-
 arch/mips/include/asm/processor.h                  |  15 +-
 arch/mips/kernel/ptrace.c                          |   2 +-
 arch/mips/kernel/ptrace32.c                        |   2 +-
 arch/mips/lib/memset.S                             |   4 +-
 arch/powerpc/include/asm/fadump.h                  |   3 -
 arch/powerpc/kernel/fadump.c                       |  92 ++++-
 arch/powerpc/kvm/book3s_64_mmu_hv.c                |   2 +-
 arch/powerpc/mm/numa.c                             |   4 +-
 arch/powerpc/platforms/powernv/pci-ioda.c          |  37 ++
 arch/powerpc/platforms/pseries/ras.c               |   4 +-
 arch/powerpc/sysdev/mpic_msgr.c                    |   2 +-
 arch/s390/include/asm/qdio.h                       |   1 -
 arch/s390/mm/fault.c                               |   2 +
 arch/s390/pci/pci.c                                |   2 +
 arch/x86/include/asm/kdebug.h                      |  12 +-
 arch/x86/include/asm/microcode_intel.h             |  15 +
 arch/x86/include/asm/percpu.h                      |   8 +-
 arch/x86/include/asm/pgtable_64.h                  |  16 +-
 arch/x86/include/asm/processor.h                   |   4 +-
 arch/x86/kernel/Makefile                           |   1 +
 arch/x86/kernel/cpu/bugs.c                         |  46 ++-
 arch/x86/kernel/cpu/common.c                       |   1 +
 arch/x86/kernel/cpu/intel.c                        |  14 +-
 arch/x86/kernel/cpu/microcode/amd.c                |  22 +-
 arch/x86/kernel/cpu/microcode/intel.c              |  31 +-
 arch/x86/kernel/cpu/microcode/intel_early.c        |  33 +-
 arch/x86/kernel/dumpstack_32.c                     |   2 +-
 arch/x86/kernel/dumpstack_64.c                     |   2 +-
 arch/x86/kernel/paravirt.c                         |   4 +-
 arch/x86/kernel/process_32.c                       |   4 +-
 arch/x86/kernel/process_64.c                       |  11 +-
 arch/x86/kernel/traps.c                            |  13 -
 arch/x86/mm/kmemcheck/error.c                      |   2 +-
 arch/x86/mm/pgtable.c                              |   6 +-
 arch/x86/vdso/vclock_gettime.c                     |  18 +-
 arch/xtensa/include/asm/cacheasm.h                 |  69 ++--
 block/bio-integrity.c                              |  26 --
 block/partitions/aix.c                             |  13 +-
 crypto/ablkcipher.c                                |  57 ++-
 crypto/blkcipher.c                                 |  54 ++-
 crypto/cts.c                                       |   3 +-
 crypto/sha1_generic.c                              |   2 +-
 crypto/sha256_generic.c                            |   5 +-
 crypto/sha512_generic.c                            |   2 +-
 crypto/tgr192.c                                    |   4 +-
 crypto/vmac.c                                      | 412 +++++++++------------
 crypto/wp512.c                                     |   8 +-
 drivers/acpi/bus.c                                 |  13 +-
 drivers/base/power/main.c                          |   5 +-
 drivers/block/nbd.c                                |   3 +
 drivers/cdrom/cdrom.c                              |   2 +-
 drivers/char/ipmi/ipmi_bt_sm.c                     |  92 ++---
 drivers/crypto/mxs-dcp.c                           |  53 +--
 drivers/edac/edac_mc_sysfs.c                       |   6 +-
 drivers/edac/i7core_edac.c                         |  24 +-
 drivers/gpu/drm/drm_fb_helper.c                    |  91 ++---
 drivers/gpu/drm/i915/i915_reg.h                    |   1 +
 drivers/gpu/drm/i915/intel_ddi.c                   |   4 +
 drivers/gpu/drm/i915/intel_display.c               |   8 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c        |  20 +-
 drivers/gpu/drm/panel/panel-s6e8aa0.c              |   2 +-
 drivers/gpu/drm/udl/udl_fb.c                       |  10 +-
 drivers/gpu/drm/udl/udl_main.c                     |  35 +-
 drivers/hv/connection.c                            |   8 +-
 drivers/hwmon/nct6775.c                            |  28 +-
 drivers/i2c/busses/i2c-xiic.c                      |   4 +
 drivers/iio/frequency/ad9523.c                     |   4 +-
 drivers/infiniband/core/cma.c                      |  12 +-
 drivers/infiniband/core/ucm.c                      |   3 +
 drivers/infiniband/core/ucma.c                     |   9 +
 drivers/infiniband/hw/cxgb4/ev.c                   |   1 +
 drivers/infiniband/hw/cxgb4/qp.c                   |  62 +++-
 drivers/infiniband/hw/cxgb4/t4.h                   |  11 +
 drivers/infiniband/ulp/ipoib/ipoib_cm.c            |   2 +
 drivers/infiniband/ulp/ipoib/ipoib_multicast.c     |   1 +
 drivers/infiniband/ulp/srpt/ib_srpt.c              |   6 +-
 drivers/infiniband/ulp/srpt/ib_srpt.h              |   4 +-
 drivers/input/mouse/elantech.c                     |   2 +
 drivers/leds/leds-max8997.c                        |   2 +-
 drivers/md/bcache/bcache.h                         |   1 +
 drivers/md/bcache/closure.h                        |   3 -
 drivers/md/bcache/io.c                             |   1 +
 drivers/md/bcache/journal.c                        |   8 +-
 drivers/md/bcache/request.c                        |  14 +-
 drivers/md/bcache/super.c                          |  29 +-
 drivers/md/dm-cache-metadata.c                     |   3 +-
 drivers/md/dm-cache-target.c                       |   5 +-
 drivers/md/dm-crypt.c                              |   8 +-
 drivers/media/platform/exynos4-is/fimc-isp-video.c |  11 +-
 drivers/media/platform/omap3isp/isp.c              |   2 +-
 drivers/media/usb/dvb-usb-v2/gl861.c               |  17 +-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c            |   2 +-
 drivers/mfd/sm501.c                                |   1 +
 drivers/misc/hmc6352.c                             |   2 +
 drivers/misc/mei/nfc.c                             |   2 +-
 drivers/misc/vmw_vmci/vmci_queue_pair.c            |   4 +-
 drivers/mtd/mtdchar.c                              |  10 +-
 drivers/mtd/nand/mxc_nand.c                        |   4 +-
 drivers/mtd/spi-nor/fsl-quadspi.c                  |  20 +-
 drivers/net/ethernet/cadence/macb.c                |  10 +-
 drivers/net/ethernet/marvell/mvneta.c              |   1 -
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h        |   8 +-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c    |   3 +-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h    |   3 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h     |   3 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c     |  12 +-
 drivers/net/ethernet/realtek/r8169.c               |   8 +-
 drivers/net/ppp/pppoe.c                            |   3 +
 drivers/net/team/team.c                            |   5 +
 drivers/net/usb/asix_common.c                      |   3 +
 drivers/net/usb/ax88179_178a.c                     |   3 +
 drivers/net/usb/r8152.c                            |   3 +
 drivers/net/usb/smsc75xx.c                         |   3 +
 drivers/net/usb/smsc95xx.c                         |   3 +
 drivers/net/usb/sr9800.c                           |   3 +
 drivers/net/vxlan.c                                | 103 ++++--
 drivers/net/wireless/ath/ath10k/mac.c              |   7 +
 drivers/net/wireless/ath/wil6210/wmi.c             |   7 +-
 drivers/net/wireless/b43/leds.c                    |   2 +-
 drivers/net/wireless/b43legacy/leds.c              |   2 +-
 drivers/net/wireless/libertas/dev.h                |   1 +
 drivers/net/wireless/libertas/if_sdio.c            |  34 +-
 drivers/net/wireless/rndis_wlan.c                  |   2 +
 drivers/net/xen-netfront.c                         |   2 +-
 drivers/of/selftest.c                              |  28 +-
 drivers/pci/host/pci-mvebu.c                       |   2 +-
 drivers/pci/hotplug/pci_hotplug_core.c             |   9 +
 drivers/pci/hotplug/pciehp.h                       |   1 +
 drivers/pci/hotplug/pciehp_core.c                  |   5 +
 drivers/pci/hotplug/pciehp_hpc.c                   |  18 +-
 drivers/pci/pci.c                                  |  27 +-
 drivers/pinctrl/berlin/berlin.c                    |  13 +-
 drivers/pinctrl/pinctrl-imx.c                      |   2 +-
 drivers/pinctrl/pinctrl-imx1-core.c                |   2 +-
 drivers/pinctrl/pinctrl-msm.c                      |  10 +-
 drivers/platform/x86/alienware-wmi.c               |   1 +
 drivers/platform/x86/ideapad-laptop.c              |   7 +
 drivers/power/generic-adc-battery.c                |  25 +-
 drivers/ptp/ptp_chardev.c                          |   4 +
 drivers/pwm/pwm-tiehrpwm.c                         |  13 +-
 drivers/regulator/core.c                           |   3 +-
 drivers/s390/cio/qdio_main.c                       |   5 +-
 drivers/scsi/aic94xx/aic94xx_init.c                |   4 +-
 drivers/scsi/scsi_sysfs.c                          |  20 +-
 drivers/scsi/virtio_scsi.c                         |   6 +-
 drivers/spi/spi-rspi.c                             | 140 +++++--
 drivers/spi/spi-sh-msiof.c                         |  57 ++-
 drivers/spi/spi-tegra20-slink.c                    |  31 +-
 drivers/staging/rts5208/sd.c                       |   2 +-
 drivers/staging/usbip/vhci_hcd.c                   |  43 ++-
 drivers/target/iscsi/iscsi_target_login.c          |  35 +-
 drivers/target/iscsi/iscsi_target_tpg.c            |   3 +-
 drivers/tty/serial/cpm_uart/cpm_uart_core.c        |  10 +-
 drivers/tty/serial/pxa.c                           |   3 +-
 drivers/tty/serial/serial_core.c                   |  17 +-
 drivers/tty/tty_ioctl.c                            |  15 +-
 drivers/tty/vt/vt_ioctl.c                          |   4 +
 drivers/uio/uio.c                                  |   3 +-
 drivers/usb/core/devio.c                           |  24 +-
 drivers/usb/core/driver.c                          |  50 +--
 drivers/usb/core/hcd-pci.c                         |   2 -
 drivers/usb/core/message.c                         |  11 +
 drivers/usb/core/quirks.c                          |   7 +
 drivers/usb/core/usb.c                             |   2 +
 drivers/usb/gadget/f_mass_storage.c                |   3 +
 drivers/usb/gadget/net2280.c                       |  36 +-
 drivers/usb/host/u132-hcd.c                        |   2 +-
 drivers/usb/host/xhci-pci.c                        |   2 +
 drivers/usb/misc/uss720.c                          |   4 +-
 drivers/usb/misc/yurex.c                           |   5 +-
 drivers/usb/serial/io_ti.h                         |   2 +-
 drivers/usb/serial/kobil_sct.c                     |  12 +-
 drivers/usb/serial/sierra.c                        |   4 +-
 drivers/usb/serial/ti_usb_3410_5052.c              |  13 +-
 drivers/usb/serial/ti_usb_3410_5052.h              |   2 -
 drivers/usb/serial/usb-serial-simple.c             |   3 +-
 drivers/usb/storage/scsiglue.c                     |   9 +
 drivers/usb/storage/uas.c                          |  20 +
 drivers/usb/storage/unusual_devs.h                 |   7 +
 drivers/video/fbdev/aty/atyfb.h                    |   3 +-
 drivers/video/fbdev/aty/atyfb_base.c               |   7 +-
 drivers/video/fbdev/aty/mach64_ct.c                |  10 +-
 drivers/video/fbdev/core/fbmem.c                   |  38 +-
 drivers/video/fbdev/omap/omapfb_main.c             |   2 +-
 drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c    |   5 +-
 drivers/video/fbdev/udlfb.c                        | 140 ++++---
 fs/9p/xattr.c                                      |   6 +-
 fs/binfmt_elf.c                                    |   2 +-
 fs/btrfs/disk-io.c                                 |  10 +-
 fs/btrfs/inode.c                                   |  25 --
 fs/btrfs/super.c                                   |   1 -
 fs/btrfs/volumes.c                                 |  10 +-
 fs/cachefiles/namei.c                              |   2 +-
 fs/cifs/cifs_debug.c                               |  30 +-
 fs/cifs/cifsfs.c                                   |  20 +-
 fs/cifs/connect.c                                  |   9 +-
 fs/cifs/inode.c                                    |   2 +
 fs/cifs/readdir.c                                  |  11 +-
 fs/cifs/sess.c                                     |   6 +
 fs/cifs/smb2ops.c                                  |  23 +-
 fs/cifs/smb2pdu.c                                  |  40 +-
 fs/cifs/smb2pdu.h                                  |  11 +
 fs/ext4/dir.c                                      |  20 +-
 fs/ext4/inline.c                                   |   4 +-
 fs/ext4/mballoc.c                                  |   4 +-
 fs/ext4/mmp.c                                      |   1 -
 fs/ext4/namei.c                                    |   6 +
 fs/ext4/resize.c                                   |  45 ++-
 fs/ext4/xattr.c                                    |   2 +
 fs/fuse/cuse.c                                     |   2 +-
 fs/fuse/dev.c                                      |   7 +-
 fs/fuse/file.c                                     |   1 +
 fs/fuse/fuse_i.h                                   |   2 -
 fs/fuse/inode.c                                    |  37 +-
 fs/ocfs2/buffer_head_io.c                          |   1 +
 fs/ocfs2/dlm/dlmmaster.c                           |   4 +-
 fs/proc/base.c                                     |  14 +
 fs/pstore/ram.c                                    |  29 +-
 fs/pstore/ram_core.c                               |  17 +-
 fs/quota/quota.c                                   |   5 +-
 fs/reiserfs/xattr.c                                |   6 +-
 fs/seq_file.c                                      |   7 +-
 fs/sysfs/file.c                                    |  44 +++
 fs/ubifs/journal.c                                 |  16 +-
 fs/ubifs/lprops.c                                  |   8 +-
 fs/ubifs/super.c                                   |   3 +
 fs/xattr.c                                         |   2 +-
 fs/xfs/xfs_attr.c                                  |   9 +-
 include/crypto/vmac.h                              |  63 ----
 include/linux/blkdev.h                             |  38 ++
 include/linux/cpuidle.h                            |   3 +
 include/linux/netdevice.h                          |   7 +
 include/linux/percpu_counter.h                     |  13 +-
 include/linux/posix-timers.h                       |   4 +-
 include/linux/seq_file.h                           |  13 +-
 include/linux/skbuff.h                             |   5 +
 include/linux/sysfs.h                              |  14 +
 include/linux/usb.h                                |   2 +-
 include/net/ip_fib.h                               |   1 +
 include/net/netfilter/nf_tables.h                  |   4 +-
 include/video/udlfb.h                              |   5 +-
 kernel/auditsc.c                                   |   8 +-
 kernel/events/core.c                               |  15 +-
 kernel/kprobes.c                                   |   4 +-
 kernel/posix-cpu-timers.c                          |   2 +-
 kernel/posix-timers.c                              |  31 +-
 kernel/sched/idle.c                                |   2 +-
 kernel/time/alarmtimer.c                           |   3 +-
 kernel/trace/blktrace.c                            |   4 +
 kernel/trace/ring_buffer.c                         |   2 +
 kernel/trace/trace.c                               |   4 +-
 kernel/trace/trace_uprobe.c                        |   2 +-
 lib/percpu_counter.c                               |   6 +-
 mm/huge_memory.c                                   |   6 +-
 mm/madvise.c                                       |   2 +-
 mm/memory.c                                        |  15 +-
 mm/mremap.c                                        |  21 +-
 mm/shmem.c                                         |   2 +
 mm/truncate.c                                      |   8 +-
 mm/vmstat.c                                        |   3 +
 net/9p/client.c                                    |   2 +-
 net/9p/trans_fd.c                                  |   7 +-
 net/9p/trans_rdma.c                                |   3 +
 net/9p/trans_virtio.c                              |  13 +-
 net/batman-adv/gateway_client.c                    |  11 +-
 net/batman-adv/main.c                              |   8 +-
 net/batman-adv/network-coding.c                    |  34 +-
 net/batman-adv/soft-interface.c                    |  27 +-
 net/batman-adv/translation-table.c                 |   6 +-
 net/core/dev.c                                     |  28 +-
 net/core/rtnetlink.c                               |   6 +
 net/core/skbuff.c                                  |  12 +-
 net/ieee802154/6lowpan_rtnl.c                      | 140 +++++--
 net/ipv4/fib_frontend.c                            |   4 +
 net/ipv4/fib_semantics.c                           |  50 +++
 net/ipv4/igmp.c                                    |   8 +-
 net/ipv4/ip_tunnel.c                               |   9 +
 net/ipv6/addrconf.c                                |   6 +-
 net/ipv6/af_inet6.c                                |   4 +-
 net/ipv6/ip6_output.c                              |   3 +-
 net/ipv6/ip6_tunnel.c                              |  13 +-
 net/ipv6/raw.c                                     |  34 +-
 net/ipv6/xfrm6_output.c                            |   2 +
 net/l2tp/l2tp_core.c                               |   2 +-
 net/mac80211/cfg.c                                 |   2 +-
 net/mac802154/tx.c                                 |  35 +-
 net/netfilter/nf_tables_api.c                      |  10 +-
 net/netfilter/nft_hash.c                           |   2 +-
 net/netfilter/nft_rbtree.c                         |   2 +-
 net/sched/act_ipt.c                                |   2 +-
 net/wireless/nl80211.c                             |   1 +
 net/wireless/reg.c                                 |   1 +
 net/xfrm/xfrm_policy.c                             |   5 +-
 net/xfrm/xfrm_user.c                               |  12 +
 security/apparmor/policy_unpack.c                  |  32 --
 security/keys/encrypted-keys/encrypted.c           |  31 +-
 sound/aoa/core/gpio-feature.c                      |   4 +-
 sound/core/memalloc.c                              |   8 +-
 sound/core/seq/oss/seq_oss.c                       |   2 +-
 sound/core/seq/seq_clientmgr.c                     |   2 +-
 sound/core/seq/seq_virmidi.c                       |  10 +
 sound/drivers/vx/vx_pcm.c                          |   6 +-
 sound/firewire/bebob/bebob_maudio.c                |  24 +-
 sound/pci/cs5535audio/cs5535audio.h                |   6 +-
 sound/pci/cs5535audio/cs5535audio_pcm.c            |   4 +-
 sound/pci/emu10k1/emufx.c                          |   2 +-
 sound/pci/vx222/vx222_ops.c                        |  20 +-
 sound/pcmcia/vx/vxp_ops.c                          |  22 +-
 sound/soc/codecs/wm8994.c                          |   1 +
 tools/hv/hv_fcopy_daemon.c                         |   1 +
 tools/hv/hv_kvp_daemon.c                           |   2 +-
 319 files changed, 2983 insertions(+), 1647 deletions(-)

-- 
Ben Hutchings
The generation of random numbers is too important to be left to chance.
                                                       - Robert Coveyou


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 004/328] audit: Fix extended comparison of GID/EGID
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (222 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 146/328] tracing/blktrace: Fix to allow setting same value Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 143/328] s390/pci: fix out of bounds access during irq setup Ben Hutchings
                   ` (103 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Ondrej Mosnáček, Paul Moore

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ondrej Mosnáček <omosnace@redhat.com>

commit af85d1772e31fed34165a1b3decef340cf4080c0 upstream.

The audit_filter_rules() function in auditsc.c used the in_[e]group_p()
functions to check GID/EGID match, but these functions use the current
task's credentials, while the comparison should use the credentials of
the task given to audit_filter_rules() as a parameter (tsk).

Note that we can use group_search(cred->group_info, ...) as a
replacement for both in_group_p and in_egroup_p as these functions only
compare the parameter to cred->fsgid/egid and then call group_search.

In fact, the usage of in_group_p was even more incorrect: it compares to
cred->fsgid (which is usually equal to cred->egid) and not cred->gid.

GitHub issue:
https://github.com/linux-audit/audit-kernel/issues/82

Fixes: 37eebe39c973 ("audit: improve GID/EGID comparation logic")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/auditsc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -489,20 +489,20 @@ static int audit_filter_rules(struct tas
 			result = audit_gid_comparator(cred->gid, f->op, f->gid);
 			if (f->op == Audit_equal) {
 				if (!result)
-					result = in_group_p(f->gid);
+					result = groups_search(cred->group_info, f->gid);
 			} else if (f->op == Audit_not_equal) {
 				if (result)
-					result = !in_group_p(f->gid);
+					result = !groups_search(cred->group_info, f->gid);
 			}
 			break;
 		case AUDIT_EGID:
 			result = audit_gid_comparator(cred->egid, f->op, f->gid);
 			if (f->op == Audit_equal) {
 				if (!result)
-					result = in_egroup_p(f->gid);
+					result = groups_search(cred->group_info, f->gid);
 			} else if (f->op == Audit_not_equal) {
 				if (result)
-					result = !in_egroup_p(f->gid);
+					result = !groups_search(cred->group_info, f->gid);
 			}
 			break;
 		case AUDIT_SGID:


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 007/328] USB: serial: sierra: fix potential deadlock at close
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (187 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 097/328] scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 085/328] pinctrl: imx: off by one in imx_pinconf_group_dbg_show() Ben Hutchings
                   ` (138 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, John Ogness, Johan Hovold, Sebastian Andrzej Siewior

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: John Ogness <john.ogness@linutronix.de>

commit e60870012e5a35b1506d7b376fddfb30e9da0b27 upstream.

The portdata spinlock can be taken in interrupt context (via
sierra_outdat_callback()).
Disable interrupts when taking the portdata spinlock when discarding
deferred URBs during close to prevent a possible deadlock.

Fixes: 014333f77c0b ("USB: sierra: fix urb and memory leak on disconnect")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
[ johan: amend commit message and add fixes and stable tags ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/serial/sierra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -772,9 +772,9 @@ static void sierra_close(struct usb_seri
 		kfree(urb->transfer_buffer);
 		usb_free_urb(urb);
 		usb_autopm_put_interface_async(serial->interface);
-		spin_lock(&portdata->lock);
+		spin_lock_irq(&portdata->lock);
 		portdata->outstanding_urbs--;
-		spin_unlock(&portdata->lock);
+		spin_unlock_irq(&portdata->lock);
 	}
 
 	sierra_stop_rx_urbs(port);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 012/328] media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (122 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 094/328] IB/IPoIB: Set ah valid flag in multicast send flow Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 242/328] pppoe: fix reception of frames with no mac header Ben Hutchings
                   ` (203 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Mauro Carvalho Chehab, Sebastian Reichel,
	Javier Martinez Canillas, Sakari Ailus

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Javier Martinez Canillas <javierm@redhat.com>

commit 2ec7debd44b49927a6e2861521994cc075a389ed upstream.

The struct clk_init_data init variable is declared in the isp_xclk_init()
function so is an automatic variable allocated in the stack. But it's not
explicitly zero-initialized, so some init fields are left uninitialized.

This causes the data structure to have undefined values that may confuse
the common clock framework when the clock is registered.

For example, the uninitialized .flags field could have the CLK_IS_CRITICAL
bit set, causing the framework to wrongly prepare the clk on registration.
This leads to the isp_xclk_prepare() callback being called, which in turn
calls to the omap3isp_get() function that increments the isp dev refcount.

Since this omap3isp_get() call is unexpected, this leads to an unbalanced
omap3isp_get() call that prevents the requested IRQ to be later enabled,
due the refcount not being 0 when the correct omap3isp_get() call happens.

Fixes: 9b28ee3c9122 ("[media] omap3isp: Use the common clock framework")

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/media/platform/omap3isp/isp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -282,7 +282,7 @@ static const char *isp_xclk_parent_name
 static int isp_xclk_init(struct isp_device *isp)
 {
 	struct isp_platform_data *pdata = isp->pdata;
-	struct clk_init_data init;
+	struct clk_init_data init = { 0 };
 	unsigned int i;
 
 	for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 005/328] kprobes: Make list and blacklist root user read only
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (273 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 133/328] KVM: arm/arm64: Skip updating PMD entry if no change Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 227/328] ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping Ben Hutchings
                   ` (52 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Linus Torvalds, Will Deacon, schwidefsky, linux-arch,
	Jon Medhurst, Thomas Richter, Thomas Gleixner, Masami Hiramatsu,
	Anil S Keshavamurthy, rostedt, Arnd Bergmann, Heiko Carstens,
	brueckner, David Howells, Peter Zijlstra, Tobin C . Harding,
	Ananth N Mavinakayanahalli, David S . Miller, acme, Ingo Molnar

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Masami Hiramatsu <mhiramat@kernel.org>

commit f2a3ab36077222437b4826fc76111caa14562b7c upstream.

Since the blacklist and list files on debugfs indicates
a sensitive address information to reader, it should be
restricted to the root user.

Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: David Howells <dhowells@redhat.com>
Cc: David S . Miller <davem@davemloft.net>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jon Medhurst <tixy@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tobin C . Harding <me@tobin.cc>
Cc: Will Deacon <will.deacon@arm.com>
Cc: acme@kernel.org
Cc: akpm@linux-foundation.org
Cc: brueckner@linux.vnet.ibm.com
Cc: linux-arch@vger.kernel.org
Cc: rostedt@goodmis.org
Cc: schwidefsky@de.ibm.com
Link: https://lkml.kernel.org/lkml/152491890171.9916.5183693615601334087.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/kprobes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2414,7 +2414,7 @@ static int __init debugfs_kprobe_init(vo
 	if (!dir)
 		return -ENOMEM;
 
-	file = debugfs_create_file("list", 0444, dir, NULL,
+	file = debugfs_create_file("list", 0400, dir, NULL,
 				&debugfs_kprobes_operations);
 	if (!file)
 		goto error;
@@ -2424,7 +2424,7 @@ static int __init debugfs_kprobe_init(vo
 	if (!file)
 		goto error;
 
-	file = debugfs_create_file("blacklist", 0444, dir, NULL,
+	file = debugfs_create_file("blacklist", 0400, dir, NULL,
 				&debugfs_kprobe_blacklist_ops);
 	if (!file)
 		goto error;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 142/328] mfd: sm501: Set coherent_dma_mask when creating subdevices
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (311 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 107/328] net: mac802154: tx: expand tailroom if necessary Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 236/328] cifs: prevent integer overflow in nxt_dir_entry() Ben Hutchings
                   ` (14 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Guenter Roeck, Lee Jones

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit 2f606da78230f09cf1a71fde6ee91d0c710fa2b2 upstream.

Instantiating the sm501 OHCI subdevice results in a kernel warning.

sm501-usb sm501-usb: SM501 OHCI
sm501-usb sm501-usb: new USB bus registered, assigned bus number 1
WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516
ohci_init+0x194/0x2d8
Modules linked in:

CPU: 0 PID: 1 Comm: swapper Tainted: G        W
4.18.0-rc7-00178-g0b5b1f9a78b5 #1
PC is at ohci_init+0x194/0x2d8
PR is at ohci_init+0x168/0x2d8
PC  : 8c27844c SP  : 8f81dd94 SR  : 40008001
TEA : 29613060
R0  : 00000000 R1  : 00000000 R2  : 00000000 R3  : 00000202
R4  : 8fa98b88 R5  : 8c277e68 R6  : 00000000 R7  : 00000000
R8  : 8f965814 R9  : 8c388100 R10 : 8fa98800 R11 : 8fa98928
R12 : 8c48302c R13 : 8fa98920 R14 : 8c48302c
MACH: 00000096 MACL: 0000017c GBR : 00000000 PR  : 8c278420

Call trace:
 [<(ptrval)>] usb_add_hcd+0x1e8/0x6ec
 [<(ptrval)>] _dev_info+0x0/0x54
 [<(ptrval)>] arch_local_save_flags+0x0/0x8
 [<(ptrval)>] arch_local_irq_restore+0x0/0x24
 [<(ptrval)>] ohci_hcd_sm501_drv_probe+0x114/0x2d8
...

Initialize coherent_dma_mask when creating SM501 subdevices to fix
the problem.

Fixes: b6d6454fdb66f ("mfd: SM501 core driver")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/mfd/sm501.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -714,6 +714,7 @@ sm501_create_subdev(struct sm501_devdata
 	smdev->pdev.name = name;
 	smdev->pdev.id = sm->pdev_id;
 	smdev->pdev.dev.parent = sm->dev;
+	smdev->pdev.dev.coherent_dma_mask = 0xffffffff;
 
 	if (res_count) {
 		smdev->pdev.resource = (struct resource *)(smdev+1);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 290/328] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (80 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 125/328] powerpc/pseries: Fix endianness while restoring of r3 in MCE handler Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 079/328] media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able Ben Hutchings
                   ` (245 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, syzbot, David S. Miller, Eric Dumazet

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 0e1d6eca5113858ed2caea61a5adc03c595f6096 upstream.

We have an impressive number of syzkaller bugs that are linked
to the fact that syzbot was able to create a networking device
with millions of TX (or RX) queues.

Let's limit the number of RX/TX queues to 4096, this really should
cover all known cases.

A separate patch will add various cond_resched() in the loops
handling sysfs entries at device creation and dismantle.

Tested:

lpaa6:~# ip link add gre-4097 numtxqueues 4097 numrxqueues 4097 type ip6gretap
RTNETLINK answers: Invalid argument

lpaa6:~# time ip link add gre-4096 numtxqueues 4096 numrxqueues 4096 type ip6gretap

real	0m0.180s
user	0m0.000s
sys	0m0.107s

Fixes: 76ff5cc91935 ("rtnl: allow to specify number of rx and tx queues on device creation")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/core/rtnetlink.c | 6 ++++++
 1 file changed, 6 insertions(+)

--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1831,6 +1831,12 @@ struct net_device *rtnl_create_link(stru
 	else if (ops->get_num_rx_queues)
 		num_rx_queues = ops->get_num_rx_queues();
 
+	if (num_tx_queues < 1 || num_tx_queues > 4096)
+		return ERR_PTR(-EINVAL);
+
+	if (num_rx_queues < 1 || num_rx_queues > 4096)
+		return ERR_PTR(-EINVAL);
+
 	err = -ENOMEM;
 	dev = alloc_netdev_mqs(ops->priv_size, ifname, ops->setup,
 			       num_tx_queues, num_rx_queues);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 325/328] mm: cleancache: fix corruption on missed inode invalidation
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (308 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 056/328] video: udlfb: Remove noisy warnings Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 006/328] s390/qdio: reset old sbal_state flags Ben Hutchings
                   ` (17 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Andi Kleen, Jan Kara, Johannes Weiner, Andrey Ryabinin,
	Vasily Averin, Linus Torvalds, Mel Gorman, Matthew Wilcox,
	Pavel Tikhomirov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

commit 6ff38bd40230af35e446239396e5fc8ebd6a5248 upstream.

If all pages are deleted from the mapping by memory reclaim and also
moved to the cleancache:

__delete_from_page_cache
  (no shadow case)
  unaccount_page_cache_page
    cleancache_put_page
  page_cache_delete
    mapping->nrpages -= nr
    (nrpages becomes 0)

We don't clean the cleancache for an inode after final file truncation
(removal).

truncate_inode_pages_final
  check (nrpages || nrexceptional) is false
    no truncate_inode_pages
      no cleancache_invalidate_inode(mapping)

These way when reading the new file created with same inode we may get
these trash leftover pages from cleancache and see wrong data instead of
the contents of the new file.

Fix it by always doing truncate_inode_pages which is already ready for
nrpages == 0 && nrexceptional == 0 case and just invalidates inode.

[akpm@linux-foundation.org: add comment, per Jan]
Link: http://lkml.kernel.org/r/20181112095734.17979-1-ptikhomirov@virtuozzo.com
Fixes: commit 91b0abe36a7b ("mm + fs: store shadow entries in page cache")
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Reviewed-by: Vasily Averin <vvs@virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 mm/truncate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -461,9 +461,13 @@ void truncate_inode_pages_final(struct a
 		 */
 		spin_lock_irq(&mapping->tree_lock);
 		spin_unlock_irq(&mapping->tree_lock);
-
-		truncate_inode_pages(mapping, 0);
 	}
+
+	/*
+	 * Cleancache needs notification even if there are no pages or shadow
+	 * entries.
+	 */
+	truncate_inode_pages(mapping, 0);
 }
 EXPORT_SYMBOL(truncate_inode_pages_final);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 297/328] ipv6: Compute net once in raw6_send_hdrinc
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (88 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 164/328] x86/spectre: Add missing family 6 check to microcode check Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 111/328] btrfs: rename total_bytes to avoid confusion Ben Hutchings
                   ` (237 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Eric W. Biederman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit adb28c9d3371c845c7a28bfd4fb163aca0d0dc37 upstream.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ipv6/raw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -618,6 +618,7 @@ static int rawv6_send_hdrinc(struct sock
 			unsigned int flags)
 {
 	struct ipv6_pinfo *np = inet6_sk(sk);
+	struct net *net = sock_net(sk);
 	struct ipv6hdr *iph;
 	struct sk_buff *skb;
 	int err;
@@ -656,7 +657,7 @@ static int rawv6_send_hdrinc(struct sock
 	if (err)
 		goto error_fault;
 
-	IP6_UPD_PO_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
+	IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
 	err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, skb, NULL,
 		      rt->dst.dev, dst_output);
 	if (err > 0)
@@ -670,7 +671,7 @@ error_fault:
 	err = -EFAULT;
 	kfree_skb(skb);
 error:
-	IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
+	IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
 	if (err == -ENOBUFS && !np->recverr)
 		err = 0;
 	return err;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 298/328] ipv6: take rcu lock in rawv6_send_hdrinc()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (119 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 134/328] KVM: arm/arm64: Skip updating PTE entry if no change Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 098/328] xfrm: Validate address prefix lengths in the xfrm selector Ben Hutchings
                   ` (206 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Eric Dumazet, Wei Wang

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Wei Wang <weiwan@google.com>

commit a688caa34beb2fd2a92f1b6d33e40cde433ba160 upstream.

In rawv6_send_hdrinc(), in order to avoid an extra dst_hold(), we
directly assign the dst to skb and set passed in dst to NULL to avoid
double free.
However, in error case, we free skb and then do stats update with the
dst pointer passed in. This causes use-after-free on the dst.
Fix it by taking rcu read lock right before dst could get released to
make sure dst does not get freed until the stats update is done.
Note: we don't have this issue in ipv4 cause dst is not used for stats
update in v4.

Syzkaller reported following crash:
BUG: KASAN: use-after-free in rawv6_send_hdrinc net/ipv6/raw.c:692 [inline]
BUG: KASAN: use-after-free in rawv6_sendmsg+0x4421/0x4630 net/ipv6/raw.c:921
Read of size 8 at addr ffff8801d95ba730 by task syz-executor0/32088

CPU: 1 PID: 32088 Comm: syz-executor0 Not tainted 4.19.0-rc2+ #93
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c4/0x2b4 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 rawv6_send_hdrinc net/ipv6/raw.c:692 [inline]
 rawv6_sendmsg+0x4421/0x4630 net/ipv6/raw.c:921
 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114
 __sys_sendmsg+0x11d/0x280 net/socket.c:2152
 __do_sys_sendmsg net/socket.c:2161 [inline]
 __se_sys_sendmsg net/socket.c:2159 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457099
Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f83756edc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f83756ee6d4 RCX: 0000000000457099
RDX: 0000000000000000 RSI: 0000000020003840 RDI: 0000000000000004
RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000004d4b30 R14: 00000000004c90b1 R15: 0000000000000000

Allocated by task 32088:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x730 mm/slab.c:3554
 dst_alloc+0xbb/0x1d0 net/core/dst.c:105
 ip6_dst_alloc+0x35/0xa0 net/ipv6/route.c:353
 ip6_rt_cache_alloc+0x247/0x7b0 net/ipv6/route.c:1186
 ip6_pol_route+0x8f8/0xd90 net/ipv6/route.c:1895
 ip6_pol_route_output+0x54/0x70 net/ipv6/route.c:2093
 fib6_rule_lookup+0x277/0x860 net/ipv6/fib6_rules.c:122
 ip6_route_output_flags+0x2c5/0x350 net/ipv6/route.c:2121
 ip6_route_output include/net/ip6_route.h:88 [inline]
 ip6_dst_lookup_tail+0xe27/0x1d60 net/ipv6/ip6_output.c:951
 ip6_dst_lookup_flow+0xc8/0x270 net/ipv6/ip6_output.c:1079
 rawv6_sendmsg+0x12d9/0x4630 net/ipv6/raw.c:905
 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:621 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:631
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2114
 __sys_sendmsg+0x11d/0x280 net/socket.c:2152
 __do_sys_sendmsg net/socket.c:2161 [inline]
 __se_sys_sendmsg net/socket.c:2159 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2159
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 5356:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x83/0x290 mm/slab.c:3756
 dst_destroy+0x267/0x3c0 net/core/dst.c:141
 dst_destroy_rcu+0x16/0x19 net/core/dst.c:154
 __rcu_reclaim kernel/rcu/rcu.h:236 [inline]
 rcu_do_batch kernel/rcu/tree.c:2576 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2880 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2847 [inline]
 rcu_process_callbacks+0xf23/0x2670 kernel/rcu/tree.c:2864
 __do_softirq+0x30b/0xad8 kernel/softirq.c:292

Fixes: 1789a640f556 ("raw: avoid two atomics in xmit")
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16:
 - We don't set tstamp here
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -643,8 +643,6 @@ static int rawv6_send_hdrinc(struct sock
 	skb->protocol = htons(ETH_P_IPV6);
 	skb->priority = sk->sk_priority;
 	skb->mark = sk->sk_mark;
-	skb_dst_set(skb, &rt->dst);
-	*dstp = NULL;
 
 	skb_put(skb, length);
 	skb_reset_network_header(skb);
@@ -654,24 +652,37 @@ static int rawv6_send_hdrinc(struct sock
 
 	skb->transport_header = skb->network_header;
 	err = memcpy_fromiovecend((void *)iph, from, 0, length);
-	if (err)
-		goto error_fault;
+	if (err) {
+		err = -EFAULT;
+		kfree_skb(skb);
+		goto error;
+	}
 
+	skb_dst_set(skb, &rt->dst);
+	*dstp = NULL;
+
+	/* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev
+	 * in the error path. Since skb has been freed, the dst could
+	 * have been queued for deletion.
+	 */
+	rcu_read_lock();
 	IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
 	err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, skb, NULL,
 		      rt->dst.dev, dst_output);
 	if (err > 0)
 		err = net_xmit_errno(err);
-	if (err)
-		goto error;
+	if (err) {
+		IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
+		rcu_read_unlock();
+		goto error_check;
+	}
+	rcu_read_unlock();
 out:
 	return 0;
 
-error_fault:
-	err = -EFAULT;
-	kfree_skb(skb);
 error:
 	IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
+error_check:
 	if (err == -ENOBUFS && !np->recverr)
 		err = 0;
 	return err;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 266/328] bcache: Remove deprecated create_workqueue
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (15 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 180/328] igmp: fix incorrect unsolicit report count when join group Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 244/328] ring-buffer: Allow for rescheduling when removing pages Ben Hutchings
                   ` (310 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jens Axboe, Tejun Heo, Bhaktipriya Shridhar

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

commit 81baf90af2dcc8259e99e2f236024524b55313fc upstream.

alloc_workqueue replaces deprecated create_workqueue().

Dedicated workqueues have been used since bcache_wq and moving_gc_wq
are workqueues for writes and are being used on a memory reclaim path.
WQ_MEM_RECLAIM has been set to ensure forward progress under memory
pressure.
Since there are only a fixed number of work items, explicit concurrency
limit is unnecessary here.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/bcache/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1543,7 +1543,8 @@ struct cache_set *bch_cache_set_alloc(st
 	    !(c->fill_iter = mempool_create_kmalloc_pool(1, iter_size)) ||
 	    !(c->bio_split = bioset_create(4, offsetof(struct bbio, bio))) ||
 	    !(c->uuids = alloc_bucket_pages(GFP_KERNEL, c)) ||
-	    !(c->moving_gc_wq = create_workqueue("bcache_gc")) ||
+	    !(c->moving_gc_wq = alloc_workqueue("bcache_gc",
+						WQ_MEM_RECLAIM, 0)) ||
 	    bch_journal_alloc(c) ||
 	    bch_btree_cache_alloc(c) ||
 	    bch_open_buckets_alloc(c) ||
@@ -2135,7 +2136,7 @@ static int __init bcache_init(void)
 		return bcache_major;
 	}
 
-	if (!(bcache_wq = create_workqueue("bcache")) ||
+	if (!(bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) ||
 	    !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
 	    sysfs_create_files(bcache_kobj, files) ||
 	    bch_request_init() ||


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 190/328] nbd: don't allow invalid blocksize settings
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (324 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 140/328] ubifs: Check data node size before truncate Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 186/328] spi: tegra20-slink: explicitly enable/disable clock Ben Hutchings
  2018-12-10 16:54 ` [PATCH 3.16 000/328] 3.16.62-rc1 review Guenter Roeck
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, syzbot, Jens Axboe, Josef Bacik

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jens Axboe <axboe@kernel.dk>

commit bc811f05d77f47059c197a98b6ad242eb03999cb upstream.

syzbot reports a divide-by-zero off the NBD_SET_BLKSIZE ioctl.
We need proper validation of the input here. Not just if it's
zero, but also if the value is a power-of-2 and in a valid
range. Add that.

Reported-by: syzbot <syzbot+25dbecbec1e62c6b0dd4@syzkaller.appspotmail.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/block/nbd.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -667,6 +667,9 @@ static int __nbd_ioctl(struct block_devi
 	}
 
 	case NBD_SET_BLKSIZE:
+		if (!arg || !is_power_of_2(arg) || arg < 512 ||
+		    arg > PAGE_SIZE)
+			return -EINVAL;
 		nbd->blksize = arg;
 		nbd->bytesize &= ~(nbd->blksize-1);
 		bdev->bd_inode->i_size = nbd->bytesize;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 186/328] spi: tegra20-slink: explicitly enable/disable clock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (325 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 190/328] nbd: don't allow invalid blocksize settings Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-10 16:54 ` [PATCH 3.16 000/328] 3.16.62-rc1 review Guenter Roeck
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Marcel Ziswiler, Mark Brown

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Marcel Ziswiler <marcel.ziswiler@toradex.com>

commit 7001cab1dabc0b72b2b672ef58a90ab64f5e2343 upstream.

Depending on the SPI instance one may get an interrupt storm upon
requesting resp. interrupt unless the clock is explicitly enabled
beforehand. This has been observed trying to bring up instance 4 on
T20.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/spi/spi-tegra20-slink.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -1063,6 +1063,24 @@ static int tegra_slink_probe(struct plat
 		goto exit_free_master;
 	}
 
+	/* disabled clock may cause interrupt storm upon request */
+	tspi->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(tspi->clk)) {
+		ret = PTR_ERR(tspi->clk);
+		dev_err(&pdev->dev, "Can not get clock %d\n", ret);
+		goto exit_free_master;
+	}
+	ret = clk_prepare(tspi->clk);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Clock prepare failed %d\n", ret);
+		goto exit_free_master;
+	}
+	ret = clk_enable(tspi->clk);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Clock enable failed %d\n", ret);
+		goto exit_free_master;
+	}
+
 	spi_irq = platform_get_irq(pdev, 0);
 	tspi->irq = spi_irq;
 	ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
@@ -1071,14 +1089,7 @@ static int tegra_slink_probe(struct plat
 	if (ret < 0) {
 		dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n",
 					tspi->irq);
-		goto exit_free_master;
-	}
-
-	tspi->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(tspi->clk)) {
-		dev_err(&pdev->dev, "can not get clock\n");
-		ret = PTR_ERR(tspi->clk);
-		goto exit_free_irq;
+		goto exit_clk_disable;
 	}
 
 	tspi->rst = devm_reset_control_get(&pdev->dev, "spi");
@@ -1138,6 +1149,8 @@ exit_rx_dma_free:
 	tegra_slink_deinit_dma_param(tspi, true);
 exit_free_irq:
 	free_irq(spi_irq, tspi);
+exit_clk_disable:
+	clk_disable(tspi->clk);
 exit_free_master:
 	spi_master_put(master);
 	return ret;
@@ -1150,6 +1163,8 @@ static int tegra_slink_remove(struct pla
 
 	free_irq(tspi->irq, tspi);
 
+	clk_disable(tspi->clk);
+
 	if (tspi->tx_dma_chan)
 		tegra_slink_deinit_dma_param(tspi, false);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 211/328] hwmon: (nct6775) Set weight source to zero correctly
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (285 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 221/328] dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion deadlock Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 023/328] USB: serial: kobil_sct: fix modem-status error handling Ben Hutchings
                   ` (40 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dan Carpenter, Guenter Roeck

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit e3f3d7ab00cd459d0f7a839758a4542f4d4b8ac8 upstream.

This is dead code because j can never be 1 at this point.  We had
intended to just test if the bit was clear.

Fixes: bbd8decd4123 ("hwmon: (nct6775) Add support for weighted fan control")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/hwmon/nct6775.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -1331,7 +1331,7 @@ static void nct6775_update_pwm(struct de
 		reg = nct6775_read_value(data, data->REG_WEIGHT_TEMP_SEL[i]);
 		data->pwm_weight_temp_sel[i] = reg & 0x1f;
 		/* If weight is disabled, report weight source as 0 */
-		if (j == 1 && !(reg & 0x80))
+		if (!(reg & 0x80))
 			data->pwm_weight_temp_sel[i] = 0;
 
 		/* Weight temp data */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 225/328] hwmon: (nct6775) Fix access to fan pulse registers
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (9 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 321/328] cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 196/328] USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller Ben Hutchings
                   ` (316 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dan Carpenter, Guenter Roeck

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit c793279c77035053e67937f5743c6ebfc303e7c5 upstream.

Not all fans have a fan pulse register. This can result in reading
beyond the end of REG_FAN_PULSES and FAN_PULSE_SHIFT arrays,
and was reported by smatch as possible error.

1672          for (i = 0; i < ARRAY_SIZE(data->rpm); i++) {
                              ^^^^^^^^^^^^^^^^^^^^^^^^
			      This is a 7 element array.
...
1685                  data->fan_pulses[i] =
1686                    (nct6775_read_value(data, data->REG_FAN_PULSES[i])
1687                          >> data->FAN_PULSE_SHIFT[i]) & 0x03;
                                 ^^^^^^^^^^^^^^^^^^^^^^^^
				 FAN_PULSE_SHIFT is either 5 or 6
				 elements.

To fix the problem, we have to ensure that all REG_FAN_PULSES and
FAN_PULSE_SHIFT have the appropriate length, and that REG_FAN_PULSES
is only read if the register actually exists.

Fixes: 6c009501ff200 ("hwmon: (nct6775) Add support for NCT6102D/6106D")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[bwh: Backported to 3.16:
 - NCT6776_REG_FAN_PULSES covers only 3 fans
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/hwmon/nct6775.c | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -269,8 +269,9 @@ static const u16 NCT6775_REG_PWM_READ[]
 
 static const u16 NCT6775_REG_FAN[] = { 0x630, 0x632, 0x634, 0x636, 0x638 };
 static const u16 NCT6775_REG_FAN_MIN[] = { 0x3b, 0x3c, 0x3d };
-static const u16 NCT6775_REG_FAN_PULSES[] = { 0x641, 0x642, 0x643, 0x644, 0 };
-static const u16 NCT6775_FAN_PULSE_SHIFT[] = { 0, 0, 0, 0, 0, 0 };
+static const u16 NCT6775_REG_FAN_PULSES[NUM_FAN] = {
+	0x641, 0x642, 0x643, 0x644 };
+static const u16 NCT6775_FAN_PULSE_SHIFT[NUM_FAN] = { };
 
 static const u16 NCT6775_REG_TEMP[] = {
 	0x27, 0x150, 0x250, 0x62b, 0x62c, 0x62d };
@@ -382,7 +383,8 @@ static const u8 NCT6776_REG_PWM_MODE[] =
 static const u8 NCT6776_PWM_MODE_MASK[] = { 0x01, 0, 0, 0, 0, 0 };
 
 static const u16 NCT6776_REG_FAN_MIN[] = { 0x63a, 0x63c, 0x63e, 0x640, 0x642 };
-static const u16 NCT6776_REG_FAN_PULSES[] = { 0x644, 0x645, 0x646, 0, 0 };
+static const u16 NCT6776_REG_FAN_PULSES[NUM_FAN] = {
+	0x644, 0x645, 0x646 };
 
 static const u16 NCT6776_REG_WEIGHT_DUTY_BASE[] = {
 	0x13e, 0x23e, 0x33e, 0x83e, 0x93e, 0xa3e };
@@ -451,7 +453,7 @@ static const s8 NCT6779_BEEP_BITS[] = {
 
 static const u16 NCT6779_REG_FAN[] = {
 	0x4b0, 0x4b2, 0x4b4, 0x4b6, 0x4b8, 0x4ba };
-static const u16 NCT6779_REG_FAN_PULSES[] = {
+static const u16 NCT6779_REG_FAN_PULSES[NUM_FAN] = {
 	0x644, 0x645, 0x646, 0x647, 0x648, 0x649 };
 
 static const u16 NCT6779_REG_CRITICAL_PWM_ENABLE[] = {
@@ -564,8 +566,8 @@ static const u16 NCT6106_REG_TEMP_CONFIG
 
 static const u16 NCT6106_REG_FAN[] = { 0x20, 0x22, 0x24 };
 static const u16 NCT6106_REG_FAN_MIN[] = { 0xe0, 0xe2, 0xe4 };
-static const u16 NCT6106_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6, 0, 0 };
-static const u16 NCT6106_FAN_PULSE_SHIFT[] = { 0, 2, 4, 0, 0 };
+static const u16 NCT6106_REG_FAN_PULSES[] = { 0xf6, 0xf6, 0xf6 };
+static const u16 NCT6106_FAN_PULSE_SHIFT[] = { 0, 2, 4 };
 
 static const u8 NCT6106_REG_PWM_MODE[] = { 0xf3, 0xf3, 0xf3 };
 static const u8 NCT6106_PWM_MODE_MASK[] = { 0x01, 0x02, 0x04 };
@@ -1451,9 +1453,13 @@ static struct nct6775_data *nct6775_upda
 			if (data->has_fan_min & (1 << i))
 				data->fan_min[i] = nct6775_read_value(data,
 					   data->REG_FAN_MIN[i]);
-			data->fan_pulses[i] =
-			  (nct6775_read_value(data, data->REG_FAN_PULSES[i])
-				>> data->FAN_PULSE_SHIFT[i]) & 0x03;
+
+			if (data->REG_FAN_PULSES[i]) {
+				data->fan_pulses[i] =
+				  (nct6775_read_value(data,
+						      data->REG_FAN_PULSES[i])
+				   >> data->FAN_PULSE_SHIFT[i]) & 0x03;
+			}
 
 			nct6775_select_fan_div(dev, data, i, reg);
 		}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 259/328] mm: shmem.c: Correctly annotate new inodes for lockdep
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (204 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 163/328] ext4: check to make sure the rename(2)'s destination is not freed Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 200/328] spi: sh-msiof: Add more register documentation Ben Hutchings
                   ` (121 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, syzbot, Joel Fernandes (Google),
	NeilBrown, Hugh Dickins, Peter Zijlstra, Matthew Wilcox,
	Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Joel Fernandes (Google)" <joel@joelfernandes.org>

commit b45d71fb89ab8adfe727b9d0ee188ed58582a647 upstream.

Directories and inodes don't necessarily need to be in the same lockdep
class.  For ex, hugetlbfs splits them out too to prevent false positives
in lockdep.  Annotate correctly after new inode creation.  If its a
directory inode, it will be put into a different class.

This should fix a lockdep splat reported by syzbot:

> ======================================================
> WARNING: possible circular locking dependency detected
> 4.18.0-rc8-next-20180810+ #36 Not tainted
> ------------------------------------------------------
> syz-executor900/4483 is trying to acquire lock:
> 00000000d2bfc8fe (&sb->s_type->i_mutex_key#9){++++}, at: inode_lock
> include/linux/fs.h:765 [inline]
> 00000000d2bfc8fe (&sb->s_type->i_mutex_key#9){++++}, at:
> shmem_fallocate+0x18b/0x12e0 mm/shmem.c:2602
>
> but task is already holding lock:
> 0000000025208078 (ashmem_mutex){+.+.}, at: ashmem_shrink_scan+0xb4/0x630
> drivers/staging/android/ashmem.c:448
>
> which lock already depends on the new lock.
>
> -> #2 (ashmem_mutex){+.+.}:
>        __mutex_lock_common kernel/locking/mutex.c:925 [inline]
>        __mutex_lock+0x171/0x1700 kernel/locking/mutex.c:1073
>        mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1088
>        ashmem_mmap+0x55/0x520 drivers/staging/android/ashmem.c:361
>        call_mmap include/linux/fs.h:1844 [inline]
>        mmap_region+0xf27/0x1c50 mm/mmap.c:1762
>        do_mmap+0xa10/0x1220 mm/mmap.c:1535
>        do_mmap_pgoff include/linux/mm.h:2298 [inline]
>        vm_mmap_pgoff+0x213/0x2c0 mm/util.c:357
>        ksys_mmap_pgoff+0x4da/0x660 mm/mmap.c:1585
>        __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline]
>        __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline]
>        __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91
>        do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>        entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> -> #1 (&mm->mmap_sem){++++}:
>        __might_fault+0x155/0x1e0 mm/memory.c:4568
>        _copy_to_user+0x30/0x110 lib/usercopy.c:25
>        copy_to_user include/linux/uaccess.h:155 [inline]
>        filldir+0x1ea/0x3a0 fs/readdir.c:196
>        dir_emit_dot include/linux/fs.h:3464 [inline]
>        dir_emit_dots include/linux/fs.h:3475 [inline]
>        dcache_readdir+0x13a/0x620 fs/libfs.c:193
>        iterate_dir+0x48b/0x5d0 fs/readdir.c:51
>        __do_sys_getdents fs/readdir.c:231 [inline]
>        __se_sys_getdents fs/readdir.c:212 [inline]
>        __x64_sys_getdents+0x29f/0x510 fs/readdir.c:212
>        do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>        entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> -> #0 (&sb->s_type->i_mutex_key#9){++++}:
>        lock_acquire+0x1e4/0x540 kernel/locking/lockdep.c:3924
>        down_write+0x8f/0x130 kernel/locking/rwsem.c:70
>        inode_lock include/linux/fs.h:765 [inline]
>        shmem_fallocate+0x18b/0x12e0 mm/shmem.c:2602
>        ashmem_shrink_scan+0x236/0x630 drivers/staging/android/ashmem.c:455
>        ashmem_ioctl+0x3ae/0x13a0 drivers/staging/android/ashmem.c:797
>        vfs_ioctl fs/ioctl.c:46 [inline]
>        file_ioctl fs/ioctl.c:501 [inline]
>        do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
>        ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
>        __do_sys_ioctl fs/ioctl.c:709 [inline]
>        __se_sys_ioctl fs/ioctl.c:707 [inline]
>        __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
>        do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
>        entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> other info that might help us debug this:
>
> Chain exists of:
>   &sb->s_type->i_mutex_key#9 --> &mm->mmap_sem --> ashmem_mutex
>
>  Possible unsafe locking scenario:
>
>        CPU0                    CPU1
>        ----                    ----
>   lock(ashmem_mutex);
>                                lock(&mm->mmap_sem);
>                                lock(ashmem_mutex);
>   lock(&sb->s_type->i_mutex_key#9);
>
>  *** DEADLOCK ***
>
> 1 lock held by syz-executor900/4483:
>  #0: 0000000025208078 (ashmem_mutex){+.+.}, at:
> ashmem_shrink_scan+0xb4/0x630 drivers/staging/android/ashmem.c:448

Link: http://lkml.kernel.org/r/20180821231835.166639-1-joel@joelfernandes.org
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reported-by: syzbot <syzkaller@googlegroups.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Suggested-by: NeilBrown <neilb@suse.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 mm/shmem.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1422,6 +1422,8 @@ static struct inode *shmem_get_inode(str
 			mpol_shared_policy_init(&info->policy, NULL);
 			break;
 		}
+
+		lockdep_annotate_inode_mutex_key(inode);
 	} else
 		shmem_free_inode(sb);
 	return inode;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 271/328] crypto: mxs-dcp - Fix wait logic on chan threads
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (90 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 111/328] btrfs: rename total_bytes to avoid confusion Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 052/328] PCI: pciehp: Fix unprotected list iteration in IRQ handler Ben Hutchings
                   ` (235 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Herbert Xu, Leonard Crestez

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Leonard Crestez <leonard.crestez@nxp.com>

commit d80771c08363ad7fbf0f56f5301e7ca65065c582 upstream.

When compiling with CONFIG_DEBUG_ATOMIC_SLEEP=y the mxs-dcp driver
prints warnings such as:

WARNING: CPU: 0 PID: 120 at kernel/sched/core.c:7736 __might_sleep+0x98/0x9c
do not call blocking ops when !TASK_RUNNING; state=1 set at [<8081978c>] dcp_chan_thread_sha+0x3c/0x2ec

The problem is that blocking ops will manipulate current->state
themselves so it is not allowed to call them between
set_current_state(TASK_INTERRUPTIBLE) and schedule().

Fix this by converting the per-chan mutex to a spinlock (it only
protects tiny list ops anyway) and rearranging the wait logic so that
callbacks are called current->state as TASK_RUNNING. Those callbacks
will indeed call blocking ops themselves so this is required.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/crypto/mxs-dcp.c | 53 +++++++++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 23 deletions(-)

--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -63,7 +63,7 @@ struct dcp {
 	struct dcp_coherent_block	*coh;
 
 	struct completion		completion[DCP_MAX_CHANS];
-	struct mutex			mutex[DCP_MAX_CHANS];
+	spinlock_t			lock[DCP_MAX_CHANS];
 	struct task_struct		*thread[DCP_MAX_CHANS];
 	struct crypto_queue		queue[DCP_MAX_CHANS];
 };
@@ -349,13 +349,20 @@ static int dcp_chan_thread_aes(void *dat
 
 	int ret;
 
-	do {
-		__set_current_state(TASK_INTERRUPTIBLE);
+	while (!kthread_should_stop()) {
+		set_current_state(TASK_INTERRUPTIBLE);
 
-		mutex_lock(&sdcp->mutex[chan]);
+		spin_lock(&sdcp->lock[chan]);
 		backlog = crypto_get_backlog(&sdcp->queue[chan]);
 		arq = crypto_dequeue_request(&sdcp->queue[chan]);
-		mutex_unlock(&sdcp->mutex[chan]);
+		spin_unlock(&sdcp->lock[chan]);
+
+		if (!backlog && !arq) {
+			schedule();
+			continue;
+		}
+
+		set_current_state(TASK_RUNNING);
 
 		if (backlog)
 			backlog->complete(backlog, -EINPROGRESS);
@@ -363,11 +370,8 @@ static int dcp_chan_thread_aes(void *dat
 		if (arq) {
 			ret = mxs_dcp_aes_block_crypt(arq);
 			arq->complete(arq, ret);
-			continue;
 		}
-
-		schedule();
-	} while (!kthread_should_stop());
+	}
 
 	return 0;
 }
@@ -407,9 +411,9 @@ static int mxs_dcp_aes_enqueue(struct ab
 	rctx->ecb = ecb;
 	actx->chan = DCP_CHAN_CRYPTO;
 
-	mutex_lock(&sdcp->mutex[actx->chan]);
+	spin_lock(&sdcp->lock[actx->chan]);
 	ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
-	mutex_unlock(&sdcp->mutex[actx->chan]);
+	spin_unlock(&sdcp->lock[actx->chan]);
 
 	wake_up_process(sdcp->thread[actx->chan]);
 
@@ -645,13 +649,20 @@ static int dcp_chan_thread_sha(void *dat
 	struct ahash_request *req;
 	int ret, fini;
 
-	do {
-		__set_current_state(TASK_INTERRUPTIBLE);
+	while (!kthread_should_stop()) {
+		set_current_state(TASK_INTERRUPTIBLE);
 
-		mutex_lock(&sdcp->mutex[chan]);
+		spin_lock(&sdcp->lock[chan]);
 		backlog = crypto_get_backlog(&sdcp->queue[chan]);
 		arq = crypto_dequeue_request(&sdcp->queue[chan]);
-		mutex_unlock(&sdcp->mutex[chan]);
+		spin_unlock(&sdcp->lock[chan]);
+
+		if (!backlog && !arq) {
+			schedule();
+			continue;
+		}
+
+		set_current_state(TASK_RUNNING);
 
 		if (backlog)
 			backlog->complete(backlog, -EINPROGRESS);
@@ -663,12 +674,8 @@ static int dcp_chan_thread_sha(void *dat
 			ret = dcp_sha_req_to_buf(arq);
 			fini = rctx->fini;
 			arq->complete(arq, ret);
-			if (!fini)
-				continue;
 		}
-
-		schedule();
-	} while (!kthread_should_stop());
+	}
 
 	return 0;
 }
@@ -726,9 +733,9 @@ static int dcp_sha_update_fx(struct ahas
 		rctx->init = 1;
 	}
 
-	mutex_lock(&sdcp->mutex[actx->chan]);
+	spin_lock(&sdcp->lock[actx->chan]);
 	ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base);
-	mutex_unlock(&sdcp->mutex[actx->chan]);
+	spin_unlock(&sdcp->lock[actx->chan]);
 
 	wake_up_process(sdcp->thread[actx->chan]);
 	mutex_unlock(&actx->mutex);
@@ -984,7 +991,7 @@ static int mxs_dcp_probe(struct platform
 	platform_set_drvdata(pdev, sdcp);
 
 	for (i = 0; i < DCP_MAX_CHANS; i++) {
-		mutex_init(&sdcp->mutex[i]);
+		spin_lock_init(&sdcp->lock[i]);
 		init_completion(&sdcp->completion[i]);
 		crypto_init_queue(&sdcp->queue[i], 50);
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 323/328] wil6210: missing length check in wmi_set_ie
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (133 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 104/328] mac802154: common tx error path Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 201/328] spi: sh-msiof: Fix handling of write value for SISTR register Ben Hutchings
                   ` (192 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Maya Erez, Kalle Valo, Lior David

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Lior David <qca_liord@qca.qualcomm.com>

commit b5a8ffcae4103a9d823ea3aa3a761f65779fbe2a upstream.

Add a length check in wmi_set_ie to detect unsigned integer
overflow.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
[bwh: Backported to 3.16: return directly rather than via "out" label]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/net/wireless/ath/wil6210/wmi.c
+++ b/drivers/net/wireless/ath/wil6210/wmi.c
@@ -958,7 +958,12 @@ int wmi_set_ie(struct wil6210_priv *wil,
 {
 	int rc;
 	u16 len = sizeof(struct wmi_set_appie_cmd) + ie_len;
-	struct wmi_set_appie_cmd *cmd = kzalloc(len, GFP_KERNEL);
+	struct wmi_set_appie_cmd *cmd;
+
+	if (len < ie_len)
+		return -EINVAL;
+
+	cmd = kzalloc(len, GFP_KERNEL);
 	if (!cmd)
 		return -ENOMEM;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 320/328] mtd: fsl-quadspi: fix macro collision problems with READ/WRITE
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (289 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 235/328] misc: hmc6352: fix potential Spectre v1 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 279/328] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() Ben Hutchings
                   ` (36 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Guenter Roeck, kbuild test robot, Brian Norris, Han Xu

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Han Xu <b45815@freescale.com>

commit 04850c4d8613127a9b488321c0ad83bff7519311 upstream.

Change the READ/WRITE to FSL_READ/FSL_WRITE to resolve any possible
namespace collisions with READ/WRITE macros (e.g., from <linux/fs.h>).

Problems have been seen, for example, on mips:

>> drivers/mtd/spi-nor/fsl-quadspi.c:186:5: error: 'LUT_0' undeclared (first use in this function)
      ((LUT_##ins) << INSTR0_SHIFT))
        ^
>> drivers/mtd/spi-nor/fsl-quadspi.c:188:30: note: in expansion of macro 'LUT0'

On SPARC:

drivers/mtd/spi-nor/fsl-quadspi.c: In function 'fsl_qspi_init_lut':
drivers/mtd/spi-nor/fsl-quadspi.c:369:1: error: 'LUT_0' undeclared (first use in this function)
drivers/mtd/spi-nor/fsl-quadspi.c:418:1: error: pasting "LUT_" and "(" does not give a valid preprocessing token
drivers/mtd/spi-nor/fsl-quadspi.c:418:2: error: implicit declaration of function 'LUT_'

And surely on others.

Fixes: d26a22d06708 ("mtd: fsl-quadspi: allow building for other ARCHes with COMPILE_TEST")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Han Xu <b45815@freescale.com>
[Brian: rewrote commit description]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -138,15 +138,15 @@
 #define LUT_MODE		4
 #define LUT_MODE2		5
 #define LUT_MODE4		6
-#define LUT_READ		7
-#define LUT_WRITE		8
+#define LUT_FSL_READ		7
+#define LUT_FSL_WRITE		8
 #define LUT_JMP_ON_CS		9
 #define LUT_ADDR_DDR		10
 #define LUT_MODE_DDR		11
 #define LUT_MODE2_DDR		12
 #define LUT_MODE4_DDR		13
-#define LUT_READ_DDR		14
-#define LUT_WRITE_DDR		15
+#define LUT_FSL_READ_DDR		14
+#define LUT_FSL_WRITE_DDR		15
 #define LUT_DATA_LEARN		16
 
 /*
@@ -306,7 +306,7 @@ static void fsl_qspi_init_lut(struct fsl
 
 	writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen),
 			base + QUADSPI_LUT(lut_base));
-	writel(LUT0(DUMMY, PAD1, dummy) | LUT1(READ, PAD4, rxfifo),
+	writel(LUT0(DUMMY, PAD1, dummy) | LUT1(FSL_READ, PAD4, rxfifo),
 			base + QUADSPI_LUT(lut_base + 1));
 
 	/* Write enable */
@@ -327,11 +327,11 @@ static void fsl_qspi_init_lut(struct fsl
 
 	writel(LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen),
 			base + QUADSPI_LUT(lut_base));
-	writel(LUT0(WRITE, PAD1, 0), base + QUADSPI_LUT(lut_base + 1));
+	writel(LUT0(FSL_WRITE, PAD1, 0), base + QUADSPI_LUT(lut_base + 1));
 
 	/* Read Status */
 	lut_base = SEQID_RDSR * 4;
-	writel(LUT0(CMD, PAD1, SPINOR_OP_RDSR) | LUT1(READ, PAD1, 0x1),
+	writel(LUT0(CMD, PAD1, SPINOR_OP_RDSR) | LUT1(FSL_READ, PAD1, 0x1),
 			base + QUADSPI_LUT(lut_base));
 
 	/* Erase a sector */
@@ -356,17 +356,17 @@ static void fsl_qspi_init_lut(struct fsl
 
 	/* READ ID */
 	lut_base = SEQID_RDID * 4;
-	writel(LUT0(CMD, PAD1, SPINOR_OP_RDID) | LUT1(READ, PAD1, 0x8),
+	writel(LUT0(CMD, PAD1, SPINOR_OP_RDID) | LUT1(FSL_READ, PAD1, 0x8),
 			base + QUADSPI_LUT(lut_base));
 
 	/* Write Register */
 	lut_base = SEQID_WRSR * 4;
-	writel(LUT0(CMD, PAD1, SPINOR_OP_WRSR) | LUT1(WRITE, PAD1, 0x2),
+	writel(LUT0(CMD, PAD1, SPINOR_OP_WRSR) | LUT1(FSL_WRITE, PAD1, 0x2),
 			base + QUADSPI_LUT(lut_base));
 
 	/* Read Configuration Register */
 	lut_base = SEQID_RDCR * 4;
-	writel(LUT0(CMD, PAD1, SPINOR_OP_RDCR) | LUT1(READ, PAD1, 0x1),
+	writel(LUT0(CMD, PAD1, SPINOR_OP_RDCR) | LUT1(FSL_READ, PAD1, 0x1),
 			base + QUADSPI_LUT(lut_base));
 
 	/* Write disable */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 191/328] RDMA/ucma: check fd type in ucma_migrate_id()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (136 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 209/328] usb: misc: uss720: Fix two sleep-in-atomic-context bugs Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 230/328] drm: udl: Destroy framebuffer only if it was initialized Ben Hutchings
                   ` (189 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jason Gunthorpe, Jann Horn

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jann Horn <jannh@google.com>

commit 0d23ba6034b9cf48b8918404367506da3e4b3ee5 upstream.

The current code grabs the private_data of whatever file descriptor
userspace has supplied and implicitly casts it to a `struct ucma_file *`,
potentially causing a type confusion.

This is probably fine in practice because the pointer is only used for
comparisons, it is never actually dereferenced; and even in the
comparisons, it is unlikely that a file from another filesystem would have
a ->private_data pointer that happens to also be valid in this context.
But ->private_data is not always guaranteed to be a valid pointer to an
object owned by the file's filesystem; for example, some filesystems just
cram numbers in there.

Check the type of the supplied file descriptor to be safe, analogous to how
other places in the kernel do it.

Fixes: 88314e4dda1e ("RDMA/cma: add support for rdma_migrate_id()")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/core/ucma.c | 6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -113,6 +113,8 @@ static DEFINE_MUTEX(mut);
 static DEFINE_IDR(ctx_idr);
 static DEFINE_IDR(multicast_idr);
 
+static const struct file_operations ucma_fops;
+
 static inline struct ucma_context *_ucma_find_context(int id,
 						      struct ucma_file *file)
 {
@@ -1448,6 +1450,10 @@ static ssize_t ucma_migrate_id(struct uc
 	f = fdget(cmd.fd);
 	if (!f.file)
 		return -ENOENT;
+	if (f.file->f_op != &ucma_fops) {
+		ret = -EINVAL;
+		goto file_put;
+	}
 
 	/* Validate current fd and prevent destruction of id. */
 	ctx = ucma_get_ctx(f.file->private_data, cmd.id);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 194/328] iw_cxgb4: only allow 1 flush on user qps
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (93 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 083/328] iio: ad9523: Fix return value for ad952x_store() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 223/328] RDMA/cma: Protect cma dev list with lock Ben Hutchings
                   ` (232 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Steve Wise, Jason Gunthorpe

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steve Wise <swise@opengridcomputing.com>

commit 308aa2b8f7b7db3332a7d41099fd37851fb793b2 upstream.

Once the qp has been flushed, it cannot be flushed again.  The user qp
flush logic wasn't enforcing it however.  The bug can cause
touch-after-free crashes like:

Unable to handle kernel paging request for data at address 0x000001ec
Faulting instruction address: 0xc008000016069100
Oops: Kernel access of bad area, sig: 11 [#1]
...
NIP [c008000016069100] flush_qp+0x80/0x480 [iw_cxgb4]
LR [c00800001606cd6c] c4iw_modify_qp+0x71c/0x11d0 [iw_cxgb4]
Call Trace:
[c00800001606cd6c] c4iw_modify_qp+0x71c/0x11d0 [iw_cxgb4]
[c00800001606e868] c4iw_ib_modify_qp+0x118/0x200 [iw_cxgb4]
[c0080000119eae80] ib_security_modify_qp+0xd0/0x3d0 [ib_core]
[c0080000119c4e24] ib_modify_qp+0xc4/0x2c0 [ib_core]
[c008000011df0284] iwcm_modify_qp_err+0x44/0x70 [iw_cm]
[c008000011df0fec] destroy_cm_id+0xcc/0x370 [iw_cm]
[c008000011ed4358] rdma_destroy_id+0x3c8/0x520 [rdma_cm]
[c0080000134b0540] ucma_close+0x90/0x1b0 [rdma_ucm]
[c000000000444da4] __fput+0xe4/0x2f0

So fix flush_qp() to only flush the wq once.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/hw/cxgb4/qp.c | 6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1133,6 +1133,12 @@ static void flush_qp(struct c4iw_qp *qhp
 	schp = to_c4iw_cq(qhp->ibqp.send_cq);
 
 	if (qhp->ibqp.uobject) {
+
+		/* for user qps, qhp->wq.flushed is protected by qhp->mutex */
+		if (qhp->wq.flushed)
+			return;
+
+		qhp->wq.flushed = 1;
 		t4_set_wq_in_error(&qhp->wq);
 		t4_set_cq_in_error(&rchp->cq);
 		spin_lock_irqsave(&rchp->comp_handler_lock, flag);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 327/328] xfs: don't fail when converting shortform attr to long form during ATTR_REPLACE
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (213 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 067/328] ALSA: vx: Fix possible transfer overflow Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 032/328] ARM: tegra: Fix Tegra30 Cardhu PCA954x reset Ben Hutchings
                   ` (112 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, kanda.motohiro, Darrick J. Wong, Dave Chinner, Christoph Hellwig

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Darrick J. Wong" <darrick.wong@oracle.com>

commit 7b38460dc8e4eafba06c78f8e37099d3b34d473c upstream.

Kanda Motohiro reported that expanding a tiny xattr into a large xattr
fails on XFS because we remove the tiny xattr from a shortform fork and
then try to re-add it after converting the fork to extents format having
not removed the ATTR_REPLACE flag.  This fails because the attr is no
longer present, causing a fs shutdown.

This is derived from the patch in his bug report, but we really
shouldn't ignore a nonzero retval from the remove call.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199119
Reported-by: kanda.motohiro@gmail.com
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/xfs/xfs_attr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -540,7 +540,14 @@ xfs_attr_shortform_addname(xfs_da_args_t
 		if (args->flags & ATTR_CREATE)
 			return(retval);
 		retval = xfs_attr_shortform_remove(args);
-		ASSERT(retval == 0);
+		if (retval)
+			return retval;
+		/*
+		 * Since we have removed the old attr, clear ATTR_REPLACE so
+		 * that the leaf format add routine won't trip over the attr
+		 * not being around.
+		 */
+		args->flags &= ~ATTR_REPLACE;
 	}
 
 	if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 305/328] usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (317 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 231/328] platform/x86: alienware-wmi: Correct a memory leak Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 269/328] bcache: add separate workqueue for journal_write to avoid deadlock Ben Hutchings
                   ` (8 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Shuah Khan (Samsung OSG),
	syzbot+bccc1fe10b70fadc78d0, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Shuah Khan (Samsung OSG)" <shuah@kernel.org>

commit 81f7567c51ad97668d1c3a48e8ecc482e64d4161 upstream.

vhci_hub_control() accesses port_status array with out of bounds port
value. Fix it to reference port_status[] only with a valid rhport value
when invalid_rhport flag is true.

The invalid_rhport flag is set early on after detecting in port value
is within the bounds or not.

The following is used reproduce the problem and verify the fix:
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14ed8ab6400000

Reported-by: syzbot+bccc1fe10b70fadc78d0@syzkaller.appspotmail.com
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16:
 - s/VHCI_HC_PORTS/VHCI_NPORTS/
 - Mask wIndex before using it, as done upstream in commit 1c9de5bf4286
   "usbip: vhci-hcd: Add USB3 SuperSpeed support"
 - Drop inapplicable changes
 - Adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -234,7 +234,8 @@ static int vhci_hub_control(struct usb_h
 {
 	struct vhci_hcd	*dum;
 	int             retval = 0;
-	int		rhport;
+	int		rhport = -1;
+	bool invalid_rhport = false;
 
 	u32 prev_port_status[VHCI_NPORTS];
 
@@ -245,11 +246,23 @@ static int vhci_hub_control(struct usb_h
 	 * NOTE:
 	 * wIndex shows the port number and begins from 1.
 	 */
+	wIndex = ((__u8)(wIndex & 0x00ff));
 	usbip_dbg_vhci_rh("typeReq %x wValue %x wIndex %x\n", typeReq, wValue,
 			  wIndex);
-	if (wIndex > VHCI_NPORTS)
-		pr_err("invalid port number %d\n", wIndex);
-	rhport = ((__u8)(wIndex & 0x00ff)) - 1;
+
+	/*
+	 * wIndex can be 0 for some request types (typeReq). rhport is
+	 * in valid range when wIndex >= 1 and < VHCI_HC_PORTS.
+	 *
+	 * Reference port_status[] only with valid rhport when
+	 * invalid_rhport is false.
+	 */
+	if (wIndex < 1 || wIndex > VHCI_NPORTS) {
+		invalid_rhport = true;
+		if (wIndex > VHCI_NPORTS)
+			pr_err("invalid port number %d\n", wIndex);
+	} else
+		rhport = wIndex - 1;
 
 	dum = hcd_to_vhci(hcd);
 
@@ -257,8 +270,9 @@ static int vhci_hub_control(struct usb_h
 
 	/* store old status and compare now and old later */
 	if (usbip_dbg_flag_vhci_rh) {
-		memcpy(prev_port_status, dum->port_status,
-			sizeof(prev_port_status));
+		if (!invalid_rhport)
+			memcpy(prev_port_status, dum->port_status,
+				sizeof(prev_port_status));
 	}
 
 	switch (typeReq) {
@@ -266,8 +280,10 @@ static int vhci_hub_control(struct usb_h
 		usbip_dbg_vhci_rh(" ClearHubFeature\n");
 		break;
 	case ClearPortFeature:
-		if (rhport < 0)
+		if (invalid_rhport) {
+			pr_err("invalid port number %d\n", wIndex);
 			goto error;
+		}
 		switch (wValue) {
 		case USB_PORT_FEAT_SUSPEND:
 			if (dum->port_status[rhport] & USB_PORT_STAT_SUSPEND) {
@@ -315,9 +331,10 @@ static int vhci_hub_control(struct usb_h
 		break;
 	case GetPortStatus:
 		usbip_dbg_vhci_rh(" GetPortStatus port %x\n", wIndex);
-		if (wIndex > VHCI_NPORTS || wIndex < 1) {
+		if (invalid_rhport) {
 			pr_err("invalid port number %d\n", wIndex);
 			retval = -EPIPE;
+			goto error;
 		}
 
 		/* we do not care about resume. */
@@ -372,8 +389,10 @@ static int vhci_hub_control(struct usb_h
 		case USB_PORT_FEAT_RESET:
 			usbip_dbg_vhci_rh(
 				" SetPortFeature: USB_PORT_FEAT_RESET\n");
-			if (rhport < 0)
+			if (invalid_rhport) {
+				pr_err("invalid port number %d\n", wIndex);
 				goto error;
+			}
 			/* if it's already running, disconnect first */
 			if (dum->port_status[rhport] & USB_PORT_STAT_ENABLE) {
 				dum->port_status[rhport] &=
@@ -389,8 +408,10 @@ static int vhci_hub_control(struct usb_h
 		default:
 			usbip_dbg_vhci_rh(" SetPortFeature: default %d\n",
 					  wValue);
-			if (rhport < 0)
+			if (invalid_rhport) {
+				pr_err("invalid port number %d\n", wIndex);
 				goto error;
+			}
 			dum->port_status[rhport] |= (1 << wValue);
 			break;
 		}
@@ -406,7 +427,7 @@ error:
 	if (usbip_dbg_flag_vhci_rh) {
 		pr_debug("port %d\n", rhport);
 		/* Only dump valid port status */
-		if (rhport >= 0) {
+		if (!invalid_rhport) {
 			dump_port_status_diff(prev_port_status[rhport],
 					      dum->port_status[rhport]);
 		}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 206/328] usb: Don't die twice if PCI xhci host is not responding in resume
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (266 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 022/328] media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 072/328] fuse: flush requests on umount Ben Hutchings
                   ` (59 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mathias Nyman, Alan Stern, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit f3dc41c5d22b2ca14a0802a65d8cdc33a3882d4e upstream.

usb_hc_died() should only be called once, and with the primary HCD
as parameter. It will mark both primary and secondary hcd's dead.

Remove the extra call to usb_cd_died with the shared hcd as parameter.

Fixes: ff9d78b36f76 ("USB: Set usb_hcd->state and flags for shared roothubs")
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/hcd-pci.c | 2 --
 1 file changed, 2 deletions(-)

--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -528,8 +528,6 @@ static int resume_common(struct device *
 				event == PM_EVENT_RESTORE);
 		if (retval) {
 			dev_err(dev, "PCI post-resume error %d!\n", retval);
-			if (hcd->shared_hcd)
-				usb_hc_died(hcd->shared_hcd);
 			usb_hc_died(hcd);
 		}
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 196/328] USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (10 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 225/328] hwmon: (nct6775) Fix access to fan pulse registers Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 036/328] mei: bus: type promotion bug in mei_nfc_if_version() Ben Hutchings
                   ` (315 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Maxence Duprès

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Maxence Duprès <xpros64@hotmail.fr>

commit 9b83a1c301ad6d24988a128c69b42cbaaf537d82 upstream.

WORLDE Controller KS49 or Prodipe MIDI 49C USB controller
cause a -EPROTO error, a communication restart and loop again.

This issue has already been fixed for KS25.
https://lore.kernel.org/patchwork/patch/753077/

I just add device 201 for KS49 in quirks.c to get it works.

Signed-off-by: Laurent Roux <xpros64@hotmail.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/quirks.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -37,6 +37,10 @@ static const struct usb_device_id usb_qu
 	/* CBM - Flash disk */
 	{ USB_DEVICE(0x0204, 0x6025), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* WORLDE Controller KS49 or Prodipe MIDI 49C USB controller */
+	{ USB_DEVICE(0x0218, 0x0201), .driver_info =
+			USB_QUIRK_CONFIG_INTF_STRINGS },
+
 	/* WORLDE easy key (easykey.25) MIDI controller  */
 	{ USB_DEVICE(0x0218, 0x0401), .driver_info =
 			USB_QUIRK_CONFIG_INTF_STRINGS },


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 291/328] smb2: fix missing files in root share directory listing
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (229 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 024/328] staging: rts5208: fix missing error check on call to rtsx_write_register Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 046/328] MIPS: Correct the 64-bit DSP accumulator register size Ben Hutchings
                   ` (96 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Steve French, Paulo Alcantara, Ronnie Sahlberg, Aurelien Aptel

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Aurelien Aptel <aaptel@suse.com>

commit 0595751f267994c3c7027377058e4185b3a28e75 upstream.

When mounting a Windows share that is the root of a drive (eg. C$)
the server does not return . and .. directory entries. This results in
the smb2 code path erroneously skipping the 2 first entries.

Pseudo-code of the readdir() code path:

cifs_readdir(struct file, struct dir_context)
    initiate_cifs_search            <-- if no reponse cached yet
        server->ops->query_dir_first

    dir_emit_dots
        dir_emit                    <-- adds "." and ".." if we're at pos=0

    find_cifs_entry
        initiate_cifs_search        <-- if pos < start of current response
                                         (restart search)
        server->ops->query_dir_next <-- if pos > end of current response
                                         (fetch next search res)

    for(...)                        <-- loops over cur response entries
                                          starting at pos
        cifs_filldir                <-- skip . and .., emit entry
            cifs_fill_dirent
            dir_emit
	pos++

A) dir_emit_dots() always adds . & ..
   and sets the current dir pos to 2 (0 and 1 are done).

Therefore we always want the index_to_find to be 2 regardless of if
the response has . and ..

B) smb1 code initializes index_of_last_entry with a +2 offset

  in cifssmb.c CIFSFindFirst():
		psrch_inf->index_of_last_entry = 2 /* skip . and .. */ +
			psrch_inf->entries_in_buffer;

Later in find_cifs_entry() we want to find the next dir entry at pos=2
as a result of (A)

	first_entry_in_buffer = cfile->srch_inf.index_of_last_entry -
					cfile->srch_inf.entries_in_buffer;

This var is the dir pos that the first entry in the buffer will
have therefore it must be 2 in the first call.

If we don't offset index_of_last_entry by 2 (like in (B)),
first_entry_in_buffer=0 but we were instructed to get pos=2 so this
code in find_cifs_entry() skips the 2 first which is ok for non-root
shares, as it skips . and .. from the response but is not ok for root
shares where the 2 first are actual files

		pos_in_buf = index_to_find - first_entry_in_buffer;
                // pos_in_buf=2
		// we skip 2 first response entries :(
		for (i = 0; (i < (pos_in_buf)) && (cur_ent != NULL); i++) {
			/* go entry by entry figuring out which is first */
			cur_ent = nxt_dir_entry(cur_ent, end_of_smb,
						cfile->srch_inf.info_level);
		}

C) cifs_filldir() skips . and .. so we can safely ignore them for now.

Sample program:

int main(int argc, char **argv)
{
	const char *path = argc >= 2 ? argv[1] : ".";
	DIR *dh;
	struct dirent *de;

	printf("listing path <%s>\n", path);
	dh = opendir(path);
	if (!dh) {
		printf("opendir error %d\n", errno);
		return 1;
	}

	while (1) {
		de = readdir(dh);
		if (!de) {
			if (errno) {
				printf("readdir error %d\n", errno);
				return 1;
			}
			printf("end of listing\n");
			break;
		}
		printf("off=%lu <%s>\n", de->d_off, de->d_name);
	}

	return 0;
}

Before the fix with SMB1 on root shares:

<.>            off=1
<..>           off=2
<$Recycle.Bin> off=3
<bootmgr>      off=4

and on non-root shares:

<.>    off=1
<..>   off=4  <-- after adding .., the offsets jumps to +2 because
<2536> off=5       we skipped . and .. from response buffer (C)
<411>  off=6       but still incremented pos
<file> off=7
<fsx>  off=8

Therefore the fix for smb2 is to mimic smb1 behaviour and offset the
index_of_last_entry by 2.

Test results comparing smb1 and smb2 before/after the fix on root
share, non-root shares and on large directories (ie. multi-response
dir listing):

PRE FIX
=======
pre-1-root VS pre-2-root:
        ERR pre-2-root is missing [bootmgr, $Recycle.Bin]
pre-1-nonroot VS pre-2-nonroot:
        OK~ same files, same order, different offsets
pre-1-nonroot-large VS pre-2-nonroot-large:
        OK~ same files, same order, different offsets

POST FIX
========
post-1-root VS post-2-root:
        OK same files, same order, same offsets
post-1-nonroot VS post-2-nonroot:
        OK same files, same order, same offsets
post-1-nonroot-large VS post-2-nonroot-large:
        OK same files, same order, same offsets

REGRESSION?
===========
pre-1-root VS post-1-root:
        OK same files, same order, same offsets
pre-1-nonroot VS post-1-nonroot:
        OK same files, same order, same offsets

BugLink: https://bugzilla.samba.org/show_bug.cgi?id=13107
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Paulo Alcantara <palcantara@suse.deR>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -743,7 +743,7 @@ smb2_query_dir_first(const unsigned int
 	}
 
 	srch_inf->entries_in_buffer = 0;
-	srch_inf->index_of_last_entry = 0;
+	srch_inf->index_of_last_entry = 2;
 
 	rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
 				  fid->volatile_fid, 0, srch_inf);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 233/328] x86/EISA: Don't probe EISA bus for Xen PV guests
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (264 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 128/328] 9p/net: Fix zero-copy path in the 9p virtio transport Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 022/328] media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt() Ben Hutchings
                   ` (61 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, xen-devel, Thomas Gleixner, jgross, hpa, Boris Ostrovsky,
	Andy Smith

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Boris Ostrovsky <boris.ostrovsky@oracle.com>

commit 6a92b11169a65b3f8cc512c75a252cbd0d096ba0 upstream.

For unprivileged Xen PV guests this is normal memory and ioremap will
not be able to properly map it.

While at it, since ioremap may return NULL, add a test for pointer's
validity.

Reported-by: Andy Smith <andy@strugglers.net>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: hpa@zytor.com
Cc: xen-devel@lists.xenproject.org
Cc: jgross@suse.com
Link: https://lkml.kernel.org/r/20180911195538.23289-1-boris.ostrovsky@oracle.com
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/kernel/eisa.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/eisa.c
+++ b/arch/x86/kernel/eisa.c
@@ -6,11 +6,17 @@
 #include <linux/ioport.h>
 #include <linux/eisa.h>
 
+#include <xen/xen.h>
+
 static __init int eisa_bus_probe(void)
 {
-	void __iomem *p = ioremap(0x0FFFD9, 4);
+	void __iomem *p;
+
+	if (xen_pv_domain() && !xen_initial_domain())
+		return 0;
 
-	if (readl(p) == 'E' + ('I'<<8) + ('S'<<16) + ('A'<<24))
+	p = ioremap(0x0FFFD9, 4);
+	if (p && readl(p) == 'E' + ('I' << 8) + ('S' << 16) + ('A' << 24))
 		EISA_bus = 1;
 	iounmap(p);
 	return 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 213/328] batman-adv: Prevent duplicated gateway_node entry
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (217 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 068/328] ALSA: vx222: Fix invalid endian conversions Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 280/328] tools: hv: fcopy: set 'error' in case an unknown operation was requested Ben Hutchings
                   ` (108 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Sven Eckelmann, Simon Wunderlich, Marek Lindner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

commit dff9bc42ab0b2d38c5e90ddd79b238fed5b4c7ad upstream.

The function batadv_gw_node_add is responsible for adding new gw_node to
the gateway_list. It is expecting that the caller already checked that
there is not already an entry with the same key or not.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/batman-adv/gateway_client.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/net/batman-adv/gateway_client.c
+++ b/net/batman-adv/gateway_client.c
@@ -27,6 +27,7 @@
 #include <linux/ipv6.h>
 #include <linux/udp.h>
 #include <linux/if_vlan.h>
+#include <linux/lockdep.h>
 
 /* These are the offsets of the "hw type" and "hw address length" in the dhcp
  * packet starting at the beginning of the dhcp header
@@ -398,6 +399,9 @@ out:
  * @bat_priv: the bat priv with all the soft interface information
  * @orig_node: originator announcing gateway capabilities
  * @gateway: announced bandwidth information
+ *
+ * Has to be called with the appropriate locks being acquired
+ * (gw.list_lock).
  */
 static void batadv_gw_node_add(struct batadv_priv *bat_priv,
 			       struct batadv_orig_node *orig_node,
@@ -405,6 +409,8 @@ static void batadv_gw_node_add(struct ba
 {
 	struct batadv_gw_node *gw_node;
 
+	lockdep_assert_held(&bat_priv->gw.list_lock);
+
 	if (gateway->bandwidth_down == 0)
 		return;
 
@@ -421,9 +427,7 @@ static void batadv_gw_node_add(struct ba
 	gw_node->orig_node = orig_node;
 	atomic_set(&gw_node->refcount, 1);
 
-	spin_lock_bh(&bat_priv->gw.list_lock);
 	hlist_add_head_rcu(&gw_node->list, &bat_priv->gw.list);
-	spin_unlock_bh(&bat_priv->gw.list_lock);
 
 	batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
 		   "Found new gateway %pM -> gw bandwidth: %u.%u/%u.%u MBit\n",
@@ -479,11 +483,14 @@ void batadv_gw_node_update(struct batadv
 {
 	struct batadv_gw_node *gw_node, *curr_gw = NULL;
 
+	spin_lock_bh(&bat_priv->gw.list_lock);
 	gw_node = batadv_gw_node_get(bat_priv, orig_node);
 	if (!gw_node) {
 		batadv_gw_node_add(bat_priv, orig_node, gateway);
+		spin_unlock_bh(&bat_priv->gw.list_lock);
 		goto out;
 	}
+	spin_unlock_bh(&bat_priv->gw.list_lock);
 
 	if ((gw_node->bandwidth_down == ntohl(gateway->bandwidth_down)) &&
 	    (gw_node->bandwidth_up == ntohl(gateway->bandwidth_up)))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 249/328] x86/paravirt: Fix some warning messages
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (209 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 197/328] USB: yurex: Fix buffer over-read in yurex_write() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 277/328] smsc95xx: Check for Wake-on-LAN modes Ben Hutchings
                   ` (116 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, H. Peter Anvin, kernel-janitors, Alok Kataria,
	Juergen Gross, Thomas Gleixner, Peter Zijlstra, Dan Carpenter,
	virtualization

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 571d0563c8881595f4ab027aef9ed1c55e3e7b7c upstream.

The first argument to WARN_ONCE() is a condition.

Fixes: 5800dc5c19f3 ("x86/paravirt: Fix spectre-v2 mitigations for paravirt guests")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Juergen Gross <jgross@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Alok Kataria <akataria@vmware.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: virtualization@lists.linux-foundation.org
Cc: kernel-janitors@vger.kernel.org
Link: https://lkml.kernel.org/r/20180919103553.GD9238@mwanda
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/kernel/paravirt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -99,7 +99,7 @@ unsigned paravirt_patch_call(void *insnb
 
 	if (len < 5) {
 #ifdef CONFIG_RETPOLINE
-		WARN_ONCE("Failing to patch indirect CALL in %ps\n", (void *)addr);
+		WARN_ONCE(1, "Failing to patch indirect CALL in %ps\n", (void *)addr);
 #endif
 		return len;	/* call too long for patch site */
 	}
@@ -119,7 +119,7 @@ unsigned paravirt_patch_jmp(void *insnbu
 
 	if (len < 5) {
 #ifdef CONFIG_RETPOLINE
-		WARN_ONCE("Failing to patch indirect JMP in %ps\n", (void *)addr);
+		WARN_ONCE(1, "Failing to patch indirect JMP in %ps\n", (void *)addr);
 #endif
 		return len;	/* call too long for patch site */
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 227/328] ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (274 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 005/328] kprobes: Make list and blacklist root user read only Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 315/328] usb: gadget: storage: Fix Spectre v1 vulnerability Ben Hutchings
                   ` (51 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai, Takashi Sakamoto

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Sakamoto <o-takashi@sakamocchi.jp>

commit 493626f2d87a74e6dbea1686499ed6e7e600484e upstream.

When executing 'fw_run_transaction()' with 'TCODE_WRITE_BLOCK_REQUEST',
an address of 'payload' argument is used for streaming DMA mapping by
'firewire_ohci' module if 'size' argument is larger than 8 byte.
Although in this case the address should not be on kernel stack, current
implementation of ALSA bebob driver uses data in kernel stack for a cue
to boot M-Audio devices. This often brings unexpected result, especially
for a case of CONFIG_VMAP_STACK=y.

This commit fixes the bug.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=201021
Reference: https://forum.manjaro.org/t/firewire-m-audio-410-driver-wont-load-firmware/51165
Fixes: a2b2a7798fb6('ALSA: bebob: Send a cue to load firmware for M-Audio Firewire series')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/firewire/bebob/bebob_maudio.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -96,17 +96,13 @@ int snd_bebob_maudio_load_firmware(struc
 	struct fw_device *device = fw_parent_device(unit);
 	int err, rcode;
 	u64 date;
-	__le32 cues[3] = {
-		cpu_to_le32(MAUDIO_BOOTLOADER_CUE1),
-		cpu_to_le32(MAUDIO_BOOTLOADER_CUE2),
-		cpu_to_le32(MAUDIO_BOOTLOADER_CUE3)
-	};
+	__le32 *cues;
 
 	/* check date of software used to build */
 	err = snd_bebob_read_block(unit, INFO_OFFSET_SW_DATE,
 				   &date, sizeof(u64));
 	if (err < 0)
-		goto end;
+		return err;
 	/*
 	 * firmware version 5058 or later has date later than "20070401", but
 	 * 'date' is not null-terminated.
@@ -114,20 +110,28 @@ int snd_bebob_maudio_load_firmware(struc
 	if (date < 0x3230303730343031LL) {
 		dev_err(&unit->device,
 			"Use firmware version 5058 or later\n");
-		err = -ENOSYS;
-		goto end;
+		return -ENXIO;
 	}
 
+	cues = kmalloc_array(3, sizeof(*cues), GFP_KERNEL);
+	if (!cues)
+		return -ENOMEM;
+
+	cues[0] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE1);
+	cues[1] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE2);
+	cues[2] = cpu_to_le32(MAUDIO_BOOTLOADER_CUE3);
+
 	rcode = fw_run_transaction(device->card, TCODE_WRITE_BLOCK_REQUEST,
 				   device->node_id, device->generation,
 				   device->max_speed, BEBOB_ADDR_REG_REQ,
-				   cues, sizeof(cues));
+				   cues, 3 * sizeof(*cues));
+	kfree(cues);
 	if (rcode != RCODE_COMPLETE) {
 		dev_err(&unit->device,
 			"Failed to send a cue to load firmware\n");
 		err = -EIO;
 	}
-end:
+
 	return err;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (255 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 039/328] tty: fix termios input-speed encoding Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:57   ` Nadav Amit
  2018-12-09 21:50 ` [PATCH 3.16 217/328] batman-adv: Place kref_get for softif_vlan near use Ben Hutchings
                   ` (70 subsequent siblings)
  327 siblings, 1 reply; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dave Hansen, Nadav Amit, Vlastimil Babka, Andi Kleen,
	Peter Zijlstra (Intel),
	Josh Poimboeuf, Thomas Gleixner, Sean Christopherson,
	Michal Hocko, Andy Lutomirski

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Nadav Amit <namit@vmware.com>

commit 9bc4f28af75a91aea0ae383f50b0a430c4509303 upstream.

When page-table entries are set, the compiler might optimize their
assignment by using multiple instructions to set the PTE. This might
turn into a security hazard if the user somehow manages to use the
interim PTE. L1TF does not make our lives easier, making even an interim
non-present PTE a security hazard.

Using WRITE_ONCE() to set PTEs and friends should prevent this potential
security hazard.

I skimmed the differences in the binary with and without this patch. The
differences are (obviously) greater when CONFIG_PARAVIRT=n as more
code optimizations are possible. For better and worse, the impact on the
binary with this patch is pretty small. Skimming the code did not cause
anything to jump out as a security hazard, but it seems that at least
move_soft_dirty_pte() caused set_pte_at() to use multiple writes.

Signed-off-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20180902181451.80520-1-namit@vmware.com
[bwh: Backported to 3.16:
 - Use ACCESS_ONCE() instead of WRITE_ONCE()
 - Drop changes in pmdp_establish(), native_set_p4d(), pudp_set_access_flags()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -44,15 +44,15 @@ struct mm_struct;
 void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
 
 
-static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
-				    pte_t *ptep)
+static inline void native_set_pte(pte_t *ptep, pte_t pte)
 {
-	*ptep = native_make_pte(0);
+	ACCESS_ONCE(*ptep) = pte;
 }
 
-static inline void native_set_pte(pte_t *ptep, pte_t pte)
+static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
+				    pte_t *ptep)
 {
-	*ptep = pte;
+	native_set_pte(ptep, native_make_pte(0));
 }
 
 static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
@@ -62,7 +62,7 @@ static inline void native_set_pte_atomic
 
 static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
 {
-	*pmdp = pmd;
+	ACCESS_ONCE(*pmdp) = pmd;
 }
 
 static inline void native_pmd_clear(pmd_t *pmd)
@@ -98,7 +98,7 @@ static inline pmd_t native_pmdp_get_and_
 
 static inline void native_set_pud(pud_t *pudp, pud_t pud)
 {
-	*pudp = pud;
+	ACCESS_ONCE(*pudp) = pud;
 }
 
 static inline void native_pud_clear(pud_t *pud)
@@ -131,7 +131,7 @@ static inline pgd_t *native_get_shadow_p
 
 static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
 {
-	*pgdp = kaiser_set_shadow_pgd(pgdp, pgd);
+	ACCESS_ONCE(*pgdp) = kaiser_set_shadow_pgd(pgdp, pgd);
 }
 
 static inline void native_pgd_clear(pgd_t *pgd)
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -242,7 +242,7 @@ static void pgd_mop_up_pmds(struct mm_st
 		if (pgd_val(pgd) != 0) {
 			pmd_t *pmd = (pmd_t *)pgd_page_vaddr(pgd);
 
-			pgdp[i] = native_make_pgd(0);
+			pgd_clear(&pgdp[i]);
 
 			paravirt_release_pmd(pgd_val(pgd) >> PAGE_SHIFT);
 			pmd_free(mm, pmd);
@@ -352,7 +352,7 @@ int ptep_set_access_flags(struct vm_area
 	int changed = !pte_same(*ptep, entry);
 
 	if (changed && dirty) {
-		*ptep = entry;
+		set_pte(ptep, entry);
 		pte_update_defer(vma->vm_mm, address, ptep);
 	}
 
@@ -369,7 +369,7 @@ int pmdp_set_access_flags(struct vm_area
 	VM_BUG_ON(address & ~HPAGE_PMD_MASK);
 
 	if (changed && dirty) {
-		*pmdp = entry;
+		set_pmd(pmdp, entry);
 		pmd_update_defer(vma->vm_mm, address, pmdp);
 		/*
 		 * We had a write-protection fault here and changed the pmd


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 217/328] batman-adv: Place kref_get for softif_vlan near use
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (256 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 182/328] SMB3: Backup intent flag missing for directory opens with backupuid mounts Ben Hutchings
                   ` (69 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Sven Eckelmann, Simon Wunderlich, Marek Lindner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

commit df28ca6bb3282a4c8dc5b65f60b0136fc190ee52 upstream.

It is hard to understand why the refcnt is increased when it isn't done
near the actual place the new reference is used. So using kref_get right
before the place which requires the reference and in the same function
helps to avoid accidental problems caused by incorrect reference counting.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16:
 - s/kref_get/atomic_inc/
 - s/_put/_free_ref/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/batman-adv/soft-interface.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -529,6 +529,7 @@ int batadv_softif_create_vlan(struct bat
 	}
 
 	spin_lock_bh(&bat_priv->softif_vlan_list_lock);
+	atomic_inc(&vlan->refcount);
 	hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list);
 	spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
 
@@ -539,6 +540,9 @@ int batadv_softif_create_vlan(struct bat
 			    bat_priv->soft_iface->dev_addr, vid,
 			    BATADV_NULL_IFINDEX, BATADV_NO_MARK);
 
+	/* don't return reference to new softif_vlan */
+	batadv_softif_vlan_free_ref(vlan);
+
 	return 0;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 224/328] drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (19 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 199/328] usb: uas: add support for more quirk flags Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 087/328] udl-kms: handle allocation failure Ben Hutchings
                   ` (306 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Daniel Vetter, Karol Herbst, Ben Skeggs, Lyude Paul, Lukas Wunner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Lyude Paul <lyude@redhat.com>

commit 6833fb1ec120bf078e1a527c573a09d4de286224 upstream.

It's true we can't resume the device from poll workers in
nouveau_connector_detect(). We can however, prevent the autosuspend
timer from elapsing immediately if it hasn't already without risking any
sort of deadlock with the runtime suspend/resume operations. So do that
instead of entirely avoiding grabbing a power reference.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Cc: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -256,12 +256,16 @@ nouveau_connector_detect(struct drm_conn
 		nv_connector->edid = NULL;
 	}
 
-	/* Outputs are only polled while runtime active, so acquiring a
-	 * runtime PM ref here is unnecessary (and would deadlock upon
-	 * runtime suspend because it waits for polling to finish).
+	/* Outputs are only polled while runtime active, so resuming the
+	 * device here is unnecessary (and would deadlock upon runtime suspend
+	 * because it waits for polling to finish). We do however, want to
+	 * prevent the autosuspend timer from elapsing during this operation
+	 * if possible.
 	 */
-	if (!drm_kms_helper_is_poll_worker()) {
-		ret = pm_runtime_get_sync(connector->dev->dev);
+	if (drm_kms_helper_is_poll_worker()) {
+		pm_runtime_get_noresume(dev->dev);
+	} else {
+		ret = pm_runtime_get_sync(dev->dev);
 		if (ret < 0 && ret != -EACCES)
 			return conn_status;
 	}
@@ -332,10 +336,8 @@ detect_analog:
 
  out:
 
-	if (!drm_kms_helper_is_poll_worker()) {
-		pm_runtime_mark_last_busy(connector->dev->dev);
-		pm_runtime_put_autosuspend(connector->dev->dev);
-	}
+	pm_runtime_mark_last_busy(dev->dev);
+	pm_runtime_put_autosuspend(dev->dev);
 
 	return conn_status;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 245/328] serial: cpm_uart: return immediately from console poll
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (291 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 279/328] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 010/328] rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication() Ben Hutchings
                   ` (34 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jason Wessel, Greg Kroah-Hartman, Christophe Leroy

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Christophe Leroy <christophe.leroy@c-s.fr>

commit be28c1e3ca29887e207f0cbcd294cefe5074bab6 upstream.

kgdb expects poll function to return immediately and
returning NO_POLL_CHAR when no character is available.

Fixes: f5316b4aea024 ("kgdb,8250,pl011: Return immediately from console poll")
Cc: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/tty/serial/cpm_uart/cpm_uart_core.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -1062,8 +1062,8 @@ static int poll_wait_key(char *obuf, str
 	/* Get the address of the host memory buffer.
 	 */
 	bdp = pinfo->rx_cur;
-	while (bdp->cbd_sc & BD_SC_EMPTY)
-		;
+	if (bdp->cbd_sc & BD_SC_EMPTY)
+		return NO_POLL_CHAR;
 
 	/* If the buffer address is in the CPM DPRAM, don't
 	 * convert it.
@@ -1097,7 +1097,11 @@ static int cpm_get_poll_char(struct uart
 		poll_chars = 0;
 	}
 	if (poll_chars <= 0) {
-		poll_chars = poll_wait_key(poll_buf, pinfo);
+		int ret = poll_wait_key(poll_buf, pinfo);
+
+		if (ret == NO_POLL_CHAR)
+			return ret;
+		poll_chars = ret;
 		pollp = poll_buf;
 	}
 	poll_chars--;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 220/328] batman-adv: Prevent duplicated tvlv handler
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (128 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 205/328] spi: rspi: Fix interrupted DMA transfers Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 136/328] xtensa: limit offsets in __loop_cache_{all,page} Ben Hutchings
                   ` (197 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Sven Eckelmann, Simon Wunderlich

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

commit ae3cdc97dc10c7a3b31f297dab429bfb774c9ccb upstream.

The function batadv_tvlv_handler_register is responsible for adding new
tvlv_handler to the handler_list. It first checks whether the entry
already is in the list or not. If it is, then the creation of a new entry
is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: ef26157747d4 ("batman-adv: tvlv - basic infrastructure")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/batman-adv/main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -1058,15 +1058,20 @@ void batadv_tvlv_handler_register(struct
 {
 	struct batadv_tvlv_handler *tvlv_handler;
 
+	spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
+
 	tvlv_handler = batadv_tvlv_handler_get(bat_priv, type, version);
 	if (tvlv_handler) {
+		spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
 		batadv_tvlv_handler_free_ref(tvlv_handler);
 		return;
 	}
 
 	tvlv_handler = kzalloc(sizeof(*tvlv_handler), GFP_ATOMIC);
-	if (!tvlv_handler)
+	if (!tvlv_handler) {
+		spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
 		return;
+	}
 
 	tvlv_handler->ogm_handler = optr;
 	tvlv_handler->unicast_handler = uptr;
@@ -1076,7 +1081,6 @@ void batadv_tvlv_handler_register(struct
 	atomic_set(&tvlv_handler->refcount, 1);
 	INIT_HLIST_NODE(&tvlv_handler->list);
 
-	spin_lock_bh(&bat_priv->tvlv.handler_list_lock);
 	hlist_add_head_rcu(&tvlv_handler->list, &bat_priv->tvlv.handler_list);
 	spin_unlock_bh(&bat_priv->tvlv.handler_list_lock);
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 215/328] batman-adv: Prevent duplicated nc_node entry
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (258 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 182/328] SMB3: Backup intent flag missing for directory opens with backupuid mounts Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 247/328] Input: elantech - enable middle button of touchpad on ThinkPad P72 Ben Hutchings
                   ` (67 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Sven Eckelmann, Marek Lindner, Simon Wunderlich

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

commit fa122fec8640eb7186ce5a41b83a4c1744ceef8f upstream.

The function batadv_nc_get_nc_node is responsible for adding new nc_nodes
to the in_coding_list and out_coding_list. It first checks whether the
entry already is in the list or not. If it is, then the creation of a new
entry is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: d56b1705e28c ("batman-adv: network coding - detect coding nodes and remove these after timeout")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/batman-adv/network-coding.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -802,16 +802,27 @@ static struct batadv_nc_node
 	spinlock_t *lock; /* Used to lock list selected by "int in_coding" */
 	struct list_head *list;
 
+	/* Select ingoing or outgoing coding node */
+	if (in_coding) {
+		lock = &orig_neigh_node->in_coding_list_lock;
+		list = &orig_neigh_node->in_coding_list;
+	} else {
+		lock = &orig_neigh_node->out_coding_list_lock;
+		list = &orig_neigh_node->out_coding_list;
+	}
+
+	spin_lock_bh(lock);
+
 	/* Check if nc_node is already added */
 	nc_node = batadv_nc_find_nc_node(orig_node, orig_neigh_node, in_coding);
 
 	/* Node found */
 	if (nc_node)
-		return nc_node;
+		goto unlock;
 
 	nc_node = kzalloc(sizeof(*nc_node), GFP_ATOMIC);
 	if (!nc_node)
-		return NULL;
+		goto unlock;
 
 	WARN_ON_ONCE(atomic_inc_return(&orig_neigh_node->refcount) < 2);
 
@@ -821,21 +832,13 @@ static struct batadv_nc_node
 	nc_node->orig_node = orig_neigh_node;
 	atomic_set(&nc_node->refcount, 2);
 
-	/* Select ingoing or outgoing coding node */
-	if (in_coding) {
-		lock = &orig_neigh_node->in_coding_list_lock;
-		list = &orig_neigh_node->in_coding_list;
-	} else {
-		lock = &orig_neigh_node->out_coding_list_lock;
-		list = &orig_neigh_node->out_coding_list;
-	}
-
 	batadv_dbg(BATADV_DBG_NC, bat_priv, "Adding nc_node %pM -> %pM\n",
 		   nc_node->addr, nc_node->orig_node->orig);
 
 	/* Add nc_node to orig_node */
-	spin_lock_bh(lock);
 	list_add_tail_rcu(&nc_node->list, list);
+
+unlock:
 	spin_unlock_bh(lock);
 
 	return nc_node;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 218/328] batman-adv: Prevent duplicated softif_vlan entry
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (280 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 262/328] USB: serial: simple: add Motorola Tetra MTP6550 id Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 240/328] ext4: don't mark mmp buffer head dirty Ben Hutchings
                   ` (45 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Sven Eckelmann, Simon Wunderlich

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

commit 94cb82f594ed86be303398d6dfc7640a6f1d45d4 upstream.

The function batadv_softif_vlan_get is responsible for adding new
softif_vlan to the softif_vlan_list. It first checks whether the entry
already is in the list or not. If it is, then the creation of a new entry
is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: 5d2c05b21337 ("batman-adv: add per VLAN interface attribute framework")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16:
 - s/kref_get/atomic_inc/
 - s/_put/_free_ref/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -506,15 +506,20 @@ int batadv_softif_create_vlan(struct bat
 	struct batadv_softif_vlan *vlan;
 	int err;
 
+	spin_lock_bh(&bat_priv->softif_vlan_list_lock);
+
 	vlan = batadv_softif_vlan_get(bat_priv, vid);
 	if (vlan) {
 		batadv_softif_vlan_free_ref(vlan);
+		spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
 		return -EEXIST;
 	}
 
 	vlan = kzalloc(sizeof(*vlan), GFP_ATOMIC);
-	if (!vlan)
+	if (!vlan) {
+		spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
 		return -ENOMEM;
+	}
 
 	vlan->bat_priv = bat_priv;
 	vlan->vid = vid;
@@ -522,17 +527,23 @@ int batadv_softif_create_vlan(struct bat
 
 	atomic_set(&vlan->ap_isolation, 0);
 
+	atomic_inc(&vlan->refcount);
+	hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list);
+	spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
+
+	/* batadv_sysfs_add_vlan cannot be in the spinlock section due to the
+	 * sleeping behavior of the sysfs functions and the fs_reclaim lock
+	 */
 	err = batadv_sysfs_add_vlan(bat_priv->soft_iface, vlan);
 	if (err) {
-		kfree(vlan);
+		/* ref for the function */
+		batadv_softif_vlan_free_ref(vlan);
+
+		/* ref for the list */
+		batadv_softif_vlan_free_ref(vlan);
 		return err;
 	}
 
-	spin_lock_bh(&bat_priv->softif_vlan_list_lock);
-	atomic_inc(&vlan->refcount);
-	hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list);
-	spin_unlock_bh(&bat_priv->softif_vlan_list_lock);
-
 	/* add a new TT local entry. This one will be marked with the NOPURGE
 	 * flag
 	 */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 219/328] batman-adv: Prevent duplicated global TT entry
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (44 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 202/328] spi: rspi: Fix invalid SPI use during system suspend Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 274/328] sr9800: Check for supported Wake-on-LAN modes Ben Hutchings
                   ` (281 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Sven Eckelmann, Simon Wunderlich

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

commit e7136e48ffdfb9f37b0820f619380485eb407361 upstream.

The function batadv_tt_global_orig_entry_add is responsible for adding new
tt_orig_list_entry to the orig_list. It first checks whether the entry
already is in the list or not. If it is, then the creation of a new entry
is aborted.

But the lock for the list is only held when the list is really modified.
This could lead to duplicated entries because another context could create
an entry with the same key between the check and the list manipulation.

The check and the manipulation of the list must therefore be in the same
locked code section.

Fixes: d657e621a0f5 ("batman-adv: add reference counting for type batadv_tt_orig_list_entry")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/batman-adv/translation-table.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1287,6 +1287,8 @@ batadv_tt_global_orig_entry_add(struct b
 {
 	struct batadv_tt_orig_list_entry *orig_entry;
 
+	spin_lock_bh(&tt_global->list_lock);
+
 	orig_entry = batadv_tt_global_orig_entry_find(tt_global, orig_node);
 	if (orig_entry) {
 		/* refresh the ttvn: the current value could be a bogus one that
@@ -1309,10 +1311,8 @@ batadv_tt_global_orig_entry_add(struct b
 	orig_entry->flags = flags;
 	atomic_set(&orig_entry->refcount, 2);
 
-	spin_lock_bh(&tt_global->list_lock);
 	hlist_add_head_rcu(&orig_entry->list,
 			   &tt_global->orig_list);
-	spin_unlock_bh(&tt_global->list_lock);
 	atomic_inc(&tt_global->orig_list_count);
 
 sync_flags:
@@ -1320,6 +1320,8 @@ sync_flags:
 out:
 	if (orig_entry)
 		batadv_tt_orig_list_entry_free_ref(orig_entry);
+
+	spin_unlock_bh(&tt_global->list_lock);
 }
 
 /**


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 222/328] i2c: xiic: Make the start and the byte count write atomic
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (147 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 086/328] udl-kms: change down_interruptible to down Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 047/328] xen-netfront: fix queue name setting Ben Hutchings
                   ` (178 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Shubhrajyoti Datta, Wolfram Sang, Michal Simek

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

commit ae7304c3ea28a3ba47a7a8312c76c654ef24967e upstream.

Disable interrupts while configuring the transfer and enable them back.

We have below as the programming sequence
1. start and slave address
2. byte count and stop

In some customer platform there was a lot of interrupts between 1 and 2
and after slave address (around 7 clock cyles) if 2 is not executed
then the transaction is nacked.

To fix this case make the 2 writes atomic.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
[wsa: added a newline for better readability]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/i2c/busses/i2c-xiic.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -504,6 +504,7 @@ static void xiic_start_recv(struct xiic_
 {
 	u8 rx_watermark;
 	struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
+	unsigned long flags;
 
 	/* Clear and enable Rx full interrupt. */
 	xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK);
@@ -519,6 +520,7 @@ static void xiic_start_recv(struct xiic_
 		rx_watermark = IIC_RX_FIFO_DEPTH;
 	xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1);
 
+	local_irq_save(flags);
 	if (!(msg->flags & I2C_M_NOSTART))
 		/* write the address */
 		xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
@@ -529,6 +531,8 @@ static void xiic_start_recv(struct xiic_
 
 	xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
 		msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0));
+	local_irq_restore(flags);
+
 	if (i2c->nmsgs == 1)
 		/* very last, enable bus not busy as well */
 		xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 250/328] ip6_tunnel: be careful when accessing the inner header
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (268 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 072/328] fuse: flush requests on umount Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 018/328] alarmtimer: Prevent overflow for relative nanosleep Ben Hutchings
                   ` (57 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Alexander Potapenko, syzbot+3fde91d4d394747d6db4,
	Paolo Abeni, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Paolo Abeni <pabeni@redhat.com>

commit 76c0ddd8c3a683f6e2c6e60e11dc1a1558caf4bc upstream.

the ip6 tunnel xmit ndo assumes that the processed skb always
contains an ip[v6] header, but syzbot has found a way to send
frames that fall short of this assumption, leading to the following splat:

BUG: KMSAN: uninit-value in ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1307
[inline]
BUG: KMSAN: uninit-value in ip6_tnl_start_xmit+0x7d2/0x1ef0
net/ipv6/ip6_tunnel.c:1390
CPU: 0 PID: 4504 Comm: syz-executor558 Not tainted 4.16.0+ #87
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x185/0x1d0 lib/dump_stack.c:53
  kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067
  __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:683
  ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1307 [inline]
  ip6_tnl_start_xmit+0x7d2/0x1ef0 net/ipv6/ip6_tunnel.c:1390
  __netdev_start_xmit include/linux/netdevice.h:4066 [inline]
  netdev_start_xmit include/linux/netdevice.h:4075 [inline]
  xmit_one net/core/dev.c:3026 [inline]
  dev_hard_start_xmit+0x5f1/0xc70 net/core/dev.c:3042
  __dev_queue_xmit+0x27ee/0x3520 net/core/dev.c:3557
  dev_queue_xmit+0x4b/0x60 net/core/dev.c:3590
  packet_snd net/packet/af_packet.c:2944 [inline]
  packet_sendmsg+0x7c70/0x8a30 net/packet/af_packet.c:2969
  sock_sendmsg_nosec net/socket.c:630 [inline]
  sock_sendmsg net/socket.c:640 [inline]
  ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046
  __sys_sendmmsg+0x42d/0x800 net/socket.c:2136
  SYSC_sendmmsg+0xc4/0x110 net/socket.c:2167
  SyS_sendmmsg+0x63/0x90 net/socket.c:2162
  do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
RIP: 0033:0x441819
RSP: 002b:00007ffe58ee8268 EFLAGS: 00000213 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000441819
RDX: 0000000000000002 RSI: 0000000020000100 RDI: 0000000000000003
RBP: 00000000006cd018 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000213 R12: 0000000000402510
R13: 00000000004025a0 R14: 0000000000000000 R15: 0000000000000000

Uninit was created at:
  kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
  kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188
  kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314
  kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321
  slab_post_alloc_hook mm/slab.h:445 [inline]
  slab_alloc_node mm/slub.c:2737 [inline]
  __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369
  __kmalloc_reserve net/core/skbuff.c:138 [inline]
  __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206
  alloc_skb include/linux/skbuff.h:984 [inline]
  alloc_skb_with_frags+0x1d4/0xb20 net/core/skbuff.c:5234
  sock_alloc_send_pskb+0xb56/0x1190 net/core/sock.c:2085
  packet_alloc_skb net/packet/af_packet.c:2803 [inline]
  packet_snd net/packet/af_packet.c:2894 [inline]
  packet_sendmsg+0x6454/0x8a30 net/packet/af_packet.c:2969
  sock_sendmsg_nosec net/socket.c:630 [inline]
  sock_sendmsg net/socket.c:640 [inline]
  ___sys_sendmsg+0xec0/0x1310 net/socket.c:2046
  __sys_sendmmsg+0x42d/0x800 net/socket.c:2136
  SYSC_sendmmsg+0xc4/0x110 net/socket.c:2167
  SyS_sendmmsg+0x63/0x90 net/socket.c:2162
  do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
  entry_SYSCALL_64_after_hwframe+0x3d/0xa2

This change addresses the issue adding the needed check before
accessing the inner header.

The ipv4 side of the issue is apparently there since the ipv4 over ipv6
initial support, and the ipv6 side predates git history.

Fixes: c4d3efafcc93 ("[IPV6] IP6TUNNEL: Add support to IPv4 over IPv6 tunnel.")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: syzbot+3fde91d4d394747d6db4@syzkaller.appspotmail.com
Tested-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ipv6/ip6_tunnel.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1085,13 +1085,18 @@ static inline int
 ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct ip6_tnl *t = netdev_priv(dev);
-	const struct iphdr  *iph = ip_hdr(skb);
+	const struct iphdr  *iph;
 	int encap_limit = -1;
 	struct flowi6 fl6;
 	__u8 dsfield;
 	__u32 mtu;
 	int err;
 
+	/* ensure we can access the full inner ip header */
+	if (!pskb_may_pull(skb, sizeof(struct iphdr)))
+		return -1;
+
+	iph = ip_hdr(skb);
 	if ((t->parms.proto != IPPROTO_IPIP && t->parms.proto != 0) ||
 	    !ip6_tnl_xmit_ctl(t))
 		return -1;
@@ -1126,7 +1131,7 @@ static inline int
 ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct ip6_tnl *t = netdev_priv(dev);
-	struct ipv6hdr *ipv6h = ipv6_hdr(skb);
+	struct ipv6hdr *ipv6h;
 	int encap_limit = -1;
 	__u16 offset;
 	struct flowi6 fl6;
@@ -1134,6 +1139,10 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, str
 	__u32 mtu;
 	int err;
 
+	if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
+		return -1;
+
+	ipv6h = ipv6_hdr(skb);
 	if ((t->parms.proto != IPPROTO_IPV6 && t->parms.proto != 0) ||
 	    !ip6_tnl_xmit_ctl(t) || ip6_tnl_addr_conflict(t, ipv6h))
 		return -1;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 216/328] x86/process: Don't mix user/kernel regs in 64bit __show_regs()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (172 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 176/328] x86/microcode/intel: Add a helper which gives the microcode revision Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 314/328] RDMA/ucma: Fix Spectre v1 vulnerability Ben Hutchings
                   ` (153 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jann Horn, Andy Lutomirski, H. Peter Anvin,
	Thomas Gleixner, Greg Kroah-Hartman, Borislav Petkov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jann Horn <jannh@google.com>

commit 9fe6299dde587788f245e9f7a5a1b296fad4e8c7 upstream.

When the kernel.print-fatal-signals sysctl has been enabled, a simple
userspace crash will cause the kernel to write a crash dump that contains,
among other things, the kernel gsbase into dmesg.

As suggested by Andy, limit output to pt_regs, FS_BASE and KERNEL_GS_BASE
in this case.

This also moves the bitness-specific logic from show_regs() into
process_{32,64}.c.

Fixes: 45807a1df9f5 ("vdso: print fatal signals")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lkml.kernel.org/r/20180831194151.123586-1-jannh@google.com
[bwh: Backported to 3.16:
 - Keep using user_mode_vm() to in 32-bit show_regs()
 - Also update call to __show_regs() in kmemcheck
 - Don't add redundant rdmsrl()s in 64-bit __show_regs()
 - Adjust filenames, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/x86/include/asm/kdebug.h
+++ b/arch/x86/include/asm/kdebug.h
@@ -21,12 +21,22 @@ enum die_val {
 	DIE_NMIUNKNOWN,
 };
 
+enum show_regs_mode {
+	SHOW_REGS_SHORT,
+	/*
+	 * For when userspace crashed, but we don't think it's our fault, and
+	 * therefore don't print kernel registers.
+	 */
+	SHOW_REGS_USER,
+	SHOW_REGS_ALL
+};
+
 extern void printk_address(unsigned long address);
 extern void die(const char *, struct pt_regs *,long);
 extern int __must_check __die(const char *, struct pt_regs *, long);
 extern void show_trace(struct task_struct *t, struct pt_regs *regs,
 		       unsigned long *sp, unsigned long bp);
-extern void __show_regs(struct pt_regs *regs, int all);
+extern void __show_regs(struct pt_regs *regs, enum show_regs_mode);
 extern unsigned long oops_begin(void);
 extern void oops_end(unsigned long, struct pt_regs *, int signr);
 #ifdef CONFIG_KEXEC
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -123,7 +123,7 @@ void show_regs(struct pt_regs *regs)
 	int i;
 
 	show_regs_print_info(KERN_EMERG);
-	__show_regs(regs, !user_mode_vm(regs));
+	__show_regs(regs, user_mode_vm(regs) ? SHOW_REGS_USER : SHOW_REGS_ALL);
 
 	/*
 	 * When in-kernel, we also print out the stack and code at the
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -301,7 +301,7 @@ void show_regs(struct pt_regs *regs)
 
 	sp = regs->sp;
 	show_regs_print_info(KERN_DEFAULT);
-	__show_regs(regs, 1);
+	__show_regs(regs, user_mode(regs) ? SHOW_REGS_USER : SHOW_REGS_ALL);
 
 	/*
 	 * When in-kernel, we also print out the stack and code at the
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -66,7 +66,7 @@ unsigned long thread_saved_pc(struct tas
 	return ((unsigned long *)tsk->thread.sp)[3];
 }
 
-void __show_regs(struct pt_regs *regs, int all)
+void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
 {
 	unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
 	unsigned long d0, d1, d2, d3, d6, d7;
@@ -95,7 +95,7 @@ void __show_regs(struct pt_regs *regs, i
 	printk(KERN_DEFAULT " DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
 	       (u16)regs->ds, (u16)regs->es, (u16)regs->fs, gs, ss);
 
-	if (!all)
+	if (mode != SHOW_REGS_ALL)
 		return;
 
 	cr0 = read_cr0();
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -56,7 +56,7 @@ asmlinkage extern void ret_from_fork(voi
 __visible DEFINE_PER_CPU_USER_MAPPED(unsigned long, old_rsp);
 
 /* Prints also some state that isn't saved in the pt_regs */
-void __show_regs(struct pt_regs *regs, int all)
+void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
 {
 	unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
 	unsigned long d0, d1, d2, d3, d6, d7;
@@ -88,9 +88,15 @@ void __show_regs(struct pt_regs *regs, i
 	rdmsrl(MSR_GS_BASE, gs);
 	rdmsrl(MSR_KERNEL_GS_BASE, shadowgs);
 
-	if (!all)
+	if (mode == SHOW_REGS_SHORT)
 		return;
 
+	if (mode == SHOW_REGS_USER) {
+		printk(KERN_DEFAULT "FS:  %016lx GS:  %016lx\n",
+		       fs, shadowgs);
+		return;
+	}
+
 	cr0 = read_cr0();
 	cr2 = read_cr2();
 	cr3 = read_cr3();
--- a/arch/x86/mm/kmemcheck/error.c
+++ b/arch/x86/mm/kmemcheck/error.c
@@ -132,7 +132,7 @@ void kmemcheck_error_recall(void)
 		break;
 	}
 
-	__show_regs(&e->regs, 1);
+	__show_regs(&e->regs, SHOW_REGS_ALL);
 	print_stack_trace(&e->trace, 0);
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 221/328] dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion deadlock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (284 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 214/328] batman-adv: Use kref_get for batadv_nc_get_nc_node Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 211/328] hwmon: (nct6775) Set weight source to zero correctly Ben Hutchings
                   ` (41 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mike Snitzer, Mikulas Patocka

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 432061b3da64e488be3403124a72a9250bbe96d4 upstream.

There's a XFS on dm-crypt deadlock, recursing back to itself due to the
crypto subsystems use of GFP_KERNEL, reported here:
https://bugzilla.kernel.org/show_bug.cgi?id=200835

* dm-crypt calls crypt_convert in xts mode
* init_crypt from xts.c calls kmalloc(GFP_KERNEL)
* kmalloc(GFP_KERNEL) recurses into the XFS filesystem, the filesystem
	tries to submit some bios and wait for them, causing a deadlock

Fix this by updating both the DM crypt and integrity targets to no
longer use the CRYPTO_TFM_REQ_MAY_SLEEP flag, which will change the
crypto allocations from GFP_KERNEL to GFP_ATOMIC, therefore they can't
recurse into a filesystem.  A GFP_ATOMIC allocation can fail, but
init_crypt() in xts.c handles the allocation failure gracefully - it
will fall back to preallocated buffer if the allocation fails.

The crypto API maintainer says that the crypto API only needs to
allocate memory when dealing with unaligned buffers and therefore
turning CRYPTO_TFM_REQ_MAY_SLEEP off is safe (see this discussion:
https://www.redhat.com/archives/dm-devel/2018-August/msg00195.html )

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
[bwh: Backported to 3.16:
 - Drop change to crypt_alloc_req_aead() in dm-crypt
 - Drop changes to dm-integrity
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -262,7 +262,7 @@ static int crypt_iv_essiv_init(struct cr
 
 	sg_init_one(&sg, cc->key, cc->key_size);
 	desc.tfm = essiv->hash_tfm;
-	desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+	desc.flags = 0;
 
 	err = crypto_hash_digest(&desc, &sg, cc->key_size, essiv->salt);
 	if (err)
@@ -533,7 +533,7 @@ static int crypt_iv_lmk_one(struct crypt
 	int i, r;
 
 	sdesc.desc.tfm = lmk->hash_tfm;
-	sdesc.desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+	sdesc.desc.flags = 0;
 
 	r = crypto_shash_init(&sdesc.desc);
 	if (r)
@@ -690,7 +690,7 @@ static int crypt_iv_tcw_whitening(struct
 
 	/* calculate crc32 for every 32bit part and xor it */
 	sdesc.desc.tfm = tcw->crc32_tfm;
-	sdesc.desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+	sdesc.desc.flags = 0;
 	for (i = 0; i < 4; i++) {
 		r = crypto_shash_init(&sdesc.desc);
 		if (r)
@@ -891,7 +891,7 @@ static void crypt_alloc_req(struct crypt
 
 	ablkcipher_request_set_tfm(ctx->req, cc->tfms[key_index]);
 	ablkcipher_request_set_callback(ctx->req,
-	    CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
+	    CRYPTO_TFM_REQ_MAY_BACKLOG,
 	    kcryptd_async_done, dmreq_of_req(cc, ctx->req));
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 223/328] RDMA/cma: Protect cma dev list with lock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (94 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 194/328] iw_cxgb4: only allow 1 flush on user qps Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 296/328] ARC: clone syscall to setp r25 as thread pointer Ben Hutchings
                   ` (231 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Leon Romanovsky, Dennis Dalessandro, Daniel Jurgens,
	Jason Gunthorpe, Parav Pandit

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Parav Pandit <parav@mellanox.com>

commit 954a8e3aea87e896e320cf648c1a5bbe47de443e upstream.

When AF_IB addresses are used during rdma_resolve_addr() a lock is not
held. A cma device can get removed while list traversal is in progress
which may lead to crash. ie

        CPU0                                     CPU1
        ====                                     ====
rdma_resolve_addr()
 cma_resolve_ib_dev()
  list_for_each()                         cma_remove_one()
    cur_dev->device                        mutex_lock(&lock)
                                            list_del();
                                           mutex_unlock(&lock);
                                           cma_process_remove();


Therefore, hold a lock while traversing the list which avoids such
situation.

Fixes: f17df3b0dede ("RDMA/cma: Add support for AF_IB to rdma_resolve_addr()")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/core/cma.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -434,6 +434,7 @@ static int cma_resolve_ib_dev(struct rdm
 	dgid = (union ib_gid *) &addr->sib_addr;
 	pkey = ntohs(addr->sib_pkey);
 
+	mutex_lock(&lock);
 	list_for_each_entry(cur_dev, &dev_list, list) {
 		if (rdma_node_get_transport(cur_dev->device->node_type) != RDMA_TRANSPORT_IB)
 			continue;
@@ -455,18 +456,19 @@ static int cma_resolve_ib_dev(struct rdm
 					cma_dev = cur_dev;
 					sgid = gid;
 					id_priv->id.port_num = p;
+					goto found;
 				}
 			}
 		}
 	}
-
-	if (!cma_dev)
-		return -ENODEV;
+	mutex_unlock(&lock);
+	return -ENODEV;
 
 found:
 	cma_attach_to_dev(id_priv, cma_dev);
-	addr = (struct sockaddr_ib *) cma_src_addr(id_priv);
-	memcpy(&addr->sib_addr, &sgid, sizeof sgid);
+	mutex_unlock(&lock);
+	addr = (struct sockaddr_ib *)cma_src_addr(id_priv);
+	memcpy(&addr->sib_addr, &sgid, sizeof(sgid));
 	cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr);
 	return 0;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 234/328] Tools: hv: Fix a bug in the key delete code
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (59 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 210/328] IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 316/328] ptp: fix Spectre v1 vulnerability Ben Hutchings
                   ` (266 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, David Binderman, Greg Kroah-Hartman, Michael Kelley,
	K. Y. Srinivasan

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "K. Y. Srinivasan" <kys@microsoft.com>

commit 86503bd35dec0ce363e9fdbf5299927422ed3899 upstream.

Fix a bug in the key delete code - the num_records range
from 0 to num_records-1.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reported-by: David Binderman <dcb314@hotmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 tools/hv/hv_kvp_daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -289,7 +289,7 @@ static int kvp_key_delete(int pool, cons
 		 * Found a match; just move the remaining
 		 * entries up.
 		 */
-		if (i == num_records) {
+		if (i == (num_records - 1)) {
 			kvp_file_info[pool].num_records--;
 			kvp_update_file(pool);
 			return 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 099/328] crypto: blkcipher - fix crash flushing dcache in error path
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (52 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 120/328] scsi: aic94xx: fix an error code in aic94xx_init() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 001/328] EDAC: Fix memleak in module init " Ben Hutchings
                   ` (273 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Eric Biggers, Liu Chao, Herbert Xu

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Biggers <ebiggers@google.com>

commit 0868def3e4100591e7a1fdbf3eed1439cc8f7ca3 upstream.

Like the skcipher_walk case:

scatterwalk_done() is only meant to be called after a nonzero number of
bytes have been processed, since scatterwalk_pagedone() will flush the
dcache of the *previous* page.  But in the error case of
blkcipher_walk_done(), e.g. if the input wasn't an integer number of
blocks, scatterwalk_done() was actually called after advancing 0 bytes.
This caused a crash ("BUG: unable to handle kernel paging request")
during '!PageSlab(page)' on architectures like arm and arm64 that define
ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE, provided that the input was
page-aligned as in that case walk->offset == 0.

Fix it by reorganizing blkcipher_walk_done() to skip the
scatterwalk_advance() and scatterwalk_done() if an error has occurred.

This bug was found by syzkaller fuzzing.

Reproducer, assuming ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE:

	#include <linux/if_alg.h>
	#include <sys/socket.h>
	#include <unistd.h>

	int main()
	{
		struct sockaddr_alg addr = {
			.salg_type = "skcipher",
			.salg_name = "ecb(aes-generic)",
		};
		char buffer[4096] __attribute__((aligned(4096))) = { 0 };
		int fd;

		fd = socket(AF_ALG, SOCK_SEQPACKET, 0);
		bind(fd, (void *)&addr, sizeof(addr));
		setsockopt(fd, SOL_ALG, ALG_SET_KEY, buffer, 16);
		fd = accept(fd, NULL, NULL);
		write(fd, buffer, 15);
		read(fd, buffer, 15);
	}

Reported-by: Liu Chao <liuchao741@huawei.com>
Fixes: 5cde0af2a982 ("[CRYPTO] cipher: Added block cipher type")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 crypto/blkcipher.c | 54 ++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 28 deletions(-)

--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -70,19 +70,18 @@ static inline u8 *blkcipher_get_spot(u8
 	return max(start, end_page);
 }
 
-static inline unsigned int blkcipher_done_slow(struct blkcipher_walk *walk,
-					       unsigned int bsize)
+static inline void blkcipher_done_slow(struct blkcipher_walk *walk,
+				       unsigned int bsize)
 {
 	u8 *addr;
 
 	addr = (u8 *)ALIGN((unsigned long)walk->buffer, walk->alignmask + 1);
 	addr = blkcipher_get_spot(addr, bsize);
 	scatterwalk_copychunks(addr, &walk->out, bsize, 1);
-	return bsize;
 }
 
-static inline unsigned int blkcipher_done_fast(struct blkcipher_walk *walk,
-					       unsigned int n)
+static inline void blkcipher_done_fast(struct blkcipher_walk *walk,
+				       unsigned int n)
 {
 	if (walk->flags & BLKCIPHER_WALK_COPY) {
 		blkcipher_map_dst(walk);
@@ -96,49 +95,48 @@ static inline unsigned int blkcipher_don
 
 	scatterwalk_advance(&walk->in, n);
 	scatterwalk_advance(&walk->out, n);
-
-	return n;
 }
 
 int blkcipher_walk_done(struct blkcipher_desc *desc,
 			struct blkcipher_walk *walk, int err)
 {
-	unsigned int nbytes = 0;
+	unsigned int n; /* bytes processed */
+	bool more;
 
-	if (likely(err >= 0)) {
-		unsigned int n = walk->nbytes - err;
+	if (unlikely(err < 0))
+		goto finish;
 
-		if (likely(!(walk->flags & BLKCIPHER_WALK_SLOW)))
-			n = blkcipher_done_fast(walk, n);
-		else if (WARN_ON(err)) {
+	n = walk->nbytes - err;
+	walk->total -= n;
+	more = (walk->total != 0);
+
+	if (likely(!(walk->flags & BLKCIPHER_WALK_SLOW))) {
+		blkcipher_done_fast(walk, n);
+	} else {
+		if (WARN_ON(err)) {
+			/* unexpected case; didn't process all bytes */
 			err = -EINVAL;
-			goto err;
-		} else
-			n = blkcipher_done_slow(walk, n);
-
-		nbytes = walk->total - n;
-		err = 0;
+			goto finish;
+		}
+		blkcipher_done_slow(walk, n);
 	}
 
-	scatterwalk_done(&walk->in, 0, nbytes);
-	scatterwalk_done(&walk->out, 1, nbytes);
-
-err:
-	walk->total = nbytes;
-	walk->nbytes = nbytes;
+	scatterwalk_done(&walk->in, 0, more);
+	scatterwalk_done(&walk->out, 1, more);
 
-	if (nbytes) {
+	if (more) {
 		crypto_yield(desc->flags);
 		return blkcipher_walk_next(desc, walk);
 	}
-
+	err = 0;
+finish:
+	walk->nbytes = 0;
 	if (walk->iv != desc->info)
 		memcpy(desc->info, walk->iv, walk->ivsize);
 	if (walk->buffer != walk->page)
 		kfree(walk->buffer);
 	if (walk->page)
 		free_page((unsigned long)walk->page);
-
 	return err;
 }
 EXPORT_SYMBOL_GPL(blkcipher_walk_done);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 251/328] USB: usbdevfs: sanitize flags more
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (250 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 166/328] USB: serial: io_ti: fix array underflow in completion handler Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 157/328] getxattr: use correct xattr length Ben Hutchings
                   ` (75 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Greg Kroah-Hartman, Oliver Neukum, syzbot+843efa30c8821bd69f53

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Oliver Neukum <oneukum@suse.com>

commit 7a68d9fb851012829c29e770621905529bd9490b upstream.

Requesting a ZERO_PACKET or not is sensible only for output.
In the input direction the device decides.
Likewise accepting short packets makes sense only for input.

This allows operation with panic_on_warn without opening up
a local DOS.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reported-by: syzbot+843efa30c8821bd69f53@syzkaller.appspotmail.com
Fixes: 0cb54a3e47cb ("USB: debugging code shouldn't alter control flow")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/devio.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1291,10 +1291,13 @@ static int proc_do_submiturb(struct usb_
 	struct async *as = NULL;
 	struct usb_ctrlrequest *dr = NULL;
 	unsigned int u, totlen, isofrmlen;
-	int i, ret, is_in, num_sgs = 0, ifnum = -1;
+	int i, ret, num_sgs = 0, ifnum = -1;
 	int number_of_packets = 0;
 	unsigned int stream_id = 0;
 	void *buf;
+	bool is_in;
+	bool allow_short = false;
+	bool allow_zero = false;
 	unsigned long mask =	USBDEVFS_URB_SHORT_NOT_OK |
 				USBDEVFS_URB_BULK_CONTINUATION |
 				USBDEVFS_URB_NO_FSBR |
@@ -1326,6 +1329,8 @@ static int proc_do_submiturb(struct usb_
 	u = 0;
 	switch(uurb->type) {
 	case USBDEVFS_URB_TYPE_CONTROL:
+		if (is_in)
+			allow_short = true;
 		if (!usb_endpoint_xfer_control(&ep->desc))
 			return -EINVAL;
 		/* min 8 byte setup packet */
@@ -1366,6 +1371,10 @@ static int proc_do_submiturb(struct usb_
 		break;
 
 	case USBDEVFS_URB_TYPE_BULK:
+		if (!is_in)
+			allow_zero = true;
+		else
+			allow_short = true;
 		switch (usb_endpoint_type(&ep->desc)) {
 		case USB_ENDPOINT_XFER_CONTROL:
 		case USB_ENDPOINT_XFER_ISOC:
@@ -1386,6 +1395,10 @@ static int proc_do_submiturb(struct usb_
 		if (!usb_endpoint_xfer_int(&ep->desc))
 			return -EINVAL;
  interrupt_urb:
+		if (!is_in)
+			allow_zero = true;
+		else
+			allow_short = true;
 		break;
 
 	case USBDEVFS_URB_TYPE_ISO:
@@ -1515,11 +1528,11 @@ static int proc_do_submiturb(struct usb_
 	u = (is_in ? URB_DIR_IN : URB_DIR_OUT);
 	if (uurb->flags & USBDEVFS_URB_ISO_ASAP)
 		u |= URB_ISO_ASAP;
-	if (uurb->flags & USBDEVFS_URB_SHORT_NOT_OK && is_in)
+	if (allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
 		u |= URB_SHORT_NOT_OK;
 	if (uurb->flags & USBDEVFS_URB_NO_FSBR)
 		u |= URB_NO_FSBR;
-	if (uurb->flags & USBDEVFS_URB_ZERO_PACKET)
+	if (allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
 		u |= URB_ZERO_PACKET;
 	if (uurb->flags & USBDEVFS_URB_NO_INTERRUPT)
 		u |= URB_NO_INTERRUPT;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 252/328] USB: usbdevfs: restore warning for nonsensical flags
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (240 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 015/328] crypto: vmac - require a block cipher with 128-bit block size Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 156/328] apparmor: remove no-op permission check in policy_unpack Ben Hutchings
                   ` (85 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Oliver Neukum, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Oliver Neukum <oneukum@suse.com>

commit 81e0403b26d94360abd1f6a57311337973bc82cd upstream.

If we filter flags before they reach the core we need to generate our
own warnings.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Fixes: 0cb54a3e47cb ("USB: debugging code shouldn't alter control flow")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/devio.c | 5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1538,6 +1538,11 @@ static int proc_do_submiturb(struct usb_
 		u |= URB_NO_INTERRUPT;
 	as->urb->transfer_flags = u;
 
+	if (!allow_short && uurb->flags & USBDEVFS_URB_SHORT_NOT_OK)
+		dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_SHORT_NOT_OK.\n");
+	if (!allow_zero && uurb->flags & USBDEVFS_URB_ZERO_PACKET)
+		dev_warn(&ps->dev->dev, "Requested nonsensical USBDEVFS_URB_ZERO_PACKET.\n");
+
 	as->urb->transfer_buffer_length = uurb->buffer_length;
 	as->urb->setup_packet = (unsigned char *)dr;
 	dr = NULL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 098/328] xfrm: Validate address prefix lengths in the xfrm selector.
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (120 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 298/328] ipv6: take rcu lock in rawv6_send_hdrinc() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 094/328] IB/IPoIB: Set ah valid flag in multicast send flow Ben Hutchings
                   ` (205 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Steffen Klassert, Air Icy

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steffen Klassert <steffen.klassert@secunet.com>

commit 07bf7908950a8b14e81aa1807e3c667eab39287a upstream.

We don't validate the address prefix lengths in the xfrm
selector we got from userspace. This can lead to undefined
behaviour in the address matching functions if the prefix
is too big for the given address family. Fix this by checking
the prefixes and refuse SA/policy insertation when a prefix
is invalid.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Air Icy <icytxw@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/xfrm/xfrm_user.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -150,10 +150,16 @@ static int verify_newsa_info(struct xfrm
 	err = -EINVAL;
 	switch (p->family) {
 	case AF_INET:
+		if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
+			goto out;
+
 		break;
 
 	case AF_INET6:
 #if IS_ENABLED(CONFIG_IPV6)
+		if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
+			goto out;
+
 		break;
 #else
 		err = -EAFNOSUPPORT;
@@ -1227,10 +1233,16 @@ static int verify_newpolicy_info(struct
 
 	switch (p->sel.family) {
 	case AF_INET:
+		if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
+			return -EINVAL;
+
 		break;
 
 	case AF_INET6:
 #if IS_ENABLED(CONFIG_IPV6)
+		if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128)
+			return -EINVAL;
+
 		break;
 #else
 		return  -EAFNOSUPPORT;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 260/328] ocfs2: fix ocfs2 read block panic
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (225 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 048/328] ALSA: memalloc: Don't exceed over the requested size Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 070/328] ALSA: cs5535audio: Fix invalid endian conversion Ben Hutchings
                   ` (100 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Joel Becker, Changwei Ge, Junxiao Bi, Joseph Qi,
	Mark Fasheh, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Junxiao Bi <junxiao.bi@oracle.com>

commit 234b69e3e089d850a98e7b3145bd00e9b52b1111 upstream.

While reading block, it is possible that io error return due to underlying
storage issue, in this case, BH_NeedsValidate was left in the buffer head.
Then when reading the very block next time, if it was already linked into
journal, that will trigger the following panic.

[203748.702517] kernel BUG at fs/ocfs2/buffer_head_io.c:342!
[203748.702533] invalid opcode: 0000 [#1] SMP
[203748.702561] Modules linked in: ocfs2 ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue configfs sunrpc dm_switch dm_queue_length dm_multipath bonding be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i iw_cxgb4 cxgb4 cxgb3i libcxgbi iw_cxgb3 cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr ipv6 iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi ipmi_devintf iTCO_wdt iTCO_vendor_support dcdbas ipmi_ssif i2c_core ipmi_si ipmi_msghandler acpi_pad pcspkr sb_edac edac_core lpc_ich mfd_core shpchp sg tg3 ptp pps_core ext4 jbd2 mbcache2 sr_mod cdrom sd_mod ahci libahci megaraid_sas wmi dm_mirror dm_region_hash dm_log dm_mod
[203748.703024] CPU: 7 PID: 38369 Comm: touch Not tainted 4.1.12-124.18.6.el6uek.x86_64 #2
[203748.703045] Hardware name: Dell Inc. PowerEdge R620/0PXXHP, BIOS 2.5.2 01/28/2015
[203748.703067] task: ffff880768139c00 ti: ffff88006ff48000 task.ti: ffff88006ff48000
[203748.703088] RIP: 0010:[<ffffffffa05e9f09>]  [<ffffffffa05e9f09>] ocfs2_read_blocks+0x669/0x7f0 [ocfs2]
[203748.703130] RSP: 0018:ffff88006ff4b818  EFLAGS: 00010206
[203748.703389] RAX: 0000000008620029 RBX: ffff88006ff4b910 RCX: 0000000000000000
[203748.703885] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 00000000023079fe
[203748.704382] RBP: ffff88006ff4b8d8 R08: 0000000000000000 R09: ffff8807578c25b0
[203748.704877] R10: 000000000f637376 R11: 000000003030322e R12: 0000000000000000
[203748.705373] R13: ffff88006ff4b910 R14: ffff880732fe38f0 R15: 0000000000000000
[203748.705871] FS:  00007f401992c700(0000) GS:ffff880bfebc0000(0000) knlGS:0000000000000000
[203748.706370] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[203748.706627] CR2: 00007f4019252440 CR3: 00000000a621e000 CR4: 0000000000060670
[203748.707124] Stack:
[203748.707371]  ffff88006ff4b828 ffffffffa0609f52 ffff88006ff4b838 0000000000000001
[203748.707885]  0000000000000000 0000000000000000 ffff880bf67c3800 ffffffffa05eca00
[203748.708399]  00000000023079ff ffffffff81c58b80 0000000000000000 0000000000000000
[203748.708915] Call Trace:
[203748.709175]  [<ffffffffa0609f52>] ? ocfs2_inode_cache_io_unlock+0x12/0x20 [ocfs2]
[203748.709680]  [<ffffffffa05eca00>] ? ocfs2_empty_dir_filldir+0x80/0x80 [ocfs2]
[203748.710185]  [<ffffffffa05ec0cb>] ocfs2_read_dir_block_direct+0x3b/0x200 [ocfs2]
[203748.710691]  [<ffffffffa05f0fbf>] ocfs2_prepare_dx_dir_for_insert.isra.57+0x19f/0xf60 [ocfs2]
[203748.711204]  [<ffffffffa065660f>] ? ocfs2_metadata_cache_io_unlock+0x1f/0x30 [ocfs2]
[203748.711716]  [<ffffffffa05f4f3a>] ocfs2_prepare_dir_for_insert+0x13a/0x890 [ocfs2]
[203748.712227]  [<ffffffffa05f442e>] ? ocfs2_check_dir_for_entry+0x8e/0x140 [ocfs2]
[203748.712737]  [<ffffffffa061b2f2>] ocfs2_mknod+0x4b2/0x1370 [ocfs2]
[203748.713003]  [<ffffffffa061c385>] ocfs2_create+0x65/0x170 [ocfs2]
[203748.713263]  [<ffffffff8121714b>] vfs_create+0xdb/0x150
[203748.713518]  [<ffffffff8121b225>] do_last+0x815/0x1210
[203748.713772]  [<ffffffff812192e9>] ? path_init+0xb9/0x450
[203748.714123]  [<ffffffff8121bca0>] path_openat+0x80/0x600
[203748.714378]  [<ffffffff811bcd45>] ? handle_pte_fault+0xd15/0x1620
[203748.714634]  [<ffffffff8121d7ba>] do_filp_open+0x3a/0xb0
[203748.714888]  [<ffffffff8122a767>] ? __alloc_fd+0xa7/0x130
[203748.715143]  [<ffffffff81209ffc>] do_sys_open+0x12c/0x220
[203748.715403]  [<ffffffff81026ddb>] ? syscall_trace_enter_phase1+0x11b/0x180
[203748.715668]  [<ffffffff816f0c9f>] ? system_call_after_swapgs+0xe9/0x190
[203748.715928]  [<ffffffff8120a10e>] SyS_open+0x1e/0x20
[203748.716184]  [<ffffffff816f0d5e>] system_call_fastpath+0x18/0xd7
[203748.716440] Code: 00 00 48 8b 7b 08 48 83 c3 10 45 89 f8 44 89 e1 44 89 f2 4c 89 ee e8 07 06 11 e1 48 8b 03 48 85 c0 75 df 8b 5d c8 e9 4d fa ff ff <0f> 0b 48 8b 7d a0 e8 dc c6 06 00 48 b8 00 00 00 00 00 00 00 10
[203748.717505] RIP  [<ffffffffa05e9f09>] ocfs2_read_blocks+0x669/0x7f0 [ocfs2]
[203748.717775]  RSP <ffff88006ff4b818>

Joesph ever reported a similar panic.
Link: https://oss.oracle.com/pipermail/ocfs2-devel/2013-May/008931.html

Link: http://lkml.kernel.org/r/20180912063207.29484-1-junxiao.bi@oracle.com
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ocfs2/buffer_head_io.c | 1 +
 1 file changed, 1 insertion(+)

--- a/fs/ocfs2/buffer_head_io.c
+++ b/fs/ocfs2/buffer_head_io.c
@@ -330,6 +330,7 @@ int ocfs2_read_blocks(struct ocfs2_cachi
 				 * for this bh as it's not marked locally
 				 * uptodate. */
 				status = -EIO;
+				clear_buffer_needs_validate(bh);
 				put_bh(bh);
 				bhs[i] = NULL;
 				continue;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 253/328] USB: leave LPM alone if possible when binding/unbinding interface drivers
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (66 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 091/328] tracing: Do not call start/stop() functions when tracing_on does not change Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 034/328] pwm: tiehrpwm: Fix disabling of output of PWMs Ben Hutchings
                   ` (259 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Greg Kroah-Hartman, Alan Stern, Mathias Nyman, Matthew Giassa

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit 6fb650d43da3e7054984dc548eaa88765a94d49f upstream.

When a USB driver is bound to an interface (either through probing or
by claiming it) or is unbound from an interface, the USB core always
disables Link Power Management during the transition and then
re-enables it afterward.  The reason is because the driver might want
to prevent hub-initiated link power transitions, in which case the HCD
would have to recalculate the various LPM parameters.  This
recalculation takes place when LPM is re-enabled and the new
parameters are sent to the device and its parent hub.

However, if the driver does not want to prevent hub-initiated link
power transitions then none of this work is necessary.  The parameters
don't need to be recalculated, and LPM doesn't need to be disabled and
re-enabled.

It turns out that disabling and enabling LPM can be time-consuming,
enough so that it interferes with user programs that want to claim and
release interfaces rapidly via usbfs.  Since the usbfs kernel driver
doesn't set the disable_hub_initiated_lpm flag, we can speed things up
and get the user programs to work by leaving LPM alone whenever the
flag isn't set.

And while we're improving the way disable_hub_initiated_lpm gets used,
let's also fix its kerneldoc.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Matthew Giassa <matthew@giassa.net>
CC: Mathias Nyman <mathias.nyman@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/driver.c | 40 ++++++++++++++++++++++-----------------
 include/linux/usb.h       |  2 +-
 2 files changed, 24 insertions(+), 18 deletions(-)

--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -298,7 +298,7 @@ static int usb_probe_interface(struct de
 	struct usb_device *udev = interface_to_usbdev(intf);
 	const struct usb_device_id *id;
 	int error = -ENODEV;
-	int lpm_disable_error;
+	int lpm_disable_error = -ENODEV;
 
 	dev_dbg(dev, "%s\n", __func__);
 
@@ -346,12 +346,14 @@ static int usb_probe_interface(struct de
 	 * setting during probe, that should also be fine.  usb_set_interface()
 	 * will attempt to disable LPM, and fail if it can't disable it.
 	 */
-	lpm_disable_error = usb_unlocked_disable_lpm(udev);
-	if (lpm_disable_error && driver->disable_hub_initiated_lpm) {
-		dev_err(&intf->dev, "%s Failed to disable LPM for driver %s\n.",
-				__func__, driver->name);
-		error = lpm_disable_error;
-		goto err;
+	if (driver->disable_hub_initiated_lpm) {
+		lpm_disable_error = usb_unlocked_disable_lpm(udev);
+		if (lpm_disable_error) {
+			dev_err(&intf->dev, "%s Failed to disable LPM for driver %s\n.",
+					__func__, driver->name);
+			error = lpm_disable_error;
+			goto err;
+		}
 	}
 
 	/* Carry out a deferred switch to altsetting 0 */
@@ -402,7 +404,8 @@ static int usb_unbind_interface(struct d
 	struct usb_interface *intf = to_usb_interface(dev);
 	struct usb_host_endpoint *ep, **eps = NULL;
 	struct usb_device *udev;
-	int i, j, error, r, lpm_disable_error;
+	int i, j, error, r;
+	int lpm_disable_error = -ENODEV;
 
 	intf->condition = USB_INTERFACE_UNBINDING;
 
@@ -410,12 +413,13 @@ static int usb_unbind_interface(struct d
 	udev = interface_to_usbdev(intf);
 	error = usb_autoresume_device(udev);
 
-	/* Hub-initiated LPM policy may change, so attempt to disable LPM until
+	/* If hub-initiated LPM policy may change, attempt to disable LPM until
 	 * the driver is unbound.  If LPM isn't disabled, that's fine because it
 	 * wouldn't be enabled unless all the bound interfaces supported
 	 * hub-initiated LPM.
 	 */
-	lpm_disable_error = usb_unlocked_disable_lpm(udev);
+	if (driver->disable_hub_initiated_lpm)
+		lpm_disable_error = usb_unlocked_disable_lpm(udev);
 
 	/* Terminate all URBs for this interface unless the driver
 	 * supports "soft" unbinding.
@@ -518,7 +522,7 @@ int usb_driver_claim_interface(struct us
 	struct device *dev;
 	struct usb_device *udev;
 	int retval = 0;
-	int lpm_disable_error;
+	int lpm_disable_error = -ENODEV;
 
 	if (!iface)
 		return -ENODEV;
@@ -535,12 +539,14 @@ int usb_driver_claim_interface(struct us
 
 	iface->condition = USB_INTERFACE_BOUND;
 
-	/* Disable LPM until this driver is bound. */
-	lpm_disable_error = usb_unlocked_disable_lpm(udev);
-	if (lpm_disable_error && driver->disable_hub_initiated_lpm) {
-		dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.",
-				__func__, driver->name);
-		return -ENOMEM;
+	/* See the comment about disabling LPM in usb_probe_interface(). */
+	if (driver->disable_hub_initiated_lpm) {
+		lpm_disable_error = usb_unlocked_disable_lpm(udev);
+		if (lpm_disable_error) {
+			dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.",
+					__func__, driver->name);
+			return -ENOMEM;
+		}
 	}
 
 	/* Claimed interfaces are initially inactive (suspended) and
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1065,7 +1065,7 @@ struct usbdrv_wrap {
  *	for interfaces bound to this driver.
  * @soft_unbind: if set to 1, the USB core will not kill URBs and disable
  *	endpoints before calling the driver's disconnect method.
- * @disable_hub_initiated_lpm: if set to 0, the USB core will not allow hubs
+ * @disable_hub_initiated_lpm: if set to 1, the USB core will not allow hubs
  *	to initiate lower power link state transitions when an idle timeout
  *	occurs.  Device-initiated USB 3.0 link PM will still be allowed.
  *


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 268/328] bcache: do not assign in if condition in bcache_init()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (57 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 293/328] PM / core: Clear the direct_complete flag on errors Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 210/328] IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler Ben Hutchings
                   ` (268 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Florian Schmaus, Coly Li, Jens Axboe

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Schmaus <flo@geekplace.eu>

commit 16c1fdf4cfd6c0091e59b93ec2cb7e99973f8244 upstream.

Fixes an error condition reported by checkpatch.pl which is caused by
assigning a variable in an if condition.

Signed-off-by: Florian Schmaus <flo@geekplace.eu>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/bcache/super.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2138,9 +2138,15 @@ static int __init bcache_init(void)
 		return bcache_major;
 	}
 
-	if (!(bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) ||
-	    !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
-	    bch_request_init() ||
+	bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0);
+	if (!bcache_wq)
+		goto err;
+
+	bcache_kobj = kobject_create_and_add("bcache", fs_kobj);
+	if (!bcache_kobj)
+		goto err;
+
+	if (bch_request_init() ||
 	    bch_debug_init(bcache_kobj) ||
 	    sysfs_create_files(bcache_kobj, files))
 		goto err;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 262/328] USB: serial: simple: add Motorola Tetra MTP6550 id
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (279 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 123/328] powerpc: Fix size calculation using resource_size() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 218/328] batman-adv: Prevent duplicated softif_vlan entry Ben Hutchings
                   ` (46 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Johan Hovold, Hans Hult

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit f5fad711c06e652f90f581fc7c2caee327c33d31 upstream.

Add device-id for the Motorola Tetra radio MTP6550.

Bus 001 Device 004: ID 0cad:9012 Motorola CGISS
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0cad Motorola CGISS
  idProduct          0x9012
  bcdDevice           24.16
  iManufacturer           1 Motorola Solutions, Inc.
  iProduct                2 TETRA PEI interface
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           55
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          3 Generic Serial config
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

Reported-by: Hans Hult <hanshult35@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/serial/usb-serial-simple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/usb-serial-simple.c
+++ b/drivers/usb/serial/usb-serial-simple.c
@@ -87,7 +87,8 @@ DEVICE(moto_modem, MOTO_IDS);
 
 /* Motorola Tetra driver */
 #define MOTOROLA_TETRA_IDS()			\
-	{ USB_DEVICE(0x0cad, 0x9011) }	/* Motorola Solutions TETRA PEI */
+	{ USB_DEVICE(0x0cad, 0x9011) },	/* Motorola Solutions TETRA PEI */ \
+	{ USB_DEVICE(0x0cad, 0x9012) }	/* MTP6550 */
 DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
 
 /* Novatel Wireless GPS driver */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 258/328] ubifs: Check for name being NULL while mounting
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (5 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 089/328] ath10k: prevent active scans on potential unusable channels Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 118/328] PCI: mvebu: Fix I/O space end address calculation Ben Hutchings
                   ` (320 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, syzbot+38bd0f7865e5c6379280, Richard Weinberger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Weinberger <richard@nod.at>

commit 37f31b6ca4311b94d985fb398a72e5399ad57925 upstream.

The requested device name can be NULL or an empty string.
Check for that and refuse to continue. UBIFS has to do this manually
since we cannot use mount_bdev(), which checks for this condition.

Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
Reported-by: syzbot+38bd0f7865e5c6379280@syzkaller.appspotmail.com
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ubifs/super.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1917,6 +1917,9 @@ static struct ubi_volume_desc *open_ubi(
 	int dev, vol;
 	char *endptr;
 
+	if (!name || !*name)
+		return ERR_PTR(-EINVAL);
+
 	/* First, try to open using the device node path method */
 	ubi = ubi_open_volume_path(name, mode);
 	if (!IS_ERR(ubi))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 264/328] fbdev/omapfb: fix omapfb_memory_read infoleak
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (49 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 318/328] r8169: fix NAPI handling under high load Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 027/328] vxlan: fix a potential issue when create a new vxlan fdb entry Ben Hutchings
                   ` (276 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jann Horn, Tony Lindgren, security, Will Deacon,
	Bartlomiej Zolnierkiewicz, Tomi Valkeinen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Tomi Valkeinen <tomi.valkeinen@ti.com>

commit 1bafcbf59fed92af58955024452f45430d3898c5 upstream.

OMAPFB_MEMORY_READ ioctl reads pixels from the LCD's memory and copies
them to a userspace buffer. The code has two issues:

- The user provided width and height could be large enough to overflow
  the calculations
- The copy_to_user() can copy uninitialized memory to the userspace,
  which might contain sensitive kernel information.

Fix these by limiting the width & height parameters, and only copying
the amount of data that we actually received from the LCD.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reported-by: Jann Horn <jannh@google.com>
Cc: security@kernel.org
Cc: Will Deacon <will.deacon@arm.com>
Cc: Jann Horn <jannh@google.com>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
@@ -493,6 +493,9 @@ static int omapfb_memory_read(struct fb_
 	if (!access_ok(VERIFY_WRITE, mr->buffer, mr->buffer_size))
 		return -EFAULT;
 
+	if (mr->w > 4096 || mr->h > 4096)
+		return -EINVAL;
+
 	if (mr->w * mr->h * 3 > mr->buffer_size)
 		return -EINVAL;
 
@@ -506,7 +509,7 @@ static int omapfb_memory_read(struct fb_
 			mr->x, mr->y, mr->w, mr->h);
 
 	if (r > 0) {
-		if (copy_to_user(mr->buffer, buf, mr->buffer_size))
+		if (copy_to_user(mr->buffer, buf, r))
 			r = -EFAULT;
 	}
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 256/328] USB: handle NULL config in usb_find_alt_setting()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (196 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 272/328] asix: Check for supported Wake-on-LAN modes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 198/328] USB: Add quirk to support DJI CineSSD Ben Hutchings
                   ` (129 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Greg Kroah-Hartman, Alan Stern, syzbot+19c3aaef85a89d451eac

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit c9a4cb204e9eb7fa7dfbe3f7d3a674fa530aa193 upstream.

usb_find_alt_setting() takes a pointer to a struct usb_host_config as
an argument; it searches for an interface with specified interface and
alternate setting numbers in that config.  However, it crashes if the
usb_host_config pointer argument is NULL.

Since this is a general-purpose routine, available for use in many
places, we want to to be more robust.  This patch makes it return NULL
whenever the config argument is NULL.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: syzbot+19c3aaef85a89d451eac@syzkaller.appspotmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/usb.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -79,6 +79,8 @@ struct usb_host_interface *usb_find_alt_
 	struct usb_interface_cache *intf_cache = NULL;
 	int i;
 
+	if (!config)
+		return NULL;
 	for (i = 0; i < config->desc.bNumInterfaces; i++) {
 		if (config->intf_cache[i]->altsetting[0].desc.bInterfaceNumber
 				== iface_num) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 089/328] ath10k: prevent active scans on potential unusable channels
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (4 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 326/328] mremap: properly flush TLB before releasing the page Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 258/328] ubifs: Check for name being NULL while mounting Ben Hutchings
                   ` (321 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Sven Eckelmann, Kalle Valo

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven.eckelmann@openmesh.com>

commit 3f259111583801013cb605bb4414aa529adccf1c upstream.

The QCA4019 hw1.0 firmware 10.4-3.2.1-00050 and 10.4-3.5.3-00053 (and most
likely all other) seem to ignore the WMI_CHAN_FLAG_DFS flag during the
scan. This results in transmission (probe requests) on channels which are
not "available" for transmissions.

Since the firmware is closed source and nothing can be done from our side
to fix the problem in it, the driver has to work around this problem. The
WMI_CHAN_FLAG_PASSIVE seems to be interpreted by the firmware to not
scan actively on a channel unless an AP was detected on it. Simple probe
requests will then be transmitted by the STA on the channel.

ath10k must therefore also use this flag when it queues a radar channel for
scanning. This should reduce the chance of an active scan when the channel
might be "unusable" for transmissions.

Fixes: e8a50f8ba44b ("ath10k: introduce DFS implementation")
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/wireless/ath/ath10k/mac.c | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1724,6 +1724,13 @@ static int ath10k_update_channel_list(st
 			passive = channel->flags & IEEE80211_CHAN_NO_IR;
 			ch->passive = passive;
 
+			/* the firmware is ignoring the "radar" flag of the
+			 * channel and is scanning actively using Probe Requests
+			 * on "Radar detection"/DFS channels which are not
+			 * marked as "available"
+			 */
+			ch->passive |= ch->chan_radar;
+
 			ch->freq = channel->center_freq;
 			ch->min_power = 0;
 			ch->max_power = channel->max_power * 2;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 261/328] powerpc/pseries: Fix unitialized timer reset on migration
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (140 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 267/328] bcache: explicitly destroy mutex while exiting Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 105/328] mac802154: tx: cleanup crc calculation Ben Hutchings
                   ` (185 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Michael Bringmann, Michael Ellerman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Bringmann <mwb@linux.vnet.ibm.com>

commit 8604895a34d92f5e186ceb931b0d1b384030ea3d upstream.

After migration of a powerpc LPAR, the kernel executes code to
update the system state to reflect new platform characteristics.

Such changes include modifications to device tree properties provided
to the system by PHYP. Property notifications received by the
post_mobility_fixup() code are passed along to the kernel in general
through a call to of_update_property() which in turn passes such
events back to all modules through entries like the '.notifier_call'
function within the NUMA module.

When the NUMA module updates its state, it resets its event timer. If
this occurs after a previous call to stop_topology_update() or on a
system without VPHN enabled, the code runs into an unitialized timer
structure and crashes. This patch adds a safety check along this path
toward the problem code.

An example crash log is as follows.

  ibmvscsi 30000081: Re-enabling adapter!
  ------------[ cut here ]------------
  kernel BUG at kernel/time/timer.c:958!
  Oops: Exception in kernel mode, sig: 5 [#1]
  LE SMP NR_CPUS=2048 NUMA pSeries
  Modules linked in: nfsv3 nfs_acl nfs tcp_diag udp_diag inet_diag lockd unix_diag af_packet_diag netlink_diag grace fscache sunrpc xts vmx_crypto pseries_rng sg binfmt_misc ip_tables xfs libcrc32c sd_mod ibmvscsi ibmveth scsi_transport_srp dm_mirror dm_region_hash dm_log dm_mod
  CPU: 11 PID: 3067 Comm: drmgr Not tainted 4.17.0+ #179
  ...
  NIP mod_timer+0x4c/0x400
  LR  reset_topology_timer+0x40/0x60
  Call Trace:
    0xc0000003f9407830 (unreliable)
    reset_topology_timer+0x40/0x60
    dt_update_callback+0x100/0x120
    notifier_call_chain+0x90/0x100
    __blocking_notifier_call_chain+0x60/0x90
    of_property_notify+0x90/0xd0
    of_update_property+0x104/0x150
    update_dt_property+0xdc/0x1f0
    pseries_devicetree_update+0x2d0/0x510
    post_mobility_fixup+0x7c/0xf0
    migration_store+0xa4/0xc0
    kobj_attr_store+0x30/0x60
    sysfs_kf_write+0x64/0xa0
    kernfs_fop_write+0x16c/0x240
    __vfs_write+0x40/0x200
    vfs_write+0xc8/0x240
    ksys_write+0x5c/0x100
    system_call+0x58/0x6c

Fixes: 5d88aa85c00b ("powerpc/pseries: Update CPU maps when device tree is updated")
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
[bwh: Backported to 3.16: Also remove direct assignment to
 topology_timer.expires, done upstream as part of commit df7e828c1b69
 "timer: Remove init_timer_deferrable() in favor of timer_setup()"]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/mm/numa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1654,8 +1654,8 @@ static struct timer_list topology_timer
 static void reset_topology_timer(void)
 {
 	topology_timer.data = 0;
-	topology_timer.expires = jiffies + 60 * HZ;
-	mod_timer(&topology_timer, topology_timer.expires);
+	if (vphn_enabled)
+		mod_timer(&topology_timer, jiffies + 60 * HZ);
 }
 
 #ifdef CONFIG_SMP


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 257/328] regulator: fix crash caused by null driver data
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (276 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 315/328] usb: gadget: storage: Fix Spectre v1 vulnerability Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 129/328] net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree() Ben Hutchings
                   ` (49 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Yu Zhao, Mark Brown

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Yu Zhao <yuzhao@google.com>

commit fb6de923ca3358a91525552b4907d4cb38730bdd upstream.

dev_set_drvdata() needs to be called before device_register()
exposes device to userspace. Otherwise kernel crashes after it
gets null pointer from dev_get_drvdata() when userspace tries
to access sysfs entries.

[Removed backtrace for length -- broonie]

Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3470,14 +3470,13 @@ regulator_register(const struct regulato
 	rdev->dev.parent = dev;
 	dev_set_name(&rdev->dev, "regulator.%d",
 		     atomic_inc_return(&regulator_no) - 1);
+	dev_set_drvdata(&rdev->dev, rdev);
 	ret = device_register(&rdev->dev);
 	if (ret != 0) {
 		put_device(&rdev->dev);
 		goto clean;
 	}
 
-	dev_set_drvdata(&rdev->dev, rdev);
-
 	if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) {
 		ret = regulator_ena_gpio_request(rdev, config);
 		if (ret != 0) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 254/328] USB: remove LPM management from usb_driver_claim_interface()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (157 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 122/328] b43legacy/leds: Ensure NUL-termination of LED name string Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 064/328] udlfb: set line_length in dlfb_ops_set_par Ben Hutchings
                   ` (168 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Alan Stern, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit c183813fcee44a249339b7c46e1ad271ca1870aa upstream.

usb_driver_claim_interface() disables and re-enables Link Power
Management, but it shouldn't do either one, for the reasons listed
below.  This patch removes the two LPM-related function calls from the
routine.

The reason for disabling LPM in the analogous function
usb_probe_interface() is so that drivers won't have to deal with
unwanted LPM transitions in their probe routine.  But
usb_driver_claim_interface() doesn't call the driver's probe routine
(or any other callbacks), so that reason doesn't apply here.

Furthermore, no driver other than usbfs will ever call
usb_driver_claim_interface() unless it is already bound to another
interface in the same device, which means disabling LPM here would be
redundant.  usbfs doesn't interact with LPM at all.

Lastly, the error return from usb_unlocked_disable_lpm() isn't handled
properly; the code doesn't clean up its earlier actions before
returning.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: 8306095fd2c1 ("USB: Disable USB 3.0 LPM in critical sections.")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/driver.c | 15 ---------------
 1 file changed, 15 deletions(-)

--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -522,7 +522,6 @@ int usb_driver_claim_interface(struct us
 	struct device *dev;
 	struct usb_device *udev;
 	int retval = 0;
-	int lpm_disable_error = -ENODEV;
 
 	if (!iface)
 		return -ENODEV;
@@ -539,16 +538,6 @@ int usb_driver_claim_interface(struct us
 
 	iface->condition = USB_INTERFACE_BOUND;
 
-	/* See the comment about disabling LPM in usb_probe_interface(). */
-	if (driver->disable_hub_initiated_lpm) {
-		lpm_disable_error = usb_unlocked_disable_lpm(udev);
-		if (lpm_disable_error) {
-			dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.",
-					__func__, driver->name);
-			return -ENOMEM;
-		}
-	}
-
 	/* Claimed interfaces are initially inactive (suspended) and
 	 * runtime-PM-enabled, but only if the driver has autosuspend
 	 * support.  Otherwise they are marked active, to prevent the
@@ -567,10 +556,6 @@ int usb_driver_claim_interface(struct us
 	if (device_is_registered(dev))
 		retval = device_bind_driver(dev);
 
-	/* Attempt to re-enable USB3 LPM, if the disable was successful. */
-	if (!lpm_disable_error)
-		usb_unlocked_enable_lpm(udev);
-
 	return retval;
 }
 EXPORT_SYMBOL_GPL(usb_driver_claim_interface);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 263/328] ip_tunnel: be careful when accessing the inner header
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (130 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 136/328] xtensa: limit offsets in __loop_cache_{all,page} Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 110/328] Btrfs: fix btrfs_write_inode vs delayed iput deadlock Ben Hutchings
                   ` (195 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Cong Wang, Paolo Abeni, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Paolo Abeni <pabeni@redhat.com>

commit ccfec9e5cb2d48df5a955b7bf47f7782157d3bc2 upstream.

Cong noted that we need the same checks introduced by commit 76c0ddd8c3a6
("ip6_tunnel: be careful when accessing the inner header")
even for ipv4 tunnels.

Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
Suggested-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ipv4/ip_tunnel.c | 9 +++++++++
 1 file changed, 9 insertions(+)

--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -551,6 +551,7 @@ void ip_tunnel_xmit(struct sk_buff *skb,
 		    const struct iphdr *tnl_params, const u8 protocol)
 {
 	struct ip_tunnel *tunnel = netdev_priv(dev);
+	unsigned int inner_nhdr_len = 0;
 	const struct iphdr *inner_iph;
 	struct flowi4 fl4;
 	u8     tos, ttl;
@@ -561,6 +562,14 @@ void ip_tunnel_xmit(struct sk_buff *skb,
 	int err;
 	bool connected;
 
+	/* ensure we can access the inner net header, for several users below */
+	if (skb->protocol == htons(ETH_P_IP))
+		inner_nhdr_len = sizeof(struct iphdr);
+	else if (skb->protocol == htons(ETH_P_IPV6))
+		inner_nhdr_len = sizeof(struct ipv6hdr);
+	if (unlikely(!pskb_may_pull(skb, inner_nhdr_len)))
+		goto tx_error;
+
 	inner_iph = (const struct iphdr *)skb_inner_network_header(skb);
 	connected = (tunnel->parms.iph.daddr != 0);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 265/328] bcache: don't embed 'return' statements in closure macros
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (84 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 139/328] ubifs: Fix memory leak in lprobs self-check Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 168/328] USB: serial: ti_usb_3410_5052: fix array underflow in completion handler Ben Hutchings
                   ` (241 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jens Axboe, Christoph Hellwig

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jens Axboe <axboe@fb.com>

commit 77b5a08427e87514c33730afc18cd02c9475e2c3 upstream.

This is horribly confusing, it breaks the flow of the code without
it being apparent in the caller.

Signed-off-by: Jens Axboe <axboe@fb.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/bcache/closure.h |  3 ---
 drivers/md/bcache/io.c      |  1 +
 drivers/md/bcache/journal.c |  2 ++
 drivers/md/bcache/request.c | 14 +++++++++++---
 4 files changed, 14 insertions(+), 6 deletions(-)

--- a/drivers/md/bcache/closure.h
+++ b/drivers/md/bcache/closure.h
@@ -320,7 +320,6 @@ static inline void closure_wake_up(struc
 do {									\
 	set_closure_fn(_cl, _fn, _wq);					\
 	closure_sub(_cl, CLOSURE_RUNNING + 1);				\
-	return;								\
 } while (0)
 
 /**
@@ -349,7 +348,6 @@ do {									\
 do {									\
 	set_closure_fn(_cl, _fn, _wq);					\
 	closure_queue(_cl);						\
-	return;								\
 } while (0)
 
 /**
@@ -365,7 +363,6 @@ do {									\
 do {									\
 	set_closure_fn(_cl, _destructor, NULL);				\
 	closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1);	\
-	return;								\
 } while (0)
 
 /**
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -105,6 +105,7 @@ void bch_generic_make_request(struct bio
 	} while (n != bio);
 
 	continue_at(&s->cl, bch_bio_submit_split_done, NULL);
+	return;
 submit:
 	generic_make_request(bio);
 }
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -586,12 +586,14 @@ static void journal_write_unlocked(struc
 
 	if (!w->need_write) {
 		closure_return_with_destructor(cl, journal_write_unlock);
+		return;
 	} else if (journal_full(&c->journal)) {
 		journal_reclaim(c);
 		spin_unlock(&c->journal.lock);
 
 		btree_flush_write(c);
 		continue_at(cl, journal_write, system_wq);
+		return;
 	}
 
 	c->journal.blocks_free -= set_blocks(w->data, block_bytes(c));
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -87,8 +87,10 @@ static void bch_data_insert_keys(struct
 	if (journal_ref)
 		atomic_dec_bug(journal_ref);
 
-	if (!op->insert_data_done)
+	if (!op->insert_data_done) {
 		continue_at(cl, bch_data_insert_start, op->wq);
+		return;
+	}
 
 	bch_keylist_free(&op->insert_keys);
 	closure_return(cl);
@@ -215,8 +217,10 @@ static void bch_data_insert_start(struct
 		/* 1 for the device pointer and 1 for the chksum */
 		if (bch_keylist_realloc(&op->insert_keys,
 					3 + (op->csum ? 1 : 0),
-					op->c))
+					op->c)) {
 			continue_at(cl, bch_data_insert_keys, op->wq);
+			return;
+		}
 
 		k = op->insert_keys.top;
 		bkey_init(k);
@@ -254,6 +258,7 @@ static void bch_data_insert_start(struct
 
 	op->insert_data_done = true;
 	continue_at(cl, bch_data_insert_keys, op->wq);
+	return;
 err:
 	/* bch_alloc_sectors() blocks if s->writeback = true */
 	BUG_ON(op->writeback);
@@ -568,8 +573,10 @@ static void cache_lookup(struct closure
 	ret = bch_btree_map_keys(&s->op, s->iop.c,
 				 &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0),
 				 cache_lookup_fn, MAP_END_KEY);
-	if (ret == -EAGAIN)
+	if (ret == -EAGAIN) {
 		continue_at(cl, cache_lookup, bcache_wq);
+		return;
+	}
 
 	closure_return(cl);
 }
@@ -1095,6 +1102,7 @@ static void flash_dev_make_request(struc
 		continue_at_nobarrier(&s->cl,
 				      flash_dev_nodata,
 				      bcache_wq);
+		return;
 	} else if (rw) {
 		bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys,
 					&KEY(d->id, bio->bi_iter.bi_sector, 0),


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 255/328] USB: fix error handling in usb_driver_claim_interface()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (98 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 317/328] cachefiles: fix the race between cachefiles_bury_object() and rmdir(2) Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 040/328] tty: fix termios input-speed encoding when using BOTHER Ben Hutchings
                   ` (227 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Greg Kroah-Hartman, Alan Stern, syzbot+f84aa7209ccec829536f

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit bd729f9d67aa9a303d8925bb8c4f06af25f407d1 upstream.

The syzbot fuzzing project found a use-after-free bug in the USB
core.  The bug was caused by usbfs not unbinding from an interface
when the USB device file was closed, which led another process to
attempt the unbind later on, after the private data structure had been
deallocated.

The reason usbfs did not unbind the interface at the appropriate time
was because it thought the interface had never been claimed in the
first place.  This was caused by the fact that
usb_driver_claim_interface() does not clean up properly when
device_bind_driver() returns an error.  Although the error code gets
passed back to the caller, the iface->dev.driver pointer remains set
and iface->condition remains equal to USB_INTERFACE_BOUND.

This patch adds proper error handling to usb_driver_claim_interface().

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: syzbot+f84aa7209ccec829536f@syzkaller.appspotmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/driver.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -556,6 +556,21 @@ int usb_driver_claim_interface(struct us
 	if (device_is_registered(dev))
 		retval = device_bind_driver(dev);
 
+	if (retval) {
+		dev->driver = NULL;
+		usb_set_intfdata(iface, NULL);
+		iface->needs_remote_wakeup = 0;
+		iface->condition = USB_INTERFACE_UNBOUND;
+
+		/*
+		 * Unbound interfaces are always runtime-PM-disabled
+		 * and runtime-PM-suspended
+		 */
+		if (driver->supports_autosuspend)
+			pm_runtime_disable(dev);
+		pm_runtime_set_suspended(dev);
+	}
+
 	return retval;
 }
 EXPORT_SYMBOL_GPL(usb_driver_claim_interface);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 267/328] bcache: explicitly destroy mutex while exiting
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (139 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 030/328] vmci: type promotion bug in qp_host_get_user_memory() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 261/328] powerpc/pseries: Fix unitialized timer reset on migration Ben Hutchings
                   ` (186 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Michael Lyle, Eric Wheeler, Jens Axboe, Coly Li, Liang Chen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Liang Chen <liangchen.linux@gmail.com>

commit 330a4db89d39a6b43f36da16824eaa7a7509d34d upstream.

mutex_destroy does nothing most of time, but it's better to call
it to make the code future proof and it also has some meaning
for like mutex debug.

As Coly pointed out in a previous review, bcache_exit() may not be
able to handle all the references properly if userspace registers
cache and backing devices right before bch_debug_init runs and
bch_debug_init failes later. So not exposing userspace interface
until everything is ready to avoid that issue.

Signed-off-by: Liang Chen <liangchen.linux@gmail.com>
Reviewed-by: Michael Lyle <mlyle@lyle.org>
Reviewed-by: Coly Li <colyli@suse.de>
Reviewed-by: Eric Wheeler <bcache@linux.ewheeler.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/bcache/super.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2115,6 +2115,7 @@ static void bcache_exit(void)
 	if (bcache_major)
 		unregister_blkdev(bcache_major, "bcache");
 	unregister_reboot_notifier(&reboot);
+	mutex_destroy(&bch_register_lock);
 }
 
 static int __init bcache_init(void)
@@ -2133,14 +2134,15 @@ static int __init bcache_init(void)
 	bcache_major = register_blkdev(0, "bcache");
 	if (bcache_major < 0) {
 		unregister_reboot_notifier(&reboot);
+		mutex_destroy(&bch_register_lock);
 		return bcache_major;
 	}
 
 	if (!(bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) ||
 	    !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
-	    sysfs_create_files(bcache_kobj, files) ||
 	    bch_request_init() ||
-	    bch_debug_init(bcache_kobj))
+	    bch_debug_init(bcache_kobj) ||
+	    sysfs_create_files(bcache_kobj, files))
 		goto err;
 
 	return 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 270/328] PCI: Reprogram bridge prefetch registers on resume
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (201 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 232/328] x86/boot: Move EISA setup to a separate file Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 281/328] pstore/ram: Fix failure-path memory leak in ramoops_init Ben Hutchings
                   ` (124 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Peter Wu, Bjorn Helgaas, Rafael J. Wysocki, Daniel Drake

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Drake <drake@endlessm.com>

commit 083874549fdfefa629dfa752785e20427dde1511 upstream.

On 38+ Intel-based ASUS products, the NVIDIA GPU becomes unusable after S3
suspend/resume.  The affected products include multiple generations of
NVIDIA GPUs and Intel SoCs.  After resume, nouveau logs many errors such
as:

  fifo: fault 00 [READ] at 0000005555555000 engine 00 [GR] client 04
        [HUB/FE] reason 4a [] on channel -1 [007fa91000 unknown]
  DRM: failed to idle channel 0 [DRM]

Similarly, the NVIDIA proprietary driver also fails after resume (black
screen, 100% CPU usage in Xorg process).  We shipped a sample to NVIDIA for
diagnosis, and their response indicated that it's a problem with the parent
PCI bridge (on the Intel SoC), not the GPU.

Runtime suspend/resume works fine, only S3 suspend is affected.

We found a workaround: on resume, rewrite the Intel PCI bridge
'Prefetchable Base Upper 32 Bits' register (PCI_PREF_BASE_UPPER32).  In the
cases that I checked, this register has value 0 and we just have to rewrite
that value.

Linux already saves and restores PCI config space during suspend/resume,
but this register was being skipped because upon resume, it already has
value 0 (the correct, pre-suspend value).

Intel appear to have previously acknowledged this behaviour and the
requirement to rewrite this register:
https://bugzilla.kernel.org/show_bug.cgi?id=116851#c23

Based on that, rewrite the prefetch register values even when that appears
unnecessary.

We have confirmed this solution on all the affected models we have in-hands
(X542UQ, UX533FD, X530UN, V272UN).

Additionally, this solves an issue where r8169 MSI-X interrupts were broken
after S3 suspend/resume on ASUS X441UAR.  This issue was recently worked
around in commit 7bb05b85bc2d ("r8169: don't use MSI-X on RTL8106e").  It
also fixes the same issue on RTL6186evl/8111evl on an Aimfor-tech laptop
that we had not yet patched.  I suspect it will also fix the issue that was
worked around in commit 7c53a722459c ("r8169: don't use MSI-X on
RTL8168g").

Thomas Martitz reports that this change also solves an issue where the AMD
Radeon Polaris 10 GPU on the HP Zbook 14u G5 is unresponsive after S3
suspend/resume.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=201069
Signed-off-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-By: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pci/pci.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1014,12 +1014,12 @@ int pci_save_state(struct pci_dev *dev)
 EXPORT_SYMBOL(pci_save_state);
 
 static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
-				     u32 saved_val, int retry)
+				     u32 saved_val, int retry, bool force)
 {
 	u32 val;
 
 	pci_read_config_dword(pdev, offset, &val);
-	if (val == saved_val)
+	if (!force && val == saved_val)
 		return;
 
 	for (;;) {
@@ -1038,25 +1038,36 @@ static void pci_restore_config_dword(str
 }
 
 static void pci_restore_config_space_range(struct pci_dev *pdev,
-					   int start, int end, int retry)
+					   int start, int end, int retry,
+					   bool force)
 {
 	int index;
 
 	for (index = end; index >= start; index--)
 		pci_restore_config_dword(pdev, 4 * index,
 					 pdev->saved_config_space[index],
-					 retry);
+					 retry, force);
 }
 
 static void pci_restore_config_space(struct pci_dev *pdev)
 {
 	if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
-		pci_restore_config_space_range(pdev, 10, 15, 0);
+		pci_restore_config_space_range(pdev, 10, 15, 0, false);
 		/* Restore BARs before the command register. */
-		pci_restore_config_space_range(pdev, 4, 9, 10);
-		pci_restore_config_space_range(pdev, 0, 3, 0);
+		pci_restore_config_space_range(pdev, 4, 9, 10, false);
+		pci_restore_config_space_range(pdev, 0, 3, 0, false);
+	} else if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
+		pci_restore_config_space_range(pdev, 12, 15, 0, false);
+
+		/*
+		 * Force rewriting of prefetch registers to avoid S3 resume
+		 * issues on Intel PCI bridges that occur when these
+		 * registers are not explicitly written.
+		 */
+		pci_restore_config_space_range(pdev, 9, 11, 0, true);
+		pci_restore_config_space_range(pdev, 0, 8, 0, false);
 	} else {
-		pci_restore_config_space_range(pdev, 0, 15, 0);
+		pci_restore_config_space_range(pdev, 0, 15, 0, false);
 	}
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 269/328] bcache: add separate workqueue for journal_write to avoid deadlock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (318 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 305/328] usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 174/328] cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE Ben Hutchings
                   ` (7 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Coly Li, Guoju Fang, Jens Axboe

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Guoju Fang <fangguoju@gmail.com>

commit 0f843e65d9eef4936929bb036c5f771fb261eea4 upstream.

After write SSD completed, bcache schedules journal_write work to
system_wq, which is a public workqueue in system, without WQ_MEM_RECLAIM
flag. system_wq is also a bound wq, and there may be no idle kworker on
current processor. Creating a new kworker may unfortunately need to
reclaim memory first, by shrinking cache and slab used by vfs, which
depends on bcache device. That's a deadlock.

This patch create a new workqueue for journal_write with WQ_MEM_RECLAIM
flag. It's rescuer thread will work to avoid the deadlock.

Signed-off-by: Guoju Fang <fangguoju@gmail.com>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/bcache/bcache.h  | 1 +
 drivers/md/bcache/journal.c | 6 +++---
 drivers/md/bcache/super.c   | 8 ++++++++
 3 files changed, 12 insertions(+), 3 deletions(-)

--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -898,6 +898,7 @@ void bch_prio_write(struct cache *);
 void bch_write_bdev_super(struct cached_dev *, struct closure *);
 
 extern struct workqueue_struct *bcache_wq;
+extern struct workqueue_struct *bch_journal_wq;
 extern const char * const bch_cache_modes[];
 extern struct mutex bch_register_lock;
 extern struct list_head bch_cache_sets;
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -454,7 +454,7 @@ static void do_journal_discard(struct ca
 
 		closure_get(&ca->set->cl);
 		INIT_WORK(&ja->discard_work, journal_discard_work);
-		schedule_work(&ja->discard_work);
+		queue_work(bch_journal_wq, &ja->discard_work);
 	}
 }
 
@@ -559,7 +559,7 @@ static void journal_write_done(struct cl
 		: &j->w[0];
 
 	__closure_wake_up(&w->wait);
-	continue_at_nobarrier(cl, journal_write, system_wq);
+	continue_at_nobarrier(cl, journal_write, bch_journal_wq);
 }
 
 static void journal_write_unlock(struct closure *cl)
@@ -592,7 +592,7 @@ static void journal_write_unlocked(struc
 		spin_unlock(&c->journal.lock);
 
 		btree_flush_write(c);
-		continue_at(cl, journal_write, system_wq);
+		continue_at(cl, journal_write, bch_journal_wq);
 		return;
 	}
 
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -56,6 +56,7 @@ static int bcache_major;
 static DEFINE_IDA(bcache_minor);
 static wait_queue_head_t unregister_wait;
 struct workqueue_struct *bcache_wq;
+struct workqueue_struct *bch_journal_wq;
 
 #define BTREE_MAX_PAGES		(256 * 1024 / PAGE_SIZE)
 
@@ -2112,6 +2113,9 @@ static void bcache_exit(void)
 		kobject_put(bcache_kobj);
 	if (bcache_wq)
 		destroy_workqueue(bcache_wq);
+	if (bch_journal_wq)
+		destroy_workqueue(bch_journal_wq);
+
 	if (bcache_major)
 		unregister_blkdev(bcache_major, "bcache");
 	unregister_reboot_notifier(&reboot);
@@ -2142,6 +2146,10 @@ static int __init bcache_init(void)
 	if (!bcache_wq)
 		goto err;
 
+	bch_journal_wq = alloc_workqueue("bch_journal", WQ_MEM_RECLAIM, 0);
+	if (!bch_journal_wq)
+		goto err;
+
 	bcache_kobj = kobject_create_and_add("bcache", fs_kobj);
 	if (!bcache_kobj)
 		goto err;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 282/328] mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (24 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 183/328] smb3: check for and properly advertise directory lease support Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 041/328] s390/kvm: fix deadlock when killed by oom Ben Hutchings
                   ` (301 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Johannes Berg, Felix Fietkau

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Felix Fietkau <nbd@nbd.name>

commit 211710ca74adf790b46ab3867fcce8047b573cd1 upstream.

key->sta is only valid after ieee80211_key_link, which is called later
in this function. Because of that, the IEEE80211_KEY_FLAG_RX_MGMT is
never set when management frame protection is enabled.

Fixes: e548c49e6dc6b ("mac80211: add key flag for management keys")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/mac80211/cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -209,7 +209,7 @@ static int ieee80211_add_key(struct wiph
 	case NL80211_IFTYPE_AP:
 	case NL80211_IFTYPE_AP_VLAN:
 		/* Keys without a station are used for TX only */
-		if (key->sta && test_sta_flag(key->sta, WLAN_STA_MFP))
+		if (sta && test_sta_flag(sta, WLAN_STA_MFP))
 			key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
 		break;
 	case NL80211_IFTYPE_ADHOC:


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 090/328] ext4: check for NUL characters in extended attribute's name
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (64 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 155/328] reiserfs: fix broken xattr handling (heap corruption, bad retval) Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 091/328] tracing: Do not call start/stop() functions when tracing_on does not change Ben Hutchings
                   ` (261 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Wen Xu, Theodore Ts'o

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit 7d95178c77014dbd8dce36ee40bbbc5e6c121ff5 upstream.

Extended attribute names are defined to be NUL-terminated, so the name
must not contain a NUL character.  This is important because there are
places when remove extended attribute, the code uses strlen to
determine the length of the entry.  That should probably be fixed at
some point, but code is currently really messy, so the simplest fix
for now is to simply validate that the extended attributes are sane.

https://bugzilla.kernel.org/show_bug.cgi?id=200401

Reported-by: Wen Xu <wen.xu@gatech.edu>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bwh: Backported to 3.16: return -EIO instead of -EFSCORRUPTED]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/xattr.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -193,6 +193,8 @@ ext4_xattr_check_names(struct ext4_xattr
 		struct ext4_xattr_entry *next = EXT4_XATTR_NEXT(e);
 		if ((void *)next >= end)
 			return -EIO;
+		if (strnlen(e->e_name, e->e_name_len) != e->e_name_len)
+			return -EIO;
 		e = next;
 	}
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 285/328] net: sched: act_ipt: check for underflow in __tcf_ipt_init()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (262 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 008/328] platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 128/328] 9p/net: Fix zero-copy path in the 9p virtio transport Ben Hutchings
                   ` (63 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dan Carpenter, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit aeadd93f2b0a609f603ac33e574b97a9832d1b90 upstream.

If "td->u.target_size" is larger than sizeof(struct xt_entry_target) we
return -EINVAL.  But we don't check whether it's smaller than
sizeof(struct xt_entry_target) and that could lead to an out of bounds
read.

Fixes: 7ba699c604ab ("[NET_SCHED]: Convert actions from rtnetlink to new netlink API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/sched/act_ipt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -107,7 +107,7 @@ static int tcf_ipt_init(struct net *net,
 		return -EINVAL;
 
 	td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]);
-	if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size)
+	if (nla_len(tb[TCA_IPT_TARG]) != td->u.target_size)
 		return -EINVAL;
 
 	if (tb[TCA_IPT_INDEX] != NULL)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 274/328] sr9800: Check for supported Wake-on-LAN modes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (45 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 219/328] batman-adv: Prevent duplicated global TT entry Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 003/328] EDAC, i7core: Fix memleaks and use-after-free on probe and remove Ben Hutchings
                   ` (280 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Florian Fainelli

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit c5cb93e994ffb43b7b3b1ff10b9f928f54574a36 upstream.

The driver currently silently accepts unsupported Wake-on-LAN modes
(other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user,
which is confusing.

Fixes: 19a38d8e0aa3 ("USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/usb/sr9800.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -421,6 +421,9 @@ sr_set_wol(struct net_device *net, struc
 	struct usbnet *dev = netdev_priv(net);
 	u8 opt = 0;
 
+	if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
+		return -EINVAL;
+
 	if (wolinfo->wolopts & WAKE_PHY)
 		opt |= SR_MONITOR_LINK;
 	if (wolinfo->wolopts & WAKE_MAGIC)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 280/328] tools: hv: fcopy: set 'error' in case an unknown operation was requested
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (218 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 213/328] batman-adv: Prevent duplicated gateway_node entry Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 239/328] pstore: Fix incorrect persistent ram buffer mapping Ben Hutchings
                   ` (107 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Vitaly Kuznetsov, Greg Kroah-Hartman, K. Y. Srinivasan

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Vitaly Kuznetsov <vkuznets@redhat.com>

commit c2d68afba86d1ff01e7300c68bc16a9234dcd8e9 upstream.

'error' variable is left uninitialized in case we see an unknown operation.
As we don't immediately return and proceed to pwrite() we need to set it
to something, HV_E_FAIL sounds good enough.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 tools/hv/hv_fcopy_daemon.c | 1 +
 1 file changed, 1 insertion(+)

--- a/tools/hv/hv_fcopy_daemon.c
+++ b/tools/hv/hv_fcopy_daemon.c
@@ -184,6 +184,7 @@ int main(void)
 			break;
 
 		default:
+			error = HV_E_FAIL;
 			syslog(LOG_ERR, "Unknown operation: %d",
 				in_msg->operation);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 275/328] r8152: Check for supported Wake-on-LAN Modes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (243 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 144/328] netfilter: nft_set: fix allocation size overflow in privsize callback Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 124/328] powerpc/fadump: handle crash memory ranges array index overflow Ben Hutchings
                   ` (82 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Florian Fainelli, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit f2750df1548bd8a2b060eb609fc43ca82811af4c upstream.

The driver does not check for Wake-on-LAN modes specified by an user,
but will conditionally set the device as wake-up enabled or not based on
that, which could be a very confusing user experience.

Fixes: 21ff2e8976b1 ("r8152: support WOL")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/usb/r8152.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3106,6 +3106,9 @@ static int rtl8152_set_wol(struct net_de
 	struct r8152 *tp = netdev_priv(dev);
 	int ret;
 
+	if (wol->wolopts & ~WAKE_ANY)
+		return -EINVAL;
+
 	ret = usb_autopm_get_interface(tp->intf);
 	if (ret < 0)
 		goto out_set_wol;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 276/328] smsc75xx: Check for Wake-on-LAN modes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (306 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 031/328] pinctrl: msm: Fix msm_config_group_get() to be compliant Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 056/328] video: udlfb: Remove noisy warnings Ben Hutchings
                   ` (19 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Florian Fainelli

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit 9c734b2769a73eea2e9e9767c0e0bf839ff23679 upstream.

The driver does not check for Wake-on-LAN modes specified by an user,
but will conditionally set the device as wake-up enabled or not based on
that, which could be a very confusing user experience.

Fixes: 6c636503260d ("smsc75xx: add wol magic packet support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/usb/smsc75xx.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -728,6 +728,9 @@ static int smsc75xx_ethtool_set_wol(stru
 	struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]);
 	int ret;
 
+	if (wolinfo->wolopts & ~SUPPORTED_WAKE)
+		return -EINVAL;
+
 	pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
 
 	ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 294/328] team: Forbid enslaving team device to itself
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (168 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 002/328] EDAC: i7core: Return proper error codes for kzalloc() errors Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 304/328] mach64: detect the dot clock divider correctly on sparc Ben Hutchings
                   ` (157 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Ido Schimmel

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ido Schimmel <idosch@mellanox.com>

commit 471b83bd8bbe4e89743683ef8ecb78f7029d8288 upstream.

team's ndo_add_slave() acquires 'team->lock' and later tries to open the
newly enslaved device via dev_open(). This emits a 'NETDEV_UP' event
that causes the VLAN driver to add VLAN 0 on the team device. team's
ndo_vlan_rx_add_vid() will also try to acquire 'team->lock' and
deadlock.

Fix this by checking early at the enslavement function that a team
device is not being enslaved to itself.

A similar check was added to the bond driver in commit 09a89c219baf
("bonding: disallow enslaving a bond to itself").

WARNING: possible recursive locking detected
4.18.0-rc7+ #176 Not tainted
--------------------------------------------
syz-executor4/6391 is trying to acquire lock:
(____ptrval____) (&team->lock){+.+.}, at: team_vlan_rx_add_vid+0x3b/0x1e0 drivers/net/team/team.c:1868

but task is already holding lock:
(____ptrval____) (&team->lock){+.+.}, at: team_add_slave+0xdb/0x1c30 drivers/net/team/team.c:1947

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&team->lock);
  lock(&team->lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz-executor4/6391:
 #0: (____ptrval____) (rtnl_mutex){+.+.}, at: rtnl_lock net/core/rtnetlink.c:77 [inline]
 #0: (____ptrval____) (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x412/0xc30 net/core/rtnetlink.c:4662
 #1: (____ptrval____) (&team->lock){+.+.}, at: team_add_slave+0xdb/0x1c30 drivers/net/team/team.c:1947

stack backtrace:
CPU: 1 PID: 6391 Comm: syz-executor4 Not tainted 4.18.0-rc7+ #176
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 print_deadlock_bug kernel/locking/lockdep.c:1765 [inline]
 check_deadlock kernel/locking/lockdep.c:1809 [inline]
 validate_chain kernel/locking/lockdep.c:2405 [inline]
 __lock_acquire.cold.64+0x1fb/0x486 kernel/locking/lockdep.c:3435
 lock_acquire+0x1e4/0x540 kernel/locking/lockdep.c:3924
 __mutex_lock_common kernel/locking/mutex.c:757 [inline]
 __mutex_lock+0x176/0x1820 kernel/locking/mutex.c:894
 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:909
 team_vlan_rx_add_vid+0x3b/0x1e0 drivers/net/team/team.c:1868
 vlan_add_rx_filter_info+0x14a/0x1d0 net/8021q/vlan_core.c:210
 __vlan_vid_add net/8021q/vlan_core.c:278 [inline]
 vlan_vid_add+0x63e/0x9d0 net/8021q/vlan_core.c:308
 vlan_device_event.cold.12+0x2a/0x2f net/8021q/vlan.c:381
 notifier_call_chain+0x180/0x390 kernel/notifier.c:93
 __raw_notifier_call_chain kernel/notifier.c:394 [inline]
 raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
 call_netdevice_notifiers_info+0x3f/0x90 net/core/dev.c:1735
 call_netdevice_notifiers net/core/dev.c:1753 [inline]
 dev_open+0x173/0x1b0 net/core/dev.c:1433
 team_port_add drivers/net/team/team.c:1219 [inline]
 team_add_slave+0xa8b/0x1c30 drivers/net/team/team.c:1948
 do_set_master+0x1c9/0x220 net/core/rtnetlink.c:2248
 do_setlink+0xba4/0x3e10 net/core/rtnetlink.c:2382
 rtnl_setlink+0x2a9/0x400 net/core/rtnetlink.c:2636
 rtnetlink_rcv_msg+0x46e/0xc30 net/core/rtnetlink.c:4665
 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2455
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4683
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0xa18/0xfd0 net/netlink/af_netlink.c:1908
 sock_sendmsg_nosec net/socket.c:642 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:652
 ___sys_sendmsg+0x7fd/0x930 net/socket.c:2126
 __sys_sendmsg+0x11d/0x290 net/socket.c:2164
 __do_sys_sendmsg net/socket.c:2173 [inline]
 __se_sys_sendmsg net/socket.c:2171 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2171
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x456b29
Code: fd b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f9706bf8c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f9706bf96d4 RCX: 0000000000456b29
RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000004
RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000004d3548 R14: 00000000004c8227 R15: 0000000000000000

Fixes: 87002b03baab ("net: introduce vlan_vid_[add/del] and use them instead of direct [add/kill]_vid ndo calls")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-and-tested-by: syzbot+bd051aba086537515cdb@syzkaller.appspotmail.com
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: drop the extack message]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1124,6 +1124,11 @@ static int team_port_add(struct team *te
 		return -EBUSY;
 	}
 
+	if (dev == port_dev) {
+		netdev_err(dev, "Cannot enslave team device to itself\n");
+		return -EINVAL;
+	}
+
 	if (port_dev->features & NETIF_F_VLAN_CHALLENGED &&
 	    vlan_uses_dev(dev)) {
 		netdev_err(dev, "Device %s is VLAN challenged and team device has VLAN set up\n",


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 281/328] pstore/ram: Fix failure-path memory leak in ramoops_init
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (202 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 270/328] PCI: Reprogram bridge prefetch registers on resume Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 163/328] ext4: check to make sure the rename(2)'s destination is not freed Ben Hutchings
                   ` (123 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Anton Vorontsov, Kees Cook, Joel Fernandes, Colin Cross,
	Tony Luck, nixiaoming, Geliang Tang

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Kees Cook <keescook@chromium.org>

commit bac6f6cda206ad7cbe0c73c35e494377ce9c4749 upstream.

As reported by nixiaoming, with some minor clarifications:

1) memory leak in ramoops_register_dummy():
   dummy_data = kzalloc(sizeof(*dummy_data), GFP_KERNEL);
   but no kfree() if platform_device_register_data() fails.

2) memory leak in ramoops_init():
   Missing platform_device_unregister(dummy) and kfree(dummy_data)
   if platform_driver_register(&ramoops_driver) fails.

I've clarified the purpose of ramoops_register_dummy(), and added a
common cleanup routine for all three failure paths to call.

Reported-by: nixiaoming <nixiaoming@huawei.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/pstore/ram.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -557,8 +557,22 @@ static struct platform_driver ramoops_dr
 	},
 };
 
-static void ramoops_register_dummy(void)
+static inline void ramoops_unregister_dummy(void)
 {
+	platform_device_unregister(dummy);
+	dummy = NULL;
+
+	kfree(dummy_data);
+	dummy_data = NULL;
+}
+
+static void __init ramoops_register_dummy(void)
+{
+	/*
+	 * Prepare a dummy platform data structure to carry the module
+	 * parameters. If mem_size isn't set, then there are no module
+	 * parameters, and we can skip this.
+	 */
 	if (!mem_size)
 		return;
 
@@ -588,21 +602,28 @@ static void ramoops_register_dummy(void)
 	if (IS_ERR(dummy)) {
 		pr_info("could not create platform device: %ld\n",
 			PTR_ERR(dummy));
+		dummy = NULL;
+		ramoops_unregister_dummy();
 	}
 }
 
 static int __init ramoops_init(void)
 {
+	int ret;
+
 	ramoops_register_dummy();
-	return platform_driver_register(&ramoops_driver);
+	ret = platform_driver_register(&ramoops_driver);
+	if (ret != 0)
+		ramoops_unregister_dummy();
+
+	return ret;
 }
 postcore_initcall(ramoops_init);
 
 static void __exit ramoops_exit(void)
 {
 	platform_driver_unregister(&ramoops_driver);
-	platform_device_unregister(dummy);
-	kfree(dummy_data);
+	ramoops_unregister_dummy();
 }
 module_exit(ramoops_exit);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 273/328] ax88179_178a: Check for supported Wake-on-LAN modes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (176 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 248/328] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 080/328] media: gl861: fix probe of dvb_usb_gl861 Ben Hutchings
                   ` (149 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Florian Fainelli

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit 5ba6b4aa9a410c5e2c6417df52b5e2118ea9b467 upstream.

The driver currently silently accepts unsupported Wake-on-LAN modes
(other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user,
which is confusing.

Fixes: e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/usb/ax88179_178a.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -506,6 +506,9 @@ ax88179_set_wol(struct net_device *net,
 	struct usbnet *dev = netdev_priv(net);
 	u8 opt = 0;
 
+	if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
+		return -EINVAL;
+
 	if (wolinfo->wolopts & WAKE_PHY)
 		opt |= AX_MONITOR_MODE_RWLC;
 	if (wolinfo->wolopts & WAKE_MAGIC)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 279/328] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (290 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 320/328] mtd: fsl-quadspi: fix macro collision problems with READ/WRITE Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 245/328] serial: cpm_uart: return immediately from console poll Ben Hutchings
                   ` (35 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dexuan Cui, Greg Kroah-Hartman, Haiyang Zhang,
	Stephen Hemminger, K. Y. Srinivasan

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dexuan Cui <decui@microsoft.com>

commit 41e270f6898e7502be9fd6920ee0a108ca259d36 upstream.

With CONFIG_DEBUG_PREEMPT=y, I always see this warning:
BUG: using smp_processor_id() in preemptible [00000000]

Fix the false warning by using get/put_cpu().

Here vmbus_connect() sends a message to the host and waits for the
host's response. The host will deliver the response message and an
interrupt on CPU msg->target_vcpu, and later the interrupt handler
will wake up vmbus_connect(). vmbus_connect() doesn't really have
to run on the same cpu as CPU msg->target_vcpu, so it's safe to
call put_cpu() just here.

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16:
 - smp_processor_id() is only used once here
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/hv/connection.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -68,6 +68,7 @@ static int vmbus_negotiate_version(struc
 					__u32 version)
 {
 	int ret = 0;
+	unsigned int cur_cpu;
 	struct vmbus_channel_initiate_contact *msg;
 	unsigned long flags;
 
@@ -80,8 +81,11 @@ static int vmbus_negotiate_version(struc
 	msg->interrupt_page = virt_to_phys(vmbus_connection.int_page);
 	msg->monitor_page1 = virt_to_phys(vmbus_connection.monitor_pages[0]);
 	msg->monitor_page2 = virt_to_phys(vmbus_connection.monitor_pages[1]);
-	if (version == VERSION_WIN8_1)
-		msg->target_vcpu = hv_context.vp_index[smp_processor_id()];
+	if (version == VERSION_WIN8_1) {
+		cur_cpu = get_cpu();
+		msg->target_vcpu = hv_context.vp_index[cur_cpu];
+		put_cpu();
+	}
 
 	/*
 	 * Add to list before we send the request since we may


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 277/328] smsc95xx: Check for Wake-on-LAN modes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (210 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 249/328] x86/paravirt: Fix some warning messages Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 237/328] CIFS: fix wrapping bugs in num_entries() Ben Hutchings
                   ` (115 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Florian Fainelli

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit c530c471ba37bdd9fe1c7185b01455c00ae606fb upstream.

The driver does not check for Wake-on-LAN modes specified by an user,
but will conditionally set the device as wake-up enabled or not based on
that, which could be a very confusing user experience.

Fixes: e0e474a83c18 ("smsc95xx: add wol magic packet support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/usb/smsc95xx.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -726,6 +726,9 @@ static int smsc95xx_ethtool_set_wol(stru
 	struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
 	int ret;
 
+	if (wolinfo->wolopts & ~SUPPORTED_WAKE)
+		return -EINVAL;
+
 	pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE;
 
 	ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 278/328] qlcnic: fix Tx descriptor corruption on 82xx devices
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (271 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 151/328] iscsi-target: nullify session in failed login sequence Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 133/328] KVM: arm/arm64: Skip updating PMD entry if no change Ben Hutchings
                   ` (54 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Shahed Shaikh, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Shahed Shaikh <shahed.shaikh@cavium.com>

commit c333fa0c4f220f8f7ea5acd6b0ebf3bf13fd684d upstream.

In regular NIC transmission flow, driver always configures MAC using
Tx queue zero descriptor as a part of MAC learning flow.
But with multi Tx queue supported NIC, regular transmission can occur on
any non-zero Tx queue and from that context it uses
Tx queue zero descriptor to configure MAC, at the same time TX queue
zero could be used by another CPU for regular transmission
which could lead to Tx queue zero descriptor corruption and cause FW
abort.

This patch fixes this in such a way that driver always configures
learned MAC address from the same Tx queue which is used for
regular transmission.

Fixes: 7e2cf4feba05 ("qlcnic: change driver hardware interface mechanism")
Signed-off-by: Shahed Shaikh <shahed.shaikh@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic.h         |  8 +++++---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c |  3 ++-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h |  3 ++-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h      |  3 ++-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c      | 12 ++++++------
 5 files changed, 17 insertions(+), 12 deletions(-)

--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
@@ -1793,7 +1793,8 @@ struct qlcnic_hardware_ops {
 	int (*config_loopback) (struct qlcnic_adapter *, u8);
 	int (*clear_loopback) (struct qlcnic_adapter *, u8);
 	int (*config_promisc_mode) (struct qlcnic_adapter *, u32);
-	void (*change_l2_filter) (struct qlcnic_adapter *, u64 *, u16);
+	void (*change_l2_filter)(struct qlcnic_adapter *adapter, u64 *addr,
+				 u16 vlan, struct qlcnic_host_tx_ring *tx_ring);
 	int (*get_board_info) (struct qlcnic_adapter *);
 	void (*set_mac_filter_count) (struct qlcnic_adapter *);
 	void (*free_mac_list) (struct qlcnic_adapter *);
@@ -2035,9 +2036,10 @@ static inline int qlcnic_nic_set_promisc
 }
 
 static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter,
-					u64 *addr, u16 id)
+					u64 *addr, u16 vlan,
+					struct qlcnic_host_tx_ring *tx_ring)
 {
-	adapter->ahw->hw_ops->change_l2_filter(adapter, addr, id);
+	adapter->ahw->hw_ops->change_l2_filter(adapter, addr, vlan, tx_ring);
 }
 
 static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -2095,7 +2095,8 @@ out:
 }
 
 void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr,
-				  u16 vlan_id)
+				  u16 vlan_id,
+				  struct qlcnic_host_tx_ring *tx_ring)
 {
 	u8 mac[ETH_ALEN];
 	memcpy(&mac, addr, ETH_ALEN);
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
@@ -549,7 +549,8 @@ int qlcnic_83xx_wrt_reg_indirect(struct
 int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32);
 int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *, int);
 int qlcnic_83xx_config_rss(struct qlcnic_adapter *, int);
-void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16);
+void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr,
+				  u16 vlan, struct qlcnic_host_tx_ring *ring);
 int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *);
 int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *);
 void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *, int);
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h
@@ -172,7 +172,8 @@ int qlcnic_82xx_napi_add(struct qlcnic_a
 			 struct net_device *netdev);
 void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *);
 void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter,
-			       u64 *uaddr, u16 vlan_id);
+			       u64 *uaddr, u16 vlan_id,
+			       struct qlcnic_host_tx_ring *tx_ring);
 int qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *,
 				     struct ethtool_coalesce *);
 int qlcnic_82xx_set_rx_coalesce(struct qlcnic_adapter *);
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -268,13 +268,12 @@ static void qlcnic_add_lb_filter(struct
 }
 
 void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr,
-			       u16 vlan_id)
+			       u16 vlan_id, struct qlcnic_host_tx_ring *tx_ring)
 {
 	struct cmd_desc_type0 *hwdesc;
 	struct qlcnic_nic_req *req;
 	struct qlcnic_mac_req *mac_req;
 	struct qlcnic_vlan_req *vlan_req;
-	struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring;
 	u32 producer;
 	u64 word;
 
@@ -301,7 +300,8 @@ void qlcnic_82xx_change_filter(struct ql
 
 static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
 			       struct cmd_desc_type0 *first_desc,
-			       struct sk_buff *skb)
+			       struct sk_buff *skb,
+			       struct qlcnic_host_tx_ring *tx_ring)
 {
 	struct vlan_ethhdr *vh = (struct vlan_ethhdr *)(skb->data);
 	struct ethhdr *phdr = (struct ethhdr *)(skb->data);
@@ -335,7 +335,7 @@ static void qlcnic_send_filter(struct ql
 		    tmp_fil->vlan_id == vlan_id) {
 			if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime))
 				qlcnic_change_filter(adapter, &src_addr,
-						     vlan_id);
+						     vlan_id, tx_ring);
 			tmp_fil->ftime = jiffies;
 			return;
 		}
@@ -350,7 +350,7 @@ static void qlcnic_send_filter(struct ql
 	if (!fil)
 		return;
 
-	qlcnic_change_filter(adapter, &src_addr, vlan_id);
+	qlcnic_change_filter(adapter, &src_addr, vlan_id, tx_ring);
 	fil->ftime = jiffies;
 	fil->vlan_id = vlan_id;
 	memcpy(fil->faddr, &src_addr, ETH_ALEN);
@@ -766,7 +766,7 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_
 	}
 
 	if (adapter->drv_mac_learn)
-		qlcnic_send_filter(adapter, first_desc, skb);
+		qlcnic_send_filter(adapter, first_desc, skb, tx_ring);
 
 	tx_ring->tx_stats.tx_bytes += skb->len;
 	tx_ring->tx_stats.xmit_called++;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 032/328] ARM: tegra: Fix Tegra30 Cardhu PCA954x reset
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (214 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 327/328] xfs: don't fail when converting shortform attr to long form during ATTR_REPLACE Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 106/328] mac802154: tx: use put_unaligned_le16 for copy crc Ben Hutchings
                   ` (111 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Thierry Reding, Jon Hunter

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jon Hunter <jonathanh@nvidia.com>

commit 6e1811900b6fe6f2b4665dba6bd6ed32c6b98575 upstream.

On all versions of Tegra30 Cardhu, the reset signal to the NXP PCA9546
I2C mux is connected to the Tegra GPIO BB0. Currently, this pin on the
Tegra is not configured as a GPIO but as a special-function IO (SFIO)
that is multiplexing the pin to an I2S controller. On exiting system
suspend, I2C commands sent to the PCA9546 are failing because there is
no ACK. Although it is not possible to see exactly what is happening
to the reset during suspend, by ensuring it is configured as a GPIO
and driven high, to de-assert the reset, the failures are no longer
seen.

Please note that this GPIO is also used to drive the reset signal
going to the camera connector on the board. However, given that there
is no camera support currently for Cardhu, this should not have any
impact.

Fixes: 40431d16ff11 ("ARM: tegra: enable PCA9546 on Cardhu")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm/boot/dts/tegra30-cardhu.dtsi | 1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -193,6 +193,7 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 			reg = <0x70>;
+			reset-gpio = <&gpio TEGRA_GPIO(BB, 0) GPIO_ACTIVE_LOW>;
 		};
 	};
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 299/328] Make file credentials available to the seqfile interfaces
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (26 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 041/328] s390/kvm: fix deadlock when killed by oom Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 121/328] b43/leds: Ensure NUL-termination of LED name string Ben Hutchings
                   ` (299 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Linus Torvalds

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Linus Torvalds <torvalds@linux-foundation.org>

commit 34dbbcdbf63360661ff7bda6c5f52f99ac515f92 upstream.

A lot of seqfile users seem to be using things like %pK that uses the
credentials of the current process, but that is actually completely
wrong for filesystem interfaces.

The unix semantics for permission checking files is to check permissions
at _open_ time, not at read or write time, and that is not just a small
detail: passing off stdin/stdout/stderr to a suid application and making
the actual IO happen in privileged context is a classic exploit
technique.

So if we want to be able to look at permissions at read time, we need to
use the file open credentials, not the current ones.  Normal file
accesses can just use "f_cred" (or any of the helper functions that do
that, like file_ns_capable()), but the seqfile interfaces do not have
any such options.

It turns out that seq_file _does_ save away the user_ns information of
the file, though.  Since user_ns is just part of the full credential
information, replace that special case with saving off the cred pointer
instead, and suddenly seq_file has all the permission information it
needs.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/seq_file.c            |  7 ++++---
 include/linux/seq_file.h | 13 ++++---------
 2 files changed, 8 insertions(+), 12 deletions(-)

--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -69,9 +69,10 @@ int seq_open(struct file *file, const st
 	memset(p, 0, sizeof(*p));
 	mutex_init(&p->lock);
 	p->op = op;
-#ifdef CONFIG_USER_NS
-	p->user_ns = file->f_cred->user_ns;
-#endif
+
+	// No refcounting: the lifetime of 'p' is constrained
+	// to the lifetime of the file.
+	p->file = file;
 
 	/*
 	 * Wrappers around seq_open(e.g. swaps_open) need to be
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -7,13 +7,10 @@
 #include <linux/mutex.h>
 #include <linux/cpumask.h>
 #include <linux/nodemask.h>
+#include <linux/fs.h>
+#include <linux/cred.h>
 
 struct seq_operations;
-struct file;
-struct path;
-struct inode;
-struct dentry;
-struct user_namespace;
 
 struct seq_file {
 	char *buf;
@@ -27,9 +24,7 @@ struct seq_file {
 	struct mutex lock;
 	const struct seq_operations *op;
 	int poll_event;
-#ifdef CONFIG_USER_NS
-	struct user_namespace *user_ns;
-#endif
+	const struct file *file;
 	void *private;
 };
 
@@ -151,7 +146,7 @@ int seq_put_decimal_ll(struct seq_file *
 static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
 {
 #ifdef CONFIG_USER_NS
-	return seq->user_ns;
+	return seq->file->f_cred->user_ns;
 #else
 	extern struct user_namespace init_user_ns;
 	return &init_user_ns;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 318/328] r8169: fix NAPI handling under high load
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (48 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 165/328] x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+ Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 264/328] fbdev/omapfb: fix omapfb_memory_read infoleak Ben Hutchings
                   ` (277 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Heiner Kallweit

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Heiner Kallweit <hkallweit1@gmail.com>

commit 6b839b6cf9eada30b086effb51e5d6076bafc761 upstream.

rtl_rx() and rtl_tx() are called only if the respective bits are set
in the interrupt status register. Under high load NAPI may not be
able to process all data (work_done == budget) and it will schedule
subsequent calls to the poll callback.
rtl_ack_events() however resets the bits in the interrupt status
register, therefore subsequent calls to rtl8169_poll() won't call
rtl_rx() and rtl_tx() - chip interrupts are still disabled.

Fix this by calling rtl_rx() and rtl_tx() independent of the bits
set in the interrupt status register. Both functions will detect
if there's nothing to do for them.

Fixes: da78dbff2e05 ("r8169: remove work from irq handler.")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/ethernet/realtek/r8169.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6417,17 +6417,15 @@ static int rtl8169_poll(struct napi_stru
 	struct rtl8169_private *tp = container_of(napi, struct rtl8169_private, napi);
 	struct net_device *dev = tp->dev;
 	u16 enable_mask = RTL_EVENT_NAPI | tp->event_slow;
-	int work_done= 0;
+	int work_done;
 	u16 status;
 
 	status = rtl_get_events(tp);
 	rtl_ack_events(tp, status & ~tp->event_slow);
 
-	if (status & RTL_EVENT_NAPI_RX)
-		work_done = rtl_rx(dev, tp, (u32) budget);
+	work_done = rtl_rx(dev, tp, (u32) budget);
 
-	if (status & RTL_EVENT_NAPI_TX)
-		rtl_tx(dev, tp);
+	rtl_tx(dev, tp);
 
 	if (status & tp->event_slow) {
 		enable_mask &= ~tp->event_slow;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 319/328] net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (235 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 241/328] bpf, net: add skb_mac_header_len helper Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 184/328] cifs: connect to servername instead of IP for IPC$ share Ben Hutchings
                   ` (90 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David Ahern, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: David Ahern <dsahern@gmail.com>

commit 4ba4c566ba8448a05e6257e0b98a21f1a0d55315 upstream.

The loop wants to skip previously dumped addresses, so loops until
current index >= saved index. If the message fills it wants to save
the index for the next address to dump - ie., the one that did not
fit in the current message.

Currently, it is incrementing the index counter before comparing to the
saved index, and then the saved index is off by 1 - it assumes the
current address is going to fit in the message.

Change the index handling to increment only after a succesful dump.

Fixes: 502a2ffd7376a ("ipv6: convert idev_list to list macros")
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ipv6/addrconf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4085,8 +4085,8 @@ static int in6_dump_addrs(struct inet6_d
 
 		/* unicast address incl. temp addr */
 		list_for_each_entry(ifa, &idev->addr_list, if_list) {
-			if (++ip_idx < s_ip_idx)
-				continue;
+			if (ip_idx < s_ip_idx)
+				goto next;
 			err = inet6_fill_ifaddr(skb, ifa,
 						NETLINK_CB(cb->skb).portid,
 						cb->nlh->nlmsg_seq,
@@ -4095,6 +4095,8 @@ static int in6_dump_addrs(struct inet6_d
 			if (err <= 0)
 				break;
 			nl_dump_check_consistent(cb, nlmsg_hdr(skb));
+next:
+			ip_idx++;
 		}
 		break;
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 316/328] ptp: fix Spectre v1 vulnerability
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (60 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 234/328] Tools: hv: Fix a bug in the key delete code Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 158/328] mm: move tlb_table_flush to tlb_flush_mmu_free Ben Hutchings
                   ` (265 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Gustavo A. R. Silva, David S. Miller, Richard Cochran

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit efa61c8cf2950ab5c0e66cff3cabe2a2b24e81ba upstream.

pin_index can be indirectly controlled by user-space, hence leading
to a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/ptp/ptp_chardev.c:253 ptp_ioctl() warn: potential spectre issue
'ops->pin_config' [r] (local cap)

Fix this by sanitizing pin_index before using it to index
ops->pin_config, and before passing it as an argument to
function ptp_set_pinfunc(), in which it is used to index
info->pin_config.

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/ptp/ptp_chardev.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -23,6 +23,8 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 
+#include <linux/nospec.h>
+
 #include "ptp_private.h"
 
 static int ptp_disable_pinfunc(struct ptp_clock_info *ops,
@@ -228,6 +230,7 @@ long ptp_ioctl(struct posix_clock *pc, u
 			err = -EINVAL;
 			break;
 		}
+		pin_index = array_index_nospec(pin_index, ops->n_pins);
 		if (mutex_lock_interruptible(&ptp->pincfg_mux))
 			return -ERESTARTSYS;
 		pd = ops->pin_config[pin_index];
@@ -246,6 +249,7 @@ long ptp_ioctl(struct posix_clock *pc, u
 			err = -EINVAL;
 			break;
 		}
+		pin_index = array_index_nospec(pin_index, ops->n_pins);
 		if (mutex_lock_interruptible(&ptp->pincfg_mux))
 			return -ERESTARTSYS;
 		err = ptp_set_pinfunc(ptp, pin_index, pd.func, pd.chan);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 317/328] cachefiles: fix the race between cachefiles_bury_object() and rmdir(2)
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (97 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 187/328] ext4: fix online resize's handling of a too-small final block group Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 255/328] USB: fix error handling in usb_driver_claim_interface() Ben Hutchings
                   ` (228 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David Howells, Greg Kroah-Hartman, Al Viro

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Al Viro <viro@zeniv.linux.org.uk>

commit 169b803397499be85bdd1e3d07d6f5e3d4bd669e upstream.

the victim might've been rmdir'ed just before the lock_rename();
unlike the normal callers, we do not look the source up after the
parents are locked - we know it beforehand and just recheck that it's
still the child of what used to be its parent.  Unfortunately,
the check is too weak - we don't spot a dead directory since its
->d_parent is unchanged, dentry is positive, etc.  So we sail all
the way to ->rename(), with hosting filesystems _not_ expecting
to be asked renaming an rmdir'ed subdirectory.

The fix is easy, fortunately - the lock on parent is sufficient for
making IS_DEADDIR() on child safe.

Fixes: 9ae326a69004 (CacheFiles: A cache that backs onto a mounted filesystem)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cachefiles/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -317,7 +317,7 @@ try_again:
 	trap = lock_rename(cache->graveyard, dir);
 
 	/* do some checks before getting the grave dentry */
-	if (rep->d_parent != dir) {
+	if (rep->d_parent != dir || IS_DEADDIR(d_inode(rep))) {
 		/* the entry was probably culled when we dropped the parent dir
 		 * lock */
 		unlock_rename(cache->graveyard, dir);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 296/328] ARC: clone syscall to setp r25 as thread pointer
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (95 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 223/328] RDMA/cma: Protect cma dev list with lock Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 187/328] ext4: fix online resize's handling of a too-small final block group Ben Hutchings
                   ` (230 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Nikita Sobolev, Vineet Gupta

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Vineet Gupta <vgupta@synopsys.com>

commit c58a584f05e35d1d4342923cd7aac07d9c3d3d16 upstream.

Per ARC TLS ABI, r25 is designated TP (thread pointer register).
However so far kernel didn't do any special treatment, like setting up
usermode r25, even for CLONE_SETTLS. We instead relied on libc runtime
to do this, in say clone libc wrapper [1]. This was deliberate to keep
kernel ABI agnostic (userspace could potentially change TP, specially
for different ARC ISA say ARCompact vs. ARCv2 with different spare
registers etc)

However userspace setting up r25, after clone syscall opens a race, if
child is not scheduled and gets a signal instead. It starts off in
userspace not in clone but in a signal handler and anything TP sepcific
there such as pthread_self() fails which showed up with uClibc
testsuite nptl/tst-kill6 [2]

Fix this by having kernel populate r25 to TP value. So this locks in
ABI, but it was not going to change anyways, and fwiw is same for both
ARCompact (arc700 core) and ARCvs (HS3x cores)

[1] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/arc/clone.S
[2] https://github.com/wbx-github/uclibc-ng-test/blob/master/test/nptl/tst-kill6.c

Fixes: ARC STAR 9001378481
Reported-by: Nikita Sobolev <sobolev@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arc/kernel/process.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

--- a/arch/arc/kernel/process.c
+++ b/arch/arc/kernel/process.c
@@ -147,6 +147,26 @@ int copy_thread(unsigned long clone_flag
 		task_thread_info(current)->thr_ptr;
 	}
 
+
+	/*
+	 * setup usermode thread pointer #1:
+	 * when child is picked by scheduler, __switch_to() uses @c_callee to
+	 * populate usermode callee regs: this works (despite being in a kernel
+	 * function) since special return path for child @ret_from_fork()
+	 * ensures those regs are not clobbered all the way to RTIE to usermode
+	 */
+	c_callee->r25 = task_thread_info(p)->thr_ptr;
+
+#ifdef CONFIG_ARC_CURR_IN_REG
+	/*
+	 * setup usermode thread pointer #2:
+	 * however for this special use of r25 in kernel, __switch_to() sets
+	 * r25 for kernel needs and only in the final return path is usermode
+	 * r25 setup, from pt_regs->user_r25. So set that up as well
+	 */
+	c_regs->user_r25 = c_callee->r25;
+#endif
+
 	return 0;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 321/328] cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (8 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 324/328] posix-timers: Sanitize overrun handling Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 225/328] hwmon: (nct6775) Fix access to fan pulse registers Ben Hutchings
                   ` (317 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Catalin Marinas, Rafael J. Wysocki

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Catalin Marinas <catalin.marinas@arm.com>

commit 9bd616e3dbedfc103f158197c8ad93678849b1ed upstream.

The cpuidle_devices per-CPU variable is only defined when CPU_IDLE is
enabled. Commit c8cc7d4de7a4 ("sched/idle: Reorganize the idle loop")
removed the #ifdef CONFIG_CPU_IDLE around cpuidle_idle_call() with the
compiler optimising away __this_cpu_read(cpuidle_devices). However, with
CONFIG_UBSAN && !CONFIG_CPU_IDLE, this optimisation no longer happens
and the kernel fails to link since cpuidle_devices is not defined.

This patch introduces an accessor function for the current CPU cpuidle
device (returning NULL when !CONFIG_CPU_IDLE) and uses it in
cpuidle_idle_call().

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/cpuidle.h | 3 +++
 kernel/sched/idle.c     | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -146,6 +146,8 @@ extern int cpuidle_play_dead(void);
 extern void cpuidle_use_deepest_state(bool enable);
 
 extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
+static inline struct cpuidle_device *cpuidle_get_device(void)
+{return __this_cpu_read(cpuidle_devices); }
 #else
 static inline void disable_cpuidle(void) { }
 static inline int cpuidle_select(struct cpuidle_driver *drv,
@@ -179,6 +181,7 @@ static inline int cpuidle_play_dead(void
 static inline void cpuidle_use_deepest_state(bool enable) {}
 static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
 	struct cpuidle_device *dev) {return NULL; }
+static inline struct cpuidle_device *cpuidle_get_device(void) {return NULL; }
 #endif
 
 #ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -76,7 +76,7 @@ void __weak arch_cpu_idle(void)
  */
 static void cpuidle_idle_call(void)
 {
-	struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
+	struct cpuidle_device *dev = cpuidle_get_device();
 	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
 	int next_state, entered_state;
 	bool broadcast;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 283/328] arm64: KVM: Tighten guest core register access from userspace
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (191 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 093/328] ext4: fix spectre gadget in ext4_mb_regular_allocator() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 161/328] net: macb: do not disable MDIO bus at open/close time Ben Hutchings
                   ` (134 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Christoffer Dall, Marc Zyngier, Dave Martin, Mark Rutland,
	Will Deacon

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Martin <Dave.Martin@arm.com>

commit d26c25a9d19b5976b319af528886f89cf455692d upstream.

We currently allow userspace to access the core register file
in about any possible way, including straddling multiple
registers and doing unaligned accesses.

This is not the expected use of the ABI, and nobody is actually
using it that way. Let's tighten it by explicitly checking
the size and alignment for each field of the register file.

Fixes: 2f4a07c5f9fe ("arm64: KVM: guest one-reg interface")
Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
[maz: rewrote Dave's initial patch to be more easily backported]
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm64/kvm/guest.c | 45 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -46,6 +46,45 @@ static u64 core_reg_offset_from_id(u64 i
 	return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE);
 }
 
+static int validate_core_offset(const struct kvm_one_reg *reg)
+{
+	u64 off = core_reg_offset_from_id(reg->id);
+	int size;
+
+	switch (off) {
+	case KVM_REG_ARM_CORE_REG(regs.regs[0]) ...
+	     KVM_REG_ARM_CORE_REG(regs.regs[30]):
+	case KVM_REG_ARM_CORE_REG(regs.sp):
+	case KVM_REG_ARM_CORE_REG(regs.pc):
+	case KVM_REG_ARM_CORE_REG(regs.pstate):
+	case KVM_REG_ARM_CORE_REG(sp_el1):
+	case KVM_REG_ARM_CORE_REG(elr_el1):
+	case KVM_REG_ARM_CORE_REG(spsr[0]) ...
+	     KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]):
+		size = sizeof(__u64);
+		break;
+
+	case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ...
+	     KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]):
+		size = sizeof(__uint128_t);
+		break;
+
+	case KVM_REG_ARM_CORE_REG(fp_regs.fpsr):
+	case KVM_REG_ARM_CORE_REG(fp_regs.fpcr):
+		size = sizeof(__u32);
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	if (KVM_REG_SIZE(reg->id) == size &&
+	    IS_ALIGNED(off, size / sizeof(__u32)))
+		return 0;
+
+	return -EINVAL;
+}
+
 static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
 {
 	/*
@@ -65,6 +104,9 @@ static int get_core_reg(struct kvm_vcpu
 	    (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
 		return -ENOENT;
 
+	if (validate_core_offset(reg))
+		return -EINVAL;
+
 	if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id)))
 		return -EFAULT;
 
@@ -87,6 +129,9 @@ static int set_core_reg(struct kvm_vcpu
 	    (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs)
 		return -ENOENT;
 
+	if (validate_core_offset(reg))
+		return -EINVAL;
+
 	if (KVM_REG_SIZE(reg->id) > sizeof(tmp))
 		return -EINVAL;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 295/328] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (300 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 171/328] usb: gadget: net2280: fix pullup handling Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 286/328] x86/vdso: Fix asm constraints on vDSO syscall fallbacks Ben Hutchings
                   ` (25 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Ralf Baechle, Paul Burton, Maciej W. Rozycki

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Maciej W. Rozycki" <macro@linux-mips.org>

commit 148b9aba99e0bbadf361747d21456e1589015f74 upstream.

Fix a commit 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for
small_memset") regression and remove assembly warnings:

arch/mips/lib/memset.S: Assembler messages:
arch/mips/lib/memset.S:243: Warning: Macro instruction expanded into multiple instructions in a branch delay slot

triggering with the CPU_DADDI_WORKAROUNDS option set and this code:

	PTR_SUBU	a2, t1, a0
	jr		ra
	 PTR_ADDIU	a2, 1

This is because with that option in place the DADDIU instruction, which
the PTR_ADDIU CPP macro expands to, becomes a GAS macro, which in turn
expands to an LI/DADDU (or actually ADDIU/DADDU) sequence:

 13c:	01a4302f 	dsubu	a2,t1,a0
 140:	03e00008 	jr	ra
 144:	24010001 	li	at,1
 148:	00c1302d 	daddu	a2,a2,at
	...

Correct this by switching off the `noreorder' assembly mode and letting
GAS schedule this jump's delay slot, as there is nothing special about
it that would require manual scheduling.  With this change in place
correct code is produced:

 13c:	01a4302f 	dsubu	a2,t1,a0
 140:	24010001 	li	at,1
 144:	03e00008 	jr	ra
 148:	00c1302d 	daddu	a2,a2,at
	...

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 8a8158c85e1e ("MIPS: memset.S: EVA & fault support for small_memset")
Patchwork: https://patchwork.linux-mips.org/patch/20833/
Cc: Ralf Baechle <ralf@linux-mips.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/mips/lib/memset.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/mips/lib/memset.S
+++ b/arch/mips/lib/memset.S
@@ -213,9 +213,11 @@
 	 nop
 
 .Lsmall_fixup\@:
+	.set		reorder
 	PTR_SUBU	a2, t1, a0
+	PTR_ADDIU	a2, 1
 	jr		ra
-	 PTR_ADDIU	a2, 1
+	.set		noreorder
 
 	.endm
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 288/328] perf/core: Fix perf_pmu_unregister() locking
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (107 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 238/328] cifs: integer overflow in in SMB2_ioctl() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 162/328] hwmon: (nct6775) Fix potential Spectre v1 Ben Hutchings
                   ` (218 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jiri Olsa, Peter Zijlstra, Alexander Shishkin, Ingo Molnar,
	Vince Weaver, Linus Torvalds, Stephane Eranian,
	Arnaldo Carvalho de Melo, Thomas Gleixner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <peterz@infradead.org>

commit a9f9772114c8b07ae75bcb3654bd017461248095 upstream.

When we unregister a PMU, we fail to serialize the @pmu_idr properly.
Fix that by doing the entire thing under pmu_lock.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: 2e80a82a49c4 ("perf: Dynamic pmu types")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[bwh: Backported to 3.16:
 - Also remove "out" label in free_pmu_context()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6705,20 +6705,17 @@ static void free_pmu_context(struct pmu
 {
 	struct pmu *i;
 
-	mutex_lock(&pmus_lock);
 	/*
 	 * Like a real lame refcount.
 	 */
 	list_for_each_entry(i, &pmus, entry) {
 		if (i->pmu_cpu_context == pmu->pmu_cpu_context) {
 			update_pmu_context(i, pmu);
-			goto out;
+			return;
 		}
 	}
 
 	free_percpu(pmu->pmu_cpu_context);
-out:
-	mutex_unlock(&pmus_lock);
 }
 static struct idr pmu_idr;
 
@@ -6930,12 +6927,8 @@ EXPORT_SYMBOL_GPL(perf_pmu_register);
 
 void perf_pmu_unregister(struct pmu *pmu)
 {
-	int remove_device;
-
 	mutex_lock(&pmus_lock);
-	remove_device = pmu_bus_running;
 	list_del_rcu(&pmu->entry);
-	mutex_unlock(&pmus_lock);
 
 	/*
 	 * We dereference the pmu list under both SRCU and regular RCU, so
@@ -6947,11 +6940,12 @@ void perf_pmu_unregister(struct pmu *pmu
 	free_percpu(pmu->pmu_disable_count);
 	if (pmu->type >= PERF_TYPE_MAX)
 		idr_remove(&pmu_idr, pmu->type);
-	if (remove_device) {
+	if (pmu_bus_running) {
 		device_del(pmu->dev);
 		put_device(pmu->dev);
 	}
 	free_pmu_context(pmu);
+	mutex_unlock(&pmus_lock);
 }
 EXPORT_SYMBOL_GPL(perf_pmu_unregister);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 061/328] udlfb: make a local copy of fb_ops
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (126 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 060/328] udlfb: don't switch if we are switching to the same videomode Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 205/328] spi: rspi: Fix interrupted DMA transfers Ben Hutchings
                   ` (199 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mikulas Patocka, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 2c29cfc3eaf11779176bf41475cfca49bccba11c upstream.

The defio subsystem overwrites the method fb_osp->mmap. That method is
stored in module's static data - and that means that if we have multiple
diplaylink adapters, they will over write each other's method.

In order to avoid interference between multiple adapters, we copy the
fb_ops structure to a device-local memory.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16: Pointer to struct dlfb_data is named "dev" rather
 than "dlfb"]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 3 ++-
 include/video/udlfb.h       | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -1680,7 +1680,8 @@ static void dlfb_init_framebuffer_work(s
 	dev->info = info;
 	info->par = dev;
 	info->pseudo_palette = dev->pseudo_palette;
-	info->fbops = &dlfb_ops;
+	dev->ops = dlfb_ops;
+	info->fbops = &dev->ops;
 
 	retval = fb_alloc_cmap(&info->cmap, 256, 0);
 	if (retval < 0) {
--- a/include/video/udlfb.h
+++ b/include/video/udlfb.h
@@ -51,6 +51,7 @@ struct dlfb_data {
 	int base8;
 	u32 pseudo_palette[256];
 	int blank_mode; /*one of FB_BLANK_ */
+	struct fb_ops ops;
 	/* blit-only rendering path metrics, exposed through sysfs */
 	atomic_t bytes_rendered; /* raw pixel-bytes driver asked to render */
 	atomic_t bytes_identical; /* saved effort with backbuffer comparison */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 070/328] ALSA: cs5535audio: Fix invalid endian conversion
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (226 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 260/328] ocfs2: fix ocfs2 read block panic Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 228/328] ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO Ben Hutchings
                   ` (99 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 69756930f2de0457d51db7d505a1e4f40e9fd116 upstream.

One place in cs5535audio_build_dma_packets() does an extra conversion
via cpu_to_le32(); namely jmpprd_addr is passed to setup_prd() ops,
which writes the value via cs_writel().  That is, the callback does
the conversion by itself, and we don't need to convert beforehand.

This patch fixes that bogus conversion.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/pci/cs5535audio/cs5535audio.h     | 6 +++---
 sound/pci/cs5535audio/cs5535audio_pcm.c | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

--- a/sound/pci/cs5535audio/cs5535audio.h
+++ b/sound/pci/cs5535audio/cs5535audio.h
@@ -66,9 +66,9 @@ struct cs5535audio_dma_ops {
 };
 
 struct cs5535audio_dma_desc {
-	u32 addr;
-	u16 size;
-	u16 ctlreserved;
+	__le32 addr;
+	__le16 size;
+	__le16 ctlreserved;
 };
 
 struct cs5535audio_dma {
--- a/sound/pci/cs5535audio/cs5535audio_pcm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pcm.c
@@ -158,8 +158,8 @@ static int cs5535audio_build_dma_packets
 	lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr);
 	lastdesc->size = 0;
 	lastdesc->ctlreserved = cpu_to_le16(PRD_JMP);
-	jmpprd_addr = cpu_to_le32(lastdesc->addr +
-				  (sizeof(struct cs5535audio_dma_desc)*periods));
+	jmpprd_addr = (u32)dma->desc_buf.addr +
+		sizeof(struct cs5535audio_dma_desc) * periods;
 
 	dma->substream = substream;
 	dma->period_bytes = period_bytes;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 053/328] fbdev: omapfb: off by one in omapfb_register_client()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (253 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 082/328] partitions/aix: append null character to print data from disk Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 039/328] tty: fix termios input-speed encoding Ben Hutchings
                   ` (72 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Imre Deak, Dan Carpenter, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 5ec1ec35b2979b59d0b33381e7c9aac17e159d16 upstream.

The omapfb_register_client[] array has OMAPFB_PLANE_NUM elements so the
> should be >= or we are one element beyond the end of the array.

Fixes: 8b08cf2b64f5 ("OMAP: add TI OMAP framebuffer driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Imre Deak <imre.deak@solidboot.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/omap/omapfb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/video/fbdev/omap/omapfb_main.c
+++ b/drivers/video/fbdev/omap/omapfb_main.c
@@ -982,7 +982,7 @@ int omapfb_register_client(struct omapfb
 {
 	int r;
 
-	if ((unsigned)omapfb_nb->plane_idx > OMAPFB_PLANE_NUM)
+	if ((unsigned)omapfb_nb->plane_idx >= OMAPFB_PLANE_NUM)
 		return -EINVAL;
 
 	if (!notifier_inited) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 180/328] igmp: fix incorrect unsolicit report count when join group
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (14 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 185/328] xfrm6: call kfree_skb when skb is toobig Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 266/328] bcache: Remove deprecated create_workqueue Ben Hutchings
                   ` (311 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Hangbin Liu, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Hangbin Liu <liuhangbin@gmail.com>

commit 4fb7253e4f9a8f06a986a3b317e2f79d9b43d552 upstream.

We should not start timer if im->unsolicit_count equal to 0 after decrease.
Or we will send one more unsolicit report message. i.e. 3 instead of 2 by
default.

Fixes: 1da177e4c3f41 ("Linux-2.6.12-rc2")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ipv4/igmp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -795,10 +795,9 @@ static void igmp_timer_expire(unsigned l
 	spin_lock(&im->lock);
 	im->tm_running = 0;
 
-	if (im->unsolicit_count) {
-		im->unsolicit_count--;
+	if (im->unsolicit_count && --im->unsolicit_count)
 		igmp_start_timer(im, unsolicited_report_interval(in_dev));
-	}
+
 	im->reporter = 1;
 	spin_unlock(&im->lock);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 064/328] udlfb: set line_length in dlfb_ops_set_par
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (158 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 254/328] USB: remove LPM management from usb_driver_claim_interface() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 181/328] igmp: fix incorrect unsolicit report count after link down and up Ben Hutchings
                   ` (167 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mikulas Patocka, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 0ac319b7af1bb24a33365d0ec82a2f56a59b2a78 upstream.

Set the variable "line_length" in the function dlfb_ops_set_par. Without
this, we get garbage if we select different videomode with fbset.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -1073,6 +1073,7 @@ static int dlfb_ops_set_par(struct fb_in
 		return result;
 
 	dev->current_mode = fvs;
+	info->fix.line_length = info->var.xres * (info->var.bits_per_pixel / 8);
 
 	if (dev->fb_count == 0) {
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 197/328] USB: yurex: Fix buffer over-read in yurex_write()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (208 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 308/328] libertas: call into generic suspend code before turning off power Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 249/328] x86/paravirt: Fix some warning messages Ben Hutchings
                   ` (117 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Ben Hutchings

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ben Hutchings <ben.hutchings@codethink.co.uk>

commit 7e10f14ebface44a48275c8d6dc1caae3668d5a9 upstream.

If the written data starts with a digit, yurex_write() tries to parse
it as an integer using simple_strtoull().  This requires a null-
terminator, and currently there's no guarantee that there is one.

(The sample program at
https://github.com/NeoCat/YUREX-driver-for-Linux/blob/master/sample/yurex_clock.pl
writes an integer without a null terminator.  It seems like it must
have worked by chance!)

Always add a null byte after the written data.  Enlarge the buffer
to allow for this.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/misc/yurex.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -437,13 +437,13 @@ static ssize_t yurex_write(struct file *
 {
 	struct usb_yurex *dev;
 	int i, set = 0, retval = 0;
-	char buffer[16];
+	char buffer[16 + 1];
 	char *data = buffer;
 	unsigned long long c, c2 = 0;
 	signed long timeout = 0;
 	DEFINE_WAIT(wait);
 
-	count = min(sizeof(buffer), count);
+	count = min(sizeof(buffer) - 1, count);
 	dev = (struct usb_yurex *)file->private_data;
 
 	/* verify that we actually have some data to write */
@@ -462,6 +462,7 @@ static ssize_t yurex_write(struct file *
 		retval = -EFAULT;
 		goto error;
 	}
+	buffer[count] = 0;
 	memset(dev->cntl_buffer, CMD_PADDING, YUREX_BUF_SIZE);
 
 	switch (buffer[0]) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 057/328] video: udlfb: Fix unaligned access
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 020/328] leds: max8997: use mode when calling max8997_led_set_mode Ben Hutchings
                   ` (326 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Ladislav Michl, Bernie Thompson, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ladislav Michl <ladis@linux-mips.org>

commit 115e77597efcc94cb1f6cbb7df5cf7ce8feb8632 upstream.

Driver generates lots of alignment trap exceptions on ARM.
Fix that by replacing typecasting of odd addresses with
byte shifting and remove uneccessary typecasting.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Cc: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -443,9 +443,9 @@ static void dlfb_compress_hline(
 
 		*cmd++ = 0xAF;
 		*cmd++ = 0x6B;
-		*cmd++ = (uint8_t) ((dev_addr >> 16) & 0xFF);
-		*cmd++ = (uint8_t) ((dev_addr >> 8) & 0xFF);
-		*cmd++ = (uint8_t) ((dev_addr) & 0xFF);
+		*cmd++ = dev_addr >> 16;
+		*cmd++ = dev_addr >> 8;
+		*cmd++ = dev_addr;
 
 		cmd_pixels_count_byte = cmd++; /*  we'll know this later */
 		cmd_pixel_start = pixel;
@@ -462,8 +462,8 @@ static void dlfb_compress_hline(
 		while (pixel < cmd_pixel_end) {
 			const uint16_t * const repeating_pixel = pixel;
 
-			*(uint16_t *)cmd = cpu_to_be16p(pixel);
-			cmd += 2;
+			*cmd++ = *pixel >> 8;
+			*cmd++ = *pixel;
 			pixel++;
 
 			if (unlikely((pixel < cmd_pixel_end) &&
@@ -1532,15 +1532,16 @@ static int dlfb_parse_vendor_descriptor(
 			u8 length;
 			u16 key;
 
-			key = le16_to_cpu(*((u16 *) desc));
-			desc += sizeof(u16);
-			length = *desc;
-			desc++;
+			key = *desc++;
+			key |= (u16)*desc++ << 8;
+			length = *desc++;
 
 			switch (key) {
 			case 0x0200: { /* max_area */
-				u32 max_area;
-				max_area = le32_to_cpu(*((u32 *)desc));
+				u32 max_area = *desc++;
+				max_area |= (u32)*desc++ << 8;
+				max_area |= (u32)*desc++ << 16;
+				max_area |= (u32)*desc++ << 24;
 				pr_warn("DL chip limited to %d pixel modes\n",
 					max_area);
 				dev->sku_pixel_limit = max_area;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 129/328] net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (277 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 257/328] regulator: fix crash caused by null driver data Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 123/328] powerpc: Fix size calculation using resource_size() Ben Hutchings
                   ` (48 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dominique Martinet, syzbot+39749ed7d9ef6dfb23f6,
	Tomas Bortoli, Yiwen Jiang

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Tomas Bortoli <tomasbortoli@gmail.com>

commit 430ac66eb4c5b5c4eb846b78ebf65747510b30f1 upstream.

The patch adds the flush in p9_mux_poll_stop() as it the function used by
p9_conn_destroy(), in turn called by p9_fd_close() to stop the async
polling associated with the data regarding the connection.

Link: http://lkml.kernel.org/r/20180720092730.27104-1-tomasbortoli@gmail.com
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+39749ed7d9ef6dfb23f6@syzkaller.appspotmail.com
To: Eric Van Hensbergen <ericvh@gmail.com>
To: Ron Minnich <rminnich@sandia.gov>
To: Latchesar Ionkov <lucho@ionkov.net>
Cc: Yiwen Jiang <jiangyiwen@huwei.com>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/9p/trans_fd.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -185,6 +185,8 @@ static void p9_mux_poll_stop(struct p9_c
 	spin_lock_irqsave(&p9_poll_lock, flags);
 	list_del_init(&m->poll_pending_link);
 	spin_unlock_irqrestore(&p9_poll_lock, flags);
+
+	flush_work(&p9_poll_work);
 }
 
 /**


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 117/328] cifs: add missing debug entries for kconfig options
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (74 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 051/328] PCI: pciehp: Fix use-after-free on unplug Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 108/328] percpu_counter: batch size aware __percpu_counter_compare() Ben Hutchings
                   ` (251 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Ronnie Sahlberg, Paulo Alcantara, Steve French, Pavel Shilovsky

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steve French <stfrench@microsoft.com>

commit 950132afd59385caf6e2b84e5235d069fa10681d upstream.

/proc/fs/cifs/DebugData displays the features (Kconfig options)
used to build cifs.ko but it was missing some, and needed comma
separator.  These can be useful in debugging certain problems
so we know which optional features were enabled in the user's build.
Also clarify them, by making them more closely match the
corresponding CONFIG_CIFS_* parm.

Old format:
Features: dfs fscache posix spnego xattr acl

New format:
Features: DFS,FSCACHE,SMB_DIRECT,STATS,DEBUG2,ALLOW_INSECURE_LEGACY,CIFS_POSIX,UPCALL(SPNEGO),XATTR,ACL

Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Paulo Alcantara <palcantara@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cifs/cifs_debug.c | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -141,25 +141,41 @@ static int cifs_debug_data_proc_show(str
 	seq_printf(m, "CIFS Version %s\n", CIFS_VERSION);
 	seq_printf(m, "Features:");
 #ifdef CONFIG_CIFS_DFS_UPCALL
-	seq_printf(m, " dfs");
+	seq_printf(m, " DFS");
 #endif
 #ifdef CONFIG_CIFS_FSCACHE
-	seq_printf(m, " fscache");
+	seq_printf(m, ",FSCACHE");
+#endif
+#ifdef CONFIG_CIFS_SMB_DIRECT
+	seq_printf(m, ",SMB_DIRECT");
+#endif
+#ifdef CONFIG_CIFS_STATS2
+	seq_printf(m, ",STATS2");
+#elif defined(CONFIG_CIFS_STATS)
+	seq_printf(m, ",STATS");
+#endif
+#ifdef CONFIG_CIFS_DEBUG2
+	seq_printf(m, ",DEBUG2");
+#elif defined(CONFIG_CIFS_DEBUG)
+	seq_printf(m, ",DEBUG");
+#endif
+#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+	seq_printf(m, ",ALLOW_INSECURE_LEGACY");
 #endif
 #ifdef CONFIG_CIFS_WEAK_PW_HASH
-	seq_printf(m, " lanman");
+	seq_printf(m, ",WEAK_PW_HASH");
 #endif
 #ifdef CONFIG_CIFS_POSIX
-	seq_printf(m, " posix");
+	seq_printf(m, ",CIFS_POSIX");
 #endif
 #ifdef CONFIG_CIFS_UPCALL
-	seq_printf(m, " spnego");
+	seq_printf(m, ",UPCALL(SPNEGO)");
 #endif
 #ifdef CONFIG_CIFS_XATTR
-	seq_printf(m, " xattr");
+	seq_printf(m, ",XATTR");
 #endif
 #ifdef CONFIG_CIFS_ACL
-	seq_printf(m, " acl");
+	seq_printf(m, ",ACL");
 #endif
 	seq_putc(m, '\n');
 	seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 051/328] PCI: pciehp: Fix use-after-free on unplug
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (73 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 154/328] fs/quota: Fix spectre gadget in do_quotactl Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 117/328] cifs: add missing debug entries for kconfig options Ben Hutchings
                   ` (252 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Bjorn Helgaas, Lukas Wunner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Lukas Wunner <lukas@wunner.de>

commit 281e878eab191cce4259abbbf1a0322e3adae02c upstream.

When pciehp is unbound (e.g. on unplug of a Thunderbolt device), the
hotplug_slot struct is deregistered and thus freed before freeing the
IRQ.  The IRQ handler and the work items it schedules print the slot
name referenced from the freed structure in various informational and
debug log messages, each time resulting in a quadruple dereference of
freed pointers (hotplug_slot -> pci_slot -> kobject -> name).

At best the slot name is logged as "(null)", at worst kernel memory is
exposed in logs or the driver crashes:

  pciehp 0000:10:00.0:pcie204: Slot((null)): Card not present

An attacker may provoke the bug by unplugging multiple devices on a
Thunderbolt daisy chain at once.  Unplugging can also be simulated by
powering down slots via sysfs.  The bug is particularly easy to trigger
in poll mode.

It has been present since the driver's introduction in 2004:
https://git.kernel.org/tglx/history/c/c16b4b14d980

Fix by rearranging teardown such that the IRQ is freed first.  Run the
work items queued by the IRQ handler to completion before freeing the
hotplug_slot struct by draining the work queue from the ->release_slot
callback which is invoked by pci_hp_deregister().

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -141,6 +141,7 @@ int pciehp_unconfigure_device(struct slo
 void pciehp_queue_pushbutton_work(struct work_struct *work);
 struct controller *pcie_init(struct pcie_device *dev);
 int pcie_init_notification(struct controller *ctrl);
+void pcie_shutdown_notification(struct controller *ctrl);
 int pciehp_enable_slot(struct slot *p_slot);
 int pciehp_disable_slot(struct slot *p_slot);
 void pcie_reenable_notification(struct controller *ctrl);
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -82,6 +82,10 @@ static void release_slot(struct hotplug_
 	ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n",
 		 __func__, hotplug_slot_name(hotplug_slot));
 
+	/* queued work needs hotplug_slot name */
+	cancel_delayed_work(&slot->work);
+	drain_workqueue(slot->wq);
+
 	kfree(hotplug_slot->ops);
 	kfree(hotplug_slot->info);
 	kfree(hotplug_slot);
@@ -313,6 +317,7 @@ static void pciehp_remove(struct pcie_de
 {
 	struct controller *ctrl = get_service_data(dev);
 
+	pcie_shutdown_notification(ctrl);
 	cleanup_slot(ctrl);
 	pciehp_release_ctrl(ctrl);
 }
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -687,7 +687,7 @@ int pcie_init_notification(struct contro
 	return 0;
 }
 
-static void pcie_shutdown_notification(struct controller *ctrl)
+void pcie_shutdown_notification(struct controller *ctrl)
 {
 	if (ctrl->notification_enabled) {
 		pcie_disable_notification(ctrl);
@@ -722,7 +722,7 @@ abort:
 static void pcie_cleanup_slot(struct controller *ctrl)
 {
 	struct slot *slot = ctrl->slot;
-	cancel_delayed_work(&slot->work);
+
 	destroy_workqueue(slot->wq);
 	kfree(slot);
 }
@@ -846,7 +846,6 @@ abort:
 
 void pciehp_release_ctrl(struct controller *ctrl)
 {
-	pcie_shutdown_notification(ctrl);
 	pcie_cleanup_slot(ctrl);
 	kfree(ctrl);
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 127/328] net/9p/client.c: version pointer uninitialized
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (149 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 047/328] xen-netfront: fix queue name setting Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 073/328] fuse: Fix oops at process_init_reply() Ben Hutchings
                   ` (176 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Tomas Bortoli, Latchesar Ionkov, Ron Minnich,
	syzbot+65c6b72f284a39d416b4, Jun Piao, Dominique Martinet,
	Eric Van Hensbergen, Yiwen Jiang

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Tomas Bortoli <tomasbortoli@gmail.com>

commit 7913690dcc5e18e235769fd87c34143072f5dbea upstream.

The p9_client_version() does not initialize the version pointer. If the
call to p9pdu_readf() returns an error and version has not been allocated
in p9pdu_readf(), then the program will jump to the "error" label and will
try to free the version pointer. If version is not initialized, free()
will be called with uninitialized, garbage data and will provoke a crash.

Link: http://lkml.kernel.org/r/20180709222943.19503-1-tomasbortoli@gmail.com
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+65c6b72f284a39d416b4@syzkaller.appspotmail.com
Reviewed-by: Jun Piao <piaojun@huawei.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/9p/client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -938,7 +938,7 @@ static int p9_client_version(struct p9_c
 {
 	int err = 0;
 	struct p9_req_t *req;
-	char *version;
+	char *version = NULL;
 	int msize;
 
 	p9_debug(P9_DEBUG_9P, ">>> TVERSION msize %d protocol %d\n",


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 081/328] partitions/aix: fix usage of uninitialized lv_info and lvname structures
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (111 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 044/328] mtdchar: fix overflows in adjustment of `count` Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 179/328] x86/microcode: Update the new microcode revision unconditionally Ben Hutchings
                   ` (214 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jens Axboe, Mauricio Faria de Oliveira

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mauricio Faria de Oliveira <mfo@canonical.com>

commit 14cb2c8a6c5dae57ee3e2da10fa3db2b9087e39e upstream.

The if-block that sets a successful return value in aix_partition()
uses 'lvip[].pps_per_lv' and 'n[].name' potentially uninitialized.

For example, if 'numlvs' is zero or alloc_lvn() fails, neither is
initialized, but are used anyway if alloc_pvd() succeeds after it.

So, make the alloc_pvd() call conditional on their initialization.

This has been hit when attaching an apparently corrupted/stressed
AIX LUN, misleading the kernel to pr_warn() invalid data and hang.

    [...] partition (null) (11 pp's found) is not contiguous
    [...] partition (null) (2 pp's found) is not contiguous
    [...] partition (null) (3 pp's found) is not contiguous
    [...] partition (null) (64 pp's found) is not contiguous

Fixes: 6ceea22bbbc8 ("partitions: add aix lvm partition support files")
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 block/partitions/aix.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/block/partitions/aix.c
+++ b/block/partitions/aix.c
@@ -177,7 +177,7 @@ int aix_partition(struct parsed_partitio
 	u32 vgda_sector = 0;
 	u32 vgda_len = 0;
 	int numlvs = 0;
-	struct pvd *pvd;
+	struct pvd *pvd = NULL;
 	struct lv_info {
 		unsigned short pps_per_lv;
 		unsigned short pps_found;
@@ -231,10 +231,11 @@ int aix_partition(struct parsed_partitio
 				if (lvip[i].pps_per_lv)
 					foundlvs += 1;
 			}
+			/* pvd loops depend on n[].name and lvip[].pps_per_lv */
+			pvd = alloc_pvd(state, vgda_sector + 17);
 		}
 		put_dev_sector(sect);
 	}
-	pvd = alloc_pvd(state, vgda_sector + 17);
 	if (pvd) {
 		int numpps = be16_to_cpu(pvd->pp_count);
 		int psn_part1 = be32_to_cpu(pvd->psn_part1);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 193/328] iw_cxgb4: atomically flush the qp
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (247 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 312/328] USB: fix the usbfs flag sanitization for control transfers Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 102/328] ieee802154: 6lowpan: ensure header compression does not corrupt ipv6 header Ben Hutchings
                   ` (78 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Doug Ledford, Steve Wise

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steve Wise <swise@opengridcomputing.com>

commit bc52e9ca74b9a395897bb640c6671b2cbf716032 upstream.

__flush_qp() has a race condition where during the flush operation,
the qp lock is released allowing another thread to possibly post a WR,
which corrupts the queue state, possibly causing crashes.  The lock was
released to preserve the cq/qp locking hierarchy of cq first, then qp.
However releasing the qp lock is not necessary; both RQ and SQ CQ locks
can be acquired first, followed by the qp lock, and then the RQ and SQ
flushing can be done w/o unlocking.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/hw/cxgb4/qp.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1071,31 +1071,34 @@ static void __flush_qp(struct c4iw_qp *q
 
 	PDBG("%s qhp %p rchp %p schp %p\n", __func__, qhp, rchp, schp);
 
-	/* locking hierarchy: cq lock first, then qp lock. */
+	/* locking hierarchy: cqs lock first, then qp lock. */
 	spin_lock_irqsave(&rchp->lock, flag);
+	if (schp != rchp)
+		spin_lock(&schp->lock);
 	spin_lock(&qhp->lock);
 
 	if (qhp->wq.flushed) {
 		spin_unlock(&qhp->lock);
+		if (schp != rchp)
+			spin_unlock(&schp->lock);
 		spin_unlock_irqrestore(&rchp->lock, flag);
 		return;
 	}
 	qhp->wq.flushed = 1;
+	t4_set_wq_in_error(&qhp->wq);
 
 	c4iw_flush_hw_cq(rchp, qhp);
 	c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
 	rq_flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
-	spin_unlock(&qhp->lock);
-	spin_unlock_irqrestore(&rchp->lock, flag);
 
-	/* locking hierarchy: cq lock first, then qp lock. */
-	spin_lock_irqsave(&schp->lock, flag);
-	spin_lock(&qhp->lock);
 	if (schp != rchp)
 		c4iw_flush_hw_cq(schp, qhp);
 	sq_flushed = c4iw_flush_sq(qhp);
+
 	spin_unlock(&qhp->lock);
-	spin_unlock_irqrestore(&schp->lock, flag);
+	if (schp != rchp)
+		spin_unlock(&schp->lock);
+	spin_unlock_irqrestore(&rchp->lock, flag);
 
 	if (schp == rchp) {
 		if (t4_clear_cq_armed(&rchp->cq) &&
@@ -1129,8 +1132,8 @@ static void flush_qp(struct c4iw_qp *qhp
 	rchp = to_c4iw_cq(qhp->ibqp.recv_cq);
 	schp = to_c4iw_cq(qhp->ibqp.send_cq);
 
-	t4_set_wq_in_error(&qhp->wq);
 	if (qhp->ibqp.uobject) {
+		t4_set_wq_in_error(&qhp->wq);
 		t4_set_cq_in_error(&rchp->cq);
 		spin_lock_irqsave(&rchp->comp_handler_lock, flag);
 		(*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 121/328] b43/leds: Ensure NUL-termination of LED name string
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (27 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 299/328] Make file credentials available to the seqfile interfaces Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 292/328] drm: fb-helper: Reject all pixel format changing requests Ben Hutchings
                   ` (298 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Kalle Valo, Michael Büsch

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Büsch <m@bues.ch>

commit 2aa650d1950fce94f696ebd7db30b8830c2c946f upstream.

strncpy might not NUL-terminate the string, if the name equals the buffer size.
Use strlcpy instead.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/wireless/b43/leds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -131,7 +131,7 @@ static int b43_register_led(struct b43_w
 	led->wl = dev->wl;
 	led->index = led_index;
 	led->activelow = activelow;
-	strncpy(led->name, name, sizeof(led->name));
+	strlcpy(led->name, name, sizeof(led->name));
 	atomic_set(&led->state, 0);
 
 	led->led_dev.name = led->name;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 071/328] fuse: don't wake up reserved req in fuse_conn_kill()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (31 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 114/328] powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 284/328] xhci: Add missing CAS workaround for Intel Sunrise Point xHCI Ben Hutchings
                   ` (294 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Miklos Szeredi

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Miklos Szeredi <mszeredi@suse.cz>

commit 0c4dd4ba1426c599072511dcf95a15ee5e12725b upstream.

Waking up reserved_req_waitq from fuse_conn_kill() doesn't make sense since
we aren't chaging ff->reserved_req here, which is what this waitqueue
signals.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/fuse/inode.c | 1 -
 1 file changed, 1 deletion(-)

--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -387,7 +387,6 @@ void fuse_conn_kill(struct fuse_conn *fc
 	kill_fasync(&fc->fasync, SIGIO, POLL_IN);
 	wake_up_all(&fc->waitq);
 	wake_up_all(&fc->blocked_waitq);
-	wake_up_all(&fc->reserved_req_waitq);
 }
 EXPORT_SYMBOL_GPL(fuse_conn_kill);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 105/328] mac802154: tx: cleanup crc calculation
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (141 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 261/328] powerpc/pseries: Fix unitialized timer reset on migration Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 287/328] perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic Ben Hutchings
                   ` (184 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Marcel Holtmann, Alexander Aring

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Aring <alex.aring@gmail.com>

commit b7eec52bcb7ab93a8cce0f718f42fa17d6d91745 upstream.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -95,10 +95,9 @@ netdev_tx_t mac802154_tx(struct mac80215
 	mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb);
 
 	if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
-		u16 crc = crc_ccitt(0, skb->data, skb->len);
-		u8 *data = skb_put(skb, 2);
-		data[0] = crc & 0xff;
-		data[1] = crc >> 8;
+		__le16 crc = cpu_to_le16(crc_ccitt(0, skb->data, skb->len));
+
+		memcpy(skb_put(skb, 2), &crc, 2);
 	}
 
 	if (skb_cow_head(skb, priv->hw.extra_tx_headroom))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 199/328] usb: uas: add support for more quirk flags
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (18 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 050/328] PCI: hotplug: Don't leak pci_slot on registration failure Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 224/328] drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect() Ben Hutchings
                   ` (307 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Oliver Neukum, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Oliver Neukum <oneukum@suse.com>

commit 42d1c6d4a06a77b3ab206a919b9050c3080f3a71 upstream.

The hope that UAS devices would be less broken than old style storage
devices has turned out to be unfounded. Make UAS support more of the
quirk flags of the old driver.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/storage/uas.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -991,6 +991,26 @@ static int uas_slave_configure(struct sc
 	if (devinfo->flags & US_FL_BROKEN_FUA)
 		sdev->broken_fua = 1;
 
+	/*
+	 * Some disks return the total number of blocks in response
+	 * to READ CAPACITY rather than the highest block number.
+	 * If this device makes that mistake, tell the sd driver.
+	 */
+	if (devinfo->flags & US_FL_FIX_CAPACITY)
+		sdev->fix_capacity = 1;
+
+	/*
+	 * Some devices don't like MODE SENSE with page=0x3f,
+	 * which is the command used for checking if a device
+	 * is write-protected.  Now that we tell the sd driver
+	 * to do a 192-byte transfer with this command the
+	 * majority of devices work fine, but a few still can't
+	 * handle it.  The sd driver will simply assume those
+	 * devices are write-enabled.
+	 */
+	if (devinfo->flags & US_FL_NO_WP_DETECT)
+		sdev->skip_ms_page_3f = 1;
+
 	scsi_set_tag_type(sdev, MSG_ORDERED_TAG);
 	scsi_activate_tcq(sdev, devinfo->qdepth - 2);
 	return 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 075/328] fuse: Add missed unlock_page() to fuse_readpages_fill()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (296 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 310/328] net: ipv4: update fnhe_pmtu when first hop's MTU changes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 302/328] ocfs2: fix locking for res->tracking and dlm->tracking_list Ben Hutchings
                   ` (29 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Kirill Tkhai, Miklos Szeredi

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Kirill Tkhai <ktkhai@virtuozzo.com>

commit 109728ccc5933151c68d1106e4065478a487a323 upstream.

The above error path returns with page unlocked, so this place seems also
to behave the same.

Fixes: f8dbdf81821b ("fuse: rework fuse_readpages()")
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/fuse/file.c | 1 +
 1 file changed, 1 insertion(+)

--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -911,6 +911,7 @@ static int fuse_readpages_fill(void *_da
 	}
 
 	if (WARN_ON(req->num_pages >= req->max_pages)) {
+		unlock_page(page);
 		fuse_put_request(fc, req);
 		return -EIO;
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 044/328] mtdchar: fix overflows in adjustment of `count`
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (110 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 150/328] x86/process: Re-export start_thread() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 081/328] partitions/aix: fix usage of uninitialized lv_info and lvname structures Ben Hutchings
                   ` (215 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Boris Brezillon, Jann Horn

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jann Horn <jannh@google.com>

commit 6c6bc9ea84d0008024606bf5ba10519e20d851bf upstream.

The first checks in mtdchar_read() and mtdchar_write() attempt to limit
`count` such that `*ppos + count <= mtd->size`. However, they ignore the
possibility of `*ppos > mtd->size`, allowing the calculation of `count` to
wrap around. `mtdchar_lseek()` prevents seeking beyond mtd->size, but the
pread/pwrite syscalls bypass this.

I haven't found any codepath on which this actually causes dangerous
behavior, but it seems like a sensible change anyway.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/mtd/mtdchar.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -190,8 +190,12 @@ static ssize_t mtdchar_read(struct file
 
 	pr_debug("MTD_read\n");
 
-	if (*ppos + count > mtd->size)
-		count = mtd->size - *ppos;
+	if (*ppos + count > mtd->size) {
+		if (*ppos < mtd->size)
+			count = mtd->size - *ppos;
+		else
+			count = 0;
+	}
 
 	if (!count)
 		return 0;
@@ -276,7 +280,7 @@ static ssize_t mtdchar_write(struct file
 
 	pr_debug("MTD_write\n");
 
-	if (*ppos == mtd->size)
+	if (*ppos >= mtd->size)
 		return -ENOSPC;
 
 	if (*ppos + count > mtd->size)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 114/328] powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX.
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (30 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 011/328] serial: pxa: Fix an error handling path in 'serial_pxa_probe()' Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 071/328] fuse: don't wake up reserved req in fuse_conn_kill() Ben Hutchings
                   ` (295 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Michal Suchanek, Mahesh Salgaonkar, Michael Ellerman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

commit 74e96bf44f430cf7a01de19ba6cf49b361cdfd6e upstream.

The global mce data buffer that used to copy rtas error log is of 2048
(RTAS_ERROR_LOG_MAX) bytes in size. Before the copy we read
extended_log_length from rtas error log header, then use max of
extended_log_length and RTAS_ERROR_LOG_MAX as a size of data to be copied.
Ideally the platform (phyp) will never send extended error log with
size > 2048. But if that happens, then we have a risk of buffer overrun
and corruption. Fix this by using min_t instead.

Fixes: d368514c3097 ("powerpc: Fix corruption when grabbing FWNMI data")
Reported-by: Michal Suchanek <msuchanek@suse.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/platforms/pseries/ras.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -309,7 +309,7 @@ static struct rtas_error_log *fwnmi_get_
 		int len, error_log_length;
 
 		error_log_length = 8 + rtas_error_extended_log_length(h);
-		len = max_t(int, error_log_length, RTAS_ERROR_LOG_MAX);
+		len = min_t(int, error_log_length, RTAS_ERROR_LOG_MAX);
 		memset(global_mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
 		memcpy(global_mce_data_buf, h, len);
 		errhdr = (struct rtas_error_log *)global_mce_data_buf;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 207/328] usb: Avoid use-after-free by flushing endpoints early in usb_set_interface()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (124 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 242/328] pppoe: fix reception of frames with no mac header Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 060/328] udlfb: don't switch if we are switching to the same videomode Ben Hutchings
                   ` (201 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Greg Kroah-Hartman, Mathias Nyman, Sudip Mukherjee, Alan Stern

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit f9a5b4f58b280c1d26255376713c132f93837621 upstream.

The steps taken by usb core to set a new interface is very different from
what is done on the xHC host side.

xHC hardware will do everything in one go. One command is used to set up
new endpoints, free old endpoints, check bandwidth, and run the new
endpoints.

All this is done by xHC when usb core asks the hcd to check for
available bandwidth. At this point usb core has not yet flushed the old
endpoints, which will cause use-after-free issues in xhci driver as
queued URBs are cancelled on a re-allocated endpoint.

To resolve this add a call to usb_disable_interface() which will flush
the endpoints before calling usb_hcd_alloc_bandwidth()

Additional checks in xhci driver will also be implemented to gracefully
handle stale URB cancel on freed and re-allocated endpoints

Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/message.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1284,6 +1284,11 @@ void usb_enable_interface(struct usb_dev
  * is submitted that needs that bandwidth.  Some other operating systems
  * allocate bandwidth early, when a configuration is chosen.
  *
+ * xHCI reserves bandwidth and configures the alternate setting in
+ * usb_hcd_alloc_bandwidth(). If it fails the original interface altsetting
+ * may be disabled. Drivers cannot rely on any particular alternate
+ * setting being in effect after a failure.
+ *
  * This call is synchronous, and may not be used in an interrupt context.
  * Also, drivers must not change altsettings while urbs are scheduled for
  * endpoints in that interface; all such urbs must first be completed
@@ -1319,6 +1324,12 @@ int usb_set_interface(struct usb_device
 			 alternate);
 		return -EINVAL;
 	}
+	/*
+	 * usb3 hosts configure the interface in usb_hcd_alloc_bandwidth,
+	 * including freeing dropped endpoint ring buffers.
+	 * Make sure the interface endpoints are flushed before that
+	 */
+	usb_disable_interface(dev, iface, false);
 
 	/* Make sure we have enough bandwidth for this alternate interface.
 	 * Remove the current alt setting and add the new alt setting.


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 073/328] fuse: Fix oops at process_init_reply()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (150 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 127/328] net/9p/client.c: version pointer uninitialized Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 009/328] platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too Ben Hutchings
                   ` (175 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Miklos Szeredi, syzbot

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Miklos Szeredi <mszeredi@redhat.com>

commit e8f3bd773d22f488724dffb886a1618da85c2966 upstream.

syzbot is hitting NULL pointer dereference at process_init_reply().
This is because deactivate_locked_super() is called before response for
initial request is processed.

Fix this by aborting and waiting for all requests (including FUSE_INIT)
before resetting fc->sb.

Original patch by Tetsuo Handa <penguin-kernel@I-love.SKAURA.ne.jp>.

Reported-by: syzbot <syzbot+b62f08f4d5857755e3bc@syzkaller.appspotmail.com>
Fixes: e27c9d3877a0 ("fuse: fuse: add time_gran to INIT_OUT")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
[bwh: Backported to 3.16:
 - Drop second argument to fuse_abort_conn()
 - fuse_wait_aborted() is not needed]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -380,9 +380,6 @@ static void fuse_put_super(struct super_
 {
 	struct fuse_conn *fc = get_fuse_conn_super(sb);
 
-	fuse_send_destroy(fc);
-
-	fuse_abort_conn(fc);
 	mutex_lock(&fuse_mutex);
 	list_del(&fc->entry);
 	fuse_ctl_remove_conn(fc);
@@ -1124,16 +1121,24 @@ static struct dentry *fuse_mount(struct
 	return mount_nodev(fs_type, flags, raw_data, fuse_fill_super);
 }
 
-static void fuse_kill_sb_anon(struct super_block *sb)
+static void fuse_sb_destroy(struct super_block *sb)
 {
 	struct fuse_conn *fc = get_fuse_conn_super(sb);
 
 	if (fc) {
+		fuse_send_destroy(fc);
+
+		fuse_abort_conn(fc);
+
 		down_write(&fc->killsb);
 		fc->sb = NULL;
 		up_write(&fc->killsb);
 	}
+}
 
+static void fuse_kill_sb_anon(struct super_block *sb)
+{
+	fuse_sb_destroy(sb);
 	kill_anon_super(sb);
 }
 
@@ -1156,14 +1161,7 @@ static struct dentry *fuse_mount_blk(str
 
 static void fuse_kill_sb_blk(struct super_block *sb)
 {
-	struct fuse_conn *fc = get_fuse_conn_super(sb);
-
-	if (fc) {
-		down_write(&fc->killsb);
-		fc->sb = NULL;
-		up_write(&fc->killsb);
-	}
-
+	fuse_sb_destroy(sb);
 	kill_block_super(sb);
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 046/328] MIPS: Correct the 64-bit DSP accumulator register size
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (230 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 291/328] smb2: fix missing files in root share directory listing Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 084/328] net: mvneta: fix mtu change on port without link Ben Hutchings
                   ` (95 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Maciej W. Rozycki, Paul Burton, linux-fsdevel,
	Ralf Baechle, Alexander Viro, linux-mips, James Hogan

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Maciej W. Rozycki" <macro@mips.com>

commit f5958b4cf4fc38ed4583ab83fb7c4cd1ab05f47b upstream.

Use the `unsigned long' rather than `__u32' type for DSP accumulator
registers, like with the regular MIPS multiply/divide accumulator and
general-purpose registers, as all are 64-bit in 64-bit implementations
and using a 32-bit data type leads to contents truncation on context
saving.

Update `arch_ptrace' and `compat_arch_ptrace' accordingly, removing
casts that are similarly not used with multiply/divide accumulator or
general-purpose register accesses.

Signed-off-by: Maciej W. Rozycki <macro@mips.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: e50c0a8fa60d ("Support the MIPS32 / MIPS64 DSP ASE.")
Patchwork: https://patchwork.linux-mips.org/patch/19329/
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/mips/include/asm/processor.h | 2 +-
 arch/mips/kernel/ptrace.c         | 2 +-
 arch/mips/kernel/ptrace32.c       | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -143,7 +143,7 @@ struct mips_fpu_struct {
 
 #define NUM_DSP_REGS   6
 
-typedef __u32 dspreg_t;
+typedef unsigned long dspreg_t;
 
 struct mips_dsp_state {
 	dspreg_t	dspr[NUM_DSP_REGS];
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -790,7 +790,7 @@ long arch_ptrace(struct task_struct *chi
 				goto out;
 			}
 			dregs = __get_dsp_regs(child);
-			tmp = (unsigned long) (dregs[addr - DSP_BASE]);
+			tmp = dregs[addr - DSP_BASE];
 			break;
 		}
 		case DSP_CONTROL:
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -140,7 +140,7 @@ long compat_arch_ptrace(struct task_stru
 				goto out;
 			}
 			dregs = __get_dsp_regs(child);
-			tmp = (unsigned long) (dregs[addr - DSP_BASE]);
+			tmp = dregs[addr - DSP_BASE];
 			break;
 		}
 		case DSP_CONTROL:


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 122/328] b43legacy/leds: Ensure NUL-termination of LED name string
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (156 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 014/328] IB/srpt: Support HCAs with more than two ports Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 254/328] USB: remove LPM management from usb_driver_claim_interface() Ben Hutchings
                   ` (169 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Kalle Valo, Michael Büsch

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Michael Büsch <m@bues.ch>

commit 4d77a89e3924b12f4a5628b21237e57ab4703866 upstream.

strncpy might not NUL-terminate the string, if the name equals the buffer size.
Use strlcpy instead.

Signed-off-by: Michael Buesch <m@bues.ch>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/wireless/b43legacy/leds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/b43legacy/leds.c
+++ b/drivers/net/wireless/b43legacy/leds.c
@@ -101,7 +101,7 @@ static int b43legacy_register_led(struct
 	led->dev = dev;
 	led->index = led_index;
 	led->activelow = activelow;
-	strncpy(led->name, name, sizeof(led->name));
+	strlcpy(led->name, name, sizeof(led->name));
 
 	led->led_dev.name = led->name;
 	led->led_dev.default_trigger = default_trigger;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 143/328] s390/pci: fix out of bounds access during irq setup
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (223 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 004/328] audit: Fix extended comparison of GID/EGID Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 048/328] ALSA: memalloc: Don't exceed over the requested size Ben Hutchings
                   ` (102 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Heiko Carstens, Sebastian Ott

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sebastian Ott <sebott@linux.ibm.com>

commit 866f3576a72b2233a76dffb80290f8086dc49e17 upstream.

During interrupt setup we allocate interrupt vectors, walk the list of msi
descriptors, and fill in the message data. Requesting more interrupts than
supported on s390 can lead to an out of bounds access.

When we restrict the number of interrupts we should also stop walking the
msi list after all supported interrupts are handled.

Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/s390/pci/pci.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -397,6 +397,8 @@ int arch_setup_msi_irqs(struct pci_dev *
 	hwirq = 0;
 	list_for_each_entry(msi, &pdev->msi_list, list) {
 		rc = -EIO;
+		if (hwirq >= msi_vecs)
+			break;
 		irq = irq_alloc_desc(0);	/* Alloc irq on node 0 */
 		if (irq < 0)
 			goto out_msi;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 109/328] btrfs: use correct compare function of dirty_metadata_bytes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (86 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 168/328] USB: serial: ti_usb_3410_5052: fix array underflow in completion handler Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 164/328] x86/spectre: Add missing family 6 check to microcode check Ben Hutchings
                   ` (239 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Ethan Lien, David Sterba, Nikolay Borisov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ethan Lien <ethanlien@synology.com>

commit d814a49198eafa6163698bdd93961302f3a877a4 upstream.

We use customized, nodesize batch value to update dirty_metadata_bytes.
We should also use batch version of compare function or we will easily
goto fast path and get false result from percpu_counter_compare().

Fixes: e2d845211eda ("Btrfs: use percpu counter for dirty metadata count")
Signed-off-by: Ethan Lien <ethanlien@synology.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[bwh: Backported to 3.16: In __btrfs_btree_balance_dirty(), use
 root->fs_info instead of fs_info]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/btrfs/disk-io.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -991,8 +991,9 @@ static int btree_writepages(struct addre
 
 		fs_info = BTRFS_I(mapping->host)->root->fs_info;
 		/* this is a bit racy, but that's ok */
-		ret = percpu_counter_compare(&fs_info->dirty_metadata_bytes,
-					     BTRFS_DIRTY_METADATA_THRESH);
+		ret = __percpu_counter_compare(&fs_info->dirty_metadata_bytes,
+					     BTRFS_DIRTY_METADATA_THRESH,
+					     fs_info->dirty_metadata_batch);
 		if (ret < 0)
 			return 0;
 	}
@@ -3793,8 +3794,9 @@ static void __btrfs_btree_balance_dirty(
 	if (flush_delayed)
 		btrfs_balance_delayed_items(root);
 
-	ret = percpu_counter_compare(&root->fs_info->dirty_metadata_bytes,
-				     BTRFS_DIRTY_METADATA_THRESH);
+	ret = __percpu_counter_compare(&root->fs_info->dirty_metadata_bytes,
+				     BTRFS_DIRTY_METADATA_THRESH,
+				     root->fs_info->dirty_metadata_batch);
 	if (ret > 0) {
 		balance_dirty_pages_ratelimited(
 				   root->fs_info->btree_inode->i_mapping);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 183/328] smb3: check for and properly advertise directory lease support
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (23 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 153/328] iscsi target: fix session creation failure handling Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 282/328] mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys Ben Hutchings
                   ` (302 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Steve French, Ronnie Sahlberg

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steve French <stfrench@microsoft.com>

commit f801568332321e2b1e7a8bd26c3e4913a312a2ec upstream.

Although servers will typically ignore unsupported features,
we should advertise the support for directory leases (as
Windows e.g. does) in the negotiate protocol capabilities we
pass to the server, and should check for the server capability
(CAP_DIRECTORY_LEASING) before sending a lease request for an
open of a directory.  This will prevent us from accidentally
sending directory leases to SMB2.1 or SMB2 server for example.

Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
[bwh: Backported to 3.16:
 - Drop changes to smb3any_values, smbdefault_values, smb311_values
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1433,7 +1433,7 @@ struct smb_version_values smb21_values =
 struct smb_version_values smb30_values = {
 	.version_string = SMB30_VERSION_STRING,
 	.protocol_id = SMB30_PROT_ID,
-	.req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU,
+	.req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_DIRECTORY_LEASING,
 	.large_lock_type = 0,
 	.exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK,
 	.shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK,
@@ -1453,7 +1453,7 @@ struct smb_version_values smb30_values =
 struct smb_version_values smb302_values = {
 	.version_string = SMB302_VERSION_STRING,
 	.protocol_id = SMB302_PROT_ID,
-	.req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU,
+	.req_capabilities = SMB2_GLOBAL_CAP_DFS | SMB2_GLOBAL_CAP_LEASING | SMB2_GLOBAL_CAP_LARGE_MTU | SMB2_GLOBAL_CAP_DIRECTORY_LEASING,
 	.large_lock_type = 0,
 	.exclusive_lock_type = SMB2_LOCKFLAG_EXCLUSIVE_LOCK,
 	.shared_lock_type = SMB2_LOCKFLAG_SHARED_LOCK,
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1211,6 +1211,9 @@ SMB2_open(const unsigned int xid, struct
 	if (!(server->capabilities & SMB2_GLOBAL_CAP_LEASING) ||
 	    *oplock == SMB2_OPLOCK_LEVEL_NONE)
 		req->RequestedOplockLevel = *oplock;
+	else if (!(server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING) &&
+		  (oparms->create_options & CREATE_NOT_FILE))
+		req->RequestedOplockLevel = *oplock; /* no srv lease support */
 	else {
 		rc = add_lease_context(server, iov, &num_iovecs,
 				       oparms->fid->lease_key, oplock);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 077/328] scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (282 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 240/328] ext4: don't mark mmp buffer head dirty Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 214/328] batman-adv: Use kref_get for batadv_nc_get_nc_node Ben Hutchings
                   ` (43 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Edwards, Jens Axboe, Martin K. Petersen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Greg Edwards <gedwards@ddn.com>

commit cdcdcaae8450a975e7d07e1bfec21f9b8c016d0c upstream.

When the underlying device is a 4 KiB logical block size device with a
protection interval exponent of 0, i.e. 4096 bytes data + 8 bytes PI, the
driver miscalculates the pi_bytes{out,in} by a factor of 8x (64 bytes).

This leads to errors on all reads and writes on 4 KiB logical block size
devices when CONFIG_BLK_DEV_INTEGRITY is enabled and the
VIRTIO_SCSI_F_T10_PI feature bit has been negotiated.

Fixes: e6dc783a38ec0 ("virtio-scsi: Enable DIF/DIX modes in SCSI host LLD")
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Edwards <gedwards@ddn.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -500,9 +500,11 @@ static void virtio_scsi_init_hdr_pi(stru
 	bi = blk_get_integrity(rq->rq_disk);
 
 	if (sc->sc_data_direction == DMA_TO_DEVICE)
-		cmd_pi->pi_bytesout = blk_rq_sectors(rq) * bi->tuple_size;
+		cmd_pi->pi_bytesout = bio_integrity_bytes(bi,
+							blk_rq_sectors(rq));
 	else if (sc->sc_data_direction == DMA_FROM_DEVICE)
-		cmd_pi->pi_bytesin = blk_rq_sectors(rq) * bi->tuple_size;
+		cmd_pi->pi_bytesin = bio_integrity_bytes(bi,
+							blk_rq_sectors(rq));
 }
 
 static int virtscsi_queuecommand(struct virtio_scsi *vscsi,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 202/328] spi: rspi: Fix invalid SPI use during system suspend
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (43 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 175/328] ipmi: Move BT capabilities detection to the detect call Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 219/328] batman-adv: Prevent duplicated global TT entry Ben Hutchings
                   ` (282 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mark Brown, Geert Uytterhoeven

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit c1ca59c22c56930b377a665fdd1b43351887830b upstream.

If the SPI queue is running during system suspend, the system may lock
up.

Fix this by stopping/restarting the queue during system suspend/resume,
by calling spi_master_suspend()/spi_master_resume() from the PM
callbacks.  In-kernel users will receive an -ESHUTDOWN error while
system suspend/resume is in progress.

Based on a patch for sh-msiof by Gaku Inami.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/spi/spi-rspi.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -1158,6 +1158,29 @@ static struct platform_device_id spi_dri
 
 MODULE_DEVICE_TABLE(platform, spi_driver_ids);
 
+#ifdef CONFIG_PM_SLEEP
+static int rspi_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct rspi_data *rspi = platform_get_drvdata(pdev);
+
+	return spi_master_suspend(rspi->master);
+}
+
+static int rspi_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct rspi_data *rspi = platform_get_drvdata(pdev);
+
+	return spi_master_resume(rspi->master);
+}
+
+static SIMPLE_DEV_PM_OPS(rspi_pm_ops, rspi_suspend, rspi_resume);
+#define DEV_PM_OPS	&rspi_pm_ops
+#else
+#define DEV_PM_OPS	NULL
+#endif /* CONFIG_PM_SLEEP */
+
 static struct platform_driver rspi_driver = {
 	.probe =	rspi_probe,
 	.remove =	rspi_remove,
@@ -1165,6 +1188,7 @@ static struct platform_driver rspi_drive
 	.driver		= {
 		.name = "renesas_spi",
 		.owner	= THIS_MODULE,
+		.pm = DEV_PM_OPS,
 		.of_match_table = of_match_ptr(rspi_of_match),
 	},
 };


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 187/328] ext4: fix online resize's handling of a too-small final block group
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (96 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 296/328] ARC: clone syscall to setp r25 as thread pointer Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 317/328] cachefiles: fix the race between cachefiles_bury_object() and rmdir(2) Ben Hutchings
                   ` (229 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Theodore Ts'o, Torsten Hilbrich

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit f0a459dec5495a3580f8d784555e6f8f3bf7f263 upstream.

Avoid growing the file system to an extent so that the last block
group is too small to hold all of the metadata that must be stored in
the block group.

This problem can be triggered with the following reproducer:

umount /mnt
mke2fs -F -m0 -b 4096 -t ext4 -O resize_inode,^has_journal \
	-E resize=1073741824 /tmp/foo.img 128M
mount /tmp/foo.img /mnt
truncate --size 1708M /tmp/foo.img
resize2fs /dev/loop0 295400
umount /mnt
e2fsck -fy /tmp/foo.img

Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/resize.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1957,6 +1957,26 @@ retry:
 		}
 	}
 
+	/*
+	 * Make sure the last group has enough space so that it's
+	 * guaranteed to have enough space for all metadata blocks
+	 * that it might need to hold.  (We might not need to store
+	 * the inode table blocks in the last block group, but there
+	 * will be cases where this might be needed.)
+	 */
+	if ((ext4_group_first_block_no(sb, n_group) +
+	     ext4_group_overhead_blocks(sb, n_group) + 2 +
+	     sbi->s_itb_per_group + sbi->s_cluster_ratio) >= n_blocks_count) {
+		n_blocks_count = ext4_group_first_block_no(sb, n_group);
+		n_group--;
+		n_blocks_count_retry = 0;
+		if (resize_inode) {
+			iput(resize_inode);
+			resize_inode = NULL;
+		}
+		goto retry;
+	}
+
 	/* extend the last group */
 	if (n_group == o_group)
 		add = n_blocks_count - o_blocks_count;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 151/328] iscsi-target: nullify session in failed login sequence
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (270 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 018/328] alarmtimer: Prevent overflow for relative nanosleep Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 278/328] qlcnic: fix Tx descriptor corruption on 82xx devices Ben Hutchings
                   ` (55 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Sagi Grimberg, Nicholas Bellinger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sagi Grimberg <sagig@mellanox.com>

commit a0b3b9b2409b409c677f7eb1e0485b816a5848f7 upstream.

In case login sequence failed, make sure conn->sess is
NULL before calling wait_conn as some transports (iser)
may rely on that (waiting for session commands).

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/target/iscsi/iscsi_target_login.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -1209,6 +1209,7 @@ void iscsi_target_login_sess_out(struct
 	}
 	kfree(conn->sess->sess_ops);
 	kfree(conn->sess);
+	conn->sess = NULL;
 
 old_sess_out:
 	iscsi_stop_login_thread_timer(np);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 181/328] igmp: fix incorrect unsolicit report count after link down and up
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (159 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 064/328] udlfb: set line_length in dlfb_ops_set_par Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 017/328] crypto: vmac - separate tfm and request context Ben Hutchings
                   ` (166 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Hangbin Liu, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Hangbin Liu <liuhangbin@gmail.com>

commit ff06525fcb8ae3c302ac1319bf6c07c026dea964 upstream.

After link down and up, i.e. when call ip_mc_up(), we doesn't init
im->unsolicit_count. So after igmp_timer_expire(), we will not start
timer again and only send one unsolicit report at last.

Fix it by initializing im->unsolicit_count in igmp_group_added(), so
we can respect igmp robustness value.

Fixes: 24803f38a5c0b ("igmp: do not remove igmp souce list info when set link down")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16:
 - Keep using constant IGMP_Unsolicited_Report_Count
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1256,6 +1256,8 @@ static void igmp_group_added(struct ip_m
 
 	if (in_dev->dead)
 		return;
+
+	im->unsolicit_count = IGMP_Unsolicited_Report_Count;
 	if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) {
 		spin_lock_bh(&im->lock);
 		igmp_start_timer(im, IGMP_Initial_Report_Delay);
@@ -1360,7 +1362,6 @@ void ip_mc_inc_group(struct in_device *i
 	spin_lock_init(&im->lock);
 #ifdef CONFIG_IP_MULTICAST
 	setup_timer(&im->timer, &igmp_timer_expire, (unsigned long)im);
-	im->unsolicit_count = IGMP_Unsolicited_Report_Count;
 #endif
 
 	im->next_rcu = in_dev->mc_list;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 201/328] spi: sh-msiof: Fix handling of write value for SISTR register
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (134 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 323/328] wil6210: missing length check in wmi_set_ie Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 209/328] usb: misc: uss720: Fix two sleep-in-atomic-context bugs Ben Hutchings
                   ` (191 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Hiromitsu Yamasaki, Geert Uytterhoeven, Mark Brown

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Hiromitsu Yamasaki <hiromitsu.yamasaki.ym@renesas.com>

commit 31a5fae4c5a009898da6d177901d5328051641ff upstream.

This patch changes writing to the SISTR register according to the H/W
user's manual.

The TDREQ bit and RDREQ bits of SISTR are read-only, and must be written
their initial values of zero.

Signed-off-by: Hiromitsu Yamasaki <hiromitsu.yamasaki.ym@renesas.com>
[geert: reword]
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/spi/spi-sh-msiof.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -325,7 +325,8 @@ static void sh_msiof_spi_set_mode_regs(s
 
 static void sh_msiof_reset_str(struct sh_msiof_spi_priv *p)
 {
-	sh_msiof_write(p, STR, sh_msiof_read(p, STR));
+	sh_msiof_write(p, STR,
+		       sh_msiof_read(p, STR) & ~(STR_TDREQ | STR_RDREQ));
 }
 
 static void sh_msiof_spi_write_fifo_8(struct sh_msiof_spi_priv *p,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 198/328] USB: Add quirk to support DJI CineSSD
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (197 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 256/328] USB: handle NULL config in usb_find_alt_setting() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 115/328] dm cache metadata: save in-core policy_hint_size to on-disk superblock Ben Hutchings
                   ` (128 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Alan Stern, Tim Anderson

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Tim Anderson <tsa@biglakesoftware.com>

commit f45681f9becaa65111ed0a691ccf080a0cd5feb8 upstream.

This device does not correctly handle the LPM operations.

Also, the device cannot handle ATA pass-through commands
and locks up when attempted while running in super speed.

This patch adds the equivalent quirk logic as found in uas.

Signed-off-by: Tim Anderson <tsa@biglakesoftware.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/quirks.c          | 3 +++
 drivers/usb/storage/scsiglue.c     | 9 +++++++++
 drivers/usb/storage/unusual_devs.h | 7 +++++++
 3 files changed, 19 insertions(+)

--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -260,6 +260,9 @@ static const struct usb_device_id usb_qu
 	{ USB_DEVICE(0x2040, 0x7200), .driver_info =
 			USB_QUIRK_CONFIG_INTF_STRINGS },
 
+	/* DJI CineSSD */
+	{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
+
 	/* INTEL VALUE SSD */
 	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
 
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -341,6 +341,15 @@ static int queuecommand_lck(struct scsi_
 		return 0;
 	}
 
+	if ((us->fflags & US_FL_NO_ATA_1X) &&
+			(srb->cmnd[0] == ATA_12 || srb->cmnd[0] == ATA_16)) {
+		memcpy(srb->sense_buffer, usb_stor_sense_invalidCDB,
+		       sizeof(usb_stor_sense_invalidCDB));
+		srb->result = SAM_STAT_CHECK_CONDITION;
+		done(srb);
+		return 0;
+	}
+
 	/* enqueue the command and wake up the control thread */
 	srb->scsi_done = done;
 	us->srb = srb;
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2144,6 +2144,13 @@ UNUSUAL_DEV(  0x2735, 0x100b, 0x0000, 0x
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_GO_SLOW ),
 
+/* Reported-by: Tim Anderson <tsa@biglakesoftware.com> */
+UNUSUAL_DEV(  0x2ca3, 0x0031, 0x0000, 0x9999,
+		"DJI",
+		"CineSSD",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_ATA_1X),
+
 /* Reported by Frederic Marchal <frederic.marchal@wowcompany.com>
  * Mio Moov 330
  */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 179/328] x86/microcode: Update the new microcode revision unconditionally
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (112 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 081/328] partitions/aix: fix usage of uninitialized lv_info and lvname structures Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 033/328] pwm: tiehrpwm: Don't use emulation mode bits to control PWM output Ben Hutchings
                   ` (213 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Borislav Petkov, prarit, Filippo Sironi, Thomas Gleixner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Filippo Sironi <sironi@amazon.de>

commit 8da38ebaad23fe1b0c4a205438676f6356607cfc upstream.

Handle the case where microcode gets loaded on the BSP's hyperthread
sibling first and the boot_cpu_data's microcode revision doesn't get
updated because of early exit due to the siblings sharing a microcode
engine.

For that, simply write the updated revision on all CPUs unconditionally.

Signed-off-by: Filippo Sironi <sironi@amazon.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: prarit@redhat.com
Link: http://lkml.kernel.org/r/1533050970-14385-1-git-send-email-sironi@amazon.de
[bwh: Backported to 3.16:
 - Keep returning 0 on success
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -214,26 +214,26 @@ int apply_microcode_amd(int cpu)
 	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
 
 	/* need to apply patch? */
-	if (rev >= mc_amd->hdr.patch_id) {
-		c->microcode = rev;
-		uci->cpu_sig.rev = rev;
-		return 0;
-	}
+	if (rev >= mc_amd->hdr.patch_id)
+		goto out;
 
 	if (__apply_microcode_amd(mc_amd)) {
 		pr_err("CPU%d: update failed for patch_level=0x%08x\n",
 			cpu, mc_amd->hdr.patch_id);
 		return -1;
 	}
-	pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
-		mc_amd->hdr.patch_id);
 
-	uci->cpu_sig.rev = mc_amd->hdr.patch_id;
-	c->microcode = mc_amd->hdr.patch_id;
+	rev = mc_amd->hdr.patch_id;
+
+	pr_info("CPU%d: new patch_level=0x%08x\n", cpu, rev);
+
+out:
+	uci->cpu_sig.rev = rev;
+	c->microcode	 = rev;
 
 	/* Update boot_cpu_data's revision too, if we're on the BSP: */
 	if (c->cpu_index == boot_cpu_data.cpu_index)
-		boot_cpu_data.microcode = mc_amd->hdr.patch_id;
+		boot_cpu_data.microcode = rev;
 
 	return 0;
 }
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -161,11 +161,8 @@ int apply_microcode(int cpu)
 	 * already.
 	 */
 	rev = intel_get_microcode_revision();
-	if (rev >= mc_intel->hdr.rev) {
-		uci->cpu_sig.rev = rev;
-		c->microcode = rev;
-		return 0;
-	}
+	if (rev >= mc_intel->hdr.rev)
+		goto out;
 
 	/* write microcode via MSR 0x79 */
 	wrmsr(MSR_IA32_UCODE_WRITE,
@@ -185,8 +182,9 @@ int apply_microcode(int cpu)
 		mc_intel->hdr.date >> 24,
 		(mc_intel->hdr.date >> 16) & 0xff);
 
+out:
 	uci->cpu_sig.rev = rev;
-	c->microcode = rev;
+	c->microcode	 = rev;
 
 	/* Update boot_cpu_data's revision too, if we're on the BSP: */
 	if (c->cpu_index == boot_cpu_data.cpu_index)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 110/328] Btrfs: fix btrfs_write_inode vs delayed iput deadlock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (131 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 263/328] ip_tunnel: be careful when accessing the inner header Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 104/328] mac802154: common tx error path Ben Hutchings
                   ` (194 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David Sterba, Omar Sandoval, Josef Bacik

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Josef Bacik <jbacik@fb.com>

commit 3c4276936f6fbe52884b4ea4e6cc120b890a0f9f upstream.

We recently ran into the following deadlock involving
btrfs_write_inode():

[  +0.005066]  __schedule+0x38e/0x8c0
[  +0.007144]  schedule+0x36/0x80
[  +0.006447]  bit_wait+0x11/0x60
[  +0.006446]  __wait_on_bit+0xbe/0x110
[  +0.007487]  ? bit_wait_io+0x60/0x60
[  +0.007319]  __inode_wait_for_writeback+0x96/0xc0
[  +0.009568]  ? autoremove_wake_function+0x40/0x40
[  +0.009565]  inode_wait_for_writeback+0x21/0x30
[  +0.009224]  evict+0xb0/0x190
[  +0.006099]  iput+0x1a8/0x210
[  +0.006103]  btrfs_run_delayed_iputs+0x73/0xc0
[  +0.009047]  btrfs_commit_transaction+0x799/0x8c0
[  +0.009567]  btrfs_write_inode+0x81/0xb0
[  +0.008008]  __writeback_single_inode+0x267/0x320
[  +0.009569]  writeback_sb_inodes+0x25b/0x4e0
[  +0.008702]  wb_writeback+0x102/0x2d0
[  +0.007487]  wb_workfn+0xa4/0x310
[  +0.006794]  ? wb_workfn+0xa4/0x310
[  +0.007143]  process_one_work+0x150/0x410
[  +0.008179]  worker_thread+0x6d/0x520
[  +0.007490]  kthread+0x12c/0x160
[  +0.006620]  ? put_pwq_unlocked+0x80/0x80
[  +0.008185]  ? kthread_park+0xa0/0xa0
[  +0.007484]  ? do_syscall_64+0x53/0x150
[  +0.007837]  ret_from_fork+0x29/0x40

Writeback calls:

btrfs_write_inode
  btrfs_commit_transaction
    btrfs_run_delayed_iputs

If iput() is called on that same inode, evict() will wait for writeback
forever.

btrfs_write_inode() was originally added way back in 4730a4bc5bf3
("btrfs_dirty_inode") to support O_SYNC writes. However, ->write_inode()
hasn't been used for O_SYNC since 148f948ba877 ("vfs: Introduce new
helpers for syncing after writing to O_SYNC file or IS_SYNC inode"), so
btrfs_write_inode() is actually unnecessary (and leads to a bunch of
unnecessary commits). Get rid of it, which also gets rid of the
deadlock.

Signed-off-by: Josef Bacik <jbacik@fb.com>
[Omar: new commit message]
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
[bwh: Backported to 3.16: deleted function is slightly different]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5542,31 +5542,6 @@ err:
 	return ret;
 }
 
-int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
-{
-	struct btrfs_root *root = BTRFS_I(inode)->root;
-	struct btrfs_trans_handle *trans;
-	int ret = 0;
-	bool nolock = false;
-
-	if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags))
-		return 0;
-
-	if (btrfs_fs_closing(root->fs_info) && btrfs_is_free_space_inode(inode))
-		nolock = true;
-
-	if (wbc->sync_mode == WB_SYNC_ALL) {
-		if (nolock)
-			trans = btrfs_join_transaction_nolock(root);
-		else
-			trans = btrfs_join_transaction(root);
-		if (IS_ERR(trans))
-			return PTR_ERR(trans);
-		ret = btrfs_commit_transaction(trans, root);
-	}
-	return ret;
-}
-
 /*
  * This is somewhat expensive, updating the tree every time the
  * inode changes.  But, it is most likely to find the inode in cache.
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1852,7 +1852,6 @@ static const struct super_operations btr
 	.sync_fs	= btrfs_sync_fs,
 	.show_options	= btrfs_show_options,
 	.show_devname	= btrfs_show_devname,
-	.write_inode	= btrfs_write_inode,
 	.alloc_inode	= btrfs_alloc_inode,
 	.destroy_inode	= btrfs_destroy_inode,
 	.statfs		= btrfs_statfs,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 184/328] cifs: connect to servername instead of IP for IPC$ share
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (236 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 319/328] net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 059/328] udlfb: fix display corruption of the last line Ben Hutchings
                   ` (89 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Aurelien Aptel, Thomas Werschlein, Tom Talpey, Steve French

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Werschlein <thomas.werschlein@geo.uzh.ch>

commit 395a2076b4064f97d3fce03af15210ff2a7bb7f9 upstream.

This patch is required allows access to a Microsoft fileserver failover
cluster behind a 1:1 NAT firewall.

The change also provides stronger context for authentication and share
connection (see MS-SMB2 3.3.5.7 and MS-SRVS 3.1.6.8) as noted by
Tom Talpey, and addresses comments about the buffer size for the UNC
made by Aurélien Aptel.

Signed-off-by: Thomas Werschlein <thomas.werschlein@geo.uzh.ch>
Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Tom Talpey <ttalpey@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
[bwh: Backported to 3.16: The IPC$ path is generated in get_dfs_path()
 in a rather fragile way. Rather than replacing all instances of
 ses->serverName here, switch to using kasprintf() so the new code
 is close to that used upstream.]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2829,15 +2829,10 @@ get_dfs_path(const unsigned int xid, str
 	*referrals = NULL;
 
 	if (ses->ipc_tid == 0) {
-		temp_unc = kmalloc(2 /* for slashes */ +
-			strnlen(ses->serverName, SERVER_NAME_LEN_WITH_NULL * 2)
-				+ 1 + 4 /* slash IPC$ */ + 2, GFP_KERNEL);
+		temp_unc = kasprintf(GFP_KERNEL, "\\\\%s\\IPC$",
+				     ses->server->hostname);
 		if (temp_unc == NULL)
 			return -ENOMEM;
-		temp_unc[0] = '\\';
-		temp_unc[1] = '\\';
-		strcpy(temp_unc + 2, ses->serverName);
-		strcpy(temp_unc + 2 + strlen(ses->serverName), "\\IPC$");
 		rc = ses->server->ops->tree_connect(xid, ses, temp_unc, NULL,
 						    nls_codepage);
 		cifs_dbg(FYI, "Tcon rc = %d ipc_tid = %d\n", rc, ses->ipc_tid);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 069/328] ALSA: vxpocket: Fix invalid endian conversions
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (101 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 131/328] 9p: fix multiple NULL-pointer-dereferences Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 177/328] x86/microcode/intel: Check microcode revision before updating sibling threads Ben Hutchings
                   ` (224 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 3acd3e3bab95ec3622ff98da313290ee823a0f68 upstream.

The endian conversions used in vxp_dma_read() and vxp_dma_write() are
superfluous and even wrong on big-endian machines, as inw() and outw()
already do conversions.  Kill them.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/pcmcia/vx/vxp_ops.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -375,7 +375,7 @@ static void vxp_dma_write(struct vx_core
 		length >>= 1; /* in 16bit words */
 		/* Transfer using pseudo-dma. */
 		for (; length > 0; length--) {
-			outw(cpu_to_le16(*addr), port);
+			outw(*addr, port);
 			addr++;
 		}
 		addr = (unsigned short *)runtime->dma_area;
@@ -385,7 +385,7 @@ static void vxp_dma_write(struct vx_core
 	count >>= 1; /* in 16bit words */
 	/* Transfer using pseudo-dma. */
 	for (; count > 0; count--) {
-		outw(cpu_to_le16(*addr), port);
+		outw(*addr, port);
 		addr++;
 	}
 	vx_release_pseudo_dma(chip);
@@ -417,7 +417,7 @@ static void vxp_dma_read(struct vx_core
 		length >>= 1; /* in 16bit words */
 		/* Transfer using pseudo-dma. */
 		for (; length > 0; length--)
-			*addr++ = le16_to_cpu(inw(port));
+			*addr++ = inw(port);
 		addr = (unsigned short *)runtime->dma_area;
 		pipe->hw_ptr = 0;
 	}
@@ -425,12 +425,12 @@ static void vxp_dma_read(struct vx_core
 	count >>= 1; /* in 16bit words */
 	/* Transfer using pseudo-dma. */
 	for (; count > 1; count--)
-		*addr++ = le16_to_cpu(inw(port));
+		*addr++ = inw(port);
 	/* Disable DMA */
 	pchip->regDIALOG &= ~VXP_DLG_DMAREAD_SEL_MASK;
 	vx_outb(chip, DIALOG, pchip->regDIALOG);
 	/* Read the last word (16 bits) */
-	*addr = le16_to_cpu(inw(port));
+	*addr = inw(port);
 	/* Disable 16-bit accesses */
 	pchip->regDIALOG &= ~VXP_DLG_DMA16_SEL_MASK;
 	vx_outb(chip, DIALOG, pchip->regDIALOG);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 136/328] xtensa: limit offsets in __loop_cache_{all,page}
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (129 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 220/328] batman-adv: Prevent duplicated tvlv handler Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 263/328] ip_tunnel: be careful when accessing the inner header Ben Hutchings
                   ` (196 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Max Filippov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Max Filippov <jcmvbkbc@gmail.com>

commit be75de25251f7cf3e399ca1f584716a95510d24a upstream.

When building kernel for xtensa cores with big cache lines (e.g. 128
bytes or more) __loop_cache_all and __loop_cache_page may generate
assembly instructions with immediate fields that are too big. This
results in the following build errors:

  arch/xtensa/mm/misc.S: Assembler messages:
  arch/xtensa/mm/misc.S:464: Error: operand 2 of 'diwbi' has invalid value '256'
  arch/xtensa/mm/misc.S:464: Error: operand 2 of 'diwbi' has invalid value '384'
  arch/xtensa/kernel/head.S: Assembler messages:
  arch/xtensa/kernel/head.S:172: Error: operand 2 of 'diu' has invalid value '256'
  arch/xtensa/kernel/head.S:172: Error: operand 2 of 'diu' has invalid value '384'
  arch/xtensa/kernel/head.S:176: Error: operand 2 of 'iiu' has invalid value '256'
  arch/xtensa/kernel/head.S:176: Error: operand 2 of 'iiu' has invalid value '384'
  arch/xtensa/kernel/head.S:255: Error: operand 2 of 'diwb' has invalid value '256'
  arch/xtensa/kernel/head.S:255: Error: operand 2 of 'diwb' has invalid value '384'

Add parameter max_immed to these macros and use it to limit values of
immediate operands. Extract common code of these macros into the new
macro __loop_cache_unroll.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/xtensa/include/asm/cacheasm.h | 65 ++++++++++++++++++------------
 1 file changed, 40 insertions(+), 25 deletions(-)

--- a/arch/xtensa/include/asm/cacheasm.h
+++ b/arch/xtensa/include/asm/cacheasm.h
@@ -31,16 +31,32 @@
  *
  */
 
-	.macro	__loop_cache_all ar at insn size line_width
 
-	movi	\ar, 0
+	.macro	__loop_cache_unroll ar at insn size line_width max_immed
+
+	.if	(1 << (\line_width)) > (\max_immed)
+	.set	_reps, 1
+	.elseif	(2 << (\line_width)) > (\max_immed)
+	.set	_reps, 2
+	.else
+	.set	_reps, 4
+	.endif
+
+	__loopi	\ar, \at, \size, (_reps << (\line_width))
+	.set	_index, 0
+	.rep	_reps
+	\insn	\ar, _index << (\line_width)
+	.set	_index, _index + 1
+	.endr
+	__endla	\ar, \at, _reps << (\line_width)
+
+	.endm
+
 
-	__loopi	\ar, \at, \size, (4 << (\line_width))
-	\insn	\ar, 0 << (\line_width)
-	\insn	\ar, 1 << (\line_width)
-	\insn	\ar, 2 << (\line_width)
-	\insn	\ar, 3 << (\line_width)
-	__endla	\ar, \at, 4 << (\line_width)
+	.macro	__loop_cache_all ar at insn size line_width max_immed
+
+	movi	\ar, 0
+	__loop_cache_unroll \ar, \at, \insn, \size, \line_width, \max_immed
 
 	.endm
 
@@ -57,14 +73,9 @@
 	.endm
 
 
-	.macro	__loop_cache_page ar at insn line_width
+	.macro	__loop_cache_page ar at insn line_width max_immed
 
-	__loopi	\ar, \at, PAGE_SIZE, 4 << (\line_width)
-	\insn	\ar, 0 << (\line_width)
-	\insn	\ar, 1 << (\line_width)
-	\insn	\ar, 2 << (\line_width)
-	\insn	\ar, 3 << (\line_width)
-	__endla	\ar, \at, 4 << (\line_width)
+	__loop_cache_unroll \ar, \at, \insn, PAGE_SIZE, \line_width, \max_immed
 
 	.endm
 
@@ -73,7 +84,8 @@
 
 	.macro	___unlock_dcache_all ar at
 
-	__loop_cache_all \ar \at diu XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH
+	__loop_cache_all \ar \at diu XCHAL_DCACHE_SIZE \
+		XCHAL_DCACHE_LINEWIDTH 240
 
 	.endm
 
@@ -83,21 +95,24 @@
 
 	.macro	___unlock_icache_all ar at
 
-	__loop_cache_all \ar \at iiu XCHAL_ICACHE_SIZE XCHAL_ICACHE_LINEWIDTH
+	__loop_cache_all \ar \at iiu XCHAL_ICACHE_SIZE \
+		XCHAL_ICACHE_LINEWIDTH 240
 
 	.endm
 #endif
 
 	.macro	___flush_invalidate_dcache_all ar at
 
-	__loop_cache_all \ar \at diwbi XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH
+	__loop_cache_all \ar \at diwbi XCHAL_DCACHE_SIZE \
+		XCHAL_DCACHE_LINEWIDTH 240
 
 	.endm
 
 
 	.macro	___flush_dcache_all ar at
 
-	__loop_cache_all \ar \at diwb XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH
+	__loop_cache_all \ar \at diwb XCHAL_DCACHE_SIZE \
+		XCHAL_DCACHE_LINEWIDTH 240
 
 	.endm
 
@@ -105,7 +120,7 @@
 	.macro	___invalidate_dcache_all ar at
 
 	__loop_cache_all \ar \at dii __stringify(DCACHE_WAY_SIZE) \
-			 XCHAL_DCACHE_LINEWIDTH
+			 XCHAL_DCACHE_LINEWIDTH 1020
 
 	.endm
 
@@ -113,7 +128,7 @@
 	.macro	___invalidate_icache_all ar at
 
 	__loop_cache_all \ar \at iii __stringify(ICACHE_WAY_SIZE) \
-			 XCHAL_ICACHE_LINEWIDTH
+			 XCHAL_ICACHE_LINEWIDTH 1020
 
 	.endm
 
@@ -150,27 +165,27 @@
 
 	.macro	___flush_invalidate_dcache_page ar as
 
-	__loop_cache_page \ar \as dhwbi XCHAL_DCACHE_LINEWIDTH
+	__loop_cache_page \ar \as dhwbi XCHAL_DCACHE_LINEWIDTH 1020
 
 	.endm
 
 
 	.macro ___flush_dcache_page ar as
 
-	__loop_cache_page \ar \as dhwb XCHAL_DCACHE_LINEWIDTH
+	__loop_cache_page \ar \as dhwb XCHAL_DCACHE_LINEWIDTH 1020
 
 	.endm
 
 
 	.macro	___invalidate_dcache_page ar as
 
-	__loop_cache_page \ar \as dhi XCHAL_DCACHE_LINEWIDTH
+	__loop_cache_page \ar \as dhi XCHAL_DCACHE_LINEWIDTH 1020
 
 	.endm
 
 
 	.macro	___invalidate_icache_page ar as
 
-	__loop_cache_page \ar \as ihi XCHAL_ICACHE_LINEWIDTH
+	__loop_cache_page \ar \as ihi XCHAL_ICACHE_LINEWIDTH 1020
 
 	.endm


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 049/328] MIPS: Change definition of cpu_relax() for Loongson-3
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (220 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 239/328] pstore: Fix incorrect persistent ram buffer mapping Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 146/328] tracing/blktrace: Fix to allow setting same value Ben Hutchings
                   ` (105 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Zhangjin Wu, James Hogan, linux-mips, Huacai Chen,
	Ralf Baechle, Fuxin Zhang, Paul Burton, Huacai Chen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Huacai Chen <chenhc@lemote.com>

commit a30718868915fbb991a9ae9e45594b059f28e9ae upstream.

Linux expects that if a CPU modifies a memory location, then that
modification will eventually become visible to other CPUs in the system.

Loongson 3 CPUs include a Store Fill Buffer (SFB) which sits between a
core & its L1 data cache, queueing memory accesses & allowing for faster
forwarding of data from pending stores to younger loads from the core.
Unfortunately the SFB prioritizes loads such that a continuous stream of
loads may cause a pending write to be buffered indefinitely. This is
problematic if we end up with 2 CPUs which each perform a store that the
other polls for - one or both CPUs may end up with their stores buffered
in the SFB, never reaching cache due to the continuous reads from the
poll loop. Such a deadlock condition has been observed whilst running
qspinlock code.

This patch changes the definition of cpu_relax() to smp_mb() for
Loongson-3, forcing a flush of the SFB on SMP systems which will cause
any pending writes to make it as far as the L1 caches where they will
become visible to other CPUs. If the kernel is not compiled for SMP
support, this will expand to a barrier() as before.

This workaround matches that currently implemented for ARM when
CONFIG_ARM_ERRATA_754327=y, which was introduced by commit 534be1d5a2da
("ARM: 6194/1: change definition of cpu_relax() for ARM11MPCore").

Although the workaround is only required when the Loongson 3 SFB
functionality is enabled, and we only began explicitly enabling that
functionality in v4.7 with commit 1e820da3c9af ("MIPS: Loongson-3:
Introduce CONFIG_LOONGSON3_ENHANCEMENT"), existing or future firmware
may enable the SFB which means we may need the workaround backported to
earlier kernels too.

[paul.burton@mips.com:
  - Reword commit message & comment.
  - Limit stable backport to v3.15+ where we support Loongson 3 CPUs.]

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
References: 534be1d5a2da ("ARM: 6194/1: change definition of cpu_relax() for ARM11MPCore")
References: 1e820da3c9af ("MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT")
Patchwork: https://patchwork.linux-mips.org/patch/19830/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: Huacai Chen <chenhuacai@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/mips/include/asm/processor.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -366,7 +366,20 @@ unsigned long get_wchan(struct task_stru
 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
 #define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
 
+#ifdef CONFIG_CPU_LOONGSON3
+/*
+ * Loongson-3's SFB (Store-Fill-Buffer) may buffer writes indefinitely when a
+ * tight read loop is executed, because reads take priority over writes & the
+ * hardware (incorrectly) doesn't ensure that writes will eventually occur.
+ *
+ * Since spin loops of any kind should have a cpu_relax() in them, force an SFB
+ * flush from cpu_relax() such that any pending writes will become visible as
+ * expected.
+ */
+#define cpu_relax()	smp_mb()
+#else
 #define cpu_relax()	barrier()
+#endif
 
 /*
  * Return_address is a replacement for __builtin_return_address(count)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 059/328] udlfb: fix display corruption of the last line
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (237 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 184/328] cifs: connect to servername instead of IP for IPC$ share Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 013/328] ALSA: snd-aoa: add of_node_put() in error path Ben Hutchings
                   ` (88 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Bartlomiej Zolnierkiewicz, Mikulas Patocka

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 4e705e17ce3409a1f492cfd5dadcf6a4f6075842 upstream.

The displaylink hardware has such a peculiarity that it doesn't render a
command until next command is received. This produces occasional
corruption, such as when setting 22x11 font on the console, only the first
line of the cursor will be blinking if the cursor is located at some
specific columns.

When we end up with a repeating pixel, the driver has a bug that it leaves
one uninitialized byte after the command (and this byte is enough to flush
the command and render it - thus it fixes the screen corruption), however
whe we end up with a non-repeating pixel, there is no byte appended and
this results in temporary screen corruption.

This patch fixes the screen corruption by always appending a byte 0xAF at
the end of URB. It also removes the uninitialized byte.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16:
 - Pointers to struct dlfb_data are named "dev" rather than "dlfb"
 - s/BPP/bpp/
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -29,6 +29,7 @@
 #include <linux/slab.h>
 #include <linux/prefetch.h>
 #include <linux/delay.h>
+#include <asm/unaligned.h>
 #include <video/udlfb.h>
 #include "edid.h"
 
@@ -453,17 +454,17 @@ static void dlfb_compress_hline(
 		raw_pixels_count_byte = cmd++; /*  we'll know this later */
 		raw_pixel_start = pixel;
 
-		cmd_pixel_end = pixel + min(MAX_CMD_PIXELS + 1,
-			min((int)(pixel_end - pixel),
-			    (int)(cmd_buffer_end - cmd) / bpp));
+		cmd_pixel_end = pixel + min3(MAX_CMD_PIXELS + 1UL,
+					(unsigned long)(pixel_end - pixel),
+					(unsigned long)(cmd_buffer_end - 1 - cmd) / bpp);
 
-		prefetch_range((void *) pixel, (cmd_pixel_end - pixel) * bpp);
+		prefetch_range((void *) pixel, (u8 *)cmd_pixel_end - (u8 *)pixel);
 
 		while (pixel < cmd_pixel_end) {
 			const uint16_t * const repeating_pixel = pixel;
 
-			*cmd++ = *pixel >> 8;
-			*cmd++ = *pixel;
+			put_unaligned_be16(*pixel, cmd);
+			cmd += 2;
 			pixel++;
 
 			if (unlikely((pixel < cmd_pixel_end) &&
@@ -489,13 +490,16 @@ static void dlfb_compress_hline(
 		if (pixel > raw_pixel_start) {
 			/* finalize last RAW span */
 			*raw_pixels_count_byte = (pixel-raw_pixel_start) & 0xFF;
+		} else {
+			/* undo unused byte */
+			cmd--;
 		}
 
 		*cmd_pixels_count_byte = (pixel - cmd_pixel_start) & 0xFF;
-		dev_addr += (pixel - cmd_pixel_start) * bpp;
+		dev_addr += (u8 *)pixel - (u8 *)cmd_pixel_start;
 	}
 
-	if (cmd_buffer_end <= MIN_RLX_CMD_BYTES + cmd) {
+	if (cmd_buffer_end - MIN_RLX_CMD_BYTES <= cmd) {
 		/* Fill leftover bytes with no-ops */
 		if (cmd_buffer_end > cmd)
 			memset(cmd, 0xAF, cmd_buffer_end - cmd);
@@ -615,8 +619,11 @@ static int dlfb_handle_damage(struct dlf
 	}
 
 	if (cmd > (char *) urb->transfer_buffer) {
+		int len;
+		if (cmd < (char *) urb->transfer_buffer + urb->transfer_buffer_length)
+			*cmd++ = 0xAF;
 		/* Send partial buffer remaining before exiting */
-		int len = cmd - (char *) urb->transfer_buffer;
+		len = cmd - (char *) urb->transfer_buffer;
 		ret = dlfb_submit_urb(dev, urb, len);
 		bytes_sent += len;
 	} else
@@ -740,8 +747,11 @@ static void dlfb_dpy_deferred_io(struct
 	}
 
 	if (cmd > (char *) urb->transfer_buffer) {
+		int len;
+		if (cmd < (char *) urb->transfer_buffer + urb->transfer_buffer_length)
+			*cmd++ = 0xAF;
 		/* Send partial buffer remaining before exiting */
-		int len = cmd - (char *) urb->transfer_buffer;
+		len = cmd - (char *) urb->transfer_buffer;
 		dlfb_submit_urb(dev, urb, len);
 		bytes_sent += len;
 	} else


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 087/328] udl-kms: handle allocation failure
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (20 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 224/328] drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 195/328] cfg80211: reg: Init wiphy_idx in regulatory_hint_core() Ben Hutchings
                   ` (305 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dave Airlie, Mikulas Patocka

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 542bb9788a1f485eb1a2229178f665d8ea166156 upstream.

Allocations larger than PAGE_ALLOC_COSTLY_ORDER are unreliable and they
may fail anytime. This patch fixes the udl kms driver so that when a large
alloactions fails, it tries to do multiple smaller allocations.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/udl/udl_main.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -171,17 +171,22 @@ static void udl_free_urb_list(struct drm
 static int udl_alloc_urb_list(struct drm_device *dev, int count, size_t size)
 {
 	struct udl_device *udl = dev->dev_private;
-	int i = 0;
 	struct urb *urb;
 	struct urb_node *unode;
 	char *buf;
+	size_t wanted_size = count * size;
 
 	spin_lock_init(&udl->urbs.lock);
 
+retry:
 	udl->urbs.size = size;
 	INIT_LIST_HEAD(&udl->urbs.list);
 
-	while (i < count) {
+	sema_init(&udl->urbs.limit_sem, 0);
+	udl->urbs.count = 0;
+	udl->urbs.available = 0;
+
+	while (udl->urbs.count * size < wanted_size) {
 		unode = kzalloc(sizeof(struct urb_node), GFP_KERNEL);
 		if (!unode)
 			break;
@@ -197,11 +202,16 @@ static int udl_alloc_urb_list(struct drm
 		}
 		unode->urb = urb;
 
-		buf = usb_alloc_coherent(udl->ddev->usbdev, MAX_TRANSFER, GFP_KERNEL,
+		buf = usb_alloc_coherent(udl->ddev->usbdev, size, GFP_KERNEL,
 					 &urb->transfer_dma);
 		if (!buf) {
 			kfree(unode);
 			usb_free_urb(urb);
+			if (size > PAGE_SIZE) {
+				size /= 2;
+				udl_free_urb_list(dev);
+				goto retry;
+			}
 			break;
 		}
 
@@ -212,16 +222,14 @@ static int udl_alloc_urb_list(struct drm
 
 		list_add_tail(&unode->entry, &udl->urbs.list);
 
-		i++;
+		up(&udl->urbs.limit_sem);
+		udl->urbs.count++;
+		udl->urbs.available++;
 	}
 
-	sema_init(&udl->urbs.limit_sem, i);
-	udl->urbs.count = i;
-	udl->urbs.available = i;
-
-	DRM_DEBUG("allocated %d %d byte urbs\n", i, (int) size);
+	DRM_DEBUG("allocated %d %d byte urbs\n", udl->urbs.count, (int) size);
 
-	return i;
+	return udl->urbs.count;
 }
 
 struct urb *udl_get_urb(struct drm_device *dev)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 076/328] block: move bio_integrity_{intervals,bytes} into blkdev.h
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (76 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 108/328] percpu_counter: batch size aware __percpu_counter_compare() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 037/328] uart: fix race between uart_put_char() and uart_shutdown() Ben Hutchings
                   ` (249 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jens Axboe, Martin K. Petersen, Greg Edwards

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Greg Edwards <gedwards@ddn.com>

commit 359f642700f2ff05d9c94cd9216c97af7b8e9553 upstream.

This allows bio_integrity_bytes() to be called from drivers instead of
open coding it.

Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Edwards <gedwards@ddn.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[bwh: Backported to 3.16: bio_integrity_intervals() was called
 bio_integrity_hw_sectors() and had a different implementation.  Move it
 without renaming.]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 block/bio-integrity.c  | 22 ----------------------
 include/linux/blkdev.h | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 22 deletions(-)

--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -194,32 +194,6 @@ int bio_integrity_enabled(struct bio *bi
 EXPORT_SYMBOL(bio_integrity_enabled);
 
 /**
- * bio_integrity_hw_sectors - Convert 512b sectors to hardware ditto
- * @bi:		blk_integrity profile for device
- * @sectors:	Number of 512 sectors to convert
- *
- * Description: The block layer calculates everything in 512 byte
- * sectors but integrity metadata is done in terms of the hardware
- * sector size of the storage device.  Convert the block layer sectors
- * to physical sectors.
- */
-static inline unsigned int bio_integrity_hw_sectors(struct blk_integrity *bi,
-						    unsigned int sectors)
-{
-	/* At this point there are only 512b or 4096b DIF/EPP devices */
-	if (bi->sector_size == 4096)
-		return sectors >>= 3;
-
-	return sectors;
-}
-
-static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
-					       unsigned int sectors)
-{
-	return bio_integrity_hw_sectors(bi, sectors) * bi->tuple_size;
-}
-
-/**
  * bio_integrity_tag_size - Retrieve integrity tag space
  * @bio:	bio to inspect
  *
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1542,6 +1542,32 @@ queue_max_integrity_segments(struct requ
 	return q->limits.max_integrity_segments;
 }
 
+/**
+ * bio_integrity_hw_sectors - Convert 512b sectors to hardware ditto
+ * @bi:		blk_integrity profile for device
+ * @sectors:	Number of 512 sectors to convert
+ *
+ * Description: The block layer calculates everything in 512 byte
+ * sectors but integrity metadata is done in terms of the hardware
+ * sector size of the storage device.  Convert the block layer sectors
+ * to physical sectors.
+ */
+static inline unsigned int bio_integrity_hw_sectors(struct blk_integrity *bi,
+						    unsigned int sectors)
+{
+	/* At this point there are only 512b or 4096b DIF/EPP devices */
+	if (bi->sector_size == 4096)
+		return sectors >>= 3;
+
+	return sectors;
+}
+
+static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
+					       unsigned int sectors)
+{
+	return bio_integrity_hw_sectors(bi, sectors) * bi->tuple_size;
+}
+
 #else /* CONFIG_BLK_DEV_INTEGRITY */
 
 struct bio;
@@ -1608,6 +1634,18 @@ static inline bool blk_integrity_is_init
 {
 	return 0;
 }
+
+static inline unsigned int bio_integrity_hw_sectors(struct blk_integrity *bi,
+						   unsigned int sectors)
+{
+	return 0;
+}
+
+static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
+					       unsigned int sectors)
+{
+	return 0;
+}
 
 #endif /* CONFIG_BLK_DEV_INTEGRITY */
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 056/328] video: udlfb: Remove noisy warnings
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (307 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 276/328] smsc75xx: Check for Wake-on-LAN modes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 325/328] mm: cleancache: fix corruption on missed inode invalidation Ben Hutchings
                   ` (18 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Ladislav Michl, Bernie Thompson, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ladislav Michl <ladis@linux-mips.org>

commit de4b74bda8e87a4ed45ebc2c26cc3e2eaae38429 upstream.

These warnings comes from times of driver development and do
not carry any usefull debugging information.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Cc: Bernie Thompson <bernie@plugable.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 20 --------------------
 1 file changed, 20 deletions(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -924,11 +924,7 @@ static void dlfb_free(struct kref *kref)
 
 	if (dev->backing_buffer)
 		vfree(dev->backing_buffer);
-
 	kfree(dev->edid);
-
-	pr_warn("freeing dlfb_data %p\n", dev);
-
 	kfree(dev);
 }
 
@@ -945,8 +941,6 @@ static void dlfb_free_framebuffer(struct
 	struct fb_info *info = dev->info;
 
 	if (info) {
-		int node = info->node;
-
 		unregister_framebuffer(info);
 
 		if (info->cmap.len != 0)
@@ -962,8 +956,6 @@ static void dlfb_free_framebuffer(struct
 
 		/* Assume info structure is freed after this point */
 		framebuffer_release(info);
-
-		pr_warn("fb_info for /dev/fb%d has been freed\n", node);
 	}
 
 	/* ref taken in probe() as part of registering framebfufer */
@@ -1064,8 +1056,6 @@ static int dlfb_ops_set_par(struct fb_in
 	u16 *pix_framebuffer;
 	int i;
 
-	pr_notice("set_par mode %dx%d\n", info->var.xres, info->var.yres);
-
 	result = dlfb_set_video_mode(dev, &info->var);
 
 	if ((result == 0) && (dev->fb_count == 0)) {
@@ -1168,8 +1158,6 @@ static int dlfb_realloc_framebuffer(stru
 	unsigned char *new_fb;
 	unsigned char *new_back = NULL;
 
-	pr_warn("Reallocating framebuffer. Addresses will change!\n");
-
 	new_len = info->fix.line_length * info->var.yres;
 
 	if (PAGE_ALIGN(new_len) > old_len) {
@@ -1420,9 +1408,6 @@ static ssize_t edid_show(
 	if (off + count > dev->edid_size)
 		count = dev->edid_size - off;
 
-	pr_info("sysfs edid copy %p to %p, %d bytes\n",
-		dev->edid, buf, (int) count);
-
 	memcpy(buf, dev->edid, count);
 
 	return count;
@@ -1448,7 +1433,6 @@ static ssize_t edid_store(
 	if (!dev->edid || memcmp(src, dev->edid, src_size))
 		return -EINVAL;
 
-	pr_info("sysfs written EDID is new default\n");
 	dlfb_ops_set_par(fb_info);
 	return src_size;
 }
@@ -1831,8 +1815,6 @@ static void dlfb_free_urb_list(struct dl
 	int ret;
 	unsigned long flags;
 
-	pr_notice("Freeing all render urbs\n");
-
 	/* keep waiting and freeing, until we've got 'em all */
 	while (count--) {
 
@@ -1911,8 +1893,6 @@ static int dlfb_alloc_urb_list(struct dl
 	dev->urbs.count = i;
 	dev->urbs.available = i;
 
-	pr_notice("allocated %d %d byte urbs\n", i, (int) size);
-
 	return i;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 153/328] iscsi target: fix session creation failure handling
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (22 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 195/328] cfg80211: reg: Init wiphy_idx in regulatory_hint_core() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 183/328] smb3: check for and properly advertise directory lease support Ben Hutchings
                   ` (303 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Matthew Wilcox, Mike Christie, Martin K. Petersen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mike Christie <mchristi@redhat.com>

commit 26abc916a898d34c5ad159315a2f683def3c5555 upstream.

The problem is that iscsi_login_zero_tsih_s1 sets conn->sess early in
iscsi_login_set_conn_values. If the function fails later like when we
alloc the idr it does kfree(sess) and leaves the conn->sess pointer set.
iscsi_login_zero_tsih_s1 then returns -Exyz and we then call
iscsi_target_login_sess_out and access the freed memory.

This patch has iscsi_login_zero_tsih_s1 either completely setup the
session or completely tear it down, so later in
iscsi_target_login_sess_out we can just check for it being set to the
connection.

Fixes: 0957627a9960 ("iscsi-target: Fix sess allocation leak in...")
Signed-off-by: Mike Christie <mchristi@redhat.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/target/iscsi/iscsi_target_login.c | 35 ++++++++++++++---------
 1 file changed, 21 insertions(+), 14 deletions(-)

--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -323,8 +323,7 @@ static int iscsi_login_zero_tsih_s1(
 		pr_err("idr_alloc() for sess_idr failed\n");
 		iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
 				ISCSI_LOGIN_STATUS_NO_RESOURCES);
-		kfree(sess);
-		return -ENOMEM;
+		goto free_sess;
 	}
 
 	sess->creation_time = get_jiffies_64();
@@ -340,20 +339,28 @@ static int iscsi_login_zero_tsih_s1(
 				ISCSI_LOGIN_STATUS_NO_RESOURCES);
 		pr_err("Unable to allocate memory for"
 				" struct iscsi_sess_ops.\n");
-		kfree(sess);
-		return -ENOMEM;
+		goto remove_idr;
 	}
 
 	sess->se_sess = transport_init_session(TARGET_PROT_NORMAL);
 	if (IS_ERR(sess->se_sess)) {
 		iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
 				ISCSI_LOGIN_STATUS_NO_RESOURCES);
-		kfree(sess->sess_ops);
-		kfree(sess);
-		return -ENOMEM;
+		goto free_ops;
 	}
 
 	return 0;
+
+free_ops:
+	kfree(sess->sess_ops);
+remove_idr:
+	spin_lock_bh(&sess_idr_lock);
+	idr_remove(&sess_idr, sess->session_index);
+	spin_unlock_bh(&sess_idr_lock);
+free_sess:
+	kfree(sess);
+	conn->sess = NULL;
+	return -ENOMEM;
 }
 
 static int iscsi_login_zero_tsih_s2(
@@ -1201,13 +1208,13 @@ void iscsi_target_login_sess_out(struct
 				   ISCSI_LOGIN_STATUS_INIT_ERR);
 	if (!zero_tsih || !conn->sess)
 		goto old_sess_out;
-	if (conn->sess->se_sess)
-		transport_free_session(conn->sess->se_sess);
-	if (conn->sess->session_index != 0) {
-		spin_lock_bh(&sess_idr_lock);
-		idr_remove(&sess_idr, conn->sess->session_index);
-		spin_unlock_bh(&sess_idr_lock);
-	}
+
+	transport_free_session(conn->sess->se_sess);
+
+	spin_lock_bh(&sess_idr_lock);
+	idr_remove(&sess_idr, conn->sess->session_index);
+	spin_unlock_bh(&sess_idr_lock);
+
 	kfree(conn->sess->sess_ops);
 	kfree(conn->sess);
 	conn->sess = NULL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 182/328] SMB3: Backup intent flag missing for directory opens with backupuid mounts
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (257 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 217/328] batman-adv: Place kref_get for softif_vlan near use Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 215/328] batman-adv: Prevent duplicated nc_node entry Ben Hutchings
                   ` (68 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Pavel Shilovsky, Steve French

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steve French <stfrench@microsoft.com>

commit 5e19697b56a64004e2d0ff1bb952ea05493c088f upstream.

When "backup intent" is requested on the mount (e.g. backupuid or
backupgid mount options), the corresponding flag needs to be set
on opens of directories (and files) but was missing in some
places causing access denied trying to enumerate and backup
servers.

Fixes kernel bugzilla #200953
https://bugzilla.kernel.org/show_bug.cgi?id=200953

Reported-and-tested-by: <whh@rubrik.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
[bwh: Backported to 3.16: drop changes in smb2_query_eas(), smb2_set_ea()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -446,6 +446,8 @@ cifs_sfu_type(struct cifs_fattr *fattr,
 	oparms.cifs_sb = cifs_sb;
 	oparms.desired_access = GENERIC_READ;
 	oparms.create_options = CREATE_NOT_DIR;
+	if (backup_cred(cifs_sb))
+		oparms.create_options |= CREATE_OPEN_BACKUP_INTENT;
 	oparms.disposition = FILE_OPEN;
 	oparms.path = path;
 	oparms.fid = &fid;
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -315,7 +315,10 @@ smb2_is_path_accessible(const unsigned i
 	oparms.tcon = tcon;
 	oparms.desired_access = FILE_READ_ATTRIBUTES;
 	oparms.disposition = FILE_OPEN;
-	oparms.create_options = 0;
+	if (backup_cred(cifs_sb))
+		oparms.create_options = CREATE_OPEN_BACKUP_INTENT;
+	else
+		oparms.create_options = 0;
 	oparms.fid = &fid;
 	oparms.reconnect = false;
 
@@ -725,7 +728,10 @@ smb2_query_dir_first(const unsigned int
 	oparms.tcon = tcon;
 	oparms.desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA;
 	oparms.disposition = FILE_OPEN;
-	oparms.create_options = 0;
+	if (backup_cred(cifs_sb))
+		oparms.create_options = CREATE_OPEN_BACKUP_INTENT;
+	else
+		oparms.create_options = 0;
 	oparms.fid = fid;
 	oparms.reconnect = false;
 
@@ -891,7 +897,10 @@ smb2_query_symlink(const unsigned int xi
 	oparms.tcon = tcon;
 	oparms.desired_access = FILE_READ_ATTRIBUTES;
 	oparms.disposition = FILE_OPEN;
-	oparms.create_options = 0;
+	if (backup_cred(cifs_sb))
+		oparms.create_options = CREATE_OPEN_BACKUP_INTENT;
+	else
+		oparms.create_options = 0;
 	oparms.fid = &fid;
 	oparms.reconnect = false;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 082/328] partitions/aix: append null character to print data from disk
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (252 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 157/328] getxattr: use correct xattr length Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 053/328] fbdev: omapfb: off by one in omapfb_register_client() Ben Hutchings
                   ` (73 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Mauricio Faria de Oliveira, Jens Axboe, Daniel J. Axtens

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mauricio Faria de Oliveira <mfo@canonical.com>

commit d43fdae7bac2def8c4314b5a49822cb7f08a45f1 upstream.

Even if properly initialized, the lvname array (i.e., strings)
is read from disk, and might contain corrupt data (e.g., lack
the null terminating character for strings).

So, make sure the partition name string used in pr_warn() has
the null terminating character.

Fixes: 6ceea22bbbc8 ("partitions: add aix lvm partition support files")
Suggested-by: Daniel J. Axtens <daniel.axtens@canonical.com>
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 block/partitions/aix.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/block/partitions/aix.c
+++ b/block/partitions/aix.c
@@ -282,10 +282,14 @@ int aix_partition(struct parsed_partitio
 				next_lp_ix += 1;
 		}
 		for (i = 0; i < state->limit; i += 1)
-			if (lvip[i].pps_found && !lvip[i].lv_is_contiguous)
+			if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) {
+				char tmp[sizeof(n[i].name) + 1]; // null char
+
+				snprintf(tmp, sizeof(tmp), "%s", n[i].name);
 				pr_warn("partition %s (%u pp's found) is "
 					"not contiguous\n",
-					n[i].name, lvip[i].pps_found);
+					tmp, lvip[i].pps_found);
+			}
 		kfree(pvd);
 	}
 	kfree(n);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 083/328] iio: ad9523: Fix return value for ad952x_store()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (92 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 052/328] PCI: pciehp: Fix unprotected list iteration in IRQ handler Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 194/328] iw_cxgb4: only allow 1 flush on user qps Ben Hutchings
                   ` (233 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jonathan Cameron, Alexandru Ardelean, Lars-Peter Clausen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Lars-Peter Clausen <lars@metafoo.de>

commit 9a5094ca29ea9b1da301b31fd377c0c0c4c23034 upstream.

A sysfs write callback function needs to either return the number of
consumed characters or an error.

The ad952x_store() function currently returns 0 if the input value was "0",
this will signal that no characters have been consumed and the function
will be called repeatedly in a loop indefinitely. Fix this by returning
number of supplied characters to indicate that the whole input string has
been consumed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Fixes: cd1678f96329 ("iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/iio/frequency/ad9523.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -507,7 +507,7 @@ static ssize_t ad9523_store(struct devic
 		return ret;
 
 	if (!state)
-		return 0;
+		return len;
 
 	mutex_lock(&indio_dev->mlock);
 	switch ((u32)this_attr->address) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 149/328] powerpc/powernv/pci: Work around races in PCI bridge enabling
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (233 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 313/328] IB/ucm: Fix Spectre v1 vulnerability Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 241/328] bpf, net: add skb_mac_header_len helper Ben Hutchings
                   ` (92 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Michael Ellerman, Benjamin Herrenschmidt

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

commit db2173198b9513f7add8009f225afa1f1c79bcc6 upstream.

The generic code is racy when multiple children of a PCI bridge try to
enable it simultaneously.

This leads to drivers trying to access a device through a
not-yet-enabled bridge, and this EEH errors under various
circumstances when using parallel driver probing.

There is work going on to fix that properly in the PCI core but it
will take some time.

x86 gets away with it because (outside of hotplug), the BIOS enables
all the bridges at boot time.

This patch does the same thing on powernv by enabling all bridges that
have child devices at boot time, thus avoiding subsequent races. It's
suitable for backporting to stable and distros, while the proper PCI
fix will probably be significantly more invasive.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
[bwh: Backported to 3.16:
 - Use dev_err() instead of pci_err()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 37 +++++++++++++++++++++++
 1 file changed, 37 insertions(+)

--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1132,6 +1132,41 @@ static void pnv_pci_ioda_create_dbgfs(vo
 #endif /* CONFIG_DEBUG_FS */
 }
 
+static void pnv_pci_enable_bridge(struct pci_bus *bus)
+{
+	struct pci_dev *dev = bus->self;
+	struct pci_bus *child;
+
+	/* Empty bus ? bail */
+	if (list_empty(&bus->devices))
+		return;
+
+	/*
+	 * If there's a bridge associated with that bus enable it. This works
+	 * around races in the generic code if the enabling is done during
+	 * parallel probing. This can be removed once those races have been
+	 * fixed.
+	 */
+	if (dev) {
+		int rc = pci_enable_device(dev);
+		if (rc)
+			dev_err(&dev->dev, "Error enabling bridge (%d)\n", rc);
+		pci_set_master(dev);
+	}
+
+	/* Perform the same to child busses */
+	list_for_each_entry(child, &bus->children, node)
+		pnv_pci_enable_bridge(child);
+}
+
+static void pnv_pci_enable_bridges(void)
+{
+	struct pci_controller *hose;
+
+	list_for_each_entry(hose, &hose_list, list_node)
+		pnv_pci_enable_bridge(hose->bus);
+}
+
 static void pnv_pci_ioda_fixup(void)
 {
 	pnv_pci_ioda_setup_PEs();
@@ -1140,6 +1175,8 @@ static void pnv_pci_ioda_fixup(void)
 
 	pnv_pci_ioda_create_dbgfs();
 
+	pnv_pci_enable_bridges();
+
 #ifdef CONFIG_EEH
 	eeh_probe_mode_set(EEH_PROBE_MODE_DEV);
 	eeh_addr_cache_build();


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 209/328] usb: misc: uss720: Fix two sleep-in-atomic-context bugs
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (135 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 201/328] spi: sh-msiof: Fix handling of write value for SISTR register Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 191/328] RDMA/ucma: check fd type in ucma_migrate_id() Ben Hutchings
                   ` (190 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jia-Ju Bai, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jia-Ju Bai <baijiaju1990@gmail.com>

commit bc8acc214d3f1cafebcbcd101a695bbac716595d upstream.

async_complete() in uss720.c is a completion handler function for the
USB driver. So it should not sleep, but it is can sleep according to the
function call paths (from bottom to top) in Linux-4.16.

[FUNC] set_1284_register(GFP_KERNEL)
drivers/usb/misc/uss720.c, 372:
  set_1284_register in parport_uss720_frob_control
drivers/parport/ieee1284.c, 560:
  [FUNC_PTR]parport_uss720_frob_control in parport_ieee1284_ack_data_avail
drivers/parport/ieee1284.c, 577:
  parport_ieee1284_ack_data_avail in parport_ieee1284_interrupt
./include/linux/parport.h, 474:
  parport_ieee1284_interrupt in parport_generic_irq
drivers/usb/misc/uss720.c, 116:
  parport_generic_irq in async_complete

[FUNC] get_1284_register(GFP_KERNEL)
drivers/usb/misc/uss720.c, 382:
  get_1284_register in parport_uss720_read_status
drivers/parport/ieee1284.c, 555:
  [FUNC_PTR]parport_uss720_read_status in parport_ieee1284_ack_data_avail
drivers/parport/ieee1284.c, 577:
  parport_ieee1284_ack_data_avail in parport_ieee1284_interrupt
./include/linux/parport.h, 474:
  parport_ieee1284_interrupt in parport_generic_irq
drivers/usb/misc/uss720.c, 116:
  parport_generic_irq in async_complete

Note that [FUNC_PTR] means a function pointer call is used.

To fix these bugs, GFP_KERNEL is replaced with GFP_ATOMIC.

These bugs are found by my static analysis tool DSAC.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/misc/uss720.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -392,7 +392,7 @@ static unsigned char parport_uss720_frob
 	mask &= 0x0f;
 	val &= 0x0f;
 	d = (priv->reg[1] & (~mask)) ^ val;
-	if (set_1284_register(pp, 2, d, GFP_KERNEL))
+	if (set_1284_register(pp, 2, d, GFP_ATOMIC))
 		return 0;
 	priv->reg[1] = d;
 	return d & 0xf;
@@ -402,7 +402,7 @@ static unsigned char parport_uss720_read
 {
 	unsigned char ret;
 
-	if (get_1284_register(pp, 1, &ret, GFP_KERNEL))
+	if (get_1284_register(pp, 1, &ret, GFP_ATOMIC))
 		return 0;
 	return ret & 0xf8;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 147/328] arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (294 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 303/328] mm: madvise(MADV_DODUMP): allow hugetlbfs pages Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 310/328] net: ipv4: update fnhe_pmtu when first hop's MTU changes Ben Hutchings
                   ` (31 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Will Deacon, Greg Hackmann, Greg Hackmann

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Greg Hackmann <ghackmann@android.com>

commit 5ad356eabc47d26a92140a0c4b20eba471c10de3 upstream.

ARM64's pfn_valid() shifts away the upper PAGE_SHIFT bits of the input
before seeing if the PFN is valid.  This leads to false positives when
some of the upper bits are set, but the lower bits match a valid PFN.

For example, the following userspace code looks up a bogus entry in
/proc/kpageflags:

    int pagemap = open("/proc/self/pagemap", O_RDONLY);
    int pageflags = open("/proc/kpageflags", O_RDONLY);
    uint64_t pfn, val;

    lseek64(pagemap, [...], SEEK_SET);
    read(pagemap, &pfn, sizeof(pfn));
    if (pfn & (1UL << 63)) {        /* valid PFN */
        pfn &= ((1UL << 55) - 1);   /* clear flag bits */
        pfn |= (1UL << 55);
        lseek64(pageflags, pfn * sizeof(uint64_t), SEEK_SET);
        read(pageflags, &val, sizeof(val));
    }

On ARM64 this causes the userspace process to crash with SIGSEGV rather
than reading (1 << KPF_NOPAGE).  kpageflags_read() treats the offset as
valid, and stable_page_flags() will try to access an address between the
user and kernel address ranges.

Fixes: c1cc1552616d ("arm64: MMU initialisation")
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
[bwh: Backported to 3.16: Keep using memblock_is_memory()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm64/mm/init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -113,7 +113,11 @@ static void __init zone_sizes_init(unsig
 #ifdef CONFIG_HAVE_ARCH_PFN_VALID
 int pfn_valid(unsigned long pfn)
 {
-	return memblock_is_memory(pfn << PAGE_SHIFT);
+	phys_addr_t addr = pfn << PAGE_SHIFT;
+
+	if ((addr >> PAGE_SHIFT) != pfn)
+		return 0;
+	return memblock_is_memory(addr);
 }
 EXPORT_SYMBOL(pfn_valid);
 #endif


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 119/328] media: rtl28xxu: be sure that it won't go past the array size
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (82 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 079/328] media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 139/328] ubifs: Fix memory leak in lprobs self-check Ben Hutchings
                   ` (243 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mauro Carvalho Chehab

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

commit 845b978a871bff3707eee611b32e4be0b9a94dd2 upstream.

smatch warns that the RC query code could go past the array size:

	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1757 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130
	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1758 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130

The driver logic gets the length of the IR RX buffer with:

        ret = rtl28xxu_rd_reg(d, IR_RX_BC, &buf[0]);
	...
        len = buf[0];

In thesis, this could range between 0 and 255 [1].

While this should never happen in practice, due to hardware limits,
smatch is right when it complains about that, as there's nothing at
the logic that would prevent it. So, if for whatever reason, buf[0]
gets filled by rtl28xx read functions with a value bigger than 128,
it will go past the array.

So, add an explicit check.

[1] I've no idea why smatch thinks that the maximum value is 130.
I double-checked the code several times. Was unable to find any
reason for assuming 130. Perhaps smatch is not properly parsing
u8 here?

Fixes: b5cbaa43a676 ("[media] rtl28xx: initial support for rtl2832u")
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1379,7 +1379,7 @@ static int rtl2832u_rc_query(struct dvb_
 		goto exit;
 
 	ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
-	if (ret)
+	if (ret || buf[0] > sizeof(buf))
 		goto err;
 
 	len = buf[0];


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 055/328] fb: fix lost console when the user unplugs a USB adapter
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (68 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 034/328] pwm: tiehrpwm: Fix disabling of output of PWMs Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 038/328] tty: fix typo in comment of tty_termios_encode_baud_rate Ben Hutchings
                   ` (257 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Bernie Thompson, Bartlomiej Zolnierkiewicz, Dave Airlie,
	Ladislav Michl, Mikulas Patocka

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 8c5b044299951acd91e830a688dd920477ea1eda upstream.

I have a USB display adapter using the udlfb driver and I use it on an ARM
board that doesn't have any graphics card. When I plug the adapter in, the
console is properly displayed, however when I unplug and re-plug the
adapter, the console is not displayed and I can't access it until I reboot
the board.

The reason is this:
When the adapter is unplugged, dlfb_usb_disconnect calls
unlink_framebuffer, then it waits until the reference count drops to zero
and then it deallocates the framebuffer. However, the console that is
attached to the framebuffer device keeps the reference count non-zero, so
the framebuffer device is never destroyed. When the USB adapter is plugged
again, it creates a new device /dev/fb1 and the console is not attached to
it.

This patch fixes the bug by unbinding the console from unlink_framebuffer.
The code to unbind the console is moved from do_unregister_framebuffer to
a function unbind_console. When the console is unbound, the reference
count drops to zero and the udlfb driver frees the framebuffer. When the
adapter is plugged back, a new framebuffer is created and the console is
attached to it.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Bernie Thompson <bernie@plugable.com>
Cc: Ladislav Michl <ladis@linux-mips.org>
[b.zolnierkie: preserve old behavior for do_unregister_framebuffer()]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/core/fbmem.c | 38 +++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 6 deletions(-)

--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1687,12 +1687,12 @@ static int do_register_framebuffer(struc
 	return 0;
 }
 
-static int do_unregister_framebuffer(struct fb_info *fb_info)
+static int unbind_console(struct fb_info *fb_info)
 {
 	struct fb_event event;
-	int i, ret = 0;
+	int ret;
+	int i = fb_info->node;
 
-	i = fb_info->node;
 	if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info)
 		return -EINVAL;
 
@@ -1707,17 +1707,29 @@ static int do_unregister_framebuffer(str
 	unlock_fb_info(fb_info);
 	console_unlock();
 
+	return ret;
+}
+
+static int __unlink_framebuffer(struct fb_info *fb_info);
+
+static int do_unregister_framebuffer(struct fb_info *fb_info)
+{
+	struct fb_event event;
+	int ret;
+
+	ret = unbind_console(fb_info);
+
 	if (ret)
 		return -EINVAL;
 
 	pm_vt_switch_unregister(fb_info->dev);
 
-	unlink_framebuffer(fb_info);
+	__unlink_framebuffer(fb_info);
 	if (fb_info->pixmap.addr &&
 	    (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
 		kfree(fb_info->pixmap.addr);
 	fb_destroy_modelist(&fb_info->modelist);
-	registered_fb[i] = NULL;
+	registered_fb[fb_info->node] = NULL;
 	num_registered_fb--;
 	fb_cleanup_device(fb_info);
 	event.info = fb_info;
@@ -1730,7 +1742,7 @@ static int do_unregister_framebuffer(str
 	return 0;
 }
 
-int unlink_framebuffer(struct fb_info *fb_info)
+static int __unlink_framebuffer(struct fb_info *fb_info)
 {
 	int i;
 
@@ -1742,6 +1754,20 @@ int unlink_framebuffer(struct fb_info *f
 		device_destroy(fb_class, MKDEV(FB_MAJOR, i));
 		fb_info->dev = NULL;
 	}
+
+	return 0;
+}
+
+int unlink_framebuffer(struct fb_info *fb_info)
+{
+	int ret;
+
+	ret = __unlink_framebuffer(fb_info);
+	if (ret)
+		return ret;
+
+	unbind_console(fb_info);
+
 	return 0;
 }
 EXPORT_SYMBOL(unlink_framebuffer);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 128/328] 9p/net: Fix zero-copy path in the 9p virtio transport
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (263 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 285/328] net: sched: act_ipt: check for underflow in __tcf_ipt_init() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 233/328] x86/EISA: Don't probe EISA bus for Xen PV guests Ben Hutchings
                   ` (62 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dominique Martinet, Chirantan Ekbote, Dylan Reid,
	Guenter Roeck, Greg Kurz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Chirantan Ekbote <chirantan@chromium.org>

commit d28c756caee6e414d9ba367d0b92da24145af2a8 upstream.

The zero-copy optimization when reading or writing large chunks of data
is quite useful.  However, the 9p messages created through the zero-copy
write path have an incorrect message size: it should be the size of the
header + size of the data being written but instead it's just the size
of the header.

This only works if the server ignores the size field of the message and
otherwise breaks the framing of the protocol. Fix this by re-writing the
message size field with the correct value.

Tested by running `dd if=/dev/zero of=out bs=4k count=1` inside a
virtio-9p mount.

Link: http://lkml.kernel.org/r/20180717003529.114368-1-chirantan@chromium.org
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Greg Kurz <groug@kaod.org>
Cc: Dylan Reid <dgreid@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/9p/trans_virtio.c | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -378,6 +378,7 @@ p9_virtio_zc_request(struct p9_client *c
 	p9_debug(P9_DEBUG_TRANS, "virtio request\n");
 
 	if (uodata) {
+		__le32 sz;
 		out_nr_pages = p9_nr_pages(uodata, outlen);
 		out_pages = kmalloc(sizeof(struct page *) * out_nr_pages,
 				    GFP_NOFS);
@@ -393,6 +394,12 @@ p9_virtio_zc_request(struct p9_client *c
 			out_pages = NULL;
 			goto err_out;
 		}
+		/* The size field of the message must include the length of the
+		 * header and the length of the data.  We didn't actually know
+		 * the length of the data until this point so add it in now.
+		 */
+		sz = cpu_to_le32(req->tc->size + outlen);
+		memcpy(&req->tc->sdata[0], &sz, sizeof(sz));
 	}
 	if (uidata) {
 		in_nr_pages = p9_nr_pages(uidata, inlen);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 132/328] 9p/virtio: fix off-by-one error in sg list bounds check
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (302 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 286/328] x86/vdso: Fix asm constraints on vDSO syscall fallbacks Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 204/328] spi: rspi: Fix leaking of unused DMA descriptors Ben Hutchings
                   ` (23 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dan Carpenter, Jun Piao, jiangyiwen, Dominique Martinet

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: jiangyiwen <jiangyiwen@huawei.com>

commit 23cba9cbde0bba05d772b335fe5f66aa82b9ad19 upstream.

Because the value of limit is VIRTQUEUE_NUM, if index is equal to
limit, it will cause sg array out of bounds, so correct the judgement
of BUG_ON.

Link: http://lkml.kernel.org/r/5B63D5F6.6080109@huawei.com
Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reported-By: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jun Piao <piaojun@huawei.com>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/9p/trans_virtio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -193,7 +193,7 @@ static int pack_sg_list(struct scatterli
 		s = rest_of_page(data);
 		if (s > count)
 			s = count;
-		BUG_ON(index > limit);
+		BUG_ON(index >= limit);
 		/* Make sure we don't terminate early. */
 		sg_unmark_end(&sg[index]);
 		sg_set_buf(&sg[index++], data, s);
@@ -239,6 +239,7 @@ pack_sg_list_p(struct scatterlist *sg, i
 		s = rest_of_page(data);
 		if (s > count)
 			s = count;
+		BUG_ON(index >= limit);
 		/* Make sure we don't terminate early. */
 		sg_unmark_end(&sg[index]);
 		sg_set_page(&sg[index++], pdata[i++], s, data_off);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 135/328] l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (41 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 306/328] dm cache: destroy migration_cache if cache target registration failed Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 175/328] ipmi: Move BT capabilities detection to the detect call Ben Hutchings
                   ` (284 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Wei Wang, David S. Miller, Guillaume Nault, Cong Wang,
	Martin KaFai Lau, David Ahern, syzbot+05f840f3b04f211bad55

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Wei Wang <weiwan@google.com>

commit 6d37fa49da1e8db8fb1995be22ac837ca41ac8a8 upstream.

In l2tp code, if it is a L2TP_UDP_ENCAP tunnel, tunnel->sk points to a
UDP socket. User could call sendmsg() on both this tunnel and the UDP
socket itself concurrently. As l2tp_xmit_skb() holds socket lock and call
__sk_dst_check() to refresh sk->sk_dst_cache, while udpv6_sendmsg() is
lockless and call sk_dst_check() to refresh sk->sk_dst_cache, there
could be a race and cause the dst cache to be freed multiple times.
So we fix l2tp side code to always call sk_dst_check() to garantee
xchg() is called when refreshing sk->sk_dst_cache to avoid race
conditions.

Syzkaller reported stack trace:
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in atomic_fetch_add_unless include/linux/atomic.h:575 [inline]
BUG: KASAN: use-after-free in atomic_add_unless include/linux/atomic.h:597 [inline]
BUG: KASAN: use-after-free in dst_hold_safe include/net/dst.h:308 [inline]
BUG: KASAN: use-after-free in ip6_hold_safe+0xe6/0x670 net/ipv6/route.c:1029
Read of size 4 at addr ffff8801aea9a880 by task syz-executor129/4829

CPU: 0 PID: 4829 Comm: syz-executor129 Not tainted 4.18.0-rc7-next-20180802+ #30
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 kasan_check_read+0x11/0x20 mm/kasan/kasan.c:272
 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
 atomic_fetch_add_unless include/linux/atomic.h:575 [inline]
 atomic_add_unless include/linux/atomic.h:597 [inline]
 dst_hold_safe include/net/dst.h:308 [inline]
 ip6_hold_safe+0xe6/0x670 net/ipv6/route.c:1029
 rt6_get_pcpu_route net/ipv6/route.c:1249 [inline]
 ip6_pol_route+0x354/0xd20 net/ipv6/route.c:1922
 ip6_pol_route_output+0x54/0x70 net/ipv6/route.c:2098
 fib6_rule_lookup+0x283/0x890 net/ipv6/fib6_rules.c:122
 ip6_route_output_flags+0x2c5/0x350 net/ipv6/route.c:2126
 ip6_dst_lookup_tail+0x1278/0x1da0 net/ipv6/ip6_output.c:978
 ip6_dst_lookup_flow+0xc8/0x270 net/ipv6/ip6_output.c:1079
 ip6_sk_dst_lookup_flow+0x5ed/0xc50 net/ipv6/ip6_output.c:1117
 udpv6_sendmsg+0x2163/0x36b0 net/ipv6/udp.c:1354
 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:632
 ___sys_sendmsg+0x51d/0x930 net/socket.c:2115
 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2210
 __do_sys_sendmmsg net/socket.c:2239 [inline]
 __se_sys_sendmmsg net/socket.c:2236 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2236
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446a29
Code: e8 ac b8 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f4de5532db8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00000000006dcc38 RCX: 0000000000446a29
RDX: 00000000000000b8 RSI: 0000000020001b00 RDI: 0000000000000003
RBP: 00000000006dcc30 R08: 00007f4de5533700 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dcc3c
R13: 00007ffe2b830fdf R14: 00007f4de55339c0 R15: 0000000000000001

Fixes: 71b1391a4128 ("l2tp: ensure sk->dst is still valid")
Reported-by: syzbot+05f840f3b04f211bad55@syzkaller.appspotmail.com
Signed-off-by: Wei Wang <weiwan@google.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Cc: Guillaume Nault <g.nault@alphalink.fr>
Cc: David Ahern <dsahern@gmail.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/l2tp/l2tp_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1195,7 +1195,7 @@ int l2tp_xmit_skb(struct l2tp_session *s
 
 	/* Get routing info from the tunnel socket */
 	skb_dst_drop(skb);
-	skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0)));
+	skb_dst_set(skb, sk_dst_check(sk, 0));
 
 	inet = inet_sk(sk);
 	fl = &inet->cork.fl;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 072/328] fuse: flush requests on umount
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (267 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 206/328] usb: Don't die twice if PCI xhci host is not responding in resume Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 250/328] ip6_tunnel: be careful when accessing the inner header Ben Hutchings
                   ` (58 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Miklos Szeredi

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Miklos Szeredi <mszeredi@suse.cz>

commit 580640ba5d331eb5631a5de46941c98f5ed90886 upstream.

Use fuse_abort_conn() instead of fuse_conn_kill() in fuse_put_super().
This flushes and aborts requests still on any queues.  But since we've
already reset fc->connected, those requests would not be useful anyway and
would be flushed when the fuse device is closed.

Next patches will rely on requests being flushed before the superblock is
destroyed.

Use fuse_abort_conn() in cuse_process_init_reply() too, since it makes no
difference there, and we can get rid of fuse_conn_kill().

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/fuse/cuse.c   |  2 +-
 fs/fuse/fuse_i.h |  2 --
 fs/fuse/inode.c  | 16 +---------------
 3 files changed, 2 insertions(+), 18 deletions(-)

--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -415,7 +415,7 @@ err_unlock:
 err_region:
 	unregister_chrdev_region(devt, 1);
 err:
-	fuse_conn_kill(fc);
+	fuse_abort_conn(fc);
 	goto out;
 }
 
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -804,8 +804,6 @@ void fuse_invalidate_atime(struct inode
  */
 struct fuse_conn *fuse_conn_get(struct fuse_conn *fc);
 
-void fuse_conn_kill(struct fuse_conn *fc);
-
 /**
  * Initialize fuse_conn
  */
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -376,27 +376,13 @@ static void fuse_bdi_destroy(struct fuse
 		bdi_destroy(&fc->bdi);
 }
 
-void fuse_conn_kill(struct fuse_conn *fc)
-{
-	spin_lock(&fc->lock);
-	fc->connected = 0;
-	fc->blocked = 0;
-	fc->initialized = 1;
-	spin_unlock(&fc->lock);
-	/* Flush all readers on this fs */
-	kill_fasync(&fc->fasync, SIGIO, POLL_IN);
-	wake_up_all(&fc->waitq);
-	wake_up_all(&fc->blocked_waitq);
-}
-EXPORT_SYMBOL_GPL(fuse_conn_kill);
-
 static void fuse_put_super(struct super_block *sb)
 {
 	struct fuse_conn *fc = get_fuse_conn_super(sb);
 
 	fuse_send_destroy(fc);
 
-	fuse_conn_kill(fc);
+	fuse_abort_conn(fc);
 	mutex_lock(&fuse_mutex);
 	list_del(&fc->entry);
 	fuse_ctl_remove_conn(fc);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 054/328] iio: ad9523: Fix displayed phase
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (114 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 033/328] pwm: tiehrpwm: Don't use emulation mode bits to control PWM output Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 307/328] of: unittest: Disable interrupt node tests for old world MAC systems Ben Hutchings
                   ` (211 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Lars-Peter Clausen, Jonathan Cameron, Alexandru Ardelean

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Lars-Peter Clausen <lars@metafoo.de>

commit 5a4e33c1c53ae7d4425f7d94e60e4458a37b349e upstream.

Fix the displayed phase for the ad9523 driver. Currently the most
significant decimal place is dropped and all other digits are shifted one
to the left. This is due to a multiplication by 10, which is not necessary,
so remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Fixes: cd1678f9632 ("iio: frequency: New driver for AD9523 SPI Low Jitter Clock Generator")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/iio/frequency/ad9523.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -641,7 +641,7 @@ static int ad9523_read_raw(struct iio_de
 		code = (AD9523_CLK_DIST_DIV_PHASE_REV(ret) * 3141592) /
 			AD9523_CLK_DIST_DIV_REV(ret);
 		*val = code / 1000000;
-		*val2 = (code % 1000000) * 10;
+		*val2 = code % 1000000;
 		return IIO_VAL_INT_PLUS_MICRO;
 	default:
 		return -EINVAL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 208/328] usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (35 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 167/328] USB: serial: ti_usb_3410_5052: use functions rather than macros Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 078/328] ALSA: virmidi: Fix too long output trigger loop Ben Hutchings
                   ` (290 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jia-Ju Bai, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jia-Ju Bai <baijiaju1990@gmail.com>

commit 6d4f268fa132742fe96dad22307c68d237356d88 upstream.

i_usX2Y_subs_startup in usbusx2yaudio.c is a completion handler function
for the USB driver. So it should not sleep, but it is can sleep
according to the function call paths (from bottom to top) in Linux-4.16.

[FUNC] msleep
drivers/usb/host/u132-hcd.c, 2558:
	msleep in u132_get_frame
drivers/usb/core/hcd.c, 2231:
	[FUNC_PTR]u132_get_frame in usb_hcd_get_frame_number
drivers/usb/core/usb.c, 822:
	usb_hcd_get_frame_number in usb_get_current_frame_number
sound/usb/usx2y/usbusx2yaudio.c, 303:
	usb_get_current_frame_number in i_usX2Y_urb_complete
sound/usb/usx2y/usbusx2yaudio.c, 366:
	i_usX2Y_urb_complete in i_usX2Y_subs_startup

Note that [FUNC_PTR] means a function pointer call is used.

To fix this bug, msleep() is replaced with mdelay().

This bug is found by my static analysis tool DSAC.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/host/u132-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -2569,7 +2569,7 @@ static int u132_get_frame(struct usb_hcd
 	} else {
 		int frame = 0;
 		dev_err(&u132->platform_dev->dev, "TODO: u132_get_frame\n");
-		msleep(100);
+		mdelay(100);
 		return frame;
 	}
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 133/328] KVM: arm/arm64: Skip updating PMD entry if no change
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (272 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 278/328] qlcnic: fix Tx descriptor corruption on 82xx devices Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 005/328] kprobes: Make list and blacklist root user read only Ben Hutchings
                   ` (53 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Marc Zyngier, Christoffer Dall, Punit Agrawal, Suzuki Poulose

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Punit Agrawal <punit.agrawal@arm.com>

commit 86658b819cd0a9aa584cd84453ed268a6f013770 upstream.

Contention on updating a PMD entry by a large number of vcpus can lead
to duplicate work when handling stage 2 page faults. As the page table
update follows the break-before-make requirement of the architecture,
it can lead to repeated refaults due to clearing the entry and
flushing the tlbs.

This problem is more likely when -

* there are large number of vcpus
* the mapping is large block mapping

such as when using PMD hugepages (512MB) with 64k pages.

Fix this by skipping the page table update if there is no change in
the entry being updated.

Fixes: ad361f093c1e ("KVM: ARM: Support hugetlbfs backed huge pages")
Reviewed-by: Suzuki Poulose <suzuki.poulose@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm/kvm/mmu.c | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -685,19 +685,35 @@ static int stage2_set_pmd_huge(struct kv
 	pmd = stage2_get_pmd(kvm, cache, addr);
 	VM_BUG_ON(!pmd);
 
-	/*
-	 * Mapping in huge pages should only happen through a fault.  If a
-	 * page is merged into a transparent huge page, the individual
-	 * subpages of that huge page should be unmapped through MMU
-	 * notifiers before we get here.
-	 *
-	 * Merging of CompoundPages is not supported; they should become
-	 * splitting first, unmapped, merged, and mapped back in on-demand.
-	 */
-	VM_BUG_ON(pmd_present(*pmd) && pmd_pfn(*pmd) != pmd_pfn(*new_pmd));
-
 	old_pmd = *pmd;
 	if (pmd_present(old_pmd)) {
+		/*
+		 * Multiple vcpus faulting on the same PMD entry, can
+		 * lead to them sequentially updating the PMD with the
+		 * same value. Following the break-before-make
+		 * (pmd_clear() followed by tlb_flush()) process can
+		 * hinder forward progress due to refaults generated
+		 * on missing translations.
+		 *
+		 * Skip updating the page table if the entry is
+		 * unchanged.
+		 */
+		if (pmd_val(old_pmd) == pmd_val(*new_pmd))
+			return 0;
+
+		/*
+		 * Mapping in huge pages should only happen through a
+		 * fault.  If a page is merged into a transparent huge
+		 * page, the individual subpages of that huge page
+		 * should be unmapped through MMU notifiers before we
+		 * get here.
+		 *
+		 * Merging of CompoundPages is not supported; they
+		 * should become splitting first, unmapped, merged,
+		 * and mapped back in on-demand.
+		 */
+		VM_BUG_ON(pmd_pfn(old_pmd) != pmd_pfn(*new_pmd));
+
 		pmd_clear(pmd);
 		kvm_tlb_flush_vmid_ipa(kvm, addr);
 	} else {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 195/328] cfg80211: reg: Init wiphy_idx in regulatory_hint_core()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (21 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 087/328] udl-kms: handle allocation failure Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 153/328] iscsi target: fix session creation failure handling Ben Hutchings
                   ` (304 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Andrei Otcheretianski, Johannes Berg, Luca Coelho

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

commit 24f33e64fcd0d50a4b1a8e5b41bd0257aa66b0e8 upstream.

Core regulatory hints didn't set wiphy_idx to WIPHY_IDX_INVALID. Since
the regulatory request is zeroed, wiphy_idx was always implicitly set to
0. This resulted in updating only phy #0.
Fix that.

Fixes: 806a9e39670b ("cfg80211: make regulatory_request use wiphy_idx instead of wiphy")
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
[add fixes tag]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/wireless/reg.c | 1 +
 1 file changed, 1 insertion(+)

--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1993,6 +1993,7 @@ static int regulatory_hint_core(const ch
 	request->alpha2[0] = alpha2[0];
 	request->alpha2[1] = alpha2[1];
 	request->initiator = NL80211_REGDOM_SET_BY_CORE;
+	request->wiphy_idx = WIPHY_IDX_INVALID;
 
 	queue_regulatory_request(request);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 080/328] media: gl861: fix probe of dvb_usb_gl861
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (177 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 273/328] ax88179_178a: Check for supported Wake-on-LAN modes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 130/328] fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed Ben Hutchings
                   ` (148 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mika Båtsman, Mauro Carvalho Chehab

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mika Båtsman <mika.batsman@gmail.com>

commit 48db0089bff6f9154f6bd98ce7a6ae3786fa8ebe upstream.

Probe of dvb_usb_gl861 was working at least with v4.4. Noticed the issue
with v4.13 but according to similar issues the problem started with v4.9.

[   15.288065] transfer buffer not dma capable
[   15.288090] WARNING: CPU: 2 PID: 493 at drivers/usb/core/hcd.c:1595 usb_hcd_map_urb_for_dma+0x4e2/0x640
...CUT...
[   15.288791] dvb_usb_gl861: probe of 3-7:1.0 failed with error -5

Tested with MSI Mega Sky 580 DVB-T Tuner [GL861]

[mchehab+samsung@kernel.org: rebased on the top of upstream]
Signed-off-by: Mika Båtsman <mika.batsman@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/media/usb/dvb-usb-v2/gl861.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

--- a/drivers/media/usb/dvb-usb-v2/gl861.c
+++ b/drivers/media/usb/dvb-usb-v2/gl861.c
@@ -26,10 +26,14 @@ static int gl861_i2c_msg(struct dvb_usb_
 	if (wo) {
 		req = GL861_REQ_I2C_WRITE;
 		type = GL861_WRITE;
+		buf = kmemdup(wbuf, wlen, GFP_KERNEL);
 	} else { /* rw */
 		req = GL861_REQ_I2C_READ;
 		type = GL861_READ;
+		buf = kmalloc(rlen, GFP_KERNEL);
 	}
+	if (!buf)
+		return -ENOMEM;
 
 	switch (wlen) {
 	case 1:
@@ -42,24 +46,19 @@ static int gl861_i2c_msg(struct dvb_usb_
 	default:
 		dev_err(&d->udev->dev, "%s: wlen=%d, aborting\n",
 				KBUILD_MODNAME, wlen);
+		kfree(buf);
 		return -EINVAL;
 	}
-	buf = NULL;
-	if (rlen > 0) {
-		buf = kmalloc(rlen, GFP_KERNEL);
-		if (!buf)
-			return -ENOMEM;
-	}
+
 	msleep(1); /* avoid I2C errors */
 
 	ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
 			      value, index, buf, rlen, 2000);
-	if (rlen > 0) {
-		if (ret > 0)
-			memcpy(rbuf, buf, rlen);
-		kfree(buf);
-	}
 
+	if (!wo && ret > 0)
+		memcpy(rbuf, buf, rlen);
+
+	kfree(buf);
 	return ret;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 108/328] percpu_counter: batch size aware __percpu_counter_compare()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (75 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 117/328] cifs: add missing debug entries for kconfig options Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 076/328] block: move bio_integrity_{intervals,bytes} into blkdev.h Ben Hutchings
                   ` (250 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dave Chinner, Tejun Heo, Dave Chinner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dave Chinner <dchinner@redhat.com>

commit 80188b0d77d7426b494af739ac129e0e684acb84 upstream.

XFS uses non-stanard batch sizes for avoiding frequent global
counter updates on it's allocated inode counters, as they increment
or decrement in batches of 64 inodes. Hence the standard percpu
counter batch of 32 means that the counter is effectively a global
counter. Currently Xfs uses a batch size of 128 so that it doesn't
take the global lock on every single modification.

However, Xfs also needs to compare accurately against zero, which
means we need to use percpu_counter_compare(), and that has a
hard-coded batch size of 32, and hence will spuriously fail to
detect when it is supposed to use precise comparisons and hence
the accounting goes wrong.

Add __percpu_counter_compare() to take a custom batch size so we can
use it sanely in XFS and factor percpu_counter_compare() to use it.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/percpu_counter.h | 13 ++++++++++++-
 lib/percpu_counter.c           |  6 +++---
 2 files changed, 15 insertions(+), 4 deletions(-)

--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -40,7 +40,12 @@ void percpu_counter_destroy(struct percp
 void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
 void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
 s64 __percpu_counter_sum(struct percpu_counter *fbc);
-int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs);
+int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch);
+
+static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
+{
+	return __percpu_counter_compare(fbc, rhs, percpu_counter_batch);
+}
 
 static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
 {
@@ -114,6 +119,12 @@ static inline int percpu_counter_compare
 		return 0;
 }
 
+static inline int
+__percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch)
+{
+	return percpu_counter_compare(fbc, rhs);
+}
+
 static inline void
 percpu_counter_add(struct percpu_counter *fbc, s64 amount)
 {
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -193,13 +193,13 @@ static int percpu_counter_hotcpu_callbac
  * Compare counter against given value.
  * Return 1 if greater, 0 if equal and -1 if less
  */
-int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
+int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch)
 {
 	s64	count;
 
 	count = percpu_counter_read(fbc);
 	/* Check to see if rough count will be sufficient for comparison */
-	if (abs(count - rhs) > (percpu_counter_batch*num_online_cpus())) {
+	if (abs(count - rhs) > (batch * num_online_cpus())) {
 		if (count > rhs)
 			return 1;
 		else
@@ -214,7 +214,7 @@ int percpu_counter_compare(struct percpu
 	else
 		return 0;
 }
-EXPORT_SYMBOL(percpu_counter_compare);
+EXPORT_SYMBOL(__percpu_counter_compare);
 
 static int __init percpu_counter_startup(void)
 {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 189/328] ext4: fix online resizing for bigalloc file systems with a 1k block size
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (321 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 243/328] ipv6: fix possible use-after-free in ip6_xmit() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 112/328] ASoC: wm8994: Mark expected switch fall-through Ben Hutchings
                   ` (4 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Theodore Ts'o

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit 5f8c10936fab2b69a487400f2872902e597dd320 upstream.

An online resize of a file system with the bigalloc feature enabled
and a 1k block size would be refused since ext4_resize_begin() did not
understand s_first_data_block is 0 for all bigalloc file systems, even
when the block size is 1k.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/resize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -18,6 +18,7 @@
 
 int ext4_resize_begin(struct super_block *sb)
 {
+	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	int ret = 0;
 
 	if (!capable(CAP_SYS_RESOURCE))
@@ -28,7 +29,7 @@ int ext4_resize_begin(struct super_block
          * because the user tools have no way of handling this.  Probably a
          * bad time to do it anyways.
          */
-	if (EXT4_SB(sb)->s_sbh->b_blocknr !=
+	if (EXT4_B2C(sbi, sbi->s_sbh->b_blocknr) !=
 	    le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
 		ext4_warning(sb, "won't resize using backup superblock at %llu",
 			(unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 079/328] media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (81 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 290/328] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 119/328] media: rtl28xxu: be sure that it won't go past the array size Ben Hutchings
                   ` (244 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mauro Carvalho Chehab, Akihiro Tsukada

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Akihiro Tsukada <tskd08@gmail.com>

commit 86f65c218123c4e36fd855fbbc38147ffaf29974 upstream.

i2c message buf might be on stack.

Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/media/usb/dvb-usb-v2/gl861.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

--- a/drivers/media/usb/dvb-usb-v2/gl861.c
+++ b/drivers/media/usb/dvb-usb-v2/gl861.c
@@ -20,6 +20,8 @@ static int gl861_i2c_msg(struct dvb_usb_
 	u16 value = addr << (8 + 1);
 	int wo = (rbuf == NULL || rlen == 0); /* write-only */
 	u8 req, type;
+	u8 *buf;
+	int ret;
 
 	if (wo) {
 		req = GL861_REQ_I2C_WRITE;
@@ -42,11 +44,23 @@ static int gl861_i2c_msg(struct dvb_usb_
 				KBUILD_MODNAME, wlen);
 		return -EINVAL;
 	}
-
+	buf = NULL;
+	if (rlen > 0) {
+		buf = kmalloc(rlen, GFP_KERNEL);
+		if (!buf)
+			return -ENOMEM;
+	}
 	msleep(1); /* avoid I2C errors */
 
-	return usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
-			       value, index, rbuf, rlen, 2000);
+	ret = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev, 0), req, type,
+			      value, index, buf, rlen, 2000);
+	if (rlen > 0) {
+		if (ret > 0)
+			memcpy(rbuf, buf, rlen);
+		kfree(buf);
+	}
+
+	return ret;
 }
 
 /* I2C */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 134/328] KVM: arm/arm64: Skip updating PTE entry if no change
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (118 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 029/328] vxlan: fix default fdb entry netlink notify ordering during netdev create Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 298/328] ipv6: take rcu lock in rawv6_send_hdrinc() Ben Hutchings
                   ` (207 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Marc Zyngier, Christoffer Dall, Punit Agrawal, Suzuki Poulose

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Punit Agrawal <punit.agrawal@arm.com>

commit 976d34e2dab10ece5ea8fe7090b7692913f89084 upstream.

When there is contention on faulting in a particular page table entry
at stage 2, the break-before-make requirement of the architecture can
lead to additional refaulting due to TLB invalidation.

Avoid this by skipping a page table update if the new value of the PTE
matches the previous value.

Fixes: d5d8184d35c9 ("KVM: ARM: Memory virtualization setup")
Reviewed-by: Suzuki Poulose <suzuki.poulose@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm/kvm/mmu.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -758,6 +758,10 @@ static int stage2_set_pte(struct kvm *kv
 	/* Create 2nd stage page table mapping - Level 3 */
 	old_pte = *pte;
 	if (pte_present(old_pte)) {
+		/* Skip page table update if there is no change */
+		if (pte_val(old_pte) == pte_val(*new_pte))
+			return 0;
+
 		kvm_set_pte(pte, __pte(0));
 		kvm_tlb_flush_vmid_ipa(kvm, addr);
 	} else {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 156/328] apparmor: remove no-op permission check in policy_unpack
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (241 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 252/328] USB: usbdevfs: restore warning for nonsensical flags Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 144/328] netfilter: nft_set: fix allocation size overflow in privsize callback Ben Hutchings
                   ` (84 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dan Carpenter, John Johansen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: John Johansen <john.johansen@canonical.com>

commit c037bd615885f1d9d3bdb48531bace79fae1505d upstream.

The patch 736ec752d95e: "AppArmor: policy routines for loading and
unpacking policy" from Jul 29, 2010, leads to the following static
checker warning:

    security/apparmor/policy_unpack.c:410 verify_accept()
    warn: bitwise AND condition is false here

    security/apparmor/policy_unpack.c:413 verify_accept()
    warn: bitwise AND condition is false here

security/apparmor/policy_unpack.c
   392  #define DFA_VALID_PERM_MASK             0xffffffff
   393  #define DFA_VALID_PERM2_MASK            0xffffffff
   394
   395  /**
   396   * verify_accept - verify the accept tables of a dfa
   397   * @dfa: dfa to verify accept tables of (NOT NULL)
   398   * @flags: flags governing dfa
   399   *
   400   * Returns: 1 if valid accept tables else 0 if error
   401   */
   402  static bool verify_accept(struct aa_dfa *dfa, int flags)
   403  {
   404          int i;
   405
   406          /* verify accept permissions */
   407          for (i = 0; i < dfa->tables[YYTD_ID_ACCEPT]->td_lolen; i++) {
   408                  int mode = ACCEPT_TABLE(dfa)[i];
   409
   410                  if (mode & ~DFA_VALID_PERM_MASK)
   411                          return 0;
   412
   413                  if (ACCEPT_TABLE2(dfa)[i] & ~DFA_VALID_PERM2_MASK)
   414                          return 0;

fixes: 736ec752d95e ("AppArmor: policy routines for loading and unpacking policy")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 security/apparmor/policy_unpack.c | 32 -------------------------------
 1 file changed, 32 deletions(-)

--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -290,32 +290,6 @@ static int unpack_strdup(struct aa_ext *
 	return res;
 }
 
-#define DFA_VALID_PERM_MASK		0xffffffff
-#define DFA_VALID_PERM2_MASK		0xffffffff
-
-/**
- * verify_accept - verify the accept tables of a dfa
- * @dfa: dfa to verify accept tables of (NOT NULL)
- * @flags: flags governing dfa
- *
- * Returns: 1 if valid accept tables else 0 if error
- */
-static bool verify_accept(struct aa_dfa *dfa, int flags)
-{
-	int i;
-
-	/* verify accept permissions */
-	for (i = 0; i < dfa->tables[YYTD_ID_ACCEPT]->td_lolen; i++) {
-		int mode = ACCEPT_TABLE(dfa)[i];
-
-		if (mode & ~DFA_VALID_PERM_MASK)
-			return 0;
-
-		if (ACCEPT_TABLE2(dfa)[i] & ~DFA_VALID_PERM2_MASK)
-			return 0;
-	}
-	return 1;
-}
 
 /**
  * unpack_dfa - unpack a file rule dfa
@@ -351,15 +325,9 @@ static struct aa_dfa *unpack_dfa(struct
 		if (IS_ERR(dfa))
 			return dfa;
 
-		if (!verify_accept(dfa, flags))
-			goto fail;
 	}
 
 	return dfa;
-
-fail:
-	aa_put_dfa(dfa);
-	return ERR_PTR(-EPROTO);
 }
 
 /**


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 178/328] x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (287 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 023/328] USB: serial: kobil_sct: fix modem-status error handling Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 235/328] misc: hmc6352: fix potential Spectre v1 Ben Hutchings
                   ` (38 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, sironi, Prarit Bhargava, Borislav Petkov, Tony Luck,
	Thomas Gleixner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Prarit Bhargava <prarit@redhat.com>

commit 370a132bb2227ff76278f98370e0e701d86ff752 upstream.

When preparing an MCE record for logging, boot_cpu_data.microcode is used
to read out the microcode revision on the box.

However, on systems where late microcode update has happened, the microcode
revision output in a MCE log record is wrong because
boot_cpu_data.microcode is not updated when the microcode gets updated.

But, the microcode revision saved in boot_cpu_data's microcode member
should be kept up-to-date, regardless, for consistency.

Make it so.

Fixes: fa94d0c6e0f3 ("x86/MCE: Save microcode revision in machine check records")
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: sironi@amazon.de
Link: http://lkml.kernel.org/r/20180731112739.32338-1-prarit@redhat.com
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/kernel/cpu/microcode/amd.c   | 4 ++++
 arch/x86/kernel/cpu/microcode/intel.c | 4 ++++
 2 files changed, 8 insertions(+)

--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -231,6 +231,10 @@ int apply_microcode_amd(int cpu)
 	uci->cpu_sig.rev = mc_amd->hdr.patch_id;
 	c->microcode = mc_amd->hdr.patch_id;
 
+	/* Update boot_cpu_data's revision too, if we're on the BSP: */
+	if (c->cpu_index == boot_cpu_data.cpu_index)
+		boot_cpu_data.microcode = mc_amd->hdr.patch_id;
+
 	return 0;
 }
 
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -188,6 +188,10 @@ int apply_microcode(int cpu)
 	uci->cpu_sig.rev = rev;
 	c->microcode = rev;
 
+	/* Update boot_cpu_data's revision too, if we're on the BSP: */
+	if (c->cpu_index == boot_cpu_data.cpu_index)
+		boot_cpu_data.microcode = rev;
+
 	return 0;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 065/328] xfrm: fix 'passing zero to ERR_PTR()' warning
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (33 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 284/328] xhci: Add missing CAS workaround for Intel Sunrise Point xHCI Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 167/328] USB: serial: ti_usb_3410_5052: use functions rather than macros Ben Hutchings
                   ` (292 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Steffen Klassert, YueHaibing

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: YueHaibing <yuehaibing@huawei.com>

commit 934ffce1343f22ed5e2d0bd6da4440f4848074de upstream.

Fix a static code checker warning:

  net/xfrm/xfrm_policy.c:1836 xfrm_resolve_and_create_bundle() warn: passing zero to 'ERR_PTR'

xfrm_tmpl_resolve return 0 just means no xdst found, return NULL
instead of passing zero to ERR_PTR.

Fixes: d809ec895505 ("xfrm: do not assume that template resolving always returns xfrms")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/xfrm/xfrm_policy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1692,7 +1692,10 @@ xfrm_resolve_and_create_bundle(struct xf
 	/* Try to instantiate a bundle */
 	err = xfrm_tmpl_resolve(pols, num_pols, fl, xfrm, family);
 	if (err <= 0) {
-		if (err != 0 && err != -EAGAIN)
+		if (err == 0)
+			return NULL;
+
+		if (err != -EAGAIN)
 			XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTPOLERROR);
 		return ERR_PTR(err);
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 113/328] ASoC: wm8994: Fix missing break in switch
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (38 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 103/328] net: 6lowpan: fix reserved space for single frames Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 169/328] ext4: avoid divide by zero fault when deleting corrupted inline directories Ben Hutchings
                   ` (287 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Valdis Kletnieks, Mark Brown, Gustavo A. R. Silva, Charles Keepax

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit ad0eaee6195db1db1749dd46b9e6f4466793d178 upstream.

Add missing break statement in order to prevent the code from falling
through to the default case.

Addresses-Coverity-ID: 115050 ("Missing break in switch")
Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/soc/codecs/wm8994.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -2427,7 +2427,7 @@ static int wm8994_set_dai_sysclk(struct
 			snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2,
 					    WM8994_OPCLK_ENA, 0);
 		}
-		/* fall through */
+		break;
 
 	default:
 		return -EINVAL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 038/328] tty: fix typo in comment of tty_termios_encode_baud_rate
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (69 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 055/328] fb: fix lost console when the user unplugs a USB adapter Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-12 13:57   ` Matthias Brugger
  2018-12-09 21:50 ` [PATCH 3.16 246/328] tty: vt_ioctl: fix potential Spectre v1 Ben Hutchings
                   ` (256 subsequent siblings)
  327 siblings, 1 reply; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Matthias Brugger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Matthias Brugger <matthias.bgg@gmail.com>

commit a1d51aa2214cea3f91611893610a2f769cada0e7 upstream.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/tty/tty_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -408,7 +408,7 @@ void tty_termios_encode_baud_rate(struct
 
 #ifdef BOTHER
 	/* If the user asked for a precise weird speed give a precise weird
-	   answer. If they asked for a Bfoo speed they many have problems
+	   answer. If they asked for a Bfoo speed they may have problems
 	   digesting non-exact replies so fuzz a bit */
 
 	if ((termios->c_cflag & CBAUD) == BOTHER)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 118/328] PCI: mvebu: Fix I/O space end address calculation
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (6 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 258/328] ubifs: Check for name being NULL while mounting Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 324/328] posix-timers: Sanitize overrun handling Ben Hutchings
                   ` (319 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Thomas Petazzoni, Lorenzo Pieralisi

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

commit dfd0309fd7b30a5baffaf47b2fccb88b46d64d69 upstream.

pcie->realio.end should be the address of last byte of the area,
therefore using resource_size() of another resource is not correct, we
must substract 1 to get the address of the last byte.

Fixes: 11be65472a427 ("PCI: mvebu: Adapt to the new device tree layout")
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pci/host/pci-mvebu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -940,7 +940,7 @@ static int mvebu_pcie_probe(struct platf
 		pcie->realio.start = PCIBIOS_MIN_IO;
 		pcie->realio.end = min_t(resource_size_t,
 					 IO_SPACE_LIMIT,
-					 resource_size(&pcie->io));
+					 resource_size(&pcie->io) - 1);
 	} else
 		pcie->realio = pcie->io;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 115/328] dm cache metadata: save in-core policy_hint_size to on-disk superblock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (198 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 198/328] USB: Add quirk to support DJI CineSSD Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 026/328] power: generic-adc-battery: check for duplicate properties copied from iio channels Ben Hutchings
                   ` (127 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mike Snitzer

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mike Snitzer <snitzer@redhat.com>

commit fd2fa95416188a767a63979296fa3e169a9ef5ec upstream.

policy_hint_size starts as 0 during __write_initial_superblock().  It
isn't until the policy is loaded that policy_hint_size is set in-core
(cmd->policy_hint_size).  But it never got recorded in the on-disk
superblock because __commit_transaction() didn't deal with transfering
the in-core cmd->policy_hint_size to the on-disk superblock.

The in-core cmd->policy_hint_size gets initialized by metadata_open()'s
__begin_transaction_flags() which re-reads all superblock fields.
Because the superblock's policy_hint_size was never properly stored, when
the cache was created, hints_array_available() would always return false
when re-activating a previously created cache.  This means
__load_mappings() always considered the hints invalid and never made use
of the hints (these hints served to optimize).

Another detremental side-effect of this oversight is the cache_check
utility would fail with: "invalid hint width: 0"

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/dm-cache-metadata.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -324,7 +324,7 @@ static int __write_initial_superblock(st
 	disk_super->version = cpu_to_le32(MAX_CACHE_VERSION);
 	memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name));
 	memset(disk_super->policy_version, 0, sizeof(disk_super->policy_version));
-	disk_super->policy_hint_size = 0;
+	disk_super->policy_hint_size = cpu_to_le32(0);
 
 	__copy_sm_root(cmd, disk_super);
 
@@ -635,6 +635,7 @@ static int __commit_transaction(struct d
 	disk_super->policy_version[0] = cpu_to_le32(cmd->policy_version[0]);
 	disk_super->policy_version[1] = cpu_to_le32(cmd->policy_version[1]);
 	disk_super->policy_version[2] = cpu_to_le32(cmd->policy_version[2]);
+	disk_super->policy_hint_size = cpu_to_le32(cmd->policy_hint_size);
 
 	disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits);
 	disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 111/328] btrfs: rename total_bytes to avoid confusion
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (89 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 297/328] ipv6: Compute net once in raw6_send_hdrinc Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 271/328] crypto: mxs-dcp - Fix wait logic on chan threads Ben Hutchings
                   ` (236 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Anand Jain, Chris Mason, David Sterba, Anand Jain

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Anand Jain <Anand.Jain@oracle.com>

commit 3c1dbdf54a31f4f049a33214c3096595988786bf upstream.

we are assigning number_devices to the total_bytes,
that's very confusing for a moment

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/btrfs/volumes.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2039,7 +2039,7 @@ int btrfs_init_new_device(struct btrfs_r
 	struct list_head *devices;
 	struct super_block *sb = root->fs_info->sb;
 	struct rcu_string *name;
-	u64 total_bytes;
+	u64 tmp;
 	int seeding_dev = 0;
 	int ret = 0;
 
@@ -2142,13 +2142,13 @@ int btrfs_init_new_device(struct btrfs_r
 	if (!blk_queue_nonrot(bdev_get_queue(bdev)))
 		root->fs_info->fs_devices->rotating = 1;
 
-	total_bytes = btrfs_super_total_bytes(root->fs_info->super_copy);
+	tmp = btrfs_super_total_bytes(root->fs_info->super_copy);
 	btrfs_set_super_total_bytes(root->fs_info->super_copy,
-				    total_bytes + device->total_bytes);
+				    tmp + device->total_bytes);
 
-	total_bytes = btrfs_super_num_devices(root->fs_info->super_copy);
+	tmp = btrfs_super_num_devices(root->fs_info->super_copy);
 	btrfs_set_super_num_devices(root->fs_info->super_copy,
-				    total_bytes + 1);
+				    tmp + 1);
 
 	/* add sysfs device entry */
 	btrfs_kobj_add_device(root->fs_info, device);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 120/328] scsi: aic94xx: fix an error code in aic94xx_init()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (51 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 027/328] vxlan: fix a potential issue when create a new vxlan fdb entry Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 099/328] crypto: blkcipher - fix crash flushing dcache in error path Ben Hutchings
                   ` (274 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Martin K. Petersen, Johannes Thumshirn, Dan Carpenter, John Garry

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 0756c57bce3d26da2592d834d8910b6887021701 upstream.

We accidentally return success instead of -ENOMEM on this error path.

Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/scsi/aic94xx/aic94xx_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -1047,8 +1047,10 @@ static int __init aic94xx_init(void)
 
 	aic94xx_transport_template =
 		sas_domain_attach_transport(&aic94xx_transport_functions);
-	if (!aic94xx_transport_template)
+	if (!aic94xx_transport_template) {
+		err = -ENOMEM;
 		goto out_destroy_caches;
+	}
 
 	err = pci_register_driver(&aic94xx_pci_driver);
 	if (err)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 085/328] pinctrl: imx: off by one in imx_pinconf_group_dbg_show()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (188 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 007/328] USB: serial: sierra: fix potential deadlock at close Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 066/328] ALSA: seq: Fix poll() error return Ben Hutchings
                   ` (137 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dong Aisheng, Dan Carpenter, Linus Walleij

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit b4859f3edb47825f62d1b2efdd75fe7945996f49 upstream.

The > should really be >= here.  It's harmless because
pinctrl_generic_get_group() will return a NULL if group is invalid.

Fixes: ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")
Reported-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pinctrl/pinctrl-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -388,7 +388,7 @@ static void imx_pinconf_group_dbg_show(s
 	const char *name;
 	int i, ret;
 
-	if (group > info->ngroups)
+	if (group >= info->ngroups)
 		return;
 
 	seq_printf(s, "\n");


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 145/328] netfilter: nf_tables: fix register ordering
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (162 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 141/328] drm/i915: set DP Main Stream Attribute for color range on DDI platforms Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 016/328] crypto: memzero_explicit - make sure to clear out sensitive data Ben Hutchings
                   ` (163 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Florian Westphal, Pablo Neira Ayuso

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Westphal <fw@strlen.de>

commit d209df3e7f7002d9099fdb0f6df0f972b4386a63 upstream.

We must register nfnetlink ops last, as that exposes nf_tables to
userspace.  Without this, we could theoretically get nfnetlink request
before net->nft state has been initialized.

Fixes: 99633ab29b213 ("netfilter: nf_tables: complete net namespace support")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[bwh: Backported to 3.16:
 - We don't call nft_chain_filter_{init,fini}() or
   {,un}register_netdevice_notifier()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4042,6 +4042,10 @@ static int __init nf_tables_module_init(
 {
 	int err;
 
+	err = register_pernet_subsys(&nf_tables_net_ops);
+	if (err < 0)
+		return err;
+
 	info = kmalloc(sizeof(struct nft_expr_info) * NFT_RULE_MAXEXPRS,
 		       GFP_KERNEL);
 	if (info == NULL) {
@@ -4053,17 +4057,19 @@ static int __init nf_tables_module_init(
 	if (err < 0)
 		goto err2;
 
+	/* must be last */
 	err = nfnetlink_subsys_register(&nf_tables_subsys);
 	if (err < 0)
 		goto err3;
 
 	pr_info("nf_tables: (c) 2007-2009 Patrick McHardy <kaber@trash.net>\n");
-	return register_pernet_subsys(&nf_tables_net_ops);
+	return err;
 err3:
 	nf_tables_core_module_exit();
 err2:
 	kfree(info);
 err1:
+	unregister_pernet_subsys(&nf_tables_net_ops);
 	return err;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 210/328] IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (58 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 268/328] bcache: do not assign in if condition in bcache_init() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 234/328] Tools: hv: Fix a bug in the key delete code Ben Hutchings
                   ` (267 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Ira Weiny, Aaron Knister, Jason Gunthorpe

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Aaron Knister <aaron.s.knister@nasa.gov>

commit 816e846c2eb9129a3e0afa5f920c8bbc71efecaa upstream.

Inside of start_xmit() the call to check if the connection is up and the
queueing of the packets for later transmission is not atomic which leaves
a window where cm_rep_handler can run, set the connection up, dequeue
pending packets and leave the subsequently queued packets by start_xmit()
sitting on neigh->queue until they're dropped when the connection is torn
down. This only applies to connected mode. These dropped packets can
really upset TCP, for example, and cause multi-minute delays in
transmission for open connections.

Here's the code in start_xmit where we check to see if the connection is
up:

       if (ipoib_cm_get(neigh)) {
               if (ipoib_cm_up(neigh)) {
                       ipoib_cm_send(dev, skb, ipoib_cm_get(neigh));
                       goto unref;
               }
       }

The race occurs if cm_rep_handler execution occurs after the above
connection check (specifically if it gets to the point where it acquires
priv->lock to dequeue pending skb's) but before the below code snippet in
start_xmit where packets are queued.

       if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
               push_pseudo_header(skb, phdr->hwaddr);
               spin_lock_irqsave(&priv->lock, flags);
               __skb_queue_tail(&neigh->queue, skb);
               spin_unlock_irqrestore(&priv->lock, flags);
       } else {
               ++dev->stats.tx_dropped;
               dev_kfree_skb_any(skb);
       }

The patch acquires the netif tx lock in cm_rep_handler for the section
where it sets the connection up and dequeues and retransmits deferred
skb's.

Fixes: 839fcaba355a ("IPoIB: Connected mode experimental support")
Signed-off-by: Aaron Knister <aaron.s.knister@nasa.gov>
Tested-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -996,12 +996,14 @@ static int ipoib_cm_rep_handler(struct i
 
 	skb_queue_head_init(&skqueue);
 
+	netif_tx_lock_bh(p->dev);
 	spin_lock_irq(&priv->lock);
 	set_bit(IPOIB_FLAG_OPER_UP, &p->flags);
 	if (p->neigh)
 		while ((skb = __skb_dequeue(&p->neigh->queue)))
 			__skb_queue_tail(&skqueue, skb);
 	spin_unlock_irq(&priv->lock);
+	netif_tx_unlock_bh(p->dev);
 
 	while ((skb = __skb_dequeue(&skqueue))) {
 		skb->dev = p->dev;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 048/328] ALSA: memalloc: Don't exceed over the requested size
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (224 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 143/328] s390/pci: fix out of bounds access during irq setup Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 260/328] ocfs2: fix ocfs2 read block panic Ben Hutchings
                   ` (101 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai, zhang jun

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit dfef01e150824b0e6da750cacda8958188d29aea upstream.

snd_dma_alloc_pages_fallback() tries to allocate pages again when the
allocation fails with reduced size.  But the first try actually
*increases* the size to power-of-two, which may give back a larger
chunk than the requested size.  This confuses the callers, e.g. sgbuf
assumes that the size is equal or less, and it may result in a bad
loop due to the underflow and eventually lead to Oops.

The code of this function seems incorrectly assuming the usage of
get_order().  We need to decrease at first, then align to
power-of-two.

Reported-and-tested-by: he, bo <bo.he@intel.com>
Reported-by: zhang jun <jun.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/core/memalloc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -239,16 +239,12 @@ int snd_dma_alloc_pages_fallback(int typ
 	int err;
 
 	while ((err = snd_dma_alloc_pages(type, device, size, dmab)) < 0) {
-		size_t aligned_size;
 		if (err != -ENOMEM)
 			return err;
 		if (size <= PAGE_SIZE)
 			return -ENOMEM;
-		aligned_size = PAGE_SIZE << get_order(size);
-		if (size != aligned_size)
-			size = aligned_size;
-		else
-			size >>= 1;
+		size >>= 1;
+		size = PAGE_SIZE << get_order(size);
 	}
 	if (! dmab->area)
 		return -ENOMEM;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 107/328] net: mac802154: tx: expand tailroom if necessary
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (310 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 006/328] s390/qdio: reset old sbal_state flags Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 142/328] mfd: sm501: Set coherent_dma_mask when creating subdevices Ben Hutchings
                   ` (15 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Rabi Narayan Sahoo, Stefan Schmidt, Alexander Aring, David Palma

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Aring <aring@mojatatu.com>

commit f9c52831133050c6b82aa8b6831c92da2bbf2a0b upstream.

This patch is necessary if case of AF_PACKET or other socket interface
which I am aware of it and didn't allocated the necessary room.

Reported-by: David Palma <david.palma@ntnu.no>
Reported-by: Rabi Narayan Sahoo <rabinarayans0828@gmail.com>
Signed-off-by: Alexander Aring <aring@mojatatu.com>
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
[bwh: Backported to 3.16:
 - Substitute literal number for IEEE802154_FCS_LEN
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -96,8 +96,20 @@ netdev_tx_t mac802154_tx(struct mac80215
 	mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb);
 
 	if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
-		u16 crc = crc_ccitt(0, skb->data, skb->len);
+		struct sk_buff *nskb;
+		u16 crc;
 
+		if (unlikely(skb_tailroom(skb) < 2)) {
+			nskb = skb_copy_expand(skb, 0, 2, GFP_ATOMIC);
+			if (likely(nskb)) {
+				consume_skb(skb);
+				skb = nskb;
+			} else {
+				goto err_tx;
+			}
+		}
+
+		crc = crc_ccitt(0, skb->data, skb->len);
 		put_unaligned_le16(crc, skb_put(skb, 2));
 	}
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 074/328] fuse: Don't access pipe->buffers without pipe_lock()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (78 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 037/328] uart: fix race between uart_put_char() and uart_shutdown() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 125/328] powerpc/pseries: Fix endianness while restoring of r3 in MCE handler Ben Hutchings
                   ` (247 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Andrey Ryabinin, Miklos Szeredi

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Andrey Ryabinin <aryabinin@virtuozzo.com>

commit a2477b0e67c52f4364a47c3ad70902bc2a61bd4c upstream.

fuse_dev_splice_write() reads pipe->buffers to determine the size of
'bufs' array before taking the pipe_lock(). This is not safe as
another thread might change the 'pipe->buffers' between the allocation
and taking the pipe_lock(). So we end up with too small 'bufs' array.

Move the bufs allocations inside pipe_lock()/pipe_unlock() to fix this.

Fixes: dd3bb14f44a6 ("fuse: support splice() writing to fuse device")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/fuse/dev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1913,11 +1913,14 @@ static ssize_t fuse_dev_splice_write(str
 	if (!fc)
 		return -EPERM;
 
+	pipe_lock(pipe);
+
 	bufs = kmalloc(pipe->buffers * sizeof(struct pipe_buffer), GFP_KERNEL);
-	if (!bufs)
+	if (!bufs) {
+		pipe_unlock(pipe);
 		return -ENOMEM;
+	}
 
-	pipe_lock(pipe);
 	nbuf = 0;
 	rem = 0;
 	for (idx = 0; idx < pipe->nrbufs && rem < len; idx++)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 200/328] spi: sh-msiof: Add more register documentation
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (205 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 259/328] mm: shmem.c: Correctly annotate new inodes for lockdep Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 021/328] libertas: fix suspend and resume for SDIO connected cards Ben Hutchings
                   ` (120 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Geert Uytterhoeven, Mark Brown

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit 2e2b36872d7b45b1f88a590283b14c67931b777f upstream.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/spi/spi-sh-msiof.c | 54 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -113,9 +113,61 @@ struct sh_msiof_spi_priv {
 #define CTR_TXE		0x00000200 /* Transmit Enable */
 #define CTR_RXE		0x00000100 /* Receive Enable */
 
-/* STR and IER */
+/* FCTR */
+#define FCTR_TFWM_MASK	0xe0000000 /* Transmit FIFO Watermark */
+#define FCTR_TFWM_64	0x00000000 /*  Transfer Request when 64 empty stages */
+#define FCTR_TFWM_32	0x20000000 /*  Transfer Request when 32 empty stages */
+#define FCTR_TFWM_24	0x40000000 /*  Transfer Request when 24 empty stages */
+#define FCTR_TFWM_16	0x60000000 /*  Transfer Request when 16 empty stages */
+#define FCTR_TFWM_12	0x80000000 /*  Transfer Request when 12 empty stages */
+#define FCTR_TFWM_8	0xa0000000 /*  Transfer Request when 8 empty stages */
+#define FCTR_TFWM_4	0xc0000000 /*  Transfer Request when 4 empty stages */
+#define FCTR_TFWM_1	0xe0000000 /*  Transfer Request when 1 empty stage */
+#define FCTR_TFUA_MASK	0x07f00000 /* Transmit FIFO Usable Area */
+#define FCTR_TFUA_SHIFT		20
+#define FCTR_TFUA(i)	((i) << FCTR_TFUA_SHIFT)
+#define FCTR_RFWM_MASK	0x0000e000 /* Receive FIFO Watermark */
+#define FCTR_RFWM_1	0x00000000 /*  Transfer Request when 1 valid stages */
+#define FCTR_RFWM_4	0x00002000 /*  Transfer Request when 4 valid stages */
+#define FCTR_RFWM_8	0x00004000 /*  Transfer Request when 8 valid stages */
+#define FCTR_RFWM_16	0x00006000 /*  Transfer Request when 16 valid stages */
+#define FCTR_RFWM_32	0x00008000 /*  Transfer Request when 32 valid stages */
+#define FCTR_RFWM_64	0x0000a000 /*  Transfer Request when 64 valid stages */
+#define FCTR_RFWM_128	0x0000c000 /*  Transfer Request when 128 valid stages */
+#define FCTR_RFWM_256	0x0000e000 /*  Transfer Request when 256 valid stages */
+#define FCTR_RFUA_MASK	0x00001ff0 /* Receive FIFO Usable Area (0x40 = full) */
+#define FCTR_RFUA_SHIFT		 4
+#define FCTR_RFUA(i)	((i) << FCTR_RFUA_SHIFT)
+
+/* STR */
+#define STR_TFEMP	0x20000000 /* Transmit FIFO Empty */
+#define STR_TDREQ	0x10000000 /* Transmit Data Transfer Request */
 #define STR_TEOF	0x00800000 /* Frame Transmission End */
+#define STR_TFSERR	0x00200000 /* Transmit Frame Synchronization Error */
+#define STR_TFOVF	0x00100000 /* Transmit FIFO Overflow */
+#define STR_TFUDF	0x00080000 /* Transmit FIFO Underflow */
+#define STR_RFFUL	0x00002000 /* Receive FIFO Full */
+#define STR_RDREQ	0x00001000 /* Receive Data Transfer Request */
 #define STR_REOF	0x00000080 /* Frame Reception End */
+#define STR_RFSERR	0x00000020 /* Receive Frame Synchronization Error */
+#define STR_RFUDF	0x00000010 /* Receive FIFO Underflow */
+#define STR_RFOVF	0x00000008 /* Receive FIFO Overflow */
+
+/* IER */
+#define IER_TDMAE	0x80000000 /* Transmit Data DMA Transfer Req. Enable */
+#define IER_TFEMPE	0x20000000 /* Transmit FIFO Empty Enable */
+#define IER_TDREQE	0x10000000 /* Transmit Data Transfer Request Enable */
+#define IER_TEOFE	0x00800000 /* Frame Transmission End Enable */
+#define IER_TFSERRE	0x00200000 /* Transmit Frame Sync Error Enable */
+#define IER_TFOVFE	0x00100000 /* Transmit FIFO Overflow Enable */
+#define IER_TFUDFE	0x00080000 /* Transmit FIFO Underflow Enable */
+#define IER_RDMAE	0x00008000 /* Receive Data DMA Transfer Req. Enable */
+#define IER_RFFULE	0x00002000 /* Receive FIFO Full Enable */
+#define IER_RDREQE	0x00001000 /* Receive Data Transfer Request Enable */
+#define IER_REOFE	0x00000080 /* Frame Reception End Enable */
+#define IER_RFSERRE	0x00000020 /* Receive Frame Sync Error Enable */
+#define IER_RFUDFE	0x00000010 /* Receive FIFO Underflow Enable */
+#define IER_RFOVFE	0x00000008 /* Receive FIFO Overflow Enable */
 
 
 static u32 sh_msiof_read(struct sh_msiof_spi_priv *p, int reg_offs)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 040/328] tty: fix termios input-speed encoding when using BOTHER
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (99 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 255/328] USB: fix error handling in usb_driver_claim_interface() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 131/328] 9p: fix multiple NULL-pointer-dereferences Ben Hutchings
                   ` (226 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Johan Hovold

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 1cee38f0363a88db374e50b232ca17b9a4c12fa0 upstream.

When the termios CIBAUD bits are left unset (i.e. B0), we use the same
output and input speed and should leave CIBAUD unchanged.

When the user requests a rate using BOTHER and c_ospeed which the driver
cannot set exactly, the driver can report back the actual baud rate
using tty_termios_encode_baud_rate(). If this rate is close enough to a
standard rate however, we could end up setting CIBAUD to a Bfoo value
despite the user having left it unset.

This in turn could lead to an unexpected input rate being set on
subsequent termios updates.

Fix this by using a zero tolerance value also for the input rate when
CIBAUD is clear so that the matching logic works as expected.

Fixes: 78137e3b34e1 ("[PATCH] tty: improve encode_baud_rate logic")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/tty/tty_ioctl.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -407,16 +407,20 @@ void tty_termios_encode_baud_rate(struct
 	termios->c_ospeed = obaud;
 
 #ifdef BOTHER
+	if ((termios->c_cflag >> IBSHIFT) & CBAUD)
+		ibinput = 1;	/* An input speed was specified */
+
 	/* If the user asked for a precise weird speed give a precise weird
 	   answer. If they asked for a Bfoo speed they may have problems
 	   digesting non-exact replies so fuzz a bit */
 
-	if ((termios->c_cflag & CBAUD) == BOTHER)
+	if ((termios->c_cflag & CBAUD) == BOTHER) {
 		oclose = 0;
+		if (!ibinput)
+			iclose = 0;
+	}
 	if (((termios->c_cflag >> IBSHIFT) & CBAUD) == BOTHER)
 		iclose = 0;
-	if ((termios->c_cflag >> IBSHIFT) & CBAUD)
-		ibinput = 1;	/* An input speed was specified */
 #endif
 	termios->c_cflag &= ~CBAUD;
 #ifdef IBSHIFT


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 112/328] ASoC: wm8994: Mark expected switch fall-through
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (322 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 189/328] ext4: fix online resizing for bigalloc file systems with a 1k block size Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 140/328] ubifs: Check data node size before truncate Ben Hutchings
                   ` (3 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Gustavo A. R. Silva, Mark Brown

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit 2cea1542859bc812f1ec51ea71c06e927e5b922e upstream.

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 115050 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/soc/codecs/wm8994.c | 1 +
 1 file changed, 1 insertion(+)

--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -2427,6 +2427,7 @@ static int wm8994_set_dai_sysclk(struct
 			snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2,
 					    WM8994_OPCLK_ENA, 0);
 		}
+		/* fall through */
 
 	default:
 		return -EINVAL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 086/328] udl-kms: change down_interruptible to down
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (146 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 126/328] uprobes: Use synchronize_rcu() not synchronize_sched() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 222/328] i2c: xiic: Make the start and the byte count write atomic Ben Hutchings
                   ` (179 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dave Airlie, Mikulas Patocka

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 8456b99c16d193c4c3b7df305cf431e027f0189c upstream.

If we leave urbs around, it causes not only leak, but also memory
corruption. This patch fixes the function udl_free_urb_list, so that it
always waits for all urbs that are in progress.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/udl/udl_main.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

--- a/drivers/gpu/drm/udl/udl_main.c
+++ b/drivers/gpu/drm/udl/udl_main.c
@@ -141,18 +141,13 @@ static void udl_free_urb_list(struct drm
 	struct list_head *node;
 	struct urb_node *unode;
 	struct urb *urb;
-	int ret;
 	unsigned long flags;
 
 	DRM_DEBUG("Waiting for completes and freeing all render urbs\n");
 
 	/* keep waiting and freeing, until we've got 'em all */
 	while (count--) {
-
-		/* Getting interrupted means a leak, but ok at shutdown*/
-		ret = down_interruptible(&udl->urbs.limit_sem);
-		if (ret)
-			break;
+		down(&udl->urbs.limit_sem);
 
 		spin_lock_irqsave(&udl->urbs.lock, flags);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 157/328] getxattr: use correct xattr length
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (251 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 251/328] USB: usbdevfs: sanitize flags more Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 082/328] partitions/aix: append null character to print data from disk Ben Hutchings
                   ` (74 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Serge Hallyn, Christian Brauner, Colin Watson, Eric W. Biederman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Christian Brauner <christian@brauner.io>

commit 82c9a927bc5df6e06b72d206d24a9d10cced4eb5 upstream.

When running in a container with a user namespace, if you call getxattr
with name = "system.posix_acl_access" and size % 8 != 4, then getxattr
silently skips the user namespace fixup that it normally does resulting in
un-fixed-up data being returned.
This is caused by posix_acl_fix_xattr_to_user() being passed the total
buffer size and not the actual size of the xattr as returned by
vfs_getxattr().
This commit passes the actual length of the xattr as returned by
vfs_getxattr() down.

A reproducer for the issue is:

  touch acl_posix

  setfacl -m user:0:rwx acl_posix

and the compile:

  #define _GNU_SOURCE
  #include <errno.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  #include <sys/types.h>
  #include <unistd.h>
  #include <attr/xattr.h>

  /* Run in user namespace with nsuid 0 mapped to uid != 0 on the host. */
  int main(int argc, void **argv)
  {
          ssize_t ret1, ret2;
          char buf1[128], buf2[132];
          int fret = EXIT_SUCCESS;
          char *file;

          if (argc < 2) {
                  fprintf(stderr,
                          "Please specify a file with "
                          "\"system.posix_acl_access\" permissions set\n");
                  _exit(EXIT_FAILURE);
          }
          file = argv[1];

          ret1 = getxattr(file, "system.posix_acl_access",
                          buf1, sizeof(buf1));
          if (ret1 < 0) {
                  fprintf(stderr, "%s - Failed to retrieve "
                                  "\"system.posix_acl_access\" "
                                  "from \"%s\"\n", strerror(errno), file);
                  _exit(EXIT_FAILURE);
          }

          ret2 = getxattr(file, "system.posix_acl_access",
                          buf2, sizeof(buf2));
          if (ret2 < 0) {
                  fprintf(stderr, "%s - Failed to retrieve "
                                  "\"system.posix_acl_access\" "
                                  "from \"%s\"\n", strerror(errno), file);
                  _exit(EXIT_FAILURE);
          }

          if (ret1 != ret2) {
                  fprintf(stderr, "The value of \"system.posix_acl_"
                                  "access\" for file \"%s\" changed "
                                  "between two successive calls\n", file);
                  _exit(EXIT_FAILURE);
          }

          for (ssize_t i = 0; i < ret2; i++) {
                  if (buf1[i] == buf2[i])
                          continue;

                  fprintf(stderr,
                          "Unexpected different in byte %zd: "
                          "%02x != %02x\n", i, buf1[i], buf2[i]);
                  fret = EXIT_FAILURE;
          }

          if (fret == EXIT_SUCCESS)
                  fprintf(stderr, "Test passed\n");
          else
                  fprintf(stderr, "Test failed\n");

          _exit(fret);
  }
and run:

  ./tester acl_posix

On a non-fixed up kernel this should return something like:

  root@c1:/# ./t
  Unexpected different in byte 16: ffffffa0 != 00
  Unexpected different in byte 17: ffffff86 != 00
  Unexpected different in byte 18: 01 != 00

and on a fixed kernel:

  root@c1:~# ./t
  Test passed

Fixes: 2f6f0654ab61 ("userns: Convert vfs posix_acl support to use kuids and kgids")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=199945
Reported-by: Colin Watson <cjwatson@ubuntu.com>
Signed-off-by: Christian Brauner <christian@brauner.io>
Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -466,7 +466,7 @@ getxattr(struct dentry *d, const char __
 	if (error > 0) {
 		if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
 		    (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
-			posix_acl_fix_xattr_to_user(kvalue, size);
+			posix_acl_fix_xattr_to_user(kvalue, error);
 		if (size && copy_to_user(value, kvalue, error))
 			error = -EFAULT;
 	} else if (error == -ERANGE && size >= XATTR_SIZE_MAX) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 148/328] KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (12 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 036/328] mei: bus: type promotion bug in mei_nfc_if_version() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 185/328] xfrm6: call kfree_skb when skb is toobig Ben Hutchings
                   ` (313 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Paul Mackerras

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Paul Mackerras <paulus@ozlabs.org>

commit 46dec40fb741f00f1864580130779aeeaf24fb3d upstream.

This fixes a bug which causes guest virtual addresses to get translated
to guest real addresses incorrectly when the guest is using the HPT MMU
and has more than 256GB of RAM, or more specifically has a HPT larger
than 2GB.  This has showed up in testing as a failure of the host to
emulate doorbell instructions correctly on POWER9 for HPT guests with
more than 256GB of RAM.

The bug is that the HPTE index in kvmppc_mmu_book3s_64_hv_xlate()
is stored as an int, and in forming the HPTE address, the index gets
shifted left 4 bits as an int before being signed-extended to 64 bits.
The simple fix is to make the variable a long int, matching the
return type of kvmppc_hv_find_lock_hpte(), which is what calculates
the index.

Fixes: 697d3899dcb4 ("KVM: PPC: Implement MMIO emulation support for Book3S HV guests")
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -451,7 +451,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate
 	unsigned long pp, key;
 	unsigned long v, gr;
 	unsigned long *hptep;
-	int index;
+	long int index;
 	int virtmode = vcpu->arch.shregs.msr & (data ? MSR_DR : MSR_IR);
 
 	/* Get SLB entry */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 125/328] powerpc/pseries: Fix endianness while restoring of r3 in MCE handler.
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (79 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 074/328] fuse: Don't access pipe->buffers without pipe_lock() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 290/328] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 Ben Hutchings
                   ` (246 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Nicholas Piggin, Mahesh Salgaonkar, Michael Ellerman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

commit cd813e1cd7122f2c261dce5b54d1e0c97f80e1a5 upstream.

During Machine Check interrupt on pseries platform, register r3 points
RTAS extended event log passed by hypervisor. Since hypervisor uses r3
to pass pointer to rtas log, it stores the original r3 value at the
start of the memory (first 8 bytes) pointed by r3. Since hypervisor
stores this info and rtas log is in BE format, linux should make
sure to restore r3 value in correct endian format.

Without this patch when MCE handler, after recovery, returns to code that
that caused the MCE may end up with Data SLB access interrupt for invalid
address followed by kernel panic or hang.

  Severe Machine check interrupt [Recovered]
    NIP [d00000000ca301b8]: init_module+0x1b8/0x338 [bork_kernel]
    Initiator: CPU
    Error type: SLB [Multihit]
      Effective address: d00000000ca70000
  cpu 0xa: Vector: 380 (Data SLB Access) at [c0000000fc7775b0]
      pc: c0000000009694c0: vsnprintf+0x80/0x480
      lr: c0000000009698e0: vscnprintf+0x20/0x60
      sp: c0000000fc777830
     msr: 8000000002009033
     dar: a803a30c000000d0
    current = 0xc00000000bc9ef00
    paca    = 0xc00000001eca5c00	 softe: 3	 irq_happened: 0x01
      pid   = 8860, comm = insmod
  vscnprintf+0x20/0x60
  vprintk_emit+0xb4/0x4b0
  vprintk_func+0x5c/0xd0
  printk+0x38/0x4c
  init_module+0x1c0/0x338 [bork_kernel]
  do_one_initcall+0x54/0x230
  do_init_module+0x8c/0x248
  load_module+0x12b8/0x15b0
  sys_finit_module+0xa8/0x110
  system_call+0x58/0x6c
  --- Exception: c00 (System Call) at 00007fff8bda0644
  SP (7fffdfbfe980) is in userspace

This patch fixes this issue.

Fixes: a08a53ea4c97 ("powerpc/le: Enable RTAS events support")
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/platforms/pseries/ras.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -298,7 +298,7 @@ static struct rtas_error_log *fwnmi_get_
 	}
 
 	savep = __va(regs->gpr[3]);
-	regs->gpr[3] = savep[0];	/* restore original r3 */
+	regs->gpr[3] = be64_to_cpu(savep[0]);	/* restore original r3 */
 
 	/* If it isn't an extended log we can use the per cpu 64bit buffer */
 	h = (struct rtas_error_log *)&savep[1];


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 039/328] tty: fix termios input-speed encoding
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (254 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 053/328] fbdev: omapfb: off by one in omapfb_register_client() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs Ben Hutchings
                   ` (71 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Johan Hovold

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit fada18c48d774b9e837928ecdce6a5d5fdd11ee7 upstream.

Make sure to clear the CIBAUD bits before OR-ing the new mask when
encoding the termios input baud rate.

This could otherwise lead to an incorrect input rate being reported back
and incidentally set on subsequent termios updates.

Fixes: edc6afc54968 ("[PATCH] tty: switch to ktermios and new framework")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/tty/tty_ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -419,6 +419,9 @@ void tty_termios_encode_baud_rate(struct
 		ibinput = 1;	/* An input speed was specified */
 #endif
 	termios->c_cflag &= ~CBAUD;
+#ifdef IBSHIFT
+	termios->c_cflag &= ~(CBAUD << IBSHIFT);
+#endif
 
 	/*
 	 *	Our goal is to find a close match to the standard baud rate


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 084/328] net: mvneta: fix mtu change on port without link
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (231 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 046/328] MIPS: Correct the 64-bit DSP accumulator register size Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 313/328] IB/ucm: Fix Spectre v1 vulnerability Ben Hutchings
                   ` (94 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Yelena Krivosheev, Gregory CLEMENT, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Yelena Krivosheev <yelena@marvell.com>

commit 8466baf788ec3e18836bd9c91ba0b1a07af25878 upstream.

It is incorrect to enable TX/RX queues (call by mvneta_port_up()) for
port without link. Indeed MTU change for interface without link causes TX
queues to stuck.

Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP
network unit")
Signed-off-by: Yelena Krivosheev <yelena@marvell.com>
[gregory.clement: adding Fixes tags and rewording commit log]
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/ethernet/marvell/mvneta.c | 1 -
 1 file changed, 1 deletion(-)

--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -2475,7 +2475,6 @@ static int mvneta_change_mtu(struct net_
 	}
 
 	mvneta_start_dev(pp);
-	mvneta_port_up(pp);
 
 	netdev_update_features(dev);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 066/328] ALSA: seq: Fix poll() error return
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (189 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 085/328] pinctrl: imx: off by one in imx_pinconf_group_dbg_show() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 093/328] ext4: fix spectre gadget in ext4_mb_regular_allocator() Ben Hutchings
                   ` (136 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit a49a71f6e25da2acc637fcd31e73debd96ca18f8 upstream.

The sanity checks in ALSA sequencer and OSS sequencer emulation codes
return falsely -ENXIO from poll callback.  They should be EPOLLERR
instead.

This was caught thanks to the recent change to the return value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[bwh: Backported to 3.16: s/EPOLLERR/POLLERR/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/core/seq/oss/seq_oss.c   | 2 +-
 sound/core/seq/seq_clientmgr.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/sound/core/seq/oss/seq_oss.c
+++ b/sound/core/seq/oss/seq_oss.c
@@ -194,7 +194,7 @@ odev_poll(struct file *file, poll_table
 	struct seq_oss_devinfo *dp;
 	dp = file->private_data;
 	if (snd_BUG_ON(!dp))
-		return -ENXIO;
+		return POLLERR;
 	return snd_seq_oss_poll(dp, file, wait);
 }
 
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1110,7 +1110,7 @@ static unsigned int snd_seq_poll(struct
 
 	/* check client structures are in place */
 	if (snd_BUG_ON(!client))
-		return -ENXIO;
+		return POLLERR;
 
 	if ((snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT) &&
 	    client->data.user.fifo) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 041/328] s390/kvm: fix deadlock when killed by oom
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (25 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 282/328] mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 299/328] Make file credentials available to the seqfile interfaces Ben Hutchings
                   ` (300 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Claudio Imbrenda, Martin Schwidefsky

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>

commit 306d6c49ac9ded11114cb53b0925da52f2c2ada1 upstream.

When the oom killer kills a userspace process in the page fault handler
while in guest context, the fault handler fails to release the mm_sem
if the FAULT_FLAG_RETRY_NOWAIT option is set. This leads to a deadlock
when tearing down the mm when the process terminates. This bug can only
happen when pfault is enabled, so only KVM clients are affected.

The problem arises in the rare cases in which handle_mm_fault does not
release the mm_sem. This patch fixes the issue by manually releasing
the mm_sem when needed.

Fixes: 24eb3a824c4f3 ("KVM: s390: Add FAULT_FLAG_RETRY_NOWAIT for guest fault")
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/s390/mm/fault.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -497,6 +497,8 @@ retry:
 	/* No reason to continue if interrupted by SIGKILL. */
 	if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
 		fault = VM_FAULT_SIGNAL;
+		if (flags & FAULT_FLAG_RETRY_NOWAIT)
+			goto out_up;
 		goto out;
 	}
 	if (unlikely(fault & VM_FAULT_ERROR))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 045/328] binfmt_elf: Respect error return from `regset->active'
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 057/328] video: udlfb: Fix unaligned access Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 020/328] leds: max8997: use mode when calling max8997_led_set_mode Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 062/328] udlfb: set optimal write delay Ben Hutchings
                   ` (324 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, linux-mips, James Hogan, Ralf Baechle, Alexander Viro,
	Paul Burton, linux-fsdevel, Maciej W. Rozycki

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Maciej W. Rozycki" <macro@mips.com>

commit 2f819db565e82e5f73cd42b39925098986693378 upstream.

The regset API documented in <linux/regset.h> defines -ENODEV as the
result of the `->active' handler to be used where the feature requested
is not available on the hardware found.  However code handling core file
note generation in `fill_thread_core_info' interpretes any non-zero
result from the `->active' handler as the regset requested being active.
Consequently processing continues (and hopefully gracefully fails later
on) rather than being abandoned right away for the regset requested.

Fix the problem then by making the code proceed only if a positive
result is returned from the `->active' handler.

Signed-off-by: Maciej W. Rozycki <macro@mips.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: 4206d3aa1978 ("elf core dump: notes user_regset")
Patchwork: https://patchwork.linux-mips.org/patch/19332/
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: James Hogan <jhogan@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/binfmt_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1571,7 +1571,7 @@ static int fill_thread_core_info(struct
 		const struct user_regset *regset = &view->regsets[i];
 		do_thread_regset_writeback(t->task, regset);
 		if (regset->core_note_type && regset->get &&
-		    (!regset->active || regset->active(t->task, regset))) {
+		    (!regset->active || regset->active(t->task, regset) > 0)) {
 			int ret;
 			size_t size = regset->n * regset->size;
 			void *data = kmalloc(size, GFP_KERNEL);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 062/328] udlfb: set optimal write delay
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (2 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 045/328] binfmt_elf: Respect error return from `regset->active' Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 326/328] mremap: properly flush TLB before releasing the page Ben Hutchings
                   ` (323 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mikulas Patocka, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit bb24153a3f13dd0dbc1f8055ad97fe346d598f66 upstream.

The default delay 5 jiffies is too much when the kernel is compiled with
HZ=100 - it results in jumpy cursor in Xwindow.

In order to find out the optimal delay, I benchmarked the driver on
1280x720x30fps video. I found out that with HZ=1000, 10ms is acceptable,
but with HZ=250 or HZ=300, we need 4ms, so that the video is played
without any frame skips.

This patch changes the delay to this value.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/video/udlfb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/video/udlfb.h
+++ b/include/video/udlfb.h
@@ -88,7 +88,7 @@ struct dlfb_data {
 #define MIN_RAW_PIX_BYTES	2
 #define MIN_RAW_CMD_BYTES	(RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES)
 
-#define DL_DEFIO_WRITE_DELAY    5 /* fb_deferred_io.delay in jiffies */
+#define DL_DEFIO_WRITE_DELAY    msecs_to_jiffies(HZ <= 300 ? 4 : 10) /* optimal value for 720p video */
 #define DL_DEFIO_WRITE_DISABLE  (HZ*60) /* "disable" with long delay */
 
 /* remove these once align.h patch is taken into kernel */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 126/328] uprobes: Use synchronize_rcu() not synchronize_sched()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (145 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 028/328] vxlan: add new fdb alloc and create helpers Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 086/328] udl-kms: change down_interruptible to down Ben Hutchings
                   ` (180 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Oleg Nesterov, Steven Rostedt (VMware)

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

commit 016f8ffc48cb01d1e7701649c728c5d2e737d295 upstream.

While debugging another bug, I was looking at all the synchronize*()
functions being used in kernel/trace, and noticed that trace_uprobes was
using synchronize_sched(), with a comment to synchronize with
{u,ret}_probe_trace_func(). When looking at those functions, the data is
protected with "rcu_read_lock()" and not with "rcu_read_lock_sched()". This
is using the wrong synchronize_*() function.

Link: http://lkml.kernel.org/r/20180809160553.469e1e32@gandalf.local.home

Fixes: 70ed91c6ec7f8 ("tracing/uprobes: Support ftrace_event_file base multibuffer")
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/trace/trace_uprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -949,7 +949,7 @@ probe_event_disable(struct trace_uprobe
 
 		list_del_rcu(&link->list);
 		/* synchronize with u{,ret}probe_trace_func */
-		synchronize_sched();
+		synchronize_rcu();
 		kfree(link);
 
 		if (!list_empty(&tu->tp.files))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 060/328] udlfb: don't switch if we are switching to the same videomode
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (125 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 207/328] usb: Avoid use-after-free by flushing endpoints early in usb_set_interface() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 061/328] udlfb: make a local copy of fb_ops Ben Hutchings
                   ` (200 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mikulas Patocka, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 564f1807379298dfdb12ed0d5b25fcb89c238527 upstream.

The udlfb driver reprograms the hardware everytime the user switches the
console, that makes quite unusable when working on the console.

This patch makes the driver remember the videomode we are in and avoid
reprogramming the hardware if we switch to the same videomode.

We mask the "activate" field and the "FB_VMODE_SMOOTH_XPAN" flag when
comparing the videomode, because they cause spurious switches when
switching to and from the Xserver.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16: Pointer to struct dlfb_data is named "dev" rather
 than "dlfb"]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 18 ++++++++++++++++--
 include/video/udlfb.h       |  1 +
 2 files changed, 17 insertions(+), 2 deletions(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -1057,10 +1057,24 @@ static int dlfb_ops_set_par(struct fb_in
 	int result;
 	u16 *pix_framebuffer;
 	int i;
+	struct fb_var_screeninfo fvs;
+
+	/* clear the activate field because it causes spurious miscompares */
+	fvs = info->var;
+	fvs.activate = 0;
+	fvs.vmode &= ~FB_VMODE_SMOOTH_XPAN;
+
+	if (!memcmp(&dev->current_mode, &fvs, sizeof(struct fb_var_screeninfo)))
+		return 0;
 
 	result = dlfb_set_video_mode(dev, &info->var);
 
-	if ((result == 0) && (dev->fb_count == 0)) {
+	if (result)
+		return result;
+
+	dev->current_mode = fvs;
+
+	if (dev->fb_count == 0) {
 
 		/* paint greenscreen */
 
@@ -1072,7 +1086,7 @@ static int dlfb_ops_set_par(struct fb_in
 				   info->screen_base);
 	}
 
-	return result;
+	return 0;
 }
 
 /* To fonzi the jukebox (e.g. make blanking changes take effect) */
--- a/include/video/udlfb.h
+++ b/include/video/udlfb.h
@@ -56,6 +56,7 @@ struct dlfb_data {
 	atomic_t bytes_identical; /* saved effort with backbuffer comparison */
 	atomic_t bytes_sent; /* to usb, after compression including overhead */
 	atomic_t cpu_kcycles_used; /* transpired during pixel processing */
+	struct fb_var_screeninfo current_mode;
 };
 
 #define NR_USB_REQUEST_I2C_SUB_IO 0x02


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 139/328] ubifs: Fix memory leak in lprobs self-check
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (83 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 119/328] media: rtl28xxu: be sure that it won't go past the array size Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 265/328] bcache: don't embed 'return' statements in closure macros Ben Hutchings
                   ` (242 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Richard Weinberger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Weinberger <richard@nod.at>

commit eef19816ada3abd56d9f20c88794cc2fea83ebb2 upstream.

Allocate the buffer after we return early.
Otherwise memory is being leaked.

Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ubifs/lprops.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -1091,10 +1091,6 @@ static int scan_check_cb(struct ubifs_in
 		}
 	}
 
-	buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
-	if (!buf)
-		return -ENOMEM;
-
 	/*
 	 * After an unclean unmount, empty and freeable LEBs
 	 * may contain garbage - do not scan them.
@@ -1113,6 +1109,10 @@ static int scan_check_cb(struct ubifs_in
 		return LPT_SCAN_CONTINUE;
 	}
 
+	buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
 	sleb = ubifs_scan(c, lnum, 0, buf, 0);
 	if (IS_ERR(sleb)) {
 		ret = PTR_ERR(sleb);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 214/328] batman-adv: Use kref_get for batadv_nc_get_nc_node
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (283 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 077/328] scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 221/328] dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion deadlock Ben Hutchings
                   ` (42 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Sven Eckelmann, Antonio Quartulli, Marek Lindner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sven Eckelmann <sven@narfation.org>

commit 0de32ceee156787429035c974316f4e5098cf722 upstream.

batadv_nc_get_nc_node requires that the caller already has a valid
reference for orig_neigh_node. It is therefore not possible that it has an
reference counter of 0 and was still given to this function

The kref_get function instead WARNs (with debug information) when the
reference counter would still be 0. This makes a bug in batman-adv better
visible because kref_get_unless_zero would have ignored this problem.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
[bwh: Backported to 3.16: Reference counts are not krefs here, so open-
 code the equivalent of kref_get()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/batman-adv/network-coding.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -813,8 +813,7 @@ static struct batadv_nc_node
 	if (!nc_node)
 		return NULL;
 
-	if (!atomic_inc_not_zero(&orig_neigh_node->refcount))
-		goto free;
+	WARN_ON_ONCE(atomic_inc_return(&orig_neigh_node->refcount) < 2);
 
 	/* Initialize nc_node */
 	INIT_LIST_HEAD(&nc_node->list);
@@ -840,10 +839,6 @@ static struct batadv_nc_node
 	spin_unlock_bh(lock);
 
 	return nc_node;
-
-free:
-	kfree(nc_node);
-	return NULL;
 }
 
 /**


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 204/328] spi: rspi: Fix leaking of unused DMA descriptors
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (303 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 132/328] 9p/virtio: fix off-by-one error in sg list bounds check Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 137/328] xtensa: increase ranges in ___invalidate_{i,d}cache_all Ben Hutchings
                   ` (22 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Laurent Pinchart, Mark Brown, Geert Uytterhoeven

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit 3819bc8752367eae0d72fa1c473dc88ea45631a7 upstream.

If dmaengine_prep_slave_sg() or dmaengine_submit() fail, we may leak
unused DMA descriptors.

As per Documentation/dmaengine.txt, once a DMA descriptor has been
obtained, it must be submitted. Hence:
  - First prepare and submit all DMA descriptors,
  - Prepare the SPI controller for DMA,
  - Start DMA by calling dma_async_issue_pending(),
  - Make sure to call dmaengine_terminate_all() on all descriptors that
    haven't completed.

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/spi/spi-rspi.c | 94 ++++++++++++++++++++++++++----------------
 1 file changed, 58 insertions(+), 36 deletions(-)

--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -472,25 +472,52 @@ static int rspi_dma_transfer(struct rspi
 	dma_cookie_t cookie;
 	int ret;
 
-	if (tx) {
-		desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx,
-					tx->sgl, tx->nents, DMA_TO_DEVICE,
-					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc_tx)
-			goto no_dma;
-
-		irq_mask |= SPCR_SPTIE;
-	}
+	/* First prepare and submit the DMA request(s), as this may fail */
 	if (rx) {
 		desc_rx = dmaengine_prep_slave_sg(rspi->master->dma_rx,
 					rx->sgl, rx->nents, DMA_FROM_DEVICE,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
-		if (!desc_rx)
-			goto no_dma;
+		if (!desc_rx) {
+			ret = -EAGAIN;
+			goto no_dma_rx;
+		}
+
+		desc_rx->callback = rspi_dma_complete;
+		desc_rx->callback_param = rspi;
+		cookie = dmaengine_submit(desc_rx);
+		if (dma_submit_error(cookie)) {
+			ret = cookie;
+			goto no_dma_rx;
+		}
 
 		irq_mask |= SPCR_SPRIE;
 	}
 
+	if (tx) {
+		desc_tx = dmaengine_prep_slave_sg(rspi->master->dma_tx,
+					tx->sgl, tx->nents, DMA_TO_DEVICE,
+					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+		if (!desc_tx) {
+			ret = -EAGAIN;
+			goto no_dma_tx;
+		}
+
+		if (rx) {
+			/* No callback */
+			desc_tx->callback = NULL;
+		} else {
+			desc_tx->callback = rspi_dma_complete;
+			desc_tx->callback_param = rspi;
+		}
+		cookie = dmaengine_submit(desc_tx);
+		if (dma_submit_error(cookie)) {
+			ret = cookie;
+			goto no_dma_tx;
+		}
+
+		irq_mask |= SPCR_SPTIE;
+	}
+
 	/*
 	 * DMAC needs SPxIE, but if SPxIE is set, the IRQ routine will be
 	 * called. So, this driver disables the IRQ while DMA transfer.
@@ -503,34 +530,24 @@ static int rspi_dma_transfer(struct rspi
 	rspi_enable_irq(rspi, irq_mask);
 	rspi->dma_callbacked = 0;
 
-	if (rx) {
-		desc_rx->callback = rspi_dma_complete;
-		desc_rx->callback_param = rspi;
-		cookie = dmaengine_submit(desc_rx);
-		if (dma_submit_error(cookie))
-			return cookie;
+	/* Now start DMA */
+	if (rx)
 		dma_async_issue_pending(rspi->master->dma_rx);
-	}
-	if (tx) {
-		if (rx) {
-			/* No callback */
-			desc_tx->callback = NULL;
-		} else {
-			desc_tx->callback = rspi_dma_complete;
-			desc_tx->callback_param = rspi;
-		}
-		cookie = dmaengine_submit(desc_tx);
-		if (dma_submit_error(cookie))
-			return cookie;
+	if (tx)
 		dma_async_issue_pending(rspi->master->dma_tx);
-	}
 
 	ret = wait_event_interruptible_timeout(rspi->wait,
 					       rspi->dma_callbacked, HZ);
 	if (ret > 0 && rspi->dma_callbacked)
 		ret = 0;
-	else if (!ret)
+	else if (!ret) {
+		dev_err(&rspi->master->dev, "DMA timeout\n");
 		ret = -ETIMEDOUT;
+		if (tx)
+			dmaengine_terminate_all(rspi->master->dma_tx);
+		if (rx)
+			dmaengine_terminate_all(rspi->master->dma_rx);
+	}
 
 	rspi_disable_irq(rspi, irq_mask);
 
@@ -541,11 +558,16 @@ static int rspi_dma_transfer(struct rspi
 
 	return ret;
 
-no_dma:
-	pr_warn_once("%s %s: DMA not available, falling back to PIO\n",
-		     dev_driver_string(&rspi->master->dev),
-		     dev_name(&rspi->master->dev));
-	return -EAGAIN;
+no_dma_tx:
+	if (rx)
+		dmaengine_terminate_all(rspi->master->dma_rx);
+no_dma_rx:
+	if (ret == -EAGAIN) {
+		pr_warn_once("%s %s: DMA not available, falling back to PIO\n",
+			     dev_driver_string(&rspi->master->dev),
+			     dev_name(&rspi->master->dev));
+	}
+	return ret;
 }
 
 static void rspi_receive_init(const struct rspi_data *rspi)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 177/328] x86/microcode/intel: Check microcode revision before updating sibling threads
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (102 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 069/328] ALSA: vxpocket: Fix invalid endian conversions Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 289/328] perf/ring_buffer: Prevent concurent ring buffer access Ben Hutchings
                   ` (223 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Borislav Petkov, Arjan Van De Ven, Ashok Raj, Tom Lendacky,
	Thomas Gleixner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ashok Raj <ashok.raj@intel.com>

commit c182d2b7d0ca48e0d6ff16f7d883161238c447ed upstream.

After updating microcode on one of the threads of a core, the other
thread sibling automatically gets the update since the microcode
resources on a hyperthreaded core are shared between the two threads.

Check the microcode revision on the CPU before performing a microcode
update and thus save us the WRMSR 0x79 because it is a particularly
expensive operation.

[ Borislav: Massage changelog and coding style. ]

Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Tested-by: Ashok Raj <ashok.raj@intel.com>
Cc: Arjan Van De Ven <arjan.van.de.ven@intel.com>
Link: http://lkml.kernel.org/r/1519352533-15992-2-git-send-email-ashok.raj@intel.com
Link: https://lkml.kernel.org/r/20180228102846.13447-3-bp@alien8.de
[bwh: Backported to 3.16:
 - s/mc->/mc_intel->/
 - Return 0 in this case
 - Adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -155,6 +155,18 @@ int apply_microcode(int cpu)
 	if (get_matching_mc(mc_intel, cpu) == 0)
 		return 0;
 
+	/*
+	 * Save us the MSR write below - which is a particular expensive
+	 * operation - when the other hyperthread has updated the microcode
+	 * already.
+	 */
+	rev = intel_get_microcode_revision();
+	if (rev >= mc_intel->hdr.rev) {
+		uci->cpu_sig.rev = rev;
+		c->microcode = rev;
+		return 0;
+	}
+
 	/* write microcode via MSR 0x79 */
 	wrmsr(MSR_IA32_UCODE_WRITE,
 	      (unsigned long) mc_intel->bits,
--- a/arch/x86/kernel/cpu/microcode/intel_early.c
+++ b/arch/x86/kernel/cpu/microcode/intel_early.c
@@ -653,6 +653,17 @@ static int apply_microcode_early(struct
 	if (mc_intel == NULL)
 		return 0;
 
+	/*
+	 * Save us the MSR write below - which is a particular expensive
+	 * operation - when the other hyperthread has updated the microcode
+	 * already.
+	 */
+	rev = intel_get_microcode_revision();
+	if (rev >= mc_intel->hdr.rev) {
+		uci->cpu_sig.rev = rev;
+		return 0;
+	}
+
 	/* write microcode via MSR 0x79 */
 	native_wrmsr(MSR_IA32_UCODE_WRITE,
 	      (unsigned long) mc_intel->bits,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 078/328] ALSA: virmidi: Fix too long output trigger loop
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (36 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 208/328] usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 103/328] net: 6lowpan: fix reserved space for single frames Ben Hutchings
                   ` (289 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai, syzbot+619d9f40141d826b097e

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 50e9ffb1996a5d11ff5040a266585bad4ceeca0a upstream.

The virmidi output trigger tries to parse the all available bytes and
process sequencer events as much as possible.  In a normal situation,
this is supposed to be relatively short, but a program may give a huge
buffer and it'll take a long time in a single spin lock, which may
eventually lead to a soft lockup.

This patch simply adds a workaround, a cond_resched() call in the loop
if applicable.  A better solution would be to move the event processor
into a work, but let's put a duct-tape quickly at first.

Reported-and-tested-by: Dae R. Jeong <threeearcat@gmail.com>
Reported-by: syzbot+619d9f40141d826b097e@syzkaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/core/seq/seq_virmidi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -163,6 +163,7 @@ static void snd_virmidi_output_trigger(s
 	int count, res;
 	unsigned char buf[32], *pbuf;
 	unsigned long flags;
+	bool check_resched = !in_atomic();
 
 	if (up) {
 		vmidi->trigger = 1;
@@ -200,6 +201,15 @@ static void snd_virmidi_output_trigger(s
 					vmidi->event.type = SNDRV_SEQ_EVENT_NONE;
 				}
 			}
+			if (!check_resched)
+				continue;
+			/* do temporary unlock & cond_resched() for avoiding
+			 * CPU soft lockup, which may happen via a write from
+			 * a huge rawmidi buffer
+			 */
+			spin_unlock_irqrestore(&substream->runtime->lock, flags);
+			cond_resched();
+			spin_lock_irqsave(&substream->runtime->lock, flags);
 		}
 	out:
 		spin_unlock_irqrestore(&substream->runtime->lock, flags);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 042/328] ARM: hisi: handle of_iomap and fix missing of_node_put
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (182 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 173/328] ipv6: fix cleanup ordering for pingv6 registration Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 212/328] ACPI / bus: Only call dmi_check_system() on X86 Ben Hutchings
                   ` (143 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Nicholas Mc Guire, Wei Xu

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Mc Guire <hofrat@osadl.org>

commit d396cb185c0337aae5664b250cdd9a73f6eb1503 upstream.

Relying on an unchecked of_iomap() which can return NULL is problematic
here, an explicit check seems mandatory. Also the call to
of_find_compatible_node() returns a device node with refcount incremented
therefor an explicit of_node_put() is needed here.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: commit 22bae4290457 ("ARM: hi3xxx: add hotplug support")
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm/mach-hisi/hotplug.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

--- a/arch/arm/mach-hisi/hotplug.c
+++ b/arch/arm/mach-hisi/hotplug.c
@@ -137,13 +137,20 @@ static int hi3xxx_hotplug_init(void)
 	struct device_node *node;
 
 	node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
-	if (node) {
-		ctrl_base = of_iomap(node, 0);
-		id = HI3620_CTRL;
-		return 0;
+	if (!node) {
+		id = ERROR_CTRL;
+		return -ENOENT;
 	}
-	id = ERROR_CTRL;
-	return -ENOENT;
+
+	ctrl_base = of_iomap(node, 0);
+	of_node_put(node);
+	if (!ctrl_base) {
+		id = ERROR_CTRL;
+		return -ENOMEM;
+	}
+
+	id = HI3620_CTRL;
+	return 0;
 }
 
 void hi3xxx_set_cpu(int cpu, bool enable)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 155/328] reiserfs: fix broken xattr handling (heap corruption, bad retval)
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (63 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 058/328] udlfb: fix semaphore value leak Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 090/328] ext4: check for NUL characters in extended attribute's name Ben Hutchings
                   ` (262 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Al Viro, Linus Torvalds, Jeff Mahoney, Eric Biggers, Jann Horn

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jann Horn <jannh@google.com>

commit a13f085d111e90469faf2d9965eb39b11c114d7e upstream.

This fixes the following issues:

- When a buffer size is supplied to reiserfs_listxattr() such that each
  individual name fits, but the concatenation of all names doesn't fit,
  reiserfs_listxattr() overflows the supplied buffer.  This leads to a
  kernel heap overflow (verified using KASAN) followed by an out-of-bounds
  usercopy and is therefore a security bug.

- When a buffer size is supplied to reiserfs_listxattr() such that a
  name doesn't fit, -ERANGE should be returned.  But reiserfs instead just
  truncates the list of names; I have verified that if the only xattr on a
  file has a longer name than the supplied buffer length, listxattr()
  incorrectly returns zero.

With my patch applied, -ERANGE is returned in both cases and the memory
corruption doesn't happen anymore.

Credit for making me clean this code up a bit goes to Al Viro, who pointed
out that the ->actor calling convention is suboptimal and should be
changed.

Link: http://lkml.kernel.org/r/20180802151539.5373-1-jannh@google.com
Fixes: 48b32a3553a5 ("reiserfs: use generic xattr handlers")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Jeff Mahoney <jeffm@suse.com>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.16:
 - The xattr handler's list operation does the copy, so also update the
   buffer size we pass to it
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -822,10 +822,12 @@ static int listxattr_filler(void *buf, c
 			return 0;
 		if (b->buf) {
 			size = handler->list(b->dentry, b->buf + b->pos,
-					 b->size, name, namelen,
+					 b->size - b->pos, name, namelen,
 					 handler->flags);
-			if (size > b->size)
+			if (b->pos + size > b->size) {
+				b->pos = -ERANGE;
 				return -ERANGE;
+			}
 		} else {
 			size = handler->list(b->dentry, NULL, 0, name,
 					     namelen, handler->flags);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 203/328] spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (55 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 229/328] drm/i915/bdw: Increase IPS disable timeout to 100ms Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 293/328] PM / core: Clear the direct_complete flag on errors Ben Hutchings
                   ` (270 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Laurent Pinchart, Geert Uytterhoeven, Mark Brown

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit 85912a88c1ebcad04a5cfec971771195ce8d6691 upstream.

As typically a shmobile SoC has less DMA channels than devices that can use
DMA, we may want to prioritize access to the DMA channels in the future.
This means that dmaengine_prep_slave_sg() may start failing arbitrarily.

Handle dmaengine_prep_slave_sg() failures gracefully by falling back to
PIO.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/spi/spi-rspi.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -477,7 +477,7 @@ static int rspi_dma_transfer(struct rspi
 					tx->sgl, tx->nents, DMA_TO_DEVICE,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc_tx)
-			return -EIO;
+			goto no_dma;
 
 		irq_mask |= SPCR_SPTIE;
 	}
@@ -486,7 +486,7 @@ static int rspi_dma_transfer(struct rspi
 					rx->sgl, rx->nents, DMA_FROM_DEVICE,
 					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 		if (!desc_rx)
-			return -EIO;
+			goto no_dma;
 
 		irq_mask |= SPCR_SPRIE;
 	}
@@ -540,6 +540,12 @@ static int rspi_dma_transfer(struct rspi
 		enable_irq(rspi->rx_irq);
 
 	return ret;
+
+no_dma:
+	pr_warn_once("%s %s: DMA not available, falling back to PIO\n",
+		     dev_driver_string(&rspi->master->dev),
+		     dev_name(&rspi->master->dev));
+	return -EAGAIN;
 }
 
 static void rspi_receive_init(const struct rspi_data *rspi)
@@ -593,8 +599,10 @@ static int rspi_common_transfer(struct r
 
 	if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
 		/* rx_buf can be NULL on RSPI on SH in TX-only Mode */
-		return rspi_dma_transfer(rspi, &xfer->tx_sg,
-					 xfer->rx_buf ? &xfer->rx_sg : NULL);
+		ret = rspi_dma_transfer(rspi, &xfer->tx_sg,
+					xfer->rx_buf ? &xfer->rx_sg : NULL);
+		if (ret != -EAGAIN)
+			return ret;
 	}
 
 	ret = rspi_pio_transfer(rspi, xfer->tx_buf, xfer->rx_buf, xfer->len);
@@ -648,8 +656,11 @@ static int qspi_transfer_out(struct rspi
 {
 	int ret;
 
-	if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer))
-		return rspi_dma_transfer(rspi, &xfer->tx_sg, NULL);
+	if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
+		ret = rspi_dma_transfer(rspi, &xfer->tx_sg, NULL);
+		if (ret != -EAGAIN)
+			return ret;
+	}
 
 	ret = rspi_pio_transfer(rspi, xfer->tx_buf, NULL, xfer->len);
 	if (ret < 0)
@@ -663,8 +674,11 @@ static int qspi_transfer_out(struct rspi
 
 static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer)
 {
-	if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer))
-		return rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
+	if (rspi->master->can_dma && __rspi_can_dma(rspi, xfer)) {
+		int ret = rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
+		if (ret != -EAGAIN)
+			return ret;
+	}
 
 	return rspi_pio_transfer(rspi, NULL, xfer->rx_buf, xfer->len);
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 146/328] tracing/blktrace: Fix to allow setting same value
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (221 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 049/328] MIPS: Change definition of cpu_relax() for Loongson-3 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 004/328] audit: Fix extended comparison of GID/EGID Ben Hutchings
                   ` (104 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jens Axboe, linux-block, Masami Hiramatsu,
	Steven Rostedt (VMware),
	Ingo Molnar

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

commit 757d9140072054528b13bbe291583d9823cde195 upstream.

Masami Hiramatsu reported:

  Current trace-enable attribute in sysfs returns an error
  if user writes the same setting value as current one,
  e.g.

    # cat /sys/block/sda/trace/enable
    0
    # echo 0 > /sys/block/sda/trace/enable
    bash: echo: write error: Invalid argument
    # echo 1 > /sys/block/sda/trace/enable
    # echo 1 > /sys/block/sda/trace/enable
    bash: echo: write error: Device or resource busy

  But this is not a preferred behavior, it should ignore
  if new setting is same as current one. This fixes the
  problem as below.

    # cat /sys/block/sda/trace/enable
    0
    # echo 0 > /sys/block/sda/trace/enable
    # echo 1 > /sys/block/sda/trace/enable
    # echo 1 > /sys/block/sda/trace/enable

Link: http://lkml.kernel.org/r/20180816103802.08678002@gandalf.local.home

Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Fixes: cd649b8bb830d ("blktrace: remove sysfs_blk_trace_enable_show/store()")
Reported-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/trace/blktrace.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1778,6 +1778,10 @@ static ssize_t sysfs_blk_trace_attr_stor
 	mutex_lock(&q->blk_trace_mutex);
 
 	if (attr == &dev_attr_enable) {
+		if (!!value == !!q->blk_trace) {
+			ret = 0;
+			goto out_unlock_bdev;
+		}
 		if (value)
 			ret = blk_trace_setup_queue(q, bdev);
 		else


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 185/328] xfrm6: call kfree_skb when skb is toobig
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (13 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 148/328] KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 180/328] igmp: fix incorrect unsolicit report count when join group Ben Hutchings
                   ` (312 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Sabrina Dubroca, Steffen Klassert, Thadeu Lima de Souza Cascardo

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

commit 215ab0f021c9fea3c18b75e7d522400ee6a49990 upstream.

After commit d6990976af7c5d8f55903bfb4289b6fb030bf754 ("vti6: fix PMTU caching
and reporting on xmit"), some too big skbs might be potentially passed down to
__xfrm6_output, causing it to fail to transmit but not free the skb, causing a
leak of skb, and consequentially a leak of dst references.

After running pmtu.sh, that shows as failure to unregister devices in a namespace:

[  311.397671] unregister_netdevice: waiting for veth_b to become free. Usage count = 1

The fix is to call kfree_skb in case of transmit failures.

Fixes: dd767856a36e ("xfrm6: Don't call icmpv6_send on local error")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ipv6/xfrm6_output.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -158,9 +158,11 @@ static int __xfrm6_output(struct sk_buff
 
 	if (toobig && xfrm6_local_dontfrag(skb)) {
 		xfrm6_local_rxpmtu(skb, mtu);
+		kfree_skb(skb);
 		return -EMSGSIZE;
 	} else if (!skb->ignore_df && toobig && skb->sk) {
 		xfrm_local_error(skb, mtu);
+		kfree_skb(skb);
 		return -EMSGSIZE;
 	}
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 154/328] fs/quota: Fix spectre gadget in do_quotactl
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (72 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 170/328] usb: gadget: udc: net2280: do not rely on 'driver' argument Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 051/328] PCI: pciehp: Fix use-after-free on unplug Ben Hutchings
                   ` (253 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jeremy Cline, Josh Poimboeuf, Jan Kara

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jeremy Cline <jcline@redhat.com>

commit 7b6924d94a60c6b8c1279ca003e8744e6cd9e8b1 upstream.

'type' is user-controlled, so sanitize it after the bounds check to
avoid using it in speculative execution. This covers the following
potential gadgets detected with the help of smatch:

* fs/ext4/super.c:5741 ext4_quota_read() warn: potential spectre issue
  'sb_dqopt(sb)->files' [r]
* fs/ext4/super.c:5778 ext4_quota_write() warn: potential spectre issue
  'sb_dqopt(sb)->files' [r]
* fs/f2fs/super.c:1552 f2fs_quota_read() warn: potential spectre issue
  'sb_dqopt(sb)->files' [r]
* fs/f2fs/super.c:1608 f2fs_quota_write() warn: potential spectre issue
  'sb_dqopt(sb)->files' [r]
* fs/quota/dquot.c:412 mark_info_dirty() warn: potential spectre issue
  'sb_dqopt(sb)->info' [w]
* fs/quota/dquot.c:933 dqinit_needed() warn: potential spectre issue
  'dquots' [r]
* fs/quota/dquot.c:2112 dquot_commit_info() warn: potential spectre
  issue 'dqopt->ops' [r]
* fs/quota/dquot.c:2362 vfs_load_quota_inode() warn: potential spectre
  issue 'dqopt->files' [w] (local cap)
* fs/quota/dquot.c:2369 vfs_load_quota_inode() warn: potential spectre
  issue 'dqopt->ops' [w] (local cap)
* fs/quota/dquot.c:2370 vfs_load_quota_inode() warn: potential spectre
  issue 'dqopt->info' [w] (local cap)
* fs/quota/quota.c:110 quota_getfmt() warn: potential spectre issue
  'sb_dqopt(sb)->info' [r]
* fs/quota/quota_v2.c:84 v2_check_quota_file() warn: potential spectre
  issue 'quota_magics' [w]
* fs/quota/quota_v2.c:85 v2_check_quota_file() warn: potential spectre
  issue 'quota_versions' [w]
* fs/quota/quota_v2.c:96 v2_read_file_info() warn: potential spectre
  issue 'dqopt->info' [r]
* fs/quota/quota_v2.c:172 v2_write_file_info() warn: potential spectre
  issue 'dqopt->info' [r]

Additionally, a quick inspection indicates there are array accesses with
'type' in quota_on() and quota_off() functions which are also addressed
by this.

Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
[bwh: Backported to 3.16: The maximum valid quota type is command-dependent.
 Introduce a local variable rather than repeating the expression.]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -17,6 +17,7 @@
 #include <linux/quotaops.h>
 #include <linux/types.h>
 #include <linux/writeback.h>
+#include <linux/nospec.h>
 
 static int check_quotactl_permission(struct super_block *sb, int type, int cmd,
 				     qid_t id)
@@ -405,10 +406,12 @@ static int quota_rmxquota(struct super_b
 static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id,
 		       void __user *addr, struct path *path)
 {
+	unsigned int max_quotas = XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS;
 	int ret;
 
-	if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS))
+	if (type >= max_quotas)
 		return -EINVAL;
+	type = array_index_nospec(type, max_quotas);
 	if (!sb->s_qcop)
 		return -ENOSYS;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 131/328] 9p: fix multiple NULL-pointer-dereferences
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (100 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 040/328] tty: fix termios input-speed encoding when using BOTHER Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 069/328] ALSA: vxpocket: Fix invalid endian conversions Ben Hutchings
                   ` (225 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, syzbot+1a262da37d3bead15c39, Tomas Bortoli, Dominique Martinet

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Tomas Bortoli <tomasbortoli@gmail.com>

commit 10aa14527f458e9867cf3d2cc6b8cb0f6704448b upstream.

Added checks to prevent GPFs from raising.

Link: http://lkml.kernel.org/r/20180727110558.5479-1-tomasbortoli@gmail.com
Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
Reported-by: syzbot+1a262da37d3bead15c39@syzkaller.appspotmail.com
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
[bwh: Backported to 3.16:
 - Drop changes in trans_xen.c
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -934,7 +934,7 @@ p9_fd_create_tcp(struct p9_client *clien
 	if (err < 0)
 		return err;
 
-	if (valid_ipaddr4(addr) < 0)
+	if (addr == NULL || valid_ipaddr4(addr) < 0)
 		return -EINVAL;
 
 	csocket = NULL;
@@ -982,6 +982,9 @@ p9_fd_create_unix(struct p9_client *clie
 
 	csocket = NULL;
 
+	if (addr == NULL)
+		return -EINVAL;
+
 	if (strlen(addr) >= UNIX_PATH_MAX) {
 		pr_err("%s (%d): address too long: %s\n",
 		       __func__, task_pid_nr(current), addr);
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -623,6 +623,9 @@ rdma_create_trans(struct p9_client *clie
 	struct ib_qp_init_attr qp_attr;
 	struct ib_device_attr devattr;
 
+	if (addr == NULL)
+		return -EINVAL;
+
 	/* Parse the transport specific mount options */
 	err = parse_opts(args, &opts);
 	if (err < 0)
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -622,6 +622,9 @@ p9_virtio_create(struct p9_client *clien
 	int ret = -ENOENT;
 	int found = 0;
 
+	if (devname == NULL)
+		return -EINVAL;
+
 	mutex_lock(&virtio_9p_lock);
 	list_for_each_entry(chan, &virtio_chan_list, chan_list) {
 		if (!strncmp(devname, chan->tag, chan->tag_len) &&


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 068/328] ALSA: vx222: Fix invalid endian conversions
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (216 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 106/328] mac802154: tx: use put_unaligned_le16 for copy crc Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 213/328] batman-adv: Prevent duplicated gateway_node entry Ben Hutchings
                   ` (109 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit fff71a4c050ba46e305d910c837b99ba1728135e upstream.

The endian conversions used in vx2_dma_read() and vx2_dma_write() are
superfluous and even wrong on big-endian machines, as inl() and outl()
already do conversions.  Kill them.

Spotted by sparse, a warning like:
  sound/pci/vx222/vx222_ops.c:278:30: warning: incorrect type in argument 1 (different base types)

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/pci/vx222/vx222_ops.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -270,7 +270,7 @@ static void vx2_dma_write(struct vx_core
 		length >>= 2; /* in 32bit words */
 		/* Transfer using pseudo-dma. */
 		for (; length > 0; length--) {
-			outl(cpu_to_le32(*addr), port);
+			outl(*addr, port);
 			addr++;
 		}
 		addr = (u32 *)runtime->dma_area;
@@ -280,7 +280,7 @@ static void vx2_dma_write(struct vx_core
 	count >>= 2; /* in 32bit words */
 	/* Transfer using pseudo-dma. */
 	for (; count > 0; count--) {
-		outl(cpu_to_le32(*addr), port);
+		outl(*addr, port);
 		addr++;
 	}
 
@@ -308,7 +308,7 @@ static void vx2_dma_read(struct vx_core
 		length >>= 2; /* in 32bit words */
 		/* Transfer using pseudo-dma. */
 		for (; length > 0; length--)
-			*addr++ = le32_to_cpu(inl(port));
+			*addr++ = inl(port);
 		addr = (u32 *)runtime->dma_area;
 		pipe->hw_ptr = 0;
 	}
@@ -316,7 +316,7 @@ static void vx2_dma_read(struct vx_core
 	count >>= 2; /* in 32bit words */
 	/* Transfer using pseudo-dma. */
 	for (; count > 0; count--)
-		*addr++ = le32_to_cpu(inl(port));
+		*addr++ = inl(port);
 
 	vx2_release_pseudo_dma(chip);
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 047/328] xen-netfront: fix queue name setting
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (148 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 222/328] i2c: xiic: Make the start and the byte count write atomic Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 23:24   ` Vitaly Kuznetsov
  2018-12-09 21:50 ` [PATCH 3.16 127/328] net/9p/client.c: version pointer uninitialized Ben Hutchings
                   ` (177 subsequent siblings)
  327 siblings, 1 reply; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Vitaly Kuznetsov, David S. Miller, Ross Lagerwall

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Vitaly Kuznetsov <vkuznets@redhat.com>

commit 2d408c0d4574b01b9ed45e02516888bf925e11a9 upstream.

Commit f599c64fdf7d ("xen-netfront: Fix race between device setup and
open") changed the initialization order: xennet_create_queues() now
happens before we do register_netdev() so using netdev->name in
xennet_init_queue() is incorrect, we end up with the following in
/proc/interrupts:

 60:        139          0   xen-dyn    -event     eth%d-q0-tx
 61:        265          0   xen-dyn    -event     eth%d-q0-rx
 62:        234          0   xen-dyn    -event     eth%d-q1-tx
 63:          1          0   xen-dyn    -event     eth%d-q1-rx

and this looks ugly. Actually, using early netdev name (even when it's
already set) is also not ideal: nowadays we tend to rename eth devices
and queue name may end up not corresponding to the netdev name.

Use nodename from xenbus device for queue naming: this can't change in VM's
lifetime. Now /proc/interrupts looks like

 62:        202          0   xen-dyn    -event     device/vif/0-q0-tx
 63:        317          0   xen-dyn    -event     device/vif/0-q0-rx
 64:        262          0   xen-dyn    -event     device/vif/0-q1-tx
 65:         17          0   xen-dyn    -event     device/vif/0-q1-rx

Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/xen-netfront.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1646,7 +1646,7 @@ static int xennet_init_queue(struct netf
 	queue->rx_refill_timer.function = rx_refill_timeout;
 
 	snprintf(queue->name, sizeof(queue->name), "%s-q%u",
-		 queue->info->netdev->name, queue->id);
+		 queue->info->xbdev->nodename, queue->id);
 
 	/* Initialise tx_skbs as a free chain containing every entry. */
 	queue->tx_skb_freelist = 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 152/328] ISCSI: fix minor memory leak
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (184 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 212/328] ACPI / bus: Only call dmi_check_system() on X86 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 088/328] udl-kms: fix crash due to uninitialized memory Ben Hutchings
                   ` (141 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Evgenii Lepikhin, Nicholas Bellinger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Evgenii Lepikhin <johnlepikhin@gmail.com>

commit a928d28d4487402e6bd18bea1b8cc2b2ec6e6d8f upstream.

This patch adds a missing kfree for sess->sess_ops memory upon
transport_init_session() failure.

Signed-off-by: Evgenii Lepikhin <johnlepikhin@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/target/iscsi/iscsi_target_login.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -348,6 +348,7 @@ static int iscsi_login_zero_tsih_s1(
 	if (IS_ERR(sess->se_sess)) {
 		iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
 				ISCSI_LOGIN_STATUS_NO_RESOURCES);
+		kfree(sess->sess_ops);
 		kfree(sess);
 		return -ENOMEM;
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 124/328] powerpc/fadump: handle crash memory ranges array index overflow
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (244 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 275/328] r8152: Check for supported Wake-on-LAN Modes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 159/328] mm/tlb: Remove tlb_remove_table() non-concurrent condition Ben Hutchings
                   ` (81 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Hari Bathini, Mahesh Salgaonkar, Michael Ellerman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Hari Bathini <hbathini@linux.ibm.com>

commit 1bd6a1c4b80a28d975287630644e6b47d0f977a5 upstream.

Crash memory ranges is an array of memory ranges of the crashing kernel
to be exported as a dump via /proc/vmcore file. The size of the array
is set based on INIT_MEMBLOCK_REGIONS, which works alright in most cases
where memblock memory regions count is less than INIT_MEMBLOCK_REGIONS
value. But this count can grow beyond INIT_MEMBLOCK_REGIONS value since
commit 142b45a72e22 ("memblock: Add array resizing support").

On large memory systems with a few DLPAR operations, the memblock memory
regions count could be larger than INIT_MEMBLOCK_REGIONS value. On such
systems, registering fadump results in crash or other system failures
like below:

  task: c00007f39a290010 ti: c00000000b738000 task.ti: c00000000b738000
  NIP: c000000000047df4 LR: c0000000000f9e58 CTR: c00000000010f180
  REGS: c00000000b73b570 TRAP: 0300   Tainted: G          L   X  (4.4.140+)
  MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE>  CR: 22004484  XER: 20000000
  CFAR: c000000000008500 DAR: 000007a450000000 DSISR: 40000000 SOFTE: 0
  ...
  NIP [c000000000047df4] smp_send_reschedule+0x24/0x80
  LR [c0000000000f9e58] resched_curr+0x138/0x160
  Call Trace:
    resched_curr+0x138/0x160 (unreliable)
    check_preempt_curr+0xc8/0xf0
    ttwu_do_wakeup+0x38/0x150
    try_to_wake_up+0x224/0x4d0
    __wake_up_common+0x94/0x100
    ep_poll_callback+0xac/0x1c0
    __wake_up_common+0x94/0x100
    __wake_up_sync_key+0x70/0xa0
    sock_def_readable+0x58/0xa0
    unix_stream_sendmsg+0x2dc/0x4c0
    sock_sendmsg+0x68/0xa0
    ___sys_sendmsg+0x2cc/0x2e0
    __sys_sendmsg+0x5c/0xc0
    SyS_socketcall+0x36c/0x3f0
    system_call+0x3c/0x100

as array index overflow is not checked for while setting up crash memory
ranges causing memory corruption. To resolve this issue, dynamically
allocate memory for crash memory ranges and resize it incrementally,
in units of pagesize, on hitting array size limit.

Fixes: 2df173d9e85d ("fadump: Initialize elfcore header and add PT_LOAD program headers.")
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Reviewed-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
[mpe: Just use PAGE_SIZE directly, fixup variable placement]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
[bwh: Backported to 3.16:
 - register_fadump() returns void
 - Include <linux/slab.h> for kfree(), krealloc()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/powerpc/include/asm/fadump.h
+++ b/arch/powerpc/include/asm/fadump.h
@@ -194,9 +194,6 @@ struct fadump_crash_info_header {
 	struct cpumask	cpu_online_mask;
 };
 
-/* Crash memory ranges */
-#define INIT_CRASHMEM_RANGES	(INIT_MEMBLOCK_REGIONS + 2)
-
 struct fad_crash_memory_ranges {
 	unsigned long long	base;
 	unsigned long long	size;
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -35,6 +35,7 @@
 #include <linux/crash_dump.h>
 #include <linux/kobject.h>
 #include <linux/sysfs.h>
+#include <linux/slab.h>
 
 #include <asm/page.h>
 #include <asm/prom.h>
@@ -48,8 +49,10 @@ static struct fadump_mem_struct fdm;
 static const struct fadump_mem_struct *fdm_active;
 
 static DEFINE_MUTEX(fadump_mutex);
-struct fad_crash_memory_ranges crash_memory_ranges[INIT_CRASHMEM_RANGES];
+struct fad_crash_memory_ranges *crash_memory_ranges;
+int crash_memory_ranges_size;
 int crash_mem_ranges;
+int max_crash_mem_ranges;
 
 /* Scan the Firmware Assisted dump configuration details. */
 int __init early_init_dt_scan_fw_dump(unsigned long node,
@@ -726,38 +729,88 @@ static int __init process_fadump(const s
 	return 0;
 }
 
-static inline void fadump_add_crash_memory(unsigned long long base,
-					unsigned long long end)
+static void free_crash_memory_ranges(void)
+{
+	kfree(crash_memory_ranges);
+	crash_memory_ranges = NULL;
+	crash_memory_ranges_size = 0;
+	max_crash_mem_ranges = 0;
+}
+
+/*
+ * Allocate or reallocate crash memory ranges array in incremental units
+ * of PAGE_SIZE.
+ */
+static int allocate_crash_memory_ranges(void)
+{
+	struct fad_crash_memory_ranges *new_array;
+	u64 new_size;
+
+	new_size = crash_memory_ranges_size + PAGE_SIZE;
+	pr_debug("Allocating %llu bytes of memory for crash memory ranges\n",
+		 new_size);
+
+	new_array = krealloc(crash_memory_ranges, new_size, GFP_KERNEL);
+	if (new_array == NULL) {
+		pr_err("Insufficient memory for setting up crash memory ranges\n");
+		free_crash_memory_ranges();
+		return -ENOMEM;
+	}
+
+	crash_memory_ranges = new_array;
+	crash_memory_ranges_size = new_size;
+	max_crash_mem_ranges = (new_size /
+				sizeof(struct fad_crash_memory_ranges));
+	return 0;
+}
+
+static inline int fadump_add_crash_memory(unsigned long long base,
+					  unsigned long long end)
 {
 	if (base == end)
-		return;
+		return 0;
+
+	if (crash_mem_ranges == max_crash_mem_ranges) {
+		int ret;
+
+		ret = allocate_crash_memory_ranges();
+		if (ret)
+			return ret;
+	}
 
 	pr_debug("crash_memory_range[%d] [%#016llx-%#016llx], %#llx bytes\n",
 		crash_mem_ranges, base, end - 1, (end - base));
 	crash_memory_ranges[crash_mem_ranges].base = base;
 	crash_memory_ranges[crash_mem_ranges].size = end - base;
 	crash_mem_ranges++;
+	return 0;
 }
 
-static void fadump_exclude_reserved_area(unsigned long long start,
+static int fadump_exclude_reserved_area(unsigned long long start,
 					unsigned long long end)
 {
 	unsigned long long ra_start, ra_end;
+	int ret = 0;
 
 	ra_start = fw_dump.reserve_dump_area_start;
 	ra_end = ra_start + fw_dump.reserve_dump_area_size;
 
 	if ((ra_start < end) && (ra_end > start)) {
 		if ((start < ra_start) && (end > ra_end)) {
-			fadump_add_crash_memory(start, ra_start);
-			fadump_add_crash_memory(ra_end, end);
+			ret = fadump_add_crash_memory(start, ra_start);
+			if (ret)
+				return ret;
+
+			ret = fadump_add_crash_memory(ra_end, end);
 		} else if (start < ra_start) {
-			fadump_add_crash_memory(start, ra_start);
+			ret = fadump_add_crash_memory(start, ra_start);
 		} else if (ra_end < end) {
-			fadump_add_crash_memory(ra_end, end);
+			ret = fadump_add_crash_memory(ra_end, end);
 		}
 	} else
-		fadump_add_crash_memory(start, end);
+		ret = fadump_add_crash_memory(start, end);
+
+	return ret;
 }
 
 static int fadump_init_elfcore_header(char *bufp)
@@ -793,10 +846,11 @@ static int fadump_init_elfcore_header(ch
  * Traverse through memblock structure and setup crash memory ranges. These
  * ranges will be used create PT_LOAD program headers in elfcore header.
  */
-static void fadump_setup_crash_memory_ranges(void)
+static int fadump_setup_crash_memory_ranges(void)
 {
 	struct memblock_region *reg;
 	unsigned long long start, end;
+	int ret;
 
 	pr_debug("Setup crash memory ranges.\n");
 	crash_mem_ranges = 0;
@@ -807,7 +861,9 @@ static void fadump_setup_crash_memory_ra
 	 * specified during fadump registration. We need to create a separate
 	 * program header for this chunk with the correct offset.
 	 */
-	fadump_add_crash_memory(RMA_START, fw_dump.boot_memory_size);
+	ret = fadump_add_crash_memory(RMA_START, fw_dump.boot_memory_size);
+	if (ret)
+		return ret;
 
 	for_each_memblock(memory, reg) {
 		start = (unsigned long long)reg->base;
@@ -816,8 +872,12 @@ static void fadump_setup_crash_memory_ra
 			start = fw_dump.boot_memory_size;
 
 		/* add this range excluding the reserved dump area. */
-		fadump_exclude_reserved_area(start, end);
+		ret = fadump_exclude_reserved_area(start, end);
+		if (ret)
+			return ret;
 	}
+
+	return 0;
 }
 
 /*
@@ -941,6 +1001,7 @@ static void register_fadump(void)
 {
 	unsigned long addr;
 	void *vaddr;
+	int ret;
 
 	/*
 	 * If no memory is reserved then we can not register for firmware-
@@ -949,7 +1010,9 @@ static void register_fadump(void)
 	if (!fw_dump.reserve_dump_area_size)
 		return;
 
-	fadump_setup_crash_memory_ranges();
+	ret = fadump_setup_crash_memory_ranges();
+	if (ret)
+		return;
 
 	addr = fdm.rmr_region.destination_address + fdm.rmr_region.source_len;
 	/* Initialize fadump crash info header. */
@@ -1028,6 +1091,7 @@ void fadump_cleanup(void)
 	} else if (fw_dump.dump_registered) {
 		/* Un-register Firmware-assisted dump if it was registered. */
 		fadump_unregister_dump(&fdm);
+		free_crash_memory_ranges();
 	}
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 063/328] udlfb: handle allocation failure
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (166 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 309/328] net: make skb_partial_csum_set() more robust against overflows Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 002/328] EDAC: i7core: Return proper error codes for kzalloc() errors Ben Hutchings
                   ` (159 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mikulas Patocka, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 080fb5240bdcabed7387b814139c3ea172d59fc5 upstream.

Allocations larger than PAGE_ALLOC_COSTLY_ORDER are unreliable and they
may fail anytime. This patch fixes the udlfb driver so that when a large
alloactions fails, it tries to do multiple smaller allocations.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16:
 - Pointers to struct dlfb_data are named "dev" rather than "dlfb"
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -1851,17 +1851,22 @@ static void dlfb_free_urb_list(struct dl
 
 static int dlfb_alloc_urb_list(struct dlfb_data *dev, int count, size_t size)
 {
-	int i = 0;
 	struct urb *urb;
 	struct urb_node *unode;
 	char *buf;
+	size_t wanted_size = count * size;
 
 	spin_lock_init(&dev->urbs.lock);
 
+retry:
 	dev->urbs.size = size;
 	INIT_LIST_HEAD(&dev->urbs.list);
 
-	while (i < count) {
+	sema_init(&dev->urbs.limit_sem, 0);
+	dev->urbs.count = 0;
+	dev->urbs.available = 0;
+
+	while (dev->urbs.count * size < wanted_size) {
 		unode = kzalloc(sizeof(struct urb_node), GFP_KERNEL);
 		if (!unode)
 			break;
@@ -1874,11 +1879,16 @@ static int dlfb_alloc_urb_list(struct dl
 		}
 		unode->urb = urb;
 
-		buf = usb_alloc_coherent(dev->udev, MAX_TRANSFER, GFP_KERNEL,
+		buf = usb_alloc_coherent(dev->udev, size, GFP_KERNEL,
 					 &urb->transfer_dma);
 		if (!buf) {
 			kfree(unode);
 			usb_free_urb(urb);
+			if (size > PAGE_SIZE) {
+				size /= 2;
+				dlfb_free_urb_list(dev);
+				goto retry;
+			}
 			break;
 		}
 
@@ -1889,14 +1899,12 @@ static int dlfb_alloc_urb_list(struct dl
 
 		list_add_tail(&unode->entry, &dev->urbs.list);
 
-		i++;
+		up(&dev->urbs.limit_sem);
+		dev->urbs.count++;
+		dev->urbs.available++;
 	}
 
-	sema_init(&dev->urbs.limit_sem, i);
-	dev->urbs.count = i;
-	dev->urbs.available = i;
-
-	return i;
+	return dev->urbs.count;
 }
 
 static struct urb *dlfb_get_urb(struct dlfb_data *dev)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 123/328] powerpc: Fix size calculation using resource_size()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (278 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 129/328] net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 262/328] USB: serial: simple: add Motorola Tetra MTP6550 id Ben Hutchings
                   ` (47 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Michael Ellerman, Tyrel Datwyler, Dan Carpenter

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit c42d3be0c06f0c1c416054022aa535c08a1f9b39 upstream.

The problem is the the calculation should be "end - start + 1" but the
plus one is missing in this calculation.

Fixes: 8626816e905e ("powerpc: add support for MPIC message register API")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/powerpc/sysdev/mpic_msgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -196,7 +196,7 @@ static int mpic_msgr_probe(struct platfo
 
 	/* IO map the message register block. */
 	of_address_to_resource(np, 0, &rsrc);
-	msgr_block_addr = ioremap(rsrc.start, rsrc.end - rsrc.start);
+	msgr_block_addr = ioremap(rsrc.start, resource_size(&rsrc));
 	if (!msgr_block_addr) {
 		dev_err(&dev->dev, "Failed to iomap MPIC message registers");
 		return -EFAULT;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 150/328] x86/process: Re-export start_thread()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (109 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 162/328] hwmon: (nct6775) Fix potential Spectre v1 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 044/328] mtdchar: fix overflows in adjustment of `count` Ben Hutchings
                   ` (216 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Andy Lutomirski, Vitaly Kuznetsov, H. Peter Anvin,
	Thomas Gleixner, Josh Poimboeuf, Borislav Petkov, Dmitry Safonov,
	Rian Hunter, Joerg Roedel

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Rian Hunter <rian@alum.mit.edu>

commit dc76803e57cc86589c4efcb5362918f9b0c0436f upstream.

The consolidation of the start_thread() functions removed the export
unintentionally. This breaks binfmt handlers built as a module.

Add it back.

Fixes: e634d8fc792c ("x86-64: merge the standard and compat start_thread() functions")
Signed-off-by: Rian Hunter <rian@alum.mit.edu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Dmitry Safonov <dima@arista.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20180819230854.7275-1-rian@alum.mit.edu
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/kernel/process_64.c | 1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -254,6 +254,7 @@ start_thread(struct pt_regs *regs, unsig
 	start_thread_common(regs, new_ip, new_sp,
 			    __USER_CS, __USER_DS, 0);
 }
+EXPORT_SYMBOL_GPL(start_thread);
 
 #ifdef CONFIG_IA32_EMULATION
 void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 212/328] ACPI / bus: Only call dmi_check_system() on X86
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (183 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 042/328] ARM: hisi: handle of_iomap and fix missing of_node_put Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 152/328] ISCSI: fix minor memory leak Ben Hutchings
                   ` (142 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jean Delvare, Rafael J. Wysocki

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jean Delvare <jdelvare@suse.de>

commit 5d128fbd8b20f8a48cb13c3eced789d1f9573ecd upstream.

Calling dmi_check_system() early only works on X86. Other
architectures initialize the DMI subsystem later so it's not
ready yet when ACPI itself gets initialized.

In the best case it results in a useless call to a function which
will do nothing. But depending on the dmi implementation, it could
also result in warnings. Best is to not call the function when it
can't work and isn't needed.

Additionally, if anyone ever needs to add non-x86 quirks, it would
surprisingly not work, so document the limitation to avoid confusion.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: cce4f632db20 (ACPI: fix early DSDT dmi check warnings on ia64)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/acpi/bus.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -36,10 +36,10 @@
 #include <linux/regulator/machine.h>
 #ifdef CONFIG_X86
 #include <asm/mpspec.h>
+#include <linux/dmi.h>
 #endif
 #include <linux/pci.h>
 #include <acpi/apei.h>
-#include <linux/dmi.h>
 #include <linux/suspend.h>
 
 #include "internal.h"
@@ -82,10 +82,6 @@ static struct dmi_system_id dsdt_dmi_tab
 	},
 	{}
 };
-#else
-static struct dmi_system_id dsdt_dmi_table[] __initdata = {
-	{}
-};
 #endif
 
 /* --------------------------------------------------------------------------
@@ -508,11 +504,16 @@ void __init acpi_early_init(void)
 
 	acpi_gbl_permanent_mmap = 1;
 
+#ifdef CONFIG_X86
 	/*
 	 * If the machine falls into the DMI check table,
-	 * DSDT will be copied to memory
+	 * DSDT will be copied to memory.
+	 * Note that calling dmi_check_system() here on other architectures
+	 * would not be OK because only x86 initializes dmi early enough.
+	 * Thankfully only x86 systems need such quirks for now.
 	 */
 	dmi_check_system(dsdt_dmi_table);
+#endif
 
 	status = acpi_reallocate_root_table();
 	if (ACPI_FAILURE(status)) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 130/328] fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (178 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 080/328] media: gl861: fix probe of dvb_usb_gl861 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 300/328] proc: restrict kernel stack dumps to root Ben Hutchings
                   ` (147 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dominique Martinet, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, piaojun

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: piaojun <piaojun@huawei.com>

commit 3111784bee81591ea2815011688d28b65df03627 upstream.

In my testing, v9fs_fid_xattr_set will return successfully even if the
backend ext4 filesystem has no space to store xattr key-value. That will
cause inconsistent behavior between front end and back end. The reason is
that lsetxattr will be triggered by p9_client_clunk, and unfortunately we
did not catch the error. This patch will catch the error to notify upper
caller.

p9_client_clunk (in 9p)
  p9_client_rpc(clnt, P9_TCLUNK, "d", fid->fid);
    v9fs_clunk (in qemu)
      put_fid
        free_fid
          v9fs_xattr_fid_clunk
            v9fs_co_lsetxattr
              s->ops->lsetxattr
                ext4_xattr_user_set (in host ext4 filesystem)

Link: http://lkml.kernel.org/r/5B57EACC.2060900@huawei.com
Signed-off-by: Jun Piao <piaojun@huawei.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/9p/xattr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -121,7 +121,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fi
 		   const void *value, size_t value_len, int flags)
 {
 	u64 offset = 0;
-	int retval, msize, write_count;
+	int retval, err, msize, write_count;
 
 	p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n",
 		 name, value_len, flags);
@@ -158,7 +158,9 @@ int v9fs_fid_xattr_set(struct p9_fid *fi
 	}
 	retval = 0;
 err:
-	p9_client_clunk(fid);
+	err = p9_client_clunk(fid);
+	if (!retval && err)
+		retval = err;
 	return retval;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 036/328] mei: bus: type promotion bug in mei_nfc_if_version()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (11 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 196/328] USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 148/328] KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function Ben Hutchings
                   ` (314 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dan Carpenter, Greg Kroah-Hartman, Tomas Winkler

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit b40b3e9358fbafff6a4ba0f4b9658f6617146f9c upstream.

We accidentally removed the check for negative returns
without considering the issue of type promotion.
The "if_version_length" variable is type size_t so if __mei_cl_recv()
returns a negative then "bytes_recv" is type promoted
to a high positive value and treated as success.

Fixes: 582ab27a063a ("mei: bus: fix received data size check in NFC fixup")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/misc/mei/nfc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/misc/mei/nfc.c
+++ b/drivers/misc/mei/nfc.c
@@ -292,7 +292,7 @@ static int mei_nfc_if_version(struct mei
 		return -ENOMEM;
 
 	bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length);
-	if (bytes_recv < if_version_length) {
+	if (bytes_recv < 0 || bytes_recv < if_version_length) {
 		dev_err(&dev->pdev->dev, "Could not read IF version\n");
 		ret = -EIO;
 		goto err;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 192/328] RDMA/cxgb4: Only call CQ completion handler if it is armed
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (180 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 300/328] proc: restrict kernel stack dumps to root Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 173/328] ipv6: fix cleanup ordering for pingv6 registration Ben Hutchings
                   ` (145 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Roland Dreier, Steve Wise

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steve Wise <swise@opengridcomputing.com>

commit 678ea9b5baab6800692b249bdba77c3c07261d61 upstream.

The function __flush_qp() always calls the ULP's CQ completion handler
functions even if the CQ was not armed.  This can crash the system if
the function pointer is NULL. The iSER ULP behaves this way: no
completion handler and never arm the CQ for notification.  So now we
track whether the CQ is armed at flush time and only call the
completion handlers if their CQs were armed.

Also, if the RCQ and SCQ are the same CQ, the completion handler is
getting called twice.  It should only be called once after all SQ and
RQ WRs are flushed from the QP.  So rearrange the logic to fix this.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/hw/cxgb4/ev.c |  1 +
 drivers/infiniband/hw/cxgb4/qp.c | 37 +++++++++++++++++++++-----------
 drivers/infiniband/hw/cxgb4/t4.h | 11 ++++++++++
 3 files changed, 37 insertions(+), 12 deletions(-)

--- a/drivers/infiniband/hw/cxgb4/ev.c
+++ b/drivers/infiniband/hw/cxgb4/ev.c
@@ -182,6 +182,7 @@ int c4iw_ev_handler(struct c4iw_dev *dev
 
 	chp = get_chp(dev, qid);
 	if (chp) {
+		t4_clear_cq_armed(&chp->cq);
 		spin_lock_irqsave(&chp->comp_handler_lock, flag);
 		(*chp->ibcq.comp_handler)(&chp->ibcq, chp->ibcq.cq_context);
 		spin_unlock_irqrestore(&chp->comp_handler_lock, flag);
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1066,7 +1066,7 @@ static void __flush_qp(struct c4iw_qp *q
 		       struct c4iw_cq *schp)
 {
 	int count;
-	int flushed;
+	int rq_flushed, sq_flushed;
 	unsigned long flag;
 
 	PDBG("%s qhp %p rchp %p schp %p\n", __func__, qhp, rchp, schp);
@@ -1084,27 +1084,40 @@ static void __flush_qp(struct c4iw_qp *q
 
 	c4iw_flush_hw_cq(rchp, qhp);
 	c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
-	flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
+	rq_flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
 	spin_unlock(&qhp->lock);
 	spin_unlock_irqrestore(&rchp->lock, flag);
-	if (flushed) {
-		spin_lock_irqsave(&rchp->comp_handler_lock, flag);
-		(*rchp->ibcq.comp_handler)(&rchp->ibcq, rchp->ibcq.cq_context);
-		spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
-	}
 
 	/* locking hierarchy: cq lock first, then qp lock. */
 	spin_lock_irqsave(&schp->lock, flag);
 	spin_lock(&qhp->lock);
 	if (schp != rchp)
 		c4iw_flush_hw_cq(schp, qhp);
-	flushed = c4iw_flush_sq(qhp);
+	sq_flushed = c4iw_flush_sq(qhp);
 	spin_unlock(&qhp->lock);
 	spin_unlock_irqrestore(&schp->lock, flag);
-	if (flushed) {
-		spin_lock_irqsave(&schp->comp_handler_lock, flag);
-		(*schp->ibcq.comp_handler)(&schp->ibcq, schp->ibcq.cq_context);
-		spin_unlock_irqrestore(&schp->comp_handler_lock, flag);
+
+	if (schp == rchp) {
+		if (t4_clear_cq_armed(&rchp->cq) &&
+		    (rq_flushed || sq_flushed)) {
+			spin_lock_irqsave(&rchp->comp_handler_lock, flag);
+			(*rchp->ibcq.comp_handler)(&rchp->ibcq,
+						   rchp->ibcq.cq_context);
+			spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
+		}
+	} else {
+		if (t4_clear_cq_armed(&rchp->cq) && rq_flushed) {
+			spin_lock_irqsave(&rchp->comp_handler_lock, flag);
+			(*rchp->ibcq.comp_handler)(&rchp->ibcq,
+						   rchp->ibcq.cq_context);
+			spin_unlock_irqrestore(&rchp->comp_handler_lock, flag);
+		}
+		if (t4_clear_cq_armed(&schp->cq) && sq_flushed) {
+			spin_lock_irqsave(&schp->comp_handler_lock, flag);
+			(*schp->ibcq.comp_handler)(&schp->ibcq,
+						   schp->ibcq.cq_context);
+			spin_unlock_irqrestore(&schp->comp_handler_lock, flag);
+		}
 	}
 }
 
--- a/drivers/infiniband/hw/cxgb4/t4.h
+++ b/drivers/infiniband/hw/cxgb4/t4.h
@@ -531,6 +531,10 @@ static inline int t4_wq_db_enabled(struc
 	return !wq->rq.queue[wq->rq.size].status.db_off;
 }
 
+enum t4_cq_flags {
+	CQ_ARMED	= 1,
+};
+
 struct t4_cq {
 	struct t4_cqe *queue;
 	dma_addr_t dma_addr;
@@ -551,12 +555,19 @@ struct t4_cq {
 	u16 cidx_inc;
 	u8 gen;
 	u8 error;
+	unsigned long flags;
 };
 
+static inline int t4_clear_cq_armed(struct t4_cq *cq)
+{
+	return test_and_clear_bit(CQ_ARMED, &cq->flags);
+}
+
 static inline int t4_arm_cq(struct t4_cq *cq, int se)
 {
 	u32 val;
 
+	set_bit(CQ_ARMED, &cq->flags);
 	while (cq->cidx_inc > CIDXINC_MASK) {
 		val = SEINTARM(0) | CIDXINC(CIDXINC_MASK) | TIMERREG(7) |
 		      INGRESSQID(cq->cqid);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 137/328] xtensa: increase ranges in ___invalidate_{i,d}cache_all
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (304 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 204/328] spi: rspi: Fix leaking of unused DMA descriptors Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 031/328] pinctrl: msm: Fix msm_config_group_get() to be compliant Ben Hutchings
                   ` (21 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Max Filippov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Max Filippov <jcmvbkbc@gmail.com>

commit fec3259c9f747c039f90e99570540114c8d81a14 upstream.

Cache invalidation macros use cache line size to iterate over
invalidated cache lines, assuming that all cache ways are invalidated by
single instruction, but xtensa ISA recommends to not assume that for
future compatibility:
  In some implementations all ways at index Addry-1..z are invalidated
  regardless of the specified way, but for future compatibility this
  behavior should not be assumed.

Iterate over all cache ways in ___invalidate_icache_all and
___invalidate_dcache_all.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/xtensa/include/asm/cacheasm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/xtensa/include/asm/cacheasm.h
+++ b/arch/xtensa/include/asm/cacheasm.h
@@ -119,7 +119,7 @@
 
 	.macro	___invalidate_dcache_all ar at
 
-	__loop_cache_all \ar \at dii __stringify(DCACHE_WAY_SIZE) \
+	__loop_cache_all \ar \at dii XCHAL_DCACHE_SIZE \
 			 XCHAL_DCACHE_LINEWIDTH 1020
 
 	.endm
@@ -127,7 +127,7 @@
 
 	.macro	___invalidate_icache_all ar at
 
-	__loop_cache_all \ar \at iii __stringify(ICACHE_WAY_SIZE) \
+	__loop_cache_all \ar \at iii XCHAL_ICACHE_SIZE \
 			 XCHAL_ICACHE_LINEWIDTH 1020
 
 	.endm


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 052/328] PCI: pciehp: Fix unprotected list iteration in IRQ handler
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (91 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 271/328] crypto: mxs-dcp - Fix wait logic on chan threads Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 083/328] iio: ad9523: Fix return value for ad952x_store() Ben Hutchings
                   ` (234 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Lukas Wunner, Bjorn Helgaas

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Lukas Wunner <lukas@wunner.de>

commit 1204e35bedf4e5015cda559ed8c84789a6dae24e upstream.

Commit b440bde74f04 ("PCI: Add pci_ignore_hotplug() to ignore hotplug
events for a device") iterates over the devices on a hotplug port's
subordinate bus in pciehp's IRQ handler without acquiring pci_bus_sem.
It is thus possible for a user to cause a crash by concurrently
manipulating the device list, e.g. by disabling slot power via sysfs
on a different CPU or by initiating a remove/rescan via sysfs.

This can't be fixed by acquiring pci_bus_sem because it may sleep.
The simplest fix is to avoid the list iteration altogether and just
check the ignore_hotplug flag on the port itself.  This works because
pci_ignore_hotplug() sets the flag both on the device as well as on its
parent bridge.

We do lose the ability to print the name of the device blocking hotplug
in the debug message, but that's probably bearable.

Fixes: b440bde74f04 ("PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
[bwh: Backported to 3.16: s/events/intr_loc/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pci/hotplug/pciehp_hpc.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -508,8 +508,6 @@ static irqreturn_t pcie_isr(int irq, voi
 {
 	struct controller *ctrl = (struct controller *)dev_id;
 	struct pci_dev *pdev = ctrl_dev(ctrl);
-	struct pci_bus *subordinate = pdev->subordinate;
-	struct pci_dev *dev;
 	struct slot *slot = ctrl->slot;
 	u16 detected, intr_loc;
 
@@ -543,14 +541,9 @@ static irqreturn_t pcie_isr(int irq, voi
 		wake_up(&ctrl->queue);
 	}
 
-	if (subordinate) {
-		list_for_each_entry(dev, &subordinate->devices, bus_list) {
-			if (dev->ignore_hotplug) {
-				ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n",
-					 intr_loc, pci_name(dev));
-				return IRQ_HANDLED;
-			}
-		}
+	if (pdev->ignore_hotplug) {
+		ctrl_dbg(ctrl, "ignoring hotplug event %#06x\n", intr_loc);
+		return IRQ_HANDLED;
 	}
 
 	if (!(intr_loc & ~PCI_EXP_SLTSTA_CC))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 088/328] udl-kms: fix crash due to uninitialized memory
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (185 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 152/328] ISCSI: fix minor memory leak Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 097/328] scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock Ben Hutchings
                   ` (140 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mikulas Patocka, Dave Airlie

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 09a00abe3a9941c2715ca83eb88172cd2f54d8fd upstream.

We must use kzalloc when allocating the fb_deferred_io structure.
Otherwise, the field first_io is undefined and it causes a crash.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/udl/udl_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -344,7 +344,7 @@ static int udl_fb_open(struct fb_info *i
 
 		struct fb_deferred_io *fbdefio;
 
-		fbdefio = kmalloc(sizeof(struct fb_deferred_io), GFP_KERNEL);
+		fbdefio = kzalloc(sizeof(struct fb_deferred_io), GFP_KERNEL);
 
 		if (fbdefio) {
 			fbdefio->delay = DL_DEFIO_WRITE_DELAY;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 116/328] smb3: fill in statfs fsid and correct namelen
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (154 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 025/328] power: generic-adc-battery: fix out-of-bounds write when copying channel properties Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 014/328] IB/srpt: Support HCAs with more than two ports Ben Hutchings
                   ` (171 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Steve French, Steve French, Aurelien Aptel

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Steve French <stfrench@microsoft.com>

commit 21ba3845b59c733a79ed4fe1c4f3732e7ece9df7 upstream.

Fil in the correct namelen (typically 255 not 4096) in the
statfs response and also fill in a reasonably unique fsid
(in this case taken from the volume id, and the creation time
of the volume).

In the case of the POSIX statfs all fields are now filled in,
and in the case of non-POSIX mounts, all fields are filled
in which can be.

Signed-off-by: Steve French <stfrench@gmail.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
[bwh: Backported to 3.16: Only use cifs_tcon::vol_{serial_number,create_time}
 if CONFIG_CIFS_SMB2 is enabled]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cifs/cifsfs.c  | 18 ++++++++++--------
 fs/cifs/smb2ops.c |  2 ++
 fs/cifs/smb2pdu.c |  8 ++++++++
 fs/cifs/smb2pdu.h | 11 +++++++++++
 4 files changed, 31 insertions(+), 8 deletions(-)

--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -190,14 +190,18 @@ cifs_statfs(struct dentry *dentry, struc
 
 	xid = get_xid();
 
-	/*
-	 * PATH_MAX may be too long - it would presumably be total path,
-	 * but note that some servers (includinng Samba 3) have a shorter
-	 * maximum path.
-	 *
-	 * Instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO.
-	 */
-	buf->f_namelen = PATH_MAX;
+	if (le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength) > 0)
+		buf->f_namelen =
+		       le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength);
+	else
+		buf->f_namelen = PATH_MAX;
+
+#ifdef CONFIG_CIFS_SMB2
+	buf->f_fsid.val[0] = tcon->vol_serial_number;
+	/* are using part of create time for more randomness, see man statfs */
+	buf->f_fsid.val[1] =  (int)le64_to_cpu(tcon->vol_create_time);
+#endif
+
 	buf->f_files = 0;	/* undefined */
 	buf->f_ffree = 0;	/* unlimited */
 
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -263,6 +263,8 @@ smb3_qfs_tcon(const unsigned int xid, st
 	SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
 			FS_DEVICE_INFORMATION);
 	SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
+			FS_VOLUME_INFORMATION);
+	SMB2_QFS_attr(xid, tcon, fid.persistent_fid, fid.volatile_fid,
 			FS_SECTOR_SIZE_INFORMATION); /* SMB3 specific */
 	SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
 	return;
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2614,6 +2614,9 @@ SMB2_QFS_attr(const unsigned int xid, st
 	} else if (level == FS_SECTOR_SIZE_INFORMATION) {
 		max_len = sizeof(struct smb3_fs_ss_info);
 		min_len = sizeof(struct smb3_fs_ss_info);
+	} else if (level == FS_VOLUME_INFORMATION) {
+		max_len = sizeof(struct smb3_fs_vol_info) + MAX_VOL_LABEL_LEN;
+		min_len = sizeof(struct smb3_fs_vol_info);
 	} else {
 		cifs_dbg(FYI, "Invalid qfsinfo level %d\n", level);
 		return -EINVAL;
@@ -2650,6 +2653,11 @@ SMB2_QFS_attr(const unsigned int xid, st
 		tcon->ss_flags = le32_to_cpu(ss_info->Flags);
 		tcon->perf_sector_size =
 			le32_to_cpu(ss_info->PhysicalBytesPerSectorForPerf);
+	} else if (level == FS_VOLUME_INFORMATION) {
+		struct smb3_fs_vol_info *vol_info = (struct smb3_fs_vol_info *)
+			(offset + (char *)rsp);
+		tcon->vol_serial_number = vol_info->VolumeSerialNumber;
+		tcon->vol_create_time = vol_info->VolumeCreationTime;
 	}
 
 qfsattr_exit:
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -946,6 +946,17 @@ struct smb3_fs_ss_info {
 	__le32 ByteOffsetForPartitionAlignment;
 } __packed;
 
+/* volume info struct - see MS-FSCC 2.5.9 */
+#define MAX_VOL_LABEL_LEN	32
+struct smb3_fs_vol_info {
+	__le64	VolumeCreationTime;
+	__u32	VolumeSerialNumber;
+	__le32	VolumeLabelLength; /* includes trailing null */
+	__u8	SupportsObjects; /* True if eg like NTFS, supports objects */
+	__u8	Reserved;
+	__u8	VolumeLabel[0]; /* variable len */
+} __packed;
+
 /* partial list of QUERY INFO levels */
 #define FILE_DIRECTORY_INFORMATION	1
 #define FILE_FULL_DIRECTORY_INFORMATION 2


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 188/328] ext4: prevent online resize with backup superblock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (152 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 009/328] platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 025/328] power: generic-adc-battery: fix out-of-bounds write when copying channel properties Ben Hutchings
                   ` (173 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Theodore Ts'o, Maxim Malkov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit 011fa99404bea3f5d897c4983f6bd51170e3b18f upstream.

Prevent BUG or corrupted file systems after the following:

mkfs.ext4 /dev/vdc 100M
mount -t ext4 -o sb=40961 /dev/vdc /vdc
resize2fs /dev/vdc

We previously prevented online resizing using the old resize ioctl.
Move the code to ext4_resize_begin(), so the check applies for all of
the resize ioctl's.

Reported-by: Maxim Malkov <malkov@ispras.ru>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/resize.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -24,6 +24,18 @@ int ext4_resize_begin(struct super_block
 		return -EPERM;
 
 	/*
+	 * If we are not using the primary superblock/GDT copy don't resize,
+         * because the user tools have no way of handling this.  Probably a
+         * bad time to do it anyways.
+         */
+	if (EXT4_SB(sb)->s_sbh->b_blocknr !=
+	    le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
+		ext4_warning(sb, "won't resize using backup superblock at %llu",
+			(unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);
+		return -EPERM;
+	}
+
+	/*
 	 * We are not allowed to do online-resizing on a filesystem mounted
 	 * with error, because it can destroy the filesystem easily.
 	 */
@@ -758,18 +770,6 @@ static int add_new_gdb(handle_t *handle,
 		       "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n",
 		       gdb_num);
 
-	/*
-	 * If we are not using the primary superblock/GDT copy don't resize,
-         * because the user tools have no way of handling this.  Probably a
-         * bad time to do it anyways.
-         */
-	if (EXT4_SB(sb)->s_sbh->b_blocknr !=
-	    le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
-		ext4_warning(sb, "won't resize using backup superblock at %llu",
-			(unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);
-		return -EPERM;
-	}
-
 	gdb_bh = sb_bread(sb, gdblock);
 	if (!gdb_bh)
 		return -EIO;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 067/328] ALSA: vx: Fix possible transfer overflow
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (212 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 237/328] CIFS: fix wrapping bugs in num_entries() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 327/328] xfs: don't fail when converting shortform attr to long form during ATTR_REPLACE Ben Hutchings
                   ` (113 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 874e1f6fad9a5184b67f4cee37c1335cd2cc5677 upstream.

The pseudo DMA transfer codes in VX222 and VX-pocket driver have a
slight bug where they check the buffer boundary wrongly, and may
overflow.  Also, the zero sample count might be handled badly for the
playback (although it shouldn't happen in theory).  This patch
addresses these issues.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=141541
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/drivers/vx/vx_pcm.c   |  6 ++++--
 sound/pci/vx222/vx222_ops.c | 12 ++++++------
 sound/pcmcia/vx/vxp_ops.c   | 12 ++++++------
 3 files changed, 16 insertions(+), 14 deletions(-)

--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -1071,8 +1071,10 @@ static void vx_pcm_capture_update(struct
 		/* ok, let's accelerate! */
 		int align = pipe->align * 3;
 		space = (count / align) * align;
-		vx_pseudo_dma_read(chip, runtime, pipe, space);
-		count -= space;
+		if (space > 0) {
+			vx_pseudo_dma_read(chip, runtime, pipe, space);
+			count -= space;
+		}
 	}
 	/* read the rest of bytes */
 	while (count > 0) {
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -264,12 +264,12 @@ static void vx2_dma_write(struct vx_core
 
 	/* Transfer using pseudo-dma.
 	 */
-	if (offset + count > pipe->buffer_bytes) {
+	if (offset + count >= pipe->buffer_bytes) {
 		int length = pipe->buffer_bytes - offset;
 		count -= length;
 		length >>= 2; /* in 32bit words */
 		/* Transfer using pseudo-dma. */
-		while (length-- > 0) {
+		for (; length > 0; length--) {
 			outl(cpu_to_le32(*addr), port);
 			addr++;
 		}
@@ -279,7 +279,7 @@ static void vx2_dma_write(struct vx_core
 	pipe->hw_ptr += count;
 	count >>= 2; /* in 32bit words */
 	/* Transfer using pseudo-dma. */
-	while (count-- > 0) {
+	for (; count > 0; count--) {
 		outl(cpu_to_le32(*addr), port);
 		addr++;
 	}
@@ -302,12 +302,12 @@ static void vx2_dma_read(struct vx_core
 	vx2_setup_pseudo_dma(chip, 0);
 	/* Transfer using pseudo-dma.
 	 */
-	if (offset + count > pipe->buffer_bytes) {
+	if (offset + count >= pipe->buffer_bytes) {
 		int length = pipe->buffer_bytes - offset;
 		count -= length;
 		length >>= 2; /* in 32bit words */
 		/* Transfer using pseudo-dma. */
-		while (length-- > 0)
+		for (; length > 0; length--)
 			*addr++ = le32_to_cpu(inl(port));
 		addr = (u32 *)runtime->dma_area;
 		pipe->hw_ptr = 0;
@@ -315,7 +315,7 @@ static void vx2_dma_read(struct vx_core
 	pipe->hw_ptr += count;
 	count >>= 2; /* in 32bit words */
 	/* Transfer using pseudo-dma. */
-	while (count-- > 0)
+	for (; count > 0; count--)
 		*addr++ = le32_to_cpu(inl(port));
 
 	vx2_release_pseudo_dma(chip);
--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -369,12 +369,12 @@ static void vxp_dma_write(struct vx_core
 	unsigned short *addr = (unsigned short *)(runtime->dma_area + offset);
 
 	vx_setup_pseudo_dma(chip, 1);
-	if (offset + count > pipe->buffer_bytes) {
+	if (offset + count >= pipe->buffer_bytes) {
 		int length = pipe->buffer_bytes - offset;
 		count -= length;
 		length >>= 1; /* in 16bit words */
 		/* Transfer using pseudo-dma. */
-		while (length-- > 0) {
+		for (; length > 0; length--) {
 			outw(cpu_to_le16(*addr), port);
 			addr++;
 		}
@@ -384,7 +384,7 @@ static void vxp_dma_write(struct vx_core
 	pipe->hw_ptr += count;
 	count >>= 1; /* in 16bit words */
 	/* Transfer using pseudo-dma. */
-	while (count-- > 0) {
+	for (; count > 0; count--) {
 		outw(cpu_to_le16(*addr), port);
 		addr++;
 	}
@@ -411,12 +411,12 @@ static void vxp_dma_read(struct vx_core
 	if (snd_BUG_ON(count % 2))
 		return;
 	vx_setup_pseudo_dma(chip, 0);
-	if (offset + count > pipe->buffer_bytes) {
+	if (offset + count >= pipe->buffer_bytes) {
 		int length = pipe->buffer_bytes - offset;
 		count -= length;
 		length >>= 1; /* in 16bit words */
 		/* Transfer using pseudo-dma. */
-		while (length-- > 0)
+		for (; length > 0; length--)
 			*addr++ = le16_to_cpu(inw(port));
 		addr = (unsigned short *)runtime->dma_area;
 		pipe->hw_ptr = 0;
@@ -424,7 +424,7 @@ static void vxp_dma_read(struct vx_core
 	pipe->hw_ptr += count;
 	count >>= 1; /* in 16bit words */
 	/* Transfer using pseudo-dma. */
-	while (count-- > 1)
+	for (; count > 1; count--)
 		*addr++ = le16_to_cpu(inw(port));
 	/* Disable DMA */
 	pchip->regDIALOG &= ~VXP_DLG_DMAREAD_SEL_MASK;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 138/328] ubifs: Fix synced_i_size calculation for xattr inodes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (260 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 247/328] Input: elantech - enable middle button of touchpad on ThinkPad P72 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 008/328] platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill Ben Hutchings
                   ` (65 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Richard Weinberger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Weinberger <richard@nod.at>

commit 59965593205fa4044850d35ee3557cf0b7edcd14 upstream.

In ubifs_jnl_update() we sync parent and child inodes to the flash,
in case of xattrs, the parent inode (AKA host inode) has a non-zero
data_len. Therefore we need to adjust synced_i_size too.

This issue was reported by ubifs self tests unter a xattr related work
load.
UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: ui_size is 4, synced_i_size is 0, but inode is clean
UBIFS error (ubi0:0 pid 1896): dbg_check_synced_i_size: i_ino 65, i_mode 0x81a4, i_size 4

Fixes: 1e51764a3c2a ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger <richard@nod.at>
[bwh: Backported to 3.16: s/host_ui/dir_ui/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ubifs/journal.c | 5 +++++
 1 file changed, 5 insertions(+)

--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -657,6 +657,11 @@ int ubifs_jnl_update(struct ubifs_info *
 	spin_lock(&ui->ui_lock);
 	ui->synced_i_size = ui->ui_size;
 	spin_unlock(&ui->ui_lock);
+	if (xent) {
+		spin_lock(&dir_ui->ui_lock);
+		dir_ui->synced_i_size = dir_ui->ui_size;
+		spin_unlock(&dir_ui->ui_lock);
+	}
 	mark_inode_clean(c, ui);
 	mark_inode_clean(c, dir_ui);
 	return 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 050/328] PCI: hotplug: Don't leak pci_slot on registration failure
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (17 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 244/328] ring-buffer: Allow for rescheduling when removing pages Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 199/328] usb: uas: add support for more quirk flags Ben Hutchings
                   ` (308 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Greg Kroah-Hartman, Bjorn Helgaas, Lukas Wunner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Lukas Wunner <lukas@wunner.de>

commit 4ce6435820d1f1cc2c2788e232735eb244bcc8a3 upstream.

If addition of sysfs files fails on registration of a hotplug slot, the
struct pci_slot as well as the entry in the slot_list is leaked.  The
issue has been present since the hotplug core was introduced in 2002:
https://git.kernel.org/tglx/history/c/a8a2069f432c

Perhaps the idea was that even though sysfs addition fails, the slot
should still be usable.  But that's not how drivers use the interface,
they abort probe if a non-zero value is returned.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pci/hotplug/pci_hotplug_core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
@@ -457,8 +457,17 @@ int __pci_hp_register(struct hotplug_slo
 	list_add(&slot->slot_list, &pci_hotplug_slot_list);
 
 	result = fs_add_slot(pci_slot);
+	if (result)
+		goto err_list_del;
+
 	kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
 	dbg("Added slot %s to the list\n", name);
+	goto out;
+
+err_list_del:
+	list_del(&slot->slot_list);
+	pci_slot->hotplug = NULL;
+	pci_destroy_slot(pci_slot);
 out:
 	mutex_unlock(&pci_hp_mutex);
 	return result;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 103/328] net: 6lowpan: fix reserved space for single frames
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (37 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 078/328] ALSA: virmidi: Fix too long output trigger loop Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 113/328] ASoC: wm8994: Fix missing break in switch Ben Hutchings
                   ` (288 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Alexander Aring, Rabi Narayan Sahoo, Stefan Schmidt, David Palma

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Aring <aring@mojatatu.com>

commit ac74f87c789af40936a80131c4759f3e72579c3a upstream.

This patch fixes patch add handling to take care tail and headroom for
single 6lowpan frames. We need to be sure we have a skb with the right
head and tailroom for single frames. This patch do it by using
skb_copy_expand() if head and tailroom is not enough allocated by upper
layer.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195059
Reported-by: David Palma <david.palma@ntnu.no>
Reported-by: Rabi Narayan Sahoo <rabinarayans0828@gmail.com>
Signed-off-by: Alexander Aring <aring@mojatatu.com>
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
[bwh: Backported to 3.16:
 - s/ldev/dev/
 - Adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ieee802154/6lowpan_rtnl.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -388,9 +388,24 @@ static netdev_tx_t lowpan_xmit(struct sk
 	/* We must take a copy of the skb before we modify/replace the ipv6
 	 * header as the header could be used elsewhere
 	 */
-	skb = skb_unshare(skb, GFP_ATOMIC);
-	if (!skb)
-		return NET_XMIT_DROP;
+	if (unlikely(skb_headroom(skb) < dev->needed_headroom ||
+		     skb_tailroom(skb) < dev->needed_tailroom)) {
+		struct sk_buff *nskb;
+
+		nskb = skb_copy_expand(skb, dev->needed_headroom,
+				       dev->needed_tailroom, GFP_ATOMIC);
+		if (likely(nskb)) {
+			consume_skb(skb);
+			skb = nskb;
+		} else {
+			kfree_skb(skb);
+			return NET_XMIT_DROP;
+		}
+	} else {
+		skb = skb_unshare(skb, GFP_ATOMIC);
+		if (!skb)
+			return NET_XMIT_DROP;
+	}
 
 	ret = lowpan_header(skb, dev);
 	if (ret < 0) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 205/328] spi: rspi: Fix interrupted DMA transfers
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (127 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 061/328] udlfb: make a local copy of fb_ops Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 220/328] batman-adv: Prevent duplicated tvlv handler Ben Hutchings
                   ` (198 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Geert Uytterhoeven, Mark Brown

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit 8dbbaa47b96f6ea5f09f922b4effff3c505cd8cf upstream.

When interrupted, wait_event_interruptible_timeout() returns
-ERESTARTSYS, and the SPI transfer in progress will fail, as expected:

    m25p80 spi0.0: SPI transfer failed: -512
    spi_master spi0: failed to transfer one message from queue

However, as the underlying DMA transfers may not have completed, all
subsequent SPI transfers may start to fail:

    spi_master spi0: receive timeout
    qspi_transfer_out_in() returned -110
    m25p80 spi0.0: SPI transfer failed: -110
    spi_master spi0: failed to transfer one message from queue

Fix this by calling dmaengine_terminate_all() not only for timeouts, but
also for errors.

This can be reproduced on r8a7991/koelsch, using "hd /dev/mtd0" followed
by CTRL-C.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/spi/spi-rspi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -538,11 +538,13 @@ static int rspi_dma_transfer(struct rspi
 
 	ret = wait_event_interruptible_timeout(rspi->wait,
 					       rspi->dma_callbacked, HZ);
-	if (ret > 0 && rspi->dma_callbacked)
+	if (ret > 0 && rspi->dma_callbacked) {
 		ret = 0;
-	else if (!ret) {
-		dev_err(&rspi->master->dev, "DMA timeout\n");
-		ret = -ETIMEDOUT;
+	} else {
+		if (!ret) {
+			dev_err(&rspi->master->dev, "DMA timeout\n");
+			ret = -ETIMEDOUT;
+		}
 		if (tx)
 			dmaengine_terminate_all(rspi->master->dma_tx);
 		if (rx)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 043/328] mtd: rawnand: mxc: remove __init qualifier from mxcnd_probe_dt
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (313 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 236/328] cifs: prevent integer overflow in nxt_dir_entry() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 095/328] uio: potential double frees if __uio_register_device() fails Ben Hutchings
                   ` (12 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Martin Kaiser, Miquel Raynal, Boris Brezillon

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Martin Kaiser <martin@kaiser.cx>

commit 24f0ae995deb728076e3ea93fea1949a9775debf upstream.

Using the sysfs unbind, bind nodes, mxcnd_probe and mxcnd_probe_dt can
potentially be called at any time. After the __init functions are cleaned,
mxcnd_probe_dt is no longer available. Calling it anyway causes a crash.

mxcnd_probe used to be marked as __init, this was removed years ago.
Remove the __init qualifier from from mxcnd_probe_dt as well.

Fixes: 06f255106923 ("mtd: remove use of __devinit")
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/mtd/nand/mxc_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1360,7 +1360,7 @@ static const struct of_device_id mxcnd_d
 	{ /* sentinel */ }
 };
 
-static int __init mxcnd_probe_dt(struct mxc_nand_host *host)
+static int mxcnd_probe_dt(struct mxc_nand_host *host)
 {
 	struct device_node *np = host->dev->of_node;
 	struct mxc_nand_platform_data *pdata = &host->pdata;
@@ -1387,7 +1387,7 @@ static int __init mxcnd_probe_dt(struct
 	return 0;
 }
 #else
-static int __init mxcnd_probe_dt(struct mxc_nand_host *host)
+static int mxcnd_probe_dt(struct mxc_nand_host *host)
 {
 	return 1;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 058/328] udlfb: fix semaphore value leak
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (62 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 158/328] mm: move tlb_table_flush to tlb_flush_mmu_free Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 155/328] reiserfs: fix broken xattr handling (heap corruption, bad retval) Ben Hutchings
                   ` (263 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mikulas Patocka, Bartlomiej Zolnierkiewicz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 9d0aa601e4cd9c0892f90d36e8488d79b72f4073 upstream.

I observed that the performance of the udl fb driver degrades over time.
On a freshly booted machine, it takes 6 seconds to do "ls -la /usr/bin";
after some time of use, the same operation takes 14 seconds.

The reason is that the value of "limit_sem" decays over time.

The udl driver uses a semaphore "limit_set" to specify how many free urbs
are there on dlfb->urbs.list. If the count is zero, the "down" operation
will sleep until some urbs are added to the freelist.

In order to avoid some hypothetical deadlock, the driver will not call
"up" immediately, but it will offload it to a workqueue. The problem is
that if we call "schedule_delayed_work" on the same work item multiple
times, the work item may only be executed once.

This is happening:
* some urb completes
* dlfb_urb_completion adds it to the free list
* dlfb_urb_completion calls schedule_delayed_work to schedule the function
  dlfb_release_urb_work to increase the semaphore count
* as the urb is on the free list, some other task grabs it and submits it
* the submitted urb completes, dlfb_urb_completion is called again
* dlfb_urb_completion calls schedule_delayed_work, but the work is already
  scheduled, so it does nothing
* finally, dlfb_release_urb_work is called, it increases the semaphore
  count by 1, although it should increase it by 2

So, the semaphore count is decreasing over time, and this causes gradual
performance degradation.

Note that in the current kernel, the "up" function may be called from
interrupt and it may race with the "down" function called by another
thread, so we don't have to offload the call of "up" to a workqueue at
all. This patch removes the workqueue code. The patch also changes
"down_interruptible" to "down" in dlfb_free_urb_list, so that we will
clean up the driver properly even if a signal arrives.

With this patch, the performance of udlfb no longer degrades.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
[b.zolnierkie: fix immediatelly -> immediately typo]
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
[bwh: Backported to 3.16: Pointers to struct dlfb_data are named "dev" rather
 than "dlfb"]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/udlfb.c | 27 ++-------------------------
 include/video/udlfb.h       |  1 -
 2 files changed, 2 insertions(+), 26 deletions(-)

--- a/drivers/video/fbdev/udlfb.c
+++ b/drivers/video/fbdev/udlfb.c
@@ -928,14 +928,6 @@ static void dlfb_free(struct kref *kref)
 	kfree(dev);
 }
 
-static void dlfb_release_urb_work(struct work_struct *work)
-{
-	struct urb_node *unode = container_of(work, struct urb_node,
-					      release_urb_work.work);
-
-	up(&unode->dev->urbs.limit_sem);
-}
-
 static void dlfb_free_framebuffer(struct dlfb_data *dev)
 {
 	struct fb_info *info = dev->info;
@@ -1797,14 +1789,7 @@ static void dlfb_urb_completion(struct u
 	dev->urbs.available++;
 	spin_unlock_irqrestore(&dev->urbs.lock, flags);
 
-	/*
-	 * When using fb_defio, we deadlock if up() is called
-	 * while another is waiting. So queue to another process.
-	 */
-	if (fb_defio)
-		schedule_delayed_work(&unode->release_urb_work, 0);
-	else
-		up(&dev->urbs.limit_sem);
+	up(&dev->urbs.limit_sem);
 }
 
 static void dlfb_free_urb_list(struct dlfb_data *dev)
@@ -1813,16 +1798,11 @@ static void dlfb_free_urb_list(struct dl
 	struct list_head *node;
 	struct urb_node *unode;
 	struct urb *urb;
-	int ret;
 	unsigned long flags;
 
 	/* keep waiting and freeing, until we've got 'em all */
 	while (count--) {
-
-		/* Getting interrupted means a leak, but ok at disconnect */
-		ret = down_interruptible(&dev->urbs.limit_sem);
-		if (ret)
-			break;
+		down(&dev->urbs.limit_sem);
 
 		spin_lock_irqsave(&dev->urbs.lock, flags);
 
@@ -1862,9 +1842,6 @@ static int dlfb_alloc_urb_list(struct dl
 			break;
 		unode->dev = dev;
 
-		INIT_DELAYED_WORK(&unode->release_urb_work,
-			  dlfb_release_urb_work);
-
 		urb = usb_alloc_urb(0, GFP_KERNEL);
 		if (!urb) {
 			kfree(unode);
--- a/include/video/udlfb.h
+++ b/include/video/udlfb.h
@@ -19,7 +19,6 @@ struct dloarea {
 struct urb_node {
 	struct list_head entry;
 	struct dlfb_data *dev;
-	struct delayed_work release_urb_work;
 	struct urb *urb;
 };
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 287/328] perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (142 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 105/328] mac802154: tx: cleanup crc calculation Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 019/328] scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size Ben Hutchings
                   ` (183 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jiri Olsa, CAI Qian, Peter Zijlstra (Intel),
	Rob Herring, Ingo Molnar, Alexander Shishkin, Kan Liang,
	Arnaldo Carvalho de Melo, Linus Torvalds, Thomas Gleixner,
	Greg Kroah-Hartman, Jiri Olsa

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Olsa <jolsa@redhat.com>

commit 0933840acf7b65d6d30a5b6089d882afea57aca3 upstream.

CAI Qian reported a crash in the PMU uncore device removal code,
enabled by the CONFIG_DEBUG_TEST_DRIVER_REMOVE=y option:

  https://marc.info/?l=linux-kernel&m=147688837328451

The reason for the crash is that perf_pmu_unregister() tries to remove
a PMU device which is not added at this point. We add PMU devices
only after pmu_bus is registered, which happens in the
perf_event_sysfs_init() call and sets the 'pmu_bus_running' flag.

The fix is to get the 'pmu_bus_running' flag state at the point
the PMU is taken out of the PMU list and remove the device
later only if it's set.

Reported-by: CAI Qian <caiqian@redhat.com>
Tested-by: CAI Qian <caiqian@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161020111011.GA13361@krava
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[bwh: Backported to 3.16: no address filter attributes to clean up]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6930,7 +6930,10 @@ EXPORT_SYMBOL_GPL(perf_pmu_register);
 
 void perf_pmu_unregister(struct pmu *pmu)
 {
+	int remove_device;
+
 	mutex_lock(&pmus_lock);
+	remove_device = pmu_bus_running;
 	list_del_rcu(&pmu->entry);
 	mutex_unlock(&pmus_lock);
 
@@ -6944,8 +6947,10 @@ void perf_pmu_unregister(struct pmu *pmu
 	free_percpu(pmu->pmu_disable_count);
 	if (pmu->type >= PERF_TYPE_MAX)
 		idr_remove(&pmu_idr, pmu->type);
-	device_del(pmu->dev);
-	put_device(pmu->dev);
+	if (remove_device) {
+		device_del(pmu->dev);
+		put_device(pmu->dev);
+	}
 	free_pmu_context(pmu);
 }
 EXPORT_SYMBOL_GPL(perf_pmu_unregister);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 302/328] ocfs2: fix locking for res->tracking and dlm->tracking_list
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (297 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 075/328] fuse: Add missed unlock_page() to fuse_readpages_fill() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 101/328] pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state Ben Hutchings
                   ` (28 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Ashish Samant, Joel Becker, Jun Piao, Junxiao Bi,
	Changwei Ge, Joseph Qi, Mark Fasheh, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Ashish Samant <ashish.samant@oracle.com>

commit cbe355f57c8074bc4f452e5b6e35509044c6fa23 upstream.

In dlm_init_lockres() we access and modify res->tracking and
dlm->tracking_list without holding dlm->track_lock.  This can cause list
corruptions and can end up in kernel panic.

Fix this by locking res->tracking and dlm->tracking_list with
dlm->track_lock instead of dlm->spinlock.

Link: http://lkml.kernel.org/r/1529951192-4686-1-git-send-email-ashish.samant@oracle.com
Signed-off-by: Ashish Samant <ashish.samant@oracle.com>
Reviewed-by: Changwei Ge <ge.changwei@h3c.com>
Acked-by: Joseph Qi <jiangqi903@gmail.com>
Acked-by: Jun Piao <piaojun@huawei.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ocfs2/dlm/dlmmaster.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -599,9 +599,9 @@ static void dlm_init_lockres(struct dlm_
 
 	res->last_used = 0;
 
-	spin_lock(&dlm->spinlock);
+	spin_lock(&dlm->track_lock);
 	list_add_tail(&res->tracking, &dlm->tracking_list);
-	spin_unlock(&dlm->spinlock);
+	spin_unlock(&dlm->track_lock);
 
 	memset(res->lvb, 0, DLM_LVB_LEN);
 	memset(res->refmap, 0, sizeof(res->refmap));


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 144/328] netfilter: nft_set: fix allocation size overflow in privsize callback.
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (242 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 156/328] apparmor: remove no-op permission check in policy_unpack Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 275/328] r8152: Check for supported Wake-on-LAN Modes Ben Hutchings
                   ` (83 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Pablo Neira Ayuso, Taehee Yoo

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Taehee Yoo <ap420073@gmail.com>

commit 4ef360dd6a65f6ef337645e1b65e744034754b19 upstream.

In order to determine allocation size of set, ->privsize is invoked.
At this point, both desc->size and size of each data structure of set
are used. desc->size means number of element that is given by user.
desc->size is u32 type. so that upperlimit of set element is 4294967295.
but return type of ->privsize is also u32. hence overflow can occurred.

test commands:
   %nft add table ip filter
   %nft add set ip filter hash1 { type ipv4_addr \; size 4294967295 \; }
   %nft list ruleset

splat looks like:
[ 1239.202910] kasan: CONFIG_KASAN_INLINE enabled
[ 1239.208788] kasan: GPF could be caused by NULL-ptr deref or user memory access
[ 1239.217625] general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
[ 1239.219329] CPU: 0 PID: 1603 Comm: nft Not tainted 4.18.0-rc5+ #7
[ 1239.229091] RIP: 0010:nft_hash_walk+0x1d2/0x310 [nf_tables_set]
[ 1239.229091] Code: 84 d2 7f 10 4c 89 e7 89 44 24 38 e8 d8 5a 17 e0 8b 44 24 38 48 8d 7b 10 41 0f b6 0c 24 48 89 fa 48 89 fe 48 c1 ea 03 83 e6 07 <42> 0f b6 14 3a 40 38 f2 7f 1a 84 d2 74 16
[ 1239.229091] RSP: 0018:ffff8801118cf358 EFLAGS: 00010246
[ 1239.229091] RAX: 0000000000000000 RBX: 0000000000020400 RCX: 0000000000000001
[ 1239.229091] RDX: 0000000000004082 RSI: 0000000000000000 RDI: 0000000000020410
[ 1239.229091] RBP: ffff880114d5a988 R08: 0000000000007e94 R09: ffff880114dd8030
[ 1239.229091] R10: ffff880114d5a988 R11: ffffed00229bb006 R12: ffff8801118cf4d0
[ 1239.229091] R13: ffff8801118cf4d8 R14: 0000000000000000 R15: dffffc0000000000
[ 1239.229091] FS:  00007f5a8fe0b700(0000) GS:ffff88011b600000(0000) knlGS:0000000000000000
[ 1239.229091] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1239.229091] CR2: 00007f5a8ecc27b0 CR3: 000000010608e000 CR4: 00000000001006f0
[ 1239.229091] Call Trace:
[ 1239.229091]  ? nft_hash_remove+0xf0/0xf0 [nf_tables_set]
[ 1239.229091]  ? memset+0x1f/0x40
[ 1239.229091]  ? __nla_reserve+0x9f/0xb0
[ 1239.229091]  ? memcpy+0x34/0x50
[ 1239.229091]  nf_tables_dump_set+0x9a1/0xda0 [nf_tables]
[ 1239.229091]  ? __kmalloc_reserve.isra.29+0x2e/0xa0
[ 1239.229091]  ? nft_chain_hash_obj+0x630/0x630 [nf_tables]
[ 1239.229091]  ? nf_tables_commit+0x2c60/0x2c60 [nf_tables]
[ 1239.229091]  netlink_dump+0x470/0xa20
[ 1239.229091]  __netlink_dump_start+0x5ae/0x690
[ 1239.229091]  nft_netlink_dump_start_rcu+0xd1/0x160 [nf_tables]
[ 1239.229091]  nf_tables_getsetelem+0x2e5/0x4b0 [nf_tables]
[ 1239.229091]  ? nft_get_set_elem+0x440/0x440 [nf_tables]
[ 1239.229091]  ? nft_chain_hash_obj+0x630/0x630 [nf_tables]
[ 1239.229091]  ? nf_tables_dump_obj_done+0x70/0x70 [nf_tables]
[ 1239.229091]  ? nla_parse+0xab/0x230
[ 1239.229091]  ? nft_get_set_elem+0x440/0x440 [nf_tables]
[ 1239.229091]  nfnetlink_rcv_msg+0x7f0/0xab0 [nfnetlink]
[ 1239.229091]  ? nfnetlink_bind+0x1d0/0x1d0 [nfnetlink]
[ 1239.229091]  ? debug_show_all_locks+0x290/0x290
[ 1239.229091]  ? sched_clock_cpu+0x132/0x170
[ 1239.229091]  ? find_held_lock+0x39/0x1b0
[ 1239.229091]  ? sched_clock_local+0x10d/0x130
[ 1239.229091]  netlink_rcv_skb+0x211/0x320
[ 1239.229091]  ? nfnetlink_bind+0x1d0/0x1d0 [nfnetlink]
[ 1239.229091]  ? netlink_ack+0x7b0/0x7b0
[ 1239.229091]  ? ns_capable_common+0x6e/0x110
[ 1239.229091]  nfnetlink_rcv+0x2d1/0x310 [nfnetlink]
[ 1239.229091]  ? nfnetlink_rcv_batch+0x10f0/0x10f0 [nfnetlink]
[ 1239.229091]  ? netlink_deliver_tap+0x829/0x930
[ 1239.229091]  ? lock_acquire+0x265/0x2e0
[ 1239.229091]  netlink_unicast+0x406/0x520
[ 1239.509725]  ? netlink_attachskb+0x5b0/0x5b0
[ 1239.509725]  ? find_held_lock+0x39/0x1b0
[ 1239.509725]  netlink_sendmsg+0x987/0xa20
[ 1239.509725]  ? netlink_unicast+0x520/0x520
[ 1239.509725]  ? _copy_from_user+0xa9/0xc0
[ 1239.509725]  __sys_sendto+0x21a/0x2c0
[ 1239.509725]  ? __ia32_sys_getpeername+0xa0/0xa0
[ 1239.509725]  ? retint_kernel+0x10/0x10
[ 1239.509725]  ? sched_clock_cpu+0x132/0x170
[ 1239.509725]  ? find_held_lock+0x39/0x1b0
[ 1239.509725]  ? lock_downgrade+0x540/0x540
[ 1239.509725]  ? up_read+0x1c/0x100
[ 1239.509725]  ? __do_page_fault+0x763/0x970
[ 1239.509725]  ? retint_user+0x18/0x18
[ 1239.509725]  __x64_sys_sendto+0x177/0x180
[ 1239.509725]  do_syscall_64+0xaa/0x360
[ 1239.509725]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 1239.509725] RIP: 0033:0x7f5a8f468e03
[ 1239.509725] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb d0 0f 1f 84 00 00 00 00 00 83 3d 49 c9 2b 00 00 75 13 49 89 ca b8 2c 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 34 c3 48 83 ec 08 e8
[ 1239.509725] RSP: 002b:00007ffd78d0b778 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
[ 1239.509725] RAX: ffffffffffffffda RBX: 00007ffd78d0c890 RCX: 00007f5a8f468e03
[ 1239.509725] RDX: 0000000000000034 RSI: 00007ffd78d0b7e0 RDI: 0000000000000003
[ 1239.509725] RBP: 00007ffd78d0b7d0 R08: 00007f5a8f15c160 R09: 000000000000000c
[ 1239.509725] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffd78d0b7e0
[ 1239.509725] R13: 0000000000000034 R14: 00007f5a8f9aff60 R15: 00005648040094b0
[ 1239.509725] Modules linked in: nf_tables_set nf_tables nfnetlink ip_tables x_tables
[ 1239.670713] ---[ end trace 39375adcda140f11 ]---
[ 1239.676016] RIP: 0010:nft_hash_walk+0x1d2/0x310 [nf_tables_set]
[ 1239.682834] Code: 84 d2 7f 10 4c 89 e7 89 44 24 38 e8 d8 5a 17 e0 8b 44 24 38 48 8d 7b 10 41 0f b6 0c 24 48 89 fa 48 89 fe 48 c1 ea 03 83 e6 07 <42> 0f b6 14 3a 40 38 f2 7f 1a 84 d2 74 16
[ 1239.705108] RSP: 0018:ffff8801118cf358 EFLAGS: 00010246
[ 1239.711115] RAX: 0000000000000000 RBX: 0000000000020400 RCX: 0000000000000001
[ 1239.719269] RDX: 0000000000004082 RSI: 0000000000000000 RDI: 0000000000020410
[ 1239.727401] RBP: ffff880114d5a988 R08: 0000000000007e94 R09: ffff880114dd8030
[ 1239.735530] R10: ffff880114d5a988 R11: ffffed00229bb006 R12: ffff8801118cf4d0
[ 1239.743658] R13: ffff8801118cf4d8 R14: 0000000000000000 R15: dffffc0000000000
[ 1239.751785] FS:  00007f5a8fe0b700(0000) GS:ffff88011b600000(0000) knlGS:0000000000000000
[ 1239.760993] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1239.767560] CR2: 00007f5a8ecc27b0 CR3: 000000010608e000 CR4: 00000000001006f0
[ 1239.775679] Kernel panic - not syncing: Fatal exception
[ 1239.776630] Kernel Offset: 0x1f000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 1239.776630] Rebooting in 5 seconds..

Fixes: 20a69341f2d0 ("netfilter: nf_tables: add netlink set API")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
[bwh: Backported to 3.16:
 - Drop changes to nft_rhash_privsize() and in nft_set_bitmap.c
 - Adjust filenames]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -183,7 +183,7 @@ enum nft_set_class {
  *	@class: lookup performance class
  */
 struct nft_set_estimate {
-	unsigned int		size;
+	u64			size;
 	enum nft_set_class	class;
 };
 
@@ -215,7 +215,7 @@ struct nft_set_ops {
 						const struct nft_set *set,
 						struct nft_set_iter *iter);
 
-	unsigned int			(*privsize)(const struct nlattr * const nla[]);
+	u64				(*privsize)(const struct nlattr * const nla[]);
 	bool				(*estimate)(const struct nft_set_desc *desc,
 						    u32 features,
 						    struct nft_set_estimate *est);
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -2519,7 +2519,7 @@ static int nf_tables_newset(struct sock
 	struct nft_set *set;
 	struct nft_ctx ctx;
 	char name[IFNAMSIZ];
-	unsigned int size;
+	u64 size;
 	bool create;
 	u32 ktype, dtype, flags, policy;
 	struct nft_set_desc desc;
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -327,7 +327,7 @@ cont:
 	}
 }
 
-static unsigned int nft_hash_privsize(const struct nlattr * const nla[])
+static u64 nft_hash_privsize(const struct nlattr * const nla[])
 {
 	return sizeof(struct nft_hash);
 }
--- a/net/netfilter/nft_rbtree.c
+++ b/net/netfilter/nft_rbtree.c
@@ -211,7 +211,7 @@ cont:
 	spin_unlock_bh(&nft_rbtree_lock);
 }
 
-static unsigned int nft_rbtree_privsize(const struct nlattr * const nla[])
+static u64 nft_rbtree_privsize(const struct nlattr * const nla[])
 {
 	return sizeof(struct nft_rbtree);
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 272/328] asix: Check for supported Wake-on-LAN modes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (195 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 301/328] mm/vmstat.c: skip NR_TLB_REMOTE_FLUSH* properly Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 256/328] USB: handle NULL config in usb_find_alt_setting() Ben Hutchings
                   ` (130 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Florian Fainelli

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit c4ce446e33d7a0e978256ac6fea4c80e59d9de5f upstream.

The driver currently silently accepts unsupported Wake-on-LAN modes
(other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user,
which is confusing.

Fixes: 2e55cc7210fe ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/usb/asix_common.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -417,6 +417,9 @@ int asix_set_wol(struct net_device *net,
 	struct usbnet *dev = netdev_priv(net);
 	u8 opt = 0;
 
+	if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
+		return -EINVAL;
+
 	if (wolinfo->wolopts & WAKE_PHY)
 		opt |= AX_MONITOR_LINK;
 	if (wolinfo->wolopts & WAKE_MAGIC)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 286/328] x86/vdso: Fix asm constraints on vDSO syscall fallbacks
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (301 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 295/328] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 132/328] 9p/virtio: fix off-by-one error in sg list bounds check Ben Hutchings
                   ` (24 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Andy Lutomirski, Thomas Gleixner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Andy Lutomirski <luto@kernel.org>

commit 715bd9d12f84d8f5cc8ad21d888f9bc304a8eb0b upstream.

The syscall fallbacks in the vDSO have incorrect asm constraints.
They are not marked as writing to their outputs -- instead, they are
marked as clobbering "memory", which is useless.  In particular, gcc
is smart enough to know that the timespec parameter hasn't escaped,
so a memory clobber doesn't clobber it.  And passing a pointer as an
asm *input* does not tell gcc that the pointed-to value is changed.

Add in the fact that the asm instructions weren't volatile, and gcc
was free to omit them entirely unless their sole output (the return
value) is used.  Which it is (phew!), but that stops happening with
some upcoming patches.

As a trivial example, the following code:

void test_fallback(struct timespec *ts)
{
	vdso_fallback_gettime(CLOCK_MONOTONIC, ts);
}

compiles to:

00000000000000c0 <test_fallback>:
  c0:   c3                      retq

To add insult to injury, the RCX and R11 clobbers on 64-bit
builds were missing.

The "memory" clobber is also unnecessary -- no ordering with respect to
other memory operations is needed, but that's going to be fixed in a
separate not-for-stable patch.

Fixes: 2aae950b21e4 ("x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu")
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/2c0231690551989d2fafa60ed0e7b5cc8b403908.1538422295.git.luto@kernel.org
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/vdso/vclock_gettime.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -50,8 +50,9 @@ extern u8 pvclock_page
 notrace static long vdso_fallback_gettime(long clock, struct timespec *ts)
 {
 	long ret;
-	asm("syscall" : "=a" (ret) :
-	    "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory");
+	asm ("syscall" : "=a" (ret), "=m" (*ts) :
+	     "0" (__NR_clock_gettime), "D" (clock), "S" (ts) :
+	     "memory", "rcx", "r11");
 	return ret;
 }
 
@@ -59,8 +60,9 @@ notrace static long vdso_fallback_gtod(s
 {
 	long ret;
 
-	asm("syscall" : "=a" (ret) :
-	    "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory");
+	asm ("syscall" : "=a" (ret), "=m" (*tv), "=m" (*tz) :
+	     "0" (__NR_gettimeofday), "D" (tv), "S" (tz) :
+	     "memory", "rcx", "r11");
 	return ret;
 }
 
@@ -143,12 +145,12 @@ notrace static long vdso_fallback_gettim
 {
 	long ret;
 
-	asm(
+	asm (
 		"mov %%ebx, %%edx \n"
 		"mov %2, %%ebx \n"
 		"call __kernel_vsyscall \n"
 		"mov %%edx, %%ebx \n"
-		: "=a" (ret)
+		: "=a" (ret), "=m" (*ts)
 		: "0" (__NR_clock_gettime), "g" (clock), "c" (ts)
 		: "memory", "edx");
 	return ret;
@@ -158,12 +160,12 @@ notrace static long vdso_fallback_gtod(s
 {
 	long ret;
 
-	asm(
+	asm (
 		"mov %%ebx, %%edx \n"
 		"mov %2, %%ebx \n"
 		"call __kernel_vsyscall \n"
 		"mov %%edx, %%ebx \n"
-		: "=a" (ret)
+		: "=a" (ret), "=m" (*tv), "=m" (*tz)
 		: "0" (__NR_gettimeofday), "g" (tv), "c" (tz)
 		: "memory", "edx");
 	return ret;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 284/328] xhci: Add missing CAS workaround for Intel Sunrise Point xHCI
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (32 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 071/328] fuse: don't wake up reserved req in fuse_conn_kill() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 065/328] xfrm: fix 'passing zero to ERR_PTR()' warning Ben Hutchings
                   ` (293 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mathias Nyman, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit ffe84e01bb1b38c7eb9c6b6da127a6c136d251df upstream.

The workaround for missing CAS bit is also needed for xHC on Intel
sunrisepoint PCH. For more details see:

Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/host/xhci-pci.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -178,6 +178,8 @@ static void xhci_pci_quirks(struct devic
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 	    (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
+	     pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI ||
+	     pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
 		xhci->quirks |= XHCI_MISSING_CAS;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 106/328] mac802154: tx: use put_unaligned_le16 for copy crc
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (215 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 032/328] ARM: tegra: Fix Tegra30 Cardhu PCA954x reset Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 068/328] ALSA: vx222: Fix invalid endian conversions Ben Hutchings
                   ` (110 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Alexander Aring, Marcel Holtmann

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Aring <alex.aring@gmail.com>

commit 061ef8f915988839b12460c47ebfcf3700e124f0 upstream.

This patch replaces the memcpy with a put_unaligned_le16. The placement
of crc inside of PSDU can also be unaligned. With memcpy this can fail
on some architectures.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/mac802154/tx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -24,6 +24,7 @@
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
 #include <linux/crc-ccitt.h>
+#include <asm/unaligned.h>
 
 #include <net/ieee802154_netdev.h>
 #include <net/mac802154.h>
@@ -95,9 +96,9 @@ netdev_tx_t mac802154_tx(struct mac80215
 	mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb);
 
 	if (!(priv->hw.flags & IEEE802154_HW_OMIT_CKSUM)) {
-		__le16 crc = cpu_to_le16(crc_ccitt(0, skb->data, skb->len));
+		u16 crc = crc_ccitt(0, skb->data, skb->len);
 
-		memcpy(skb_put(skb, 2), &crc, 2);
+		put_unaligned_le16(crc, skb_put(skb, 2));
 	}
 
 	if (skb_cow_head(skb, priv->hw.extra_tx_headroom))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 037/328] uart: fix race between uart_put_char() and uart_shutdown()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (77 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 076/328] block: move bio_integrity_{intervals,bytes} into blkdev.h Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 074/328] fuse: Don't access pipe->buffers without pipe_lock() Ben Hutchings
                   ` (248 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Tycho Andersen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Tycho Andersen <tycho@tycho.ws>

commit a5ba1d95e46ecaea638ddd7cd144107c783acb5d upstream.

We have reports of the following crash:

    PID: 7 TASK: ffff88085c6d61c0 CPU: 1 COMMAND: "kworker/u25:0"
    #0 [ffff88085c6db710] machine_kexec at ffffffff81046239
    #1 [ffff88085c6db760] crash_kexec at ffffffff810fc248
    #2 [ffff88085c6db830] oops_end at ffffffff81008ae7
    #3 [ffff88085c6db860] no_context at ffffffff81050b8f
    #4 [ffff88085c6db8b0] __bad_area_nosemaphore at ffffffff81050d75
    #5 [ffff88085c6db900] bad_area_nosemaphore at ffffffff81050e83
    #6 [ffff88085c6db910] __do_page_fault at ffffffff8105132e
    #7 [ffff88085c6db9b0] do_page_fault at ffffffff8105152c
    #8 [ffff88085c6db9c0] page_fault at ffffffff81a3f122
    [exception RIP: uart_put_char+149]
    RIP: ffffffff814b67b5 RSP: ffff88085c6dba78 RFLAGS: 00010006
    RAX: 0000000000000292 RBX: ffffffff827c5120 RCX: 0000000000000081
    RDX: 0000000000000000 RSI: 000000000000005f RDI: ffffffff827c5120
    RBP: ffff88085c6dba98 R8: 000000000000012c R9: ffffffff822ea320
    R10: ffff88085fe4db04 R11: 0000000000000001 R12: ffff881059f9c000
    R13: 0000000000000001 R14: 000000000000005f R15: 0000000000000fba
    ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
    #9 [ffff88085c6dbaa0] tty_put_char at ffffffff81497544
    #10 [ffff88085c6dbac0] do_output_char at ffffffff8149c91c
    #11 [ffff88085c6dbae0] __process_echoes at ffffffff8149cb8b
    #12 [ffff88085c6dbb30] commit_echoes at ffffffff8149cdc2
    #13 [ffff88085c6dbb60] n_tty_receive_buf_fast at ffffffff8149e49b
    #14 [ffff88085c6dbbc0] __receive_buf at ffffffff8149ef5a
    #15 [ffff88085c6dbc20] n_tty_receive_buf_common at ffffffff8149f016
    #16 [ffff88085c6dbca0] n_tty_receive_buf2 at ffffffff8149f194
    #17 [ffff88085c6dbcb0] flush_to_ldisc at ffffffff814a238a
    #18 [ffff88085c6dbd50] process_one_work at ffffffff81090be2
    #19 [ffff88085c6dbe20] worker_thread at ffffffff81091b4d
    #20 [ffff88085c6dbeb0] kthread at ffffffff81096384
    #21 [ffff88085c6dbf50] ret_from_fork at ffffffff81a3d69f​

after slogging through some dissasembly:

ffffffff814b6720 <uart_put_char>:
ffffffff814b6720:	55                   	push   %rbp
ffffffff814b6721:	48 89 e5             	mov    %rsp,%rbp
ffffffff814b6724:	48 83 ec 20          	sub    $0x20,%rsp
ffffffff814b6728:	48 89 1c 24          	mov    %rbx,(%rsp)
ffffffff814b672c:	4c 89 64 24 08       	mov    %r12,0x8(%rsp)
ffffffff814b6731:	4c 89 6c 24 10       	mov    %r13,0x10(%rsp)
ffffffff814b6736:	4c 89 74 24 18       	mov    %r14,0x18(%rsp)
ffffffff814b673b:	e8 b0 8e 58 00       	callq  ffffffff81a3f5f0 <mcount>
ffffffff814b6740:	4c 8b a7 88 02 00 00 	mov    0x288(%rdi),%r12
ffffffff814b6747:	45 31 ed             	xor    %r13d,%r13d
ffffffff814b674a:	41 89 f6             	mov    %esi,%r14d
ffffffff814b674d:	49 83 bc 24 70 01 00 	cmpq   $0x0,0x170(%r12)
ffffffff814b6754:	00 00
ffffffff814b6756:	49 8b 9c 24 80 01 00 	mov    0x180(%r12),%rbx
ffffffff814b675d:	00
ffffffff814b675e:	74 2f                	je     ffffffff814b678f <uart_put_char+0x6f>
ffffffff814b6760:	48 89 df             	mov    %rbx,%rdi
ffffffff814b6763:	e8 a8 67 58 00       	callq  ffffffff81a3cf10 <_raw_spin_lock_irqsave>
ffffffff814b6768:	41 8b 8c 24 78 01 00 	mov    0x178(%r12),%ecx
ffffffff814b676f:	00
ffffffff814b6770:	89 ca                	mov    %ecx,%edx
ffffffff814b6772:	f7 d2                	not    %edx
ffffffff814b6774:	41 03 94 24 7c 01 00 	add    0x17c(%r12),%edx
ffffffff814b677b:	00
ffffffff814b677c:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
ffffffff814b6782:	75 23                	jne    ffffffff814b67a7 <uart_put_char+0x87>
ffffffff814b6784:	48 89 c6             	mov    %rax,%rsi
ffffffff814b6787:	48 89 df             	mov    %rbx,%rdi
ffffffff814b678a:	e8 e1 64 58 00       	callq  ffffffff81a3cc70 <_raw_spin_unlock_irqrestore>
ffffffff814b678f:	44 89 e8             	mov    %r13d,%eax
ffffffff814b6792:	48 8b 1c 24          	mov    (%rsp),%rbx
ffffffff814b6796:	4c 8b 64 24 08       	mov    0x8(%rsp),%r12
ffffffff814b679b:	4c 8b 6c 24 10       	mov    0x10(%rsp),%r13
ffffffff814b67a0:	4c 8b 74 24 18       	mov    0x18(%rsp),%r14
ffffffff814b67a5:	c9                   	leaveq
ffffffff814b67a6:	c3                   	retq
ffffffff814b67a7:	49 8b 94 24 70 01 00 	mov    0x170(%r12),%rdx
ffffffff814b67ae:	00
ffffffff814b67af:	48 63 c9             	movslq %ecx,%rcx
ffffffff814b67b2:	41 b5 01             	mov    $0x1,%r13b
ffffffff814b67b5:	44 88 34 0a          	mov    %r14b,(%rdx,%rcx,1)
ffffffff814b67b9:	41 8b 94 24 78 01 00 	mov    0x178(%r12),%edx
ffffffff814b67c0:	00
ffffffff814b67c1:	83 c2 01             	add    $0x1,%edx
ffffffff814b67c4:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
ffffffff814b67ca:	41 89 94 24 78 01 00 	mov    %edx,0x178(%r12)
ffffffff814b67d1:	00
ffffffff814b67d2:	eb b0                	jmp    ffffffff814b6784 <uart_put_char+0x64>
ffffffff814b67d4:	66 66 66 2e 0f 1f 84 	data32 data32 nopw %cs:0x0(%rax,%rax,1)
ffffffff814b67db:	00 00 00 00 00

for our build, this is crashing at:

    circ->buf[circ->head] = c;

Looking in uart_port_startup(), it seems that circ->buf (state->xmit.buf)
protected by the "per-port mutex", which based on uart_port_check() is
state->port.mutex. Indeed, the lock acquired in uart_put_char() is
uport->lock, i.e. not the same lock.

Anyway, since the lock is not acquired, if uart_shutdown() is called, the
last chunk of that function may release state->xmit.buf before its assigned
to null, and cause the race above.

To fix it, let's lock uport->lock when allocating/deallocating
state->xmit.buf in addition to the per-port mutex.

v2: switch to locking uport->lock on allocation/deallocation instead of
    locking the per-port mutex in uart_put_char. Note that since
    uport->lock is a spin lock, we have to switch the allocation to
    GFP_ATOMIC.
v3: move the allocation outside the lock, so we can switch back to
    GFP_KERNEL

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: Use uport->lock directly rather than through
 uart_port_{,un}lock()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/tty/serial/serial_core.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -131,6 +131,7 @@ static int uart_port_startup(struct tty_
 	struct uart_port *uport = state->uart_port;
 	struct tty_port *port = &state->port;
 	unsigned long page;
+	unsigned long flags = 0;
 	int retval = 0;
 
 	if (uport->type == PORT_UNKNOWN)
@@ -145,15 +146,18 @@ static int uart_port_startup(struct tty_
 	 * Initialise and allocate the transmit and temporary
 	 * buffer.
 	 */
-	if (!state->xmit.buf) {
-		/* This is protected by the per port mutex */
-		page = get_zeroed_page(GFP_KERNEL);
-		if (!page)
-			return -ENOMEM;
+	page = get_zeroed_page(GFP_KERNEL);
+	if (!page)
+		return -ENOMEM;
 
+	spin_lock_irqsave(&uport->lock, flags);
+	if (!state->xmit.buf) {
 		state->xmit.buf = (unsigned char *) page;
 		uart_circ_clear(&state->xmit);
+	} else {
+		free_page(page);
 	}
+	spin_unlock_irqrestore(&uport->lock, flags);
 
 	retval = uport->ops->startup(uport);
 	if (retval == 0) {
@@ -232,6 +236,7 @@ static void uart_shutdown(struct tty_str
 {
 	struct uart_port *uport = state->uart_port;
 	struct tty_port *port = &state->port;
+	unsigned long flags = 0;
 
 	/*
 	 * Set the TTY IO error marker
@@ -262,10 +267,12 @@ static void uart_shutdown(struct tty_str
 	/*
 	 * Free the transmit buffer page.
 	 */
+	spin_lock_irqsave(&uport->lock, flags);
 	if (state->xmit.buf) {
 		free_page((unsigned long)state->xmit.buf);
 		state->xmit.buf = NULL;
 	}
+	spin_unlock_irqrestore(&uport->lock, flags);
 }
 
 /**


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 035/328] drm/panel: type promotion bug in s6e8aa0_read_mtp_id()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (193 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 161/328] net: macb: do not disable MDIO bus at open/close time Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 301/328] mm/vmstat.c: skip NR_TLB_REMOTE_FLUSH* properly Ben Hutchings
                   ` (132 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Andrzej Hajda, Dan Carpenter, Thierry Reding

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit cd0e0ca69109d025b1a1b6609f70682db62138b0 upstream.

The ARRAY_SIZE() macro is type size_t.  If s6e8aa0_dcs_read() returns a
negative error code, then "ret < ARRAY_SIZE(id)" is false because the
negative error code is type promoted to a high positive value.

Fixes: 02051ca06371 ("drm/panel: add S6E8AA0 driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180704093807.s3lqsb2v6dg2k43d@kili.mountain
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/panel/panel-s6e8aa0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/panel/panel-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c
@@ -832,7 +832,7 @@ static void s6e8aa0_read_mtp_id(struct s
 	int ret, i;
 
 	ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
-	if (ret < ARRAY_SIZE(id) || id[0] == 0x00) {
+	if (ret < 0 || ret < ARRAY_SIZE(id) || id[0] == 0x00) {
 		dev_err(ctx->dev, "read id failed\n");
 		ctx->error = -EIO;
 		return;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 303/328] mm: madvise(MADV_DODUMP): allow hugetlbfs pages
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (293 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 010/328] rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 147/328] arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid() Ben Hutchings
                   ` (32 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Daniel Black, Mike Kravetz, Kenneth Penza,
	Konstantin Khlebnikov, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Black <daniel@linux.ibm.com>

commit d41aa5252394c065d1f04d1ceea885b70d00c9c6 upstream.

Reproducer, assuming 2M of hugetlbfs available:

Hugetlbfs mounted, size=2M and option user=testuser

  # mount | grep ^hugetlbfs
  hugetlbfs on /dev/hugepages type hugetlbfs (rw,pagesize=2M,user=dan)
  # sysctl vm.nr_hugepages=1
  vm.nr_hugepages = 1
  # grep Huge /proc/meminfo
  AnonHugePages:         0 kB
  ShmemHugePages:        0 kB
  HugePages_Total:       1
  HugePages_Free:        1
  HugePages_Rsvd:        0
  HugePages_Surp:        0
  Hugepagesize:       2048 kB
  Hugetlb:            2048 kB

Code:

  #include <sys/mman.h>
  #include <stddef.h>
  #define SIZE 2*1024*1024
  int main()
  {
    void *ptr;
    ptr = mmap(NULL, SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_HUGETLB | MAP_ANONYMOUS, -1, 0);
    madvise(ptr, SIZE, MADV_DONTDUMP);
    madvise(ptr, SIZE, MADV_DODUMP);
  }

Compile and strace:

  mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_HUGETLB, -1, 0) = 0x7ff7c9200000
  madvise(0x7ff7c9200000, 2097152, MADV_DONTDUMP) = 0
  madvise(0x7ff7c9200000, 2097152, MADV_DODUMP) = -1 EINVAL (Invalid argument)

hugetlbfs pages have VM_DONTEXPAND in the VmFlags driver pages based on
author testing with analysis from Florian Weimer[1].

The inclusion of VM_DONTEXPAND into the VM_SPECIAL defination was a
consequence of the large useage of VM_DONTEXPAND in device drivers.

A consequence of [2] is that VM_DONTEXPAND marked pages are unable to be
marked DODUMP.

A user could quite legitimately madvise(MADV_DONTDUMP) their hugetlbfs
memory for a while and later request that madvise(MADV_DODUMP) on the same
memory.  We correct this omission by allowing madvice(MADV_DODUMP) on
hugetlbfs pages.

[1] https://stackoverflow.com/questions/52548260/madvisedodump-on-the-same-ptr-size-as-a-successful-madvisedontdump-fails-wit
[2] commit 0103bd16fb90 ("mm: prepare VM_DONTDUMP for using in drivers")

Link: http://lkml.kernel.org/r/20180930054629.29150-1-daniel@linux.ibm.com
Link: https://lists.launchpad.net/maria-discuss/msg05245.html
Fixes: 0103bd16fb90 ("mm: prepare VM_DONTDUMP for using in drivers")
Reported-by: Kenneth Penza <kpenza@gmail.com>
Signed-off-by: Daniel Black <daniel@linux.ibm.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 mm/madvise.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -75,7 +75,7 @@ static long madvise_behavior(struct vm_a
 		new_flags |= VM_DONTDUMP;
 		break;
 	case MADV_DODUMP:
-		if (new_flags & VM_SPECIAL) {
+		if (!is_vm_hugetlb_page(vma) && new_flags & VM_SPECIAL) {
 			error = -EINVAL;
 			goto out;
 		}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 322/328] KEYS: encrypted: fix buffer overread in valid_master_desc()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (104 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 289/328] perf/ring_buffer: Prevent concurent ring buffer access Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 311/328] x86/percpu: Fix this_cpu_read() Ben Hutchings
                   ` (221 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Eric Biggers, Mimi Zohar, David Howells, James Morris

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Biggers <ebiggers@google.com>

commit 794b4bc292f5d31739d89c0202c54e7dc9bc3add upstream.

With the 'encrypted' key type it was possible for userspace to provide a
data blob ending with a master key description shorter than expected,
e.g. 'keyctl add encrypted desc "new x" @s'.  When validating such a
master key description, validate_master_desc() could read beyond the end
of the buffer.  Fix this by using strncmp() instead of memcmp().  [Also
clean up the code to deduplicate some logic.]

Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 security/keys/encrypted-keys/encrypted.c | 31 ++++++++++++------------
 1 file changed, 15 insertions(+), 16 deletions(-)

--- a/security/keys/encrypted-keys/encrypted.c
+++ b/security/keys/encrypted-keys/encrypted.c
@@ -141,23 +141,22 @@ static int valid_ecryptfs_desc(const cha
  */
 static int valid_master_desc(const char *new_desc, const char *orig_desc)
 {
-	if (!memcmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN)) {
-		if (strlen(new_desc) == KEY_TRUSTED_PREFIX_LEN)
-			goto out;
-		if (orig_desc)
-			if (memcmp(new_desc, orig_desc, KEY_TRUSTED_PREFIX_LEN))
-				goto out;
-	} else if (!memcmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN)) {
-		if (strlen(new_desc) == KEY_USER_PREFIX_LEN)
-			goto out;
-		if (orig_desc)
-			if (memcmp(new_desc, orig_desc, KEY_USER_PREFIX_LEN))
-				goto out;
-	} else
-		goto out;
+	int prefix_len;
+
+	if (!strncmp(new_desc, KEY_TRUSTED_PREFIX, KEY_TRUSTED_PREFIX_LEN))
+		prefix_len = KEY_TRUSTED_PREFIX_LEN;
+	else if (!strncmp(new_desc, KEY_USER_PREFIX, KEY_USER_PREFIX_LEN))
+		prefix_len = KEY_USER_PREFIX_LEN;
+	else
+		return -EINVAL;
+
+	if (!new_desc[prefix_len])
+		return -EINVAL;
+
+	if (orig_desc && strncmp(new_desc, orig_desc, prefix_len))
+		return -EINVAL;
+
 	return 0;
-out:
-	return -EINVAL;
 }
 
 /*


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 326/328] mremap: properly flush TLB before releasing the page
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (3 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 062/328] udlfb: set optimal write delay Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 089/328] ath10k: prevent active scans on potential unusable channels Ben Hutchings
                   ` (322 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Ingo Molnar, Peter Zijlstra (Intel),
	Greg Kroah-Hartman, Linus Torvalds, Will Deacon

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Linus Torvalds <torvalds@linux-foundation.org>

commit eb66ae030829605d61fbef1909ce310e29f78821 upstream.

Jann Horn points out that our TLB flushing was subtly wrong for the
mremap() case.  What makes mremap() special is that we don't follow the
usual "add page to list of pages to be freed, then flush tlb, and then
free pages".  No, mremap() obviously just _moves_ the page from one page
table location to another.

That matters, because mremap() thus doesn't directly control the
lifetime of the moved page with a freelist: instead, the lifetime of the
page is controlled by the page table locking, that serializes access to
the entry.

As a result, we need to flush the TLB not just before releasing the lock
for the source location (to avoid any concurrent accesses to the entry),
but also before we release the destination page table lock (to avoid the
TLB being flushed after somebody else has already done something to that
page).

This also makes the whole "need_flush" logic unnecessary, since we now
always end up flushing the TLB for every valid entry.

Reported-and-tested-by: Jann Horn <jannh@google.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Tested-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[will: backport to 4.4 stable]
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 mm/huge_memory.c |  6 +++++-
 mm/mremap.c      | 21 ++++++++++++++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1452,7 +1452,7 @@ int move_huge_pmd(struct vm_area_struct
 	spinlock_t *old_ptl, *new_ptl;
 	int ret = 0;
 	pmd_t pmd;
-
+	bool force_flush = false;
 	struct mm_struct *mm = vma->vm_mm;
 
 	if ((old_addr & ~HPAGE_PMD_MASK) ||
@@ -1480,6 +1480,8 @@ int move_huge_pmd(struct vm_area_struct
 		if (new_ptl != old_ptl)
 			spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING);
 		pmd = pmdp_get_and_clear(mm, old_addr, old_pmd);
+		if (pmd_present(pmd))
+			force_flush = true;
 		VM_BUG_ON(!pmd_none(*new_pmd));
 
 		if (pmd_move_must_withdraw(new_ptl, old_ptl)) {
@@ -1488,6 +1490,8 @@ int move_huge_pmd(struct vm_area_struct
 			pgtable_trans_huge_deposit(mm, new_pmd, pgtable);
 		}
 		set_pmd_at(mm, new_addr, new_pmd, pmd_mksoft_dirty(pmd));
+		if (force_flush)
+			flush_tlb_range(vma, old_addr, old_addr + PMD_SIZE);
 		if (new_ptl != old_ptl)
 			spin_unlock(new_ptl);
 		spin_unlock(old_ptl);
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -95,6 +95,8 @@ static void move_ptes(struct vm_area_str
 	struct mm_struct *mm = vma->vm_mm;
 	pte_t *old_pte, *new_pte, pte;
 	spinlock_t *old_ptl, *new_ptl;
+	bool force_flush = false;
+	unsigned long len = old_end - old_addr;
 
 	/*
 	 * When need_rmap_locks is true, we take the i_mmap_mutex and anon_vma
@@ -141,12 +143,26 @@ static void move_ptes(struct vm_area_str
 		if (pte_none(*old_pte))
 			continue;
 		pte = ptep_get_and_clear(mm, old_addr, old_pte);
+		/*
+		 * If we are remapping a valid PTE, make sure
+		 * to flush TLB before we drop the PTL for the PTE.
+		 *
+		 * NOTE! Both old and new PTL matter: the old one
+		 * for racing with page_mkclean(), the new one to
+		 * make sure the physical page stays valid until
+		 * the TLB entry for the old mapping has been
+		 * flushed.
+		 */
+		if (pte_present(pte))
+			force_flush = true;
 		pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
 		pte = move_soft_dirty_pte(pte);
 		set_pte_at(mm, new_addr, new_pte, pte);
 	}
 
 	arch_leave_lazy_mmu_mode();
+	if (force_flush)
+		flush_tlb_range(vma, old_end - len, old_end);
 	if (new_ptl != old_ptl)
 		spin_unlock(new_ptl);
 	pte_unmap(new_pte - 1);
@@ -166,7 +182,6 @@ unsigned long move_page_tables(struct vm
 {
 	unsigned long extent, next, old_end;
 	pmd_t *old_pmd, *new_pmd;
-	bool need_flush = false;
 	unsigned long mmun_start;	/* For mmu_notifiers */
 	unsigned long mmun_end;		/* For mmu_notifiers */
 
@@ -204,7 +219,6 @@ unsigned long move_page_tables(struct vm
 					anon_vma_unlock_write(vma->anon_vma);
 			}
 			if (err > 0) {
-				need_flush = true;
 				continue;
 			} else if (!err) {
 				split_huge_page_pmd(vma, old_addr, old_pmd);
@@ -221,10 +235,7 @@ unsigned long move_page_tables(struct vm
 			extent = LATENCY_LIMIT;
 		move_ptes(vma, old_pmd, old_addr, old_addr + extent,
 			  new_vma, new_pmd, new_addr, need_rmap_locks);
-		need_flush = true;
 	}
-	if (likely(need_flush))
-		flush_tlb_range(vma, old_end-len, old_addr);
 
 	mmu_notifier_invalidate_range_end(vma->vm_mm, mmun_start, mmun_end);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 324/328] posix-timers: Sanitize overrun handling
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (7 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 118/328] PCI: mvebu: Fix I/O space end address calculation Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 321/328] cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE Ben Hutchings
                   ` (318 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Thomas Gleixner, Michael Kerrisk, Team OWL337,
	Peter Zijlstra, John Stultz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit 78c9c4dfbf8c04883941445a195276bb4bb92c76 upstream.

The posix timer overrun handling is broken because the forwarding functions
can return a huge number of overruns which does not fit in an int. As a
consequence timer_getoverrun(2) and siginfo::si_overrun can turn into
random number generators.

The k_clock::timer_forward() callbacks return a 64 bit value now. Make
k_itimer::ti_overrun[_last] 64bit as well, so the kernel internal
accounting is correct. 3Remove the temporary (int) casts.

Add a helper function which clamps the overrun value returned to user space
via timer_getoverrun(2) or siginfo::si_overrun limited to a positive value
between 0 and INT_MAX. INT_MAX is an indicator for user space that the
overrun value has been clamped.

Reported-by: Team OWL337 <icytxw@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <john.stultz@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Link: https://lkml.kernel.org/r/20180626132705.018623573@linutronix.de
[bwh: Backported to 3.16: adjust filenames, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 include/linux/posix-timers.h |  4 ++--
 kernel/posix-cpu-timers.c    |  2 +-
 kernel/posix-timers.c        | 31 ++++++++++++++++++++-----------
 3 files changed, 23 insertions(+), 14 deletions(-)

--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -65,8 +65,8 @@ struct k_itimer {
 	spinlock_t it_lock;
 	clockid_t it_clock;		/* which timer type */
 	timer_t it_id;			/* timer id */
-	int it_overrun;			/* overrun on pending signal  */
-	int it_overrun_last;		/* overrun on last delivered signal */
+	s64 it_overrun;			/* overrun on pending signal  */
+	s64 it_overrun_last;		/* overrun on last delivered signal */
 	int it_requeue_pending;		/* waiting to requeue this timer */
 #define REQUEUE_PENDING 1
 	int it_sigev_notify;		/* notify word of sigevent struct */
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -103,7 +103,7 @@ static void bump_cpu_timer(struct k_itim
 			continue;
 
 		timer->it.cpu.expires += incr;
-		timer->it_overrun += 1 << i;
+		timer->it_overrun += 1LL << i;
 		delta -= incr;
 	}
 }
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -347,6 +347,17 @@ static __init int init_posix_timers(void
 
 __initcall(init_posix_timers);
 
+/*
+ * The siginfo si_overrun field and the return value of timer_getoverrun(2)
+ * are of type int. Clamp the overrun value to INT_MAX
+ */
+static inline int timer_overrun_to_int(struct k_itimer *timr, int baseval)
+{
+	s64 sum = timr->it_overrun_last + (s64)baseval;
+
+	return sum > (s64)INT_MAX ? INT_MAX : (int)sum;
+}
+
 static void schedule_next_timer(struct k_itimer *timr)
 {
 	struct hrtimer *timer = &timr->it.real.timer;
@@ -354,12 +365,11 @@ static void schedule_next_timer(struct k
 	if (timr->it.real.interval.tv64 == 0)
 		return;
 
-	timr->it_overrun += (unsigned int) hrtimer_forward(timer,
-						timer->base->get_time(),
-						timr->it.real.interval);
+	timr->it_overrun += hrtimer_forward(timer, timer->base->get_time(),
+					    timr->it.real.interval);
 
 	timr->it_overrun_last = timr->it_overrun;
-	timr->it_overrun = -1;
+	timr->it_overrun = -1LL;
 	++timr->it_requeue_pending;
 	hrtimer_restart(timer);
 }
@@ -388,7 +398,7 @@ void do_schedule_next_timer(struct sigin
 		else
 			schedule_next_timer(timr);
 
-		info->si_overrun += timr->it_overrun_last;
+		info->si_overrun = timer_overrun_to_int(timr, info->si_overrun);
 	}
 
 	if (timr)
@@ -483,9 +493,8 @@ static enum hrtimer_restart posix_timer_
 					now = ktime_add(now, kj);
 			}
 #endif
-			timr->it_overrun += (unsigned int)
-				hrtimer_forward(timer, now,
-						timr->it.real.interval);
+			timr->it_overrun += hrtimer_forward(timer, now,
+							    timr->it.real.interval);
 			ret = HRTIMER_RESTART;
 			++timr->it_requeue_pending;
 		}
@@ -633,7 +642,7 @@ SYSCALL_DEFINE3(timer_create, const cloc
 	it_id_set = IT_ID_SET;
 	new_timer->it_id = (timer_t) new_timer_id;
 	new_timer->it_clock = which_clock;
-	new_timer->it_overrun = -1;
+	new_timer->it_overrun = -1LL;
 
 	if (timer_event_spec) {
 		if (copy_from_user(&event, timer_event_spec, sizeof (event))) {
@@ -763,7 +772,7 @@ common_timer_get(struct k_itimer *timr,
 	 * expiry is > now.
 	 */
 	if (iv.tv64 && (timr->it_requeue_pending & REQUEUE_PENDING || sig_none))
-		timr->it_overrun += (unsigned int) hrtimer_forward(timer, now, iv);
+		timr->it_overrun += hrtimer_forward(timer, now, iv);
 
 	remaining = ktime_sub(hrtimer_get_expires(timer), now);
 	/* Return 0 only, when the timer is expired and not pending */
@@ -825,7 +834,7 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_
 	if (!timr)
 		return -EINVAL;
 
-	overrun = timr->it_overrun_last;
+	overrun = timer_overrun_to_int(timr, 0);
 	unlock_timer(timr, flags);
 
 	return overrun;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 328/328] cdrom: fix improper type cast, which can leat to information leak.
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (170 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 304/328] mach64: detect the dot clock divider correctly on sparc Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 176/328] x86/microcode/intel: Add a helper which gives the microcode revision Ben Hutchings
                   ` (155 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Young_X, Jens Axboe

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Young_X <YangX92@hotmail.com>

commit e4f3aa2e1e67bb48dfbaaf1cad59013d5a5bc276 upstream.

There is another cast from unsigned long to int which causes
a bounds check to fail with specially crafted input. The value is
then used as an index in the slot array in cdrom_slot_status().

This issue is similar to CVE-2018-16658 and CVE-2018-10940.

Signed-off-by: Young_X <YangX92@hotmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/cdrom/cdrom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -2427,7 +2427,7 @@ static int cdrom_ioctl_select_disc(struc
 		return -ENOSYS;
 
 	if (arg != CDSL_CURRENT && arg != CDSL_NONE) {
-		if ((int)arg >= cdi->capacity)
+		if (arg >= cdi->capacity)
 			return -EINVAL;
 	}
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 031/328] pinctrl: msm: Fix msm_config_group_get() to be compliant
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (305 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 137/328] xtensa: increase ranges in ___invalidate_{i,d}cache_all Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 276/328] smsc75xx: Check for Wake-on-LAN modes Ben Hutchings
                   ` (20 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Linus Walleij, Douglas Anderson

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Douglas Anderson <dianders@chromium.org>

commit 05e0c828955c1cab58dd71a04539442e5375d917 upstream.

If you do this on an sdm845 board:
  cat /sys/kernel/debug/pinctrl/3400000.pinctrl/pinconf-groups

...it looks like nonsense.  For every pin you see listed:
  input bias bus hold, input bias disabled, input bias pull down, input bias pull up

That's because msm_config_group_get() isn't complying with the rules
that pinconf_generic_dump_one() expects.  Specifically for boolean
parameters (anything with a "struct pin_config_item" where has_arg is
false) the function expects that the function should return its value
not through the "config" parameter but should return "0" if the value
is set and "-EINVAL" if the value isn't set.

Let's fix this.

=46roma quick sample of other pinctrl drivers, it appears to be
tradition to also return 1 through the config parameter for these
boolean parameters when they exist.  I'm not one to knock tradition,
so I'll follow tradition and return 1 in these cases.  While I'm at
it, I'll also continue searching for four leaf clovers, kocking on
wood three times, and trying not to break mirrors.

Fixes: f365be092572 ("pinctrl: Add Qualcomm TLMM driver")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[bwh: Backported to 3.16:
 - Drop change to case PIN_CONFIG_BIAS_BUS_HOLD
 - Adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pinctrl/pinctrl-msm.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

--- a/drivers/pinctrl/pinctrl-msm.c
+++ b/drivers/pinctrl/pinctrl-msm.c
@@ -275,13 +275,19 @@ static int msm_config_group_get(struct p
 	/* Convert register value to pinconf value */
 	switch (param) {
 	case PIN_CONFIG_BIAS_DISABLE:
-		arg = arg == MSM_NO_PULL;
+		if (arg != MSM_NO_PULL)
+			return -EINVAL;
+		arg = 1;
 		break;
 	case PIN_CONFIG_BIAS_PULL_DOWN:
-		arg = arg == MSM_PULL_DOWN;
+		if (arg != MSM_PULL_DOWN)
+			return -EINVAL;
+		arg = 1;
 		break;
 	case PIN_CONFIG_BIAS_PULL_UP:
 		arg = arg == MSM_PULL_UP;
+		if (!arg)
+			return -EINVAL;
 		break;
 	case PIN_CONFIG_DRIVE_STRENGTH:
 		arg = msm_regval_to_drive(arg);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 306/328] dm cache: destroy migration_cache if cache target registration failed
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (40 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 169/328] ext4: avoid divide by zero fault when deleting corrupted inline directories Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 135/328] l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache Ben Hutchings
                   ` (285 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Shenghui Wang, Mike Snitzer

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Shenghui Wang <shhuiw@foxmail.com>

commit c7cd55504a5b0fc826a2cd9540845979d24ae542 upstream.

Commit 7e6358d244e47 ("dm: fix various targets to dm_register_target
after module __init resources created") inadvertently introduced this
bug when it moved dm_register_target() after the call to KMEM_CACHE().

Fixes: 7e6358d244e47 ("dm: fix various targets to dm_register_target after module __init resources created")
Signed-off-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/md/dm-cache-target.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -3109,14 +3109,13 @@ static int __init dm_cache_init(void)
 	int r;
 
 	migration_cache = KMEM_CACHE(dm_cache_migration, 0);
-	if (!migration_cache) {
-		dm_unregister_target(&cache_target);
+	if (!migration_cache)
 		return -ENOMEM;
-	}
 
 	r = dm_register_target(&cache_target);
 	if (r) {
 		DMERR("cache target registration failed: %d", r);
+		kmem_cache_destroy(migration_cache);
 		return r;
 	}
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 307/328] of: unittest: Disable interrupt node tests for old world MAC systems
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (115 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 054/328] iio: ad9523: Fix displayed phase Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 096/328] scsi: sysfs: Introduce sysfs_{un,}break_active_protection() Ben Hutchings
                   ` (210 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Frank Rowand, Guenter Roeck, Rob Herring

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit 8894891446c9380709451b99ab45c5c53adfd2fc upstream.

On systems with OF_IMAP_OLDWORLD_MAC set in of_irq_workarounds, the
devicetree interrupt parsing code is different, causing unit tests of
devicetree interrupt nodes to fail. Due to a bug in unittest code, which
tries to dereference an uninitialized pointer, this results in a crash.

OF: /testcase-data/phandle-tests/consumer-a: arguments longer than property
Unable to handle kernel paging request for data at address 0x00bc616e
Faulting instruction address: 0xc08e9468
Oops: Kernel access of bad area, sig: 11 [#1]
BE PREEMPT PowerMac
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.72-rc1-yocto-standard+ #1
task: cf8e0000 task.stack: cf8da000
NIP:  c08e9468 LR: c08ea5bc CTR: c08ea5ac
REGS: cf8dbb50 TRAP: 0300   Not tainted  (4.14.72-rc1-yocto-standard+)
MSR:  00001032 <ME,IR,DR,RI>  CR: 82004044  XER: 00000000
DAR: 00bc616e DSISR: 40000000
GPR00: c08ea5bc cf8dbc00 cf8e0000 c13ca517 c13ca517 c13ca8a0 00000066 00000002
GPR08: 00000063 00bc614e c0b05865 000affff 82004048 00000000 c00047f0 00000000
GPR16: c0a80000 c0a9cc34 c13ca517 c0ad1134 05ffffff 000affff c0b05860 c0abeef8
GPR24: cecec278 cecec278 c0a8c4d0 c0a885e0 c13ca8a0 05ffffff c13ca8a0 c13ca517

NIP [c08e9468] device_node_gen_full_name+0x30/0x15c
LR [c08ea5bc] device_node_string+0x190/0x3c8
Call Trace:
[cf8dbc00] [c007f670] trace_hardirqs_on_caller+0x118/0x1fc (unreliable)
[cf8dbc40] [c08ea5bc] device_node_string+0x190/0x3c8
[cf8dbcb0] [c08eb794] pointer+0x25c/0x4d0
[cf8dbd00] [c08ebcbc] vsnprintf+0x2b4/0x5ec
[cf8dbd60] [c08ec00c] vscnprintf+0x18/0x48
[cf8dbd70] [c008e268] vprintk_store+0x4c/0x22c
[cf8dbda0] [c008ecac] vprintk_emit+0x94/0x130
[cf8dbdd0] [c008ff54] printk+0x5c/0x6c
[cf8dbe10] [c0b8ddd4] of_unittest+0x2220/0x26f8
[cf8dbea0] [c0004434] do_one_initcall+0x4c/0x184
[cf8dbf00] [c0b4534c] kernel_init_freeable+0x13c/0x1d8
[cf8dbf30] [c0004814] kernel_init+0x24/0x118
[cf8dbf40] [c0013398] ret_from_kernel_thread+0x5c/0x64

The problem was observed when running a qemu test for the g3beige machine
with devicetree unittests enabled.

Disable interrupt node tests on affected systems to avoid both false
unittest failures and the crash.

With this patch in place, unittest on the affected system passes with
the following message.

	dt-test ### end of unittest - 144 passed, 0 failed

Fixes: 53a42093d96ef ("of: Add device tree selftests")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
[bwh: Backported to 3.16: s/unittest/selftest/]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/of/selftest.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -326,6 +326,9 @@ static void __init of_selftest_parse_int
 	struct of_phandle_args args;
 	int i, rc;
 
+	if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
+		return;
+
 	np = of_find_node_by_path("/testcase-data/interrupts/interrupts0");
 	if (!np) {
 		pr_err("missing testcase data\n");
@@ -398,6 +401,9 @@ static void __init of_selftest_parse_int
 	struct of_phandle_args args;
 	int i, rc;
 
+	if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
+		return;
+
 	np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0");
 	if (!np) {
 		pr_err("missing testcase data\n");
@@ -545,15 +551,19 @@ static void __init of_selftest_platform_
 	pdev = of_find_device_by_node(np);
 	selftest(pdev, "device 1 creation failed\n");
 
-	irq = platform_get_irq(pdev, 0);
-	selftest(irq == -EPROBE_DEFER, "device deferred probe failed - %d\n", irq);
-
-	/* Test that a parsing failure does not return -EPROBE_DEFER */
-	np = of_find_node_by_path("/testcase-data/testcase-device2");
-	pdev = of_find_device_by_node(np);
-	selftest(pdev, "device 2 creation failed\n");
-	irq = platform_get_irq(pdev, 0);
-	selftest(irq < 0 && irq != -EPROBE_DEFER, "device parsing error failed - %d\n", irq);
+	if (!(of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)) {
+		irq = platform_get_irq(pdev, 0);
+		selftest(irq == -EPROBE_DEFER,
+			 "device deferred probe failed - %d\n", irq);
+
+		/* Test that a parsing failure does not return -EPROBE_DEFER */
+		np = of_find_node_by_path("/testcase-data/testcase-device2");
+		pdev = of_find_device_by_node(np);
+		selftest(pdev, "device 2 creation failed\n");
+		irq = platform_get_irq(pdev, 0);
+		selftest(irq < 0 && irq != -EPROBE_DEFER,
+			 "device parsing error failed - %d\n", irq);
+	}
 
 	np = of_find_node_by_path("/testcase-data/platform-tests");
 	if (!np) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 301/328] mm/vmstat.c: skip NR_TLB_REMOTE_FLUSH* properly
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (194 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 035/328] drm/panel: type promotion bug in s6e8aa0_read_mtp_id() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 272/328] asix: Check for supported Wake-on-LAN modes Ben Hutchings
                   ` (131 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Oleg Nesterov, Davidlohr Bueso, Ingo Molnar, Kemi Wang,
	Jann Horn, Christoph Lameter, Kees Cook, Michal Hocko,
	Greg Kroah-Hartman, Andy Lutomirski, Roman Gushchin

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jann Horn <jannh@google.com>

commit 58bc4c34d249bf1bc50730a9a209139347cfacfe upstream.

5dd0b16cdaff ("mm/vmstat: Make NR_TLB_REMOTE_FLUSH_RECEIVED available even
on UP") made the availability of the NR_TLB_REMOTE_FLUSH* counters inside
the kernel unconditional to reduce #ifdef soup, but (either to avoid
showing dummy zero counters to userspace, or because that code was missed)
didn't update the vmstat_array, meaning that all following counters would
be shown with incorrect values.

This only affects kernel builds with
CONFIG_VM_EVENT_COUNTERS=y && CONFIG_DEBUG_TLBFLUSH=y && CONFIG_SMP=n.

Link: http://lkml.kernel.org/r/20181001143138.95119-2-jannh@google.com
Fixes: 5dd0b16cdaff ("mm/vmstat: Make NR_TLB_REMOTE_FLUSH_RECEIVED available even on UP")
Signed-off-by: Jann Horn <jannh@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Roman Gushchin <guro@fb.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Kemi Wang <kemi.wang@intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 mm/vmstat.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -864,6 +864,9 @@ const char * const vmstat_text[] = {
 #ifdef CONFIG_SMP
 	"nr_tlb_remote_flush",
 	"nr_tlb_remote_flush_received",
+#else
+	"", /* nr_tlb_remote_flush */
+	"", /* nr_tlb_remote_flush_received */
 #endif /* CONFIG_SMP */
 	"nr_tlb_local_flush_all",
 	"nr_tlb_local_flush_one",


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 292/328] drm: fb-helper: Reject all pixel format changing requests
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (28 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 121/328] b43/leds: Ensure NUL-termination of LED name string Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 011/328] serial: pxa: Fix an error handling path in 'serial_pxa_probe()' Ben Hutchings
                   ` (297 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Daniel Vetter, Ville Syrjälä, Eugeniy Paltsev

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>

commit db05c481977599236f12a85e55de9f5ab37b0a2c upstream.

drm fbdev emulation doesn't support changing the pixel format at all,
so reject all pixel format changing requests.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181003164538.5534-1-Eugeniy.Paltsev@synopsys.com
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/drm_fb_helper.c | 91 ++++++++++-----------------------
 1 file changed, 26 insertions(+), 65 deletions(-)

--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -750,6 +750,25 @@ int drm_fb_helper_setcmap(struct fb_cmap
 }
 EXPORT_SYMBOL(drm_fb_helper_setcmap);
 
+static bool drm_fb_pixel_format_equal(const struct fb_var_screeninfo *var_1,
+				      const struct fb_var_screeninfo *var_2)
+{
+	return var_1->bits_per_pixel == var_2->bits_per_pixel &&
+	       var_1->grayscale == var_2->grayscale &&
+	       var_1->red.offset == var_2->red.offset &&
+	       var_1->red.length == var_2->red.length &&
+	       var_1->red.msb_right == var_2->red.msb_right &&
+	       var_1->green.offset == var_2->green.offset &&
+	       var_1->green.length == var_2->green.length &&
+	       var_1->green.msb_right == var_2->green.msb_right &&
+	       var_1->blue.offset == var_2->blue.offset &&
+	       var_1->blue.length == var_2->blue.length &&
+	       var_1->blue.msb_right == var_2->blue.msb_right &&
+	       var_1->transp.offset == var_2->transp.offset &&
+	       var_1->transp.length == var_2->transp.length &&
+	       var_1->transp.msb_right == var_2->transp.msb_right;
+}
+
 /**
  * drm_fb_helper_check_var - implementation for ->fb_check_var
  * @var: screeninfo to check
@@ -760,7 +779,6 @@ int drm_fb_helper_check_var(struct fb_va
 {
 	struct drm_fb_helper *fb_helper = info->par;
 	struct drm_framebuffer *fb = fb_helper->fb;
-	int depth;
 
 	if (var->pixclock != 0 || in_dbg_master())
 		return -EINVAL;
@@ -777,72 +795,15 @@ int drm_fb_helper_check_var(struct fb_va
 		return -EINVAL;
 	}
 
-	switch (var->bits_per_pixel) {
-	case 16:
-		depth = (var->green.length == 6) ? 16 : 15;
-		break;
-	case 32:
-		depth = (var->transp.length > 0) ? 32 : 24;
-		break;
-	default:
-		depth = var->bits_per_pixel;
-		break;
-	}
-
-	switch (depth) {
-	case 8:
-		var->red.offset = 0;
-		var->green.offset = 0;
-		var->blue.offset = 0;
-		var->red.length = 8;
-		var->green.length = 8;
-		var->blue.length = 8;
-		var->transp.length = 0;
-		var->transp.offset = 0;
-		break;
-	case 15:
-		var->red.offset = 10;
-		var->green.offset = 5;
-		var->blue.offset = 0;
-		var->red.length = 5;
-		var->green.length = 5;
-		var->blue.length = 5;
-		var->transp.length = 1;
-		var->transp.offset = 15;
-		break;
-	case 16:
-		var->red.offset = 11;
-		var->green.offset = 5;
-		var->blue.offset = 0;
-		var->red.length = 5;
-		var->green.length = 6;
-		var->blue.length = 5;
-		var->transp.length = 0;
-		var->transp.offset = 0;
-		break;
-	case 24:
-		var->red.offset = 16;
-		var->green.offset = 8;
-		var->blue.offset = 0;
-		var->red.length = 8;
-		var->green.length = 8;
-		var->blue.length = 8;
-		var->transp.length = 0;
-		var->transp.offset = 0;
-		break;
-	case 32:
-		var->red.offset = 16;
-		var->green.offset = 8;
-		var->blue.offset = 0;
-		var->red.length = 8;
-		var->green.length = 8;
-		var->blue.length = 8;
-		var->transp.length = 8;
-		var->transp.offset = 24;
-		break;
-	default:
+	/*
+	 * drm fbdev emulation doesn't support changing the pixel format at all,
+	 * so reject all pixel format changing requests.
+	 */
+	if (!drm_fb_pixel_format_equal(var, &info->var)) {
+		DRM_DEBUG("fbdev emulation doesn't support changing the pixel format\n");
 		return -EINVAL;
 	}
+
 	return 0;
 }
 EXPORT_SYMBOL(drm_fb_helper_check_var);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 308/328] libertas: call into generic suspend code before turning off power
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (207 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 021/328] libertas: fix suspend and resume for SDIO connected cards Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 197/328] USB: yurex: Fix buffer over-read in yurex_write() Ben Hutchings
                   ` (118 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Ulf Hansson, Kalle Valo, Daniel Mack

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Mack <daniel@zonque.org>

commit 4f666675cdff0b986195413215eb062b7da6586f upstream.

When powering down a SDIO connected card during suspend, make sure to call
into the generic lbs_suspend() function before pulling the plug. This will
make sure the card is successfully deregistered from the system to avoid
communication to the card starving out.

Fixes: 7444a8092906 ("libertas: fix suspend and resume for SDIO connected cards")
Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/wireless/libertas/if_sdio.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -1369,6 +1369,10 @@ static int if_sdio_suspend(struct device
 	if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
 		dev_info(dev, "Suspend without wake params -- powering down card\n");
 		if (priv->fw_ready) {
+			ret = lbs_suspend(priv);
+			if (ret)
+				return ret;
+
 			priv->power_up_on_resume = true;
 			if_sdio_power_off(card);
 		}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 304/328] mach64: detect the dot clock divider correctly on sparc
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (169 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 294/328] team: Forbid enslaving team device to itself Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 328/328] cdrom: fix improper type cast, which can leat to information leak Ben Hutchings
                   ` (156 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Mikulas Patocka, David S. Miller, Ville Syrjälä

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mpatocka@redhat.com>

commit 76ebebd2464c5c8a4453c98b6dbf9c95a599e810 upstream.

On Sun Ultra 5, it happens that the dot clock is not set up properly for
some videomodes. For example, if we set the videomode "r1024x768x60" in
the firmware, Linux would incorrectly set a videomode with refresh rate
180Hz when booting (suprisingly, my LCD monitor can display it, although
display quality is very low).

The reason is this: Older mach64 cards set the divider in the register
VCLK_POST_DIV. The register has four 2-bit fields (the field that is
actually used is specified in the lowest two bits of the register
CLOCK_CNTL). The 2 bits select divider "1, 2, 4, 8". On newer mach64 cards,
there's another bit added - the top four bits of PLL_EXT_CNTL extend the
divider selection, so we have possible dividers "1, 2, 4, 8, 3, 5, 6, 12".
The Linux driver clears the top four bits of PLL_EXT_CNTL and never sets
them, so it can work regardless if the card supports them. However, the
sparc64 firmware may set these extended dividers during boot - and the
mach64 driver detects incorrect dot clock in this case.

This patch makes the driver read the additional divider bit from
PLL_EXT_CNTL and calculate the initial refresh rate properly.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Ville Syrjälä <syrjala@sci.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/video/fbdev/aty/atyfb.h      |  3 ++-
 drivers/video/fbdev/aty/atyfb_base.c |  7 ++++---
 drivers/video/fbdev/aty/mach64_ct.c  | 10 +++++-----
 3 files changed, 11 insertions(+), 9 deletions(-)

--- a/drivers/video/fbdev/aty/atyfb.h
+++ b/drivers/video/fbdev/aty/atyfb.h
@@ -335,6 +335,8 @@ extern const struct aty_pll_ops aty_pll_
 extern void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll);
 extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par);
 
+extern const u8 aty_postdividers[8];
+
 
     /*
      *  Hardware cursor support
@@ -361,7 +363,6 @@ static inline void wait_for_idle(struct
 
 extern void aty_reset_engine(const struct atyfb_par *par);
 extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info);
-extern u8   aty_ld_pll_ct(int offset, const struct atyfb_par *par);
 
 void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
 void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -3118,17 +3118,18 @@ static int atyfb_setup_sparc(struct pci_
 		/*
 		 * PLL Reference Divider M:
 		 */
-		M = pll_regs[2];
+		M = pll_regs[PLL_REF_DIV];
 
 		/*
 		 * PLL Feedback Divider N (Dependent on CLOCK_CNTL):
 		 */
-		N = pll_regs[7 + (clock_cntl & 3)];
+		N = pll_regs[VCLK0_FB_DIV + (clock_cntl & 3)];
 
 		/*
 		 * PLL Post Divider P (Dependent on CLOCK_CNTL):
 		 */
-		P = 1 << (pll_regs[6] >> ((clock_cntl & 3) << 1));
+		P = aty_postdividers[((pll_regs[VCLK_POST_DIV] >> ((clock_cntl & 3) << 1)) & 3) |
+		                     ((pll_regs[PLL_EXT_CNTL] >> (2 + (clock_cntl & 3))) & 4)];
 
 		/*
 		 * PLL Divider Q:
--- a/drivers/video/fbdev/aty/mach64_ct.c
+++ b/drivers/video/fbdev/aty/mach64_ct.c
@@ -114,7 +114,7 @@ static void aty_st_pll_ct(int offset, u8
  */
 
 #define Maximum_DSP_PRECISION 7
-static u8 postdividers[] = {1,2,4,8,3};
+const u8 aty_postdividers[8] = {1,2,4,8,3,5,6,12};
 
 static int aty_dsp_gt(const struct fb_info *info, u32 bpp, struct pll_ct *pll)
 {
@@ -221,7 +221,7 @@ static int aty_valid_pll_ct(const struct
 		pll->vclk_post_div += (q <  64*8);
 		pll->vclk_post_div += (q <  32*8);
 	}
-	pll->vclk_post_div_real = postdividers[pll->vclk_post_div];
+	pll->vclk_post_div_real = aty_postdividers[pll->vclk_post_div];
 	//    pll->vclk_post_div <<= 6;
 	pll->vclk_fb_div = q * pll->vclk_post_div_real / 8;
 	pllvclk = (1000000 * 2 * pll->vclk_fb_div) /
@@ -512,7 +512,7 @@ static int aty_init_pll_ct(const struct
 		u8 mclk_fb_div, pll_ext_cntl;
 		pll->ct.pll_ref_div = aty_ld_pll_ct(PLL_REF_DIV, par);
 		pll_ext_cntl = aty_ld_pll_ct(PLL_EXT_CNTL, par);
-		pll->ct.xclk_post_div_real = postdividers[pll_ext_cntl & 0x07];
+		pll->ct.xclk_post_div_real = aty_postdividers[pll_ext_cntl & 0x07];
 		mclk_fb_div = aty_ld_pll_ct(MCLK_FB_DIV, par);
 		if (pll_ext_cntl & PLL_MFB_TIMES_4_2B)
 			mclk_fb_div <<= 1;
@@ -534,7 +534,7 @@ static int aty_init_pll_ct(const struct
 		xpost_div += (q <  64*8);
 		xpost_div += (q <  32*8);
 	}
-	pll->ct.xclk_post_div_real = postdividers[xpost_div];
+	pll->ct.xclk_post_div_real = aty_postdividers[xpost_div];
 	pll->ct.mclk_fb_div = q * pll->ct.xclk_post_div_real / 8;
 
 #ifdef CONFIG_PPC
@@ -583,7 +583,7 @@ static int aty_init_pll_ct(const struct
 			mpost_div += (q <  64*8);
 			mpost_div += (q <  32*8);
 		}
-		sclk_post_div_real = postdividers[mpost_div];
+		sclk_post_div_real = aty_postdividers[mpost_div];
 		pll->ct.sclk_fb_div = q * sclk_post_div_real / 8;
 		pll->ct.spll_cntl2 = mpost_div << 4;
 #ifdef DEBUG


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 315/328] usb: gadget: storage: Fix Spectre v1 vulnerability
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (275 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 227/328] ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 257/328] regulator: fix crash caused by null driver data Ben Hutchings
                   ` (50 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Gustavo A. R. Silva, Greg Kroah-Hartman, Felipe Balbi

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit 9ae24af3669111d418242caec8dd4ebd9ba26860 upstream.

num can be indirectly controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/usb/gadget/function/f_mass_storage.c:3177 fsg_lun_make() warn:
potential spectre issue 'fsg_opts->common->luns' [r] (local cap)

Fix this by sanitizing num before using it to index
fsg_opts->common->luns

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Felipe Balbi <felipe.balbi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/gadget/f_mass_storage.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -219,6 +219,8 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 
+#include <linux/nospec.h>
+
 #include "gadget_chips.h"
 #include "configfs.h"
 
@@ -3344,6 +3346,7 @@ static struct config_group *fsg_lun_make
 	fsg_opts = to_fsg_opts(&group->cg_item);
 	if (num >= FSG_MAX_LUNS)
 		return ERR_PTR(-ERANGE);
+	num = array_index_nospec(num, FSG_MAX_LUNS);
 
 	mutex_lock(&fsg_opts->lock);
 	if (fsg_opts->refcnt || fsg_opts->common->luns[num]) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 310/328] net: ipv4: update fnhe_pmtu when first hop's MTU changes
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (295 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 147/328] arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 075/328] fuse: Add missed unlock_page() to fuse_readpages_fill() Ben Hutchings
                   ` (30 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Sabrina Dubroca, David S. Miller, Stefano Brivio, David Ahern

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sabrina Dubroca <sd@queasysnail.net>

commit af7d6cce53694a88d6a1bb60c9a239a6a5144459 upstream.

Since commit 5aad1de5ea2c ("ipv4: use separate genid for next hop
exceptions"), exceptions get deprecated separately from cached
routes. In particular, administrative changes don't clear PMTU anymore.

As Stefano described in commit e9fa1495d738 ("ipv6: Reflect MTU changes
on PMTU of exceptions for MTU-less routes"), the PMTU discovered before
the local MTU change can become stale:
 - if the local MTU is now lower than the PMTU, that PMTU is now
   incorrect
 - if the local MTU was the lowest value in the path, and is increased,
   we might discover a higher PMTU

Similarly to what commit e9fa1495d738 did for IPv6, update PMTU in those
cases.

If the exception was locked, the discovered PMTU was smaller than the
minimal accepted PMTU. In that case, if the new local MTU is smaller
than the current PMTU, let PMTU discovery figure out if locking of the
exception is still needed.

To do this, we need to know the old link MTU in the NETDEV_CHANGEMTU
notifier. By the time the notifier is called, dev->mtu has been
changed. This patch adds the old MTU as additional information in the
notifier structure, and a new call_netdevice_notifiers_u32() function.

Fixes: 5aad1de5ea2c ("ipv4: use separate genid for next hop exceptions")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16:
 - Pass net_device argument to call_netdevice_notifiers_info()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1867,6 +1867,13 @@ struct netdev_notifier_info {
 	struct net_device *dev;
 };
 
+struct netdev_notifier_info_ext {
+	struct netdev_notifier_info info; /* must be first */
+	union {
+		u32 mtu;
+	} ext;
+};
+
 struct netdev_notifier_change_info {
 	struct netdev_notifier_info info; /* must be first */
 	unsigned int flags_changed;
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -293,6 +293,7 @@ int ip_fib_check_default(__be32 gw, stru
 int fib_sync_down_dev(struct net_device *dev, int force);
 int fib_sync_down_addr(struct net *net, __be32 local);
 int fib_sync_up(struct net_device *dev);
+void fib_sync_mtu(struct net_device *dev, u32 orig_mtu);
 void fib_select_multipath(struct fib_result *res);
 
 /* Exported by fib_trie.c */
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1598,6 +1598,28 @@ int call_netdevice_notifiers(unsigned lo
 }
 EXPORT_SYMBOL(call_netdevice_notifiers);
 
+/**
+ *	call_netdevice_notifiers_mtu - call all network notifier blocks
+ *	@val: value passed unmodified to notifier function
+ *	@dev: net_device pointer passed unmodified to notifier function
+ *	@arg: additional u32 argument passed to the notifier function
+ *
+ *	Call all network notifier blocks.  Parameters and return value
+ *	are as for raw_notifier_call_chain().
+ */
+static int call_netdevice_notifiers_mtu(unsigned long val,
+					struct net_device *dev, u32 arg)
+{
+	struct netdev_notifier_info_ext info = {
+		.info.dev = dev,
+		.ext.mtu = arg,
+	};
+
+	BUILD_BUG_ON(offsetof(struct netdev_notifier_info_ext, info) != 0);
+
+	return call_netdevice_notifiers_info(val, dev, &info.info);
+}
+
 static struct static_key netstamp_needed __read_mostly;
 #ifdef HAVE_JUMP_LABEL
 static atomic_t netstamp_needed_deferred;
@@ -5688,14 +5710,16 @@ int dev_set_mtu(struct net_device *dev,
 	err = __dev_set_mtu(dev, new_mtu);
 
 	if (!err) {
-		err = call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
+		err = call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev,
+						   orig_mtu);
 		err = notifier_to_errno(err);
 		if (err) {
 			/* setting mtu back and notifying everyone again,
 			 * so that they have a chance to revert changes.
 			 */
 			__dev_set_mtu(dev, orig_mtu);
-			call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
+			call_netdevice_notifiers_mtu(NETDEV_CHANGEMTU, dev,
+						     new_mtu);
 		}
 	}
 	return err;
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1046,6 +1046,7 @@ static int fib_inetaddr_event(struct not
 static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+	struct netdev_notifier_info_ext *info_ext = ptr;
 	struct in_device *in_dev;
 	struct net *net = dev_net(dev);
 
@@ -1074,6 +1075,9 @@ static int fib_netdev_event(struct notif
 		fib_disable_ip(dev, 0);
 		break;
 	case NETDEV_CHANGEMTU:
+		fib_sync_mtu(dev, info_ext->ext.mtu);
+		rt_cache_flush(net);
+		break;
 	case NETDEV_CHANGE:
 		rt_cache_flush(net);
 		break;
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1122,6 +1122,56 @@ int fib_sync_down_addr(struct net *net,
 	return ret;
 }
 
+/* Update the PMTU of exceptions when:
+ * - the new MTU of the first hop becomes smaller than the PMTU
+ * - the old MTU was the same as the PMTU, and it limited discovery of
+ *   larger MTUs on the path. With that limit raised, we can now
+ *   discover larger MTUs
+ * A special case is locked exceptions, for which the PMTU is smaller
+ * than the minimal accepted PMTU:
+ * - if the new MTU is greater than the PMTU, don't make any change
+ * - otherwise, unlock and set PMTU
+ */
+static void nh_update_mtu(struct fib_nh *nh, u32 new, u32 orig)
+{
+	struct fnhe_hash_bucket *bucket;
+	int i;
+
+	bucket = rcu_dereference_protected(nh->nh_exceptions, 1);
+	if (!bucket)
+		return;
+
+	for (i = 0; i < FNHE_HASH_SIZE; i++) {
+		struct fib_nh_exception *fnhe;
+
+		for (fnhe = rcu_dereference_protected(bucket[i].chain, 1);
+		     fnhe;
+		     fnhe = rcu_dereference_protected(fnhe->fnhe_next, 1)) {
+			if (fnhe->fnhe_mtu_locked) {
+				if (new <= fnhe->fnhe_pmtu) {
+					fnhe->fnhe_pmtu = new;
+					fnhe->fnhe_mtu_locked = false;
+				}
+			} else if (new < fnhe->fnhe_pmtu ||
+				   orig == fnhe->fnhe_pmtu) {
+				fnhe->fnhe_pmtu = new;
+			}
+		}
+	}
+}
+
+void fib_sync_mtu(struct net_device *dev, u32 orig_mtu)
+{
+	unsigned int hash = fib_devindex_hashfn(dev->ifindex);
+	struct hlist_head *head = &fib_info_devhash[hash];
+	struct fib_nh *nh;
+
+	hlist_for_each_entry(nh, head, nh_hash) {
+		if (nh->nh_dev == dev)
+			nh_update_mtu(nh, dev->mtu, orig_mtu);
+	}
+}
+
 int fib_sync_down_dev(struct net_device *dev, int force)
 {
 	int ret = 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 313/328] IB/ucm: Fix Spectre v1 vulnerability
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (232 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 084/328] net: mvneta: fix mtu change on port without link Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 149/328] powerpc/powernv/pci: Work around races in PCI bridge enabling Ben Hutchings
                   ` (93 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Doug Ledford, Gustavo A. R. Silva

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit 0295e39595e1146522f2722715dba7f7fba42217 upstream.

hdr.cmd can be indirectly controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/infiniband/core/ucm.c:1127 ib_ucm_write() warn: potential
spectre issue 'ucm_cmd_table' [r] (local cap)

Fix this by sanitizing hdr.cmd before using it to index
ucm_cmd_table.

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/core/ucm.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -46,6 +46,8 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 
+#include <linux/nospec.h>
+
 #include <asm/uaccess.h>
 
 #include <rdma/ib.h>
@@ -1116,6 +1118,7 @@ static ssize_t ib_ucm_write(struct file
 
 	if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table))
 		return -EINVAL;
+	hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucm_cmd_table));
 
 	if (hdr.in + sizeof(hdr) > len)
 		return -EINVAL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 309/328] net: make skb_partial_csum_set() more robust against overflows
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (165 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 172/328] USB: net2280: Fix erroneous synchronization change Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 063/328] udlfb: handle allocation failure Ben Hutchings
                   ` (160 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Herbert Xu, Eric Dumazet, David S. Miller, syzbot

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit 52b5d6f5dcf0e5201392f7d417148ccb537dbf6f upstream.

syzbot managed to crash in skb_checksum_help() [1] :

        BUG_ON(offset + sizeof(__sum16) > skb_headlen(skb));

Root cause is the following check in skb_partial_csum_set()

	if (unlikely(start > skb_headlen(skb)) ||
	    unlikely((int)start + off > skb_headlen(skb) - 2))
		return false;

If skb_headlen(skb) is 1, then (skb_headlen(skb) - 2) becomes 0xffffffff
and the check fails to detect that ((int)start + off) is off the limit,
since the compare is unsigned.

When we fix that, then the first condition (start > skb_headlen(skb))
becomes obsolete.

Then we should also check that (skb_headroom(skb) + start) wont
overflow 16bit field.

[1]
kernel BUG at net/core/dev.c:2880!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 7330 Comm: syz-executor4 Not tainted 4.19.0-rc6+ #253
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:skb_checksum_help+0x9e3/0xbb0 net/core/dev.c:2880
Code: 85 00 ff ff ff 48 c1 e8 03 42 80 3c 28 00 0f 84 09 fb ff ff 48 8b bd 00 ff ff ff e8 97 a8 b9 fb e9 f8 fa ff ff e8 2d 09 76 fb <0f> 0b 48 8b bd 28 ff ff ff e8 1f a8 b9 fb e9 b1 f6 ff ff 48 89 cf
RSP: 0018:ffff8801d83a6f60 EFLAGS: 00010293
RAX: ffff8801b9834380 RBX: ffff8801b9f8d8c0 RCX: ffffffff8608c6d7
RDX: 0000000000000000 RSI: ffffffff8608cc63 RDI: 0000000000000006
RBP: ffff8801d83a7068 R08: ffff8801b9834380 R09: 0000000000000000
R10: ffff8801d83a76d8 R11: 0000000000000000 R12: 0000000000000001
R13: 0000000000010001 R14: 000000000000ffff R15: 00000000000000a8
FS:  00007f1a66db5700(0000) GS:ffff8801daf00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f7d77f091b0 CR3: 00000001ba252000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 skb_csum_hwoffload_help+0x8f/0xe0 net/core/dev.c:3269
 validate_xmit_skb+0xa2a/0xf30 net/core/dev.c:3312
 __dev_queue_xmit+0xc2f/0x3950 net/core/dev.c:3797
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3838
 packet_snd net/packet/af_packet.c:2928 [inline]
 packet_sendmsg+0x422d/0x64c0 net/packet/af_packet.c:2953

Fixes: 5ff8dda3035d ("net: Ensure partial checksum offset is inside the skb head")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/core/skbuff.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3593,14 +3593,16 @@ EXPORT_SYMBOL_GPL(skb_complete_wifi_ack)
  */
 bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
 {
-	if (unlikely(start > skb_headlen(skb)) ||
-	    unlikely((int)start + off > skb_headlen(skb) - 2)) {
-		net_warn_ratelimited("bad partial csum: csum=%u/%u len=%u\n",
-				     start, off, skb_headlen(skb));
+	u32 csum_end = (u32)start + (u32)off + sizeof(__sum16);
+	u32 csum_start = skb_headroom(skb) + (u32)start;
+
+	if (unlikely(csum_start > U16_MAX || csum_end > skb_headlen(skb))) {
+		net_warn_ratelimited("bad partial csum: csum=%u/%u headroom=%u headlen=%u\n",
+				     start, off, skb_headroom(skb), skb_headlen(skb));
 		return false;
 	}
 	skb->ip_summed = CHECKSUM_PARTIAL;
-	skb->csum_start = skb_headroom(skb) + start;
+	skb->csum_start = csum_start;
 	skb->csum_offset = off;
 	skb_set_transport_header(skb, start);
 	return true;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 311/328] x86/percpu: Fix this_cpu_read()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (105 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 322/328] KEYS: encrypted: fix buffer overread in valid_master_desc() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 238/328] cifs: integer overflow in in SMB2_ioctl() Ben Hutchings
                   ` (220 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Eric Dumazet, bp, Peter Zijlstra, Thomas Gleixner,
	eric.dumazet, hpa

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <peterz@infradead.org>

commit b59167ac7bafd804c91e49ad53c6d33a7394d4c8 upstream.

Eric reported that a sequence count loop using this_cpu_read() got
optimized out. This is wrong, this_cpu_read() must imply READ_ONCE()
because the interface is IRQ-safe, therefore an interrupt can have
changed the per-cpu value.

Fixes: 7c3576d261ce ("[PATCH] i386: Convert PDA into the percpu section")
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Eric Dumazet <edumazet@google.com>
Cc: hpa@zytor.com
Cc: eric.dumazet@gmail.com
Cc: bp@alien8.de
Link: https://lkml.kernel.org/r/20181011104019.748208519@infradead.org
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/include/asm/percpu.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -185,22 +185,22 @@ do {									\
 	typeof(var) pfo_ret__;				\
 	switch (sizeof(var)) {				\
 	case 1:						\
-		asm(op "b "__percpu_arg(1)",%0"		\
+		asm volatile(op "b "__percpu_arg(1)",%0"\
 		    : "=q" (pfo_ret__)			\
 		    : constraint);			\
 		break;					\
 	case 2:						\
-		asm(op "w "__percpu_arg(1)",%0"		\
+		asm volatile(op "w "__percpu_arg(1)",%0"\
 		    : "=r" (pfo_ret__)			\
 		    : constraint);			\
 		break;					\
 	case 4:						\
-		asm(op "l "__percpu_arg(1)",%0"		\
+		asm volatile(op "l "__percpu_arg(1)",%0"\
 		    : "=r" (pfo_ret__)			\
 		    : constraint);			\
 		break;					\
 	case 8:						\
-		asm(op "q "__percpu_arg(1)",%0"		\
+		asm volatile(op "q "__percpu_arg(1)",%0"\
 		    : "=r" (pfo_ret__)			\
 		    : constraint);			\
 		break;					\


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 300/328] proc: restrict kernel stack dumps to root
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (179 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 130/328] fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 192/328] RDMA/cxgb4: Only call CQ completion handler if it is armed Ben Hutchings
                   ` (146 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Josh Poimboeuf, Laura Abbott, Alexey Dobriyan,
	Greg Kroah-Hartman, Thomas Gleixner, Kees Cook, Will Deacon,
	H . Peter Anvin, Ingo Molnar, Ken Chen, Andy Lutomirski,
	Catalin Marinas, Jann Horn

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jann Horn <jannh@google.com>

commit f8a00cef17206ecd1b30d3d9f99e10d9fa707aa7 upstream.

Currently, you can use /proc/self/task/*/stack to cause a stack walk on
a task you control while it is running on another CPU.  That means that
the stack can change under the stack walker.  The stack walker does
have guards against going completely off the rails and into random
kernel memory, but it can interpret random data from your kernel stack
as instruction pointers and stack pointers.  This can cause exposure of
kernel stack contents to userspace.

Restrict the ability to inspect kernel stacks of arbitrary tasks to root
in order to prevent a local attacker from exploiting racy stack unwinding
to leak kernel task stack contents.  See the added comment for a longer
rationale.

There don't seem to be any users of this userspace API that can't
gracefully bail out if reading from the file fails.  Therefore, I believe
that this change is unlikely to break things.  In the case that this patch
does end up needing a revert, the next-best solution might be to fake a
single-entry stack based on wchan.

Link: http://lkml.kernel.org/r/20180927153316.200286-1-jannh@google.com
Fixes: 2ec220e27f50 ("proc: add /proc/*/stack")
Signed-off-by: Jann Horn <jannh@google.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Ken Chen <kenchen@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/proc/base.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -273,6 +273,20 @@ static int proc_pid_stack(struct seq_fil
 	int err;
 	int i;
 
+	/*
+	 * The ability to racily run the kernel stack unwinder on a running task
+	 * and then observe the unwinder output is scary; while it is useful for
+	 * debugging kernel issues, it can also allow an attacker to leak kernel
+	 * stack contents.
+	 * Doing this in a manner that is at least safe from races would require
+	 * some work to ensure that the remote task can not be scheduled; and
+	 * even then, this would still expose the unwinder as local attack
+	 * surface.
+	 * Therefore, this interface is restricted to root.
+	 */
+	if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN))
+		return -EACCES;
+
 	entries = kmalloc(MAX_STACK_TRACE_DEPTH * sizeof(*entries), GFP_KERNEL);
 	if (!entries)
 		return -ENOMEM;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 314/328] RDMA/ucma: Fix Spectre v1 vulnerability
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (173 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 216/328] x86/process: Don't mix user/kernel regs in 64bit __show_regs() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 100/328] crypto: ablkcipher - fix crash flushing dcache in error path Ben Hutchings
                   ` (152 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Gustavo A. R. Silva, Doug Ledford

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit a3671a4f973ee9d9621d60166cc3b037c397d604 upstream.

hdr.cmd can be indirectly controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/infiniband/core/ucma.c:1686 ucma_write() warn: potential
spectre issue 'ucma_cmd_table' [r] (local cap)

Fix this by sanitizing hdr.cmd before using it to index
ucm_cmd_table.

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/core/ucma.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -43,6 +43,8 @@
 #include <linux/sysctl.h>
 #include <linux/module.h>
 
+#include <linux/nospec.h>
+
 #include <rdma/rdma_user_cm.h>
 #include <rdma/ib_marshall.h>
 #include <rdma/rdma_cm.h>
@@ -1540,6 +1542,7 @@ static ssize_t ucma_write(struct file *f
 
 	if (hdr.cmd >= ARRAY_SIZE(ucma_cmd_table))
 		return -EINVAL;
+	hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucma_cmd_table));
 
 	if (hdr.in + sizeof(hdr) > len)
 		return -EINVAL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 312/328] USB: fix the usbfs flag sanitization for control transfers
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (246 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 159/328] mm/tlb: Remove tlb_remove_table() non-concurrent condition Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 193/328] iw_cxgb4: atomically flush the qp Ben Hutchings
                   ` (79 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Oliver Neukum, Alan Stern, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit 665c365a77fbfeabe52694aedf3446d5f2f1ce42 upstream.

Commit 7a68d9fb8510 ("USB: usbdevfs: sanitize flags more") checks the
transfer flags for URBs submitted from userspace via usbfs.  However,
the check for whether the USBDEVFS_URB_SHORT_NOT_OK flag should be
allowed for a control transfer was added in the wrong place, before
the code has properly determined the direction of the control
transfer.  (Control transfers are special because for them, the
direction is set by the bRequestType byte of the Setup packet rather
than direction bit of the endpoint address.)

This patch moves code which sets up the allow_short flag for control
transfers down after is_in has been set to the correct value.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: syzbot+24a30223a4b609bb802e@syzkaller.appspotmail.com
Fixes: 7a68d9fb8510 ("USB: usbdevfs: sanitize flags more")
CC: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/core/devio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1329,8 +1329,6 @@ static int proc_do_submiturb(struct usb_
 	u = 0;
 	switch(uurb->type) {
 	case USBDEVFS_URB_TYPE_CONTROL:
-		if (is_in)
-			allow_short = true;
 		if (!usb_endpoint_xfer_control(&ep->desc))
 			return -EINVAL;
 		/* min 8 byte setup packet */
@@ -1360,6 +1358,8 @@ static int proc_do_submiturb(struct usb_
 			is_in = 0;
 			uurb->endpoint &= ~USB_DIR_IN;
 		}
+		if (is_in)
+			allow_short = true;
 		snoop(&ps->dev->dev, "control urb: bRequestType=%02x "
 			"bRequest=%02x wValue=%04x "
 			"wIndex=%04x wLength=%04x\n",


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 289/328] perf/ring_buffer: Prevent concurent ring buffer access
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (103 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 177/328] x86/microcode/intel: Check microcode revision before updating sibling threads Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 322/328] KEYS: encrypted: fix buffer overread in valid_master_desc() Ben Hutchings
                   ` (222 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Vince Weaver, Linus Torvalds, Stephane Eranian,
	Arnaldo Carvalho de Melo, Jiri Olsa, Thomas Gleixner,
	Andrew Vagin, Namhyung Kim, Jiri Olsa, Peter Zijlstra (Intel),
	Alexander Shishkin, Arnaldo Carvalho de Melo, Ingo Molnar

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Olsa <jolsa@redhat.com>

commit cd6fb677ce7e460c25bdd66f689734102ec7d642 upstream.

Some of the scheduling tracepoints allow the perf_tp_event
code to write to ring buffer under different cpu than the
code is running on.

This results in corrupted ring buffer data demonstrated in
following perf commands:

  # perf record -e 'sched:sched_switch,sched:sched_wakeup' perf bench sched messaging
  # Running 'sched/messaging' benchmark:
  # 20 sender and receiver processes per group
  # 10 groups == 400 processes run

       Total time: 0.383 [sec]
  [ perf record: Woken up 8 times to write data ]
  0x42b890 [0]: failed to process type: -1765585640
  [ perf record: Captured and wrote 4.825 MB perf.data (29669 samples) ]

  # perf report --stdio
  0x42b890 [0]: failed to process type: -1765585640

The reason for the corruption are some of the scheduling tracepoints,
that have __perf_task dfined and thus allow to store data to another
cpu ring buffer:

  sched_waking
  sched_wakeup
  sched_wakeup_new
  sched_stat_wait
  sched_stat_sleep
  sched_stat_iowait
  sched_stat_blocked

The perf_tp_event function first store samples for current cpu
related events defined for tracepoint:

    hlist_for_each_entry_rcu(event, head, hlist_entry)
      perf_swevent_event(event, count, &data, regs);

And then iterates events of the 'task' and store the sample
for any task's event that passes tracepoint checks:

  ctx = rcu_dereference(task->perf_event_ctxp[perf_sw_context]);

  list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
    if (event->attr.type != PERF_TYPE_TRACEPOINT)
      continue;
    if (event->attr.config != entry->type)
      continue;

    perf_swevent_event(event, count, &data, regs);
  }

Above code can race with same code running on another cpu,
ending up with 2 cpus trying to store under the same ring
buffer, which is specifically not allowed.

This patch prevents the problem, by allowing only events with the same
current cpu to receive the event.

NOTE: this requires the use of (per-task-)per-cpu buffers for this
feature to work; perf-record does this.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
[peterz: small edits to Changelog]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrew Vagin <avagin@openvz.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: e6dab5ffab59 ("perf/trace: Add ability to set a target task for events")
Link: http://lkml.kernel.org/r/20180923161343.GB15054@krava
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/events/core.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6276,6 +6276,8 @@ void perf_tp_event(u64 addr, u64 count,
 			goto unlock;
 
 		list_for_each_entry_rcu(event, &ctx->event_list, event_entry) {
+			if (event->cpu != smp_processor_id())
+				continue;
 			if (event->attr.type != PERF_TYPE_TRACEPOINT)
 				continue;
 			if (event->attr.config != entry->type)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 017/328] crypto: vmac - separate tfm and request context
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (160 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 181/328] igmp: fix incorrect unsolicit report count after link down and up Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 141/328] drm/i915: set DP Main Stream Attribute for color range on DDI platforms Ben Hutchings
                   ` (165 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Eric Biggers, syzbot+264bca3a6e8d645550d3, Herbert Xu

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Biggers <ebiggers@google.com>

commit bb29648102335586e9a66289a1d98a0cb392b6e5 upstream.

syzbot reported a crash in vmac_final() when multiple threads
concurrently use the same "vmac(aes)" transform through AF_ALG.  The bug
is pretty fundamental: the VMAC template doesn't separate per-request
state from per-tfm (per-key) state like the other hash algorithms do,
but rather stores it all in the tfm context.  That's wrong.

Also, vmac_final() incorrectly zeroes most of the state including the
derived keys and cached pseudorandom pad.  Therefore, only the first
VMAC invocation with a given key calculates the correct digest.

Fix these bugs by splitting the per-tfm state from the per-request state
and using the proper init/update/final sequencing for requests.

Reproducer for the crash:

    #include <linux/if_alg.h>
    #include <sys/socket.h>
    #include <unistd.h>

    int main()
    {
            int fd;
            struct sockaddr_alg addr = {
                    .salg_type = "hash",
                    .salg_name = "vmac(aes)",
            };
            char buf[256] = { 0 };

            fd = socket(AF_ALG, SOCK_SEQPACKET, 0);
            bind(fd, (void *)&addr, sizeof(addr));
            setsockopt(fd, SOL_ALG, ALG_SET_KEY, buf, 16);
            fork();
            fd = accept(fd, NULL, NULL);
            for (;;)
                    write(fd, buf, 256);
    }

The immediate cause of the crash is that vmac_ctx_t.partial_size exceeds
VMAC_NHBYTES, causing vmac_final() to memset() a negative length.

Reported-by: syzbot+264bca3a6e8d645550d3@syzkaller.appspotmail.com
Fixes: f1939f7c5645 ("crypto: vmac - New hash algorithm for intel_txt support")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 crypto/vmac.c         | 408 +++++++++++++++++++-----------------------
 include/crypto/vmac.h |  63 -------
 2 files changed, 181 insertions(+), 290 deletions(-)
 delete mode 100644 include/crypto/vmac.h

--- a/crypto/vmac.c
+++ b/crypto/vmac.c
@@ -1,6 +1,10 @@
 /*
- * Modified to interface to the Linux kernel
+ * VMAC: Message Authentication Code using Universal Hashing
+ *
+ * Reference: https://tools.ietf.org/html/draft-krovetz-vmac-01
+ *
  * Copyright (c) 2009, Intel Corporation.
+ * Copyright (c) 2018, Google Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -16,14 +20,15 @@
  * Place - Suite 330, Boston, MA 02111-1307 USA.
  */
 
-/* --------------------------------------------------------------------------
- * VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai.
- * This implementation is herby placed in the public domain.
- * The authors offers no warranty. Use at your own risk.
- * Please send bug reports to the authors.
- * Last modified: 17 APR 08, 1700 PDT
- * ----------------------------------------------------------------------- */
+/*
+ * Derived from:
+ *	VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai.
+ *	This implementation is herby placed in the public domain.
+ *	The authors offers no warranty. Use at your own risk.
+ *	Last modified: 17 APR 08, 1700 PDT
+ */
 
+#include <asm/unaligned.h>
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/crypto.h>
@@ -31,10 +36,36 @@
 #include <linux/scatterlist.h>
 #include <asm/byteorder.h>
 #include <crypto/scatterwalk.h>
-#include <crypto/vmac.h>
 #include <crypto/internal/hash.h>
 
 /*
+ * User definable settings.
+ */
+#define VMAC_TAG_LEN	64
+#define VMAC_KEY_SIZE	128/* Must be 128, 192 or 256			*/
+#define VMAC_KEY_LEN	(VMAC_KEY_SIZE/8)
+#define VMAC_NHBYTES	128/* Must 2^i for any 3 < i < 13 Standard = 128*/
+
+/* per-transform (per-key) context */
+struct vmac_tfm_ctx {
+	struct crypto_cipher *cipher;
+	u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
+	u64 polykey[2*VMAC_TAG_LEN/64];
+	u64 l3key[2*VMAC_TAG_LEN/64];
+};
+
+/* per-request context */
+struct vmac_desc_ctx {
+	union {
+		u8 partial[VMAC_NHBYTES];	/* partial block */
+		__le64 partial_words[VMAC_NHBYTES / 8];
+	};
+	unsigned int partial_size;	/* size of the partial block */
+	bool first_block_processed;
+	u64 polytmp[2*VMAC_TAG_LEN/64];	/* running total of L2-hash */
+};
+
+/*
  * Constants and masks
  */
 #define UINT64_C(x) x##ULL
@@ -318,13 +349,6 @@ static void poly_step_func(u64 *ahi, u64
 	} while (0)
 #endif
 
-static void vhash_abort(struct vmac_ctx *ctx)
-{
-	ctx->polytmp[0] = ctx->polykey[0] ;
-	ctx->polytmp[1] = ctx->polykey[1] ;
-	ctx->first_block_processed = 0;
-}
-
 static u64 l3hash(u64 p1, u64 p2, u64 k1, u64 k2, u64 len)
 {
 	u64 rh, rl, t, z = 0;
@@ -364,280 +388,209 @@ static u64 l3hash(u64 p1, u64 p2, u64 k1
 	return rl;
 }
 
-static void vhash_update(const unsigned char *m,
-			unsigned int mbytes, /* Pos multiple of VMAC_NHBYTES */
-			struct vmac_ctx *ctx)
-{
-	u64 rh, rl, *mptr;
-	const u64 *kptr = (u64 *)ctx->nhkey;
-	int i;
-	u64 ch, cl;
-	u64 pkh = ctx->polykey[0];
-	u64 pkl = ctx->polykey[1];
-
-	if (!mbytes)
-		return;
-
-	BUG_ON(mbytes % VMAC_NHBYTES);
+/* L1 and L2-hash one or more VMAC_NHBYTES-byte blocks */
+static void vhash_blocks(const struct vmac_tfm_ctx *tctx,
+			 struct vmac_desc_ctx *dctx,
+			 const __le64 *mptr, unsigned int blocks)
+{
+	const u64 *kptr = tctx->nhkey;
+	const u64 pkh = tctx->polykey[0];
+	const u64 pkl = tctx->polykey[1];
+	u64 ch = dctx->polytmp[0];
+	u64 cl = dctx->polytmp[1];
+	u64 rh, rl;
 
-	mptr = (u64 *)m;
-	i = mbytes / VMAC_NHBYTES;  /* Must be non-zero */
-
-	ch = ctx->polytmp[0];
-	cl = ctx->polytmp[1];
-
-	if (!ctx->first_block_processed) {
-		ctx->first_block_processed = 1;
+	if (!dctx->first_block_processed) {
+		dctx->first_block_processed = true;
 		nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
 		rh &= m62;
 		ADD128(ch, cl, rh, rl);
 		mptr += (VMAC_NHBYTES/sizeof(u64));
-		i--;
+		blocks--;
 	}
 
-	while (i--) {
+	while (blocks--) {
 		nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
 		rh &= m62;
 		poly_step(ch, cl, pkh, pkl, rh, rl);
 		mptr += (VMAC_NHBYTES/sizeof(u64));
 	}
 
-	ctx->polytmp[0] = ch;
-	ctx->polytmp[1] = cl;
+	dctx->polytmp[0] = ch;
+	dctx->polytmp[1] = cl;
 }
 
-static u64 vhash(unsigned char m[], unsigned int mbytes,
-			u64 *tagl, struct vmac_ctx *ctx)
+static int vmac_setkey(struct crypto_shash *tfm,
+		       const u8 *key, unsigned int keylen)
 {
-	u64 rh, rl, *mptr;
-	const u64 *kptr = (u64 *)ctx->nhkey;
-	int i, remaining;
-	u64 ch, cl;
-	u64 pkh = ctx->polykey[0];
-	u64 pkl = ctx->polykey[1];
-
-	mptr = (u64 *)m;
-	i = mbytes / VMAC_NHBYTES;
-	remaining = mbytes % VMAC_NHBYTES;
-
-	if (ctx->first_block_processed) {
-		ch = ctx->polytmp[0];
-		cl = ctx->polytmp[1];
-	} else if (i) {
-		nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, ch, cl);
-		ch &= m62;
-		ADD128(ch, cl, pkh, pkl);
-		mptr += (VMAC_NHBYTES/sizeof(u64));
-		i--;
-	} else if (remaining) {
-		nh_16(mptr, kptr, 2*((remaining+15)/16), ch, cl);
-		ch &= m62;
-		ADD128(ch, cl, pkh, pkl);
-		mptr += (VMAC_NHBYTES/sizeof(u64));
-		goto do_l3;
-	} else {/* Empty String */
-		ch = pkh; cl = pkl;
-		goto do_l3;
-	}
-
-	while (i--) {
-		nh_vmac_nhbytes(mptr, kptr, VMAC_NHBYTES/8, rh, rl);
-		rh &= m62;
-		poly_step(ch, cl, pkh, pkl, rh, rl);
-		mptr += (VMAC_NHBYTES/sizeof(u64));
-	}
-	if (remaining) {
-		nh_16(mptr, kptr, 2*((remaining+15)/16), rh, rl);
-		rh &= m62;
-		poly_step(ch, cl, pkh, pkl, rh, rl);
-	}
-
-do_l3:
-	vhash_abort(ctx);
-	remaining *= 8;
-	return l3hash(ch, cl, ctx->l3key[0], ctx->l3key[1], remaining);
-}
-
-static u64 vmac(unsigned char m[], unsigned int mbytes,
-			const unsigned char n[16], u64 *tagl,
-			struct vmac_ctx_t *ctx)
-{
-	u64 *in_n, *out_p;
-	u64 p, h;
-	int i;
-
-	in_n = ctx->__vmac_ctx.cached_nonce;
-	out_p = ctx->__vmac_ctx.cached_aes;
-
-	i = n[15] & 1;
-	if ((*(u64 *)(n+8) != in_n[1]) || (*(u64 *)(n) != in_n[0])) {
-		in_n[0] = *(u64 *)(n);
-		in_n[1] = *(u64 *)(n+8);
-		((unsigned char *)in_n)[15] &= 0xFE;
-		crypto_cipher_encrypt_one(ctx->child,
-			(unsigned char *)out_p, (unsigned char *)in_n);
+	struct vmac_tfm_ctx *tctx = crypto_shash_ctx(tfm);
+	__be64 out[2];
+	u8 in[16] = { 0 };
+	unsigned int i;
+	int err;
 
-		((unsigned char *)in_n)[15] |= (unsigned char)(1-i);
+	if (keylen != VMAC_KEY_LEN) {
+		crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
+		return -EINVAL;
 	}
-	p = be64_to_cpup(out_p + i);
-	h = vhash(m, mbytes, (u64 *)0, &ctx->__vmac_ctx);
-	return le64_to_cpu(p + h);
-}
-
-static int vmac_set_key(unsigned char user_key[], struct vmac_ctx_t *ctx)
-{
-	u64 in[2] = {0}, out[2];
-	unsigned i;
-	int err = 0;
 
-	err = crypto_cipher_setkey(ctx->child, user_key, VMAC_KEY_LEN);
+	err = crypto_cipher_setkey(tctx->cipher, key, keylen);
 	if (err)
 		return err;
 
 	/* Fill nh key */
-	((unsigned char *)in)[0] = 0x80;
-	for (i = 0; i < sizeof(ctx->__vmac_ctx.nhkey)/8; i += 2) {
-		crypto_cipher_encrypt_one(ctx->child,
-			(unsigned char *)out, (unsigned char *)in);
-		ctx->__vmac_ctx.nhkey[i] = be64_to_cpup(out);
-		ctx->__vmac_ctx.nhkey[i+1] = be64_to_cpup(out+1);
-		((unsigned char *)in)[15] += 1;
+	in[0] = 0x80;
+	for (i = 0; i < ARRAY_SIZE(tctx->nhkey); i += 2) {
+		crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
+		tctx->nhkey[i] = be64_to_cpu(out[0]);
+		tctx->nhkey[i+1] = be64_to_cpu(out[1]);
+		in[15]++;
 	}
 
 	/* Fill poly key */
-	((unsigned char *)in)[0] = 0xC0;
-	in[1] = 0;
-	for (i = 0; i < sizeof(ctx->__vmac_ctx.polykey)/8; i += 2) {
-		crypto_cipher_encrypt_one(ctx->child,
-			(unsigned char *)out, (unsigned char *)in);
-		ctx->__vmac_ctx.polytmp[i] =
-			ctx->__vmac_ctx.polykey[i] =
-				be64_to_cpup(out) & mpoly;
-		ctx->__vmac_ctx.polytmp[i+1] =
-			ctx->__vmac_ctx.polykey[i+1] =
-				be64_to_cpup(out+1) & mpoly;
-		((unsigned char *)in)[15] += 1;
+	in[0] = 0xC0;
+	in[15] = 0;
+	for (i = 0; i < ARRAY_SIZE(tctx->polykey); i += 2) {
+		crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
+		tctx->polykey[i] = be64_to_cpu(out[0]) & mpoly;
+		tctx->polykey[i+1] = be64_to_cpu(out[1]) & mpoly;
+		in[15]++;
 	}
 
 	/* Fill ip key */
-	((unsigned char *)in)[0] = 0xE0;
-	in[1] = 0;
-	for (i = 0; i < sizeof(ctx->__vmac_ctx.l3key)/8; i += 2) {
+	in[0] = 0xE0;
+	in[15] = 0;
+	for (i = 0; i < ARRAY_SIZE(tctx->l3key); i += 2) {
 		do {
-			crypto_cipher_encrypt_one(ctx->child,
-				(unsigned char *)out, (unsigned char *)in);
-			ctx->__vmac_ctx.l3key[i] = be64_to_cpup(out);
-			ctx->__vmac_ctx.l3key[i+1] = be64_to_cpup(out+1);
-			((unsigned char *)in)[15] += 1;
-		} while (ctx->__vmac_ctx.l3key[i] >= p64
-			|| ctx->__vmac_ctx.l3key[i+1] >= p64);
+			crypto_cipher_encrypt_one(tctx->cipher, (u8 *)out, in);
+			tctx->l3key[i] = be64_to_cpu(out[0]);
+			tctx->l3key[i+1] = be64_to_cpu(out[1]);
+			in[15]++;
+		} while (tctx->l3key[i] >= p64 || tctx->l3key[i+1] >= p64);
 	}
 
-	/* Invalidate nonce/aes cache and reset other elements */
-	ctx->__vmac_ctx.cached_nonce[0] = (u64)-1; /* Ensure illegal nonce */
-	ctx->__vmac_ctx.cached_nonce[1] = (u64)0;  /* Ensure illegal nonce */
-	ctx->__vmac_ctx.first_block_processed = 0;
-
-	return err;
+	return 0;
 }
 
-static int vmac_setkey(struct crypto_shash *parent,
-		const u8 *key, unsigned int keylen)
+static int vmac_init(struct shash_desc *desc)
 {
-	struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
+	const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
+	struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
 
-	if (keylen != VMAC_KEY_LEN) {
-		crypto_shash_set_flags(parent, CRYPTO_TFM_RES_BAD_KEY_LEN);
-		return -EINVAL;
-	}
-
-	return vmac_set_key((u8 *)key, ctx);
-}
-
-static int vmac_init(struct shash_desc *pdesc)
-{
+	dctx->partial_size = 0;
+	dctx->first_block_processed = false;
+	memcpy(dctx->polytmp, tctx->polykey, sizeof(dctx->polytmp));
 	return 0;
 }
 
-static int vmac_update(struct shash_desc *pdesc, const u8 *p,
-		unsigned int len)
+static int vmac_update(struct shash_desc *desc, const u8 *p, unsigned int len)
 {
-	struct crypto_shash *parent = pdesc->tfm;
-	struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
-	int expand;
-	int min;
-
-	expand = VMAC_NHBYTES - ctx->partial_size > 0 ?
-			VMAC_NHBYTES - ctx->partial_size : 0;
-
-	min = len < expand ? len : expand;
-
-	memcpy(ctx->partial + ctx->partial_size, p, min);
-	ctx->partial_size += min;
-
-	if (len < expand)
-		return 0;
-
-	vhash_update(ctx->partial, VMAC_NHBYTES, &ctx->__vmac_ctx);
-	ctx->partial_size = 0;
-
-	len -= expand;
-	p += expand;
-
-	if (len % VMAC_NHBYTES) {
-		memcpy(ctx->partial, p + len - (len % VMAC_NHBYTES),
-			len % VMAC_NHBYTES);
-		ctx->partial_size = len % VMAC_NHBYTES;
+	const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
+	struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
+	unsigned int n;
+
+	if (dctx->partial_size) {
+		n = min(len, VMAC_NHBYTES - dctx->partial_size);
+		memcpy(&dctx->partial[dctx->partial_size], p, n);
+		dctx->partial_size += n;
+		p += n;
+		len -= n;
+		if (dctx->partial_size == VMAC_NHBYTES) {
+			vhash_blocks(tctx, dctx, dctx->partial_words, 1);
+			dctx->partial_size = 0;
+		}
+	}
+
+	if (len >= VMAC_NHBYTES) {
+		n = round_down(len, VMAC_NHBYTES);
+		/* TODO: 'p' may be misaligned here */
+		vhash_blocks(tctx, dctx, (const __le64 *)p, n / VMAC_NHBYTES);
+		p += n;
+		len -= n;
+	}
+
+	if (len) {
+		memcpy(dctx->partial, p, len);
+		dctx->partial_size = len;
 	}
 
-	vhash_update(p, len - len % VMAC_NHBYTES, &ctx->__vmac_ctx);
-
 	return 0;
 }
 
-static int vmac_final(struct shash_desc *pdesc, u8 *out)
+static u64 vhash_final(const struct vmac_tfm_ctx *tctx,
+		       struct vmac_desc_ctx *dctx)
 {
-	struct crypto_shash *parent = pdesc->tfm;
-	struct vmac_ctx_t *ctx = crypto_shash_ctx(parent);
-	vmac_t mac;
-	u8 nonce[16] = {};
-
-	/* vmac() ends up accessing outside the array bounds that
-	 * we specify.  In appears to access up to the next 2-word
-	 * boundary.  We'll just be uber cautious and zero the
-	 * unwritten bytes in the buffer.
-	 */
-	if (ctx->partial_size) {
-		memset(ctx->partial + ctx->partial_size, 0,
-			VMAC_NHBYTES - ctx->partial_size);
-	}
-	mac = vmac(ctx->partial, ctx->partial_size, nonce, NULL, ctx);
-	memcpy(out, &mac, sizeof(vmac_t));
-	memzero_explicit(&mac, sizeof(vmac_t));
-	memset(&ctx->__vmac_ctx, 0, sizeof(struct vmac_ctx));
-	ctx->partial_size = 0;
+	unsigned int partial = dctx->partial_size;
+	u64 ch = dctx->polytmp[0];
+	u64 cl = dctx->polytmp[1];
+
+	/* L1 and L2-hash the final block if needed */
+	if (partial) {
+		/* Zero-pad to next 128-bit boundary */
+		unsigned int n = round_up(partial, 16);
+		u64 rh, rl;
+
+		memset(&dctx->partial[partial], 0, n - partial);
+		nh_16(dctx->partial_words, tctx->nhkey, n / 8, rh, rl);
+		rh &= m62;
+		if (dctx->first_block_processed)
+			poly_step(ch, cl, tctx->polykey[0], tctx->polykey[1],
+				  rh, rl);
+		else
+			ADD128(ch, cl, rh, rl);
+	}
+
+	/* L3-hash the 128-bit output of L2-hash */
+	return l3hash(ch, cl, tctx->l3key[0], tctx->l3key[1], partial * 8);
+}
+
+static int vmac_final(struct shash_desc *desc, u8 *out)
+{
+	const struct vmac_tfm_ctx *tctx = crypto_shash_ctx(desc->tfm);
+	struct vmac_desc_ctx *dctx = shash_desc_ctx(desc);
+	static const u8 nonce[16] = {}; /* TODO: this is insecure */
+	union {
+		u8 bytes[16];
+		__be64 pads[2];
+	} block;
+	int index;
+	u64 hash, pad;
+
+	/* Finish calculating the VHASH of the message */
+	hash = vhash_final(tctx, dctx);
+
+	/* Generate pseudorandom pad by encrypting the nonce */
+	memcpy(&block, nonce, 16);
+	index = block.bytes[15] & 1;
+	block.bytes[15] &= ~1;
+	crypto_cipher_encrypt_one(tctx->cipher, block.bytes, block.bytes);
+	pad = be64_to_cpu(block.pads[index]);
+
+	/* The VMAC is the sum of VHASH and the pseudorandom pad */
+	put_unaligned_le64(hash + pad, out);
 	return 0;
 }
 
 static int vmac_init_tfm(struct crypto_tfm *tfm)
 {
-	struct crypto_cipher *cipher;
-	struct crypto_instance *inst = (void *)tfm->__crt_alg;
+	struct crypto_instance *inst = crypto_tfm_alg_instance(tfm);
 	struct crypto_spawn *spawn = crypto_instance_ctx(inst);
-	struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
+	struct vmac_tfm_ctx *tctx = crypto_tfm_ctx(tfm);
+	struct crypto_cipher *cipher;
 
 	cipher = crypto_spawn_cipher(spawn);
 	if (IS_ERR(cipher))
 		return PTR_ERR(cipher);
 
-	ctx->child = cipher;
+	tctx->cipher = cipher;
 	return 0;
 }
 
 static void vmac_exit_tfm(struct crypto_tfm *tfm)
 {
-	struct vmac_ctx_t *ctx = crypto_tfm_ctx(tfm);
-	crypto_free_cipher(ctx->child);
+	struct vmac_tfm_ctx *tctx = crypto_tfm_ctx(tfm);
+
+	crypto_free_cipher(tctx->cipher);
 }
 
 static int vmac_create(struct crypto_template *tmpl, struct rtattr **tb)
@@ -674,11 +627,12 @@ static int vmac_create(struct crypto_tem
 	inst->alg.base.cra_blocksize = alg->cra_blocksize;
 	inst->alg.base.cra_alignmask = alg->cra_alignmask;
 
-	inst->alg.digestsize = sizeof(vmac_t);
-	inst->alg.base.cra_ctxsize = sizeof(struct vmac_ctx_t);
+	inst->alg.base.cra_ctxsize = sizeof(struct vmac_tfm_ctx);
 	inst->alg.base.cra_init = vmac_init_tfm;
 	inst->alg.base.cra_exit = vmac_exit_tfm;
 
+	inst->alg.descsize = sizeof(struct vmac_desc_ctx);
+	inst->alg.digestsize = VMAC_TAG_LEN / 8;
 	inst->alg.init = vmac_init;
 	inst->alg.update = vmac_update;
 	inst->alg.final = vmac_final;
--- a/include/crypto/vmac.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Modified to interface to the Linux kernel
- * Copyright (c) 2009, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#ifndef __CRYPTO_VMAC_H
-#define __CRYPTO_VMAC_H
-
-/* --------------------------------------------------------------------------
- * VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai.
- * This implementation is herby placed in the public domain.
- * The authors offers no warranty. Use at your own risk.
- * Please send bug reports to the authors.
- * Last modified: 17 APR 08, 1700 PDT
- * ----------------------------------------------------------------------- */
-
-/*
- * User definable settings.
- */
-#define VMAC_TAG_LEN	64
-#define VMAC_KEY_SIZE	128/* Must be 128, 192 or 256			*/
-#define VMAC_KEY_LEN	(VMAC_KEY_SIZE/8)
-#define VMAC_NHBYTES	128/* Must 2^i for any 3 < i < 13 Standard = 128*/
-
-/*
- * This implementation uses u32 and u64 as names for unsigned 32-
- * and 64-bit integer types. These are defined in C99 stdint.h. The
- * following may need adaptation if you are not running a C99 or
- * Microsoft C environment.
- */
-struct vmac_ctx {
-	u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
-	u64 polykey[2*VMAC_TAG_LEN/64];
-	u64 l3key[2*VMAC_TAG_LEN/64];
-	u64 polytmp[2*VMAC_TAG_LEN/64];
-	u64 cached_nonce[2];
-	u64 cached_aes[2];
-	int first_block_processed;
-};
-
-typedef u64 vmac_t;
-
-struct vmac_ctx_t {
-	struct crypto_cipher *child;
-	struct vmac_ctx __vmac_ctx;
-	u8 partial[VMAC_NHBYTES];	/* partial block */
-	int partial_size;		/* size of the partial block */
-};
-
-#endif /* __CRYPTO_VMAC_H */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 293/328] PM / core: Clear the direct_complete flag on errors
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (56 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 203/328] spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 268/328] bcache: do not assign in if condition in bcache_init() Ben Hutchings
                   ` (269 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Al Cooper, Rafael J. Wysocki, Ulf Hansson

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

commit 69e445ab8b66a9f30519842ef18be555d3ee9b51 upstream.

If __device_suspend() runs asynchronously (in which case the device
passed to it is in dpm_suspended_list at that point) and it returns
early on an error or pending wakeup, and the power.direct_complete
flag has been set for the device already, the subsequent
device_resume() will be confused by that and it will call
pm_runtime_enable() incorrectly, as runtime PM has not been
disabled for the device by __device_suspend().

To avoid that, clear power.direct_complete if __device_suspend()
is not going to disable runtime PM for the device before returning.

Fixes: aae4518b3124 (PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily)
Reported-by: Al Cooper <alcooperx@gmail.com>
Tested-by: Al Cooper <alcooperx@gmail.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/base/power/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1336,8 +1336,10 @@ static int __device_suspend(struct devic
 
 	dpm_wait_for_children(dev, async);
 
-	if (async_error)
+	if (async_error) {
+		dev->power.direct_complete = false;
 		goto Complete;
+	}
 
 	/*
 	 * If a device configured to wake up the system from sleep states
@@ -1349,6 +1351,7 @@ static int __device_suspend(struct devic
 		pm_wakeup_event(dev, 0);
 
 	if (pm_wakeup_pending()) {
+		dev->power.direct_complete = false;
 		async_error = -EBUSY;
 		goto Complete;
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 241/328] bpf, net: add skb_mac_header_len helper
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (234 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 149/328] powerpc/powernv/pci: Work around races in PCI bridge enabling Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 319/328] net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs Ben Hutchings
                   ` (91 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, John Fastabend, Daniel Borkmann, David S. Miller,
	Alexei Starovoitov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <daniel@iogearbox.net>

commit 0daf4349406074fc03e4889ba5e97e6fb5311bab upstream.

Add a small skb_mac_header_len() helper similarly as the
skb_network_header_len() we have and replace open coded
places in BPF's bpf_skb_change_proto() helper. Will also
be used in upcoming work.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: drop changes in bpf]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1801,6 +1801,11 @@ static inline unsigned char *skb_mac_hea
 	return skb->head + skb->mac_header;
 }
 
+static inline u32 skb_mac_header_len(const struct sk_buff *skb)
+{
+	return skb->network_header - skb->mac_header;
+}
+
 static inline int skb_mac_header_was_set(const struct sk_buff *skb)
 {
 	return skb->mac_header != (typeof(skb->mac_header))~0U;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 247/328] Input: elantech - enable middle button of touchpad on ThinkPad P72
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (259 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 215/328] batman-adv: Prevent duplicated nc_node entry Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 138/328] ubifs: Fix synced_i_size calculation for xattr inodes Ben Hutchings
                   ` (66 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Aaron Ma, Dmitry Torokhov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Aaron Ma <aaron.ma@canonical.com>

commit 91a97507323e1ad4bfc10f4a5922e67cdaf8b3cd upstream.

Adding 2 new touchpad IDs to support middle button support.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/input/mouse/elantech.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1083,6 +1083,8 @@ static const struct dmi_system_id elante
 static const char * const middle_button_pnp_ids[] = {
 	"LEN2131", /* ThinkPad P52 w/ NFC */
 	"LEN2132", /* ThinkPad P52 */
+	"LEN2133", /* ThinkPad P72 w/ NFC */
+	"LEN2134", /* ThinkPad P72 */
 	NULL
 };
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 248/328] ARM: 8799/1: mm: fix pci_ioremap_io() offset check
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (175 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 100/328] crypto: ablkcipher - fix crash flushing dcache in error path Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 273/328] ax88179_178a: Check for supported Wake-on-LAN modes Ben Hutchings
                   ` (150 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Thomas Petazzoni, Russell King, Nicolas Pitre, Thomas Petazzoni

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

commit 3a58ac65e2d7969bcdf1b6acb70fa4d12a88e53e upstream.

IO_SPACE_LIMIT is the ending address of the PCI IO space, i.e
something like 0xfffff (and not 0x100000).

Therefore, when offset = 0xf0000 is passed as argument, this function
fails even though the offset + SZ_64K fits below the
IO_SPACE_LIMIT. This makes the last chunk of 64 KB of the I/O space
not usable as it cannot be mapped.

This patch fixes that by substracing 1 to offset + SZ_64K, so that we
compare the addrss of the last byte of the I/O space against
IO_SPACE_LIMIT instead of the address of the first byte of what is
after the I/O space.

Fixes: c2794437091a4 ("ARM: Add fixed PCI i/o mapping")
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/arm/mm/ioremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -447,7 +447,7 @@ void pci_ioremap_set_mem_type(int mem_ty
 
 int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr)
 {
-	BUG_ON(offset + SZ_64K > IO_SPACE_LIMIT);
+	BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT);
 
 	return ioremap_page_range(PCI_IO_VIRT_BASE + offset,
 				  PCI_IO_VIRT_BASE + offset + SZ_64K,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 235/328] misc: hmc6352: fix potential Spectre v1
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (288 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 178/328] x86/microcode: Make sure boot_cpu_data.microcode is up-to-date Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 320/328] mtd: fsl-quadspi: fix macro collision problems with READ/WRITE Ben Hutchings
                   ` (37 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Gustavo A. R. Silva

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit de916736aaaadddbd6061472969f667b14204aa9 upstream.

val is indirectly controlled by user-space, hence leading to a
potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/misc/hmc6352.c:54 compass_store() warn: potential spectre issue
'map' [r]

Fix this by sanitizing val before using it to index map

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/misc/hmc6352.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/misc/hmc6352.c
+++ b/drivers/misc/hmc6352.c
@@ -27,6 +27,7 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/sysfs.h>
+#include <linux/nospec.h>
 
 static DEFINE_MUTEX(compass_mutex);
 
@@ -50,6 +51,7 @@ static int compass_store(struct device *
 		return ret;
 	if (val >= strlen(map))
 		return -EINVAL;
+	val = array_index_nospec(val, strlen(map));
 	mutex_lock(&compass_mutex);
 	ret = compass_command(c, map[val]);
 	mutex_unlock(&compass_mutex);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 246/328] tty: vt_ioctl: fix potential Spectre v1
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (70 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 038/328] tty: fix typo in comment of tty_termios_encode_baud_rate Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 170/328] usb: gadget: udc: net2280: do not rely on 'driver' argument Ben Hutchings
                   ` (255 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Alan Cox, Greg Kroah-Hartman, Gustavo A. R. Silva

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit e97267cb4d1ee01ca0929638ec0fcbb0904f903d upstream.

vsa.console is indirectly controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/tty/vt/vt_ioctl.c:711 vt_ioctl() warn: potential spectre issue
'vc_cons' [r]

Fix this by sanitizing vsa.console before using it to index vc_cons

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/tty/vt/vt_ioctl.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -31,6 +31,8 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
+#include <linux/nospec.h>
+
 #include <linux/kbd_kern.h>
 #include <linux/vt_kern.h>
 #include <linux/kbd_diacr.h>
@@ -703,6 +705,8 @@ int vt_ioctl(struct tty_struct *tty,
 		if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
 			ret = -ENXIO;
 		else {
+			vsa.console = array_index_nospec(vsa.console,
+							 MAX_NR_CONSOLES + 1);
 			vsa.console--;
 			console_lock();
 			ret = vc_allocate(vsa.console);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 242/328] pppoe: fix reception of frames with no mac header
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (123 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 012/328] media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 207/328] usb: Avoid use-after-free by flushing endpoints early in usb_set_interface() Ben Hutchings
                   ` (202 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, syzbot+f5f6080811c849739212, David S. Miller, Guillaume Nault

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Guillaume Nault <g.nault@alphalink.fr>

commit 8540827ebac6b654ab2f69c8fbce9e4fbd6304a0 upstream.

pppoe_rcv() needs to look back at the Ethernet header in order to
lookup the PPPoE session. Therefore we need to ensure that the mac
header is big enough to contain an Ethernet header. Otherwise
eth_hdr(skb)->h_source might access invalid data.

==================================================================
BUG: KMSAN: uninit-value in __get_item drivers/net/ppp/pppoe.c:172 [inline]
BUG: KMSAN: uninit-value in get_item drivers/net/ppp/pppoe.c:236 [inline]
BUG: KMSAN: uninit-value in pppoe_rcv+0xcef/0x10e0 drivers/net/ppp/pppoe.c:450
CPU: 0 PID: 4543 Comm: syz-executor355 Not tainted 4.16.0+ #87
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google
01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x185/0x1d0 lib/dump_stack.c:53
 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067
 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:683
 __get_item drivers/net/ppp/pppoe.c:172 [inline]
 get_item drivers/net/ppp/pppoe.c:236 [inline]
 pppoe_rcv+0xcef/0x10e0 drivers/net/ppp/pppoe.c:450
 __netif_receive_skb_core+0x47df/0x4a90 net/core/dev.c:4562
 __netif_receive_skb net/core/dev.c:4627 [inline]
 netif_receive_skb_internal+0x49d/0x630 net/core/dev.c:4701
 netif_receive_skb+0x230/0x240 net/core/dev.c:4725
 tun_rx_batched drivers/net/tun.c:1555 [inline]
 tun_get_user+0x740f/0x7c60 drivers/net/tun.c:1962
 tun_chr_write_iter+0x1d4/0x330 drivers/net/tun.c:1990
 call_write_iter include/linux/fs.h:1782 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x7fb/0x9f0 fs/read_write.c:482
 vfs_write+0x463/0x8d0 fs/read_write.c:544
 SYSC_write+0x172/0x360 fs/read_write.c:589
 SyS_write+0x55/0x80 fs/read_write.c:581
 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
RIP: 0033:0x4447c9
RSP: 002b:00007fff64c8fc28 EFLAGS: 00000297 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004447c9
RDX: 000000000000fd87 RSI: 0000000020000600 RDI: 0000000000000004
RBP: 00000000006cf018 R08: 00007fff64c8fda8 R09: 00007fff00006bda
R10: 0000000000005fe7 R11: 0000000000000297 R12: 00000000004020d0
R13: 0000000000402160 R14: 0000000000000000 R15: 0000000000000000

Uninit was created at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline]
 kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188
 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314
 kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321
 slab_post_alloc_hook mm/slab.h:445 [inline]
 slab_alloc_node mm/slub.c:2737 [inline]
 __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369
 __kmalloc_reserve net/core/skbuff.c:138 [inline]
 __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206
 alloc_skb include/linux/skbuff.h:984 [inline]
 alloc_skb_with_frags+0x1d4/0xb20 net/core/skbuff.c:5234
 sock_alloc_send_pskb+0xb56/0x1190 net/core/sock.c:2085
 tun_alloc_skb drivers/net/tun.c:1532 [inline]
 tun_get_user+0x2242/0x7c60 drivers/net/tun.c:1829
 tun_chr_write_iter+0x1d4/0x330 drivers/net/tun.c:1990
 call_write_iter include/linux/fs.h:1782 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x7fb/0x9f0 fs/read_write.c:482
 vfs_write+0x463/0x8d0 fs/read_write.c:544
 SYSC_write+0x172/0x360 fs/read_write.c:589
 SyS_write+0x55/0x80 fs/read_write.c:581
 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
==================================================================

Fixes: 224cf5ad14c0 ("ppp: Move the PPP drivers")
Reported-by: syzbot+f5f6080811c849739212@syzkaller.appspotmail.com
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/ppp/pppoe.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -426,6 +426,9 @@ static int pppoe_rcv(struct sk_buff *skb
 	if (!skb)
 		goto out;
 
+	if (skb_mac_header_len(skb) < ETH_HLEN)
+		goto drop;
+
 	if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
 		goto drop;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 244/328] ring-buffer: Allow for rescheduling when removing pages
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (16 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 266/328] bcache: Remove deprecated create_workqueue Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 050/328] PCI: hotplug: Don't leak pci_slot on registration failure Ben Hutchings
                   ` (309 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Steven Rostedt (VMware), Vaibhav Nagarnaik, Jason Behmer

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Vaibhav Nagarnaik <vnagarnaik@google.com>

commit 83f365554e47997ec68dc4eca3f5dce525cd15c3 upstream.

When reducing ring buffer size, pages are removed by scheduling a work
item on each CPU for the corresponding CPU ring buffer. After the pages
are removed from ring buffer linked list, the pages are free()d in a
tight loop. The loop does not give up CPU until all pages are removed.
In a worst case behavior, when lot of pages are to be freed, it can
cause system stall.

After the pages are removed from the list, the free() can happen while
the work is rescheduled. Call cond_resched() in the loop to prevent the
system hangup.

Link: http://lkml.kernel.org/r/20180907223129.71994-1-vnagarnaik@google.com

Fixes: 83f40318dab00 ("ring-buffer: Make removal of ring buffer pages atomic")
Reported-by: Jason Behmer <jbehmer@google.com>
Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/trace/ring_buffer.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1541,6 +1541,8 @@ rb_remove_pages(struct ring_buffer_per_c
 	tmp_iter_page = first_page;
 
 	do {
+		cond_resched();
+
 		to_remove_page = tmp_iter_page;
 		rb_inc_page(cpu_buffer, &tmp_iter_page);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 230/328] drm: udl: Destroy framebuffer only if it was initialized
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (137 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 191/328] RDMA/ucma: check fd type in ucma_migrate_id() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 030/328] vmci: type promotion bug in qp_host_get_user_memory() Ben Hutchings
                   ` (188 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Daniel Vetter, Sean Paul, Emil Lundmark

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Emil Lundmark <lndmrk@chromium.org>

commit fcb74da1eb8edd3a4ef9b9724f88ed709d684227 upstream.

This fixes a NULL pointer dereference that can happen if the UDL
driver is unloaded before the framebuffer is initialized. This can
happen e.g. if the USB device is unplugged right after it was plugged
in.

As explained by Stéphane Marchesin:

It happens when fbdev is disabled (which is the case for Chrome OS).
Even though intialization of the fbdev part is optional (it's done in
udlfb_create which is the callback for fb_probe()), the teardown isn't
optional (udl_driver_unload -> udl_fbdev_cleanup ->
udl_fbdev_destroy).

Note that udl_fbdev_cleanup *tries* to be conditional (you can see it
does if (!udl->fbdev)) but that doesn't work, because udl->fbdev is
always set during udl_fbdev_init.

Suggested-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Emil Lundmark <lndmrk@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180528142711.142466-1-lndmrk@chromium.org
Signed-off-by: Sean Paul <seanpaul@chromium.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/udl/udl_fb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -574,9 +574,11 @@ static void udl_fbdev_destroy(struct drm
 		framebuffer_release(info);
 	}
 	drm_fb_helper_fini(&ufbdev->helper);
-	drm_framebuffer_unregister_private(&ufbdev->ufb.base);
-	drm_framebuffer_cleanup(&ufbdev->ufb.base);
-	drm_gem_object_unreference_unlocked(&ufbdev->ufb.obj->base);
+	if (ufbdev->ufb.obj) {
+		drm_framebuffer_unregister_private(&ufbdev->ufb.base);
+		drm_framebuffer_cleanup(&ufbdev->ufb.base);
+		drm_gem_object_unreference_unlocked(&ufbdev->ufb.obj->base);
+	}
 }
 
 int udl_fbdev_init(struct drm_device *dev)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 236/328] cifs: prevent integer overflow in nxt_dir_entry()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (312 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 142/328] mfd: sm501: Set coherent_dma_mask when creating subdevices Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 043/328] mtd: rawnand: mxc: remove __init qualifier from mxcnd_probe_dt Ben Hutchings
                   ` (13 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Dan Carpenter, Ronnie Sahlberg, Aurelien Aptel,
	Dr Silvio Cesare of InfoSect, Steve French

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 8ad8aa353524d89fa2e09522f3078166ff78ec42 upstream.

The "old_entry + le32_to_cpu(pDirInfo->NextEntryOffset)" can wrap
around so I have added a check for integer overflow.

Reported-by: Dr Silvio Cesare of InfoSect <silvio.cesare@gmail.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cifs/readdir.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -370,8 +370,15 @@ static char *nxt_dir_entry(char *old_ent
 
 		new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) +
 				pfData->FileNameLength;
-	} else
-		new_entry = old_entry + le32_to_cpu(pDirInfo->NextEntryOffset);
+	} else {
+		u32 next_offset = le32_to_cpu(pDirInfo->NextEntryOffset);
+
+		if (old_entry + next_offset < old_entry) {
+			cifs_dbg(VFS, "invalid offset %u\n", next_offset);
+			return NULL;
+		}
+		new_entry = old_entry + next_offset;
+	}
 	cifs_dbg(FYI, "new entry %p old entry %p\n", new_entry, old_entry);
 	/* validate that new_entry is not past end of SMB */
 	if (new_entry >= end_of_smb) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 243/328] ipv6: fix possible use-after-free in ip6_xmit()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (320 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 174/328] cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 189/328] ext4: fix online resizing for bigalloc file systems with a 1k block size Ben Hutchings
                   ` (5 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Eric Dumazet, David S. Miller, syzbot

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

commit bbd6528d28c1b8e80832b3b018ec402b6f5c3215 upstream.

In the unlikely case ip6_xmit() has to call skb_realloc_headroom(),
we need to call skb_set_owner_w() before consuming original skb,
otherwise we risk a use-after-free.

Bring IPv6 in line with what we do in IPv4 to fix this.

Fixes: 1da177e4c3f41 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -183,9 +183,10 @@ int ip6_xmit(struct sock *sk, struct sk_
 				kfree_skb(skb);
 				return -ENOBUFS;
 			}
+			if (skb->sk)
+				skb_set_owner_w(skb2, skb->sk);
 			consume_skb(skb);
 			skb = skb2;
-			skb_set_owner_w(skb, sk);
 		}
 		if (opt->opt_flen)
 			ipv6_push_frag_opts(skb, opt, &proto);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 229/328] drm/i915/bdw: Increase IPS disable timeout to 100ms
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (54 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 001/328] EDAC: Fix memleak in module init " Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 203/328] spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully Ben Hutchings
                   ` (271 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Rodrigo Vivi, Imre Deak, Ville Syrjälä, Diego Viola

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Imre Deak <imre.deak@intel.com>

commit 92a6803149465e2339f8f7f8f6415d75be80073d upstream.

During IPS disabling the current 42ms timeout value leads to occasional
timeouts, increase it to 100ms which seems to get rid of the problem.

References: https://bugs.freedesktop.org/show_bug.cgi?id=107494
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107562
Reported-by: Diego Viola <diego.viola@gmail.com>
Tested-by: Diego Viola <diego.viola@gmail.com>
Cc: Diego Viola <diego.viola@gmail.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180905100005.7663-1-imre.deak@intel.com
(cherry picked from commit acb3ef0ee40ea657280a4a11d9f60eb2937c0dca)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3794,8 +3794,12 @@ void hsw_disable_ips(struct intel_crtc *
 		mutex_lock(&dev_priv->rps.hw_lock);
 		WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0));
 		mutex_unlock(&dev_priv->rps.hw_lock);
-		/* wait for pcode to finish disabling IPS, which may take up to 42ms */
-		if (wait_for((I915_READ(IPS_CTL) & IPS_ENABLE) == 0, 42))
+		/*
+		 * Wait for PCODE to finish disabling IPS. The BSpec specified
+		 * 42ms timeout value leads to occasional timeouts so use 100ms
+		 * instead.
+		 */
+		if (wait_for((I915_READ(IPS_CTL) & IPS_ENABLE) == 0, 100))
 			DRM_ERROR("Timed out waiting for IPS disable\n");
 	} else {
 		I915_WRITE(IPS_CTL, 0);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 238/328] cifs: integer overflow in in SMB2_ioctl()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (106 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 311/328] x86/percpu: Fix this_cpu_read() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 288/328] perf/core: Fix perf_pmu_unregister() locking Ben Hutchings
                   ` (219 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Steve French, Dan Carpenter, Aurelien Aptel

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 2d204ee9d671327915260071c19350d84344e096 upstream.

The "le32_to_cpu(rsp->OutputOffset) + *plen" addition can overflow and
wrap around to a smaller value which looks like it would lead to an
information leak.

Fixes: 4a72dafa19ba ("SMB2 FSCTL and IOCTL worker function")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
[bwh: Backported to 3.16: Use get_rfc1002_length(rsp) instead of
 rsp->iov.iov_len]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cifs/smb2pdu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1394,14 +1394,14 @@ SMB2_ioctl(const unsigned int xid, struc
 	/* We check for obvious errors in the output buffer length and offset */
 	if (*plen == 0)
 		goto ioctl_exit; /* server returned no data */
-	else if (*plen > 0xFF00) {
+	else if (*plen > get_rfc1002_length(rsp) || *plen > 0xFF00) {
 		cifs_dbg(VFS, "srv returned invalid ioctl length: %d\n", *plen);
 		*plen = 0;
 		rc = -EIO;
 		goto ioctl_exit;
 	}
 
-	if (get_rfc1002_length(rsp) < le32_to_cpu(rsp->OutputOffset) + *plen) {
+	if (get_rfc1002_length(rsp) - *plen < le32_to_cpu(rsp->OutputOffset)) {
 		cifs_dbg(VFS, "Malformed ioctl resp: len %d offset %d\n", *plen,
 			le32_to_cpu(rsp->OutputOffset));
 		*plen = 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 175/328] ipmi: Move BT capabilities detection to the detect call
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (42 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 135/328] l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 202/328] spi: rspi: Fix invalid SPI use during system suspend Ben Hutchings
                   ` (283 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Corey Minyard, Andrew Banman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Corey Minyard <cminyard@mvista.com>

commit c86ba91be75702c013bbf7379542920b6920e98f upstream.

The capabilities detection was being done as part of the normal
state machine, but it was possible for it to be running while
the upper layers of the IPMI driver were initializing the
device, resulting in error and failure to initialize.

Move the capabilities detection to the the detect function,
so it's done before anything else runs on the device.  This also
simplifies the state machine and removes some code, as a bonus.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Reported-by: Andrew Banman <abanman@hpe.com>
Tested-by: Andrew Banman <abanman@hpe.com>
[bwh: Backported to 3.16:
 - struct si_sm_data doesn't include a dev pointer, so use pr_* functions
   for logging
 - Include <linux/sched.h> for schedule_timeout_uninterruptible()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/char/ipmi/ipmi_bt_sm.c
+++ b/drivers/char/ipmi/ipmi_bt_sm.c
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/ipmi_msgdefs.h>		/* for completion codes */
+#include <linux/sched.h>
 #include "ipmi_si_sm.h"
 
 #define BT_DEBUG_OFF	0	/* Used in production */
@@ -77,8 +78,6 @@ enum bt_states {
 	BT_STATE_RESET3,
 	BT_STATE_RESTART,
 	BT_STATE_PRINTME,
-	BT_STATE_CAPABILITIES_BEGIN,
-	BT_STATE_CAPABILITIES_END,
 	BT_STATE_LONG_BUSY	/* BT doesn't get hosed :-) */
 };
 
@@ -104,7 +103,6 @@ struct si_sm_data {
 	int		error_retries;	/* end of "common" fields */
 	int		nonzero_status;	/* hung BMCs stay all 0 */
 	enum bt_states	complete;	/* to divert the state machine */
-	int		BT_CAP_outreqs;
 	long		BT_CAP_req2rsp;
 	int		BT_CAP_retries;	/* Recommended retries */
 };
@@ -155,8 +153,6 @@ static char *state2txt(unsigned char sta
 	case BT_STATE_RESET3:		return("RESET3");
 	case BT_STATE_RESTART:		return("RESTART");
 	case BT_STATE_LONG_BUSY:	return("LONG_BUSY");
-	case BT_STATE_CAPABILITIES_BEGIN: return("CAP_BEGIN");
-	case BT_STATE_CAPABILITIES_END:	return("CAP_END");
 	}
 	return("BAD STATE");
 }
@@ -203,7 +199,6 @@ static unsigned int bt_init_data(struct
 	bt->complete = BT_STATE_IDLE;	/* end here */
 	bt->BT_CAP_req2rsp = BT_NORMAL_TIMEOUT * USEC_PER_SEC;
 	bt->BT_CAP_retries = BT_NORMAL_RETRY_LIMIT;
-	/* BT_CAP_outreqs == zero is a flag to read BT Capabilities */
 	return 3; /* We claim 3 bytes of space; ought to check SPMI table */
 }
 
@@ -469,7 +464,7 @@ static enum si_sm_result error_recovery(
 
 static enum si_sm_result bt_event(struct si_sm_data *bt, long time)
 {
-	unsigned char status, BT_CAP[8];
+	unsigned char status;
 	static enum bt_states last_printed = BT_STATE_PRINTME;
 	int i;
 
@@ -522,12 +517,6 @@ static enum si_sm_result bt_event(struct
 		if (status & BT_H_BUSY)		/* clear a leftover H_BUSY */
 			BT_CONTROL(BT_H_BUSY);
 
-		bt->timeout = bt->BT_CAP_req2rsp;
-
-		/* Read BT capabilities if it hasn't been done yet */
-		if (!bt->BT_CAP_outreqs)
-			BT_STATE_CHANGE(BT_STATE_CAPABILITIES_BEGIN,
-					SI_SM_CALL_WITHOUT_DELAY);
 		BT_SI_SM_RETURN(SI_SM_IDLE);
 
 	case BT_STATE_XACTION_START:
@@ -632,37 +621,6 @@ static enum si_sm_result bt_event(struct
 		BT_STATE_CHANGE(BT_STATE_XACTION_START,
 				SI_SM_CALL_WITH_DELAY);
 
-	/*
-	 * Get BT Capabilities, using timing of upper level state machine.
-	 * Set outreqs to prevent infinite loop on timeout.
-	 */
-	case BT_STATE_CAPABILITIES_BEGIN:
-		bt->BT_CAP_outreqs = 1;
-		{
-			unsigned char GetBT_CAP[] = { 0x18, 0x36 };
-			bt->state = BT_STATE_IDLE;
-			bt_start_transaction(bt, GetBT_CAP, sizeof(GetBT_CAP));
-		}
-		bt->complete = BT_STATE_CAPABILITIES_END;
-		BT_STATE_CHANGE(BT_STATE_XACTION_START,
-				SI_SM_CALL_WITH_DELAY);
-
-	case BT_STATE_CAPABILITIES_END:
-		i = bt_get_result(bt, BT_CAP, sizeof(BT_CAP));
-		bt_init_data(bt, bt->io);
-		if ((i == 8) && !BT_CAP[2]) {
-			bt->BT_CAP_outreqs = BT_CAP[3];
-			bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC;
-			bt->BT_CAP_retries = BT_CAP[7];
-		} else
-			printk(KERN_WARNING "IPMI BT: using default values\n");
-		if (!bt->BT_CAP_outreqs)
-			bt->BT_CAP_outreqs = 1;
-		printk(KERN_WARNING "IPMI BT: req2rsp=%ld secs retries=%d\n",
-			bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries);
-		bt->timeout = bt->BT_CAP_req2rsp;
-		return SI_SM_CALL_WITHOUT_DELAY;
-
 	default:	/* should never occur */
 		return error_recovery(bt,
 				      status,
@@ -673,6 +631,11 @@ static enum si_sm_result bt_event(struct
 
 static int bt_detect(struct si_sm_data *bt)
 {
+	unsigned char GetBT_CAP[] = { 0x18, 0x36 };
+	unsigned char BT_CAP[8];
+	enum si_sm_result smi_result;
+	int rv;
+
 	/*
 	 * It's impossible for the BT status and interrupt registers to be
 	 * all 1's, (assuming a properly functioning, self-initialized BMC)
@@ -683,6 +646,47 @@ static int bt_detect(struct si_sm_data *
 	if ((BT_STATUS == 0xFF) && (BT_INTMASK_R == 0xFF))
 		return 1;
 	reset_flags(bt);
+
+	/*
+	 * Try getting the BT capabilities here.
+	 */
+	rv = bt_start_transaction(bt, GetBT_CAP, sizeof(GetBT_CAP));
+	if (rv) {
+		pr_warn("BT: Can't start capabilities transaction: %d\n", rv);
+		goto out_no_bt_cap;
+	}
+
+	smi_result = SI_SM_CALL_WITHOUT_DELAY;
+	for (;;) {
+		if (smi_result == SI_SM_CALL_WITH_DELAY ||
+		    smi_result == SI_SM_CALL_WITH_TICK_DELAY) {
+			schedule_timeout_uninterruptible(1);
+			smi_result = bt_event(bt, jiffies_to_usecs(1));
+		} else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) {
+			smi_result = bt_event(bt, 0);
+		} else
+			break;
+	}
+
+	rv = bt_get_result(bt, BT_CAP, sizeof(BT_CAP));
+	bt_init_data(bt, bt->io);
+	if (rv < 8) {
+		pr_warn("BT: bt cap response too short: %d\n", rv);
+		goto out_no_bt_cap;
+	}
+
+	if (BT_CAP[2]) {
+		pr_warn("BT: Error fetching bt cap: %x\n", BT_CAP[2]);
+out_no_bt_cap:
+		pr_warn("BT: using default values\n");
+	} else {
+		bt->BT_CAP_req2rsp = BT_CAP[6] * USEC_PER_SEC;
+		bt->BT_CAP_retries = BT_CAP[7];
+	}
+
+	pr_info("BT: req2rsp=%ld secs retries=%d\n",
+		 bt->BT_CAP_req2rsp / USEC_PER_SEC, bt->BT_CAP_retries);
+
 	return 0;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 240/328] ext4: don't mark mmp buffer head dirty
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (281 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 218/328] batman-adv: Prevent duplicated softif_vlan entry Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 077/328] scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices Ben Hutchings
                   ` (44 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Li Dongyang, Theodore Ts'o, Andreas Dilger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Li Dongyang <dongyangli@ddn.com>

commit fe18d649891d813964d3aaeebad873f281627fbc upstream.

Marking mmp bh dirty before writing it will make writeback
pick up mmp block later and submit a write, we don't want the
duplicate write as kmmpd thread should have full control of
reading and writing the mmp block.
Another reason is we will also have random I/O error on
the writeback request when blk integrity is enabled, because
kmmpd could modify the content of the mmp block(e.g. setting
new seq and time) while the mmp block is under I/O requested
by writeback.

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/mmp.c | 1 -
 1 file changed, 1 deletion(-)

--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -48,7 +48,6 @@ static int write_mmp_block(struct super_
 	 */
 	sb_start_write(sb);
 	ext4_mmp_csum_set(sb, mmp);
-	mark_buffer_dirty(bh);
 	lock_buffer(bh);
 	bh->b_end_io = end_buffer_write_sync;
 	get_bh(bh);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 239/328] pstore: Fix incorrect persistent ram buffer mapping
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (219 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 280/328] tools: hv: fcopy: set 'error' in case an unknown operation was requested Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 049/328] MIPS: Change definition of cpu_relax() for Loongson-3 Ben Hutchings
                   ` (106 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Bin Yang, Kees Cook

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Bin Yang <bin.yang@intel.com>

commit 831b624df1b420c8f9281ed1307a8db23afb72df upstream.

persistent_ram_vmap() returns the page start vaddr.
persistent_ram_iomap() supports non-page-aligned mapping.

persistent_ram_buffer_map() always adds offset-in-page to the vaddr
returned from these two functions, which causes incorrect mapping of
non-page-aligned persistent ram buffer.

By default ftrace_size is 4096 and max_ftrace_cnt is nr_cpu_ids. Without
this patch, the zone_sz in ramoops_init_przs() is 4096/nr_cpu_ids which
might not be page aligned. If the offset-in-page > 2048, the vaddr will be
in next page. If the next page is not mapped, it will cause kernel panic:

[    0.074231] BUG: unable to handle kernel paging request at ffffa19e0081b000
...
[    0.075000] RIP: 0010:persistent_ram_new+0x1f8/0x39f
...
[    0.075000] Call Trace:
[    0.075000]  ramoops_init_przs.part.10.constprop.15+0x105/0x260
[    0.075000]  ramoops_probe+0x232/0x3a0
[    0.075000]  platform_drv_probe+0x3e/0xa0
[    0.075000]  driver_probe_device+0x2cd/0x400
[    0.075000]  __driver_attach+0xe4/0x110
[    0.075000]  ? driver_probe_device+0x400/0x400
[    0.075000]  bus_for_each_dev+0x70/0xa0
[    0.075000]  driver_attach+0x1e/0x20
[    0.075000]  bus_add_driver+0x159/0x230
[    0.075000]  ? do_early_param+0x95/0x95
[    0.075000]  driver_register+0x70/0xc0
[    0.075000]  ? init_pstore_fs+0x4d/0x4d
[    0.075000]  __platform_driver_register+0x36/0x40
[    0.075000]  ramoops_init+0x12f/0x131
[    0.075000]  do_one_initcall+0x4d/0x12c
[    0.075000]  ? do_early_param+0x95/0x95
[    0.075000]  kernel_init_freeable+0x19b/0x222
[    0.075000]  ? rest_init+0xbb/0xbb
[    0.075000]  kernel_init+0xe/0xfc
[    0.075000]  ret_from_fork+0x3a/0x50

Signed-off-by: Bin Yang <bin.yang@intel.com>
[kees: add comments describing the mapping differences, updated commit log]
Fixes: 24c3d2f342ed ("staging: android: persistent_ram: Make it possible to use memory outside of bootmem")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/pstore/ram_core.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -376,7 +376,12 @@ static void *persistent_ram_vmap(phys_ad
 	vaddr = vmap(pages, page_count, VM_MAP, prot);
 	kfree(pages);
 
-	return vaddr;
+	/*
+	 * Since vmap() uses page granularity, we must add the offset
+	 * into the page here, to get the byte granularity address
+	 * into the mapping to represent the actual "start" location.
+	 */
+	return vaddr + offset_in_page(start);
 }
 
 static void *persistent_ram_iomap(phys_addr_t start, size_t size,
@@ -395,6 +400,11 @@ static void *persistent_ram_iomap(phys_a
 	else
 		va = ioremap_wc(start, size);
 
+	/*
+	 * Since request_mem_region() and ioremap() are byte-granularity
+	 * there is no need handle anything special like we do when the
+	 * vmap() case in persistent_ram_vmap() above.
+	 */
 	return va;
 }
 
@@ -415,7 +425,7 @@ static int persistent_ram_buffer_map(phy
 		return -ENOMEM;
 	}
 
-	prz->buffer = prz->vaddr + offset_in_page(start);
+	prz->buffer = prz->vaddr;
 	prz->buffer_size = size - sizeof(struct persistent_ram_buffer);
 
 	return 0;
@@ -461,7 +471,8 @@ void persistent_ram_free(struct persiste
 
 	if (prz->vaddr) {
 		if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
-			vunmap(prz->vaddr);
+			/* We must vunmap() at page-granularity. */
+			vunmap(prz->vaddr - offset_in_page(prz->paddr));
 		} else {
 			iounmap(prz->vaddr);
 			release_mem_region(prz->paddr, prz->size);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 228/328] ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (227 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 070/328] ALSA: cs5535audio: Fix invalid endian conversion Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 024/328] staging: rts5208: fix missing error check on call to rtsx_write_register Ben Hutchings
                   ` (98 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Jann Horn, Takashi Iwai, Willy Tarreau

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Willy Tarreau <w@1wt.eu>

commit 49434c6c575d2008c0abbc93e615019f39e01252 upstream.

snd_emu10k1_fx8010_ioctl(SNDRV_EMU10K1_IOCTL_INFO) allocates
memory using kmalloc() and partially fills it by calling
snd_emu10k1_fx8010_info() before returning the resulting
structure to userspace, leaving uninitialized holes. Let's
just use kzalloc() here.

BugLink: http://blog.infosectcbr.com.au/2018/09/linux-kernel-infoleaks.html
Signed-off-by: Willy Tarreau <w@1wt.eu>
Cc: Jann Horn <jannh@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/pci/emu10k1/emufx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -2521,7 +2521,7 @@ static int snd_emu10k1_fx8010_ioctl(stru
 		emu->support_tlv = 1;
 		return put_user(SNDRV_EMU10K1_VERSION, (int __user *)argp);
 	case SNDRV_EMU10K1_IOCTL_INFO:
-		info = kmalloc(sizeof(*info), GFP_KERNEL);
+		info = kzalloc(sizeof(*info), GFP_KERNEL);
 		if (!info)
 			return -ENOMEM;
 		snd_emu10k1_fx8010_info(emu, info);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 237/328] CIFS: fix wrapping bugs in num_entries()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (211 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 277/328] smsc95xx: Check for Wake-on-LAN modes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 067/328] ALSA: vx: Fix possible transfer overflow Ben Hutchings
                   ` (114 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Steve French, Pavel Shilovsky, Aurelien Aptel, Dan Carpenter

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 56446f218af1133c802dad8e9e116f07f381846c upstream.

The problem is that "entryptr + next_offset" and "entryptr + len + size"
can wrap.  I ended up changing the type of "entryptr" because it makes
the math easier when we don't have to do so much casting.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cifs/smb2pdu.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2148,33 +2148,38 @@ num_entries(char *bufstart, char *end_of
 	int len;
 	unsigned int entrycount = 0;
 	unsigned int next_offset = 0;
-	FILE_DIRECTORY_INFO *entryptr;
+	char *entryptr;
+	FILE_DIRECTORY_INFO *dir_info;
 
 	if (bufstart == NULL)
 		return 0;
 
-	entryptr = (FILE_DIRECTORY_INFO *)bufstart;
+	entryptr = bufstart;
 
 	while (1) {
-		entryptr = (FILE_DIRECTORY_INFO *)
-					((char *)entryptr + next_offset);
-
-		if ((char *)entryptr + size > end_of_buf) {
+		if (entryptr + next_offset < entryptr ||
+		    entryptr + next_offset > end_of_buf ||
+		    entryptr + next_offset + size > end_of_buf) {
 			cifs_dbg(VFS, "malformed search entry would overflow\n");
 			break;
 		}
 
-		len = le32_to_cpu(entryptr->FileNameLength);
-		if ((char *)entryptr + len + size > end_of_buf) {
+		entryptr = entryptr + next_offset;
+		dir_info = (FILE_DIRECTORY_INFO *)entryptr;
+
+		len = le32_to_cpu(dir_info->FileNameLength);
+		if (entryptr + len < entryptr ||
+		    entryptr + len > end_of_buf ||
+		    entryptr + len + size > end_of_buf) {
 			cifs_dbg(VFS, "directory entry name would overflow frame end of buf %p\n",
 				 end_of_buf);
 			break;
 		}
 
-		*lastentry = (char *)entryptr;
+		*lastentry = entryptr;
 		entrycount++;
 
-		next_offset = le32_to_cpu(entryptr->NextEntryOffset);
+		next_offset = le32_to_cpu(dir_info->NextEntryOffset);
 		if (!next_offset)
 			break;
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 232/328] x86/boot: Move EISA setup to a separate file
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (200 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 026/328] power: generic-adc-battery: check for duplicate properties copied from iio channels Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 270/328] PCI: Reprogram bridge prefetch registers on resume Ben Hutchings
                   ` (125 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Thomas Gleixner, Steven Rostedt, Andy Lutomirski,
	Linus Torvalds, Ingo Molnar, Borislav Petkov, Peter Zijlstra

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit f7eaf6e00fd581043bb540dfe865f1d81769b189 upstream.

EISA has absolutely nothing to do with traps, so move it out of traps.c
into its own eisa.c file.

Furthermore, the EISA bus detection does not need to run during
very early boot, it's good enough to run it before the EISA bus
and drivers are initialized.

I.e. instead of calling it from the very early trap_init() code,
make it a subsys_initcall().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170828064956.515322409@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/kernel/Makefile |  1 +
 arch/x86/kernel/eisa.c   | 18 ++++++++++++++++++
 arch/x86/kernel/traps.c  | 13 -------------
 3 files changed, 19 insertions(+), 13 deletions(-)
 create mode 100644 arch/x86/kernel/eisa.c

--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -92,6 +92,7 @@ obj-$(CONFIG_PARAVIRT)		+= paravirt.o pa
 obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= paravirt-spinlocks.o
 obj-$(CONFIG_PARAVIRT_CLOCK)	+= pvclock.o
 
+obj-$(CONFIG_EISA)		+= eisa.o
 obj-$(CONFIG_PCSPKR_PLATFORM)	+= pcspeaker.o
 
 obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
--- /dev/null
+++ b/arch/x86/kernel/eisa.c
@@ -0,0 +1,18 @@
+/*
+ * EISA specific code
+ *
+ * This file is licensed under the GPL V2
+ */
+#include <linux/ioport.h>
+#include <linux/eisa.h>
+
+static __init int eisa_bus_probe(void)
+{
+	void __iomem *p = ioremap(0x0FFFD9, 4);
+
+	if (readl(p) == 'E' + ('I'<<8) + ('S'<<16) + ('A'<<24))
+		EISA_bus = 1;
+	iounmap(p);
+	return 0;
+}
+subsys_initcall(eisa_bus_probe);
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -37,11 +37,6 @@
 #include <linux/smp.h>
 #include <linux/io.h>
 
-#ifdef CONFIG_EISA
-#include <linux/ioport.h>
-#include <linux/eisa.h>
-#endif
-
 #if defined(CONFIG_EDAC)
 #include <linux/edac.h>
 #endif
@@ -796,14 +791,6 @@ void __init trap_init(void)
 {
 	int i;
 
-#ifdef CONFIG_EISA
-	void __iomem *p = early_ioremap(0x0FFFD9, 4);
-
-	if (readl(p) == 'E' + ('I'<<8) + ('S'<<16) + ('A'<<24))
-		EISA_bus = 1;
-	early_iounmap(p, 4);
-#endif
-
 	set_intr_gate(X86_TRAP_DE, divide_error);
 	set_intr_gate_ist(X86_TRAP_NMI, &nmi, NMI_STACK);
 	/* int4 can be called from all */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 231/328] platform/x86: alienware-wmi: Correct a memory leak
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (316 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 160/328] cifs: check kmalloc before use Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 305/328] usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control() Ben Hutchings
                   ` (9 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Mario Limonciello, Darren Hart (VMware)

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mario Limonciello <mario.limonciello@dell.com>

commit ff0e9f26288d2daee4950f42b37a3d3d30d36ec1 upstream.

An ACPI buffer that was allocated was not being freed after use.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/platform/x86/alienware-wmi.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -447,6 +447,7 @@ static acpi_status alienware_hdmi_comman
 		if (obj && obj->type == ACPI_TYPE_INTEGER)
 			*out_data = (u32) obj->integer.value;
 	}
+	kfree(output.pointer);
 	return status;
 
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 172/328] USB: net2280: Fix erroneous synchronization change
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (164 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 016/328] crypto: memzero_explicit - make sure to clear out sensitive data Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 309/328] net: make skb_partial_csum_set() more robust against overflows Ben Hutchings
                   ` (161 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Felipe Balbi, Alan Stern, D. Ziesche

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit dec3c23c9aa1815f07d98ae0375b4cbc10971e13 upstream.

Commit f16443a034c7 ("USB: gadgetfs, dummy-hcd, net2280: fix locking
for callbacks") was based on a serious misunderstanding.  It
introduced regressions into both the dummy-hcd and net2280 drivers.

The problem in dummy-hcd was fixed by commit 7dbd8f4cabd9 ("USB:
dummy-hcd: Fix erroneous synchronization change"), but the problem in
net2280 remains.  Namely: the ->disconnect(), ->suspend(), ->resume(),
and ->reset() callbacks must be invoked without the private lock held;
otherwise a deadlock will occur when the callback routine tries to
interact with the UDC driver.

This patch largely is a reversion of the relevant parts of
f16443a034c7.  It also drops the private lock around the calls to
->suspend() and ->resume() (something the earlier patch forgot to do).
This is safe from races with device interrupts because it occurs
within the interrupt handler.

Finally, the patch changes where the ->disconnect() callback is
invoked when net2280_pullup() turns the pullup off.  Rather than
making the callback from within stop_activity() at a time when dropping
the private lock could be unsafe, the callback is moved to a point
after the lock has already been dropped.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: f16443a034c7 ("USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks")
Reported-by: D. Ziesche <dziesche@zes.com>
Tested-by: D. Ziesche <dziesche@zes.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
[bwh: Backported to 3.16:
 - Drop inapplicable change to disconnection handling in handle_stat1_irqs()
 - Adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -1399,11 +1399,14 @@ static int net2280_pullup(struct usb_gad
 		writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
 	} else {
 		writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
-		stop_activity(dev, dev->driver);
+		stop_activity(dev, NULL);
 	}
 
 	spin_unlock_irqrestore (&dev->lock, flags);
 
+	if (!is_on && dev->driver)
+		dev->driver->disconnect(&dev->gadget);
+
 	return 0;
 }
 
@@ -1948,8 +1951,11 @@ stop_activity (struct net2280 *dev, stru
 		nuke (&dev->ep [i]);
 
 	/* report disconnect; the driver is already quiesced */
-	if (driver)
+	if (driver) {
+		spin_unlock(&dev->lock);
 		driver->disconnect(&dev->gadget);
+		spin_lock(&dev->lock);
+	}
 
 	usb_reinit (dev);
 }
@@ -2452,6 +2458,8 @@ next_endpoints:
 		| (1 << PCI_RETRY_ABORT_INTERRUPT))
 
 static void handle_stat1_irqs (struct net2280 *dev, u32 stat)
+__releases(dev->lock)
+__acquires(dev->lock)
 {
 	struct net2280_ep	*ep;
 	u32			tmp, num, mask, scratch;
@@ -2494,6 +2502,7 @@ static void handle_stat1_irqs (struct ne
 	tmp = (1 << SUSPEND_REQUEST_CHANGE_INTERRUPT);
 	if (stat & tmp) {
 		writel (tmp, &dev->regs->irqstat1);
+		spin_unlock(&dev->lock);
 		if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) {
 			if (dev->driver->suspend)
 				dev->driver->suspend (&dev->gadget);
@@ -2504,6 +2513,7 @@ static void handle_stat1_irqs (struct ne
 				dev->driver->resume (&dev->gadget);
 			/* at high speed, note erratum 0133 */
 		}
+		spin_lock(&dev->lock);
 		stat &= ~tmp;
 	}
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 161/328] net: macb: do not disable MDIO bus at open/close time
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (192 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 283/328] arm64: KVM: Tighten guest core register access from userspace Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 035/328] drm/panel: type promotion bug in s6e8aa0_read_mtp_id() Ben Hutchings
                   ` (133 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Claudiu Beznea, Anssi Hannula, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Anssi Hannula <anssi.hannula@bitwise.fi>

commit 0da70f808029476001109b6cb076737bc04cea2e upstream.

macb_reset_hw() is called from macb_close() and indirectly from
macb_open(). macb_reset_hw() zeroes the NCR register, including the MPE
(Management Port Enable) bit.

This will prevent accessing any other PHYs for other Ethernet MACs on
the MDIO bus, which remains registered at macb_reset_hw() time, until
macb_init_hw() is called from macb_open() which sets the MPE bit again.

I.e. currently the MDIO bus has a short disruption at open time and is
disabled at close time until the interface is opened again.

Fix that by only touching the RE and TE bits when enabling and disabling
RX/TX.

v2: Make macb_init_hw() NCR write a single statement.

Fixes: 6c36a7074436 ("macb: Use generic PHY layer")
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -1257,14 +1257,18 @@ static void macb_init_rings(struct macb
 
 static void macb_reset_hw(struct macb *bp)
 {
+	u32 ctrl = macb_readl(bp, NCR);
+
 	/*
 	 * Disable RX and TX (XXX: Should we halt the transmission
 	 * more gracefully?)
 	 */
-	macb_writel(bp, NCR, 0);
+	ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE));
 
 	/* Clear the stats registers (XXX: Update stats first?) */
-	macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
+	ctrl |= MACB_BIT(CLRSTAT);
+
+	macb_writel(bp, NCR, ctrl);
 
 	/* Clear all status flags */
 	macb_writel(bp, TSR, -1);
@@ -1400,7 +1404,7 @@ static void macb_init_hw(struct macb *bp
 	macb_writel(bp, TBQP, bp->tx_ring_dma);
 
 	/* Enable TX and RX */
-	macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE));
+	macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
 
 	/* Enable interrupts */
 	macb_writel(bp, IER, (MACB_RX_INT_FLAGS


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 162/328] hwmon: (nct6775) Fix potential Spectre v1
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (108 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 288/328] perf/core: Fix perf_pmu_unregister() locking Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 150/328] x86/process: Re-export start_thread() Ben Hutchings
                   ` (217 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Gustavo A. R. Silva, Guenter Roeck

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>

commit d49dbfade96d5b0863ca8a90122a805edd5ef50a upstream.

val can be indirectly controlled by user-space, hence leading to
a potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

vers/hwmon/nct6775.c:2698 store_pwm_weight_temp_sel() warn: potential
spectre issue 'data->temp_src' [r]

Fix this by sanitizing val before using it to index data->temp_src

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/hwmon/nct6775.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -57,6 +57,7 @@
 #include <linux/mutex.h>
 #include <linux/acpi.h>
 #include <linux/io.h>
+#include <linux/nospec.h>
 #include "lm75.h"
 
 #define USE_ALTERNATE
@@ -2438,6 +2439,7 @@ store_pwm_weight_temp_sel(struct device
 		return err;
 	if (val > NUM_TEMP)
 		return -EINVAL;
+	val = array_index_nospec(val, NUM_TEMP + 1);
 	if (val && (!(data->have_temp & (1 << (val - 1))) ||
 		    !data->temp_src[val - 1]))
 		return -EINVAL;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 173/328] ipv6: fix cleanup ordering for pingv6 registration
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (181 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 192/328] RDMA/cxgb4: Only call CQ completion handler if it is armed Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 042/328] ARM: hisi: handle of_iomap and fix missing of_node_put Ben Hutchings
                   ` (144 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Sabrina Dubroca

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sabrina Dubroca <sd@queasysnail.net>

commit a03dc36bdca6b614651fedfcd8559cf914d2d21d upstream.

Commit 6d0bfe226116 ("net: ipv6: Add IPv6 support to the ping socket.")
contains an error in the cleanup path of inet6_init(): when
proto_register(&pingv6_prot, 1) fails, we try to unregister
&pingv6_prot. When rawv6_init() fails, we skip unregistering
&pingv6_prot.

Example of panic (triggered by faking a failure of
 proto_register(&pingv6_prot, 1)):

    general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
    [...]
    RIP: 0010:__list_del_entry_valid+0x79/0x160
    [...]
    Call Trace:
     proto_unregister+0xbb/0x550
     ? trace_preempt_on+0x6f0/0x6f0
     ? sock_no_shutdown+0x10/0x10
     inet6_init+0x153/0x1b8

Fixes: 6d0bfe226116 ("net: ipv6: Add IPv6 support to the ping socket.")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ipv6/af_inet6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -860,14 +860,14 @@ static int __init inet6_init(void)
 
 	err = proto_register(&pingv6_prot, 1);
 	if (err)
-		goto out_unregister_ping_proto;
+		goto out_unregister_raw_proto;
 
 	/* We MUST register RAW sockets before we create the ICMP6,
 	 * IGMP6, or NDISC control sockets.
 	 */
 	err = rawv6_init();
 	if (err)
-		goto out_unregister_raw_proto;
+		goto out_unregister_ping_proto;
 
 	/* Register the family here so that the init calls below will
 	 * be able to create sockets. (?? is this dangerous ??)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 171/328] usb: gadget: net2280: fix pullup handling
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (299 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 101/328] pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 295/328] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression Ben Hutchings
                   ` (26 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Felipe Balbi, Mian Yousaf Kaukab, Ricardo Ribalda Delgado

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>

commit 11bece5e063ca567e631c6ea3b1611c10dbc3282 upstream.

Gadget must be informed about disconnection when pullup is removed.

Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -139,6 +139,10 @@ static char *type_string (u8 bmAttribute
 #define valid_bit	cpu_to_le32 (1 << VALID_BIT)
 #define dma_done_ie	cpu_to_le32 (1 << DMA_DONE_INTERRUPT_ENABLE)
 
+static void stop_activity(struct net2280 *dev,
+					struct usb_gadget_driver *driver);
+static void ep0_start(struct net2280 *dev);
+
 /*-------------------------------------------------------------------------*/
 
 static int
@@ -1390,11 +1394,14 @@ static int net2280_pullup(struct usb_gad
 	spin_lock_irqsave (&dev->lock, flags);
 	tmp = readl (&dev->usb->usbctl);
 	dev->softconnect = (is_on != 0);
-	if (is_on)
-		tmp |= (1 << USB_DETECT_ENABLE);
-	else
-		tmp &= ~(1 << USB_DETECT_ENABLE);
-	writel (tmp, &dev->usb->usbctl);
+	if (is_on) {
+		ep0_start(dev);
+		writel(tmp | BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
+	} else {
+		writel(tmp & ~BIT(USB_DETECT_ENABLE), &dev->usb->usbctl);
+		stop_activity(dev, dev->driver);
+	}
+
 	spin_unlock_irqrestore (&dev->lock, flags);
 
 	return 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 174/328] cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (319 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 269/328] bcache: add separate workqueue for journal_write to avoid deadlock Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 243/328] ipv6: fix possible use-after-free in ip6_xmit() Ben Hutchings
                   ` (6 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Johannes Berg, Arunk Khandavalli, Jouni Malinen

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Arunk Khandavalli <akhandav@codeaurora.org>

commit 4f0223bfe9c3e62d8f45a85f1ef1b18a8a263ef9 upstream.

nl80211_update_ft_ies() tried to validate NL80211_ATTR_IE with
is_valid_ie_attr() before dereferencing it, but that helper function
returns true in case of NULL pointer (i.e., attribute not included).
This can result to dereferencing a NULL pointer. Fix that by explicitly
checking that NL80211_ATTR_IE is included.

Fixes: 355199e02b83 ("cfg80211: Extend support for IEEE 802.11r Fast BSS Transition")
Signed-off-by: Arunk Khandavalli <akhandav@codeaurora.org>
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/wireless/nl80211.c | 1 +
 1 file changed, 1 insertion(+)

--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9185,6 +9185,7 @@ static int nl80211_update_ft_ies(struct
 		return -EOPNOTSUPP;
 
 	if (!info->attrs[NL80211_ATTR_MDID] ||
+	    !info->attrs[NL80211_ATTR_IE] ||
 	    !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]))
 		return -EINVAL;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 170/328] usb: gadget: udc: net2280: do not rely on 'driver' argument
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (71 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 246/328] tty: vt_ioctl: fix potential Spectre v1 Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 154/328] fs/quota: Fix spectre gadget in do_quotactl Ben Hutchings
                   ` (254 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Felipe Balbi

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Felipe Balbi <balbi@ti.com>

commit bfd0ed576dbf9cc71af7dbe42841fc9246524961 upstream.

future patches will remove the extra 'driver'
argument to ->udc_stop(), in order to do that,
we must make sure that our UDC does not rely
on it first.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[bwh: Backported to 3.16: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/gadget/net2280.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -1956,11 +1956,9 @@ static int net2280_stop(struct usb_gadge
 	dev = container_of (_gadget, struct net2280, gadget);
 
 	spin_lock_irqsave (&dev->lock, flags);
-	stop_activity (dev, driver);
+	stop_activity(dev, NULL);
 	spin_unlock_irqrestore (&dev->lock, flags);
 
-	dev->driver = NULL;
-
 	net2280_led_active (dev, 0);
 
 	/* Disable full-speed test mode */
@@ -1970,7 +1968,8 @@ static int net2280_stop(struct usb_gadge
 	device_remove_file (&dev->pdev->dev, &dev_attr_queues);
 
 	DEBUG(dev, "unregistered driver '%s'\n",
-			driver ? driver->driver.name : "");
+	      dev->driver ? dev->driver->driver.name : "");
+	dev->driver = NULL;
 
 	return 0;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 158/328] mm: move tlb_table_flush to tlb_flush_mmu_free
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (61 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 316/328] ptp: fix Spectre v1 vulnerability Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 058/328] udlfb: fix semaphore value leak Ben Hutchings
                   ` (264 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Peter Zijlstra, Nicholas Piggin, Linus Torvalds, Will Deacon

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Piggin <npiggin@gmail.com>

commit db7ddef301128dad394f1c0f77027f86ee9a4edb upstream.

There is no need to call this from tlb_flush_mmu_tlbonly, it logically
belongs with tlb_flush_mmu_free.  This makes future fixes simpler.

[ This was originally done to allow code consolidation for the
  mmu_notifier fix, but it also ends up helping simplify the
  HAVE_RCU_TABLE_INVALIDATE fix.    - Linus ]

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 mm/memory.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -236,15 +236,15 @@ static void tlb_flush_mmu_tlbonly(struct
 {
 	tlb->need_flush = 0;
 	tlb_flush(tlb);
-#ifdef CONFIG_HAVE_RCU_TABLE_FREE
-	tlb_table_flush(tlb);
-#endif
 }
 
 static void tlb_flush_mmu_free(struct mmu_gather *tlb)
 {
 	struct mmu_gather_batch *batch;
 
+#ifdef CONFIG_HAVE_RCU_TABLE_FREE
+	tlb_table_flush(tlb);
+#endif
 	for (batch = &tlb->local; batch; batch = batch->next) {
 		free_pages_and_swap_cache(batch->pages, batch->nr);
 		batch->nr = 0;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 159/328] mm/tlb: Remove tlb_remove_table() non-concurrent condition
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (245 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 124/328] powerpc/fadump: handle crash memory ranges array index overflow Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 312/328] USB: fix the usbfs flag sanitization for control transfers Ben Hutchings
                   ` (80 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Nicholas Piggin, David Miller, Peter Zijlstra,
	Rik van Riel, Michael Ellerman, Will Deacon, Martin Schwidefsky,
	Linus Torvalds

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Peter Zijlstra <peterz@infradead.org>

commit a6f572084fbee8b30f91465f4a085d7a90901c57 upstream.

Will noted that only checking mm_users is incorrect; we should also
check mm_count in order to cover CPUs that have a lazy reference to
this mm (and could do speculative TLB operations).

If removing this turns out to be a performance issue, we can
re-instate a more complete check, but in tlb_table_flush() eliding the
call_rcu_sched().

Fixes: 267239116987 ("mm, powerpc: move the RCU page-table freeing into generic code")
Reported-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Rik van Riel <riel@surriel.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 mm/memory.c | 9 ---------
 1 file changed, 9 deletions(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -359,15 +359,6 @@ void tlb_remove_table(struct mmu_gather
 
 	tlb->need_flush = 1;
 
-	/*
-	 * When there's less then two users of this mm there cannot be a
-	 * concurrent page-table walk.
-	 */
-	if (atomic_read(&tlb->mm->mm_users) < 2) {
-		__tlb_remove_table(table);
-		return;
-	}
-
 	if (*batch == NULL) {
 		*batch = (struct mmu_table_batch *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
 		if (*batch == NULL) {


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 169/328] ext4: avoid divide by zero fault when deleting corrupted inline directories
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (39 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 113/328] ASoC: wm8994: Fix missing break in switch Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 306/328] dm cache: destroy migration_cache if cache target registration failed Ben Hutchings
                   ` (286 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Wen Xu, Theodore Ts'o

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit 4d982e25d0bdc83d8c64e66fdeca0b89240b3b85 upstream.

A specially crafted file system can trick empty_inline_dir() into
reading past the last valid entry in a inline directory, and then run
into the end of xattr marker. This will trigger a divide by zero
fault.  Fix this by using the size of the inline directory instead of
dir->i_size.

Also clean up error reporting in __ext4_check_dir_entry so that the
message is clearer and more understandable --- and avoids the division
by zero trap if the size passed in is zero.  (I'm not sure why we
coded it that way in the first place; printing offset % size is
actually more confusing and less useful.)

https://bugzilla.kernel.org/show_bug.cgi?id=200933

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Wen Xu <wen.xu@gatech.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/dir.c    | 20 +++++++++-----------
 fs/ext4/inline.c |  4 +++-
 2 files changed, 12 insertions(+), 12 deletions(-)

--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -77,7 +77,7 @@ int __ext4_check_dir_entry(const char *f
 	else if (unlikely(rlen < EXT4_DIR_REC_LEN(de->name_len)))
 		error_msg = "rec_len is too small for name_len";
 	else if (unlikely(((char *) de - buf) + rlen > size))
-		error_msg = "directory entry across range";
+		error_msg = "directory entry overrun";
 	else if (unlikely(le32_to_cpu(de->inode) >
 			le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count)))
 		error_msg = "inode out of bounds";
@@ -86,18 +86,16 @@ int __ext4_check_dir_entry(const char *f
 
 	if (filp)
 		ext4_error_file(filp, function, line, bh->b_blocknr,
-				"bad entry in directory: %s - offset=%u(%u), "
-				"inode=%u, rec_len=%d, name_len=%d",
-				error_msg, (unsigned) (offset % size),
-				offset, le32_to_cpu(de->inode),
-				rlen, de->name_len);
+				"bad entry in directory: %s - offset=%u, "
+				"inode=%u, rec_len=%d, name_len=%d, size=%d",
+				error_msg, offset, le32_to_cpu(de->inode),
+				rlen, de->name_len, size);
 	else
 		ext4_error_inode(dir, function, line, bh->b_blocknr,
-				"bad entry in directory: %s - offset=%u(%u), "
-				"inode=%u, rec_len=%d, name_len=%d",
-				error_msg, (unsigned) (offset % size),
-				offset, le32_to_cpu(de->inode),
-				rlen, de->name_len);
+				"bad entry in directory: %s - offset=%u, "
+				"inode=%u, rec_len=%d, name_len=%d, size=%d",
+				 error_msg, offset, le32_to_cpu(de->inode),
+				 rlen, de->name_len, size);
 
 	return 1;
 }
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1741,6 +1741,7 @@ int empty_inline_dir(struct inode *dir,
 {
 	int err, inline_size;
 	struct ext4_iloc iloc;
+	size_t inline_len;
 	void *inline_pos;
 	unsigned int offset;
 	struct ext4_dir_entry_2 *de;
@@ -1768,8 +1769,9 @@ int empty_inline_dir(struct inode *dir,
 		goto out;
 	}
 
+	inline_len = ext4_get_inline_size(dir);
 	offset = EXT4_INLINE_DOTDOT_SIZE;
-	while (offset < dir->i_size) {
+	while (offset < inline_len) {
 		de = ext4_get_inline_entry(dir, &iloc, offset,
 					   &inline_pos, &inline_size);
 		if (ext4_check_dir_entry(dir, NULL, de,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 160/328] cifs: check kmalloc before use
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (315 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 095/328] uio: potential double frees if __uio_register_device() fails Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 231/328] platform/x86: alienware-wmi: Correct a memory leak Ben Hutchings
                   ` (10 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Nicholas Mc Guire, Pavel Shilovsky, Steve French

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Mc Guire <hofrat@osadl.org>

commit 126c97f4d0d1b5b956e8b0740c81a2b2a2ae548c upstream.

The kmalloc was not being checked - if it fails issue a warning
and return -ENOMEM to the caller.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: b8da344b74c8 ("cifs: dynamic allocation of ntlmssp blob")
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/cifs/sess.c | 6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -398,6 +398,12 @@ int build_ntlmssp_auth_blob(unsigned cha
 		goto setup_ntlmv2_ret;
 	}
 	*pbuffer = kmalloc(size_of_ntlmssp_blob(ses), GFP_KERNEL);
+	if (!*pbuffer) {
+		rc = -ENOMEM;
+		cifs_dbg(VFS, "Error %d during NTLMSSP allocation\n", rc);
+		*buflen = 0;
+		goto setup_ntlmv2_ret;
+	}
 	sec_blob = (AUTHENTICATE_MESSAGE *)*pbuffer;
 
 	memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 176/328] x86/microcode/intel: Add a helper which gives the microcode revision
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (171 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 328/328] cdrom: fix improper type cast, which can leat to information leak Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 216/328] x86/process: Don't mix user/kernel regs in 64bit __show_regs() Ben Hutchings
                   ` (154 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Borislav Petkov, Thomas Gleixner

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Borislav Petkov <bp@suse.de>

commit 4167709bbf826512a52ebd6aafda2be104adaec9 upstream.

Since on Intel we're required to do CPUID(1) first, before reading
the microcode revision MSR, let's add a special helper which does the
required steps so that we don't forget to do them next time, when we
want to read the microcode revision.

Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/20170109114147.5082-4-bp@alien8.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[bwh: Backported to 3.16:
 - Don't touch prev_rev variable in apply_microcode()
 - Keep using sync_core(), which will alway includes the necessary CPUID
 - Adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/arch/x86/include/asm/microcode_intel.h
+++ b/arch/x86/include/asm/microcode_intel.h
@@ -63,6 +63,21 @@ extern int get_matching_sig(unsigned int
 extern int
 update_match_revision(struct microcode_header_intel *mc_header, int rev);
 
+static inline u32 intel_get_microcode_revision(void)
+{
+	u32 rev, dummy;
+
+	native_wrmsrl(MSR_IA32_UCODE_REV, 0);
+
+	/* As documented in the SDM: Do a CPUID 1 here */
+	sync_core();
+
+	/* get the current revision from MSR 0x8B */
+	native_rdmsr(MSR_IA32_UCODE_REV, dummy, rev);
+
+	return rev;
+}
+
 #ifdef CONFIG_MICROCODE_INTEL_EARLY
 extern void __init load_ucode_intel_bsp(void);
 extern void load_ucode_intel_ap(void);
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -14,6 +14,7 @@
 #include <asm/bugs.h>
 #include <asm/cpu.h>
 #include <asm/intel-family.h>
+#include <asm/microcode_intel.h>
 
 #ifdef CONFIG_X86_64
 #include <linux/topology.h>
@@ -103,14 +104,8 @@ static void early_init_intel(struct cpui
 		(c->x86 == 0x6 && c->x86_model >= 0x0e))
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 
-	if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64)) {
-		unsigned lower_word;
-
-		wrmsr(MSR_IA32_UCODE_REV, 0, 0);
-		/* Required by the SDM */
-		sync_core();
-		rdmsr(MSR_IA32_UCODE_REV, lower_word, c->microcode);
-	}
+	if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64))
+		c->microcode = intel_get_microcode_revision();
 
 	/* Now if any of them are set, check the blacklist and clear the lot */
 	if ((cpu_has(c, X86_FEATURE_SPEC_CTRL) ||
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -134,9 +134,9 @@ int apply_microcode(int cpu)
 {
 	struct microcode_intel *mc_intel;
 	struct ucode_cpu_info *uci;
-	unsigned int val[2];
 	int cpu_num = raw_smp_processor_id();
 	struct cpuinfo_x86 *c = &cpu_data(cpu_num);
+	u32 rev;
 
 	uci = ucode_cpu_info + cpu;
 	mc_intel = uci->mc;
@@ -159,27 +159,22 @@ int apply_microcode(int cpu)
 	wrmsr(MSR_IA32_UCODE_WRITE,
 	      (unsigned long) mc_intel->bits,
 	      (unsigned long) mc_intel->bits >> 16 >> 16);
-	wrmsr(MSR_IA32_UCODE_REV, 0, 0);
 
-	/* As documented in the SDM: Do a CPUID 1 here */
-	sync_core();
+	rev = intel_get_microcode_revision();
 
-	/* get the current revision from MSR 0x8B */
-	rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
-
-	if (val[1] != mc_intel->hdr.rev) {
+	if (rev != mc_intel->hdr.rev) {
 		pr_err("CPU%d update to revision 0x%x failed\n",
 		       cpu_num, mc_intel->hdr.rev);
 		return -1;
 	}
 	pr_info("CPU%d updated to revision 0x%x, date = %04x-%02x-%02x\n",
-		cpu_num, val[1],
+		cpu_num, rev,
 		mc_intel->hdr.date & 0xffff,
 		mc_intel->hdr.date >> 24,
 		(mc_intel->hdr.date >> 16) & 0xff);
 
-	uci->cpu_sig.rev = val[1];
-	c->microcode = val[1];
+	uci->cpu_sig.rev = rev;
+	c->microcode = rev;
 
 	return 0;
 }
--- a/arch/x86/kernel/cpu/microcode/intel_early.c
+++ b/arch/x86/kernel/cpu/microcode/intel_early.c
@@ -391,15 +391,8 @@ static int collect_cpu_info_early(struct
 		native_rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
 		csig.pf = 1 << ((val[1] >> 18) & 7);
 	}
-	native_wrmsr(MSR_IA32_UCODE_REV, 0, 0);
 
-	/* As documented in the SDM: Do a CPUID 1 here */
-	sync_core();
-
-	/* get the current revision from MSR 0x8B */
-	native_rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
-
-	csig.rev = val[1];
+	csig.rev = intel_get_microcode_revision();
 
 	uci->cpu_sig = csig;
 	uci->valid = 1;
@@ -654,7 +647,7 @@ static int apply_microcode_early(struct
 				 struct ucode_cpu_info *uci)
 {
 	struct microcode_intel *mc_intel;
-	unsigned int val[2];
+	u32 rev;
 
 	mc_intel = uci->mc;
 	if (mc_intel == NULL)
@@ -664,21 +657,16 @@ static int apply_microcode_early(struct
 	native_wrmsr(MSR_IA32_UCODE_WRITE,
 	      (unsigned long) mc_intel->bits,
 	      (unsigned long) mc_intel->bits >> 16 >> 16);
-	native_wrmsr(MSR_IA32_UCODE_REV, 0, 0);
-
-	/* As documented in the SDM: Do a CPUID 1 here */
-	sync_core();
 
-	/* get the current revision from MSR 0x8B */
-	native_rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
-	if (val[1] != mc_intel->hdr.rev)
+	rev = intel_get_microcode_revision();
+	if (rev != mc_intel->hdr.rev)
 		return -1;
 
 #ifdef CONFIG_X86_64
 	/* Flush global tlb. This is precaution. */
 	flush_tlb_early();
 #endif
-	uci->cpu_sig.rev = val[1];
+	uci->cpu_sig.rev = rev;
 
 	print_ucode(uci);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 165/328] x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (47 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 003/328] EDAC, i7core: Fix memleaks and use-after-free on probe and remove Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 318/328] r8169: fix NAPI handling under high load Ben Hutchings
                   ` (278 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Andi Kleen, vbabka, Michael Hocko, Thomas Gleixner,
	Christopher Snowhill, x86, xxxxxx xxxxxx

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Andi Kleen <ak@linux.intel.com>

commit cc51e5428ea54f575d49cfcede1d4cb3a72b4ec4 upstream.

On Nehalem and newer core CPUs the CPU cache internally uses 44 bits
physical address space. The L1TF workaround is limited by this internal
cache address width, and needs to have one bit free there for the
mitigation to work.

Older client systems report only 36bit physical address space so the range
check decides that L1TF is not mitigated for a 36bit phys/32GB system with
some memory holes.

But since these actually have the larger internal cache width this warning
is bogus because it would only really be needed if the system had more than
43bits of memory.

Add a new internal x86_cache_bits field. Normally it is the same as the
physical bits field reported by CPUID, but for Nehalem and newerforce it to
be at least 44bits.

Change the L1TF memory size warning to use the new cache_bits field to
avoid bogus warnings and remove the bogus comment about memory size.

Fixes: 17dbca119312 ("x86/speculation/l1tf: Add sysfs reporting for l1tf")
Reported-by: xxxxxx xxxxxx <xxxxxx@xxxxxx.xxx>
Reported-by: Christopher Snowhill <kode54@gmail.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Michael Hocko <mhocko@suse.com>
Cc: vbabka@suse.cz
Link: https://lkml.kernel.org/r/20180824170351.34874-1-andi@firstfloor.org
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/include/asm/processor.h |  4 ++-
 arch/x86/kernel/cpu/bugs.c       | 46 ++++++++++++++++++++++++++++----
 arch/x86/kernel/cpu/common.c     |  1 +
 3 files changed, 45 insertions(+), 6 deletions(-)

--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -127,6 +127,8 @@ struct cpuinfo_x86 {
 	/* Index into per_cpu list: */
 	u16			cpu_index;
 	u32			microcode;
+	/* Address space bits used by the cache internally */
+	u8			x86_cache_bits;
 } __attribute__((__aligned__(SMP_CACHE_BYTES)));
 
 #define X86_VENDOR_INTEL	0
@@ -167,7 +169,7 @@ extern void fpu_detect(struct cpuinfo_x8
 
 static inline unsigned long long l1tf_pfn_limit(void)
 {
-	return BIT_ULL(boot_cpu_data.x86_phys_bits - 1 - PAGE_SHIFT);
+	return BIT_ULL(boot_cpu_data.x86_cache_bits - 1 - PAGE_SHIFT);
 }
 
 extern void early_cpu_init(void);
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -696,6 +696,45 @@ void x86_spec_ctrl_setup_ap(void)
 
 #undef pr_fmt
 #define pr_fmt(fmt)	"L1TF: " fmt
+/*
+ * These CPUs all support 44bits physical address space internally in the
+ * cache but CPUID can report a smaller number of physical address bits.
+ *
+ * The L1TF mitigation uses the top most address bit for the inversion of
+ * non present PTEs. When the installed memory reaches into the top most
+ * address bit due to memory holes, which has been observed on machines
+ * which report 36bits physical address bits and have 32G RAM installed,
+ * then the mitigation range check in l1tf_select_mitigation() triggers.
+ * This is a false positive because the mitigation is still possible due to
+ * the fact that the cache uses 44bit internally. Use the cache bits
+ * instead of the reported physical bits and adjust them on the affected
+ * machines to 44bit if the reported bits are less than 44.
+ */
+static void override_cache_bits(struct cpuinfo_x86 *c)
+{
+	if (c->x86 != 6)
+		return;
+
+	switch (c->x86_model) {
+	case INTEL_FAM6_NEHALEM:
+	case INTEL_FAM6_WESTMERE:
+	case INTEL_FAM6_SANDYBRIDGE:
+	case INTEL_FAM6_IVYBRIDGE:
+	case INTEL_FAM6_HASWELL_CORE:
+	case INTEL_FAM6_HASWELL_ULT:
+	case INTEL_FAM6_HASWELL_GT3E:
+	case INTEL_FAM6_BROADWELL_CORE:
+	case INTEL_FAM6_BROADWELL_GT3E:
+	case INTEL_FAM6_SKYLAKE_MOBILE:
+	case INTEL_FAM6_SKYLAKE_DESKTOP:
+	case INTEL_FAM6_KABYLAKE_MOBILE:
+	case INTEL_FAM6_KABYLAKE_DESKTOP:
+		if (c->x86_cache_bits < 44)
+			c->x86_cache_bits = 44;
+		break;
+	}
+}
+
 static void __init l1tf_select_mitigation(void)
 {
 	u64 half_pa;
@@ -703,16 +742,13 @@ static void __init l1tf_select_mitigatio
 	if (!boot_cpu_has_bug(X86_BUG_L1TF))
 		return;
 
+	override_cache_bits(&boot_cpu_data);
+
 #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
 	pr_warn("Kernel not compiled for PAE. No mitigation for L1TF\n");
 	return;
 #endif
 
-	/*
-	 * This is extremely unlikely to happen because almost all
-	 * systems have far more MAX_PA/2 than RAM can be fit into
-	 * DIMM slots.
-	 */
 	half_pa = (u64)l1tf_pfn_limit() << PAGE_SHIFT;
 	if (e820_any_mapped(half_pa, ULLONG_MAX - half_pa, E820_RAM)) {
 		pr_warn("System has more than MAX_PA/2 memory. L1TF mitigation not effective.\n");
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -772,6 +772,7 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
 	else if (cpu_has(c, X86_FEATURE_PAE) || cpu_has(c, X86_FEATURE_PSE36))
 		c->x86_phys_bits = 36;
 #endif
+	c->x86_cache_bits = c->x86_phys_bits;
 
 	if (c->extended_cpuid_level >= 0x80000007)
 		c->x86_power = cpuid_edx(0x80000007);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 167/328] USB: serial: ti_usb_3410_5052: use functions rather than macros
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (34 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 065/328] xfrm: fix 'passing zero to ERR_PTR()' warning Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 208/328] usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame() Ben Hutchings
                   ` (291 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Johan Hovold, Mathieu OTHACEHE

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mathieu OTHACEHE <m.othacehe@gmail.com>

commit d8d841e8332779fae2b18420d39ef407ea3729da upstream.

Functions are preferable to macros resembling functions.

Signed-off-by: Mathieu OTHACEHE <m.othacehe@gmail.com>
[johan: drop inline keyword, move above calling function ]
Signed-off-by: Johan Hovold <johan@kernel.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -925,6 +925,15 @@ static void ti_break(struct tty_struct *
 		dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status);
 }
 
+static int ti_get_port_from_code(unsigned char code)
+{
+	return (code >> 4) - 3;
+}
+
+static int ti_get_func_from_code(unsigned char code)
+{
+	return code & 0x0f;
+}
 
 static void ti_interrupt_callback(struct urb *urb)
 {
@@ -966,8 +975,8 @@ static void ti_interrupt_callback(struct
 		goto exit;
 	}
 
-	port_number = TI_GET_PORT_FROM_CODE(data[0]);
-	function = TI_GET_FUNC_FROM_CODE(data[0]);
+	port_number = ti_get_port_from_code(data[0]);
+	function = ti_get_func_from_code(data[0]);
 
 	dev_dbg(dev, "%s - port_number %d, function %d, data 0x%02X\n",
 		__func__, port_number, function, data[1]);
--- a/drivers/usb/serial/ti_usb_3410_5052.h
+++ b/drivers/usb/serial/ti_usb_3410_5052.h
@@ -227,8 +227,6 @@ struct ti_interrupt {
 } __attribute__((packed));
 
 /* Interrupt codes */
-#define TI_GET_PORT_FROM_CODE(c)	(((c) >> 4) - 3)
-#define TI_GET_FUNC_FROM_CODE(c)	((c) & 0x0f)
 #define TI_CODE_HARDWARE_ERROR		0xFF
 #define TI_CODE_DATA_ERROR		0x03
 #define TI_CODE_MODEM_STATUS		0x04


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 168/328] USB: serial: ti_usb_3410_5052: fix array underflow in completion handler
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (85 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 265/328] bcache: don't embed 'return' statements in closure macros Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 109/328] btrfs: use correct compare function of dirty_metadata_bytes Ben Hutchings
                   ` (240 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Johan Hovold

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 5dfdd24eb3d39d815bc952ae98128e967c9bba49 upstream.

Similarly to a recently reported bug in io_ti, a malicious USB device
could set port_number to a negative value and we would underflow the
port array in the interrupt completion handler.

As these devices only have one or two ports, fix this by making sure we
only consider the seventh bit when determining the port number (and
ignore bits 0xb0 which are typically set to 0x30).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/serial/ti_usb_3410_5052.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -927,7 +927,7 @@ static void ti_break(struct tty_struct *
 
 static int ti_get_port_from_code(unsigned char code)
 {
-	return (code >> 4) - 3;
+	return (code >> 6) & 0x01;
 }
 
 static int ti_get_func_from_code(unsigned char code)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 163/328] ext4: check to make sure the rename(2)'s destination is not freed
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (203 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 281/328] pstore/ram: Fix failure-path memory leak in ramoops_init Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 259/328] mm: shmem.c: Correctly annotate new inodes for lockdep Ben Hutchings
                   ` (122 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Wen Xu, Theodore Ts'o

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Theodore Ts'o <tytso@mit.edu>

commit b50282f3241acee880514212d88b6049fb5039c8 upstream.

If the destination of the rename(2) system call exists, the inode's
link count (i_nlinks) must be non-zero.  If it is, the inode can end
up on the orphan list prematurely, leading to all sorts of hilarity,
including a use-after-free.

https://bugzilla.kernel.org/show_bug.cgi?id=200931

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Wen Xu <wen.xu@gatech.edu>
[bwh: Backported to 3.16:
 - Return -EIO on error
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/namei.c | 6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3211,6 +3211,12 @@ static int ext4_rename(struct inode *old
 	int force_reread;
 	int retval;
 
+	if (new.inode && new.inode->i_nlink == 0) {
+		EXT4_ERROR_INODE(new.inode,
+				 "target of rename is already freed");
+		return -EIO;
+	}
+
 	dquot_initialize(old.dir);
 	dquot_initialize(new.dir);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 166/328] USB: serial: io_ti: fix array underflow in completion handler
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (249 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 102/328] ieee802154: 6lowpan: ensure header compression does not corrupt ipv6 header Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 251/328] USB: usbdevfs: sanitize flags more Ben Hutchings
                   ` (76 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dan Carpenter, Johan Hovold

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 691a03cfe8ca483f9c48153b869d354e4ae3abef upstream.

As reported by Dan Carpenter, a malicious USB device could set
port_number to a negative value and we would underflow the port array in
the interrupt completion handler.

As these devices only have one or two ports, fix this by making sure we
only consider the seventh bit when determining the port number (and
ignore bits 0xb0 which are typically set to 0x30).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/serial/io_ti.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/serial/io_ti.h
+++ b/drivers/usb/serial/io_ti.h
@@ -178,7 +178,7 @@ struct ump_interrupt {
 }  __attribute__((packed));
 
 
-#define TIUMP_GET_PORT_FROM_CODE(c)	(((c) >> 4) - 3)
+#define TIUMP_GET_PORT_FROM_CODE(c)	(((c) >> 6) & 0x01)
 #define TIUMP_GET_FUNC_FROM_CODE(c)	((c) & 0x0f)
 #define TIUMP_INTERRUPT_CODE_LSR	0x03
 #define TIUMP_INTERRUPT_CODE_MSR	0x04


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 164/328] x86/spectre: Add missing family 6 check to microcode check
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (87 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 109/328] btrfs: use correct compare function of dirty_metadata_bytes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 297/328] ipv6: Compute net once in raw6_send_hdrinc Ben Hutchings
                   ` (238 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Andi Kleen, Thomas Gleixner, x86

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Andi Kleen <ak@linux.intel.com>

commit 1ab534e85c93945f7862378d8c8adcf408205b19 upstream.

The check for Spectre microcodes does not check for family 6, only the
model numbers.

Add a family 6 check to avoid ambiguity with other families.

Fixes: a5b296636453 ("x86/cpufeature: Blacklist SPEC_CTRL/PRED_CMD on early Spectre v2 microcodes")
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
Link: https://lkml.kernel.org/r/20180824170351.34874-2-andi@firstfloor.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/kernel/cpu/intel.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -75,6 +75,9 @@ static bool bad_spectre_microcode(struct
 	if (cpu_has(c, X86_FEATURE_HYPERVISOR))
 		return false;
 
+	if (c->x86 != 6)
+		return false;
+
 	for (i = 0; i < ARRAY_SIZE(spectre_bad_microcodes); i++) {
 		if (c->x86_model == spectre_bad_microcodes[i].model &&
 		    c->x86_mask == spectre_bad_microcodes[i].stepping)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 104/328] mac802154: common tx error path
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (132 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 110/328] Btrfs: fix btrfs_write_inode vs delayed iput deadlock Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 323/328] wil6210: missing length check in wmi_set_ie Ben Hutchings
                   ` (193 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Marcel Holtmann, Alexander Aring, Varka Bhadram

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Varka Bhadram <varkab@cdac.in>

commit f55889128a776b51581394b20abd0b470304cf95 upstream.

This patch introduce the common error path on failure of Tx by
inserting the label 'err_tx'.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/mac802154/tx.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -89,8 +89,7 @@ netdev_tx_t mac802154_tx(struct mac80215
 
 	if (!(priv->phy->channels_supported[page] & (1 << chan))) {
 		WARN_ON(1);
-		kfree_skb(skb);
-		return NETDEV_TX_OK;
+		goto err_tx;
 	}
 
 	mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb);
@@ -102,12 +101,10 @@ netdev_tx_t mac802154_tx(struct mac80215
 		data[1] = crc >> 8;
 	}
 
-	if (skb_cow_head(skb, priv->hw.extra_tx_headroom)) {
-		kfree_skb(skb);
-		return NETDEV_TX_OK;
-	}
+	if (skb_cow_head(skb, priv->hw.extra_tx_headroom))
+		goto err_tx;
 
-	work = kzalloc(sizeof(struct xmit_work), GFP_ATOMIC);
+	work = kzalloc(sizeof(*work), GFP_ATOMIC);
 	if (!work) {
 		kfree_skb(skb);
 		return NETDEV_TX_BUSY;
@@ -128,4 +125,8 @@ netdev_tx_t mac802154_tx(struct mac80215
 	queue_work(priv->dev_workqueue, &work->work);
 
 	return NETDEV_TX_OK;
+
+err_tx:
+	kfree_skb(skb);
+	return NETDEV_TX_OK;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 100/328] crypto: ablkcipher - fix crash flushing dcache in error path
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (174 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 314/328] RDMA/ucma: Fix Spectre v1 vulnerability Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 248/328] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Ben Hutchings
                   ` (151 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Herbert Xu, Liu Chao, Eric Biggers

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Biggers <ebiggers@google.com>

commit 318abdfbe708aaaa652c79fb500e9bd60521f9dc upstream.

Like the skcipher_walk and blkcipher_walk cases:

scatterwalk_done() is only meant to be called after a nonzero number of
bytes have been processed, since scatterwalk_pagedone() will flush the
dcache of the *previous* page.  But in the error case of
ablkcipher_walk_done(), e.g. if the input wasn't an integer number of
blocks, scatterwalk_done() was actually called after advancing 0 bytes.
This caused a crash ("BUG: unable to handle kernel paging request")
during '!PageSlab(page)' on architectures like arm and arm64 that define
ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE, provided that the input was
page-aligned as in that case walk->offset == 0.

Fix it by reorganizing ablkcipher_walk_done() to skip the
scatterwalk_advance() and scatterwalk_done() if an error has occurred.

Reported-by: Liu Chao <liuchao741@huawei.com>
Fixes: bf06099db18a ("crypto: skcipher - Add ablkcipher_walk interfaces")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 crypto/ablkcipher.c | 57 +++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 31 deletions(-)

--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -72,11 +72,9 @@ static inline u8 *ablkcipher_get_spot(u8
 	return max(start, end_page);
 }
 
-static inline unsigned int ablkcipher_done_slow(struct ablkcipher_walk *walk,
-						unsigned int bsize)
+static inline void ablkcipher_done_slow(struct ablkcipher_walk *walk,
+					unsigned int n)
 {
-	unsigned int n = bsize;
-
 	for (;;) {
 		unsigned int len_this_page = scatterwalk_pagelen(&walk->out);
 
@@ -88,17 +86,13 @@ static inline unsigned int ablkcipher_do
 		n -= len_this_page;
 		scatterwalk_start(&walk->out, scatterwalk_sg_next(walk->out.sg));
 	}
-
-	return bsize;
 }
 
-static inline unsigned int ablkcipher_done_fast(struct ablkcipher_walk *walk,
-						unsigned int n)
+static inline void ablkcipher_done_fast(struct ablkcipher_walk *walk,
+					unsigned int n)
 {
 	scatterwalk_advance(&walk->in, n);
 	scatterwalk_advance(&walk->out, n);
-
-	return n;
 }
 
 static int ablkcipher_walk_next(struct ablkcipher_request *req,
@@ -108,39 +102,40 @@ int ablkcipher_walk_done(struct ablkciph
 			 struct ablkcipher_walk *walk, int err)
 {
 	struct crypto_tfm *tfm = req->base.tfm;
-	unsigned int nbytes = 0;
+	unsigned int n; /* bytes processed */
+	bool more;
 
-	if (likely(err >= 0)) {
-		unsigned int n = walk->nbytes - err;
+	if (unlikely(err < 0))
+		goto finish;
 
-		if (likely(!(walk->flags & ABLKCIPHER_WALK_SLOW)))
-			n = ablkcipher_done_fast(walk, n);
-		else if (WARN_ON(err)) {
+	n = walk->nbytes - err;
+	walk->total -= n;
+	more = (walk->total != 0);
+
+	if (likely(!(walk->flags & ABLKCIPHER_WALK_SLOW))) {
+		ablkcipher_done_fast(walk, n);
+	} else {
+		if (WARN_ON(err)) {
+			/* unexpected case; didn't process all bytes */
 			err = -EINVAL;
-			goto err;
-		} else
-			n = ablkcipher_done_slow(walk, n);
-
-		nbytes = walk->total - n;
-		err = 0;
+			goto finish;
+		}
+		ablkcipher_done_slow(walk, n);
 	}
 
-	scatterwalk_done(&walk->in, 0, nbytes);
-	scatterwalk_done(&walk->out, 1, nbytes);
+	scatterwalk_done(&walk->in, 0, more);
+	scatterwalk_done(&walk->out, 1, more);
 
-err:
-	walk->total = nbytes;
-	walk->nbytes = nbytes;
-
-	if (nbytes) {
+	if (more) {
 		crypto_yield(req->base.flags);
 		return ablkcipher_walk_next(req, walk);
 	}
-
+	err = 0;
+finish:
+	walk->nbytes = 0;
 	if (walk->iv != req->info)
 		memcpy(req->info, walk->iv, tfm->crt_ablkcipher.ivsize);
 	kfree(walk->iv_buffer);
-
 	return err;
 }
 EXPORT_SYMBOL_GPL(ablkcipher_walk_done);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 102/328] ieee802154: 6lowpan: ensure header compression does not corrupt ipv6 header
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (248 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 193/328] iw_cxgb4: atomically flush the qp Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 166/328] USB: serial: io_ti: fix array underflow in completion handler Ben Hutchings
                   ` (77 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Simon Vincent, Alexander Aring, Marcel Holtmann

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Simon Vincent <simon.vincent@xsilon.com>

commit f19f4f9525cf32f97341fac20ce66392e86a1b67 upstream.

The 6lowpan ipv6 header compression was causing problems for other interfaces
that expected a ipv6 header to still be in place, as we were replacing the
ipv6 header with a compressed version. This happened if you sent a packet to a
multicast address as the packet would be output on 802.15.4, ethernet, and also
be sent to the loopback interface. The skb data was shared between these
interfaces so all interfaces ended up with a compressed ipv6 header.

The solution is to ensure that before we do any header compression we are not
sharing the skb or skb data with any other interface. If we are then we must
take a copy of the skb and skb data before modifying the ipv6 header.
The only place we can copy the skb is inside the xmit function so we don't
leave dangling references to skb.

This patch moves all the header compression to inside the xmit function. Very
little code has been changed it has mostly been moved from lowpan_header_create
to lowpan_xmit. At the top of the xmit function we now check if the skb is
shared and if so copy it. In lowpan_header_create all we do now is store the
source and destination addresses for use later when we compress the header.

Signed-off-by: Simon Vincent <simon.vincent@xsilon.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 net/ieee802154/6lowpan_rtnl.c | 125 ++++++++++++++++++++++++----------
 1 file changed, 89 insertions(+), 36 deletions(-)

--- a/net/ieee802154/6lowpan_rtnl.c
+++ b/net/ieee802154/6lowpan_rtnl.c
@@ -71,6 +71,21 @@ struct lowpan_dev_record {
 	struct list_head list;
 };
 
+/* don't save pan id, it's intra pan */
+struct lowpan_addr {
+	u8 mode;
+	union {
+		/* IPv6 needs big endian here */
+		__be64 extended_addr;
+		__be16 short_addr;
+	} u;
+};
+
+struct lowpan_addr_info {
+	struct lowpan_addr daddr;
+	struct lowpan_addr saddr;
+};
+
 static inline struct
 lowpan_dev_info *lowpan_dev_info(const struct net_device *dev)
 {
@@ -84,6 +99,14 @@ static inline void lowpan_address_flip(u
 		(dest)[IEEE802154_ADDR_LEN - i - 1] = (src)[i];
 }
 
+static inline struct
+lowpan_addr_info *lowpan_skb_priv(const struct sk_buff *skb)
+{
+	WARN_ON_ONCE(skb_headroom(skb) < sizeof(struct lowpan_addr_info));
+	return (struct lowpan_addr_info *)(skb->data -
+			sizeof(struct lowpan_addr_info));
+}
+
 static int lowpan_header_create(struct sk_buff *skb,
 			   struct net_device *dev,
 			   unsigned short type, const void *_daddr,
@@ -91,8 +114,7 @@ static int lowpan_header_create(struct s
 {
 	const u8 *saddr = _saddr;
 	const u8 *daddr = _daddr;
-	struct ieee802154_addr sa, da;
-	struct ieee802154_mac_cb *cb = mac_cb_init(skb);
+	struct lowpan_addr_info *info;
 
 	/* TODO:
 	 * if this package isn't ipv6 one, where should it be routed?
@@ -106,41 +128,17 @@ static int lowpan_header_create(struct s
 	raw_dump_inline(__func__, "saddr", (unsigned char *)saddr, 8);
 	raw_dump_inline(__func__, "daddr", (unsigned char *)daddr, 8);
 
-	lowpan_header_compress(skb, dev, type, daddr, saddr, len);
-
-	/* NOTE1: I'm still unsure about the fact that compression and WPAN
-	 * header are created here and not later in the xmit. So wait for
-	 * an opinion of net maintainers.
-	 */
-	/* NOTE2: to be absolutely correct, we must derive PANid information
-	 * from MAC subif of the 'dev' and 'real_dev' network devices, but
-	 * this isn't implemented in mainline yet, so currently we assign 0xff
-	 */
-	cb->type = IEEE802154_FC_TYPE_DATA;
+	info = lowpan_skb_priv(skb);
 
-	/* prepare wpan address data */
-	sa.mode = IEEE802154_ADDR_LONG;
-	sa.pan_id = ieee802154_mlme_ops(dev)->get_pan_id(dev);
-	sa.extended_addr = ieee802154_devaddr_from_raw(saddr);
+	/* TODO: Currently we only support extended_addr */
+	info->daddr.mode = IEEE802154_ADDR_LONG;
+	memcpy(&info->daddr.u.extended_addr, daddr,
+	       sizeof(info->daddr.u.extended_addr));
+	info->saddr.mode = IEEE802154_ADDR_LONG;
+	memcpy(&info->saddr.u.extended_addr, saddr,
+	       sizeof(info->daddr.u.extended_addr));
 
-	/* intra-PAN communications */
-	da.pan_id = sa.pan_id;
-
-	/* if the destination address is the broadcast address, use the
-	 * corresponding short address
-	 */
-	if (lowpan_is_addr_broadcast(daddr)) {
-		da.mode = IEEE802154_ADDR_SHORT;
-		da.short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
-	} else {
-		da.mode = IEEE802154_ADDR_LONG;
-		da.extended_addr = ieee802154_devaddr_from_raw(daddr);
-	}
-
-	cb->ackreq = !lowpan_is_addr_broadcast(daddr);
-
-	return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
-			type, (void *)&da, (void *)&sa, 0);
+	return 0;
 }
 
 static int lowpan_give_skb_to_devices(struct sk_buff *skb,
@@ -338,13 +336,68 @@ err:
 	return rc;
 }
 
+static int lowpan_header(struct sk_buff *skb, struct net_device *dev)
+{
+	struct ieee802154_addr sa, da;
+	struct ieee802154_mac_cb *cb = mac_cb_init(skb);
+	struct lowpan_addr_info info;
+	void *daddr, *saddr;
+
+	memcpy(&info, lowpan_skb_priv(skb), sizeof(info));
+
+	/* TODO: Currently we only support extended_addr */
+	daddr = &info.daddr.u.extended_addr;
+	saddr = &info.saddr.u.extended_addr;
+
+	lowpan_header_compress(skb, dev, ETH_P_IPV6, daddr, saddr, skb->len);
+
+	cb->type = IEEE802154_FC_TYPE_DATA;
+
+	/* prepare wpan address data */
+	sa.mode = IEEE802154_ADDR_LONG;
+	sa.pan_id = ieee802154_mlme_ops(dev)->get_pan_id(dev);
+	sa.extended_addr = ieee802154_devaddr_from_raw(saddr);
+
+	/* intra-PAN communications */
+	da.pan_id = sa.pan_id;
+
+	/* if the destination address is the broadcast address, use the
+	 * corresponding short address
+	 */
+	if (lowpan_is_addr_broadcast((const u8 *)daddr)) {
+		da.mode = IEEE802154_ADDR_SHORT;
+		da.short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
+		cb->ackreq = false;
+	} else {
+		da.mode = IEEE802154_ADDR_LONG;
+		da.extended_addr = ieee802154_devaddr_from_raw(daddr);
+		cb->ackreq = true;
+	}
+
+	return dev_hard_header(skb, lowpan_dev_info(dev)->real_dev,
+			ETH_P_IPV6, (void *)&da, (void *)&sa, 0);
+}
+
 static netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct ieee802154_hdr wpan_hdr;
-	int max_single;
+	int max_single, ret;
 
 	pr_debug("package xmit\n");
 
+	/* We must take a copy of the skb before we modify/replace the ipv6
+	 * header as the header could be used elsewhere
+	 */
+	skb = skb_unshare(skb, GFP_ATOMIC);
+	if (!skb)
+		return NET_XMIT_DROP;
+
+	ret = lowpan_header(skb, dev);
+	if (ret < 0) {
+		kfree_skb(skb);
+		return NET_XMIT_DROP;
+	}
+
 	if (ieee802154_hdr_peek(skb, &wpan_hdr) < 0) {
 		kfree_skb(skb);
 		return NET_XMIT_DROP;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 101/328] pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (298 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 302/328] ocfs2: fix locking for res->tracking and dlm->tracking_list Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 171/328] usb: gadget: net2280: fix pullup handling Ben Hutchings
                   ` (27 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Linus Walleij, Jisheng Zhang, YueHaibing

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: YueHaibing <yuehaibing@huawei.com>

commit b5031b7db77dc47f474f0efc2b2552c32b7bb59d upstream.

fixes following Smatch static check warning:

 drivers/pinctrl/berlin/berlin.c:237 berlin_pinctrl_build_state()
 warn: passing devm_ allocated variable to kfree. 'pctrl->functions'

As we will be calling krealloc() on pointer 'pctrl->functions', which means
kfree() will be called in there, devm_kzalloc() shouldn't be used with
the allocation in the first place.  Fix the warning by calling kcalloc()
and managing the free procedure in error path on our own.

Fixes: 3de68d331c24 ("pinctrl: berlin: add the core pinctrl driver for Marvell Berlin SoCs")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[bwh: Backported to 3.16: berlin_pinctrl_state() was not yet converted
 to devm_kcalloc()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pinctrl/berlin/berlin.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/drivers/pinctrl/berlin/berlin.c
+++ b/drivers/pinctrl/berlin/berlin.c
@@ -237,9 +237,8 @@ static int berlin_pinctrl_build_state(st
 	}
 
 	/* we will reallocate later */
-	pctrl->functions = devm_kzalloc(&pdev->dev,
-					max_functions * sizeof(*pctrl->functions),
-					GFP_KERNEL);
+	pctrl->functions = kcalloc(max_functions,
+				   sizeof(*pctrl->functions), GFP_KERNEL);
 	if (!pctrl->functions)
 		return -ENOMEM;
 
@@ -277,8 +276,10 @@ static int berlin_pinctrl_build_state(st
 				function++;
 			}
 
-			if (!found)
+			if (!found) {
+				kfree(pctrl->functions);
 				return -EINVAL;
+			}
 
 			if (!function->groups) {
 				function->groups =
@@ -286,8 +287,10 @@ static int berlin_pinctrl_build_state(st
 						     function->ngroups * sizeof(char *),
 						     GFP_KERNEL);
 
-				if (!function->groups)
+				if (!function->groups) {
+					kfree(pctrl->functions);
 					return -ENOMEM;
+				}
 			}
 
 			groups = function->groups;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 091/328] tracing: Do not call start/stop() functions when tracing_on does not change
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (65 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 090/328] ext4: check for NUL characters in extended attribute's name Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 253/328] USB: leave LPM alone if possible when binding/unbinding interface drivers Ben Hutchings
                   ` (260 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Steven Rostedt (VMware), Erica Bugden

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

commit f143641bfef9a4a60c57af30de26c63057e7e695 upstream.

Currently, when one echo's in 1 into tracing_on, the current tracer's
"start()" function is executed, even if tracing_on was already one. This can
lead to strange side effects. One being that if the hwlat tracer is enabled,
and someone does "echo 1 > tracing_on" into tracing_on, the hwlat tracer's
start() function is called again which will recreate another kernel thread,
and make it unable to remove the old one.

Link: http://lkml.kernel.org/r/1533120354-22923-1-git-send-email-erica.bugden@linutronix.de

Fixes: 2df8f8a6a897e ("tracing: Fix regression with irqsoff tracer and tracing_on file")
Reported-by: Erica Bugden <erica.bugden@linutronix.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/trace/trace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6180,7 +6180,9 @@ rb_simple_write(struct file *filp, const
 
 	if (buffer) {
 		mutex_lock(&trace_types_lock);
-		if (val) {
+		if (!!val == tracer_tracing_is_on(tr)) {
+			val = 0; /* do nothing */
+		} else if (val) {
 			tracer_tracing_on(tr);
 			if (tr->current_trace->start)
 				tr->current_trace->start(tr);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 096/328] scsi: sysfs: Introduce sysfs_{un,}break_active_protection()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (116 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 307/328] of: unittest: Disable interrupt node tests for old world MAC systems Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 029/328] vxlan: fix default fdb entry netlink notify ordering during netdev create Ben Hutchings
                   ` (209 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Tejun Heo, Martin K. Petersen, Bart Van Assche, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bart.vanassche@wdc.com>

commit 2afc9166f79b8f6da5f347f48515215ceee4ae37 upstream.

Introduce these two functions and export them such that the next patch
can add calls to these functions from the SCSI core.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/sysfs/file.c       | 44 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/sysfs.h | 14 ++++++++++++++
 2 files changed, 58 insertions(+)

--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -357,6 +357,50 @@ int sysfs_chmod_file(struct kobject *kob
 EXPORT_SYMBOL_GPL(sysfs_chmod_file);
 
 /**
+ * sysfs_break_active_protection - break "active" protection
+ * @kobj: The kernel object @attr is associated with.
+ * @attr: The attribute to break the "active" protection for.
+ *
+ * With sysfs, just like kernfs, deletion of an attribute is postponed until
+ * all active .show() and .store() callbacks have finished unless this function
+ * is called. Hence this function is useful in methods that implement self
+ * deletion.
+ */
+struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
+						  const struct attribute *attr)
+{
+	struct kernfs_node *kn;
+
+	kobject_get(kobj);
+	kn = kernfs_find_and_get(kobj->sd, attr->name);
+	if (kn)
+		kernfs_break_active_protection(kn);
+	return kn;
+}
+EXPORT_SYMBOL_GPL(sysfs_break_active_protection);
+
+/**
+ * sysfs_unbreak_active_protection - restore "active" protection
+ * @kn: Pointer returned by sysfs_break_active_protection().
+ *
+ * Undo the effects of sysfs_break_active_protection(). Since this function
+ * calls kernfs_put() on the kernfs node that corresponds to the 'attr'
+ * argument passed to sysfs_break_active_protection() that attribute may have
+ * been removed between the sysfs_break_active_protection() and
+ * sysfs_unbreak_active_protection() calls, it is not safe to access @kn after
+ * this function has returned.
+ */
+void sysfs_unbreak_active_protection(struct kernfs_node *kn)
+{
+	struct kobject *kobj = kn->parent->priv;
+
+	kernfs_unbreak_active_protection(kn);
+	kernfs_put(kn);
+	kobject_put(kobj);
+}
+EXPORT_SYMBOL_GPL(sysfs_unbreak_active_protection);
+
+/**
  * sysfs_remove_file_ns - remove an object attribute with a custom ns tag
  * @kobj: object we're acting for
  * @attr: attribute descriptor
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -204,6 +204,9 @@ int __must_check sysfs_create_files(stru
 				   const struct attribute **attr);
 int __must_check sysfs_chmod_file(struct kobject *kobj,
 				  const struct attribute *attr, umode_t mode);
+struct kernfs_node *sysfs_break_active_protection(struct kobject *kobj,
+						  const struct attribute *attr);
+void sysfs_unbreak_active_protection(struct kernfs_node *kn);
 void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
 			  const void *ns);
 bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
@@ -314,6 +317,17 @@ static inline int sysfs_chmod_file(struc
 	return 0;
 }
 
+static inline struct kernfs_node *
+sysfs_break_active_protection(struct kobject *kobj,
+			      const struct attribute *attr)
+{
+	return NULL;
+}
+
+static inline void sysfs_unbreak_active_protection(struct kernfs_node *kn)
+{
+}
+
 static inline void sysfs_remove_file_ns(struct kobject *kobj,
 					const struct attribute *attr,
 					const void *ns)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 093/328] ext4: fix spectre gadget in ext4_mb_regular_allocator()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (190 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 066/328] ALSA: seq: Fix poll() error return Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 283/328] arm64: KVM: Tighten guest core register access from userspace Ben Hutchings
                   ` (135 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jeremy Cline, Theodore Ts'o, Josh Poimboeuf

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jeremy Cline <jcline@redhat.com>

commit 1a5d5e5d51e75a5bca67dadbcea8c841934b7b85 upstream.

'ac->ac_g_ex.fe_len' is a user-controlled value which is used in the
derivation of 'ac->ac_2order'. 'ac->ac_2order', in turn, is used to
index arrays which makes it a potential spectre gadget. Fix this by
sanitizing the value assigned to 'ac->ac2_order'.  This covers the
following accesses found with the help of smatch:

* fs/ext4/mballoc.c:1896 ext4_mb_simple_scan_group() warn: potential
  spectre issue 'grp->bb_counters' [w] (local cap)

* fs/ext4/mballoc.c:445 mb_find_buddy() warn: potential spectre issue
  'EXT4_SB(e4b->bd_sb)->s_mb_offsets' [r] (local cap)

* fs/ext4/mballoc.c:446 mb_find_buddy() warn: potential spectre issue
  'EXT4_SB(e4b->bd_sb)->s_mb_maxs' [r] (local cap)

Suggested-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ext4/mballoc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -26,6 +26,7 @@
 #include <linux/log2.h>
 #include <linux/module.h>
 #include <linux/slab.h>
+#include <linux/nospec.h>
 #include <trace/events/ext4.h>
 
 #ifdef CONFIG_EXT4_DEBUG
@@ -2124,7 +2125,8 @@ ext4_mb_regular_allocator(struct ext4_al
 		 * This should tell if fe_len is exactly power of 2
 		 */
 		if ((ac->ac_g_ex.fe_len & (~(1 << (i - 1)))) == 0)
-			ac->ac_2order = i - 1;
+			ac->ac_2order = array_index_nospec(i - 1,
+							   sb->s_blocksize_bits + 2);
 	}
 
 	/* if stream allocation is enabled, use global goal */


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 094/328] IB/IPoIB: Set ah valid flag in multicast send flow
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (121 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 098/328] xfrm: Validate address prefix lengths in the xfrm selector Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 012/328] media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data Ben Hutchings
                   ` (204 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Jason Gunthorpe, Leon Romanovsky, Denis Drozdov,
	Feras Daoud, Erez Shitrit

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Denis Drozdov <denisd@mellanox.com>

commit 75da96067ade4e7854379ec2f7834f3497652b1a upstream.

The change of ipoib_ah data structure with adding "valid" flag and
checks of ah->valid in ipoib_start_xmit affected multicast packet flow.

Since the multicast flow doesn't invoke path_rec_start, "ah->valid" flag
remains unset, so that ipoib_start_xmit end up with neigh_refresh_path
instead of sending the packet using neigh.

"ah->valid" has to be set in multicast send flow. As a result IPoIB
starts sending packets via neigh immediately and eliminates 60sec delay
of neigh keep alive interval.

The typical example of this issue are two sequential arpings:

arping 11.134.208.9 -> got response (mcast_send)
arping 11.134.208.9 -> no response  (ah->valid = 0)

Fixes: fa9391dbad4b ("RDMA/ipoib: Update paths on CLIENT_REREG/SM_CHANGE events")
Signed-off-by: Denis Drozdov <denisd@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Feras Daoud <ferasda@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 1 +
 1 file changed, 1 insertion(+)

--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -734,6 +734,7 @@ out:
 			if (neigh && list_empty(&neigh->list)) {
 				kref_get(&mcast->ah->ref);
 				neigh->ah	= mcast->ah;
+				neigh->ah->valid = 1;
 				list_add_tail(&neigh->list, &mcast->neigh_list);
 			}
 		}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 141/328] drm/i915: set DP Main Stream Attribute for color range on DDI platforms
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (161 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 017/328] crypto: vmac - separate tfm and request context Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 145/328] netfilter: nf_tables: fix register ordering Ben Hutchings
                   ` (164 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, N. W.,
	Tom Yan, Rodrigo Vivi, Paulo Zanoni, Ville Syrjälä,
	Michał Kopeć,
	Nicholas Stommel, Jani Nikula

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jani Nikula <jani.nikula@intel.com>

commit 6209c285e7a5e68dbcdf8fd2456c6dd68433806b upstream.

Since Haswell we have no color range indication either in the pipe or
port registers for DP. Instead, there's a separate register for setting
the DP Main Stream Attributes (MSA) directly. The MSA register
definition makes no references to colorimetry, just a vague reference to
the DP spec. The connection to the color range was lost.

Apparently we've failed to set the proper MSA bit for limited, or CEA,
range ever since the first DDI platforms. We've started setting other
MSA parameters since commit dae847991a43 ("drm/i915: add
intel_ddi_set_pipe_settings").

Without the crucial bit of information, the DP sink has no way of
knowing the source is actually transmitting limited range RGB, leading
to "washed out" colors. With the colorimetry information, compliant
sinks should be able to handle the limited range properly. Native
(i.e. non-LSPCON) HDMI was not affected because we do pass the color
range via AVI infoframes.

Though not the root cause, the problem was made worse for DDI platforms
with commit 55bc60db5988 ("drm/i915: Add "Automatic" mode for the
"Broadcast RGB" property"), which selects limited range RGB
automatically based on the mode, as per the DP, HDMI and CEA specs.

After all these years, the fix boils down to flipping one bit.

[Per testing reports, this fixes DP sinks, but not the LSPCON. My
 educated guess is that the LSPCON fails to turn the CEA range MSA into
 AVI infoframes for HDMI.]

Reported-by: Michał Kopeć <mkopec12@gmail.com>
Reported-by: N. W. <nw9165-3201@yahoo.com>
Reported-by: Nicholas Stommel <nicholas.stommel@gmail.com>
Reported-by: Tom Yan <tom.ty89@gmail.com>
Tested-by: Nicholas Stommel <nicholas.stommel@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=100023
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107476
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=94921
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180814060001.18224-1-jani.nikula@intel.com
(cherry picked from commit dc5977da99ea28094b8fa4e9bacbd29bedc41de5)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
[bwh: Backported to 3.16:
 - s/crtc_state->/intel_crtc->config./
 - Adjust context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/gpu/drm/i915/i915_reg.h  | 1 +
 drivers/gpu/drm/i915/intel_ddi.c | 4 ++++
 2 files changed, 5 insertions(+)

--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -5918,6 +5918,7 @@ enum punit_power_well {
 #define  TRANS_MSA_10_BPC		(2<<5)
 #define  TRANS_MSA_12_BPC		(3<<5)
 #define  TRANS_MSA_16_BPC		(4<<5)
+#define  TRANS_MSA_CEA_RANGE		(1 << 3)
 
 /* LCPLL Control */
 #define LCPLL_CTL			0x130040
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -929,6 +929,10 @@ void intel_ddi_set_pipe_settings(struct
 	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
 
 		temp = TRANS_MSA_SYNC_CLK;
+
+		if (intel_crtc->config.limited_color_range)
+			temp |= TRANS_MSA_CEA_RANGE;
+
 		switch (intel_crtc->config.pipe_bpp) {
 		case 18:
 			temp |= TRANS_MSA_6_BPC;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 097/328] scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (186 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 088/328] udl-kms: fix crash due to uninitialized memory Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 007/328] USB: serial: sierra: fix potential deadlock at close Ben Hutchings
                   ` (139 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Martin K. Petersen, Bart Van Assche, Greg Kroah-Hartman,
	Johannes Thumshirn, Tejun Heo

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bart.vanassche@wdc.com>

commit 0ee223b2e1f67cb2de9c0e3247c510d846e74d63 upstream.

A long time ago the unfortunate decision was taken to add a self-deletion
attribute to the sysfs SCSI device directory. That decision was unfortunate
because self-deletion is really tricky. We can't drop that attribute
because widely used user space software depends on it, namely the
rescan-scsi-bus.sh script. Hence this patch that avoids that writing into
that attribute triggers a deadlock. See also commit 7973cbd9fbd9 ("[PATCH]
add sysfs attributes to scan and delete scsi_devices").

This patch avoids that self-removal triggers the following deadlock:

======================================================
WARNING: possible circular locking dependency detected
4.18.0-rc2-dbg+ #5 Not tainted
------------------------------------------------------
modprobe/6539 is trying to acquire lock:
000000008323c4cd (kn->count#202){++++}, at: kernfs_remove_by_name_ns+0x45/0x90

but task is already holding lock:
00000000a6ec2c69 (&shost->scan_mutex){+.+.}, at: scsi_remove_host+0x21/0x150 [scsi_mod]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (&shost->scan_mutex){+.+.}:
       __mutex_lock+0xfe/0xc70
       mutex_lock_nested+0x1b/0x20
       scsi_remove_device+0x26/0x40 [scsi_mod]
       sdev_store_delete+0x27/0x30 [scsi_mod]
       dev_attr_store+0x3e/0x50
       sysfs_kf_write+0x87/0xa0
       kernfs_fop_write+0x190/0x230
       __vfs_write+0xd2/0x3b0
       vfs_write+0x101/0x270
       ksys_write+0xab/0x120
       __x64_sys_write+0x43/0x50
       do_syscall_64+0x77/0x230
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (kn->count#202){++++}:
       lock_acquire+0xd2/0x260
       __kernfs_remove+0x424/0x4a0
       kernfs_remove_by_name_ns+0x45/0x90
       remove_files.isra.1+0x3a/0x90
       sysfs_remove_group+0x5c/0xc0
       sysfs_remove_groups+0x39/0x60
       device_remove_attrs+0x82/0xb0
       device_del+0x251/0x580
       __scsi_remove_device+0x19f/0x1d0 [scsi_mod]
       scsi_forget_host+0x37/0xb0 [scsi_mod]
       scsi_remove_host+0x9b/0x150 [scsi_mod]
       sdebug_driver_remove+0x4b/0x150 [scsi_debug]
       device_release_driver_internal+0x241/0x360
       device_release_driver+0x12/0x20
       bus_remove_device+0x1bc/0x290
       device_del+0x259/0x580
       device_unregister+0x1a/0x70
       sdebug_remove_adapter+0x8b/0xf0 [scsi_debug]
       scsi_debug_exit+0x76/0xe8 [scsi_debug]
       __x64_sys_delete_module+0x1c1/0x280
       do_syscall_64+0x77/0x230
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&shost->scan_mutex);
                               lock(kn->count#202);
                               lock(&shost->scan_mutex);
  lock(kn->count#202);

 *** DEADLOCK ***

2 locks held by modprobe/6539:
 #0: 00000000efaf9298 (&dev->mutex){....}, at: device_release_driver_internal+0x68/0x360
 #1: 00000000a6ec2c69 (&shost->scan_mutex){+.+.}, at: scsi_remove_host+0x21/0x150 [scsi_mod]

stack backtrace:
CPU: 10 PID: 6539 Comm: modprobe Not tainted 4.18.0-rc2-dbg+ #5
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
Call Trace:
 dump_stack+0xa4/0xf5
 print_circular_bug.isra.34+0x213/0x221
 __lock_acquire+0x1a7e/0x1b50
 lock_acquire+0xd2/0x260
 __kernfs_remove+0x424/0x4a0
 kernfs_remove_by_name_ns+0x45/0x90
 remove_files.isra.1+0x3a/0x90
 sysfs_remove_group+0x5c/0xc0
 sysfs_remove_groups+0x39/0x60
 device_remove_attrs+0x82/0xb0
 device_del+0x251/0x580
 __scsi_remove_device+0x19f/0x1d0 [scsi_mod]
 scsi_forget_host+0x37/0xb0 [scsi_mod]
 scsi_remove_host+0x9b/0x150 [scsi_mod]
 sdebug_driver_remove+0x4b/0x150 [scsi_debug]
 device_release_driver_internal+0x241/0x360
 device_release_driver+0x12/0x20
 bus_remove_device+0x1bc/0x290
 device_del+0x259/0x580
 device_unregister+0x1a/0x70
 sdebug_remove_adapter+0x8b/0xf0 [scsi_debug]
 scsi_debug_exit+0x76/0xe8 [scsi_debug]
 __x64_sys_delete_module+0x1c1/0x280
 do_syscall_64+0x77/0x230
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

See also https://www.mail-archive.com/linux-scsi@vger.kernel.org/msg54525.html.

Fixes: ac0ece9174ac ("scsi: use device_remove_file_self() instead of device_schedule_callback()")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Johannes Thumshirn <jthumshirn@suse.de>

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/scsi/scsi_sysfs.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -651,8 +651,24 @@ static ssize_t
 sdev_store_delete(struct device *dev, struct device_attribute *attr,
 		  const char *buf, size_t count)
 {
-	if (device_remove_file_self(dev, attr))
-		scsi_remove_device(to_scsi_device(dev));
+	struct kernfs_node *kn;
+
+	kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
+	WARN_ON_ONCE(!kn);
+	/*
+	 * Concurrent writes into the "delete" sysfs attribute may trigger
+	 * concurrent calls to device_remove_file() and scsi_remove_device().
+	 * device_remove_file() handles concurrent removal calls by
+	 * serializing these and by ignoring the second and later removal
+	 * attempts.  Concurrent calls of scsi_remove_device() are
+	 * serialized. The second and later calls of scsi_remove_device() are
+	 * ignored because the first call of that function changes the device
+	 * state into SDEV_DEL.
+	 */
+	device_remove_file(dev, attr);
+	scsi_remove_device(to_scsi_device(dev));
+	if (kn)
+		sysfs_unbreak_active_protection(kn);
 	return count;
 };
 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 095/328] uio: potential double frees if __uio_register_device() fails
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (314 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 043/328] mtd: rawnand: mxc: remove __init qualifier from mxcnd_probe_dt Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 160/328] cifs: check kmalloc before use Ben Hutchings
                   ` (11 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dan Carpenter, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit f019f07ecf6a6b8bd6d7853bce70925d90af02d1 upstream.

The uio_unregister_device() function assumes that if "info->uio_dev" is
non-NULL that means "info" is fully allocated.  Setting info->uio_de
has to be the last thing in the function.

In the current code, if request_threaded_irq() fails then we return with
info->uio_dev set to non-NULL but info is not fully allocated and it can
lead to double frees.

Fixes: beafc54c4e2f ("UIO: Add the User IO core code")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/uio/uio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -852,8 +852,6 @@ int __uio_register_device(struct module
 	if (ret)
 		goto err_uio_dev_add_attributes;
 
-	info->uio_dev = idev;
-
 	if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) {
 		ret = devm_request_irq(idev->dev, info->irq, uio_interrupt,
 				  info->irq_flags, info->name, idev);
@@ -861,6 +859,7 @@ int __uio_register_device(struct module
 			goto err_request_irq;
 	}
 
+	info->uio_dev = idev;
 	return 0;
 
 err_request_irq:


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 140/328] ubifs: Check data node size before truncate
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (323 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 112/328] ASoC: wm8994: Mark expected switch fall-through Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 190/328] nbd: don't allow invalid blocksize settings Ben Hutchings
                   ` (2 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Kees Cook, Silvio Cesare, Richard Weinberger

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Richard Weinberger <richard@nod.at>

commit 95a22d2084d72ea067d8323cc85677dba5d97cae upstream.

Check whether the size is within bounds before using it.
If the size is not correct, abort and dump the bad data node.

Cc: Kees Cook <keescook@chromium.org>
Cc: Silvio Cesare <silvio.cesare@gmail.com>
Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system")
Reported-by: Silvio Cesare <silvio.cesare@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
[bwh: Backported to 3.16: Drop first argument to ubifs_err()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ubifs/journal.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -1186,7 +1186,16 @@ int ubifs_jnl_truncate(struct ubifs_info
 		else if (err)
 			goto out_free;
 		else {
-			if (le32_to_cpu(dn->size) <= dlen)
+			int dn_len = le32_to_cpu(dn->size);
+
+			if (dn_len <= 0 || dn_len > UBIFS_BLOCK_SIZE) {
+				ubifs_err("bad data node (block %u, inode %lu)",
+					  blk, inode->i_ino);
+				ubifs_dump_node(c, dn);
+				goto out_free;
+			}
+
+			if (dn_len <= dlen)
 				dlen = 0; /* Nothing to do */
 			else {
 				int compr_type = le16_to_cpu(dn->compr_type);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 010/328] rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (292 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 245/328] serial: cpm_uart: return immediately from console poll Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 303/328] mm: madvise(MADV_DODUMP): allow hugetlbfs pages Ben Hutchings
                   ` (33 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Dan Carpenter, Kalle Valo

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit ae636fb1554833ee5133ca47bf4b2791b6739c52 upstream.

This is a static checker fix, not something I have tested.  The issue
is that on the second iteration through the loop, we jump forward by
le32_to_cpu(auth_req->length) bytes.  The problem is that if the length
is more than "buflen" then we end up with a negative "buflen".  A
negative buflen is type promoted to a high positive value and the loop
continues but it's accessing beyond the end of the buffer.

I believe the "auth_req->length" comes from the firmware and if the
firmware is malicious or buggy, you're already toasted so the impact of
this bug is probably not very severe.

Fixes: 030645aceb3d ("rndis_wlan: handle 802.11 indications from device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/wireless/rndis_wlan.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2917,6 +2917,8 @@ static void rndis_wlan_auth_indication(s
 
 	while (buflen >= sizeof(*auth_req)) {
 		auth_req = (void *)buf;
+		if (buflen < le32_to_cpu(auth_req->length))
+			return;
 		type = "unknown";
 		flags = le32_to_cpu(auth_req->flags);
 		pairwise_error = false;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 018/328] alarmtimer: Prevent overflow for relative nanosleep
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (269 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 250/328] ip6_tunnel: be careful when accessing the inner header Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 151/328] iscsi-target: nullify session in failed login sequence Ben Hutchings
                   ` (56 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Thomas Gleixner, Team OWL337, John Stultz

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit 5f936e19cc0ef97dbe3a56e9498922ad5ba1edef upstream.

Air Icy reported:

  UBSAN: Undefined behaviour in kernel/time/alarmtimer.c:811:7
  signed integer overflow:
  1529859276030040771 + 9223372036854775807 cannot be represented in type 'long long int'
  Call Trace:
   alarm_timer_nsleep+0x44c/0x510 kernel/time/alarmtimer.c:811
   __do_sys_clock_nanosleep kernel/time/posix-timers.c:1235 [inline]
   __se_sys_clock_nanosleep kernel/time/posix-timers.c:1213 [inline]
   __x64_sys_clock_nanosleep+0x326/0x4e0 kernel/time/posix-timers.c:1213
   do_syscall_64+0xb8/0x3a0 arch/x86/entry/common.c:290

alarm_timer_nsleep() uses ktime_add() to add the current time and the
relative expiry value. ktime_add() has no sanity checks so the addition
can overflow when the relative timeout is large enough.

Use ktime_add_safe() which has the necessary sanity checks in place and
limits the result to the valid range.

Fixes: 9a7adcf5c6de ("timers: Posix interface for alarm-timers")
Reported-by: Team OWL337 <icytxw@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1807020926360.1595@nanos.tec.linutronix.de
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 kernel/time/alarmtimer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -775,7 +775,8 @@ static int alarm_timer_nsleep(const cloc
 	/* Convert (if necessary) to absolute time */
 	if (flags != TIMER_ABSTIME) {
 		ktime_t now = alarm_bases[type].gettime();
-		exp = ktime_add(now, exp);
+
+		exp = ktime_add_safe(now, exp);
 	}
 
 	if (alarmtimer_do_nsleep(&alarm, exp))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 034/328] pwm: tiehrpwm: Fix disabling of output of PWMs
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (67 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 253/328] USB: leave LPM alone if possible when binding/unbinding interface drivers Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 055/328] fb: fix lost console when the user unplugs a USB adapter Ben Hutchings
                   ` (258 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Thierry Reding, Vignesh R

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Vignesh R <vigneshr@ti.com>

commit 38dabd91ff0bde33352ca3cc65ef515599b77a05 upstream.

pwm-tiehrpwm driver disables PWM output by putting it in low output
state via active AQCSFRC register in ehrpwm_pwm_disable(). But, the
AQCSFRC shadow register is not updated. Therefore, when shadow AQCSFRC
register is re-enabled in ehrpwm_pwm_enable() (say to enable second PWM
output), previous settings are lost as shadow register value is loaded
into active register. This results in things like PWMA getting enabled
automatically, when PWMB is enabled and vice versa. Fix this by
updating AQCSFRC shadow register as well during ehrpwm_pwm_disable().

Fixes: 19891b20e7c2 ("pwm: pwm-tiehrpwm: PWM driver support for EHRPWM")
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/pwm/pwm-tiehrpwm.c | 2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -378,6 +378,8 @@ static void ehrpwm_pwm_disable(struct pw
 		aqcsfrc_mask = AQCSFRC_CSFA_MASK;
 	}
 
+	/* Update shadow register first before modifying active register */
+	ehrpwm_modify(pc->mmio_base, AQCSFRC, aqcsfrc_mask, aqcsfrc_val);
 	/*
 	 * Changes to immediate action on Action Qualifier. This puts
 	 * Action Qualifier control on PWM output from next TBCLK


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 022/328] media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (265 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 233/328] x86/EISA: Don't probe EISA bus for Xen PV guests Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 206/328] usb: Don't die twice if PCI xhci host is not responding in resume Ben Hutchings
                   ` (60 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Mauro Carvalho Chehab, Sylwester Nawrocki, Dan Carpenter

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Sylwester Nawrocki <s.nawrocki@samsung.com>

commit 7c1b9a5aeed91bef98988ac0fcf38c8c1f4f9a3a upstream.

This patch fixes potential NULL pointer dereference as indicated
by the following static checker warning:

drivers/media/platform/exynos4-is/fimc-isp-video.c:408 isp_video_try_fmt_mplane()
error: NULL dereference inside function '__isp_video_try_fmt(isp, &f->fmt.pix_mp, (0))()'.

Fixes: 34947b8aebe3: ("[media] exynos4-is: Add the FIMC-IS ISP capture DMA driver")

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/media/platform/exynos4-is/fimc-isp-video.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- a/drivers/media/platform/exynos4-is/fimc-isp-video.c
+++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c
@@ -390,12 +390,17 @@ static void __isp_video_try_fmt(struct f
 				struct v4l2_pix_format_mplane *pixm,
 				const struct fimc_fmt **fmt)
 {
-	*fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
+	const struct fimc_fmt *__fmt;
+
+	__fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);
+
+	if (fmt)
+		*fmt = __fmt;
 
 	pixm->colorspace = V4L2_COLORSPACE_SRGB;
 	pixm->field = V4L2_FIELD_NONE;
-	pixm->num_planes = (*fmt)->memplanes;
-	pixm->pixelformat = (*fmt)->fourcc;
+	pixm->num_planes = __fmt->memplanes;
+	pixm->pixelformat = __fmt->fourcc;
 	/*
 	 * TODO: double check with the docmentation these width/height
 	 * constraints are correct.


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 021/328] libertas: fix suspend and resume for SDIO connected cards
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (206 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 200/328] spi: sh-msiof: Add more register documentation Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 308/328] libertas: call into generic suspend code before turning off power Ben Hutchings
                   ` (119 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Kalle Valo, Ulf Hansson, Daniel Mack, Chris Ball

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Mack <daniel@zonque.org>

commit 7444a8092906ed44c09459780c56ba57043e39b1 upstream.

Prior to commit 573185cc7e64 ("mmc: core: Invoke sdio func driver's PM
callbacks from the sdio bus"), the MMC core used to call into the power
management functions of SDIO clients itself and removed the card if the
return code was non-zero. IOW, the mmc handled errors gracefully and didn't
upchain them to the pm core.

Since this change, the mmc core relies on generic power management
functions which treat all errors as a reason to cancel the suspend
immediately. This causes suspend attempts to fail when the libertas
driver is loaded.

To fix this, power down the card explicitly in if_sdio_suspend() when we
know we're about to lose power and return success. Also set a flag in these
cases, and power up the card again in if_sdio_resume().

Fixes: 573185cc7e64 ("mmc: core: Invoke sdio func driver's PM callbacks from the sdio bus")
Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: Chris Ball <chris@printf.net>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
[bwh: Backported to 3.16: adjust filenames]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/wireless/libertas/dev.h     |  1 +
 drivers/net/wireless/libertas/if_sdio.c | 30 +++++++++++++++----
 2 files changed, 25 insertions(+), 6 deletions(-)

--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -102,6 +102,7 @@ struct lbs_private {
 	u8 fw_ready;
 	u8 surpriseremoved;
 	u8 setup_fw_on_resume;
+	u8 power_up_on_resume;
 	int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb);
 	void (*reset_card) (struct lbs_private *priv);
 	int (*power_save) (struct lbs_private *priv);
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -1342,15 +1342,23 @@ static void if_sdio_remove(struct sdio_f
 static int if_sdio_suspend(struct device *dev)
 {
 	struct sdio_func *func = dev_to_sdio_func(dev);
-	int ret;
 	struct if_sdio_card *card = sdio_get_drvdata(func);
+	struct lbs_private *priv = card->priv;
+	int ret;
 
 	mmc_pm_flag_t flags = sdio_get_host_pm_caps(func);
+	priv->power_up_on_resume = false;
 
 	/* If we're powered off anyway, just let the mmc layer remove the
 	 * card. */
-	if (!lbs_iface_active(card->priv))
-		return -ENOSYS;
+	if (!lbs_iface_active(priv)) {
+		if (priv->fw_ready) {
+			priv->power_up_on_resume = true;
+			if_sdio_power_off(card);
+		}
+
+		return 0;
+	}
 
 	dev_info(dev, "%s: suspend: PM flags = 0x%x\n",
 		 sdio_func_id(func), flags);
@@ -1358,9 +1366,14 @@ static int if_sdio_suspend(struct device
 	/* If we aren't being asked to wake on anything, we should bail out
 	 * and let the SD stack power down the card.
 	 */
-	if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) {
+	if (priv->wol_criteria == EHS_REMOVE_WAKEUP) {
 		dev_info(dev, "Suspend without wake params -- powering down card\n");
-		return -ENOSYS;
+		if (priv->fw_ready) {
+			priv->power_up_on_resume = true;
+			if_sdio_power_off(card);
+		}
+
+		return 0;
 	}
 
 	if (!(flags & MMC_PM_KEEP_POWER)) {
@@ -1373,7 +1386,7 @@ static int if_sdio_suspend(struct device
 	if (ret)
 		return ret;
 
-	ret = lbs_suspend(card->priv);
+	ret = lbs_suspend(priv);
 	if (ret)
 		return ret;
 
@@ -1388,6 +1401,11 @@ static int if_sdio_resume(struct device
 
 	dev_info(dev, "%s: resume: we're back\n", sdio_func_id(func));
 
+	if (card->priv->power_up_on_resume) {
+		if_sdio_power_on(card);
+		wait_event(card->pwron_waitq, card->priv->fw_ready);
+	}
+
 	ret = lbs_resume(card->priv);
 
 	return ret;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 033/328] pwm: tiehrpwm: Don't use emulation mode bits to control PWM output
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (113 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 179/328] x86/microcode: Update the new microcode revision unconditionally Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 054/328] iio: ad9523: Fix displayed phase Ben Hutchings
                   ` (212 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Vignesh R, Thierry Reding

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Vignesh R <vigneshr@ti.com>

commit aa49d628f6e016bcec8c6f8e704b9b18ee697329 upstream.

As per AM335x TRM SPRUH73P "15.2.2.11 ePWM Behavior During Emulation",
TBCTL[15:14] only have effect during emulation suspend events (IOW,
to stop PWM when debugging using a debugger). These bits have no effect
on PWM output during normal running of system. Hence, remove code
accessing these bits as they have no role in enabling/disabling PWMs.

Fixes: 19891b20e7c2 ("pwm: pwm-tiehrpwm: PWM driver support for EHRPWM")
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -35,10 +35,6 @@
 #define TBCTL			0x00
 #define TBPRD			0x0A
 
-#define TBCTL_RUN_MASK		(BIT(15) | BIT(14))
-#define TBCTL_STOP_NEXT		0
-#define TBCTL_STOP_ON_CYCLE	BIT(14)
-#define TBCTL_FREE_RUN		(BIT(15) | BIT(14))
 #define TBCTL_PRDLD_MASK	BIT(3)
 #define TBCTL_PRDLD_SHDW	0
 #define TBCTL_PRDLD_IMDT	BIT(3)
@@ -357,7 +353,7 @@ static int ehrpwm_pwm_enable(struct pwm_
 	/* Channels polarity can be configured from action qualifier module */
 	configure_polarity(pc, pwm->hwpwm);
 
-	/* Enable TBCLK before enabling PWM device */
+	/* Enable TBCLK */
 	ret = clk_enable(pc->tbclk);
 	if (ret) {
 		dev_err(chip->dev, "Failed to enable TBCLK for %s\n",
@@ -365,8 +361,6 @@ static int ehrpwm_pwm_enable(struct pwm_
 		return ret;
 	}
 
-	/* Enable time counter for free_run */
-	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_FREE_RUN);
 	return 0;
 }
 
@@ -396,9 +390,6 @@ static void ehrpwm_pwm_disable(struct pw
 	/* Disabling TBCLK on PWM disable */
 	clk_disable(pc->tbclk);
 
-	/* Stop Time base counter */
-	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_STOP_NEXT);
-
 	/* Disable clock on PWM disable */
 	pm_runtime_put_sync(chip->dev);
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 027/328] vxlan: fix a potential issue when create a new vxlan fdb entry.
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (50 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 264/328] fbdev/omapfb: fix omapfb_memory_read infoleak Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 120/328] scsi: aic94xx: fix an error code in aic94xx_init() Ben Hutchings
                   ` (275 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Haishuang Yan, Jiri Benc, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

commit 17b463654f41f0aa334efd5a6efeab8a6e9496f7 upstream.

vxlan_fdb_append may return error, so add the proper check,
otherwise it will cause memory leak.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

Changes in v2:
  - Unnecessary to initialize rc to zero.
Acked-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/vxlan.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -695,6 +695,7 @@ static int vxlan_fdb_create(struct vxlan
 	struct vxlan_rdst *rd = NULL;
 	struct vxlan_fdb *f;
 	int notify = 0;
+	int rc;
 
 	f = __vxlan_find_mac(vxlan, mac);
 	if (f) {
@@ -729,8 +730,7 @@ static int vxlan_fdb_create(struct vxlan
 		if ((flags & NLM_F_APPEND) &&
 		    (is_multicast_ether_addr(f->eth_addr) ||
 		     is_zero_ether_addr(f->eth_addr))) {
-			int rc = vxlan_fdb_append(f, ip, port, vni, ifindex,
-						  &rd);
+			rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
 
 			if (rc < 0)
 				return rc;
@@ -760,7 +760,11 @@ static int vxlan_fdb_create(struct vxlan
 		INIT_LIST_HEAD(&f->remotes);
 		memcpy(f->eth_addr, mac, ETH_ALEN);
 
-		vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
+		rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
+		if (rc < 0) {
+			kfree(f);
+			return rc;
+		}
 
 		++vxlan->addrcnt;
 		hlist_add_head_rcu(&f->hlist,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 023/328] USB: serial: kobil_sct: fix modem-status error handling
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (286 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 211/328] hwmon: (nct6775) Set weight source to zero correctly Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 178/328] x86/microcode: Make sure boot_cpu_data.microcode is up-to-date Ben Hutchings
                   ` (39 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Johan Hovold

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit a420b5d939ee58f1d950f0ea782834056520aeaa upstream.

Make sure to return -EIO in case of a short modem-status read request.

While at it, split the debug message to not include the (zeroed)
transfer-buffer content in case of errors.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/usb/serial/kobil_sct.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -408,12 +408,20 @@ static int kobil_tiocmget(struct tty_str
 			  transfer_buffer_length,
 			  KOBIL_TIMEOUT);
 
-	dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n",
-		__func__, result, transfer_buffer[0]);
+	dev_dbg(&port->dev, "Send get_status_line_state URB returns: %i\n",
+			result);
+	if (result < 1) {
+		if (result >= 0)
+			result = -EIO;
+		goto out_free;
+	}
+
+	dev_dbg(&port->dev, "Statusline: %02x\n", transfer_buffer[0]);
 
 	result = 0;
 	if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
 		result = TIOCM_DSR;
+out_free:
 	kfree(transfer_buffer);
 	return result;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 024/328] staging: rts5208: fix missing error check on call to rtsx_write_register
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (228 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 228/328] ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 291/328] smb2: fix missing files in root share directory listing Ben Hutchings
                   ` (97 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Colin Ian King, Greg Kroah-Hartman

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Colin Ian King <colin.king@canonical.com>

commit c5fae4f4fd28189b1062fb8ef7b21fec37cb8b17 upstream.

Currently the check on error return from the call to rtsx_write_register
is checking the error status from the previous call. Fix this by adding
in the missing assignment of retval.

Detected by CoverityScan, CID#709877

Fixes: fa590c222fba ("staging: rts5208: add support for rts5208 and rts5288")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/staging/rts5208/sd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -4276,7 +4276,7 @@ int sd_execute_write_data(struct scsi_cm
 		if (retval != STATUS_SUCCESS)
 			TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed);
 
-		rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
+		retval = rtsx_write_register(chip, SD_BYTE_CNT_L, 0xFF, 0x00);
 		if (retval != STATUS_SUCCESS)
 			TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed);
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 014/328] IB/srpt: Support HCAs with more than two ports
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (155 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 116/328] smb3: fill in statfs fsid and correct namelen Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 122/328] b43legacy/leds: Ensure NUL-termination of LED name string Ben Hutchings
                   ` (170 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Steve Wise, Christoph Hellwig, Jason Gunthorpe, Bart Van Assche

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bart.vanassche@wdc.com>

commit e620ebfc228dcbef7519e3d16f43c6c6f1a1d0cb upstream.

Since there are adapters that have four ports, increase the size of
the srpt_device.port[] array. This patch avoids that the following
warning is hit with quad port Chelsio adapters:

    WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));

Reported-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Steve Wise <swise@opengridcomputing.com>
Cc: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
[bwh: Backported to 3.16:
 - Use inline calculation instead of struct_size; the number of ports is not
   user-controlled so no overflow check is needed
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3147,7 +3147,9 @@ static void srpt_add_one(struct ib_devic
 	pr_debug("device = %p, device->dma_ops = %p\n", device,
 		 device->dma_ops);
 
-	sdev = kzalloc(sizeof *sdev, GFP_KERNEL);
+	sdev = kzalloc(sizeof(*sdev) +
+		       device->phys_port_cnt * sizeof(*sdev->port),
+		       GFP_KERNEL);
 	if (!sdev)
 		goto err;
 
@@ -3220,8 +3222,6 @@ static void srpt_add_one(struct ib_devic
 	for (i = 0; i < sdev->srq_size; ++i)
 		srpt_post_recv(sdev, sdev->ioctx_ring[i]);
 
-	WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));
-
 	for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
 		sport = &sdev->port[i - 1];
 		sport->sdev = sdev;
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -387,9 +387,9 @@ struct srpt_port {
  * @rch_list:      Per-device channel list -- see also srpt_rdma_ch.list.
  * @ch_releaseQ:   Enables waiting for removal from rch_list.
  * @spinlock:      Protects rch_list and tpg.
- * @port:          Information about the ports owned by this HCA.
  * @event_handler: Per-HCA asynchronous IB event handler.
  * @list:          Node in srpt_dev_list.
+ * @port:          Information about the ports owned by this HCA.
  */
 struct srpt_device {
 	struct ib_device	*device;
@@ -403,9 +403,9 @@ struct srpt_device {
 	struct list_head	rch_list;
 	wait_queue_head_t	ch_releaseQ;
 	spinlock_t		spinlock;
-	struct srpt_port	port[2];
 	struct ib_event_handler	event_handler;
 	struct list_head	list;
+	struct srpt_port        port[];
 };
 
 /**


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 026/328] power: generic-adc-battery: check for duplicate properties copied from iio channels
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (199 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 115/328] dm cache metadata: save in-core policy_hint_size to on-disk superblock Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 232/328] x86/boot: Move EISA setup to a separate file Ben Hutchings
                   ` (126 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Sebastian Reichel, H. Nikolaus Schaller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "H. Nikolaus Schaller" <hns@goldelico.com>

commit a427503edaaed9b75ed9746a654cece7e93e60a8 upstream.

If an iio channel defines a basic property, there are duplicate entries
in /sys/class/power/*/uevent.

So add a check to avoid duplicates. Since all channels may be duplicates,
we have to modify the related error check.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Fixes: e60fea794e6e ("power: battery: Generic battery driver using IIO")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
[bwh: Backported to 3.16:
 - s/psy_desc/psy/
 - Adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/power/generic-adc-battery.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

--- a/drivers/power/generic-adc-battery.c
+++ b/drivers/power/generic-adc-battery.c
@@ -244,6 +244,7 @@ static int gab_probe(struct platform_dev
 	int ret = 0;
 	int chan;
 	int index = ARRAY_SIZE(gab_props);
+	bool any = false;
 
 	adc_bat = devm_kzalloc(&pdev->dev, sizeof(*adc_bat), GFP_KERNEL);
 	if (!adc_bat) {
@@ -288,12 +289,22 @@ static int gab_probe(struct platform_dev
 			adc_bat->channel[chan] = NULL;
 		} else {
 			/* copying properties for supported channels only */
-			psy->properties[index++] = gab_dyn_props[chan];
+			int index2;
+
+			for (index2 = 0; index2 < index; index2++) {
+				if (psy->properties[index2] ==
+				    gab_dyn_props[chan])
+					break;	/* already known */
+			}
+			if (index2 == index)	/* really new */
+				psy->properties[index++] =
+					gab_dyn_props[chan];
+			any = true;
 		}
 	}
 
 	/* none of the channels are supported so let's bail out */
-	if (index == ARRAY_SIZE(gab_props)) {
+	if (!any) {
 		ret = -ENODEV;
 		goto second_mem_fail;
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 030/328] vmci: type promotion bug in qp_host_get_user_memory()
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (138 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 230/328] drm: udl: Destroy framebuffer only if it was initialized Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 267/328] bcache: explicitly destroy mutex while exiting Ben Hutchings
                   ` (187 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Dan Carpenter

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 7fb2fd4e25fc1fb10dcb30b5519de257cfeae84c upstream.

The problem is that if get_user_pages_fast() fails and returns a
negative error code, it gets type promoted to a high positive value and
treated as a success.

Fixes: 06164d2b72aa ("VMCI: queue pairs implementation.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/misc/vmw_vmci/vmci_queue_pair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
+++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
@@ -735,7 +735,7 @@ static int qp_host_get_user_memory(u64 p
 	retval = get_user_pages_fast((uintptr_t) produce_uva,
 				     produce_q->kernel_if->num_pages, 1,
 				     produce_q->kernel_if->u.h.header_page);
-	if (retval < produce_q->kernel_if->num_pages) {
+	if (retval < (int)produce_q->kernel_if->num_pages) {
 		pr_warn("get_user_pages(produce) failed (retval=%d)", retval);
 		qp_release_pages(produce_q->kernel_if->u.h.header_page,
 				 retval, false);
@@ -746,7 +746,7 @@ static int qp_host_get_user_memory(u64 p
 	retval = get_user_pages_fast((uintptr_t) consume_uva,
 				     consume_q->kernel_if->num_pages, 1,
 				     consume_q->kernel_if->u.h.header_page);
-	if (retval < consume_q->kernel_if->num_pages) {
+	if (retval < (int)consume_q->kernel_if->num_pages) {
 		pr_warn("get_user_pages(consume) failed (retval=%d)", retval);
 		qp_release_pages(consume_q->kernel_if->u.h.header_page,
 				 retval, false);


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 009/328] platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (151 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 073/328] fuse: Fix oops at process_init_reply() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 188/328] ext4: prevent online resize with backup superblock Ben Hutchings
                   ` (174 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Darren Hart (VMware), Takashi Iwai

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 58e73aa177850babb947555257fd4f79e5275cf1 upstream.

The commit 5d9f40b56630 ("platform/x86: ideapad-laptop: Add
Y520-15IKBN to no_hw_rfkill") added the entry for Y20-15IKBN, and it
turned out that another variant, Y20-15IKBM, also requires the
no_hw_rfkill.

Trim the last letter from the string so that it matches to both
Y20-15IKBN and Y20-15IKBM models.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=1098626
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/platform/x86/ideapad-laptop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -860,10 +860,10 @@ static struct dmi_system_id no_hw_rfkill
 		},
 	},
 	{
-		.ident = "Lenovo Legion Y520-15IKBN",
+		.ident = "Lenovo Legion Y520-15IKB",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y520-15IKBN"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y520-15IKB"),
 		},
 	},
 	{


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 020/328] leds: max8997: use mode when calling max8997_led_set_mode
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 057/328] video: udlfb: Fix unaligned access Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 045/328] binfmt_elf: Respect error return from `regset->active' Ben Hutchings
                   ` (325 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Colin Ian King, Jacek Anaszewski

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Colin Ian King <colin.king@canonical.com>

commit 7a5de56db902ea632a0ff0c2b47481d278db645f upstream.

Variable mode is assigned to pdata->led_pdata->mode[led->id] and yet
is not being used when calling function max8997_led_set_mode. Fix
this by using mode when calling max8997_led_set_mode.

Cleans up clang warning:
warning: variable 'mode' set but not used [-Wunused-but-set-variable]

Fixes: 8584cb82f151 ("leds: Add suuport for MAX8997-LED driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/leds/leds-max8997.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/leds/leds-max8997.c
+++ b/drivers/leds/leds-max8997.c
@@ -262,7 +262,7 @@ static int max8997_led_probe(struct plat
 		mode = pdata->led_pdata->mode[led->id];
 		brightness = pdata->led_pdata->brightness[led->id];
 
-		max8997_led_set_mode(led, pdata->led_pdata->mode[led->id]);
+		max8997_led_set_mode(led, mode);
 
 		if (brightness > led->cdev.max_brightness)
 			brightness = led->cdev.max_brightness;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 025/328] power: generic-adc-battery: fix out-of-bounds write when copying channel properties
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (153 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 188/328] ext4: prevent online resize with backup superblock Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 116/328] smb3: fill in statfs fsid and correct namelen Ben Hutchings
                   ` (172 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, H. Nikolaus Schaller, Sebastian Reichel

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: "H. Nikolaus Schaller" <hns@goldelico.com>

commit 932d47448c3caa0fa99e84d7f5bc302aa286efd8 upstream.

We did have sporadic problems in the pinctrl framework during boot
where a pin group name unexpectedly became NULL leading to a NULL
dereference in strcmp.

Detailled analysis of the failing cases did reveal that there were
two devm allocated objects close to each other. The second one was
the affected group_desc in pinmux and the first one was the
psy_desc->properties buffer of the gab driver.

Review of the gab code showed that the address calculation for
one memcpy() is wrong. It does

	properties + sizeof(type) * index

but C is defined to do the index multiplication already for
pointer + integer additions. Hence the factor was applied twice
and the memcpy() does write outside of the properties buffer.
Sometimes it happened to be the pinctrl and triggered the strcmp(NULL).

Anyways, it is overkill to use a memcpy() here instead of a simple
assignment, which is easier to read and has less risk for wrong
address calculations. So we change code to a simple assignment.

If we initialize the index to the first free location, we can even
remove the local variable 'properties'.

This bug seems to exist right from the beginning in 3.7-rc1 in

commit e60fea794e6e ("power: battery: Generic battery driver using IIO")

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Fixes: e60fea794e6e ("power: battery: Generic battery driver using IIO")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
[bwh: Backported to 3.16:
 - s/psy_desc/psy/g
 - Adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/power/generic-adc-battery.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

--- a/drivers/power/generic-adc-battery.c
+++ b/drivers/power/generic-adc-battery.c
@@ -241,10 +241,9 @@ static int gab_probe(struct platform_dev
 	struct gab *adc_bat;
 	struct power_supply *psy;
 	struct gab_platform_data *pdata = pdev->dev.platform_data;
-	enum power_supply_property *properties;
 	int ret = 0;
 	int chan;
-	int index = 0;
+	int index = ARRAY_SIZE(gab_props);
 
 	adc_bat = devm_kzalloc(&pdev->dev, sizeof(*adc_bat), GFP_KERNEL);
 	if (!adc_bat) {
@@ -276,8 +275,6 @@ static int gab_probe(struct platform_dev
 	}
 
 	memcpy(psy->properties, gab_props, sizeof(gab_props));
-	properties = (enum power_supply_property *)
-				((char *)psy->properties + sizeof(gab_props));
 
 	/*
 	 * getting channel from iio and copying the battery properties
@@ -291,15 +288,12 @@ static int gab_probe(struct platform_dev
 			adc_bat->channel[chan] = NULL;
 		} else {
 			/* copying properties for supported channels only */
-			memcpy(properties + sizeof(*(psy->properties)) * index,
-					&gab_dyn_props[chan],
-					sizeof(gab_dyn_props[chan]));
-			index++;
+			psy->properties[index++] = gab_dyn_props[chan];
 		}
 	}
 
 	/* none of the channels are supported so let's bail out */
-	if (index == 0) {
+	if (index == ARRAY_SIZE(gab_props)) {
 		ret = -ENODEV;
 		goto second_mem_fail;
 	}
@@ -310,7 +304,7 @@ static int gab_probe(struct platform_dev
 	 * as come channels may be not be supported by the device.So
 	 * we need to take care of that.
 	 */
-	psy->num_properties = ARRAY_SIZE(gab_props) + index;
+	psy->num_properties = index;
 
 	ret = power_supply_register(&pdev->dev, psy);
 	if (ret)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 015/328] crypto: vmac - require a block cipher with 128-bit block size
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (239 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 013/328] ALSA: snd-aoa: add of_node_put() in error path Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 252/328] USB: usbdevfs: restore warning for nonsensical flags Ben Hutchings
                   ` (86 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Eric Biggers, Herbert Xu

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Biggers <ebiggers@google.com>

commit 73bf20ef3df262026c3470241ae4ac8196943ffa upstream.

The VMAC template assumes the block cipher has a 128-bit block size, but
it failed to check for that.  Thus it was possible to instantiate it
using a 64-bit block size cipher, e.g. "vmac(cast5)", causing
uninitialized memory to be used.

Add the needed check when instantiating the template.

Fixes: f1939f7c5645 ("crypto: vmac - New hash algorithm for intel_txt support")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 crypto/vmac.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/crypto/vmac.c
+++ b/crypto/vmac.c
@@ -655,6 +655,10 @@ static int vmac_create(struct crypto_tem
 	if (IS_ERR(alg))
 		return PTR_ERR(alg);
 
+	err = -EINVAL;
+	if (alg->cra_blocksize != 16)
+		goto out_put_alg;
+
 	inst = shash_alloc_instance("vmac", alg);
 	err = PTR_ERR(inst);
 	if (IS_ERR(inst))


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 016/328] crypto: memzero_explicit - make sure to clear out sensitive data
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (163 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 145/328] netfilter: nf_tables: fix register ordering Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 172/328] USB: net2280: Fix erroneous synchronization change Ben Hutchings
                   ` (162 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Hannes Frederic Sowa, Daniel Borkmann, Theodore Ts'o,
	Herbert Xu, Julia Lawall

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Daniel Borkmann <dborkman@redhat.com>

commit 7185ad2672a7d50bc384de0e38d90b75d99f3d82 upstream.

Recently, in commit 13aa93c70e71 ("random: add and use memzero_explicit()
for clearing data"), we have found that GCC may optimize some memset()
cases away when it detects a stack variable is not being used anymore
and going out of scope. This can happen, for example, in cases when we
are clearing out sensitive information such as keying material or any
e.g. intermediate results from crypto computations, etc.

With the help of Coccinelle, we can figure out and fix such occurences
in the crypto subsytem as well. Julia Lawall provided the following
Coccinelle program:

  @@
  type T;
  identifier x;
  @@

  T x;
  ... when exists
      when any
  -memset
  +memzero_explicit
     (&x,
  -0,
     ...)
  ... when != x
      when strict

  @@
  type T;
  identifier x;
  @@

  T x[...];
  ... when exists
      when any
  -memset
  +memzero_explicit
     (x,
  -0,
     ...)
  ... when != x
      when strict

Therefore, make use of the drop-in replacement memzero_explicit() for
exactly such cases instead of using memset().

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 crypto/cts.c            | 3 ++-
 crypto/sha1_generic.c   | 2 +-
 crypto/sha256_generic.c | 5 ++---
 crypto/sha512_generic.c | 2 +-
 crypto/tgr192.c         | 4 ++--
 crypto/vmac.c           | 2 +-
 crypto/wp512.c          | 8 ++++----
 7 files changed, 13 insertions(+), 13 deletions(-)

--- a/crypto/cts.c
+++ b/crypto/cts.c
@@ -202,7 +202,8 @@ static int cts_cbc_decrypt(struct crypto
 	/* 5. Append the tail (BB - Ln) bytes of Xn (tmp) to Cn to create En */
 	memcpy(s + bsize + lastn, tmp + lastn, bsize - lastn);
 	/* 6. Decrypt En to create Pn-1 */
-	memset(iv, 0, sizeof(iv));
+	memzero_explicit(iv, sizeof(iv));
+
 	sg_set_buf(&sgsrc[0], s + bsize, bsize);
 	sg_set_buf(&sgdst[0], d, bsize);
 	err = crypto_blkcipher_decrypt_iv(&lcldesc, sgdst, sgsrc, bsize);
--- a/crypto/sha1_generic.c
+++ b/crypto/sha1_generic.c
@@ -64,7 +64,7 @@ int crypto_sha1_update(struct shash_desc
 			src = data + done;
 		} while (done + SHA1_BLOCK_SIZE <= len);
 
-		memset(temp, 0, sizeof(temp));
+		memzero_explicit(temp, sizeof(temp));
 		partial = 0;
 	}
 	memcpy(sctx->buffer + partial, src, len - done);
--- a/crypto/sha256_generic.c
+++ b/crypto/sha256_generic.c
@@ -210,10 +210,9 @@ static void sha256_transform(u32 *state,
 
 	/* clear any sensitive info... */
 	a = b = c = d = e = f = g = h = t1 = t2 = 0;
-	memset(W, 0, 64 * sizeof(u32));
+	memzero_explicit(W, 64 * sizeof(u32));
 }
 
-
 static int sha224_init(struct shash_desc *desc)
 {
 	struct sha256_state *sctx = shash_desc_ctx(desc);
@@ -316,7 +315,7 @@ static int sha224_final(struct shash_des
 	sha256_final(desc, D);
 
 	memcpy(hash, D, SHA224_DIGEST_SIZE);
-	memset(D, 0, SHA256_DIGEST_SIZE);
+	memzero_explicit(D, SHA256_DIGEST_SIZE);
 
 	return 0;
 }
--- a/crypto/sha512_generic.c
+++ b/crypto/sha512_generic.c
@@ -238,7 +238,7 @@ static int sha384_final(struct shash_des
 	sha512_final(desc, D);
 
 	memcpy(hash, D, 48);
-	memset(D, 0, 64);
+	memzero_explicit(D, 64);
 
 	return 0;
 }
--- a/crypto/tgr192.c
+++ b/crypto/tgr192.c
@@ -612,7 +612,7 @@ static int tgr160_final(struct shash_des
 
 	tgr192_final(desc, D);
 	memcpy(out, D, TGR160_DIGEST_SIZE);
-	memset(D, 0, TGR192_DIGEST_SIZE);
+	memzero_explicit(D, TGR192_DIGEST_SIZE);
 
 	return 0;
 }
@@ -623,7 +623,7 @@ static int tgr128_final(struct shash_des
 
 	tgr192_final(desc, D);
 	memcpy(out, D, TGR128_DIGEST_SIZE);
-	memset(D, 0, TGR192_DIGEST_SIZE);
+	memzero_explicit(D, TGR192_DIGEST_SIZE);
 
 	return 0;
 }
--- a/crypto/vmac.c
+++ b/crypto/vmac.c
@@ -613,7 +613,7 @@ static int vmac_final(struct shash_desc
 	}
 	mac = vmac(ctx->partial, ctx->partial_size, nonce, NULL, ctx);
 	memcpy(out, &mac, sizeof(vmac_t));
-	memset(&mac, 0, sizeof(vmac_t));
+	memzero_explicit(&mac, sizeof(vmac_t));
 	memset(&ctx->__vmac_ctx, 0, sizeof(struct vmac_ctx));
 	ctx->partial_size = 0;
 	return 0;
--- a/crypto/wp512.c
+++ b/crypto/wp512.c
@@ -1102,8 +1102,8 @@ static int wp384_final(struct shash_desc
 	u8 D[64];
 
 	wp512_final(desc, D);
-	memcpy (out, D, WP384_DIGEST_SIZE);
-	memset (D, 0, WP512_DIGEST_SIZE);
+	memcpy(out, D, WP384_DIGEST_SIZE);
+	memzero_explicit(D, WP512_DIGEST_SIZE);
 
 	return 0;
 }
@@ -1113,8 +1113,8 @@ static int wp256_final(struct shash_desc
 	u8 D[64];
 
 	wp512_final(desc, D);
-	memcpy (out, D, WP256_DIGEST_SIZE);
-	memset (D, 0, WP512_DIGEST_SIZE);
+	memcpy(out, D, WP256_DIGEST_SIZE);
+	memzero_explicit(D, WP512_DIGEST_SIZE);
 
 	return 0;
 }


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 028/328] vxlan: add new fdb alloc and create helpers
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (144 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 019/328] scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 126/328] uprobes: Use synchronize_rcu() not synchronize_sched() Ben Hutchings
                   ` (181 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, David S. Miller, Roopa Prabhu

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Roopa Prabhu <roopa@cumulusnetworks.com>

commit 25e20e730d56471cffa25419bf2a66078bd55330 upstream.

- Add new vxlan_fdb_alloc helper
- rename existing vxlan_fdb_create into vxlan_fdb_update:
        because it really creates or updates an existing
        fdb entry
- move new fdb creation into a separate vxlan_fdb_create

Main motivation for this change is to introduce the ability
to decouple vxlan fdb creation and notify, used in a later patch.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16:
 - s/vxlan->cfg\.addrmax/vxlan->addrmax/g
 - Drop src_vni parameters and initialisation of vxlan_fdb::vni
 - Drop last argument to vxlan_fdb_head()
 - Drop change to vxlan_changelink()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/net/vxlan.c | 91 ++++++++++++++++++++++++++++++---------------
 1 file changed, 62 insertions(+), 29 deletions(-)

--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -685,9 +685,60 @@ static void vxlan_notify_del_rx_port(str
 		udp_del_offload(&vs->udp_offloads);
 }
 
-/* Add new entry to forwarding table -- assumes lock held */
+static struct vxlan_fdb *vxlan_fdb_alloc(struct vxlan_dev *vxlan,
+					 const u8 *mac, __u16 state,
+					 __u8 ndm_flags)
+{
+	struct vxlan_fdb *f;
+
+	f = kmalloc(sizeof(*f), GFP_ATOMIC);
+	if (!f)
+		return NULL;
+	f->state = state;
+	f->flags = ndm_flags;
+	f->updated = f->used = jiffies;
+	INIT_LIST_HEAD(&f->remotes);
+	memcpy(f->eth_addr, mac, ETH_ALEN);
+
+	return f;
+}
+
 static int vxlan_fdb_create(struct vxlan_dev *vxlan,
 			    const u8 *mac, union vxlan_addr *ip,
+			    __u16 state, __be16 port,
+			    __be32 vni, __u32 ifindex, __u8 ndm_flags,
+			    struct vxlan_fdb **fdb)
+{
+	struct vxlan_rdst *rd = NULL;
+	struct vxlan_fdb *f;
+	int rc;
+
+	if (vxlan->addrmax && vxlan->addrcnt >= vxlan->addrmax)
+		return -ENOSPC;
+
+	netdev_dbg(vxlan->dev, "add %pM -> %pIS\n", mac, ip);
+	f = vxlan_fdb_alloc(vxlan, mac, state, ndm_flags);
+	if (!f)
+		return -ENOMEM;
+
+	rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
+	if (rc < 0) {
+		kfree(f);
+		return rc;
+	}
+
+	++vxlan->addrcnt;
+	hlist_add_head_rcu(&f->hlist,
+			   vxlan_fdb_head(vxlan, mac));
+
+	*fdb = f;
+
+	return 0;
+}
+
+/* Add new entry to forwarding table -- assumes lock held */
+static int vxlan_fdb_update(struct vxlan_dev *vxlan,
+			    const u8 *mac, union vxlan_addr *ip,
 			    __u16 state, __u16 flags,
 			    __be16 port, __u32 vni, __u32 ifindex,
 			    __u8 ndm_flags)
@@ -740,35 +791,17 @@ static int vxlan_fdb_create(struct vxlan
 		if (!(flags & NLM_F_CREATE))
 			return -ENOENT;
 
-		if (vxlan->addrmax && vxlan->addrcnt >= vxlan->addrmax)
-			return -ENOSPC;
-
 		/* Disallow replace to add a multicast entry */
 		if ((flags & NLM_F_REPLACE) &&
 		    (is_multicast_ether_addr(mac) || is_zero_ether_addr(mac)))
 			return -EOPNOTSUPP;
 
 		netdev_dbg(vxlan->dev, "add %pM -> %pIS\n", mac, ip);
-		f = kmalloc(sizeof(*f), GFP_ATOMIC);
-		if (!f)
-			return -ENOMEM;
-
-		notify = 1;
-		f->state = state;
-		f->flags = ndm_flags;
-		f->updated = f->used = jiffies;
-		INIT_LIST_HEAD(&f->remotes);
-		memcpy(f->eth_addr, mac, ETH_ALEN);
-
-		rc = vxlan_fdb_append(f, ip, port, vni, ifindex, &rd);
-		if (rc < 0) {
-			kfree(f);
+		rc = vxlan_fdb_create(vxlan, mac, ip, state, port,
+				      vni, ifindex, ndm_flags, &f);
+		if (rc < 0)
 			return rc;
-		}
-
-		++vxlan->addrcnt;
-		hlist_add_head_rcu(&f->hlist,
-				   vxlan_fdb_head(vxlan, mac));
+		notify = 1;
 	}
 
 	if (notify) {
@@ -886,7 +919,7 @@ static int vxlan_fdb_add(struct ndmsg *n
 		return -EAFNOSUPPORT;
 
 	spin_lock_bh(&vxlan->hash_lock);
-	err = vxlan_fdb_create(vxlan, addr, &ip, ndm->ndm_state, flags,
+	err = vxlan_fdb_update(vxlan, addr, &ip, ndm->ndm_state, flags,
 			       port, vni, ifindex, ndm->ndm_flags);
 	spin_unlock_bh(&vxlan->hash_lock);
 
@@ -1012,7 +1045,7 @@ static bool vxlan_snoop(struct net_devic
 
 		/* close off race between vxlan_flush and incoming packets */
 		if (netif_running(dev))
-			vxlan_fdb_create(vxlan, src_mac, src_ip,
+			vxlan_fdb_update(vxlan, src_mac, src_ip,
 					 NUD_REACHABLE,
 					 NLM_F_EXCL|NLM_F_CREATE,
 					 vxlan->dst_port,
@@ -2718,7 +2751,7 @@ static int vxlan_newlink(struct net *net
 
 	/* create an fdb entry for a valid default destination */
 	if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
-		err = vxlan_fdb_create(vxlan, all_zeros_mac,
+		err = vxlan_fdb_update(vxlan, all_zeros_mac,
 				       &vxlan->default_dst.remote_ip,
 				       NUD_REACHABLE|NUD_PERMANENT,
 				       NLM_F_EXCL|NLM_F_CREATE,


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 001/328] EDAC: Fix memleak in module init error path
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (53 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 099/328] crypto: blkcipher - fix crash flushing dcache in error path Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 229/328] drm/i915/bdw: Increase IPS disable timeout to 100ms Ben Hutchings
                   ` (272 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Denis Kirjanov, Borislav Petkov, linux-edac,
	Mauro Carvalho Chehab, Johan Hovold

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 4708aa85d50cc6e962dfa8acf5ad4e0d290a21db upstream.

Make sure to use put_device() to free the initialised struct device so
that resources managed by driver core also gets released in the event of
a registration failure.

Signed-off-by: Johan Hovold <johan@kernel.org>
Cc: Denis Kirjanov <kirjanov@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>
Fixes: 2d56b109e3a5 ("EDAC: Handle error path in edac_mc_sysfs_init() properly")
Link: http://lkml.kernel.org/r/20180612124335.6420-1-johan@kernel.org
Signed-off-by: Borislav Petkov <bp@suse.de>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/edac/edac_mc_sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -1161,14 +1161,14 @@ int __init edac_mc_sysfs_init(void)
 
 	err = device_add(mci_pdev);
 	if (err < 0)
-		goto out_dev_free;
+		goto out_put_device;
 
 	edac_dbg(0, "device %s created\n", dev_name(mci_pdev));
 
 	return 0;
 
- out_dev_free:
-	kfree(mci_pdev);
+ out_put_device:
+	put_device(mci_pdev);
  out_put_sysfs:
 	edac_put_sysfs_subsys();
  out:


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 029/328] vxlan: fix default fdb entry netlink notify ordering during netdev create
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (117 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 096/328] scsi: sysfs: Introduce sysfs_{un,}break_active_protection() Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 134/328] KVM: arm/arm64: Skip updating PTE entry if no change Ben Hutchings
                   ` (208 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Roopa Prabhu, David S. Miller

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Roopa Prabhu <roopa@cumulusnetworks.com>

commit 0241b836732f5f43c3f0fd9e9073c1fb24ea6757 upstream.

Problem:
In vxlan_newlink, a default fdb entry is added before register_netdev.
The default fdb creation function also notifies user-space of the
fdb entry on the vxlan device which user-space does not know about yet.
(RTM_NEWNEIGH goes before RTM_NEWLINK for the same ifindex).

This patch fixes the user-space netlink notification ordering issue
with the following changes:
- decouple fdb notify from fdb create.
- Move fdb notify after register_netdev.
- Call rtnl_configure_link in vxlan newlink handler to notify
userspace about the newlink before fdb notify and
hence avoiding the user-space race.

Fixes: afbd8bae9c79 ("vxlan: add implicit fdb entry for default destination")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16:
 - Drop changes to vxlan_changelink()
 - Drop last argument to vxlan_fdb_destroy()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2614,6 +2614,7 @@ static int vxlan_newlink(struct net *net
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	struct vxlan_dev *vxlan = netdev_priv(dev), *tmp;
 	struct vxlan_rdst *dst = &vxlan->default_dst;
+	struct vxlan_fdb *f = NULL;
 	__u32 vni;
 	int err;
 	bool use_ipv6 = false;
@@ -2751,27 +2752,38 @@ static int vxlan_newlink(struct net *net
 
 	/* create an fdb entry for a valid default destination */
 	if (!vxlan_addr_any(&vxlan->default_dst.remote_ip)) {
-		err = vxlan_fdb_update(vxlan, all_zeros_mac,
+		err = vxlan_fdb_create(vxlan, all_zeros_mac,
 				       &vxlan->default_dst.remote_ip,
 				       NUD_REACHABLE|NUD_PERMANENT,
-				       NLM_F_EXCL|NLM_F_CREATE,
 				       vxlan->dst_port,
 				       vxlan->default_dst.remote_vni,
 				       vxlan->default_dst.remote_ifindex,
-				       NTF_SELF);
+				       NTF_SELF, &f);
 		if (err)
 			return err;
 	}
 
 	err = register_netdevice(dev);
+	if (err)
+		goto errout;
+
+	err = rtnl_configure_link(dev, NULL);
 	if (err) {
-		vxlan_fdb_delete_default(vxlan);
-		return err;
+		unregister_netdevice(dev);
+		goto errout;
 	}
 
+	/* notify default fdb entry */
+	if (f)
+		vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), RTM_NEWNEIGH);
+
 	list_add(&vxlan->next, &vn->vxlan_list);
 
 	return 0;
+errout:
+	if (f)
+		vxlan_fdb_destroy(vxlan, f);
+	return err;
 }
 
 static void vxlan_dellink(struct net_device *dev, struct list_head *head)


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 011/328] serial: pxa: Fix an error handling path in 'serial_pxa_probe()'
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (29 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 292/328] drm: fb-helper: Reject all pixel format changing requests Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 114/328] powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX Ben Hutchings
                   ` (296 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman, Christophe JAILLET

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

commit 95a0e656580fab3128c7bee5f660c50784f53651 upstream.

If port.line is out of range, we still need to release some resources, or
we will leak them.

Fixes: afc7851fab83 ("serial: pxa: Fix out-of-bounds access through serial port index")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/tty/serial/pxa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -890,7 +890,8 @@ static int serial_pxa_probe(struct platf
 		goto err_clk;
 	if (sport->port.line >= ARRAY_SIZE(serial_pxa_ports)) {
 		dev_err(&dev->dev, "serial%d out of range\n", sport->port.line);
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_clk;
 	}
 	snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1);
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 019/328] scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (143 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 287/328] perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 028/328] vxlan: add new fdb alloc and create helpers Ben Hutchings
                   ` (182 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, Bart Van Assche, Martin K. Petersen, Mike Christie,
	Hannes Reinecke, Christoph Hellwig

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Bart Van Assche <bart.vanassche@wdc.com>

commit 35bea5c84fd13c643cce63f0b5cd4b148f8c901d upstream.

Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/target/iscsi/iscsi_target_tpg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -652,8 +652,7 @@ int iscsit_ta_authentication(struct iscs
 		none = strstr(buf1, NONE);
 		if (none)
 			goto out;
-		strncat(buf1, ",", strlen(","));
-		strncat(buf1, NONE, strlen(NONE));
+		strlcat(buf1, "," NONE, sizeof(buf1));
 		if (iscsi_update_param_value(param, buf1) < 0)
 			return -EINVAL;
 	}


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 003/328] EDAC, i7core: Fix memleaks and use-after-free on probe and remove
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (46 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 274/328] sr9800: Check for supported Wake-on-LAN modes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 165/328] x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+ Ben Hutchings
                   ` (279 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: akpm, linux-edac, Borislav Petkov, Johan Hovold, Mauro Carvalho Chehab

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Johan Hovold <johan@kernel.org>

commit 6c974d4dfafe5e9ee754f2a6fba0eb1864f1649e upstream.

Make sure to free and deregister the addrmatch and chancounts devices
allocated during probe in all error paths. Also fix use-after-free in a
probe error path and in the remove success path where the devices were
being put before before deregistration.

Signed-off-by: Johan Hovold <johan@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>
Fixes: 356f0a30860d ("i7core_edac: change the mem allocation scheme to make Documentation/kobject.txt happy")
Link: http://lkml.kernel.org/r/20180612124335.6420-2-johan@kernel.org
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/edac/i7core_edac.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1190,15 +1190,14 @@ static int i7core_create_sysfs_devices(s
 
 	rc = device_add(pvt->addrmatch_dev);
 	if (rc < 0)
-		return rc;
+		goto err_put_addrmatch;
 
 	if (!pvt->is_registered) {
 		pvt->chancounts_dev = kzalloc(sizeof(*pvt->chancounts_dev),
 					      GFP_KERNEL);
 		if (!pvt->chancounts_dev) {
-			put_device(pvt->addrmatch_dev);
-			device_del(pvt->addrmatch_dev);
-			return -ENOMEM;
+			rc = -ENOMEM;
+			goto err_del_addrmatch;
 		}
 
 		pvt->chancounts_dev->type = &all_channel_counts_type;
@@ -1212,9 +1211,18 @@ static int i7core_create_sysfs_devices(s
 
 		rc = device_add(pvt->chancounts_dev);
 		if (rc < 0)
-			return rc;
+			goto err_put_chancounts;
 	}
 	return 0;
+
+err_put_chancounts:
+	put_device(pvt->chancounts_dev);
+err_del_addrmatch:
+	device_del(pvt->addrmatch_dev);
+err_put_addrmatch:
+	put_device(pvt->addrmatch_dev);
+
+	return rc;
 }
 
 static void i7core_delete_sysfs_devices(struct mem_ctl_info *mci)
@@ -1229,11 +1237,11 @@ static void i7core_delete_sysfs_devices(
 	device_remove_file(&mci->dev, &dev_attr_inject_enable);
 
 	if (!pvt->is_registered) {
-		put_device(pvt->chancounts_dev);
 		device_del(pvt->chancounts_dev);
+		put_device(pvt->chancounts_dev);
 	}
-	put_device(pvt->addrmatch_dev);
 	device_del(pvt->addrmatch_dev);
+	put_device(pvt->addrmatch_dev);
 }
 
 /****************************************************************************


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 002/328] EDAC: i7core: Return proper error codes for kzalloc() errors
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (167 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 063/328] udlfb: handle allocation failure Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 294/328] team: Forbid enslaving team device to itself Ben Hutchings
                   ` (158 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai, Borislav Petkov

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit e97d7e38162dc305b4734a316ca758a2bbd1fa6e upstream.

... instead of possibly uninitialized return value.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: http://lkml.kernel.org/r/1423046938-18111-5-git-send-email-tiwai@suse.de
[ Add a commit message, albeit a small one. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/edac/i7core_edac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1177,7 +1177,7 @@ static int i7core_create_sysfs_devices(s
 
 	pvt->addrmatch_dev = kzalloc(sizeof(*pvt->addrmatch_dev), GFP_KERNEL);
 	if (!pvt->addrmatch_dev)
-		return rc;
+		return -ENOMEM;
 
 	pvt->addrmatch_dev->type = &addrmatch_type;
 	pvt->addrmatch_dev->bus = mci->dev.bus;
@@ -1198,7 +1198,7 @@ static int i7core_create_sysfs_devices(s
 		if (!pvt->chancounts_dev) {
 			put_device(pvt->addrmatch_dev);
 			device_del(pvt->addrmatch_dev);
-			return rc;
+			return -ENOMEM;
 		}
 
 		pvt->chancounts_dev->type = &all_channel_counts_type;


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 008/328] platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (261 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 138/328] ubifs: Fix synced_i_size calculation for xattr inodes Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 285/328] net: sched: act_ipt: check for underflow in __tcf_ipt_init() Ben Hutchings
                   ` (64 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Andy Shevchenko, Olle Liljenzin

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Olle Liljenzin <olle@liljenzin.se>

commit 5d9f40b56630a8702b5f7a61a770f9b73aa07464 upstream.

Lenovo Legion Y520-15IKBN is yet another Lenovo model that does not
have an hw rfkill switch, resulting in wifi always reported as hard
blocked.

Add the model to the list of models without rfkill switch.

Signed-off-by: Olle Liljenzin <olle@liljenzin.se>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 drivers/platform/x86/ideapad-laptop.c | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -860,6 +860,13 @@ static struct dmi_system_id no_hw_rfkill
 		},
 	},
 	{
+		.ident = "Lenovo Legion Y520-15IKBN",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Y520-15IKBN"),
+		},
+	},
+	{
 		.ident = "Lenovo Yoga 2 11 / 13 / Pro",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 013/328] ALSA: snd-aoa: add of_node_put() in error path
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (238 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 059/328] udlfb: fix display corruption of the last line Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 015/328] crypto: vmac - require a block cipher with 128-bit block size Ben Hutchings
                   ` (87 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Takashi Iwai, Nicholas Mc Guire

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Mc Guire <hofrat@osadl.org>

commit 222bce5eb88d1af656419db04bcd84b2419fb900 upstream.

 Both calls to of_find_node_by_name() and of_get_next_child() return a
node pointer with refcount incremented thus it must be explicidly
decremented here after the last usage. As we are assured to have a
refcounted  np  either from the initial
of_find_node_by_name(NULL, name); or from the of_get_next_child(gpio, np)
in the while loop if we reached the error code path below, an
x of_node_put(np) is needed.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Fixes: commit f3d9478b2ce4 ("[ALSA] snd-aoa: add snd-aoa")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 sound/aoa/core/gpio-feature.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/sound/aoa/core/gpio-feature.c
+++ b/sound/aoa/core/gpio-feature.c
@@ -88,8 +88,10 @@ static struct device_node *get_gpio(char
 	}
 
 	reg = of_get_property(np, "reg", NULL);
-	if (!reg)
+	if (!reg) {
+		of_node_put(np);
 		return NULL;
+	}
 
 	*gpioptr = *reg;
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* [PATCH 3.16 006/328] s390/qdio: reset old sbal_state flags
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (309 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 325/328] mm: cleancache: fix corruption on missed inode invalidation Ben Hutchings
@ 2018-12-09 21:50 ` Ben Hutchings
  2018-12-09 21:50 ` [PATCH 3.16 107/328] net: mac802154: tx: expand tailroom if necessary Ben Hutchings
                   ` (16 subsequent siblings)
  327 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-09 21:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: akpm, Martin Schwidefsky, Julian Wiedmann

3.16.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Julian Wiedmann <jwi@linux.ibm.com>

commit 64e03ff72623b8c2ea89ca3cb660094e019ed4ae upstream.

When allocating a new AOB fails, handle_outbound() is still capable of
transmitting the selected buffer (just without async completion).

But if a previous transfer on this queue slot used async completion, its
sbal_state flags field is still set to QDIO_OUTBUF_STATE_FLAG_PENDING.
So when the upper layer driver sees this stale flag, it expects an async
completion that never happens.

Fix this by unconditionally clearing the flags field.

Fixes: 104ea556ee7f ("qdio: support asynchronous delivery of storage blocks")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/s390/include/asm/qdio.h | 1 -
 drivers/s390/cio/qdio_main.c | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -271,7 +271,6 @@ struct qdio_outbuf_state {
 	void *user;
 };
 
-#define QDIO_OUTBUF_STATE_FLAG_NONE	0x00
 #define QDIO_OUTBUF_STATE_FLAG_PENDING	0x01
 
 #define CHSC_AC1_INITIATE_INPUTQ	0x80
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -640,21 +640,20 @@ static inline unsigned long qdio_aob_for
 	unsigned long phys_aob = 0;
 
 	if (!q->use_cq)
-		goto out;
+		return 0;
 
 	if (!q->aobs[bufnr]) {
 		struct qaob *aob = qdio_allocate_aob();
 		q->aobs[bufnr] = aob;
 	}
 	if (q->aobs[bufnr]) {
-		q->sbal_state[bufnr].flags = QDIO_OUTBUF_STATE_FLAG_NONE;
 		q->sbal_state[bufnr].aob = q->aobs[bufnr];
 		q->aobs[bufnr]->user1 = (u64) q->sbal_state[bufnr].user;
 		phys_aob = virt_to_phys(q->aobs[bufnr]);
 		WARN_ON_ONCE(phys_aob & 0xFF);
 	}
 
-out:
+	q->sbal_state[bufnr].flags = 0;
 	return phys_aob;
 }
 


^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs
  2018-12-09 21:50 ` [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs Ben Hutchings
@ 2018-12-09 21:57   ` Nadav Amit
  2018-12-16 22:01     ` Ben Hutchings
  0 siblings, 1 reply; 338+ messages in thread
From: Nadav Amit @ 2018-12-09 21:57 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: LKML, stable, Andrew Morton, Dave Hansen, Vlastimil Babka,
	Andi Kleen, Peter Zijlstra (Intel),
	Josh Poimboeuf, Thomas Gleixner, Sean Christopherson,
	Michal Hocko, Andy Lutomirski

This patch causes some sparse warnings. If you want to wait, I’ll send a
patch to fix it. (No expected functional impact though).


> On Dec 9, 2018, at 1:50 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
> 
> 3.16.62-rc1 review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Nadav Amit <namit@vmware.com>
> 
> commit 9bc4f28af75a91aea0ae383f50b0a430c4509303 upstream.
> 
> When page-table entries are set, the compiler might optimize their
> assignment by using multiple instructions to set the PTE. This might
> turn into a security hazard if the user somehow manages to use the
> interim PTE. L1TF does not make our lives easier, making even an interim
> non-present PTE a security hazard.
> 
> Using WRITE_ONCE() to set PTEs and friends should prevent this potential
> security hazard.
> 
> I skimmed the differences in the binary with and without this patch. The
> differences are (obviously) greater when CONFIG_PARAVIRT=n as more
> code optimizations are possible. For better and worse, the impact on the
> binary with this patch is pretty small. Skimming the code did not cause
> anything to jump out as a security hazard, but it seems that at least
> move_soft_dirty_pte() caused set_pte_at() to use multiple writes.
> 
> Signed-off-by: Nadav Amit <namit@vmware.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: Andi Kleen <ak@linux.intel.com>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> Cc: Andy Lutomirski <luto@kernel.org>
> Link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.kernel.org%2Fr%2F20180902181451.80520-1-namit%40vmware.com&amp;data=02%7C01%7Cnamit%40vmware.com%7C714a85e56274491706a408d65e210edd%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636799893436192539&amp;sdata=QNA9jX%2FSAai7zpZeNn%2FosXL%2BrjkG2lYfDVVUN9Etm0A%3D&amp;reserved=0
> [bwh: Backported to 3.16:
> - Use ACCESS_ONCE() instead of WRITE_ONCE()
> - Drop changes in pmdp_establish(), native_set_p4d(), pudp_set_access_flags()]
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> --- a/arch/x86/include/asm/pgtable_64.h
> +++ b/arch/x86/include/asm/pgtable_64.h
> @@ -44,15 +44,15 @@ struct mm_struct;
> void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
> 
> 
> -static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
> -				    pte_t *ptep)
> +static inline void native_set_pte(pte_t *ptep, pte_t pte)
> {
> -	*ptep = native_make_pte(0);
> +	ACCESS_ONCE(*ptep) = pte;
> }
> 
> -static inline void native_set_pte(pte_t *ptep, pte_t pte)
> +static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
> +				    pte_t *ptep)
> {
> -	*ptep = pte;
> +	native_set_pte(ptep, native_make_pte(0));
> }
> 
> static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
> @@ -62,7 +62,7 @@ static inline void native_set_pte_atomic
> 
> static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
> {
> -	*pmdp = pmd;
> +	ACCESS_ONCE(*pmdp) = pmd;
> }
> 
> static inline void native_pmd_clear(pmd_t *pmd)
> @@ -98,7 +98,7 @@ static inline pmd_t native_pmdp_get_and_
> 
> static inline void native_set_pud(pud_t *pudp, pud_t pud)
> {
> -	*pudp = pud;
> +	ACCESS_ONCE(*pudp) = pud;
> }
> 
> static inline void native_pud_clear(pud_t *pud)
> @@ -131,7 +131,7 @@ static inline pgd_t *native_get_shadow_p
> 
> static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
> {
> -	*pgdp = kaiser_set_shadow_pgd(pgdp, pgd);
> +	ACCESS_ONCE(*pgdp) = kaiser_set_shadow_pgd(pgdp, pgd);
> }
> 
> static inline void native_pgd_clear(pgd_t *pgd)
> --- a/arch/x86/mm/pgtable.c
> +++ b/arch/x86/mm/pgtable.c
> @@ -242,7 +242,7 @@ static void pgd_mop_up_pmds(struct mm_st
> 		if (pgd_val(pgd) != 0) {
> 			pmd_t *pmd = (pmd_t *)pgd_page_vaddr(pgd);
> 
> -			pgdp[i] = native_make_pgd(0);
> +			pgd_clear(&pgdp[i]);
> 
> 			paravirt_release_pmd(pgd_val(pgd) >> PAGE_SHIFT);
> 			pmd_free(mm, pmd);
> @@ -352,7 +352,7 @@ int ptep_set_access_flags(struct vm_area
> 	int changed = !pte_same(*ptep, entry);
> 
> 	if (changed && dirty) {
> -		*ptep = entry;
> +		set_pte(ptep, entry);
> 		pte_update_defer(vma->vm_mm, address, ptep);
> 	}
> 
> @@ -369,7 +369,7 @@ int pmdp_set_access_flags(struct vm_area
> 	VM_BUG_ON(address & ~HPAGE_PMD_MASK);
> 
> 	if (changed && dirty) {
> -		*pmdp = entry;
> +		set_pmd(pmdp, entry);
> 		pmd_update_defer(vma->vm_mm, address, pmdp);
> 		/*
> 		 * We had a write-protection fault here and changed the pmd



^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 047/328] xen-netfront: fix queue name setting
  2018-12-09 21:50 ` [PATCH 3.16 047/328] xen-netfront: fix queue name setting Ben Hutchings
@ 2018-12-09 23:24   ` Vitaly Kuznetsov
  2018-12-16 21:42     ` Ben Hutchings
  0 siblings, 1 reply; 338+ messages in thread
From: Vitaly Kuznetsov @ 2018-12-09 23:24 UTC (permalink / raw)
  To: Ben Hutchings, linux-kernel, stable; +Cc: akpm, David S. Miller, Ross Lagerwall

Ben Hutchings <ben@decadent.org.uk> writes:

> 3.16.62-rc1 review patch.  If anyone has any objections, please let me know.
>
> ------------------
>
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> commit 2d408c0d4574b01b9ed45e02516888bf925e11a9 upstream.
>
> Commit f599c64fdf7d ("xen-netfront: Fix race between device setup and
> open") changed the initialization order: xennet_create_queues() now
> happens before we do register_netdev() so using netdev->name in
> xennet_init_queue() is incorrect, we end up with the following in
> /proc/interrupts:
>
>  60:        139          0   xen-dyn    -event     eth%d-q0-tx
>  61:        265          0   xen-dyn    -event     eth%d-q0-rx
>  62:        234          0   xen-dyn    -event     eth%d-q1-tx
>  63:          1          0   xen-dyn    -event     eth%d-q1-rx
>
> and this looks ugly. Actually, using early netdev name (even when it's
> already set) is also not ideal: nowadays we tend to rename eth devices
> and queue name may end up not corresponding to the netdev name.
>
> Use nodename from xenbus device for queue naming: this can't change in VM's
> lifetime. Now /proc/interrupts looks like
>
>  62:        202          0   xen-dyn    -event     device/vif/0-q0-tx
>  63:        317          0   xen-dyn    -event     device/vif/0-q0-rx
>  64:        262          0   xen-dyn    -event     device/vif/0-q1-tx
>  65:         17          0   xen-dyn    -event     device/vif/0-q1-rx
>
> Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
>  drivers/net/xen-netfront.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -1646,7 +1646,7 @@ static int xennet_init_queue(struct netf
>  	queue->rx_refill_timer.function = rx_refill_timeout;
>  
>  	snprintf(queue->name, sizeof(queue->name), "%s-q%u",
> -		 queue->info->netdev->name, queue->id);
> +		 queue->info->xbdev->nodename, queue->id);
>  
>  	/* Initialise tx_skbs as a free chain containing every entry. */
>  	queue->tx_skb_freelist = 0;
>

We should also take 

commit 21f2706b20100bb3db378461ab9b8e2035309b5b
Author: Xiao Liang <xiliang@redhat.com>
Date:   Tue Aug 14 23:21:28 2018 +0800

    xen-netfront: fix warn message as irq device name has '/'

as it fixes an issue introduced by the commit in question. Sorry if this
is already in your series but I wasn't CCed on it.

-- 
Vitaly

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 000/328] 3.16.62-rc1 review
  2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
                   ` (326 preceding siblings ...)
  2018-12-09 21:50 ` [PATCH 3.16 186/328] spi: tegra20-slink: explicitly enable/disable clock Ben Hutchings
@ 2018-12-10 16:54 ` Guenter Roeck
  2018-12-10 19:06   ` Ben Hutchings
  327 siblings, 1 reply; 338+ messages in thread
From: Guenter Roeck @ 2018-12-10 16:54 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linux-kernel, stable, torvalds, akpm

On Sun, Dec 09, 2018 at 09:50:32PM +0000, Ben Hutchings wrote:
> This is the start of the stable review cycle for the 3.16.62 release.
> There are 328 patches in this series, which will be posted as responses
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri Dec 14 18:00:00 UTC 2018.
> Anything received after that time might be too late.
> 

Build results:
	total: 136 pass: 135 fail: 1
Failed builds: 
	i386:tools/perf 
Qemu test results:
	total: 219 pass: 219 fail: 0

Details are available at https://kerneltests.org/builders/.

Guenter

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 000/328] 3.16.62-rc1 review
  2018-12-10 16:54 ` [PATCH 3.16 000/328] 3.16.62-rc1 review Guenter Roeck
@ 2018-12-10 19:06   ` Ben Hutchings
  2018-12-10 20:36     ` Guenter Roeck
  0 siblings, 1 reply; 338+ messages in thread
From: Ben Hutchings @ 2018-12-10 19:06 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, stable, torvalds, akpm

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

On Mon, 2018-12-10 at 08:54 -0800, Guenter Roeck wrote:
> On Sun, Dec 09, 2018 at 09:50:32PM +0000, Ben Hutchings wrote:
> > This is the start of the stable review cycle for the 3.16.62 release.
> > There are 328 patches in this series, which will be posted as responses
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Fri Dec 14 18:00:00 UTC 2018.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
> 	total: 136 pass: 135 fail: 1

This is the i386 perf build which never succeeded yet, right?

> Failed builds: 
> 	i386:tools/perf 
> Qemu test results:
> 	total: 219 pass: 219 fail: 0
> 
> Details are available at https://kerneltests.org/builders/.

Thanks for checking.

Ben.

-- 
Ben Hutchings
Beware of bugs in the above code;
I have only proved it correct, not tried it. - Donald Knuth



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 000/328] 3.16.62-rc1 review
  2018-12-10 19:06   ` Ben Hutchings
@ 2018-12-10 20:36     ` Guenter Roeck
  2018-12-16 21:36       ` Ben Hutchings
  0 siblings, 1 reply; 338+ messages in thread
From: Guenter Roeck @ 2018-12-10 20:36 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linux-kernel, stable, torvalds, akpm

On Mon, Dec 10, 2018 at 07:06:41PM +0000, Ben Hutchings wrote:
> On Mon, 2018-12-10 at 08:54 -0800, Guenter Roeck wrote:
> > On Sun, Dec 09, 2018 at 09:50:32PM +0000, Ben Hutchings wrote:
> > > This is the start of the stable review cycle for the 3.16.62 release.
> > > There are 328 patches in this series, which will be posted as responses
> > > to this one.  If anyone has any issues with these being applied, please
> > > let me know.
> > > 
> > > Responses should be made by Fri Dec 14 18:00:00 UTC 2018.
> > > Anything received after that time might be too late.
> > > 
> > 
> > Build results:
> > 	total: 136 pass: 135 fail: 1
> 
> This is the i386 perf build which never succeeded yet, right?
> 

Correct. Should I disable the test ?

> > Failed builds: 
> > 	i386:tools/perf 
> > Qemu test results:
> > 	total: 219 pass: 219 fail: 0
> > 
> > Details are available at https://kerneltests.org/builders/.
> 
> Thanks for checking.
> 
My pleasure.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 038/328] tty: fix typo in comment of tty_termios_encode_baud_rate
  2018-12-09 21:50 ` [PATCH 3.16 038/328] tty: fix typo in comment of tty_termios_encode_baud_rate Ben Hutchings
@ 2018-12-12 13:57   ` Matthias Brugger
  2018-12-14  1:40     ` Ben Hutchings
  0 siblings, 1 reply; 338+ messages in thread
From: Matthias Brugger @ 2018-12-12 13:57 UTC (permalink / raw)
  To: Ben Hutchings, linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman



On 09/12/2018 22:50, Ben Hutchings wrote:
> 3.16.62-rc1 review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Matthias Brugger <matthias.bgg@gmail.com>
> 
> commit a1d51aa2214cea3f91611893610a2f769cada0e7 upstream.
> 
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
>  drivers/tty/tty_ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/tty/tty_ioctl.c
> +++ b/drivers/tty/tty_ioctl.c
> @@ -408,7 +408,7 @@ void tty_termios_encode_baud_rate(struct
>  
>  #ifdef BOTHER
>  	/* If the user asked for a precise weird speed give a precise weird
> -	   answer. If they asked for a Bfoo speed they many have problems
> +	   answer. If they asked for a Bfoo speed they may have problems

I don't think fixes of comments are good candidates for stable.

Regards,
Matthias

>  	   digesting non-exact replies so fuzz a bit */
>  
>  	if ((termios->c_cflag & CBAUD) == BOTHER)
> 

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 038/328] tty: fix typo in comment of tty_termios_encode_baud_rate
  2018-12-12 13:57   ` Matthias Brugger
@ 2018-12-14  1:40     ` Ben Hutchings
  0 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-14  1:40 UTC (permalink / raw)
  To: Matthias Brugger, linux-kernel, stable; +Cc: akpm, Greg Kroah-Hartman

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

On Wed, 2018-12-12 at 14:57 +0100, Matthias Brugger wrote:
> 
> On 09/12/2018 22:50, Ben Hutchings wrote:
> > 3.16.62-rc1 review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Matthias Brugger <matthias.bgg@gmail.com>
> > 
> > commit a1d51aa2214cea3f91611893610a2f769cada0e7 upstream.
> > 
> > Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> > ---
> >  drivers/tty/tty_ioctl.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > --- a/drivers/tty/tty_ioctl.c
> > +++ b/drivers/tty/tty_ioctl.c
> > @@ -408,7 +408,7 @@ void tty_termios_encode_baud_rate(struct
> >  
> >  #ifdef BOTHER
> >  	/* If the user asked for a precise weird speed give a precise weird
> > -	   answer. If they asked for a Bfoo speed they many have problems
> > +	   answer. If they asked for a Bfoo speed they may have problems
> 
> I don't think fixes of comments are good candidates for stable.

I agree in general, but this allows commit 1cee38f0363a "tty: fix
termios input-speed encoding when using BOTHER" to apply more cleanly.

Ben.

> Regards,
> Matthias
> 
> >  	   digesting non-exact replies so fuzz a bit */
> >  
> >  	if ((termios->c_cflag & CBAUD) == BOTHER)
> > 
-- 
Ben Hutchings
If more than one person is responsible for a bug, no one is at fault.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 000/328] 3.16.62-rc1 review
  2018-12-10 20:36     ` Guenter Roeck
@ 2018-12-16 21:36       ` Ben Hutchings
  0 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-16 21:36 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-kernel, stable, torvalds, akpm

[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]

On Mon, 2018-12-10 at 12:36 -0800, Guenter Roeck wrote:
> On Mon, Dec 10, 2018 at 07:06:41PM +0000, Ben Hutchings wrote:
> > On Mon, 2018-12-10 at 08:54 -0800, Guenter Roeck wrote:
> > > On Sun, Dec 09, 2018 at 09:50:32PM +0000, Ben Hutchings wrote:
> > > > This is the start of the stable review cycle for the 3.16.62 release.
> > > > There are 328 patches in this series, which will be posted as responses
> > > > to this one.  If anyone has any issues with these being applied, please
> > > > let me know.
> > > > 
> > > > Responses should be made by Fri Dec 14 18:00:00 UTC 2018.
> > > > Anything received after that time might be too late.
> > > > 
> > > 
> > > Build results:
> > > 	total: 136 pass: 135 fail: 1
> > 
> > This is the i386 perf build which never succeeded yet, right?
> > 
> 
> Correct. Should I disable the test ?

I'll try to fix it, but not in this cycle.

Ben.

> > > Failed builds: 
> > > 	i386:tools/perf 
> > > Qemu test results:
> > > 	total: 219 pass: 219 fail: 0
> > > 
> > > Details are available at https://kerneltests.org/builders/.
> > 
> > Thanks for checking.
> > 
> My pleasure.
> 
> Thanks,
> Guenter
-- 
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 047/328] xen-netfront: fix queue name setting
  2018-12-09 23:24   ` Vitaly Kuznetsov
@ 2018-12-16 21:42     ` Ben Hutchings
  0 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-16 21:42 UTC (permalink / raw)
  To: Vitaly Kuznetsov, linux-kernel, stable
  Cc: akpm, David S. Miller, Ross Lagerwall

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

On Mon, 2018-12-10 at 00:24 +0100, Vitaly Kuznetsov wrote:
> Ben Hutchings <ben@decadent.org.uk> writes:
> 
> > 3.16.62-rc1 review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Vitaly Kuznetsov <vkuznets@redhat.com>
> > 
> > commit 2d408c0d4574b01b9ed45e02516888bf925e11a9 upstream.
[...]
> We should also take 
> 
> commit 21f2706b20100bb3db378461ab9b8e2035309b5b
> Author: Xiao Liang <xiliang@redhat.com>
> Date:   Tue Aug 14 23:21:28 2018 +0800
> 
>     xen-netfront: fix warn message as irq device name has '/'
> 
> as it fixes an issue introduced by the commit in question. Sorry if this
> is already in your series but I wasn't CCed on it.

Thanks, I've added that.

Ben.

-- 
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 338+ messages in thread

* Re: [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs
  2018-12-09 21:57   ` Nadav Amit
@ 2018-12-16 22:01     ` Ben Hutchings
  0 siblings, 0 replies; 338+ messages in thread
From: Ben Hutchings @ 2018-12-16 22:01 UTC (permalink / raw)
  To: Nadav Amit
  Cc: LKML, stable, Andrew Morton, Dave Hansen, Vlastimil Babka,
	Andi Kleen, Peter Zijlstra (Intel),
	Josh Poimboeuf, Thomas Gleixner, Sean Christopherson,
	Michal Hocko, Andy Lutomirski

[-- Attachment #1: Type: text/plain, Size: 5327 bytes --]

On Sun, 2018-12-09 at 21:57 +0000, Nadav Amit wrote:
> This patch causes some sparse warnings. If you want to wait, I’ll send a
> patch to fix it. (No expected functional impact though).

Thanks for the note.  I don't think that's enough of a reason to delay
this fix.

Ben.

> 
> > On Dec 9, 2018, at 1:50 PM, Ben Hutchings <ben@decadent.org.uk> wrote:
> > 
> > 3.16.62-rc1 review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Nadav Amit <namit@vmware.com>
> > 
> > commit 9bc4f28af75a91aea0ae383f50b0a430c4509303 upstream.
> > 
> > When page-table entries are set, the compiler might optimize their
> > assignment by using multiple instructions to set the PTE. This might
> > turn into a security hazard if the user somehow manages to use the
> > interim PTE. L1TF does not make our lives easier, making even an interim
> > non-present PTE a security hazard.
> > 
> > Using WRITE_ONCE() to set PTEs and friends should prevent this potential
> > security hazard.
> > 
> > I skimmed the differences in the binary with and without this patch. The
> > differences are (obviously) greater when CONFIG_PARAVIRT=n as more
> > code optimizations are possible. For better and worse, the impact on the
> > binary with this patch is pretty small. Skimming the code did not cause
> > anything to jump out as a security hazard, but it seems that at least
> > move_soft_dirty_pte() caused set_pte_at() to use multiple writes.
> > 
> > Signed-off-by: Nadav Amit <namit@vmware.com>
> > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > Cc: Dave Hansen <dave.hansen@linux.intel.com>
> > Cc: Andi Kleen <ak@linux.intel.com>
> > Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> > Cc: Michal Hocko <mhocko@suse.com>
> > Cc: Vlastimil Babka <vbabka@suse.cz>
> > Cc: Sean Christopherson <sean.j.christopherson@intel.com>
> > Cc: Andy Lutomirski <luto@kernel.org>
> > Link: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flkml.kernel.org%2Fr%2F20180902181451.80520-1-namit%40vmware.com&amp;data=02%7C01%7Cnamit%40vmware.com%7C714a85e56274491706a408d65e210edd%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C636799893436192539&amp;sdata=QNA9jX%2FSAai7zpZeNn%2FosXL%2BrjkG2lYfDVVUN9Etm0A%3D&amp;reserved=0
> > [bwh: Backported to 3.16:
> > - Use ACCESS_ONCE() instead of WRITE_ONCE()
> > - Drop changes in pmdp_establish(), native_set_p4d(), pudp_set_access_flags()]
> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> > ---
> > --- a/arch/x86/include/asm/pgtable_64.h
> > +++ b/arch/x86/include/asm/pgtable_64.h
> > @@ -44,15 +44,15 @@ struct mm_struct;
> > void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte);
> > 
> > 
> > -static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
> > -				    pte_t *ptep)
> > +static inline void native_set_pte(pte_t *ptep, pte_t pte)
> > {
> > -	*ptep = native_make_pte(0);
> > +	ACCESS_ONCE(*ptep) = pte;
> > }
> > 
> > -static inline void native_set_pte(pte_t *ptep, pte_t pte)
> > +static inline void native_pte_clear(struct mm_struct *mm, unsigned long addr,
> > +				    pte_t *ptep)
> > {
> > -	*ptep = pte;
> > +	native_set_pte(ptep, native_make_pte(0));
> > }
> > 
> > static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
> > @@ -62,7 +62,7 @@ static inline void native_set_pte_atomic
> > 
> > static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
> > {
> > -	*pmdp = pmd;
> > +	ACCESS_ONCE(*pmdp) = pmd;
> > }
> > 
> > static inline void native_pmd_clear(pmd_t *pmd)
> > @@ -98,7 +98,7 @@ static inline pmd_t native_pmdp_get_and_
> > 
> > static inline void native_set_pud(pud_t *pudp, pud_t pud)
> > {
> > -	*pudp = pud;
> > +	ACCESS_ONCE(*pudp) = pud;
> > }
> > 
> > static inline void native_pud_clear(pud_t *pud)
> > @@ -131,7 +131,7 @@ static inline pgd_t *native_get_shadow_p
> > 
> > static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
> > {
> > -	*pgdp = kaiser_set_shadow_pgd(pgdp, pgd);
> > +	ACCESS_ONCE(*pgdp) = kaiser_set_shadow_pgd(pgdp, pgd);
> > }
> > 
> > static inline void native_pgd_clear(pgd_t *pgd)
> > --- a/arch/x86/mm/pgtable.c
> > +++ b/arch/x86/mm/pgtable.c
> > @@ -242,7 +242,7 @@ static void pgd_mop_up_pmds(struct mm_st
> > 		if (pgd_val(pgd) != 0) {
> > 			pmd_t *pmd = (pmd_t *)pgd_page_vaddr(pgd);
> > 
> > -			pgdp[i] = native_make_pgd(0);
> > +			pgd_clear(&pgdp[i]);
> > 
> > 			paravirt_release_pmd(pgd_val(pgd) >> PAGE_SHIFT);
> > 			pmd_free(mm, pmd);
> > @@ -352,7 +352,7 @@ int ptep_set_access_flags(struct vm_area
> > 	int changed = !pte_same(*ptep, entry);
> > 
> > 	if (changed && dirty) {
> > -		*ptep = entry;
> > +		set_pte(ptep, entry);
> > 		pte_update_defer(vma->vm_mm, address, ptep);
> > 	}
> > 
> > @@ -369,7 +369,7 @@ int pmdp_set_access_flags(struct vm_area
> > 	VM_BUG_ON(address & ~HPAGE_PMD_MASK);
> > 
> > 	if (changed && dirty) {
> > -		*pmdp = entry;
> > +		set_pmd(pmdp, entry);
> > 		pmd_update_defer(vma->vm_mm, address, pmdp);
> > 		/*
> > 		 * We had a write-protection fault here and changed the pmd
> 
> 
-- 
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 338+ messages in thread

end of thread, other threads:[~2018-12-16 22:01 UTC | newest]

Thread overview: 338+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-09 21:50 [PATCH 3.16 000/328] 3.16.62-rc1 review Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 057/328] video: udlfb: Fix unaligned access Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 020/328] leds: max8997: use mode when calling max8997_led_set_mode Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 045/328] binfmt_elf: Respect error return from `regset->active' Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 062/328] udlfb: set optimal write delay Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 326/328] mremap: properly flush TLB before releasing the page Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 089/328] ath10k: prevent active scans on potential unusable channels Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 258/328] ubifs: Check for name being NULL while mounting Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 118/328] PCI: mvebu: Fix I/O space end address calculation Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 324/328] posix-timers: Sanitize overrun handling Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 321/328] cpuidle: Do not access cpuidle_devices when !CONFIG_CPU_IDLE Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 225/328] hwmon: (nct6775) Fix access to fan pulse registers Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 196/328] USB: add quirk for WORLDE Controller KS49 or Prodipe MIDI 49C USB controller Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 036/328] mei: bus: type promotion bug in mei_nfc_if_version() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 148/328] KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 185/328] xfrm6: call kfree_skb when skb is toobig Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 180/328] igmp: fix incorrect unsolicit report count when join group Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 266/328] bcache: Remove deprecated create_workqueue Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 244/328] ring-buffer: Allow for rescheduling when removing pages Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 050/328] PCI: hotplug: Don't leak pci_slot on registration failure Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 199/328] usb: uas: add support for more quirk flags Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 224/328] drm/nouveau/drm/nouveau: Use pm_runtime_get_noresume() in connector_detect() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 087/328] udl-kms: handle allocation failure Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 195/328] cfg80211: reg: Init wiphy_idx in regulatory_hint_core() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 153/328] iscsi target: fix session creation failure handling Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 183/328] smb3: check for and properly advertise directory lease support Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 282/328] mac80211: fix setting IEEE80211_KEY_FLAG_RX_MGMT for AP mode keys Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 041/328] s390/kvm: fix deadlock when killed by oom Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 299/328] Make file credentials available to the seqfile interfaces Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 121/328] b43/leds: Ensure NUL-termination of LED name string Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 292/328] drm: fb-helper: Reject all pixel format changing requests Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 011/328] serial: pxa: Fix an error handling path in 'serial_pxa_probe()' Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 114/328] powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 071/328] fuse: don't wake up reserved req in fuse_conn_kill() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 284/328] xhci: Add missing CAS workaround for Intel Sunrise Point xHCI Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 065/328] xfrm: fix 'passing zero to ERR_PTR()' warning Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 167/328] USB: serial: ti_usb_3410_5052: use functions rather than macros Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 208/328] usb: host: u132-hcd: Fix a sleep-in-atomic-context bug in u132_get_frame() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 078/328] ALSA: virmidi: Fix too long output trigger loop Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 103/328] net: 6lowpan: fix reserved space for single frames Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 113/328] ASoC: wm8994: Fix missing break in switch Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 169/328] ext4: avoid divide by zero fault when deleting corrupted inline directories Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 306/328] dm cache: destroy migration_cache if cache target registration failed Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 135/328] l2tp: use sk_dst_check() to avoid race on sk->sk_dst_cache Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 175/328] ipmi: Move BT capabilities detection to the detect call Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 202/328] spi: rspi: Fix invalid SPI use during system suspend Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 219/328] batman-adv: Prevent duplicated global TT entry Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 274/328] sr9800: Check for supported Wake-on-LAN modes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 003/328] EDAC, i7core: Fix memleaks and use-after-free on probe and remove Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 165/328] x86/speculation/l1tf: Increase l1tf memory limit for Nehalem+ Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 318/328] r8169: fix NAPI handling under high load Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 264/328] fbdev/omapfb: fix omapfb_memory_read infoleak Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 027/328] vxlan: fix a potential issue when create a new vxlan fdb entry Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 120/328] scsi: aic94xx: fix an error code in aic94xx_init() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 099/328] crypto: blkcipher - fix crash flushing dcache in error path Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 001/328] EDAC: Fix memleak in module init " Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 229/328] drm/i915/bdw: Increase IPS disable timeout to 100ms Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 203/328] spi: rspi: Handle dmaengine_prep_slave_sg() failures gracefully Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 293/328] PM / core: Clear the direct_complete flag on errors Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 268/328] bcache: do not assign in if condition in bcache_init() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 210/328] IB/ipoib: Avoid a race condition between start_xmit and cm_rep_handler Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 234/328] Tools: hv: Fix a bug in the key delete code Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 316/328] ptp: fix Spectre v1 vulnerability Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 158/328] mm: move tlb_table_flush to tlb_flush_mmu_free Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 058/328] udlfb: fix semaphore value leak Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 155/328] reiserfs: fix broken xattr handling (heap corruption, bad retval) Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 090/328] ext4: check for NUL characters in extended attribute's name Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 091/328] tracing: Do not call start/stop() functions when tracing_on does not change Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 253/328] USB: leave LPM alone if possible when binding/unbinding interface drivers Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 034/328] pwm: tiehrpwm: Fix disabling of output of PWMs Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 055/328] fb: fix lost console when the user unplugs a USB adapter Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 038/328] tty: fix typo in comment of tty_termios_encode_baud_rate Ben Hutchings
2018-12-12 13:57   ` Matthias Brugger
2018-12-14  1:40     ` Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 246/328] tty: vt_ioctl: fix potential Spectre v1 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 170/328] usb: gadget: udc: net2280: do not rely on 'driver' argument Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 154/328] fs/quota: Fix spectre gadget in do_quotactl Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 051/328] PCI: pciehp: Fix use-after-free on unplug Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 117/328] cifs: add missing debug entries for kconfig options Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 108/328] percpu_counter: batch size aware __percpu_counter_compare() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 076/328] block: move bio_integrity_{intervals,bytes} into blkdev.h Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 037/328] uart: fix race between uart_put_char() and uart_shutdown() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 074/328] fuse: Don't access pipe->buffers without pipe_lock() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 125/328] powerpc/pseries: Fix endianness while restoring of r3 in MCE handler Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 290/328] rtnl: limit IFLA_NUM_TX_QUEUES and IFLA_NUM_RX_QUEUES to 4096 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 079/328] media: dvb-usb-v2/gl861: ensure USB message buffers DMA'able Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 119/328] media: rtl28xxu: be sure that it won't go past the array size Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 139/328] ubifs: Fix memory leak in lprobs self-check Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 265/328] bcache: don't embed 'return' statements in closure macros Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 168/328] USB: serial: ti_usb_3410_5052: fix array underflow in completion handler Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 109/328] btrfs: use correct compare function of dirty_metadata_bytes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 164/328] x86/spectre: Add missing family 6 check to microcode check Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 297/328] ipv6: Compute net once in raw6_send_hdrinc Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 111/328] btrfs: rename total_bytes to avoid confusion Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 271/328] crypto: mxs-dcp - Fix wait logic on chan threads Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 052/328] PCI: pciehp: Fix unprotected list iteration in IRQ handler Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 083/328] iio: ad9523: Fix return value for ad952x_store() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 194/328] iw_cxgb4: only allow 1 flush on user qps Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 223/328] RDMA/cma: Protect cma dev list with lock Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 296/328] ARC: clone syscall to setp r25 as thread pointer Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 187/328] ext4: fix online resize's handling of a too-small final block group Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 317/328] cachefiles: fix the race between cachefiles_bury_object() and rmdir(2) Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 255/328] USB: fix error handling in usb_driver_claim_interface() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 040/328] tty: fix termios input-speed encoding when using BOTHER Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 131/328] 9p: fix multiple NULL-pointer-dereferences Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 069/328] ALSA: vxpocket: Fix invalid endian conversions Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 177/328] x86/microcode/intel: Check microcode revision before updating sibling threads Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 289/328] perf/ring_buffer: Prevent concurent ring buffer access Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 322/328] KEYS: encrypted: fix buffer overread in valid_master_desc() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 311/328] x86/percpu: Fix this_cpu_read() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 238/328] cifs: integer overflow in in SMB2_ioctl() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 288/328] perf/core: Fix perf_pmu_unregister() locking Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 162/328] hwmon: (nct6775) Fix potential Spectre v1 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 150/328] x86/process: Re-export start_thread() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 044/328] mtdchar: fix overflows in adjustment of `count` Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 081/328] partitions/aix: fix usage of uninitialized lv_info and lvname structures Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 179/328] x86/microcode: Update the new microcode revision unconditionally Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 033/328] pwm: tiehrpwm: Don't use emulation mode bits to control PWM output Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 054/328] iio: ad9523: Fix displayed phase Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 307/328] of: unittest: Disable interrupt node tests for old world MAC systems Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 096/328] scsi: sysfs: Introduce sysfs_{un,}break_active_protection() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 029/328] vxlan: fix default fdb entry netlink notify ordering during netdev create Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 134/328] KVM: arm/arm64: Skip updating PTE entry if no change Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 298/328] ipv6: take rcu lock in rawv6_send_hdrinc() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 098/328] xfrm: Validate address prefix lengths in the xfrm selector Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 094/328] IB/IPoIB: Set ah valid flag in multicast send flow Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 012/328] media: omap3isp: zero-initialize the isp cam_xclk{a,b} initial data Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 242/328] pppoe: fix reception of frames with no mac header Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 207/328] usb: Avoid use-after-free by flushing endpoints early in usb_set_interface() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 060/328] udlfb: don't switch if we are switching to the same videomode Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 061/328] udlfb: make a local copy of fb_ops Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 205/328] spi: rspi: Fix interrupted DMA transfers Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 220/328] batman-adv: Prevent duplicated tvlv handler Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 136/328] xtensa: limit offsets in __loop_cache_{all,page} Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 263/328] ip_tunnel: be careful when accessing the inner header Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 110/328] Btrfs: fix btrfs_write_inode vs delayed iput deadlock Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 104/328] mac802154: common tx error path Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 323/328] wil6210: missing length check in wmi_set_ie Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 201/328] spi: sh-msiof: Fix handling of write value for SISTR register Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 209/328] usb: misc: uss720: Fix two sleep-in-atomic-context bugs Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 191/328] RDMA/ucma: check fd type in ucma_migrate_id() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 230/328] drm: udl: Destroy framebuffer only if it was initialized Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 030/328] vmci: type promotion bug in qp_host_get_user_memory() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 267/328] bcache: explicitly destroy mutex while exiting Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 261/328] powerpc/pseries: Fix unitialized timer reset on migration Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 105/328] mac802154: tx: cleanup crc calculation Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 287/328] perf/core: Protect PMU device removal with a 'pmu_bus_running' check, to fix CONFIG_DEBUG_TEST_DRIVER_REMOVE=y kernel panic Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 019/328] scsi: target/iscsi: Make iscsit_ta_authentication() respect the output buffer size Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 028/328] vxlan: add new fdb alloc and create helpers Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 126/328] uprobes: Use synchronize_rcu() not synchronize_sched() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 086/328] udl-kms: change down_interruptible to down Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 222/328] i2c: xiic: Make the start and the byte count write atomic Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 047/328] xen-netfront: fix queue name setting Ben Hutchings
2018-12-09 23:24   ` Vitaly Kuznetsov
2018-12-16 21:42     ` Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 127/328] net/9p/client.c: version pointer uninitialized Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 073/328] fuse: Fix oops at process_init_reply() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 009/328] platform/x86: ideapad-laptop: Apply no_hw_rfkill to Y20-15IKBM, too Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 188/328] ext4: prevent online resize with backup superblock Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 025/328] power: generic-adc-battery: fix out-of-bounds write when copying channel properties Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 116/328] smb3: fill in statfs fsid and correct namelen Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 014/328] IB/srpt: Support HCAs with more than two ports Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 122/328] b43legacy/leds: Ensure NUL-termination of LED name string Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 254/328] USB: remove LPM management from usb_driver_claim_interface() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 064/328] udlfb: set line_length in dlfb_ops_set_par Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 181/328] igmp: fix incorrect unsolicit report count after link down and up Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 017/328] crypto: vmac - separate tfm and request context Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 141/328] drm/i915: set DP Main Stream Attribute for color range on DDI platforms Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 145/328] netfilter: nf_tables: fix register ordering Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 016/328] crypto: memzero_explicit - make sure to clear out sensitive data Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 172/328] USB: net2280: Fix erroneous synchronization change Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 309/328] net: make skb_partial_csum_set() more robust against overflows Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 063/328] udlfb: handle allocation failure Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 002/328] EDAC: i7core: Return proper error codes for kzalloc() errors Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 294/328] team: Forbid enslaving team device to itself Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 304/328] mach64: detect the dot clock divider correctly on sparc Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 328/328] cdrom: fix improper type cast, which can leat to information leak Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 176/328] x86/microcode/intel: Add a helper which gives the microcode revision Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 216/328] x86/process: Don't mix user/kernel regs in 64bit __show_regs() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 314/328] RDMA/ucma: Fix Spectre v1 vulnerability Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 100/328] crypto: ablkcipher - fix crash flushing dcache in error path Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 248/328] ARM: 8799/1: mm: fix pci_ioremap_io() offset check Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 273/328] ax88179_178a: Check for supported Wake-on-LAN modes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 080/328] media: gl861: fix probe of dvb_usb_gl861 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 130/328] fs/9p/xattr.c: catch the error of p9_client_clunk when setting xattr failed Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 300/328] proc: restrict kernel stack dumps to root Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 192/328] RDMA/cxgb4: Only call CQ completion handler if it is armed Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 173/328] ipv6: fix cleanup ordering for pingv6 registration Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 042/328] ARM: hisi: handle of_iomap and fix missing of_node_put Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 212/328] ACPI / bus: Only call dmi_check_system() on X86 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 152/328] ISCSI: fix minor memory leak Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 088/328] udl-kms: fix crash due to uninitialized memory Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 097/328] scsi: core: Avoid that SCSI device removal through sysfs triggers a deadlock Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 007/328] USB: serial: sierra: fix potential deadlock at close Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 085/328] pinctrl: imx: off by one in imx_pinconf_group_dbg_show() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 066/328] ALSA: seq: Fix poll() error return Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 093/328] ext4: fix spectre gadget in ext4_mb_regular_allocator() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 283/328] arm64: KVM: Tighten guest core register access from userspace Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 161/328] net: macb: do not disable MDIO bus at open/close time Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 035/328] drm/panel: type promotion bug in s6e8aa0_read_mtp_id() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 301/328] mm/vmstat.c: skip NR_TLB_REMOTE_FLUSH* properly Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 272/328] asix: Check for supported Wake-on-LAN modes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 256/328] USB: handle NULL config in usb_find_alt_setting() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 198/328] USB: Add quirk to support DJI CineSSD Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 115/328] dm cache metadata: save in-core policy_hint_size to on-disk superblock Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 026/328] power: generic-adc-battery: check for duplicate properties copied from iio channels Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 232/328] x86/boot: Move EISA setup to a separate file Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 270/328] PCI: Reprogram bridge prefetch registers on resume Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 281/328] pstore/ram: Fix failure-path memory leak in ramoops_init Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 163/328] ext4: check to make sure the rename(2)'s destination is not freed Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 259/328] mm: shmem.c: Correctly annotate new inodes for lockdep Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 200/328] spi: sh-msiof: Add more register documentation Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 021/328] libertas: fix suspend and resume for SDIO connected cards Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 308/328] libertas: call into generic suspend code before turning off power Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 197/328] USB: yurex: Fix buffer over-read in yurex_write() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 249/328] x86/paravirt: Fix some warning messages Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 277/328] smsc95xx: Check for Wake-on-LAN modes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 237/328] CIFS: fix wrapping bugs in num_entries() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 067/328] ALSA: vx: Fix possible transfer overflow Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 327/328] xfs: don't fail when converting shortform attr to long form during ATTR_REPLACE Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 032/328] ARM: tegra: Fix Tegra30 Cardhu PCA954x reset Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 106/328] mac802154: tx: use put_unaligned_le16 for copy crc Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 068/328] ALSA: vx222: Fix invalid endian conversions Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 213/328] batman-adv: Prevent duplicated gateway_node entry Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 280/328] tools: hv: fcopy: set 'error' in case an unknown operation was requested Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 239/328] pstore: Fix incorrect persistent ram buffer mapping Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 049/328] MIPS: Change definition of cpu_relax() for Loongson-3 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 146/328] tracing/blktrace: Fix to allow setting same value Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 004/328] audit: Fix extended comparison of GID/EGID Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 143/328] s390/pci: fix out of bounds access during irq setup Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 048/328] ALSA: memalloc: Don't exceed over the requested size Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 260/328] ocfs2: fix ocfs2 read block panic Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 070/328] ALSA: cs5535audio: Fix invalid endian conversion Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 228/328] ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 024/328] staging: rts5208: fix missing error check on call to rtsx_write_register Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 291/328] smb2: fix missing files in root share directory listing Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 046/328] MIPS: Correct the 64-bit DSP accumulator register size Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 084/328] net: mvneta: fix mtu change on port without link Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 313/328] IB/ucm: Fix Spectre v1 vulnerability Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 149/328] powerpc/powernv/pci: Work around races in PCI bridge enabling Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 241/328] bpf, net: add skb_mac_header_len helper Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 319/328] net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 184/328] cifs: connect to servername instead of IP for IPC$ share Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 059/328] udlfb: fix display corruption of the last line Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 013/328] ALSA: snd-aoa: add of_node_put() in error path Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 015/328] crypto: vmac - require a block cipher with 128-bit block size Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 252/328] USB: usbdevfs: restore warning for nonsensical flags Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 156/328] apparmor: remove no-op permission check in policy_unpack Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 144/328] netfilter: nft_set: fix allocation size overflow in privsize callback Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 275/328] r8152: Check for supported Wake-on-LAN Modes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 124/328] powerpc/fadump: handle crash memory ranges array index overflow Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 159/328] mm/tlb: Remove tlb_remove_table() non-concurrent condition Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 312/328] USB: fix the usbfs flag sanitization for control transfers Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 193/328] iw_cxgb4: atomically flush the qp Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 102/328] ieee802154: 6lowpan: ensure header compression does not corrupt ipv6 header Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 166/328] USB: serial: io_ti: fix array underflow in completion handler Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 251/328] USB: usbdevfs: sanitize flags more Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 157/328] getxattr: use correct xattr length Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 082/328] partitions/aix: append null character to print data from disk Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 053/328] fbdev: omapfb: off by one in omapfb_register_client() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 039/328] tty: fix termios input-speed encoding Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 226/328] x86/mm: Use WRITE_ONCE() when setting PTEs Ben Hutchings
2018-12-09 21:57   ` Nadav Amit
2018-12-16 22:01     ` Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 217/328] batman-adv: Place kref_get for softif_vlan near use Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 182/328] SMB3: Backup intent flag missing for directory opens with backupuid mounts Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 215/328] batman-adv: Prevent duplicated nc_node entry Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 247/328] Input: elantech - enable middle button of touchpad on ThinkPad P72 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 138/328] ubifs: Fix synced_i_size calculation for xattr inodes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 008/328] platform/x86: ideapad-laptop: Add Y520-15IKBN to no_hw_rfkill Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 285/328] net: sched: act_ipt: check for underflow in __tcf_ipt_init() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 128/328] 9p/net: Fix zero-copy path in the 9p virtio transport Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 233/328] x86/EISA: Don't probe EISA bus for Xen PV guests Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 022/328] media: exynos4-is: Prevent NULL pointer dereference in __isp_video_try_fmt() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 206/328] usb: Don't die twice if PCI xhci host is not responding in resume Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 072/328] fuse: flush requests on umount Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 250/328] ip6_tunnel: be careful when accessing the inner header Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 018/328] alarmtimer: Prevent overflow for relative nanosleep Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 151/328] iscsi-target: nullify session in failed login sequence Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 278/328] qlcnic: fix Tx descriptor corruption on 82xx devices Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 133/328] KVM: arm/arm64: Skip updating PMD entry if no change Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 005/328] kprobes: Make list and blacklist root user read only Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 227/328] ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 315/328] usb: gadget: storage: Fix Spectre v1 vulnerability Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 257/328] regulator: fix crash caused by null driver data Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 129/328] net/9p/trans_fd.c: fix race-condition by flushing workqueue before the kfree() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 123/328] powerpc: Fix size calculation using resource_size() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 262/328] USB: serial: simple: add Motorola Tetra MTP6550 id Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 218/328] batman-adv: Prevent duplicated softif_vlan entry Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 240/328] ext4: don't mark mmp buffer head dirty Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 077/328] scsi: virtio_scsi: fix pi_bytes{out,in} on 4 KiB block size devices Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 214/328] batman-adv: Use kref_get for batadv_nc_get_nc_node Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 221/328] dm: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a GFP_KERNEL recursion deadlock Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 211/328] hwmon: (nct6775) Set weight source to zero correctly Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 023/328] USB: serial: kobil_sct: fix modem-status error handling Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 178/328] x86/microcode: Make sure boot_cpu_data.microcode is up-to-date Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 235/328] misc: hmc6352: fix potential Spectre v1 Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 320/328] mtd: fsl-quadspi: fix macro collision problems with READ/WRITE Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 279/328] Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 245/328] serial: cpm_uart: return immediately from console poll Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 010/328] rndis_wlan: potential buffer overflow in rndis_wlan_auth_indication() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 303/328] mm: madvise(MADV_DODUMP): allow hugetlbfs pages Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 147/328] arm64: mm: check for upper PAGE_SHIFT bits in pfn_valid() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 310/328] net: ipv4: update fnhe_pmtu when first hop's MTU changes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 075/328] fuse: Add missed unlock_page() to fuse_readpages_fill() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 302/328] ocfs2: fix locking for res->tracking and dlm->tracking_list Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 101/328] pinctrl: berlin: fix 'pctrl->functions' allocation in berlin_pinctrl_build_state Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 171/328] usb: gadget: net2280: fix pullup handling Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 295/328] MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 286/328] x86/vdso: Fix asm constraints on vDSO syscall fallbacks Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 132/328] 9p/virtio: fix off-by-one error in sg list bounds check Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 204/328] spi: rspi: Fix leaking of unused DMA descriptors Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 137/328] xtensa: increase ranges in ___invalidate_{i,d}cache_all Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 031/328] pinctrl: msm: Fix msm_config_group_get() to be compliant Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 276/328] smsc75xx: Check for Wake-on-LAN modes Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 056/328] video: udlfb: Remove noisy warnings Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 325/328] mm: cleancache: fix corruption on missed inode invalidation Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 006/328] s390/qdio: reset old sbal_state flags Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 107/328] net: mac802154: tx: expand tailroom if necessary Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 142/328] mfd: sm501: Set coherent_dma_mask when creating subdevices Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 236/328] cifs: prevent integer overflow in nxt_dir_entry() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 043/328] mtd: rawnand: mxc: remove __init qualifier from mxcnd_probe_dt Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 095/328] uio: potential double frees if __uio_register_device() fails Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 160/328] cifs: check kmalloc before use Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 231/328] platform/x86: alienware-wmi: Correct a memory leak Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 305/328] usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 269/328] bcache: add separate workqueue for journal_write to avoid deadlock Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 174/328] cfg80211: nl80211_update_ft_ies() to validate NL80211_ATTR_IE Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 243/328] ipv6: fix possible use-after-free in ip6_xmit() Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 189/328] ext4: fix online resizing for bigalloc file systems with a 1k block size Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 112/328] ASoC: wm8994: Mark expected switch fall-through Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 140/328] ubifs: Check data node size before truncate Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 190/328] nbd: don't allow invalid blocksize settings Ben Hutchings
2018-12-09 21:50 ` [PATCH 3.16 186/328] spi: tegra20-slink: explicitly enable/disable clock Ben Hutchings
2018-12-10 16:54 ` [PATCH 3.16 000/328] 3.16.62-rc1 review Guenter Roeck
2018-12-10 19:06   ` Ben Hutchings
2018-12-10 20:36     ` Guenter Roeck
2018-12-16 21:36       ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).