3.16.63-rc1 review
Subsystems (9)
cover 3.16.63-rc1 review
This is the start of the stable review cycle for the 3.16.63 release. There are 305 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 Feb 08 18:00:00 UTC 2019. 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.
-------------
Aaro Koskinen (1):
MMC: OMAP: fix broken MMC on OMAP15XX/OMAP5910/OMAP310
[e8cde625bfe8a714a856e1366bcbb259d7346095]
Aaron Ma (2):
usb: xhci: fix timeout for transition from RExit to U0
[a5baeaeabcca3244782a9b6382ebab6f8a58f583]
usb: xhci: fix uninitialized completion when USB3 port got wrong status
[958c0bd86075d4ef1c936998deefe1947e539240]
Ahmad Fatoum (1):
mtd: spi-nor: fsl-quadspi: Don't let -EINVAL on the bus
[000412276370a9bcfec73b3752ceefd9a927f1db]
Al Viro (2):
gfs2_meta: ->mount() can get NULL dev_name
[3df629d873f8683af6f0d34dfc743f637966d483]
new helper: uaccess_kernel()
[db68ce10c4f0a27c1ff9fa0e789e5c41f8c4ea63]Alex Stanoev (1):
ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops
[ac237c28d5ac1b241d58b1b7b4b9fa10efb22fb5]
Alexander Theissen (1):
usb: appledisplay: Add 27" Apple Cinema Display
[d7859905301880ad3e16272399d26900af3ac496]
Amir Goldstein (1):
lockd: fix access beyond unterminated strings in prints
[93f38b6fae0ea8987e22d9e6c38f8dfdccd867ee]
Anders Roxell (1):
cpupower: remove stringop-truncation waring
[8a7e2d2ea080d10a189a1d611344b0330468ebc3]
Andrea Parri (1):
uprobes: Fix handle_swbp() vs. unregister() + register() race once more
[09d3f015d1e1b4fee7e9bbdcf54201d239393391]
Andreas Kemnade (1):
w1: omap-hdq: fix missing bus unregister at removal
[a007734618fee1bf35556c04fa498d41d42c7301]
Andreas Larsson (1):
sparc32: Fix inverted invalid_frame_pointer checks on sigreturns
[07b5ab3f71d318e52c18cc3b73c1d44c908aacfa]
Andy Lutomirski (1):
x86/vdso: Fix vDSO syscall fallback asm constraint regression
[02e425668f5c9deb42787d10001a3b605993ad15]
Anssi Hannula (2):
net: macb: add missing barriers when reading descriptors
[6e0af298066f3b6d99f58989bb0dca6f764b4c6d]
net: macb: fix dropped RX frames due to a race
[8159ecab0db9095902d4c73605fb8787f5c7d653]
Arnd Bergmann (4):
ARM: fix put_user() for gcc-8
[9f73bd8bb445e0cbe4bcef6d4cfc788f1e184007]
kbuild: fix kernel/bounds.c 'W=1' warning
[6a32c2469c3fbfee8f25bcd20af647326650a6cf]
mtd: docg3: don't set conflicting BCH_CONST_PARAMS option
[be2e1c9dcf76886a83fb1c433a316e26d4ca2550]
turn off -Wattribute-alias
[bee20031772af3debe8cbaa234528f24c7892e8f]
Aya Levin (1):
net/mlx4: Fix UBSAN warning of signed integer overflow
[a463146e67c848cbab5ce706d6528281b7cded08]
Ben Greear (1):
mac80211: Clear beacon_int in ieee80211_do_stop
[5c21e8100dfd57c806e833ae905e26efbb87840f]Ben Hutchings (3):
ipv6: Fix another sparse warning on rt6i_node
[not upstream; function has been removed]
s390/dasd: Restore a necessary cast
[not upstream; variable type has been changed]
x86/boot: eboot.c: Include string function declarations
[393f203f5fd54421fddb1e2a263f64d3876eeadb]
Benjamin Poirier (1):
xfrm: Fix bucket count reported to userspace
[ca92e173ab34a4f7fc4128bd372bd96f1af6f507]
Bin Meng (1):
PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk
[d0c9606b31a21028fb5b753c8ad79626292accfd]
Breno Leitao (1):
HID: hiddev: fix potential Spectre v1
[f11274396a538b31bc010f782e05c2ce3f804c13]
Carlos Maiolino (1):
xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat
[41657e5507b13e963be906d5d874f4f02374fd5c]
Chad Austin (1):
fuse: continue to send FUSE_RELEASEDIR when FUSE_OPEN returns ENOSYS
[2e64ff154ce6ce9a8dc0f9556463916efa6ff460]
Changwei Ge (1):
ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
[29aa30167a0a2e6045a0d6d2e89d8168132333d5]
Chen Gang (1):
s390/timex: fix get_tod_clock_ext() inline assembly
[e38f97813302065fbc9c9eab5c1a94dc021d71e2]
Chris Mason (1):
Btrfs: don't clean dirty pages during buffered writes
[7703bdd8d23e6ef057af3253958a793ec6066b28]
Chris Wilson (1):
drm/i915: Large page offsets for pread/pwrite
[a5e856a5348f6cd50889d125c40bbeec7328e466]
Christian Hoff (1):
Input: matrix_keypad - check for errors from of_get_named_gpio()
[d55bda1b3e7c5a87f10da54fdda866a9a9cef30b]
Christophe Leroy (1):
gpio: max7301: fix driver for use with CONFIG_VMAP_STACK
[abf221d2f51b8ce7b9959a8953f880a8b0a1400d]
Chuck Lever (1):
SUNRPC: Fix leak of krb5p encode pages
[8dae5398ab1ac107b1517e8195ed043d5f422bd0]
Colin Ian King (3):
media: cx231xx: fix potential sign-extension overflow on large shift
[32ae592036d7aeaabcccb2b1715373a68639a768]
vxge: ensure data0 is initialized in when fetching firmware version information
[f7db2beb4c2c6cc8111f5ab90fc7363ca91107b6]
x86/mtrr: Don't copy uninitialized gentry fields back to userspace
[32043fa065b51e0b1433e48d118821c71b5cd65d]
Dan Carpenter (6):
bnx2fc: fix an error code in _bnx2fc_create()
[2043e1fd09c1896bb03a6e25b64baa84a30879c9]
libertas_tf: prevent underflow in process_cmdrequest()
[3348ef6a6a126706d6a73ed40c18d8033df72783]
qlcnic: fix a return in qlcnic_dcb_get_capability()
[c94f026fb742b2d3199422751dbc4f6fc0e753d8]
scsi: bnx2fc: Fix NULL dereference in error handling
[9ae4f8420ed7be4b13c96600e3568c144d101a23]
staging: comedi: quatech_daqp_cs: fix no-op loop daqp_ao_insn_write()
[1376b0a2160319125c3a2822e8c09bd283cd8141]
uio: Fix an Oops on load
[432798195bbce1f8cd33d1c0284d0538835e25fb]
Dennis Wassenberg (1):
usb: core: Fix hub port connection events lost
[22454b79e6de05fa61a2a72d00d2eed798abbb75]
Dexuan Cui (4):
Drivers: hv: kvp: Fix the recent regression caused by incorrect clean-up
[e670de54c813b5bc3672dd1c67871dc60e9206f4]
Drivers: hv: kvp: Fix two "this statement may fall through" warnings
[fc62c3b1977d62e6374fd6e28d371bb42dfa5c9d]
Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels
[fc96df16a1ce80cbb3c316ab7d4dc8cd5c2852ce]
Drivers: hv: vmbus: check the creation_status in vmbus_establish_gpadl()
[eceb05965489784f24bbf4d61ba60e475a983016]
Diego Viola (2):
libata: Apply NOLPM quirk for SAMSUNG MZ7TD256HAFV-000L9
[a435ab4f80f983c53b4ca4f8c12b3ddd3ca17670]
libata: blacklist SAMSUNG MZ7TD256HAFV-000L9 SSD
[410b5c7b48368317af95f0113692561d01d8144e]
Dmitry Bazhenov (1):
hwmon: (pmbus) Fix page count auto-detection.
[e7c6a55606b5c46b449d76588968b4d8caae903f]
Dmitry Bilunov (1):
KVM: Handle MSR_IA32_PERF_CTL
[0c2df2a1affd183ba9c114915f42a2d464b4f58f]
Dmitry V. Levin (1):
mips: fix mips_get_syscall_arg o32 check
[c50cbd85cd7027d32ac5945bb60217936b4f7eaf]
Eduardo Habkost (1):
kvm: x86: Add AMD's EX_CFG to the list of ignored MSRs
[0e1b869fff60c81b510c2d00602d778f8f59dd9a]
Emmanuel Grumbach (1):
mac80211: ignore NullFunc frames in the duplicate detection
[990d71846a0b7281bd933c34d734e6afc7408e7e]
Emmanuel Pescosta (1):
usb: quirks: Add delay-init quirk for Corsair K70 LUX RGB
[a77112577667cbda7c6292c52d909636aef31fd9]
Enric Balletbo i Serra (1):
PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.
[23c7b54ca1cd1797ef39169ab85e6d46f1c2d061]
Eric Biggers (2):
HID: uhid: forbid UHID_CREATE under KERNEL_DS or elevated privileges
[8c01db7619f07c85c5cd81ec5eb83608b56c88f5]
ima: fix showing large 'violations' or 'runtime_measurements_count'
[1e4c8dafbb6bf72fb5eca035b861e39c5896c2b7]
Eric Dumazet (4):
ipv6: tunnels: fix two use-after-free
[cbb49697d5512ce9e61b45ce75d3ee43d7ea5524]
llc: do not use sk_eat_skb()
[604d415e2bd642b7e02c80e719e0396b9d4a77a6]
net-gro: reset skb->pkt_type in napi_reuse_skb()
[33d9a2c72f086cbf1087b2fd2d1a15aa9df14a7f]
rtnetlink: ndo_dflt_fdb_dump() only work for ARPHRD_ETHER devices
[688838934c231bb08f46db687e57f6d8bf82709c]Eric W. Biederman (5):
mount: Don't allow copying MNT_UNBINDABLE|MNT_LOCKED mounts
[df7342b240185d58d3d9665c0bbf0a0f5570ec29]
mount: Prevent MNT_DETACH from disconnecting locked mounts
[9c8e0a1b683525464a2abe9fb4b54404a50ed2b4]
mount: Retest MNT_LOCKED in do_umount
[25d202ed820ee347edec0bf3bf553544556bf64b]
signal/GenWQE: Fix sending of SIGKILL
[0ab93e9c99f8208c0a1a7b7170c827936268c996]
signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init
[3597dfe01d12f570bc739da67f857fd222a3ea66]
Erik Schmauss (1):
ACPICA: AML interpreter: add region addresses in global list during initialization
[4abb951b73ff0a8a979113ef185651aa3c8da19b]
Eugen Hristev (2):
iio: adc: at91: fix acking DRDY irq on simple conversions
[bc1b45326223e7e890053cf6266357adfa61942d]
iio: adc: at91: fix wrong channel number in triggered buffer mode
[aea835f2dc8a682942b859179c49ad1841a6c8b9]
Felipe Balbi (1):
Revert "usb: dwc3: gadget: skip Set/Clear Halt when invalid"
[38317f5c0f2faae5110854f36edad810f841d62f]
Felix Fietkau (1):
mac80211: fix reordering of buffered broadcast packets
[9ec1190d065998650fd9260dea8cf3e1f56c0e8c]
Filipe Manana (5):
Btrfs: ensure path name is null terminated at btrfs_control_ioctl
[f505754fd6599230371cb01b9332754ddc104be1]
Btrfs: fix data corruption due to cloning of eof block
[ac765f83f1397646c11092a032d4f62c3d478b81]
Btrfs: fix null pointer dereference on compressed write path error
[3527a018c00e5dbada2f9d7ed5576437b6dd5cfb]
Btrfs: fix race between enabling quotas and subvolume creation
[552f0329c75b3e1d7f9bb8c9e421d37403f192cd]
Btrfs: fix use-after-free when dumping free space
[9084cb6a24bf5838a665af92ded1af8363f9e563]
Finn Thain (1):
scsi: esp_scsi: Track residual for PIO transfers
[fd47d919d0c336e7c22862b51ee94927ffea227a]
Florian Fainelli (1):
net: phy: Stop with excessive soft reset
[6e2d85ec05591b739059f65fe8438c9c5999f7d8]
Florian Westphal (4):
netfilter: nf_tables: don't use position attribute on rule replacement
[447750f281abef547be44fdcfe3bc4447b3115a8]
netfilter: nf_tables: fix oob access
[3e38df136e453aa69eb4472108ebce2fb00b1ba6]
netfilter: nf_tables: fix use-after-free when deleting compat expressions
[29e3880109e357fdc607b4393f8308cef6af9413]
netfilter: x_tables: add and use xt_check_proc_name
[b1d0a5d0cba4597c0394997b2d5fced3e3841b4e]
Frank Sorenson (1):
sunrpc: correct the computation for page_ptr when truncating
[5d7a5bcb67c70cbc904057ef52d3fcfeb24420bb]
François Cami (1):
libata: Apply NOLPM quirk for SAMSUNG PM830 CXM13D1Q.
[76936e9a6df17b89481bd2655c8684291afbe656]
Geert Uytterhoeven (4):
iommu/ipmmu-vmsa: Fix crash on early domain free
[e5b78f2e349eef5d4fca5dc1cf5a3b4b2cc27abd]
thermal: rcar: Make error and remove paths symmetrical with init
[ac71c7025ebc1ed25114b1be77dc60b7f8cb8544]
thermal: rcar_thermal: Prevent doing work after unbind
[697ee786f15d7b65c7f3045d45fe3a05d28e0911]
thermal: rcar_thermal: Prevent hardware access during system suspend
[3a31386217628ffe2491695be2db933c25dde785]
Gustavo A. R. Silva (2):
drivers/misc/sgi-gru: fix Spectre v1 vulnerability
[fee05f455ceb5c670cbe48e2f9454ebc4a388554]
drm/ioctl: Fix Spectre v1 vulnerabilities
[505b5240329b922f21f91d5b5d1e535c805eca6d]
H Hartley Sweeten (2):
staging: comedi: quatech_daqp_cs: fix bug in daqp_ao_insn_write()
[e024181b02ed6b833358bede3f2d0c52cb5fb6bc]
staging: comedi: quatech_daqp_cs: use comedi_timeout() in ao (*insn_write)
[e031642eccc040648b09cfc7d632e2e8d0b6f94f]
H. Peter Anvin (2):
arch/alpha, termios: implement BOTHER, IBSHIFT and termios2
[d0ffb805b729322626639336986bc83fc2e60871]
termios, tty/tty_baudrate.c: fix buffer overrun
[991a25194097006ec1e0d2e0814ff920e59e3465]
Halil Pasic (2):
virtio/s390: avoid race on vcdev->config
[2448a299ec416a80f699940a86f4a6d9a4f643b1]
virtio/s390: fix race in ccw_io_helper()
[78b1a52e05c9db11d293342e8d6d8a230a04b4e7]Hangbin Liu (1):
team: no need to do team_notify_peers or team_mcast_rejoin when disabling port
[5ed9dc99107144f83b6c1bb52a69b58875baf540]
Hans Verkuil (1):
media: vb2: don't call __vb2_queue_cancel if vb2_start_streaming failed
[04990215dec43c424daff00d1f622167b8aafd1f]
Hans de Goede (3):
ACPI / platform: Add SMB0001 HID to forbidden_id_list
[2bbb5fa37475d7aa5fa62f34db1623f3da2dfdfa]
iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers
[0145b50566e7de5637e80ecba96c7f0e6fff1aad]
libata: Apply NOLPM quirk for SAMSUNG MZMPC128HBFU-000MV SSD
[b5b4d3a52c8fd6e3fc6469c5a64ca0139c07229e]
Harry Pan (1):
usb: quirk: add no-LPM quirk on SanDisk Ultra Flair device
[2f2dde6ba89b1ef1fe23c1138131b315d9aa4019]
He Zhe (3):
kgdboc: Passing ekgdboc to command line causes panic
[1bd54d851f50dea6af30c3e6ff4f3e9aab5558f9]
printk: Fix panic caused by passing log_buf_len to command line
[277fcdb2cfee38ccdbe07e705dbd4896ba0c9930]
x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided
[ccde460b9ae5c2bd5e4742af0a7f623c2daad566]
Helge Deller (1):
parisc: Fix map_pages() to not overwrite existing pte entries
[3c229b3f2dd8133f61bb81d3cb018be92f4bba39]
Himanshu Madhani (1):
scsi: qla2xxx: Fix incorrect port speed being set for FC adapters
[4c1458df9635c7e3ced155f594d2e7dfd7254e21]
Hou Tao (1):
jffs2: free jffs2_sb_info through jffs2_kill_sb()
[92e2921f7eee63450a5f953f4b15dc6210219430]
Huacai Chen (1):
hwmon: (w83795) temp4_type has writable permission
[09aaf6813cfca4c18034fda7a43e68763f34abb1]
Hui Peng (1):
ALSA: usb-audio: Fix UAF decrement if card has no live interfaces in card.c
[5f8cf712582617d523120df67d392059eaf2fc4b]
Ido Schimmel (1):
rtnetlink: Disallow FDB configuration for non-Ethernet device
[da71577545a52be3e0e9225a946e5fd79cfab015]
Ilya Dryomov (1):
libceph: bump CEPH_MSG_MAX_DATA_LEN
[94e6992bb560be8bffb47f287194adf070b57695]
Ingo Molnar (1):
timer/debug: Change /proc/timer_list from 0444 to 0400
[8e7df2b5b7f245c9bd11064712db5cb69044a362]
Jakub Kicinski (1):
net: sched: gred: pass the right attribute to gred_change_table_def()
[38b4f18d56372e1e21771ab7b0357b853330186c]
Janusz Krzysztofik (1):
ARM: OMAP1: ams-delta: Fix possible use of uninitialized field
[cec83ff1241ec98113a19385ea9e9cfa9aa4125b]
Jason Wang (1):
vhost: make sure used idx is seen before log in vhost_add_used_n()
[841df922417eb82c835e93d4b93eb6a68c99d599]
Jeff Mahoney (1):
btrfs: fix error handling in btrfs_dev_replace_start
[5c06147128fbbdf7a84232c5f0d808f53153defe]
Jeff Moyer (1):
aio: fix spectre gadget in lookup_ioctx
[a538e3ff9dabcdf6c3f477a373c629213d1c3066]
Jens Axboe (2):
floppy: fix race condition in __floppy_read_block_0()
[de7b75d82f70c5469675b99ad632983c50b6f7e7]
scsi: sd: use mempool for discard special page
[61cce6f6eeced5ddd9cac55e807fe28b4f18c1ba]
Jeremy Cline (1):
ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905)
[e7bb6ad5685f05685dd8a6a5eda7bfcd14d5f95b]Jim Mattson (2):
KVM: nVMX: Always reflect #NM VM-exits to L1
[3c6e099fa15fdb6fb1892199ed8709012e1294f2]
kvm: svm: Ensure an IBPB on all affected CPUs when freeing a vmcb
[fd65d3142f734bc4376053c8d75670041903134d]
Jiri Kosina (1):
x86/speculation: Apply IBPB more strictly to avoid cross-process data leak
[dbfe2953f63c640463c630746cd5d9de8b2f63ae]
Joe Jin (1):
xen-swiotlb: use actually allocated size on check physical continuous
[7250f422da0480d8512b756640f131b9b893ccda]
Johan Hovold (3):
USB: serial: cypress_m8: fix interrupt-out transfer length
[56445eef55cb5904096fed7a73cf87b755dfffc7]
net: bcmgenet: fix OF child-node lookup
[d397dbe606120a1ea1b11b0020c3f7a3852da5ac]
of: add helper to lookup compatible child node
[36156f9241cb0f9e37d998052873ca7501ad4b36]
John David Anglin (1):
parisc: Fix address in HPMC IVA
[1138b6718ff74d2a934459643e3754423d23b5e2]
Jorgen Hansen (2):
VMCI: Resource wildcard match fixed
[11924ba5e671d6caef1516923e2bd8c72929a3fe]
VSOCK: Send reset control packet when socket is partially bound
[a915b982d8f5e4295f64b8dd37ce753874867e88]
Josef Bacik (1):
btrfs: wait on caching when putting the bg cache
[3aa7c7a31c26321696b92841d5103461c6f3f517]
Juergen Gross (1):
x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear
[b2d7a075a1ccef2fb321d595802190c8e9b39004]
Julian Wiedmann (2):
s390/qeth: fix length check in SNMP processing
[9a764c1e59684c0358e16ccaafd870629f2cfe67]
s390/qeth: invoke softirqs after napi_schedule()
[4d19db777a2f32c9b76f6fd517ed8960576cb43e]
Junaid Shahid (1):
kvm: mmu: Fix race in emulated page table writes
[0e0fee5c539b61fdd098332e0e2cc375d9073706]
Jörgen Storvist (1):
USB: serial: option: add Simcom SIM7500/SIM7600 (MBIM mode)
[cc6730df08a291e51e145bc65e24ffb5e2f17ab6]
Kai-Heng Feng (4):
ALSA: hda: Add support for AMD Stoney Ridge
[3deef52ce10514ccdebba8e8ab85f9cebd0eb3f7]
USB: Wait for extra delay time after USB_PORT_FEAT_RESET for quirky hub
[781f0766cc41a9dd2e5d118ef4b1d5d89430257b]
USB: quirks: Add no-lpm quirk for Raydium touchscreens
[deefd24228a172d1b27d4a9adbfd2cdacd60ae64]
USB: usb-storage: Add new IDs to ums-realtek
[a84a1bcc992f0545a51d2e120b8ca2ef20e2ea97]
Kirill A. Shutemov (1):
x86/mm: Fix regression with huge pages on PAE
[70f1528747651b20c7769d3516ade369f9963237]
Krzysztof Kozlowski (1):
clk: s2mps11: Fix matching when built as module and DT node contains compatible
[8985167ecf57f97061599a155bb9652c84ea4913]
Ladi Prosek (1):
KVM: x86: Add MSR_AMD64_DC_CFG to the list of ignored MSRs
[405a353a0e20d09090ad96147da6afad9b0ce056]
Lars-Peter Clausen (1):
iio: ad5064: Fix regulator handling
[8911a43bc198877fad9f4b0246a866b26bb547ab]
Leon Romanovsky (1):
RDMA/cm: Respect returned status of cm_init_av_by_path
[e54b6a3bcd1ec972b25a164bdf495d9e7120b107]
Linus Torvalds (1):
disable new gcc-7.1.1 warnings for now
[bd664f6b3e376a8ef4990f87d08271cc2d01ba9a]
Loic Poulain (1):
usb: chipidea: Prevent unbalanced IRQ disable
[8b97d73c4d72a2abf58f8e49062a7ee1e5f1334e]
Lubomir Rintel (2):
ARM: mmp/mmp2: fix cpu_is_mmp2() on mmp2-dt
[76f4e2c3b6a560cdd7a75b87df543e04d05a9e5f]
libertas: don't set URB_ZERO_PACKET on IN USB transfer
[6528d88047801b80d2a5370ad46fb6eff2f509e0]Luca Coelho (1):
iwlwifi: mvm: check return value of rs_rate_from_ucode_rate()
[3d71c3f1f50cf309bd20659422af549bc784bfff]
Lukas Czerner (1):
ext4: initialize retries variable in ext4_da_write_inline_data_begin()
[625ef8a3acd111d5f496d190baf99d1a815bd03e]
Lukas Wunner (2):
PCI/ASPM: Fix link_state teardown on device removal
[aeae4f3e5c38d47bdaef50446dc0ec857307df68]
genirq: Fix race on spurious interrupt detection
[746a923b863a1065ef77324e1e43f19b1a3eab5c]
Maarten Jacobs (1):
usb: cdc-acm: add entry for Hiro (Conexant) modem
[63529eaa6164ef7ab4b907b25ac3648177e5e78f]
Maciej S. Szmigiero (1):
pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges
[95691e3eddc41da2d1cd3cca51fecdfb46bd85bc]
Macpaul Lin (1):
kgdboc: fix KASAN global-out-of-bounds bug in param_set_kgdboc_var()
[dada6a43b0402eba438a17ac86fdc64ac56a4607]
Marc Kleine-Budde (4):
can: dev: __can_get_echo_skb(): Don't crash the kernel if can_priv::echo_skb is accessed out of bounds
[e7a6994d043a1e31d5b17706a22ce33d2a3e4cdc]
can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb
[7da11ba5c5066dadc2e96835a6233d56d7b7764a]
can: dev: __can_get_echo_skb(): replace struct can_frame by canfd_frame to access frame length
[200f5c49f7a2cd694436bfc6cb0662b794c96736]
can: dev: can_get_echo_skb(): factor out non sending code to __can_get_echo_skb()
[a4310fa2f24687888ce80fdb0e88583561a23700]
Marco Felsch (1):
media: tvp5150: fix width alignment during set_selection()
[bd24db04101f45a9c1d874fe21b0c7eab7bcadec]
Marek Szyprowski (1):
ARM: dts: exynos: Disable pull control for MAX8997 interrupts on Origen
[f5e758b8358f6c27e8a351ddf0b441a64cdabb94]
Mathias Nyman (3):
usb: xhci: Prevent bus suspend if a port connect change or polling state is detected
[2f31a67f01a8beb22cae754c53522cb61a005750]
xhci: Don't prevent USB2 bus suspend in state check intended for USB3 only
[45f750c16cae3625014c14c77bd9005eda975d35]
xhci: Prevent U1/U2 link pm states if exit latency is too long
[0472bf06c6fd33c1a18aaead4c8f91e5a03d8d7b]
Mathias Payer (1):
USB: check usb_get_extra_descriptor for proper size
[704620afc70cf47abb9d6a1a57f3825d2bca49cf]
Mattias Jacobsson (1):
USB: misc: appledisplay: add 20" Apple Cinema Display
[f6501f49199097b99e4e263644d88c90d1ec1060]
Mauro Carvalho Chehab (3):
media: em28xx: fix input name for Terratec AV 350
[15644bfa195bd166d0a5ed76ae2d587f719c3dac]
media: em28xx: make v4l2-compliance happier by starting sequence on zero
[afeaade90db4c5dab93f326d9582be1d5954a198]
media: em28xx: use a default format if TRY_FMT fails
[f823ce2a1202d47110a7ef86b65839f0be8adc38]
Max Filippov (6):
xtensa: add NOTES section to the linker script
[4119ba211bc4f1bf638f41e50b7a0f329f58aa16]
xtensa: enable coprocessors that are being flushed
[2958b66694e018c552be0b60521fec27e8d12988]
xtensa: fix boot parameters address translation
[40dc948f234b73497c3278875eb08a01d5854d3f]
xtensa: fix coprocessor context offset definitions
[03bc996af0cc71c7f30c384d8ce7260172423b34]
xtensa: fix coprocessor part of ptrace_{get,set}xregs
[38a35a78c5e270cbe53c4fef6b0d3c2da90dd849]
xtensa: make sure bFLT stack is 16 byte aligned
[0773495b1f5f1c5e23551843f87b5ff37e7af8f7]
Michael Kelley (2):
clockevents/drivers/i8253: Add support for PIT shutdown quirk
[35b69a420bfb56b7b74cb635ea903db05e357bec]
x86/hyper-v: Enable PIT shutdown quirk
[1de72c706488b7be664a601cf3843bd01e327e58]
Michael Niewöhner (1):
usb: core: quirks: add RESET_RESUME quirk for Cherry G230 Stream series
[effd14f66cc1ef6701a19c5a56e39c35f4d395a5]
Michal Hocko (1):
memory_hotplug: cond_resched in __remove_pages
[dd33ad7b251f900481701b2a82d25de583867708]
Mike Kravetz (2):
hugetlbfs: dirty pages as they are added to pagecache
[22146c3ce98962436e401f7b7016a6f664c9ffb5]
hugetlbfs: fix kernel BUG at fs/hugetlbfs/inode.c:444!
[5e41540c8a0f0e98c337dda8b391e5dda0cde7cf]
Miklos Szeredi (3):
fuse: cleanup fuse_file refcounting
[267d84449f52349ee252db684ed95ede18e51744]
fuse: fix blocked_waitq wakeup
[908a572b80f6e9577b45e81b3dfe2e22111286b8]
fuse: fix leaked notify reply
[7fabaf303458fcabb694999d6fa772cc13d4e217]
Mikulas Patocka (2):
mach64: fix display corruption on big endian machines
[3c6c6a7878d00a3ac997a779c5b9861ff25dfcc8]
mach64: fix image corruption due to reading accelerator registers
[c09bcc91bb94ed91f1391bffcbe294963d605732]
Nadav Amit (1):
media: uvcvideo: Fix uvc_alloc_entity() allocation alignment
[89dd34caf73e28018c58cd193751e41b1f8bdc56]
Nathan Chancellor (2):
clk: s2mps11: Add used attribute to s2mps11_dt_match
[9c940bbe2bb47e03ca5e937d30b6a50bf9c0e671]
misc: atmel-ssc: Fix section annotation on atmel_ssc_get_driver_data
[7c97301285b62a41d6bceded7d964085fc8cc50f]
Naveen N. Rao (2):
powerpc/pseries: Fix DTL buffer registration
[db787af1b8a6b4be428ee2ea7d409dafcaa4a43c]
powerpc/pseries: Fix how we iterate over the DTL entries
[9258227e9dd1da8feddb07ad9702845546a581c9]
Nicholas Mc Guire (2):
media: pci: cx23885: handle adding to list failure
[c5d59528e24ad22500347b199d52b9368e686a42]
usb: gadget: fsl_udc_core: check allocation return value and cleanup on failure
[4ab2b48c98f2ec9712452d520a381917f91ac3d2]
Nicolas Dichtel (1):
tun: forbid iface creation with rtnl ops
[35b827b6d06199841a83839e8bb69c0cd13a28be]
Nicolas Huaman (1):
ALSA: usb-audio: update quirk for B&W PX to remove microphone
[c369c8db15d51fa175d2ba85928f79d16af6b562]
Nicolas Pitre (1):
Cramfs: fix abad comparison when wrap-arounds occur
[672ca9dd13f1aca0c17516f76fc5b0e8344b3e46]
Nikolay Borisov (1):
btrfs: Always try all copies when reading extent buffers
[f8397d69daef06d358430d3054662fb597e37c00]
Oliver Hartkopp (1):
can: raw: check for CAN FD capable netdev in raw_sendmsg()
[a43608fa77213ad5ac5f75994254b9f65d57cfa0]
Ondrej Mosnacek (1):
crypto: lrw - Fix out-of bounds access on counter overflow
[fbe1a850b3b1522e9fc22319ccbbcd2ab05328d2]
Pan Bian (5):
btrfs: relocation: set trans to be NULL after ending transaction
[42a657f57628402c73237547f0134e083e2f6764]
exportfs: do not read dentry after free
[2084ac6c505a58f7efdec13eba633c6aaa085ca5]
ext2: fix potential use after free
[ecebf55d27a11538ea84aee0be643dd953f830d5]
hfs: do not free node before using
[ce96a407adef126870b3f4a1b73529dd8aa80f49]
rapidio/rionet: do not free skb before reading its length
[cfc435198f53a6fa1f656d98466b24967ff457d0]
Paolo Bonzini (1):
KVM: x86: remove code for lazy FPU handling
[bd7e5b0899a429445cc6e3037c13f8b5ae3be903]
Parav Pandit (3):
IB/cm: Avoid AV ah_attr overwriting during LAP message handling
[a5c57d327272bdf3a8b19686eaca2ec683449e67]
IB/cm: Fix sleeping while spin lock is held
[33f93e1ebcf5acfaef06cda2d3e373730519e33e]
IB/{cm, umad}: Handle av init error
[0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f]
Paul Mackerras (1):
powerpc: Fix COFF zImage booting on old powermacs
[5564597d51c8ff5b88d95c76255e18b13b760879]
Paul Moore (1):
cipso: don't use IPCB() to locate the CIPSO IP option
[04f81f0154e4bf002be6f4d85668ce1257efa4d9]
Paulo Alcantara (1):
cifs: Fix separator when building path from dentry
[c988de29ca161823db6a7125e803d597ef75b49c]
Petr Machata (1):
vxlan: Fix error path in __vxlan_dev_create()
[6db9246871394b3a136cd52001a0763676563840]
Punnaiah Choudary Kalluri (1):
net: macb: Fix race condition in driver when Rx frame is dropped
[d4c216c54197d741ed8b7ca54f13645dfb3eacde]
Quinn Tran (1):
scsi: qla2xxx: shutdown chip if reset fail
[1e4ac5d6fe0a4af17e4b6251b884485832bf75a3]
Richard Genoud (2):
dmaengine: at_hdmac: fix memory leak in at_dma_xlate()
[98f5f932254b88ce828bc8e4d1642d14e5854caa]
dmaengine: at_hdmac: fix module unloading
[77e75fda94d2ebb86aa9d35fb1860f6395bf95de]
Richard Weinberger (2):
um: Drop own definition of PTRACE_SYSEMU/_SINGLESTEP
[0676b957c24bfb6e495449ba7b7e72c5b5d79233]
um: Give start_idle_thread() a return code
[7ff1e34bbdc15acab823b1ee4240e94623d50ee8]
Robbie Ko (1):
Btrfs: fix cur_offset in the error case for nocow
[506481b20e818db40b6198815904ecd2d6daee64]
Russell King (1):
mmc: omap_hsmmc: fix DMA API warning
[0b479790684192ab7024ce6a621f93f6d0a64d92]
Sagi Grimberg (1):
iser: set sector for ambiguous mr status errors
[24c3456c8d5ee6fc1933ca40f7b4406130682668]
Sakari Ailus (1):
media: v4l: event: Add subscription to list before calling "add" operation
[92539d3eda2c090b382699bbb896d4b54e9bdece]
Sandeep Singh (1):
xhci: workaround CSS timeout on AMD SNPS 3.0 xHC
[a7d57abcc8a5bdeb53bbf8e87558e8e0a2c2a29d]
Sebastian Parschauer (2):
HID: Add quirk for Microsoft PIXART OEM mouse
[e82e62e390d39c3819641cd721695702180d54fb]
HID: Add quirk for Primax PIXART OEM mice
[fb862c3b199d28bee238d52e8270eae8650d6cb0]
Sergei Shtylyov (1):
spi: sh-msiof: fix deferred probing
[f34c6e6257aa477cdfe7e9bbbecd3c5648ecda69]
Serhey Popovych (1):
tun: Consistently configure generic netdev params via rtnetlink
[df52eab23d703142c766ac00bdb8db19d71238d0]
Spencer E. Olson (1):
staging: comedi: ni_mio_common: protect register write overflow
[1cbca5852d6c16e85a21487a15d211195aacd4a1]
Stefan Nuernberger (1):
net/ipv4: defensive cipso option parsing
[076ed3da0c9b2f88d9157dbe7044a45641ae369e]
Stefano Brivio (1):
ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called
[ee1abcf689353f36d9322231b4320926096bdee0]
Steve French (3):
smb3: allow stats which track session and share reconnects to be reset
[2c887635cd6ab3af619dc2be94e5bf8f2e172b78]
smb3: do not attempt cifs operation in smb3 query info error path
[1e77a8c204c9d1b655c61751b8ad0fde22421dbb]
smb3: on kerberos mount if server doesn't specify auth type use krb5
[926674de6705f0f1dbf29a62fd758d0977f535d6]
Steven Rostedt (2):
tracing: Fix memory leak in set_trigger_filter()
[3cec638b3d793b7cacdec5b8072364b41caeb0e1]
tracing: Fix memory leak of instance function hash filters
[2840f84f74035e5a535959d5f17269c69fa6edc5]
Sven Eckelmann (3):
batman-adv: Check total_size when queueing fragments
[53e771457e823fbc21834f60508c42a4270534fd]
batman-adv: Expand merged fragment buffer for full packet
[d7d8bbb40a5b1f682ee6589e212934f4c6b8ad60]
batman-adv: Use only queued fragments when merging
[83e8b87721f21b26b843633caca8ef453e943623]
Taehee Yoo (1):
netfilter: xt_IDLETIMER: add sysfs filename checking routine
[54451f60c8fa061af9051a53be9786393947367c]
Takashi Iwai (8):
ALSA: ac97: Fix incorrect bit shift at AC97-SPSA control write
[7194eda1ba0872d917faf3b322540b4f57f11ba5]
ALSA: control: Fix race between adding and removing a user element
[e1a7bfe3807974e66f971f2589d4e0197ec0fced]
ALSA: oss: Use kvzalloc() for local buffer allocations
[65766ee0bf7fe8b3be80e2e1c3ef54ad59b29476]
ALSA: pcm: Call snd_pcm_unlink() conditionally at closing
[b51abed8355e5556886623b2772fa6b7598d2282]
ALSA: sparc: Fix invalid snd_free_pages() at error path
[9a20332ab373b1f8f947e0a9c923652b32dab031]
ALSA: usb-audio: Avoid nested autoresume calls
[47ab154593827b1a8f0713a2b9dd445753d551d8]
ALSA: usb-audio: Replace probing flag with active refcount
[a6da499b76b1a75412f047ac388e9ffd69a5c55b]
ALSA: wss: Fix invalid snd_free_pages() at error path
[7b69154171b407844c273ab4c10b5f0ddcd6aa29]
Takashi Sakamoto (1):
ALSA: control: fix failure to return numerical ID in 'add' event
[d34890cf4113397625a6629d71749fa638a7a734]
Tang Junhui (1):
bcache: fix miss key refill->end in writeback
[2d6cb6edd2c7fb4f40998895bda45006281b1ac5]Tang.Junhui (1):
bcache: fix wrong cache_misses statistics
[c157313791a999646901b3e3c6888514ebc36d62]
Tarick Bedeir (1):
net/mlx4_core: Correctly set PFC param if global pause is turned off.
[bd5122cd1e0644d8bd8dd84517c932773e999766]
Theodore Ts'o (4):
ext4: avoid possible double brelse() in add_new_gdb() on error path
[4f32c38b4662312dd3c5f113d8bdd459887fb773]
ext4: fix EXT4_IOC_SWAP_BOOT
[18aded17492088962ef43f00825179598b3e8c58]
ext4: fix possible leak of sbi->s_group_desc_leak in error path
[9e463084cdb22e0b56b2dfbc50461020409a5fd3]
ext4: fix use-after-free race in ext4_remount()'s error path
[33458eaba4dfe778a426df6a19b7aad2ff9f7eec]Thomas Gleixner (2):
mac80211_hwsim: Replace bogus hrtimer clockid
[8fbcfeb8a9cc803464d6c166e7991913711c612c]
x86/eisa: Add missing include
[ef1d4deab953ecb1dfcf9f167043bda8b3f14a11]
Thomas Zimmermann (1):
drm/ast: Remove existing framebuffers before loading driver
[5478ad10e7850ce3d8b7056db05ddfa3c9ddad9a]
Thor Thayer (1):
net: stmmac: Fix RX packet size > 8191
[8137b6ef0ce469154e5cf19f8e7fe04d9a72ac5e]
Tom Lendacky (1):
x86/mm: Simplify p[g4um]d_page() macros
[fd7e315988b784509ba3f1b42f539bd0b1fca9bb]Tomasz Figa (1):
power: supply: max8998-charger: Fix platform data retrieval
[cb90a2c6f77fe9b43d1e3f759bb2f13fe7fa1811]
Tony Luck (1):
EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting
[432de7fd7630c84ad24f1c2acd1e3bb4ce3741ca]
Tore Anderson (1):
USB: serial: option: add HP lt4132
[d57ec3c83b5153217a70b561d4fb6ed96f2f7a25]
Toshi Kani (3):
x86/asm: Add pud/pmd mask interfaces to handle large PAT bit
[4be4c1fb9a754b100466ebaec50f825be0b2050b]
x86/asm: Fix pud/pmd interfaces to handle large PAT bit
[f70abb0fc3da1b2945c92751ccda2744081bf2b7]
x86/asm: Move PUD_PAGE macros to page_types.h
[832102671855f73962e7a04fdafd48b9385ea5c6]
Trond Myklebust (3):
NFSv4: Don't exit the state manager without clearing NFS4CLNT_MANAGER_RUNNING
[21a446cf186570168b7281b154b1993968598aca]
SUNRPC: Fix a potential race in xprt_connect()
[0a9a4304f3614e25d9de9b63502ca633c01c0d70]
nfsd: Fix an Oops in free_session()
[bb6ad5572c0022e17e846b382d7413cdcf8055be]
Ulf Hansson (2):
mmc: core: Reset HPI enabled state during re-init and in case of errors
[a0741ba40a009f97c019ae7541dc61c1fdf41efb]
mmc: core: Use a minimum 1600ms timeout when enabling CACHE ctrl
[e3ae3401aa19432ee4943eb0bbc2ec704d07d793]
Vasily Averin (10):
ext4: add missing brelse() add_new_gdb_meta_bg()'s error path
[61a9c11e5e7a0dab5381afa5d9d4dd5ebf18f7a0]
ext4: add missing brelse() in set_flexbg_block_bitmap()'s error path
[cea5794122125bf67559906a0762186cf417099c]
ext4: add missing brelse() update_backups()'s error path
[ea0abbb648452cdb6e1734b702b6330a7448fcf8]
ext4: avoid buffer leak in ext4_orphan_add() after prior errors
[feaf264ce7f8d54582e2f66eb82dd9dd124c94f3]
ext4: avoid potential extra brelse in setup_new_flex_group_blocks()
[9e4028935cca3f9ef9b6a90df9da6f1f94853536]
ext4: fix buffer leak in __ext4_read_dirblock() on error path
[de59fae0043f07de5d25e02ca360f7d57bfa5866]
ext4: fix buffer leak in ext4_xattr_move_to_block() on error path
[6bdc9977fcdedf47118d2caf7270a19f4b6d8a8f]
ext4: fix missing cleanup if ext4_alloc_flex_bg_array() fails while resizing
[f348e2241fb73515d65b5d77dd9c174128a7fbf2]
ext4: fix possible inode leak in the retry loop of ext4_resize_fs()
[db6aee62406d9fbb53315fcddd81f1dc271d49fa]
ext4: release bs.bh before re-using in ext4_xattr_block_find()
[45ae932d246f721e6584430017176cbcadfde610]
Vasyl Vavrychuk (1):
mac80211_hwsim: Timer should be initialized before device registered
[a1881c9b8a1edef0a5ae1d5c1b61406fe3402114]
Ville Syrjälä (2):
drm/i915: Disable LP3 watermarks on all SNB machines
[03981c6ebec4fc7056b9b45f847393aeac90d060]
drm: Rewrite drm_ioctl_flags() to resemble the new drm_ioctl() code
[7ef5f82b100716b23de7d2da6ff602b0842e5804]
Wanpeng Li (1):
KVM: X86: Fix NULL deref in vcpu_scan_ioapic
[dcbd3e49c2f0b2c2d8a321507ff8f3de4af76d7c]
Wei Yongjun (1):
IB/mthca: Fix error return code in __mthca_init_one()
[39f2495618c5e980d2873ea3f2d1877dd253e07a]
Wenwen Wang (1):
dm ioctl: harden copy_params()'s copy_from_user() from malicious users
[800a7340ab7dd667edf95e74d8e4f23a17e87076]
Wolfram Sang (1):
mmc: core: use mrq->sbc when sending CMD23 for RPMB
[a44f7cb937321d4961bfc8f28912126b06e701c5]Xin Long (1):
l2tp: fix a sock refcnt leak in l2tp_tunnel_register
[f8504f4ca0a0e9f84546ef86e00b24d2ea9a0bd2]
Y.C. Chen (2):
drm/ast: change resolution may cause screen blurred
[1a37bd823891568f8721989aed0615835632d81a]
drm/ast: fixed cursor may disappear sometimes
[7989b9ee8bafe5cc625381dd0c3c4586de27ca26]
Yogesh Gaur (1):
mtd: spi-nor: fsl-quadspi: fix api naming typo _init_ahb_read
[dd50a1c4e56d6d2ea753f87a35b1f1e09cb877d7]
Young Xiao (1):
staging: rtl8712: Fix possible buffer overrun
[300cd664865bed5d50ae0a42fb4e3a6f415e8a10]
YueHaibing (3):
SUNRPC: drop pointless static qualifier in xdr_get_next_encode_buffer()
[025911a5f4e36955498ed50806ad1b02f0f76288]
exportfs: fix 'passing zero to ERR_PTR()' warning
[909e22e05353a783c526829427e9a8de122fba9c]
sysv: return 'err' instead of 0 in __sysv_write_inode
[c4b7d1ba7d263b74bb72e9325262a67139605cde]
Yujuan.Qi (1):
Cipso: cipso_v4_optptr enter infinite loop
[40413955ee265a5e42f710940ec78f5450d49149]
Zhimin Gu (1):
x86, hibernate: Fix nosave_regions setup for hibernation
[cc55f7537db6af371e9c1c6a71161ee40f918824]
Makefile | 8 +- arch/alpha/include/asm/termios.h | 8 +- arch/alpha/include/uapi/asm/ioctls.h | 5 + arch/alpha/include/uapi/asm/termbits.h | 17 ++++ arch/arm/boot/dts/exynos4210-origen.dts | 9 ++ arch/arm/include/asm/uaccess.h | 2 +- arch/arm/mach-mmp/include/mach/cputype.h | 6 +- arch/arm/mach-omap1/board-ams-delta.c | 3 + arch/mips/include/asm/syscall.h | 2 +- arch/parisc/kernel/entry.S | 2 +- arch/parisc/kernel/traps.c | 3 +- arch/parisc/mm/init.c | 8 +- arch/powerpc/boot/crt0.S | 4 +- arch/powerpc/platforms/pseries/dtl.c | 4 +- arch/s390/hypfs/hypfs_vm.c | 2 +- arch/s390/include/asm/timex.h | 10 +- arch/sparc/kernel/signal_32.c | 4 +- arch/um/os-Linux/skas/process.c | 5 + arch/x86/boot/boot.h | 1 - arch/x86/boot/compressed/eboot.c | 3 +- arch/x86/boot/video-mode.c | 2 + arch/x86/boot/video.c | 2 + arch/x86/include/asm/kvm_host.h | 2 - arch/x86/include/asm/page_64_types.h | 3 - arch/x86/include/asm/page_types.h | 13 ++- arch/x86/include/asm/pgtable-3level.h | 7 +- arch/x86/include/asm/pgtable.h | 19 ++-- arch/x86/include/asm/pgtable_types.h | 34 ++++++- arch/x86/include/asm/x86_init.h | 1 - arch/x86/include/uapi/asm/msr-index.h | 1 + arch/x86/kernel/check.c | 15 +++ arch/x86/kernel/cpu/mshyperv.c | 11 +++ arch/x86/kernel/cpu/mtrr/if.c | 2 + arch/x86/kernel/eisa.c | 1 + arch/x86/kernel/setup.c | 2 +- arch/x86/kvm/mmu.c | 27 ++--- arch/x86/kvm/svm.c | 62 ++++-------- arch/x86/kvm/vmx.c | 121 +++-------------------- arch/x86/kvm/x86.c | 21 ++-- arch/x86/mm/tlb.c | 29 ++++-- arch/x86/um/shared/sysdep/ptrace_32.h | 10 -- arch/x86/vdso/vclock_gettime.c | 8 +- arch/xtensa/boot/Makefile | 2 +- arch/xtensa/include/asm/processor.h | 6 +- arch/xtensa/kernel/asm-offsets.c | 16 +-- arch/xtensa/kernel/head.S | 7 +- arch/xtensa/kernel/process.c | 5 +- arch/xtensa/kernel/ptrace.c | 42 +++++++- arch/xtensa/kernel/vmlinux.lds.S | 1 + crypto/lrw.c | 7 +- drivers/acpi/acpi_platform.c | 1 + drivers/acpi/acpica/dsopcode.c | 4 + drivers/ata/libata-core.c | 5 + drivers/block/floppy.c | 3 +- drivers/clk/clk-s2mps11.c | 27 +++++ drivers/clocksource/i8253.c | 14 ++- drivers/devfreq/devfreq.c | 53 +++++++++- drivers/dma/at_hdmac.c | 10 +- drivers/edac/i7core_edac.c | 1 + drivers/edac/sb_edac.c | 1 + drivers/gpio/gpio-max7301.c | 12 +-- drivers/gpu/drm/ast/ast_drv.c | 21 ++++ drivers/gpu/drm/ast/ast_mode.c | 3 +- drivers/gpu/drm/drm_drv.c | 21 ++-- drivers/gpu/drm/i915/i915_gem.c | 15 ++- drivers/gpu/drm/i915/intel_pm.c | 43 +++++++- drivers/hid/hid-ids.h | 3 + drivers/hid/hid-sensor-hub.c | 13 ++- drivers/hid/uhid.c | 13 +++ drivers/hid/usbhid/hid-quirks.c | 3 + drivers/hid/usbhid/hiddev.c | 18 +++- drivers/hv/channel.c | 8 ++ drivers/hv/hv_kvp.c | 24 ++++- drivers/hv/vmbus_drv.c | 20 ++++ drivers/hwmon/pmbus/pmbus.c | 2 + drivers/hwmon/pmbus/pmbus_core.c | 5 +- drivers/hwmon/w83795.c | 2 +- drivers/iio/accel/hid-sensor-accel-3d.c | 5 +- drivers/iio/adc/at91_adc.c | 6 +- drivers/iio/dac/ad5064.c | 55 ++++++++--- drivers/iio/gyro/hid-sensor-gyro-3d.c | 5 +- drivers/iio/light/hid-sensor-als.c | 8 +- drivers/iio/light/hid-sensor-prox.c | 8 +- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 8 +- drivers/iio/orientation/hid-sensor-incl-3d.c | 8 +- drivers/iio/pressure/hid-sensor-press.c | 8 +- drivers/infiniband/core/cm.c | 42 +++++--- drivers/infiniband/core/user_mad.c | 10 +- drivers/infiniband/hw/mthca/mthca_main.c | 3 +- drivers/infiniband/ulp/iser/iser_verbs.c | 7 +- drivers/input/keyboard/matrix_keypad.c | 23 +++-- drivers/iommu/ipmmu-vmsa.c | 3 + drivers/md/bcache/btree.c | 2 +- drivers/md/bcache/request.c | 6 +- drivers/md/dm-ioctl.c | 18 ++-- drivers/media/i2c/tvp5150.c | 14 ++- drivers/media/pci/cx23885/altera-ci.c | 10 ++ drivers/media/usb/cx231xx/cx231xx-video.c | 2 +- drivers/media/usb/em28xx/em28xx-cards.c | 4 +- drivers/media/usb/em28xx/em28xx-video.c | 8 +- drivers/media/usb/uvc/uvc_driver.c | 2 +- drivers/media/v4l2-core/v4l2-event.c | 43 ++++---- drivers/media/v4l2-core/videobuf2-core.c | 4 +- drivers/misc/atmel-ssc.c | 2 +- drivers/misc/genwqe/card_base.h | 2 +- drivers/misc/genwqe/card_dev.c | 9 +- drivers/misc/sgi-gru/grukdump.c | 4 + drivers/misc/vmw_vmci/vmci_resource.c | 3 +- drivers/mmc/card/block.c | 15 ++- drivers/mmc/core/mmc.c | 19 +++- drivers/mmc/host/omap.c | 11 ++- drivers/mmc/host/omap_hsmmc.c | 12 ++- drivers/mtd/devices/Kconfig | 2 +- drivers/mtd/spi-nor/fsl-quadspi.c | 14 ++- drivers/net/can/dev.c | 48 ++++++--- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +- drivers/net/ethernet/cadence/macb.c | 22 ++++- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 4 +- drivers/net/ethernet/mellanox/mlx4/mlx4.h | 4 +- drivers/net/ethernet/neterion/vxge/vxge-config.c | 2 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 3 +- drivers/net/ethernet/stmicro/stmmac/descs_com.h | 2 +- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 +- drivers/net/ethernet/stmicro/stmmac/ring_mode.c | 2 +- drivers/net/phy/phy_device.c | 2 - drivers/net/rionet.c | 2 +- drivers/net/team/team.c | 2 - drivers/net/tun.c | 2 +- drivers/net/vxlan.c | 13 ++- drivers/net/wireless/iwlwifi/mvm/rs.c | 29 ++++-- drivers/net/wireless/libertas/if_usb.c | 2 - drivers/net/wireless/libertas_tf/if_usb.c | 5 +- drivers/net/wireless/mac80211_hwsim.c | 8 +- drivers/of/base.c | 25 +++++ drivers/pci/pcie/aspm.c | 2 +- drivers/pci/quirks.c | 4 + drivers/pci/remove.c | 4 +- drivers/pcmcia/ricoh.h | 35 +++++++ drivers/pcmcia/yenta_socket.c | 3 +- drivers/power/max8998_charger.c | 2 +- drivers/rtc/rtc-hid-sensor-time.c | 2 +- drivers/s390/block/dasd_alias.c | 3 +- drivers/s390/kvm/virtio_ccw.c | 17 +++- drivers/s390/net/qeth_core_main.c | 27 +++-- drivers/s390/net/qeth_l2_main.c | 3 + drivers/s390/net/qeth_l3_main.c | 3 + drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 3 +- drivers/scsi/esp_scsi.c | 1 + drivers/scsi/esp_scsi.h | 2 + drivers/scsi/mac_esp.c | 2 + drivers/scsi/qla2xxx/qla_init.c | 2 +- drivers/scsi/qla2xxx/qla_mbx.c | 5 +- drivers/scsi/sd.c | 17 +++- drivers/spi/spi-sh-msiof.c | 4 +- drivers/staging/comedi/drivers/ni_mio_common.c | 22 +++-- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 25 ++++- drivers/staging/rtl8712/mlme_linux.c | 2 +- drivers/staging/rtl8712/rtl871x_mlme.c | 2 +- drivers/thermal/rcar_thermal.c | 9 +- drivers/tty/serial/kgdboc.c | 9 +- drivers/tty/tty_ioctl.c | 4 +- drivers/uio/uio.c | 7 +- drivers/usb/chipidea/otg.h | 3 +- drivers/usb/class/cdc-acm.c | 3 + drivers/usb/core/hub.c | 16 ++- drivers/usb/core/quirks.c | 18 ++++ drivers/usb/core/usb.c | 6 +- drivers/usb/dwc3/gadget.c | 6 -- drivers/usb/gadget/fsl_udc_core.c | 30 +++++- drivers/usb/host/hwa-hc.c | 2 +- drivers/usb/host/xhci-hub.c | 67 +++++++++---- drivers/usb/host/xhci-pci.c | 4 + drivers/usb/host/xhci-ring.c | 2 +- drivers/usb/host/xhci.c | 42 +++++++- drivers/usb/host/xhci.h | 5 +- drivers/usb/misc/appledisplay.c | 2 + drivers/usb/serial/cypress_m8.c | 2 +- drivers/usb/serial/option.c | 8 +- drivers/usb/storage/unusual_realtek.h | 10 ++ drivers/vhost/vhost.c | 2 + drivers/video/fbdev/aty/mach64_accel.c | 28 +++--- drivers/w1/masters/omap_hdq.c | 2 + drivers/xen/swiotlb-xen.c | 6 ++ fs/aio.c | 2 + fs/btrfs/dev-replace.c | 7 +- fs/btrfs/disk-io.c | 10 +- fs/btrfs/extent-tree.c | 1 + fs/btrfs/file.c | 30 ++++-- fs/btrfs/free-space-cache.c | 2 + fs/btrfs/inode.c | 6 +- fs/btrfs/ioctl.c | 12 ++- fs/btrfs/qgroup.c | 3 +- fs/btrfs/relocation.c | 1 + fs/btrfs/super.c | 1 + fs/cifs/cifs_debug.c | 3 + fs/cifs/cifs_spnego.c | 6 +- fs/cifs/dir.c | 2 +- fs/cifs/inode.c | 10 +- fs/cramfs/inode.c | 3 +- fs/exportfs/expfs.c | 3 +- fs/ext2/xattr.c | 2 +- fs/ext4/ext4.h | 3 +- fs/ext4/inline.c | 2 +- fs/ext4/ioctl.c | 33 +++++-- fs/ext4/namei.c | 5 +- fs/ext4/resize.c | 28 +++--- fs/ext4/super.c | 91 ++++++++++------- fs/ext4/xattr.c | 4 + fs/fuse/dev.c | 19 +++- fs/fuse/dir.c | 4 +- fs/fuse/file.c | 37 +++---- fs/fuse/fuse_i.h | 3 +- fs/gfs2/ops_fstype.c | 3 + fs/hfs/btree.c | 3 +- fs/jffs2/super.c | 4 +- fs/lockd/host.c | 2 +- fs/namespace.c | 22 ++++- fs/nfs/nfs4state.c | 8 +- fs/ocfs2/dir.c | 3 +- fs/sysv/inode.c | 2 +- fs/xfs/xfs_stats.c | 2 +- include/linux/can/dev.h | 1 + include/linux/ceph/libceph.h | 8 +- include/linux/hid-sensor-hub.h | 4 +- include/linux/i8253.h | 1 + include/linux/kvm_host.h | 2 - include/linux/netfilter/x_tables.h | 2 + include/linux/of.h | 8 ++ include/linux/ptrace.h | 21 +++- include/linux/uaccess.h | 3 + include/linux/usb.h | 4 +- include/linux/usb/quirks.h | 3 + include/net/cipso_ipv4.h | 25 +++-- kernel/bounds.c | 4 +- kernel/events/uprobes.c | 12 ++- kernel/irq/manage.c | 8 +- kernel/printk/printk.c | 7 +- kernel/ptrace.c | 10 ++ kernel/signal.c | 2 +- kernel/time/timer_list.c | 2 +- kernel/trace/ftrace.c | 1 + kernel/trace/trace_events_trigger.c | 6 +- mm/hugetlb.c | 29 +++++- mm/memory_hotplug.c | 2 + net/batman-adv/fragmentation.c | 20 ++-- net/batman-adv/types.h | 2 + net/can/raw.c | 15 +-- net/core/dev.c | 4 + net/core/rtnetlink.c | 13 +++ net/ipv4/cipso_ipv4.c | 62 ++++++++---- net/ipv6/ip6_fib.c | 6 +- net/ipv6/ip6_vti.c | 1 + net/ipv6/ndisc.c | 3 +- net/l2tp/l2tp_core.c | 9 +- net/llc/af_llc.c | 13 +-- net/mac80211/iface.c | 2 + net/mac80211/rx.c | 1 + net/mac80211/tx.c | 4 +- net/netfilter/nf_tables_api.c | 22 ++--- net/netfilter/nft_compat.c | 3 +- net/netfilter/x_tables.c | 30 ++++++ net/netfilter/xt_IDLETIMER.c | 20 ++++ net/netfilter/xt_hashlimit.c | 5 +- net/netfilter/xt_recent.c | 6 +- net/netlabel/netlabel_kapi.c | 15 ++- net/sched/sch_gred.c | 2 +- net/sunrpc/auth_gss/auth_gss.c | 4 + net/sunrpc/svc_xprt.c | 2 +- net/sunrpc/xdr.c | 7 +- net/sunrpc/xprt.c | 11 ++- net/vmw_vsock/vmci_transport.c | 67 +++++++++---- net/xfrm/xfrm_state.c | 2 +- security/integrity/ima/ima_fs.c | 6 +- sound/core/control.c | 79 ++++++++------- sound/core/oss/pcm_oss.c | 2 +- sound/core/oss/pcm_plugin.c | 2 +- sound/core/pcm_native.c | 3 +- sound/isa/wss/wss_lib.c | 2 - sound/pci/ac97/ac97_codec.c | 2 +- sound/pci/ca0106/ca0106.h | 2 +- sound/pci/hda/hda_intel.c | 4 + sound/pci/hda/patch_conexant.c | 1 + sound/sparc/cs4231.c | 8 +- sound/usb/card.c | 81 ++++++++++----- sound/usb/endpoint.c | 10 +- sound/usb/mixer.c | 32 ++---- sound/usb/mixer_quirks.c | 112 ++++++++++----------- sound/usb/pcm.c | 32 +++--- sound/usb/proc.c | 4 +- sound/usb/quirks-table.h | 9 +- sound/usb/usbaudio.h | 11 ++- tools/power/cpupower/bench/parse.c | 2 +- 293 files changed, 2221 insertions(+), 1084 deletions(-)
Signature · 3 lines
Ben Hutchings
Horngren's Observation:
Among economists, the real world is often a special case.PATCH 1/305 x86/asm: Add pud/pmd mask interfaces to handle large PAT bit
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit 4be4c1fb9a754b100466ebaec50f825be0b2050b upstream.
The PAT bit gets relocated to bit 12 when PUD and PMD mappings are used. This bit 12, however, is not covered by PTE_FLAGS_MASK, which is used for masking pfn and flags for all levels.
Add pud/pmd mask interfaces to handle pfn and flags properly by using P?D_PAGE_MASK when PUD/PMD mappings are used, i.e. PSE bit is set.
--- arch/x86/include/asm/pgtable_types.h | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
arch/x86/include/asm/pgtable_types.h +34 -2
@@ -257,10 +257,10 @@#include <linux/types.h> -/* PTE_PFN_MASK extracts the PFN from a (pte|pmd|pud|pgd)val_t */ +/* Extracts the PFN from a (pte|pmd|pud|pgd)val_t of a 4KB page */ #define PTE_PFN_MASK ((pteval_t)PHYSICAL_PAGE_MASK) -/* PTE_FLAGS_MASK extracts the flags from a (pte|pmd|pud|pgd)val_t */ +/* Extracts the flags from a (pte|pmd|pud|pgd)val_t of a 4KB page */ #define PTE_FLAGS_MASK (~PTE_PFN_MASK)typedef struct pgprot {pgprotval_t pgprot; }pgprot_t ;
@@ -329,11 +329,43 @@ static inline pmdval_t native_pmd_val(pm }#endif +static inline pudval_t pud_pfn_mask (pud_t pud) +{ +if (native_pud_val (pud) & _PAGE_PSE) +return PUD_PAGE_MASK &PHYSICAL_PAGE_MASK ; +else +return PTE_PFN_MASK ; +} + +static inline pudval_t pud_flags_mask (pud_t pud) +{ +if (native_pud_val (pud) & _PAGE_PSE) +return ~(PUD_PAGE_MASK & (pudval_t )PHYSICAL_PAGE_MASK ); +else +return ~PTE_PFN_MASK ; +} +static inline pudval_t pud_flags (pud_t pud) {return native_pud_val (pud) &PTE_FLAGS_MASK ; } +static inline pmdval_t pmd_pfn_mask (pmd_t pmd) +{ +if (native_pmd_val (pmd) & _PAGE_PSE) +return PMD_PAGE_MASK &PHYSICAL_PAGE_MASK ; +else +return PTE_PFN_MASK ; +} + +static inline pmdval_t pmd_flags_mask (pmd_t pmd) +{ +if (native_pmd_val (pmd) & _PAGE_PSE) +return ~(PMD_PAGE_MASK & (pmdval_t )PHYSICAL_PAGE_MASK ); +else +return ~PTE_PFN_MASK ; +} +static inline pmdval_t pmd_flags (pmd_t pmd) {return native_pmd_val (pmd) &PTE_FLAGS_MASK ;
PATCH 2/305 x86/asm: Move PUD_PAGE macros to page_types.h
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit 832102671855f73962e7a04fdafd48b9385ea5c6 upstream.
PUD_SHIFT is defined according to a given kernel configuration, which allows it be commonly used by any x86 kernels. However, PUD_PAGE_SIZE and PUD_PAGE_MASK, which are set from PUD_SHIFT, are defined in page_64_types.h, which can be used by 64-bit kernel only.
Move PUD_PAGE_SIZE and PUD_PAGE_MASK to page_types.h so that they can be used by any x86 kernels as well.
--- arch/x86/include/asm/page_64_types.h | 3 --- arch/x86/include/asm/page_types.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/page_64_types.h +0 -3
@@ -20,9 +20,6 @@#define MCE_STACK 4#define N_EXCEPTION_STACKS 4/* hw limit: 7 */ -#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) -#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) -/* * Set __PAGE_OFFSET to the most negative possible address + * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a
arch/x86/include/asm/page_types.h +3 -0
@@ -20,6 +20,9 @@#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT)#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) +#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) +#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) +#define HPAGE_SHIFT PMD_SHIFT#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)#define HPAGE_MASK (~(HPAGE_SIZE - 1))
PATCH 3/305 x86/asm: Fix pud/pmd interfaces to handle large PAT bit
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit f70abb0fc3da1b2945c92751ccda2744081bf2b7 upstream.
Now that we have pud/pmd mask interfaces, which handle pfn & flags mask properly for the large PAT bit.
Fix pud/pmd pfn & flags interfaces by replacing PTE_PFN_MASK and PTE_FLAGS_MASK with the pud/pmd mask interfaces.
--- arch/x86/include/asm/pgtable.h | 14 ++++++++------ arch/x86/include/asm/pgtable_types.h | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-)
arch/x86/include/asm/pgtable.h +8 -6
@@ -156,14 +156,14 @@ static inline unsigned long pmd_pfn(pmd_ {phys_addr_t pfn =pmd_val (pmd); pfn ^=protnone_mask (pfn); -return (pfn &PTE_PFN_MASK ) >>PAGE_SHIFT ; +return (pfn &pmd_pfn_mask (pmd)) >>PAGE_SHIFT ; }static inline unsigned long pud_pfn (pud_t pud) {phys_addr_t pfn =pud_val (pud); pfn ^=protnone_mask (pfn); -return (pfn &PTE_PFN_MASK ) >>PAGE_SHIFT ; +return (pfn &pud_pfn_mask (pud)) >>PAGE_SHIFT ; }#define pte_page (pte) pfn_to_page(pte_pfn(pte))
@@ -584,14 +584,15 @@ static inline int pmd_none(pmd_t pmd)static inline unsigned long pmd_page_vaddr (pmd_t pmd) { -return (unsigned long )__va (pmd_val (pmd) &PTE_PFN_MASK ); +return (unsigned long )__va (pmd_val (pmd) &pmd_pfn_mask (pmd)); }/* * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pmd_page (pmd) pfn_to_page((pmd_val(pmd) & PTE_PFN_MASK) >> PAGE_SHIFT) +#define pmd_page (pmd) \ + pfn_to_page((pmd_val(pmd) & pmd_pfn_mask(pmd)) >> PAGE_SHIFT)/* * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
@@ -657,14 +658,15 @@ static inline int pud_present(pud_t pud)static inline unsigned long pud_page_vaddr (pud_t pud) { -return (unsigned long )__va ((unsigned long )pud_val (pud) &PTE_PFN_MASK ); +return (unsigned long )__va (pud_val (pud) &pud_pfn_mask (pud)); }/* * Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pud_page (pud) pfn_to_page(pud_val(pud) >> PAGE_SHIFT) +#define pud_page (pud) \ + pfn_to_page((pud_val(pud) & pud_pfn_mask(pud)) >> PAGE_SHIFT)/* Find an entry in the second-level page table.. */ static inline pmd_t *pmd_offset (pud_t *pud,unsigned long address)
arch/x86/include/asm/pgtable_types.h +2 -2
@@ -347,7 +347,7 @@ static inline pudval_t pud_flags_mask(pustatic inline pudval_t pud_flags (pud_t pud) { -return native_pud_val (pud) &PTE_FLAGS_MASK ; +return native_pud_val (pud) &pud_flags_mask (pud); }static inline pmdval_t pmd_pfn_mask (pmd_t pmd)
@@ -368,7 +368,7 @@ static inline pmdval_t pmd_flags_mask(pmstatic inline pmdval_t pmd_flags (pmd_t pmd) { -return native_pmd_val (pmd) &PTE_FLAGS_MASK ; +return native_pmd_val (pmd) &pmd_flags_mask (pmd); }static inline pte_t native_make_pte (pteval_t val)
PATCH 4/305 x86/mm: Simplify p[g4um]d_page() macros
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tom Lendacky <[email protected]>
commit fd7e315988b784509ba3f1b42f539bd0b1fca9bb upstream.
Create a pgd_pfn() macro similar to the p[4um]d_pfn() macros and then use the p[g4um]d_pfn() macros in the p[g4um]d_page() macros instead of duplicating the code.
--- arch/x86/include/asm/pgtable.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/x86/include/asm/pgtable.h +8 -5
@@ -166,6 +166,11 @@ static inline unsigned long pud_pfn(pud_return (pfn &pud_pfn_mask (pud)) >>PAGE_SHIFT ; } +static inline unsigned long pgd_pfn (pgd_t pgd) +{ +return (pgd_val (pgd) &PTE_PFN_MASK ) >>PAGE_SHIFT ; +} +#define pte_page (pte) pfn_to_page(pte_pfn(pte))static inline int pmd_large (pmd_t pte)
@@ -591,8 +596,7 @@ static inline unsigned long pmd_page_vad* Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pmd_page (pmd) \ - pfn_to_page((pmd_val(pmd) & pmd_pfn_mask(pmd)) >> PAGE_SHIFT) +#define pmd_page (pmd) pfn_to_page(pmd_pfn(pmd))/* * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
@@ -665,8 +669,7 @@ static inline unsigned long pud_page_vad* Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pud_page (pud) \ - pfn_to_page((pud_val(pud) & pud_pfn_mask(pud)) >> PAGE_SHIFT) +#define pud_page (pud) pfn_to_page(pud_pfn(pud))/* Find an entry in the second-level page table.. */ static inline pmd_t *pmd_offset (pud_t *pud,unsigned long address)
@@ -706,7 +709,7 @@ static inline unsigned long pgd_page_vad* Currently stuck as a macro due to indirect forward reference to * linux/mmzone.h's __section_mem_map_addr() definition: */ -#define pgd_page (pgd) pfn_to_page(pgd_val(pgd) >> PAGE_SHIFT) +#define pgd_page (pgd) pfn_to_page(pgd_pfn(pgd))/* to find an entry in a page-table-directory. */ static inline unsigned long pud_index (unsigned long address)
PATCH 5/305 x86/mm: Fix regression with huge pages on PAE
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Kirill A. Shutemov" <[email protected]>
commit 70f1528747651b20c7769d3516ade369f9963237 upstream.
Recent PAT patchset has caused issue on 32-bit PAE machines:
page:eea45000 count:0 mapcount:-128 mapping: (null) index:0x0 flags: 0x40000000()
page dumped because: VM_BUG_ON_PAGE(page_mapcount(page) < 0) ------------[ cut here ]------------ kernel BUG at /home/build/linux-boris/mm/huge_memory.c:1485! invalid opcode: 0000 [#1] SMP [...] Call Trace: unmap_single_vma ? __wake_up unmap_vmas unmap_region do_munmap vm_munmap SyS_munmap do_fast_syscall_32 ? __do_page_fault sysenter_past_esp Code: ... EIP: [<c11bde80>] zap_huge_pmd+0x240/0x260 SS:ESP 0068:f6459d98
The problem is in pmd_pfn_mask() and pmd_flags_mask(). These helpers use PMD_PAGE_MASK to calculate resulting mask. PMD_PAGE_MASK is 'unsigned long', not 'unsigned long long' as phys_addr_t is on 32-bit PAE (ARCH_PHYS_ADDR_T_64BIT). As a result, the upper bits of resulting mask get truncated.
pud_pfn_mask() and pud_flags_mask() aren't problematic since we don't have PUD page table level on 32-bit systems, but it's reasonable to keep them consistent with PMD counterpart.
Introduce PHYSICAL_PMD_PAGE_MASK and PHYSICAL_PUD_PAGE_MASK in addition to existing PHYSICAL_PAGE_MASK and reworks helpers to use them.
--- arch/x86/boot/boot.h | 1 - arch/x86/boot/video-mode.c | 2 ++ arch/x86/boot/video.c | 2 ++ arch/x86/include/asm/page_types.h | 16 +++++++++------- arch/x86/include/asm/pgtable_types.h | 14 ++++---------- arch/x86/include/asm/x86_init.h | 1 - 6 files changed, 17 insertions(+), 19 deletions(-)
arch/x86/boot/boot.h +0 -1
@@ -23,7 +23,6 @@#include <stdarg.h> #include <linux/types.h> #include <linux/edd.h> -#include <asm/boot.h> #include <asm/setup.h> #include "bitops.h" #include "ctype.h"
arch/x86/boot/video-mode.c +2 -0
@@ -19,6 +19,8 @@#include "video.h" #include "vesa.h" +#include <uapi/asm/boot.h> +/* * Common variables */
arch/x86/boot/video.c +2 -0
@@ -13,6 +13,8 @@* Select video mode */ +#include <uapi/asm/boot.h> +#include "boot.h" #include "video.h" #include "vesa.h"
arch/x86/include/asm/page_types.h +9 -7
@@ -9,19 +9,21 @@#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)#define PAGE_MASK (~(PAGE_SIZE-1)) +#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) +#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) + +#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) +#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) +#define __PHYSICAL_MASK ((phys_addr_t)((1ULL << __PHYSICAL_MASK_SHIFT) - 1))#define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) -/* Cast PAGE_MASK to a signed type so that it is sign-extended if +/* Cast *PAGE_MASK to a signed type so that it is sign-extended if virtual addresses are 32-bits but physical addresses are larger (ie, 32-bit PAE). */ #define PHYSICAL_PAGE_MASK (((signed long)PAGE_MASK) & __PHYSICAL_MASK) - -#define PMD_PAGE_SIZE (_AC(1, UL) << PMD_SHIFT) -#define PMD_PAGE_MASK (~(PMD_PAGE_SIZE-1)) - -#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) -#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) +#define PHYSICAL_PMD_PAGE_MASK (((signed long)PMD_PAGE_MASK) & __PHYSICAL_MASK) +#define PHYSICAL_PUD_PAGE_MASK (((signed long)PUD_PAGE_MASK) & __PHYSICAL_MASK)#define HPAGE_SHIFT PMD_SHIFT#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
arch/x86/include/asm/pgtable_types.h +4 -10
@@ -332,17 +332,14 @@ static inline pmdval_t native_pmd_val(pmstatic inline pudval_t pud_pfn_mask (pud_t pud) {if (native_pud_val (pud) & _PAGE_PSE) -return PUD_PAGE_MASK &PHYSICAL_PAGE_MASK ; +return PHYSICAL_PUD_PAGE_MASK ;else return PTE_PFN_MASK ; }static inline pudval_t pud_flags_mask (pud_t pud) { -if (native_pud_val (pud) & _PAGE_PSE) -return ~(PUD_PAGE_MASK & (pudval_t )PHYSICAL_PAGE_MASK ); -else -return ~PTE_PFN_MASK ; +return ~pud_pfn_mask (pud); }static inline pudval_t pud_flags (pud_t pud)
@@ -353,17 +350,14 @@ static inline pudval_t pud_flags(pud_t pstatic inline pmdval_t pmd_pfn_mask (pmd_t pmd) {if (native_pmd_val (pmd) & _PAGE_PSE) -return PMD_PAGE_MASK &PHYSICAL_PAGE_MASK ; +return PHYSICAL_PMD_PAGE_MASK ;else return PTE_PFN_MASK ; }static inline pmdval_t pmd_flags_mask (pmd_t pmd) { -if (native_pmd_val (pmd) & _PAGE_PSE) -return ~(PMD_PAGE_MASK & (pmdval_t )PHYSICAL_PAGE_MASK ); -else -return ~PTE_PFN_MASK ; +return ~pmd_pfn_mask (pmd); }static inline pmdval_t pmd_flags (pmd_t pmd)
arch/x86/include/asm/x86_init.h +0 -1
@@ -1,7 +1,6 @@#ifndef _ASM_X86_PLATFORM_H#define _ASM_X86_PLATFORM_H -#include <asm/pgtable_types.h> #include <asm/bootparam.h> struct mpc_bus ;
PATCH 6/305 x86/eisa: Add missing include
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit ef1d4deab953ecb1dfcf9f167043bda8b3f14a11 upstream.
The seperation of the EISA init missed to include linux/io.h which breaks the build with some special configurations.
--- arch/x86/kernel/eisa.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/eisa.c +1 -0
@@ -5,6 +5,7 @@*/ #include <linux/ioport.h> #include <linux/eisa.h> +#include <linux/io.h> #include <xen/xen.h>
PATCH 7/305 x86/boot: eboot.c: Include string function declarations
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
The earliest boot code has its own string functions, since it can't use those included in the main kernel image. Under some compiler versions eboot.c fails to include a suitable declaration, resulting in the warning:
In file included from arch/x86/boot/compressed/eboot.c:287:0:
arch/x86/boot/compressed/../../../../drivers/firmware/efi/efi-stub-helper.c: In function 'efi_relocate_kernel':
Quoted 1 line
Quoted 1 line
arch/x86/boot/compressed/../../../../drivers/firmware/efi/efi-stub-helper.c:566:2: warning: implicit declaration of function 'memcpy'; did you mean 'memchr'? [-Wimplicit-function-declaration]
memcpy((void *)new_addr, (void *)cur_image_addr, image_size);
^~~~~~
memchrInclude "../string.h" which provides the correct declarations. This was done upstream as part of commit 393f203f5fd5 "x86_64: kasan: add interceptors for memset/memmove/memcpy functions".
---
arch/x86/boot/compressed/eboot.c +1 -2
@@ -13,8 +13,7 @@#include <asm/setup.h> #include <asm/desc.h> -#undef memcpy/* Use memcpy from misc.c */ - +#include "../string.h" #include "eboot.h" static efi_system_table_t *sys_table;
PATCH 8/305 s390/timex: fix get_tod_clock_ext() inline assembly
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chen Gang <[email protected]>
commit e38f97813302065fbc9c9eab5c1a94dc021d71e2 upstream.
For C language, it treats array parameter as a pointer, so sizeof for an array parameter is equal to sizeof for a pointer, which causes compiler warning (with allmodconfig by gcc 5):
./arch/s390/include/asm/timex.h: In function 'get_tod_clock_ext':
./arch/s390/include/asm/timex.h:76:32: warning: 'sizeof' on array function parameter 'clk' will return size of 'char *' [-Wsizeof-array-argument]
typedef struct { char _[sizeof(clk)]; } addrtype;
^Can use macro CLOCK_STORE_SIZE instead of all related hard code numbers, which also can avoid this warning. And also add a tab to CLOCK_TICK_RATE definition to match coding styles.
[[email protected]]:
Chen's patch actually fixes a bug within the get_tod_clock_ext() inline assembly where we incorrectly tell the compiler that only 8 bytes of memory get changed instead of 16 bytes.
This would allow gcc to generate incorrect code. Right now this doesn't seem to be the case.
Also slightly changed the patch a bit.
- renamed CLOCK_STORE_SIZE to STORE_CLOCK_EXT_SIZE
- changed get_tod_clock_ext() to receive a char pointer parameter
--- arch/s390/hypfs/hypfs_vm.c | 2 +- arch/s390/include/asm/timex.h | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-)
arch/s390/hypfs/hypfs_vm.c +1 -1
@@ -231,7 +231,7 @@ failed:struct dbfs_d2fc_hdr {u64 len;/* Length of d2fc buffer without header */ u16 version;/* Version of header */ -char tod_ext[16 ];/* TOD clock for d2fc */ +char tod_ext[STORE_CLOCK_EXT_SIZE ];/* TOD clock for d2fc */ u64 count;/* Number of VM guests in d2fc buffer */ char reserved[30 ]; } __attribute__ ((packed));
arch/s390/include/asm/timex.h +6 -4
@@ -67,20 +67,22 @@ static inline void local_tick_enable(unsset_clock_comparator (S390_lowcore.clock_comparator); } -#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ +#define CLOCK_TICK_RATE 1193180/* Underlying HZ */ +#define STORE_CLOCK_EXT_SIZE 16/* stcke writes 16 bytes */ typedef unsigned long long cycles_t ; -static inline void get_tod_clock_ext (char clk[16 ]) +static inline void get_tod_clock_ext (char *clk) { -typedef struct {char _[sizeof (clk)]; }addrtype ; +typedef struct {char _[STORE_CLOCK_EXT_SIZE ]; }addrtype ; asmvolatile ("stcke %0" :"=Q" (*(addrtype *) clk) : :"cc" ); }static inline unsigned long long get_tod_clock (void ) { -unsigned char clk[16 ]; +unsigned char clk[STORE_CLOCK_EXT_SIZE ]; +get_tod_clock_ext (clk);return *((unsigned long long *)&clk[1 ]); }
PATCH 9/305 s390/dasd: Restore a necessary cast
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit c3925a3da617 "s390/dasd: fix IO error for newly defined devices" removed a cast of dasd_device::private which was not necessary in the upstream code. However, in 3.16 the type of dasd_device::private is char *, so the cast is still needed.
---
drivers/s390/block/dasd_alias.c +2 -1
@@ -608,7 +608,8 @@ static int _schedule_lcu_update(struct aint dasd_alias_add_device (struct dasd_device *device) { -struct dasd_eckd_private *private = device->private; +struct dasd_eckd_private *private = + (struct dasd_eckd_private *)device->private;__u8 uaddr = private->uid.real_unit_addr;struct alias_lcu *lcu = private->lcu;unsigned long flags;
PATCH 10/305 ipv6: Fix another sparse warning on rt6i_node
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Commit 0933273ce750 "ipv6: fix sparse warning on rt6i_node" fixed some sparse warnings in ip6_fib.c, but introduced a new one in fib6_update_sernum() (which was removed before the corresponding upstream commit).
fib6_update_sernum() is called in a RCU read-side section, so use rcu_dereference() to read rt6_info::rt6i_node.
---
net/ipv6/ip6_fib.c +3 -3
@@ -1681,10 +1681,10 @@ static void fib6_prune_clones(struct netstatic int fib6_update_sernum (struct rt6_info *rt,void *arg) {__u32 sernum = *(__u32 *)arg; +struct fib6_node *fn =rcu_dereference (rt->rt6i_node); -if (rt->rt6i_node && - rt->rt6i_node->fn_sernum != sernum) - rt->rt6i_node->fn_sernum = sernum; +if (fn && fn->fn_sernum != sernum) + fn->fn_sernum = sernum;return 0 ; }
PATCH 11/305 timer/debug: Change /proc/timer_list from 0444 to 0400
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit 8e7df2b5b7f245c9bd11064712db5cb69044a362 upstream.
While it uses %pK, there's still few reasons to read this file as non-root.
--- kernel/time/timer_list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/timer_list.c +1 -1
@@ -362,7 +362,7 @@ static int __init init_timer_list_procfs {struct proc_dir_entry *pe; - pe =proc_create ("timer_list" ,0444 ,NULL , &timer_list_fops); + pe =proc_create ("timer_list" ,0400 ,NULL , &timer_list_fops);if (!pe)return -ENOMEM ;return 0 ;
PATCH 12/305 x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit b2d7a075a1ccef2fb321d595802190c8e9b39004 upstream.
Using only 32-bit writes for the pte will result in an intermediate L1TF vulnerable PTE. When running as a Xen PV guest this will at once switch the guest to shadow mode resulting in a loss of performance.
Use arch_atomic64_xchg() instead which will perform the requested operation atomically with all 64 bits.
Some performance considerations according to:
The main number should be the latency, as there is no tight loop around native_ptep_get_and_clear().
"lock cmpxchg8b" has a latency of 20 cycles, while "lock xchg" (with a memory operand) isn't mentioned in that document. "lock xadd" (with xadd having 3 cycles less latency than xchg) has a latency of 11, so we can assume a latency of 14 for "lock xchg".
--- arch/x86/include/asm/pgtable-3level.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/x86/include/asm/pgtable-3level.h +3 -4
@@ -1,6 +1,8 @@#ifndef _ASM_X86_PGTABLE_3LEVEL_H#define _ASM_X86_PGTABLE_3LEVEL_H +#include <asm/atomic64_32.h> +/* * Intel Physical Address Extension (PAE) Mode - three-level page * tables on PPro+ CPUs.
@@ -142,10 +144,7 @@ static inline pte_t native_ptep_get_and_ {pte_t res; -/* xchg acts as a barrier before the setting of the high bits */ - res.pte_low =xchg (&ptep->pte_low,0 ); - res.pte_high = ptep->pte_high; - ptep->pte_high =0 ; + res.pte = (pteval_t )atomic64_xchg ((atomic64_t *)ptep,0 );return res; }
PATCH 13/305 ARM: fix put_user() for gcc-8
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
Building kernels before linux-4.7 with gcc-8 results in many build failures when gcc triggers a check that was meant to catch broken compilers:
/tmp/ccCGMQmS.s:648: Error: .err encountered
According to the discussion in the gcc bugzilla, a local "register asm()" variable is still supposed to be the correct way to force an inline assembly to use a particular register, but marking it 'const' lets the compiler do optimizations that break that, i.e the compiler is free to treat the variable as either 'const' or 'register' in that case.
Upstream commit 9f73bd8bb445 ("ARM: uaccess: remove put_user() code duplication") fixed this problem in linux-4.8 as part of a larger change, but seems a little too big to be backported to 4.4.
Let's take the simplest fix and change only the one broken line in the same way as newer kernels.
--- arch/arm/include/asm/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/uaccess.h +1 -1
@@ -172,7 +172,7 @@ extern int __put_user_8(void *, unsigned ({ \ unsigned long __limit = current_thread_info()->addr_limit - 1; \ const typeof(*(p)) __user *__tmp_p = (p); \ - register const typeof(*(p)) __r2 asm("r2") = (x); \ + register typeof(*(p)) __r2 asm("r2") = (x); \ register const typeof(*(p)) __user *__p asm("r0") = __tmp_p; \ register unsigned long __l asm("r1") = __limit; \ register int __e asm("r0"); \
PATCH 14/305 disable new gcc-7.1.1 warnings for now
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit bd664f6b3e376a8ef4990f87d08271cc2d01ba9a upstream.
I made the mistake of upgrading my desktop to the new Fedora 26 that comes with gcc-7.1.1.
There's nothing wrong per se that I've noticed, but I now have 1500 lines of warnings, mostly from the new format-truncation warning triggering all over the tree.
We use 'snprintf()' and friends in a lot of places, and often know that the numbers are fairly small (ie a controller index or similar), but gcc doesn't know that, and sees an 'int', and thinks that it could be some huge number. And then complains when our buffers are not able to fit the name for the ten millionth controller.
These warnings aren't necessarily bad per se, and we probably want to look through them subsystem by subsystem, but at least during the merge window they just mean that I can't even see if somebody is introducing any *real* problems when I pull.
So warnings disabled for now.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -617,6 +617,9 @@ include $(srctree)/arch/$(SRCARCH)/Makef KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) +KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) +KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) +KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
PATCH 15/305 turn off -Wattribute-alias
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
Starting with gcc-8.1, we get a warning about all system call definitions, which use an alias between functions with incompatible prototypes, e.g.:
In file included from ../mm/process_vm_access.c:19:../include/linux/syscalls.h:211:18: warning: 'sys_process_vm_readv' alias between functions of incompatible types 'long int(pid_t, const struct iovec *, long unsigned int, const struct iovec *, long unsigned int, long unsigned int)' {aka 'long int(int, const struct iovec *, long unsigned int, const struct iovec *, long unsigned int, long unsigned int)'} and 'long int(long int, long int, long int, long int, long int, long int)' [-Wattribute-alias]
asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
^~~../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
^~~~~~~~~~~~~~~../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec, ^~~~~~~~~~~~~~~../include/linux/syscalls.h:215:18: note: aliased declaration here
asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
^~~../include/linux/syscalls.h:207:2: note: in expansion of macro '__SYSCALL_DEFINEx'
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
^~~~~~~~~~~~~~~~~../include/linux/syscalls.h:201:36: note: in expansion of macro 'SYSCALL_DEFINEx'
#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
^~~~~~~~~~~~~~~../mm/process_vm_access.c:300:1: note: in expansion of macro 'SYSCALL_DEFINE6'
SYSCALL_DEFINE6(process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
This is really noisy and does not indicate a real problem. In the latest mainline kernel, this was addressed by commit bee20031772a ("disable -Wattribute-alias warning for SYSCALL_DEFINEx()"), which seems too invasive to backport.
This takes a much simpler approach and just disables the warning across the kernel.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -620,6 +620,7 @@ KBUILD_CFLAGS += $(call cc-disable-warni KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) +KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias) ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
PATCH 16/305 staging: comedi: quatech_daqp_cs: fix bug in daqp_ao_insn_write()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: H Hartley Sweeten <[email protected]>
commit e024181b02ed6b833358bede3f2d0c52cb5fb6bc upstream.
The comedi core expects (*insn_write) functions to write insn->n values to the hardware and return the number of values written.
Currently, this function only writes the first value. Fix it to work like the core expects.
--- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/quatech_daqp_cs.c +2 -2
@@ -640,7 +640,6 @@ static int daqp_ao_insn_write(struct com {struct daqp_private *devpriv = dev->private;unsigned int chan =CR_CHAN (insn->chanspec); -unsigned int val;int i;if (devpriv->stop)
@@ -650,7 +649,8 @@ static int daqp_ao_insn_write(struct comoutb (0 , dev->iobase +DAQP_AUX );for (i =0 ; i > insn->n; i++) { - val = data[0 ]; +unsigned val = data[i]; + val &=0x0fff ; val ^=0x0800 ;/* Flip the sign */ val |= (chan <<12 );
PATCH 17/305 staging: comedi: quatech_daqp_cs: use comedi_timeout() in ao (*insn_write)
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: H Hartley Sweeten <[email protected]>
commit e031642eccc040648b09cfc7d632e2e8d0b6f94f upstream.
The data link between the D/A data port and the D/A converter is a serial link. The serial link requires about 8ms to complete a transfer. Use the comedi_timeout() helper to ensure that there is not a previous transfer still happening before trying to write new data to the channel.
--- .../staging/comedi/drivers/quatech_daqp_cs.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/staging/comedi/drivers/quatech_daqp_cs.c +19 -0
@@ -633,6 +633,19 @@ static int daqp_ai_cmd(struct comedi_devreturn 0 ; } +static int daqp_ao_empty (struct comedi_device *dev, +struct comedi_subdevice *s, +struct comedi_insn *insn, +unsigned long context) +{ +unsigned int status; + + status =inb (dev->iobase +DAQP_AUX ); +if ((status &DAQP_AUX_DA_BUFFER ) ==0 ) +return 0 ; +return -EBUSY ; +} + static int daqp_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn,
@@ -650,6 +663,12 @@ static int daqp_ao_insn_write(struct comfor (i =0 ; i > insn->n; i++) {unsigned val = data[i]; +int ret; + +/* D/A transfer rate is about 8ms */ + ret =comedi_timeout (dev, s, insn, daqp_ao_empty,0 ); +if (ret) +return ret; val &=0x0fff ; val ^=0x0800 ;/* Flip the sign */
PATCH 18/305 staging: comedi: quatech_daqp_cs: fix no-op loop daqp_ao_insn_write()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 1376b0a2160319125c3a2822e8c09bd283cd8141 upstream.
There is a '>' vs '<' typo so this loop is a no-op.
--- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/quatech_daqp_cs.c +1 -1
@@ -661,7 +661,7 @@ static int daqp_ao_insn_write(struct com/* Make sure D/A update mode is direct update */ outb (0 , dev->iobase +DAQP_AUX ); -for (i =0 ; i > insn->n; i++) { +for (i =0 ; i < insn->n; i++) {unsigned val = data[i];int ret;
PATCH 19/305 media: v4l: event: Add subscription to list before calling "add" operation
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 92539d3eda2c090b382699bbb896d4b54e9bdece upstream.
Patch ad608fbcf166 changed how events were subscribed to address an issue elsewhere. As a side effect of that change, the "add" callback was called before the event subscription was added to the list of subscribed events, causing the first event queued by the add callback (and possibly other events arriving soon afterwards) to be lost.
Fix this by adding the subscription to the list before calling the "add" callback, and clean up afterwards if that fails.
--- drivers/media/v4l2-core/v4l2-event.c | 43 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 19 deletions(-)
drivers/media/v4l2-core/v4l2-event.c +24 -19
@@ -194,6 +194,22 @@ int v4l2_event_pending(struct v4l2_fh *f }EXPORT_SYMBOL_GPL (v4l2_event_pending); +static void __v4l2_event_unsubscribe (struct v4l2_subscribed_event *sev) +{ +struct v4l2_fh *fh = sev->fh; +unsigned int i; + +lockdep_assert_held (&fh->subscribe_lock); +assert_spin_locked (&fh->vdev->fh_lock); + +/* Remove any pending events for this subscription */ +for (i =0 ; i < sev->in_use; i++) { +list_del (&sev->events[sev_pos (sev, i)].list); + fh->navailable--; + } +list_del (&sev->list); +} +int v4l2_event_subscribe (struct v4l2_fh *fh,const struct v4l2_event_subscription *sub,unsigned elems,const struct v4l2_subscribed_event_ops *ops)
@@ -225,27 +241,23 @@ int v4l2_event_subscribe(struct v4l2_fhspin_lock_irqsave (&fh->vdev->fh_lock, flags); found_ev =v4l2_event_subscribed (fh, sub->type, sub->id); +if (!found_ev) +list_add (&sev->list, &fh->subscribed);spin_unlock_irqrestore (&fh->vdev->fh_lock, flags);if (found_ev) {/* Already listening */ kfree (sev); - goto out_unlock; - } - -if (sev->ops && sev->ops->add) { + }else if (sev->ops && sev->ops->add) { ret = sev->ops->add (sev, elems);if (ret) { +spin_lock_irqsave (&fh->vdev->fh_lock, flags); +__v4l2_event_unsubscribe (sev); +spin_unlock_irqrestore (&fh->vdev->fh_lock, flags);kfree (sev); - goto out_unlock; } } -spin_lock_irqsave (&fh->vdev->fh_lock, flags); -list_add (&sev->list, &fh->subscribed); -spin_unlock_irqrestore (&fh->vdev->fh_lock, flags); - -out_unlock:mutex_unlock (&fh->subscribe_lock);return ret;
@@ -280,7 +292,6 @@ int v4l2_event_unsubscribe(struct v4l2_f {struct v4l2_subscribed_event *sev;unsigned long flags; -int i;if (sub->type ==V4L2_EVENT_ALL ) {v4l2_event_unsubscribe_all (fh);
@@ -292,14 +303,8 @@ int v4l2_event_unsubscribe(struct v4l2_fspin_lock_irqsave (&fh->vdev->fh_lock, flags); sev =v4l2_event_subscribed (fh, sub->type, sub->id); -if (sev !=NULL ) { -/* Remove any pending events for this subscription */ -for (i =0 ; i < sev->in_use; i++) { -list_del (&sev->events[sev_pos (sev, i)].list); - fh->navailable--; - } -list_del (&sev->list); - } +if (sev !=NULL ) +__v4l2_event_unsubscribe (sev);spin_unlock_irqrestore (&fh->vdev->fh_lock, flags);
PATCH 20/305 sparc32: Fix inverted invalid_frame_pointer checks on sigreturns
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Larsson <[email protected]>
commit 07b5ab3f71d318e52c18cc3b73c1d44c908aacfa upstream.
--- arch/sparc/kernel/signal_32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sparc/kernel/signal_32.c +2 -2
@@ -89,7 +89,7 @@ asmlinkage void do_sigreturn(struct pt_r sf = (struct signal_frame __user *) regs->u_regs[UREG_FP ];/* 1. Make sure we are not getting garbage from the user */ -if (!invalid_frame_pointer (sf,sizeof (*sf))) +if (invalid_frame_pointer (sf,sizeof (*sf))) goto segv_and_exit;if (get_user (ufp, &sf->info.si_regs.u_regs[UREG_FP ]))
@@ -150,7 +150,7 @@ asmlinkage void do_rt_sigreturn(struct psynchronize_user_stack (); sf = (struct rt_signal_frame __user *) regs->u_regs[UREG_FP ]; -if (!invalid_frame_pointer (sf,sizeof (*sf))) +if (invalid_frame_pointer (sf,sizeof (*sf))) goto segv;if (get_user (ufp, &sf->regs.u_regs[UREG_FP ]))
PATCH 21/305 cpupower: remove stringop-truncation waring
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Anders Roxell <[email protected]>
commit 8a7e2d2ea080d10a189a1d611344b0330468ebc3 upstream.
The strncpy doesn't null terminate the string because the size is too short by one byte.
parse.c: In function ‘prepare_default_config’:
parse.c:148:2: warning: ‘strncpy’ output truncated before terminating
nul copying 8 bytes from a string of the same length [-Wstringop-truncation]
strncpy(config->governor, "ondemand", 8); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The normal method of passing the length of the destination buffer works correctly here.
--- tools/power/cpupower/bench/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/cpupower/bench/parse.c +1 -1
@@ -135,7 +135,7 @@ struct config *prepare_default_config() config->cpu =0 ; config->prio =SCHED_HIGH ; config->verbose =0 ; -strncpy (config->governor,"ondemand" ,8 ); +strncpy (config->governor,"ondemand" ,sizeof (config->governor)); config->output = stdout;
PATCH 22/305 libertas_tf: prevent underflow in process_cmdrequest()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 3348ef6a6a126706d6a73ed40c18d8033df72783 upstream.
If recvlength is less than MESSAGE_HEADER_LEN (4) we would end up corrupting memory.
--- drivers/net/wireless/libertas_tf/if_usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/libertas_tf/if_usb.c +3 -2
@@ -610,9 +610,10 @@ static inline void process_cmdrequest(in struct if_usb_card *cardp, struct lbtf_private *priv) { -if (recvlength >LBS_CMD_BUFFER_SIZE ) { +if (recvlength <MESSAGE_HEADER_LEN || + recvlength >LBS_CMD_BUFFER_SIZE ) {lbtf_deb_usbd (&cardp->udev->dev, -"The receive buffer is too large\n" ); +"The receive buffer is invalid: %d\n" , recvlength);kfree_skb (skb);return ; }
PATCH 23/305 ARM: dts: exynos: Disable pull control for MAX8997 interrupts on Origen
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit f5e758b8358f6c27e8a351ddf0b441a64cdabb94 upstream.
PMIC_IRQB and PMIC_KEYINB lines on Exynos4210-based Origen board have external pull-up resistors, so disable any pull control for those lines in respective pin controller node. This fixes support for MAX8997 interrupts and enables operation of wakeup from MAX8997 RTC alarm.
[bwh: Backported to 3.16:
- Use literal 0 instead of EXYNOS_PIN_PULL_NONE
- Adjust context, indentation]
--- arch/arm/boot/dts/exynos4210-origen.dts | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/exynos4210-origen.dts +9 -0
@@ -115,6 +115,8 @@ reg = <0x66>; interrupt-parent = <&gpx0>; interrupts = <4 0>, <3 0>; + pinctrl-names = "default"; + pinctrl-0 = <&max8997_irq>; max8997,pmic-buck1-dvs-voltage = <1350000>; max8997,pmic-buck2-dvs-voltage = <1100000>;
@@ -334,3 +336,10 @@ }; }; }; + +&pinctrl_1 { + max8997_irq: max8997-irq { + samsung,pins = "gpx0-3", "gpx0-4"; + samsung,pin-pud = <0>; + }; +};
PATCH 24/305 x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: He Zhe <[email protected]>
commit ccde460b9ae5c2bd5e4742af0a7f623c2daad566 upstream.
memory_corruption_check[{_period|_size}]()'s handlers do not check input argument before passing it to kstrtoul() or simple_strtoull(). The argument would be a NULL pointer if each of the kernel parameters, without its value, is set in command line and thus cause the following panic.
PANIC: early exception 0xe3 IP 10:ffffffff73587c22 error 0 cr2 0x0
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.18-rc8+ #2 [ 0.000000] RIP: 0010:kstrtoull+0x2/0x10 ... [ 0.000000] Call Trace [ 0.000000] ? set_corruption_check+0x21/0x49 [ 0.000000] ? do_early_param+0x4d/0x82 [ 0.000000] ? parse_args+0x212/0x330 [ 0.000000] ? rdinit_setup+0x26/0x26 [ 0.000000] ? parse_early_options+0x20/0x23 [ 0.000000] ? rdinit_setup+0x26/0x26 [ 0.000000] ? parse_early_param+0x2d/0x39 [ 0.000000] ? setup_arch+0x2f7/0xbf4 [ 0.000000] ? start_kernel+0x5e/0x4c2 [ 0.000000] ? load_ucode_bsp+0x113/0x12f [ 0.000000] ? secondary_startup_64+0xa5/0xb0
This patch adds checks to prevent the panic.
--- arch/x86/kernel/check.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/x86/kernel/check.c +15 -0
@@ -30,6 +30,11 @@ static __init int set_corruption_check(cssize_t ret;unsigned long val; +if (!arg) { +pr_err ("memory_corruption_check config string not provided\n" ); +return -EINVAL ; + } + ret =kstrtoul (arg,10 , &val);if (ret)return ret;
@@ -44,6 +49,11 @@ static __init int set_corruption_check_pssize_t ret;unsigned long val; +if (!arg) { +pr_err ("memory_corruption_check_period config string not provided\n" ); +return -EINVAL ; + } + ret =kstrtoul (arg,10 , &val);if (ret)return ret;
@@ -58,6 +68,11 @@ static __init int set_corruption_check_schar *end;unsigned size; +if (!arg) { +pr_err ("memory_corruption_check_size config string not provided\n" ); +return -EINVAL ; + } + size =memparse (arg, &end);if (*end =='\0' )
PATCH 25/305 media: uvcvideo: Fix uvc_alloc_entity() allocation alignment
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nadav Amit <[email protected]>
commit 89dd34caf73e28018c58cd193751e41b1f8bdc56 upstream.
The use of ALIGN() in uvc_alloc_entity() is incorrect, since the size of (entity->pads) is not a power of two. As a stop-gap, until a better solution is adapted, use roundup() instead.
Found by a static assertion. Compile-tested only.
--- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +1 -1
@@ -826,7 +826,7 @@ static struct uvc_entity *uvc_alloc_entiunsigned int size;unsigned int i; - extra_size =ALIGN (extra_size,sizeof (*entity->pads)); + extra_size =roundup (extra_size,sizeof (*entity->pads)); num_inputs = (type &UVC_TERM_OUTPUT ) ? num_pads : num_pads -1 ; size =sizeof (*entity) + extra_size +sizeof (*entity->pads) * num_pads + num_inputs;
Re: [PATCH 3.16 025/305] media: uvcvideo: Fix uvc_alloc_entity() allocation alignment
Hi,
Quoted 28 lines · Ben Hutchings
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nadav Amit <[email protected]>
commit
89dd34caf73e28018c58cd193751e41b1f8bdc56upstream.The use of
ALIGN()inuvc_alloc_entity()is incorrect, since the size of (entity->pads) is not a power of two. As a stop-gap, until a better solution is adapted, useroundup()instead.Found by a static assertion. Compile-tested only.
Fixes 4ffc2d89f38a ("uvcvideo: Register subdevices for each entity")Signed-off-by Nadav Amit <[email protected]>Signed-off-by Laurent Pinchart <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c static struct uvc_entity *uvc_alloc_enti · line 832
Quoted 8 lines
drivers/media/usb/uvc/uvc_driver.c +1
-1@@ -826,7 +826,7 @@ static struct uvc_entity *uvc_alloc_entiunsigned int size;unsigned int i; - extra_size =ALIGN (extra_size,sizeof (*entity->pads)); + extra_size =roundup (extra_size,sizeof (*entity->pads)); num_inputs = (type &UVC_TERM_OUTPUT ) ? num_pads : num_pads -1 ; size =sizeof (*entity) + extra_size +sizeof (*entity->pads) * num_pads + num_inputs;
Funny that this commit made its way to 3.16 but didn't make its way to 4.19 (at least checking 4.19.43). I haven't seen any actual crashes caused by the lack of this commit but it seems like the kind of thing we probably want picked back to other stable kernels too.
-Doug
Greg KH
maintainerRe: [PATCH 3.16 025/305] media: uvcvideo: Fix uvc_alloc_entity() allocation alignment
Quoted 34 lines · Doug Anderson
Hi,
Quoted 31 lines · Ben Hutchings
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nadav Amit <[email protected]>
commit
89dd34caf73e28018c58cd193751e41b1f8bdc56upstream.The use of
ALIGN()inuvc_alloc_entity()is incorrect, since the size of (entity->pads) is not a power of two. As a stop-gap, until a better solution is adapted, useroundup()instead.Found by a static assertion. Compile-tested only.
Fixes 4ffc2d89f38a ("uvcvideo: Register subdevices for each entity")Signed-off-by Nadav Amit <[email protected]>Signed-off-by Laurent Pinchart <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/usb/uvc/uvc_driver.c +0
-0@@ -826,7 +826,7 @@ static struct uvc_entity *uvc_alloc_entiunsigned int size;unsigned int i;
Quoted 10 lines
drivers/media/usb/uvc/uvc_driver.c static struct uvc_entity *uvc_alloc_enti · line 832
Quoted 5 lines
drivers/media/usb/uvc/uvc_driver.c +1
-1- extra_size =ALIGN (extra_size,sizeof (*entity->pads)); + extra_size =roundup (extra_size,sizeof (*entity->pads)); num_inputs = (type &UVC_TERM_OUTPUT ) ? num_pads : num_pads -1 ; size =sizeof (*entity) + extra_size +sizeof (*entity->pads) * num_pads + num_inputs;Funny that this commit made its way to 3.16 but didn't make its way to 4.19 (at least checking 4.19.43). I haven't seen any actual crashes caused by the lack of this commit but it seems like the kind of thing we probably want picked back to other stable kernels too.
Good idea, now queued up.
greg k-h
PATCH 26/305 signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 3597dfe01d12f570bc739da67f857fd222a3ea66 upstream.
Instead of playing whack-a-mole and changing SEND_SIG_PRIV to SEND_SIG_FORCED throughout the kernel to ensure a pid namespace init gets signals sent by the kernel, stop allowing a pid namespace init to ignore SIGKILL or SIGSTOP sent by the kernel. A pid namespace init is only supposed to be able to ignore signals sent from itself and children with SIG_DFL.
--- kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/signal.c +1 -1
@@ -1040,7 +1040,7 @@ static int __send_signal(int sig, struct result =TRACE_SIGNAL_IGNORED ;if (!prepare_signal (sig, t, - from_ancestor_ns || (info ==SEND_SIG_FORCED ))) + from_ancestor_ns || (info ==SEND_SIG_PRIV ) || (info ==SEND_SIG_FORCED ))) goto ret; pending = group ? &t->signal->shared_pending : &t->pending;
PATCH 27/305 scsi: qla2xxx: Fix incorrect port speed being set for FC adapters
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Himanshu Madhani <[email protected]>
commit 4c1458df9635c7e3ced155f594d2e7dfd7254e21 upstream.
--- drivers/scsi/qla2xxx/qla_mbx.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_mbx.c +1 -4
@@ -3264,10 +3264,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t * mcp->mb[0 ] =MBC_PORT_PARAMS ; mcp->mb[1 ] = loop_id; mcp->mb[2 ] =BIT_0 ; -if (IS_CNA_CAPABLE (vha->hw)) - mcp->mb[3 ] = port_speed & (BIT_5 |BIT_4 |BIT_3 |BIT_2 |BIT_1 |BIT_0 ); -else - mcp->mb[3 ] = port_speed & (BIT_2 |BIT_1 |BIT_0 ); + mcp->mb[3 ] = port_speed & (BIT_5 |BIT_4 |BIT_3 |BIT_2 |BIT_1 |BIT_0 ); mcp->mb[9 ] = vha->vp_idx; mcp->out_mb =MBX_9 |MBX_3 |MBX_2 |MBX_1 |MBX_0 ; mcp->in_mb =MBX_3 |MBX_1 |MBX_0 ;
PATCH 28/305 scsi: qla2xxx: shutdown chip if reset fail
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 1e4ac5d6fe0a4af17e4b6251b884485832bf75a3 upstream.
If chip unable to fully initialize, use full shutdown sequence to clear out any stale FW state.
--- drivers/scsi/qla2xxx/qla_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +1 -1
@@ -4667,7 +4667,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)* The next call disables the board * completely. */ - ha->isp_ops->reset_adapter (vha); +qla2x00_abort_isp_cleanup (vha); vha->flags.online =0 ;clear_bit (ISP_ABORT_RETRY , &vha->dpc_flags);
PATCH 29/305 signal/GenWQE: Fix sending of SIGKILL
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 0ab93e9c99f8208c0a1a7b7170c827936268c996 upstream.
The genweq_add_file and genwqe_del_file by caching current without using reference counting embed the assumption that a file descriptor will never be passed from one process to another. It even embeds the assumption that the the thread that opened the file will be in
existence when the process terminates. Neither of which are
guaranteed to be true.
Therefore replace caching the task_struct of the opener with pid of the openers thread group id. All the knowledge of the opener is used for is as the target of SIGKILL and a SIGKILL will kill the entire process group.
Rename genwqe_force_sig to genwqe_terminate, remove it's unncessary signal argument, update it's ownly caller, and use kill_pid instead of force_sig.
The work force_sig does in changing signal handling state is not relevant to SIGKILL sent as SEND_SIG_PRIV. The exact same processess will be killed just with less work, and less confusion. The work done by force_sig is really only needed for handling syncrhonous exceptions.
It will still be possible to cause genwqe_device_remove to wait 8 seconds by passing a file descriptor to another process but the possible user after free is fixed.
--- drivers/misc/genwqe/card_base.h | 2 +- drivers/misc/genwqe/card_dev.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/misc/genwqe/card_base.h +1 -1
@@ -401,7 +401,7 @@ struct genwqe_file {struct file *filp;struct fasync_struct *async_queue; -struct task_struct *owner; +struct pid *opener;struct list_head list;/* entry in list of open files */ spinlock_t map_lock;/* lock for dma_mappings */
drivers/misc/genwqe/card_dev.c +5 -4
@@ -52,7 +52,7 @@ static void genwqe_add_file(struct genwq {unsigned long flags; - cfile->owner = current; + cfile->opener =get_pid (task_tgid (current));spin_lock_irqsave (&cd->file_lock, flags);list_add (&cfile->list, &cd->file_list);spin_unlock_irqrestore (&cd->file_lock, flags);
@@ -65,6 +65,7 @@ static int genwqe_del_file(struct genwqespin_lock_irqsave (&cd->file_lock, flags);list_del (&cfile->list);spin_unlock_irqrestore (&cd->file_lock, flags); +put_pid (cfile->opener);return 0 ; }
@@ -275,7 +276,7 @@ static int genwqe_kill_fasync(struct genreturn files; } -static int genwqe_force_sig (struct genwqe_dev *cd,int sig) +static int genwqe_terminate (struct genwqe_dev *cd) {unsigned int files =0 ;unsigned long flags;
@@ -283,7 +284,7 @@ static int genwqe_force_sig(struct genwqspin_lock_irqsave (&cd->file_lock, flags);list_for_each_entry (cfile, &cd->file_list, list) { -force_sig (sig, cfile->owner); +kill_pid (cfile->opener,SIGKILL ,1 ); files++; }spin_unlock_irqrestore (&cd->file_lock, flags);
@@ -1346,7 +1347,7 @@ static int genwqe_inform_and_stop_procesdev_warn (&pci_dev->dev,"[%s] send SIGKILL and wait ...\n" , __func__); - rc =genwqe_force_sig (cd,SIGKILL );/* force terminate */ + rc =genwqe_terminate (cd);if (rc) {/* Give kill_timout more seconds to end processes */ for (i = 0; (i < genwqe_kill_timeout) &&
PATCH 30/305 power: supply: max8998-charger: Fix platform data retrieval
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tomasz Figa <[email protected]>
commit cb90a2c6f77fe9b43d1e3f759bb2f13fe7fa1811 upstream.
Since the max8998 MFD driver supports instantiation by DT, platform data retrieval is handled in MFD probe and cell drivers should get use the pdata field of max8998_dev struct to obtain them.
--- drivers/power/max8998_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/max8998_charger.c +1 -1
@@ -78,7 +78,7 @@ static int max8998_battery_get_property(static int max8998_battery_probe (struct platform_device *pdev) {struct max8998_dev *iodev =dev_get_drvdata (pdev->dev.parent); -struct max8998_platform_data *pdata =dev_get_platdata (iodev->dev); +struct max8998_platform_data *pdata = iodev->pdata;struct max8998_battery_data *max8998;struct i2c_client *i2c;int ret =0 ;
PATCH 31/305 s390/qeth: invoke softirqs after napi_schedule()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit 4d19db777a2f32c9b76f6fd517ed8960576cb43e upstream.
Calling napi_schedule() from process context does not ensure that the NET_RX softirq is run in a timely fashion. So trigger it manually.
This is no big issue with current code. A call to ndo_open() is usually followed by a ndo_set_rx_mode() call, and for qeth this contains a spin_unlock_bh(). Except for OSN, where qeth_l2_set_rx_mode() bails out early.
Nevertheless it's best to not depend on this behaviour, and just fix the issue at its source like all other drivers do. For instance see commit 83a0c6e58901 ("i40e: Invoke softirqs after napi_reschedule").
--- drivers/s390/net/qeth_l2_main.c | 3 +++ drivers/s390/net/qeth_l3_main.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/s390/net/qeth_l2_main.c +3 -0
@@ -856,7 +856,10 @@ static int __qeth_l2_open(struct net_devif (qdio_stop_irq (card->data.ccwdev,0 ) >=0 ) {napi_enable (&card->napi); +local_bh_disable ();napi_schedule (&card->napi); +/* kick-start the NAPI softirq: */ +local_bh_enable (); }else rc = -EIO ;return rc;
drivers/s390/net/qeth_l3_main.c +3 -0
@@ -3127,7 +3127,10 @@ static int __qeth_l3_open(struct net_devif (qdio_stop_irq (card->data.ccwdev,0 ) >=0 ) {napi_enable (&card->napi); +local_bh_disable ();napi_schedule (&card->napi); +/* kick-start the NAPI softirq: */ +local_bh_enable (); }else rc = -EIO ;return rc;
PATCH 32/305 media: em28xx: use a default format if TRY_FMT fails
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit f823ce2a1202d47110a7ef86b65839f0be8adc38 upstream.
Follow the V4L2 spec, as warned by v4l2-compliance:
warn: v4l2-test-formats.cpp(732): TRY_FMT cannot handle an invalid pixelformat.
warn: v4l2-test-formats.cpp(733): This may or may not be a problem. For more information see:
warn: v4l2-test-formats.cpp(734): http://www.mail-archive.com/[email protected]/msg56550.html
--- drivers/media/usb/em28xx/em28xx-video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/usb/em28xx/em28xx-video.c +3 -3
@@ -1279,9 +1279,9 @@ static int vidioc_try_fmt_vid_cap(struct fmt =format_by_fourcc (f->fmt.pix.pixelformat);if (!fmt) { -em28xx_videodbg ("Fourcc format (%08x) invalid.\n" , - f->fmt.pix.pixelformat); -return -EINVAL ; + fmt = &format[0 ]; +em28xx_videodbg ("Fourcc format (%08x) invalid. Using default (%08x).\n" , + f->fmt.pix.pixelformat, fmt->fourcc); }if (dev->board.is_em2800) {
PATCH 33/305 media: em28xx: fix input name for Terratec AV 350
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 15644bfa195bd166d0a5ed76ae2d587f719c3dac upstream.
Instead of using a register value, use an AMUX name, as otherwise VIDIOC_G_AUDIO would fail.
--- drivers/media/usb/em28xx/em28xx-cards.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/em28xx/em28xx-cards.c +2 -2
@@ -2001,13 +2001,13 @@ struct em28xx_board em28xx_boards[] = { .input = { { .type = EM28XX_VMUX_COMPOSITE1, .vmux = TVP5150_COMPOSITE1, - .amux = EM28XX_AUDIO_SRC_LINE, + .amux = EM28XX_AMUX_LINE_IN, .gpio = terratec_av350_unmute_gpio, }, { .type = EM28XX_VMUX_SVIDEO, .vmux = TVP5150_SVIDEO, - .amux = EM28XX_AUDIO_SRC_LINE, + .amux = EM28XX_AMUX_LINE_IN, .gpio = terratec_av350_unmute_gpio, } }, },
PATCH 34/305 media: em28xx: make v4l2-compliance happier by starting sequence on zero
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit afeaade90db4c5dab93f326d9582be1d5954a198 upstream.
The v4l2-compliance tool complains if a video doesn't start with a zero sequence number.
While this shouldn't cause any real problem for apps, let's make it happier, in order to better check the v4l2-compliance differences before and after patchsets.
This is actually an old issue. It is there since at least its videobuf2 conversion, e. g. changeset 3829fadc461 ("[media]
em28xx: convert to videobuf2"), if VB1 wouldn't suffer from the same issue.
--- drivers/media/usb/em28xx/em28xx-video.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/em28xx/em28xx-video.c +2 -0
@@ -928,6 +928,8 @@ int em28xx_start_analog_streaming(structem28xx_videodbg ("%s\n" , __func__); + dev->v4l2->field_count =0 ; +/* Make sure streaming is not already in progress for this type of filehandle (e.g. video, vbi) */ rc =res_get (dev, vq->type);
PATCH 35/305 media: tvp5150: fix width alignment during set_selection()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marco Felsch <[email protected]>
commit bd24db04101f45a9c1d874fe21b0c7eab7bcadec upstream.
The driver ignored the width alignment which exists due to the UYVY colorspace format. Fix the width alignment and make use of the the provided v4l2 helper function to set the width, height and all alignments in one.
--- drivers/media/i2c/tvp5150.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/media/i2c/tvp5150.c +9 -5
@@ -873,9 +873,6 @@ static int tvp5150_s_crop(struct v4l2_su/* tvp5150 has some special limits */ rect.left =clamp (rect.left,0 ,TVP5150_MAX_CROP_LEFT ); - rect.width = clamp_t(unsigned int, rect.width, -TVP5150_H_MAX -TVP5150_MAX_CROP_LEFT - rect.left, -TVP5150_H_MAX - rect.left); rect.top =clamp (rect.top,0 ,TVP5150_MAX_CROP_TOP );/* Calculate height based on current standard */
@@ -889,9 +886,16 @@ static int tvp5150_s_crop(struct v4l2_suelse hmax =TVP5150_V_MAX_OTHERS ; - rect.height = clamp_t(unsigned int, rect.height, +/* +* alignments: +* - width = 2 due to UYVY colorspace +* - height, image = no special alignment +*/ +v4l_bound_align_image (&rect.width, +TVP5150_H_MAX -TVP5150_MAX_CROP_LEFT - rect.left, +TVP5150_H_MAX - rect.left,1 , &rect.height, hmax -TVP5150_MAX_CROP_TOP - rect.top, - hmax - rect.top); + hmax - rect.top,0 ,0 );tvp5150_write (sd,TVP5150_VERT_BLANKING_START , rect.top); tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,
PATCH 36/305 PCI/ASPM: Fix link_state teardown on device removal
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit aeae4f3e5c38d47bdaef50446dc0ec857307df68 upstream.
Upon removal of the last device on a bus, the link_state of the bridge leading to that bus is sought to be torn down by having pci_stop_dev() call pcie_aspm_exit_link_state().
When ASPM was originally introduced by commit 7d715a6c1ae5 ("PCI: add PCI Express ASPM support"), it determined whether the device being removed is the last one by calling list_empty() on the bridge's subordinate devices list. That didn't work because the device is only removed from the list slightly later in pci_destroy_dev().
Commit 3419c75e15f8 ("PCI: properly clean up ASPM link state on device remove") attempted to fix it by calling list_is_last(), but that's not correct either because it checks whether the device is at the *end* of the list, not whether it's the last one *left* in the list. If the user removes the device which happens to be at the end of the list via sysfs but other devices are preceding the device in the list, the link_state is torn down prematurely.
The real fix is to move the invocation of pcie_aspm_exit_link_state() to pci_destroy_dev() and reinstate the call to list_empty(). Remove a duplicate check for dev->bus->self because pcie_aspm_exit_link_state() already contains an identical check.
--- drivers/pci/pcie/aspm.c | 2 +- drivers/pci/remove.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/pci/pcie/aspm.c +1 -1
@@ -646,7 +646,7 @@ void pcie_aspm_exit_link_state(struct pc* All PCIe functions are in one slot, remove one function will remove * the whole slot, so just wait until we are the last function left. */ -if (!list_is_last (&pdev->bus_list, &parent->subordinate->devices)) +if (!list_empty (&parent->subordinate->devices)) goto out; link = parent->link_state;
drivers/pci/remove.c +1 -3
@@ -25,9 +25,6 @@ static void pci_stop_dev(struct pci_devdevice_release_driver (&dev->dev); dev->is_added =0 ; } - -if (dev->bus->self) -pcie_aspm_exit_link_state (dev); }static void pci_destroy_dev (struct pci_dev *dev)
@@ -41,6 +38,7 @@ static void pci_destroy_dev(struct pci_dlist_del (&dev->bus_list);up_write (&pci_bus_sem); +pcie_aspm_exit_link_state (dev);pci_free_resources (dev);put_device (&dev->dev); }
PATCH 37/305 cipso: don't use IPCB() to locate the CIPSO IP option
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
commit 04f81f0154e4bf002be6f4d85668ce1257efa4d9 upstream.
Using the IPCB() macro to get the IPv4 options is convenient, but unfortunately NetLabel often needs to examine the CIPSO option outside of the scope of the IP layer in the stack. While historically IPCB() worked above the IP layer, due to the inclusion of the inet_skb_param struct at the head of the {tcp,udp}_skb_cb structs, recent commit 971f10ec ("tcp: better TCP_SKB_CB layout to reduce cache line misses") reordered the tcp_skb_cb struct and invalidated this IPCB() trick.
This patch fixes the problem by creating a new function, cipso_v4_optptr(), which locates the CIPSO option inside the IP header without calling IPCB(). Unfortunately, this isn't as fast as a simple lookup so some additional tweaks were made to limit the use of this new function.
--- include/net/cipso_ipv4.h | 25 +++++++++++------- net/ipv4/cipso_ipv4.c | 51 +++++++++++++++++++++--------------- net/netlabel/netlabel_kapi.c | 15 +++++++---- 3 files changed, 56 insertions(+), 35 deletions(-)
include/net/cipso_ipv4.h +16 -9
@@ -121,13 +121,6 @@ extern int cipso_v4_rbm_strictvalid;#endif /* -* Helper Functions -*/ - -#define CIPSO_V4_OPTEXIST (x) (IPCB(x)->opt.cipso != 0) -#define CIPSO_V4_OPTPTR (x) (skb_network_header(x) + IPCB(x)->opt.cipso) - -/* * DOI List Functions */
@@ -190,7 +183,7 @@ static inline int cipso_v4_doi_domhsh_re#ifdef CONFIG_NETLABEL void cipso_v4_cache_invalidate (void ); -int cipso_v4_cache_add (const struct sk_buff *skb, +int cipso_v4_cache_add (const unsigned char *cipso_ptr,const struct netlbl_lsm_secattr *secattr);#else static inline void cipso_v4_cache_invalidate (void )
@@ -198,7 +191,7 @@ static inline void cipso_v4_cache_invalireturn ; } -static inline int cipso_v4_cache_add (const struct sk_buff *skb, +static inline int cipso_v4_cache_add (const unsigned char *cipso_ptr,const struct netlbl_lsm_secattr *secattr) {return 0 ;
@@ -211,6 +204,8 @@ static inline int cipso_v4_cache_add(con#ifdef CONFIG_NETLABEL void cipso_v4_error (struct sk_buff *skb,int error,u32 gateway); +int cipso_v4_getattr (const unsigned char *cipso, +struct netlbl_lsm_secattr *secattr);int cipso_v4_sock_setattr (struct sock *sk,const struct cipso_v4_doi *doi_def,const struct netlbl_lsm_secattr *secattr);
@@ -226,6 +221,7 @@ int cipso_v4_skbuff_setattr(struct sk_buint cipso_v4_skbuff_delattr (struct sk_buff *skb);int cipso_v4_skbuff_getattr (const struct sk_buff *skb,struct netlbl_lsm_secattr *secattr); +unsigned char *cipso_v4_optptr (const struct sk_buff *skb);int cipso_v4_validate (const struct sk_buff *skb,unsigned char **option);#else static inline void cipso_v4_error(struct sk_buff *skb,
@@ -235,6 +231,12 @@ static inline void cipso_v4_error(structreturn ; } +static inline int cipso_v4_getattr (const unsigned char *cipso, +struct netlbl_lsm_secattr *secattr) +{ +return -ENOSYS ; +} +static inline int cipso_v4_sock_setattr (struct sock *sk,const struct cipso_v4_doi *doi_def,const struct netlbl_lsm_secattr *secattr)
@@ -282,6 +284,11 @@ static inline int cipso_v4_skbuff_getattreturn -ENOSYS ; } +static inline unsigned char *cipso_v4_optptr (const struct sk_buff *skb) +{ +return NULL ; +} +static inline int cipso_v4_validate (const struct sk_buff *skb,unsigned char **option) {
net/ipv4/cipso_ipv4.c +30 -21
86 lines not on this page · raw message
net/netlabel/netlabel_kapi.c +10 -5
@@ -948,10 +948,12 @@ int netlbl_skbuff_getattr(const struct su16 family, struct netlbl_lsm_secattr *secattr) { + unsigned char *ptr; +switch (family) {case AF_INET : - if (CIPSO_V4_OPTEXIST(skb) && - cipso_v4_skbuff_getattr(skb, secattr) == 0) + ptr =cipso_v4_optptr (skb); +if (ptr &&cipso_v4_getattr (ptr, secattr) ==0 )return 0 ;break ;#if IS_ENABLED (CONFIG_IPV6 )
@@ -977,7 +979,7 @@ int netlbl_skbuff_getattr(const struct s*/ void netlbl_skbuff_err (struct sk_buff *skb,int error,int gateway) { -if (CIPSO_V4_OPTEXIST (skb)) +if (cipso_v4_optptr (skb))cipso_v4_error (skb, error, gateway); }
@@ -1009,11 +1011,14 @@ void netlbl_cache_invalidate(void)int netlbl_cache_add (const struct sk_buff *skb,const struct netlbl_lsm_secattr *secattr) { +unsigned char *ptr; +if ((secattr->flags &NETLBL_SECATTR_CACHE ) ==0 )return -ENOMSG ; -if (CIPSO_V4_OPTEXIST (skb)) -return cipso_v4_cache_add (skb, secattr); + ptr =cipso_v4_optptr (skb); +if (ptr) +return cipso_v4_cache_add (ptr, secattr);return -ENOMSG ; }
PATCH 38/305 Cipso: cipso_v4_optptr enter infinite loop
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "yujuan.qi" <[email protected]>
commit 40413955ee265a5e42f710940ec78f5450d49149 upstream.
in for(),if((optlen > 0) && (optptr[1] == 0)), enter infinite loop.
Test: receive a packet which the ip length > 20 and the first byte of ip option is 0, produce this issue
--- net/ipv4/cipso_ipv4.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
net/ipv4/cipso_ipv4.c +10 -2
@@ -1606,9 +1606,17 @@ unsigned char *cipso_v4_optptr(const strint taglen;for (optlen = iph->ihl*4 -sizeof (struct iphdr ); optlen >0 ; ) { -if (optptr[0 ] ==IPOPT_CIPSO ) +switch (optptr[0 ]) { +case IPOPT_CIPSO :return optptr; - taglen = optptr[1 ]; +case IPOPT_END : +return NULL ; +case IPOPT_NOOP : + taglen =1 ; +break ; +default : + taglen = optptr[1 ]; + } optlen -= taglen; optptr += taglen; }
PATCH 39/305 net/ipv4: defensive cipso option parsing
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Nuernberger <[email protected]>
commit 076ed3da0c9b2f88d9157dbe7044a45641ae369e upstream.
commit 40413955ee26 ("Cipso: cipso_v4_optptr enter infinite loop") fixed a possible infinite loop in the IP option parsing of CIPSO. The fix assumes that ip_options_compile filtered out all zero length options and that no other one-byte options beside IPOPT_END and IPOPT_NOOP exist. While this assumption currently holds true, add explicit checks for zero length and invalid length options to be safe for the future. Even though ip_options_compile should have validated the options, the introduction of new one-byte options can still confuse this code without the additional checks.
--- net/ipv4/cipso_ipv4.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/ipv4/cipso_ipv4.c +7 -4
@@ -1595,7 +1595,7 @@ static int cipso_v4_parsetag_loc(const s* * Description: * Parse the packet's IP header looking for a CIPSO option. Returns a pointer -* to the start of the CIPSO option on success, NULL if one if not found. +* to the start of the CIPSO option on success, NULL if one is not found. * */ unsigned char *cipso_v4_optptr (const struct sk_buff *skb)
@@ -1605,10 +1605,8 @@ unsigned char *cipso_v4_optptr(const strint optlen;int taglen; -for (optlen = iph->ihl*4 -sizeof (struct iphdr ); optlen >0 ; ) { +for (optlen = iph->ihl*4 -sizeof (struct iphdr ); optlen >1 ; ) {switch (optptr[0 ]) { -case IPOPT_CIPSO : -return optptr;case IPOPT_END :return NULL ;case IPOPT_NOOP :
@@ -1617,6 +1615,11 @@ unsigned char *cipso_v4_optptr(const strdefault : taglen = optptr[1 ]; } +if (!taglen || taglen > optlen) +return NULL ; +if (optptr[0 ] ==IPOPT_CIPSO ) +return optptr; + optlen -= taglen; optptr += taglen; }
PATCH 40/305 kgdboc: Passing ekgdboc to command line causes panic
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: He Zhe <[email protected]>
commit 1bd54d851f50dea6af30c3e6ff4f3e9aab5558f9 upstream.
kgdboc_option_setup does not check input argument before passing it to strlen. The argument would be a NULL pointer if "ekgdboc", without its value, is set in command line and thus cause the following panic.
PANIC: early exception 0xe3 IP 10:ffffffff8fbbb620 error 0 cr2 0x0
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.18-rc8+ #1 [ 0.000000] RIP: 0010:strlen+0x0/0x20 ... [ 0.000000] Call Trace [ 0.000000] ? kgdboc_option_setup+0x9/0xa0 [ 0.000000] ? kgdboc_early_init+0x6/0x1b [ 0.000000] ? do_early_param+0x4d/0x82 [ 0.000000] ? parse_args+0x212/0x330 [ 0.000000] ? rdinit_setup+0x26/0x26 [ 0.000000] ? parse_early_options+0x20/0x23 [ 0.000000] ? rdinit_setup+0x26/0x26 [ 0.000000] ? parse_early_param+0x2d/0x39 [ 0.000000] ? setup_arch+0x2f7/0xbf4 [ 0.000000] ? start_kernel+0x5e/0x4c2 [ 0.000000] ? load_ucode_bsp+0x113/0x12f [ 0.000000] ? secondary_startup_64+0xa5/0xb0
This patch adds a check to prevent the panic.
--- drivers/tty/serial/kgdboc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/kgdboc.c +5 -0
@@ -133,6 +133,11 @@ static void kgdboc_unregister_kbd(void)static int kgdboc_option_setup (char *opt) { +if (!opt) { +pr_err ("kgdboc: config string not provided\n" ); +return -EINVAL ; + } +if (strlen (opt) >=MAX_CONFIG_LEN ) {printk (KERN_ERR "kgdboc: config string too long\n" );return -ENOSPC ;
PATCH 41/305 usb: chipidea: Prevent unbalanced IRQ disable
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Loic Poulain <[email protected]>
commit 8b97d73c4d72a2abf58f8e49062a7ee1e5f1334e upstream.
The ChipIdea IRQ is disabled before scheduling the otg work and re-enabled on otg work completion. However if the job is already scheduled we have to undo the effect of disable_irq int order to balance the IRQ disable-depth value.
--- drivers/usb/chipidea/otg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/chipidea/otg.h +2 -1
@@ -20,7 +20,8 @@ void ci_handle_vbus_change(struct ci_hdrstatic inline void ci_otg_queue_work (struct ci_hdrc *ci) {disable_irq_nosync (ci->irq); -queue_work (ci->wq, &ci->work); +if (queue_work (ci->wq, &ci->work) == false) +enable_irq (ci->irq); }#endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */
PATCH 42/305 crypto: lrw - Fix out-of bounds access on counter overflow
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Mosnacek <[email protected]>
commit fbe1a850b3b1522e9fc22319ccbbcd2ab05328d2 upstream.
When the LRW block counter overflows, the current implementation returns 128 as the index to the precomputed multiplication table, which has 128 entries. This patch fixes it to return the correct value (127).
--- crypto/lrw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
crypto/lrw.c +6 -1
@@ -132,7 +132,12 @@ static inline int get_index128(be128 *blreturn x +ffz (val); } -return x; +/* +* If we get here, then x == 128 and we are incrementing the counter +* from all ones to all zeros. This means we must return index 127, i.e. +* the one corresponding to key2*{ 1,...,1 }. +*/ +return 127 ; } static int crypt(struct blkcipher_desc *d,
PATCH 43/305 media: pci: cx23885: handle adding to list failure
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Mc Guire <[email protected]>
commit c5d59528e24ad22500347b199d52b9368e686a42 upstream.
altera_hw_filt_init() which calls append_internal() assumes that the node was successfully linked in while in fact it can silently fail. So the call-site needs to set return to -ENOMEM on append_internal() returning NULL and exit through the err path.
--- drivers/media/pci/cx23885/altera-ci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/media/pci/cx23885/altera-ci.c +10 -0
@@ -666,6 +666,10 @@ static int altera_hw_filt_init(struct al } temp_int =append_internal (inter); +if (!temp_int) { + ret = -ENOMEM ; + goto err; + } inter->filts_used =1 ; inter->dev = config->dev; inter->fpga_rw = config->fpga_rw;
@@ -700,6 +704,7 @@ err: __func__, ret);kfree (pid_filt); +kfree (inter);return ret; }
@@ -735,6 +740,10 @@ int altera_ci_init(struct altera_ci_conf } temp_int =append_internal (inter); +if (!temp_int) { + ret = -ENOMEM ; + goto err; + } inter->cis_used =1 ; inter->dev = config->dev; inter->fpga_rw = config->fpga_rw;
@@ -803,6 +812,7 @@ err:ci_dbg_print ("%s: Cannot initialize CI: Error %d.\n" , __func__, ret);kfree (state); +kfree (inter);return ret; }
PATCH 44/305 net: phy: Stop with excessive soft reset
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 6e2d85ec05591b739059f65fe8438c9c5999f7d8 upstream.
While consolidating the PHY reset in phy_init_hw() an unconditionaly BMCR soft-reset I became quite trigger happy with those. This was later on deactivated for the Generic PHY driver on the premise that a prior software entity (e.g: bootloader) might have applied workarounds in commit 0878fff1f42c ("net: phy: Do not perform software reset for Generic PHY").
Since we have a hook to wire-up a soft_reset callback, just use that and get rid of the call to genphy_soft_reset() entirely. This speeds up initialization and link establishment for most PHYs out there that do not require a reset.
--- drivers/net/phy/phy_device.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/phy/phy_device.c +0 -2
@@ -543,8 +543,6 @@ int phy_init_hw(struct phy_device *phydeif (phydev->drv->soft_reset) ret = phydev->drv->soft_reset (phydev); -else - ret =genphy_soft_reset (phydev);if (ret <0 )return ret;
PATCH 45/305 x86/speculation: Apply IBPB more strictly to avoid cross-process data leak
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
commit dbfe2953f63c640463c630746cd5d9de8b2f63ae upstream.
Currently, IBPB is only issued in cases when switching into a non-dumpable process, the rationale being to protect such 'important and security sensitive' processess (such as GPG) from data leaking into a different userspace process via spectre v2.
This is however completely insufficient to provide proper userspace-to-userpace spectrev2 protection, as any process can poison branch buffers before being scheduled out, and the newly scheduled process immediately becomes spectrev2 victim.
In order to minimize the performance impact (for usecases that do require spectrev2 protection), issue the barrier only in cases when switching between processess where the victim can't be ptraced by the potential attacker (as in such cases, the attacker doesn't have to bother with branch buffers at all).
[ tglx: Split up PTRACE_MODE_NOACCESS_CHK into PTRACE_MODE_SCHED and
PTRACE_MODE_IBPB to be able to do ptrace() context tracking reasonably fine-grained ]
[bwh: Backported to 3.16: We don't have mm_context_t::ctx_id so can't use
it to compare task identity.]
---
arch/x86/mm/tlb.c +20 -9
@@ -7,6 +7,7 @@#include <linux/module.h> #include <linux/cpu.h> #include <linux/debugfs.h> +#include <linux/ptrace.h> #include <asm/tlbflush.h> #include <asm/mmu_context.h>
@@ -95,6 +96,19 @@ void switch_mm(struct mm_struct *prev, slocal_irq_restore (flags); } +static bool ibpb_needed (struct task_struct *tsk) +{ +/* +* Check if the current (previous) task has access to the memory +* of the @tsk (next) task. If access is denied, make sure to +* issue a IBPB to stop user->user Spectre-v2 attacks. +* +* Note: __ptrace_may_access() returns 0 or -ERRNO. +*/ +return (tsk && tsk->mm && +ptrace_may_access_sched (tsk,PTRACE_MODE_SPEC_IBPB )); +} +void switch_mm_irqs_off (struct mm_struct *prev,struct mm_struct *next,struct task_struct *tsk) {
@@ -107,16 +121,13 @@ void switch_mm_irqs_off(struct mm_struct* one process from doing Spectre-v2 attacks on another. * * As an optimization, flush indirect branches only when -* switching into processes that disable dumping. This -* protects high value processes like gpg, without having -* too high performance overhead. IBPB is *expensive*! -* -* This will not flush branches when switching into kernel -* threads. It will flush if we switch to a different non- -* dumpable process. +* switching into a processes that can't be ptrace by the +* current one (as in such case, attacker has much more +* convenient way how to tamper with the next process than +* branch buffer poisoning). */ -if (tsk && tsk->mm && -get_dumpable (tsk->mm) !=SUID_DUMP_USER ) +if (static_cpu_has (X86_FEATURE_USE_IBPB ) && +ibpb_needed (tsk))indirect_branch_prediction_barrier ();this_cpu_write (cpu_tlbstate.state,TLBSTATE_OK );
include/linux/ptrace.h +19 -2
@@ -59,14 +59,17 @@ extern void exit_ptrace(struct task_stru#define PTRACE_MODE_READ 0x01#define PTRACE_MODE_ATTACH 0x02#define PTRACE_MODE_NOAUDIT 0x04 -#define PTRACE_MODE_FSCREDS 0x08 -#define PTRACE_MODE_REALCREDS 0x10 +#define PTRACE_MODE_FSCREDS 0x08 +#define PTRACE_MODE_REALCREDS 0x10 +#define PTRACE_MODE_SCHED 0x20 +#define PTRACE_MODE_IBPB 0x40/* shorthands for READ/ATTACH and FSCREDS/REALCREDS combinations */ #define PTRACE_MODE_READ_FSCREDS (PTRACE_MODE_READ | PTRACE_MODE_FSCREDS)#define PTRACE_MODE_READ_REALCREDS (PTRACE_MODE_READ | PTRACE_MODE_REALCREDS)#define PTRACE_MODE_ATTACH_FSCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_FSCREDS)#define PTRACE_MODE_ATTACH_REALCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_REALCREDS) +#define PTRACE_MODE_SPEC_IBPB (PTRACE_MODE_ATTACH_REALCREDS | PTRACE_MODE_IBPB)/** * ptrace_may_access - check whether the caller is permitted to access
@@ -84,6 +87,20 @@ extern void exit_ptrace(struct task_stru*/ extern bool ptrace_may_access (struct task_struct *task,unsigned int mode); +/** +* ptrace_may_access - check whether the caller is permitted to access +* a target task. +* @task: target task +* @mode: selects type of access and caller credentials +* +* Returns true on success, false on denial. +* +* Similar to ptrace_may_access(). Only to be called from context switch +* code. Does not call into audit and the regular LSM hooks due to locking +* constraints. +*/ +extern bool ptrace_may_access_sched (struct task_struct *task,unsigned int mode); +static inline int ptrace_reparented (struct task_struct *child) {return !same_thread_group (child->real_parent, child->parent);
kernel/ptrace.c +10 -0
@@ -262,6 +262,9 @@ static int ptrace_check_attach(struct tastatic int ptrace_has_cap (struct user_namespace *ns,unsigned int mode) { +if (mode &PTRACE_MODE_SCHED ) +return false; +if (mode &PTRACE_MODE_NOAUDIT )return has_ns_capability_noaudit (current, ns,CAP_SYS_PTRACE );else
@@ -329,9 +332,16 @@ ok: !ptrace_has_cap(mm->user_ns, mode)))return -EPERM ; +if (mode &PTRACE_MODE_SCHED ) +return 0 ;return security_ptrace_access_check (task, mode); } +bool ptrace_may_access_sched (struct task_struct *task,unsigned int mode) +{ +return __ptrace_may_access (task, mode |PTRACE_MODE_SCHED ); +} +bool ptrace_may_access (struct task_struct *task,unsigned int mode) {int err;
Re: [PATCH 3.16 045/305] x86/speculation: Apply IBPB more strictly to avoid cross-process data leak
Quoted 7 lines · Ben Hutchings
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
commit
dbfe2953f63c640463c630746cd5d9de8b2f63aeupstream.
You really want the whole IBPB+STIBP revamp from upstream, otherwise you're going to get noticeable performance penalties on some workloads with some microcodes.
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: [PATCH 3.16 045/305] x86/speculation: Apply IBPB more strictly to avoid cross-process data leak
Quoted 6 lines · Jiri Kosina
Quoted 4 lines · Ben Hutchings
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
Quoted 7 lines
Quoted 3 lines
From: Jiri Kosina <[email protected]>
commit
dbfe2953f63c640463c630746cd5d9de8b2f63aeupstream.You really want the whole IBPB+STIBP revamp from upstream, otherwise you're going to get noticeable performance penalties on some workloads with some microcodes.
Yes, we would need the opt-in/opt-out support too.
Please don't merge it just as is.
-Andi
Re: [PATCH 3.16 045/305] x86/speculation: Apply IBPB more strictly to avoid cross-process data leak
Quoted 11 lines · Andi Kleen
Quoted 10 lines · Jiri Kosina
Quoted 7 lines · Ben Hutchings
3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
commit
dbfe2953f63c640463c630746cd5d9de8b2f63aeupstream.
Quoted 7 lines
Quoted 3 lines
You really want the whole IBPB+STIBP revamp from upstream, otherwise you're going to get noticeable performance penalties on some workloads with some microcodes.
Yes, we would need the opt-in/opt-out support too.
Please don't merge it just as is.
Thanks, I've now dropped this.
Ben.
Signature · 3 lines
Ben Hutchings It is impossible to make anything foolproof because fools are so ingenious.
PATCH 46/305 fuse: fix blocked_waitq wakeup
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 908a572b80f6e9577b45e81b3dfe2e22111286b8 upstream.
Using waitqueue_active() is racy. Make sure we issue a wake_up() unconditionally after storing into fc->blocked. After that it's okay to optimize with waitqueue_active() since the first wake up provides the necessary barrier for all waiters, not the just the woken one.
--- fs/fuse/dev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
fs/fuse/dev.c +11 -4
@@ -376,12 +376,19 @@ __releases(fc->lock)if (req->background) { req->background =0 ; -if (fc->num_background == fc->max_background) +if (fc->num_background == fc->max_background) { fc->blocked =0 ; - -/* Wake up next waiter, if any */ -if (!fc->blocked &&waitqueue_active (&fc->blocked_waitq))wake_up (&fc->blocked_waitq); + }else if (!fc->blocked) { +/* +* Wake up next waiter, if any. It's okay to use +* waitqueue_active(), as we've already synced up +* fc->blocked with waiters with the wake_up() call +* above. +*/ +if (waitqueue_active (&fc->blocked_waitq)) +wake_up (&fc->blocked_waitq); + }if (fc->num_background == fc->congestion_threshold && fc->connected && fc->bdi_initialized) {
PATCH 47/305 EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tony Luck <[email protected]>
commit 432de7fd7630c84ad24f1c2acd1e3bb4ce3741ca upstream.
The count of errors is picked up from bits 52:38 of the machine check bank status register. But this is the count of *corrected* errors. If an uncorrected error is being logged, the h/w sets this field to 0. Which means that when edac_mc_handle_error() is called, the EDAC core will carefully add zero to the appropriate uncorrected error counts.
---
drivers/edac/i7core_edac.c +1 -0
@@ -1729,6 +1729,7 @@ static void i7core_mce_output_error(struu32 errnum =find_first_bit (&error,32 );if (uncorrected_error) { + core_err_cnt =1 ;if (ripv) tp_event =HW_EVENT_ERR_FATAL ;else
drivers/edac/sb_edac.c +1 -0
@@ -1659,6 +1659,7 @@ static void sbridge_mce_output_error(str recoverable =GET_BITFIELD (m->status,56 ,56 );if (uncorrected_error) { + core_err_cnt =1 ;if (ripv) { type ="FATAL" ; tp_event =HW_EVENT_ERR_FATAL ;
PATCH 48/305 iio: adc: at91: fix acking DRDY irq on simple conversions
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eugen Hristev <[email protected]>
commit bc1b45326223e7e890053cf6266357adfa61942d upstream.
When doing simple conversions, the driver did not acknowledge the DRDY irq. If this irq status is not acked, it will be left pending, and as soon as a trigger is enabled, the irq handler will be called, it doesn't know why this status has occurred because no channel is pending, and then it will go int a irq loop and board will hang.
To avoid this situation, read the LCDR after a raw conversion is done.
--- drivers/iio/adc/at91_adc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/at91_adc.c +2 -0
@@ -276,6 +276,8 @@ void handle_adc_eoc_trigger(int irq, striio_trigger_poll (idev->trig,iio_get_time_ns ()); }else { st->last_value =at91_adc_readl (st,AT91_ADC_CHAN (st, st->chnb)); +/* Needed to ACK the DRDY interruption */ +at91_adc_readl (st,AT91_ADC_LCDR ); st->done = true;wake_up_interruptible (&st->wq_data_avail); }
PATCH 49/305 iio: adc: at91: fix wrong channel number in triggered buffer mode
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eugen Hristev <[email protected]>
commit aea835f2dc8a682942b859179c49ad1841a6c8b9 upstream.
When channels are registered, the hardware channel number is not the actual iio channel number.
This is because the driver is probed with a certain number of accessible channels. Some pins are routed and some not, depending on the description of the board in the DT.
Because of that, channels 0,1,2,3 can correspond to hardware channels 2,3,4,5 for example.
In the buffered triggered case, we need to do the translation accordingly. Fixed the channel number to stop reading the wrong channel.
--- drivers/iio/adc/at91_adc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/adc/at91_adc.c +3 -1
@@ -245,12 +245,14 @@ static irqreturn_t at91_adc_trigger_handstruct iio_poll_func *pf = p;struct iio_dev *idev = pf->indio_dev;struct at91_adc_state *st =iio_priv (idev); +struct iio_chan_spec const *chan;int i, j =0 ;for (i =0 ; i < idev->masklength; i++) {if (!test_bit (i, idev->active_scan_mask))continue ; - st->buffer[j] =at91_adc_readl (st,AT91_ADC_CHAN (st, i)); + chan = idev->channels + i; + st->buffer[j] =at91_adc_readl (st,AT91_ADC_CHAN (st, chan->channel)); j++; }
PATCH 50/305 iio: ad5064: Fix regulator handling
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit 8911a43bc198877fad9f4b0246a866b26bb547ab upstream.
The correct way to handle errors returned by regualtor_get() and friends is to propagate the error since that means that an regulator was specified, but something went wrong when requesting it.
For handling optional regulators, e.g. when the device has an internal vref, regulator_get_optional() should be used to avoid getting the dummy regulator that the regulator core otherwise provides.
[bwh: Backported to 3.16: Keep using ad5064_write() instead of
ad5064_set_config().]
--- drivers/iio/dac/ad5064.c | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 15 deletions(-)
drivers/iio/dac/ad5064.c +39 -16
@@ -469,6 +469,41 @@ static const char * const ad5064_vref_nareturn st->chip_info->shared_vref ?"vref" : ad5064_vref_names[vref]; } +static int ad5064_request_vref (struct ad5064_state *st,struct device *dev) +{ +unsigned int i; +int ret; + +for (i =0 ; i <ad5064_num_vref (st); ++i) + st->vref_reg[i].supply =ad5064_vref_name (st, i); + +if (!st->chip_info->internal_vref) +return devm_regulator_bulk_get (dev,ad5064_num_vref (st), + st->vref_reg); + +/* +* This assumes that when the regulator has an internal VREF +* there is only one external VREF connection, which is +* currently the case for all supported devices. +*/ + st->vref_reg[0 ].consumer =devm_regulator_get_optional (dev,"vref" ); +if (!IS_ERR (st->vref_reg[0 ].consumer)) +return 0 ; + + ret =PTR_ERR (st->vref_reg[0 ].consumer); +if (ret != -ENODEV ) +return ret; + +/* If no external regulator was supplied use the internal VREF */ + st->use_internal_vref = true; + ret =ad5064_write (st,AD5064_CMD_CONFIG ,0 , +AD5064_CONFIG_INT_VREF_ENABLE ,0 ); +if (ret) +dev_err (dev,"Failed to enable internal vref: %d\n" , ret); + +return ret; +} +static int ad5064_probe (struct device *dev,enum ad5064_type type,const char *name,ad5064_write_func write) {
@@ -489,23 +524,11 @@ static int ad5064_probe(struct device *d st->dev = dev; st->write = write; -for (i =0 ; i <ad5064_num_vref (st); ++i) - st->vref_reg[i].supply =ad5064_vref_name (st, i); + ret =ad5064_request_vref (st, dev); +if (ret) +return ret; - ret =devm_regulator_bulk_get (dev,ad5064_num_vref (st), - st->vref_reg); -if (ret) { -if (!st->chip_info->internal_vref) -return ret; - st->use_internal_vref = true; - ret =ad5064_write (st,AD5064_CMD_CONFIG ,0 , -AD5064_CONFIG_INT_VREF_ENABLE ,0 ); -if (ret) { -dev_err (dev,"Failed to enable internal vref: %d\n" , - ret); -return ret; - } - }else { +if (!st->use_internal_vref) { ret =regulator_bulk_enable (ad5064_num_vref (st), st->vref_reg);if (ret)return ret;
PATCH 51/305 pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej S. Szmigiero" <[email protected]>
commit 95691e3eddc41da2d1cd3cca51fecdfb46bd85bc upstream.
Currently, "disable_clkrun" yenta_socket module parameter is only implemented for TI CardBus bridges.
Add also an implementation for Ricoh bridges that have the necessary setting documented in publicly available datasheets.
Tested on a RL5C476II with a Sunrich C-160 CardBus NIC that doesn't work correctly unless the CLKRUN protocol is disabled.
Let's also make it clear in its description that the "disable_clkrun" module parameter only works on these two previously mentioned brands of CardBus bridges.
--- drivers/pcmcia/ricoh.h | 35 +++++++++++++++++++++++++++++++++++ drivers/pcmcia/yenta_socket.c | 3 ++- 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/pcmcia/ricoh.h +35 -0
@@ -119,6 +119,10 @@#define RL5C4XX_MISC_CONTROL 0x2F/* 8 bit */ #define RL5C4XX_ZV_ENABLE 0x08 +/* Misc Control 3 Register */ +#define RL5C4XX_MISC3 0x00A2/* 16 bit */ +#define RL5C47X_MISC3_CB_CLKRUN_DIS BIT(1) +#ifdef __YENTA_H#define rl_misc (socket) ((socket)->private[0])
@@ -156,6 +160,35 @@ static void ricoh_set_zv(struct yenta_so } } +static void ricoh_set_clkrun (struct yenta_socket *socket,bool quiet) +{ +u16 misc3; + +/* +* RL5C475II likely has this setting, too, however no datasheet +* is publicly available for this chip +*/ +if (socket->dev->device !=PCI_DEVICE_ID_RICOH_RL5C476 && + socket->dev->device !=PCI_DEVICE_ID_RICOH_RL5C478 ) +return ; + +if (socket->dev->revision <0x80 ) +return ; + + misc3 =config_readw (socket,RL5C4XX_MISC3 ); +if (misc3 &RL5C47X_MISC3_CB_CLKRUN_DIS ) { +if (!quiet) +dev_dbg (&socket->dev->dev, +"CLKRUN feature already disabled\n" ); + }else if (disable_clkrun) { +if (!quiet) +dev_info (&socket->dev->dev, +"Disabling CLKRUN feature\n" ); + misc3 |=RL5C47X_MISC3_CB_CLKRUN_DIS ; +config_writew (socket,RL5C4XX_MISC3 , misc3); + } +} +static void ricoh_save_state (struct yenta_socket *socket) {rl_misc (socket) =config_readw (socket,RL5C4XX_MISC );
@@ -172,6 +205,7 @@ static void ricoh_restore_state(struct yconfig_writew (socket,RL5C4XX_16BIT_IO_0 ,rl_io (socket));config_writew (socket,RL5C4XX_16BIT_MEM_0 ,rl_mem (socket));config_writew (socket,RL5C4XX_CONFIG ,rl_config (socket)); +ricoh_set_clkrun (socket, true); }
@@ -197,6 +231,7 @@ static int ricoh_override(struct yenta_sconfig_writew (socket,RL5C4XX_CONFIG , config);ricoh_set_zv (socket); +ricoh_set_clkrun (socket, false);return 0 ; }
drivers/pcmcia/yenta_socket.c +2 -1
@@ -26,7 +26,8 @@static bool disable_clkrun;module_param (disable_clkrun, bool,0444 ); -MODULE_PARM_DESC (disable_clkrun,"If PC card doesn't function properly, please try this option" ); +MODULE_PARM_DESC (disable_clkrun, +"If PC card doesn't function properly, please try this option (TI and Ricoh bridges only)" );static bool isa_probe =1 ;module_param (isa_probe, bool,0444 );
PATCH 52/305 PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Enric Balletbo i Serra <[email protected]>
commit 23c7b54ca1cd1797ef39169ab85e6d46f1c2d061 upstream.
When the devfreq driver and the governor driver are built as modules, the call to devfreq_add_device() or governor_store() fails because the governor driver is not loaded at the time the devfreq driver loads. The devfreq driver has a build dependency on the governor but also should have a runtime dependency. We need to make sure that the governor driver is loaded before the devfreq driver.
This patch fixes this bug by adding a try_then_request_governor() function. First tries to find the governor, and then, if it is not found, it requests the module and tries again.
[bwh: Backported to 3.16:
- Use string literal instead of DEVFREQ_GOV_SIMPLE_ONDEMAND
- Adjust context]
--- drivers/devfreq/devfreq.c | 53 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-)
drivers/devfreq/devfreq.c +49 -4
@@ -11,6 +11,7 @@*/ #include <linux/kernel.h> +#include <linux/kmod.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/err.h>
@@ -148,6 +149,49 @@ static struct devfreq_governor *find_devreturn ERR_PTR (-ENODEV ); } +/** +* try_then_request_governor() - Try to find the governor and request the +* module if is not found. +* @name: name of the governor +* +* Search the list of devfreq governors and request the module and try again +* if is not found. This can happen when both drivers (the governor driver +* and the driver that call devfreq_add_device) are built as modules. +* devfreq_list_lock should be held by the caller. Returns the matched +* governor's pointer. +*/ +static struct devfreq_governor *try_then_request_governor (const char *name) +{ +struct devfreq_governor *governor; +int err =0 ; + +if (IS_ERR_OR_NULL (name)) { +pr_err ("DEVFREQ: %s: Invalid parameters\n" , __func__); +return ERR_PTR (-EINVAL ); + } +WARN (!mutex_is_locked (&devfreq_list_lock), +"devfreq_list_lock must be locked." ); + + governor =find_devfreq_governor (name); +if (IS_ERR (governor)) { +mutex_unlock (&devfreq_list_lock); + +if (!strncmp (name,"simple_ondemand" , +DEVFREQ_NAME_LEN )) + err =request_module ("governor_%s" ,"simpleondemand" ); +else + err =request_module ("governor_%s" , name); +/* Restore previous state before return */ +mutex_lock (&devfreq_list_lock); +if (err) +return NULL ; + + governor =find_devfreq_governor (name); + } + +return governor; +} +/* Load monitoring helper functions for governors use */ /**
@@ -499,9 +543,8 @@ struct devfreq *devfreq_add_device(strucmutex_unlock (&devfreq->lock);mutex_lock (&devfreq_list_lock); -list_add (&devfreq->node, &devfreq_list); - governor =find_devfreq_governor (devfreq->governor_name); + governor =try_then_request_governor (devfreq->governor_name);if (IS_ERR (governor)) {dev_err (dev,"%s: Unable to find governor for the device\n" , __func__);
@@ -517,12 +560,14 @@ struct devfreq *devfreq_add_device(struc __func__); goto err_init; } + +list_add (&devfreq->node, &devfreq_list); +mutex_unlock (&devfreq_list_lock);return devfreq; err_init: -list_del (&devfreq->node);mutex_unlock (&devfreq_list_lock);device_unregister (&devfreq->dev);
@@ -798,7 +843,7 @@ static ssize_t governor_store(struct devreturn -EINVAL ;mutex_lock (&devfreq_list_lock); - governor =find_devfreq_governor (str_governor); + governor =try_then_request_governor (str_governor);if (IS_ERR (governor)) { ret =PTR_ERR (governor); goto out;
PATCH 53/305 usb: gadget: fsl_udc_core: check allocation return value and cleanup on failure
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Mc Guire <[email protected]>
commit 4ab2b48c98f2ec9712452d520a381917f91ac3d2 upstream.
The allocation with fsl_alloc_request() and kmalloc() were unchecked fixed this up with a NULL check and appropriate cleanup.
Additionally udc->ep_qh_size was reset to 0 on failure of allocation. Similar udc->phy_mode is initially 0 (as udc_controller was allocated with kzalloc in fsl_udc_probe()) so reset it to 0 as well so that this function is side-effect free on failure. Not clear if this is necessary or sensible as fsl_udc_release() probably can not be called if fsl_udc_probe() failed - but it should not hurt.
--- drivers/usb/gadget/fsl_udc_core.c | 30 +++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
drivers/usb/gadget/fsl_udc_core.c +26 -4
@@ -2256,8 +2256,10 @@ static int __init struct_udc_setup(struc udc->phy_mode = pdata->phy_mode; udc->eps =kzalloc (sizeof (struct fsl_ep ) * udc->max_ep,GFP_KERNEL ); -if (!udc->eps) -return -1 ; +if (!udc->eps) { +ERR ("kmalloc udc endpoint status failed\n" ); + goto eps_alloc_failed; + }/* initialized QHs, take care of alignment */ size = udc->max_ep *sizeof (struct ep_queue_head );
@@ -2271,8 +2273,7 @@ static int __init struct_udc_setup(struc &udc->ep_qh_dma, GFP_KERNEL);if (!udc->ep_qh) {ERR ("malloc QHs for udc failed\n" ); -kfree (udc->eps); -return -1 ; + goto ep_queue_alloc_failed; } udc->ep_qh_size = size;
@@ -2281,8 +2282,17 @@ static int __init struct_udc_setup(struc/* FIXME: fsl_alloc_request() ignores ep argument */ udc->status_req =container_of (fsl_alloc_request (NULL ,GFP_KERNEL ), struct fsl_req, req); +if (!udc->status_req) { +ERR ("kzalloc for udc status request failed\n" ); + goto udc_status_alloc_failed; + } +/* allocate a small amount of memory to get valid address */ udc->status_req->req.buf =kmalloc (8 ,GFP_KERNEL ); +if (!udc->status_req->req.buf) { +ERR ("kzalloc for udc request buffer failed\n" ); + goto udc_req_buf_alloc_failed; + } udc->resume_state =USB_STATE_NOTATTACHED ; udc->usb_state =USB_STATE_POWERED ;
@@ -2290,6 +2300,18 @@ static int __init struct_udc_setup(struc udc->remote_wakeup =0 ;/* default to 0 on reset */ return 0 ; + +udc_req_buf_alloc_failed: +kfree (udc->status_req); +udc_status_alloc_failed: +kfree (udc->ep_qh); + udc->ep_qh_size =0 ; +ep_queue_alloc_failed: +kfree (udc->eps); +eps_alloc_failed: + udc->phy_mode =0 ; +return -1 ; + }/*----------------------------------------------------------------
PATCH 54/305 ext4: fix EXT4_IOC_SWAP_BOOT
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 18aded17492088962ef43f00825179598b3e8c58 upstream.
The code EXT4_IOC_SWAP_BOOT ioctl hasn't been updated in a while, and it's a bit broken with respect to more modern ext4 kernels, especially metadata checksums.
Other problems fixed with this commit:
* Don't allow installing a DAX, swap file, or an encrypted file as a boot loader.
* Respect the immutable and append-only flags.
* Wait until any DIO operations are finished *before* calling truncate_inode_pages().
* Don't swap inode->i_flags, since these flags have nothing to do with the inode blocks --- and it will give the IMA/audit code heartburn when the inode is evicted.
[bwh: Backported to 3.16:
- Drop IS_ENCRYPTED() check
- Adjust context]
--- fs/ext4/ioctl.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)
fs/ext4/ioctl.c +27 -6
@@ -64,7 +64,6 @@ static void swap_inode_data(struct inode ei1 =EXT4_I (inode1); ei2 =EXT4_I (inode2); -memswap (&inode1->i_flags, &inode2->i_flags,sizeof (inode1->i_flags));memswap (&inode1->i_version, &inode2->i_version,sizeof (inode1->i_version)); memswap(&inode1->i_blocks, &inode2->i_blocks,
@@ -86,6 +85,21 @@ static void swap_inode_data(struct inodei_size_write (inode2, isize); } +static void reset_inode_seed (struct inode *inode) +{ +struct ext4_inode_info *ei =EXT4_I (inode); +struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb); +__le32 inum =cpu_to_le32 (inode->i_ino); +__le32 gen =cpu_to_le32 (inode->i_generation); +__u32 csum; + +if (!ext4_has_metadata_csum (inode->i_sb)) +return ; + + csum =ext4_chksum (sbi, sbi->s_csum_seed, (__u8 *)&inum,sizeof (inum)); + ei->i_csum_seed =ext4_chksum (sbi, csum, (__u8 *)&gen,sizeof (gen)); +} +/** * Swap the information from the given @inode and the inode * EXT4_BOOT_LOADER_INO. It will basically swap i_data and all other
@@ -104,10 +118,13 @@ static long swap_inode_boot_loader(strucstruct ext4_inode_info *ei_bl;struct ext4_sb_info *sbi =EXT4_SB (sb); -if (inode->i_nlink !=1 || !S_ISREG (inode->i_mode)) +if (inode->i_nlink !=1 || !S_ISREG (inode->i_mode) || +IS_SWAPFILE (inode) || +ext4_has_inline_data (inode))return -EINVAL ; -if (!inode_owner_or_capable (inode) || !capable (CAP_SYS_ADMIN )) +if (IS_RDONLY (inode) ||IS_APPEND (inode) ||IS_IMMUTABLE (inode) || + !inode_owner_or_capable (inode) || !capable (CAP_SYS_ADMIN ))return -EPERM ; inode_bl =ext4_iget (sb,EXT4_BOOT_LOADER_INO );
@@ -122,15 +139,15 @@ static long swap_inode_boot_loader(struc* that only 1 swap_inode_boot_loader is running. */ lock_two_nondirectories (inode, inode_bl); -truncate_inode_pages (&inode->i_data,0 ); -truncate_inode_pages (&inode_bl->i_data,0 ); -/* Wait for all existing dio workers */ ext4_inode_block_unlocked_dio (inode);ext4_inode_block_unlocked_dio (inode_bl);inode_dio_wait (inode);inode_dio_wait (inode_bl); +truncate_inode_pages (&inode->i_data,0 ); +truncate_inode_pages (&inode_bl->i_data,0 ); + handle =ext4_journal_start (inode_bl,EXT4_HT_MOVE_EXTENTS ,2 );if (IS_ERR (handle)) { err = -EINVAL ;
@@ -166,6 +183,8 @@ static long swap_inode_boot_loader(struc inode->i_generation = sbi->s_next_generation++; inode_bl->i_generation = sbi->s_next_generation++;spin_unlock (&sbi->s_next_gen_lock); +reset_inode_seed (inode); +reset_inode_seed (inode_bl);ext4_discard_preallocations (inode);
@@ -176,6 +195,7 @@ static long swap_inode_boot_loader(struc inode->i_ino, err);/* Revert all changes: */ swap_inode_data (inode, inode_bl); +ext4_mark_inode_dirty (handle, inode); }else { err =ext4_mark_inode_dirty (handle, inode_bl);if (err <0 ) {
@@ -185,6 +205,7 @@ static long swap_inode_boot_loader(struc/* Revert all changes: */ swap_inode_data (inode, inode_bl);ext4_mark_inode_dirty (handle, inode); +ext4_mark_inode_dirty (handle, inode_bl); } }ext4_journal_stop (handle);
PATCH 55/305 w1: omap-hdq: fix missing bus unregister at removal
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
commit a007734618fee1bf35556c04fa498d41d42c7301 upstream.
The bus master was not removed after unloading the module or unbinding the driver. That lead to oopses like this
[ 127.842987] Unable to handle kernel paging request at virtual address bf01d04c [ 127.850646] pgd = 70e3cd9a [ 127.853698] [bf01d04c] *pgd=8f908811, *pte=00000000, *ppte=00000000 [ 127.860412] Internal error: Oops: 80000007 [#1] PREEMPT SMP ARM [ 127.866668] Modules linked in: bq27xxx_battery overlay [last unloaded: omap_hdq] [ 127.874542] CPU: 0 PID: 1022 Comm: w1_bus_master1 Not tainted 4.19.0-rc4-00001-g2d51da718324 #12 [ 127.883819] Hardware name: Generic OMAP36xx (Flattened Device Tree) [ 127.890441] PC is at 0xbf01d04c [ 127.893798] LR is at w1_search_process_cb+0x4c/0xfc [ 127.898956] pc : [<bf01d04c>] lr : [<c05f9580>] psr: a0070013 [ 127.905609] sp : cf885f48 ip : bf01d04c fp : ddf1e11c [ 127.911132] r10: cf8fe040 r9 : c05f8d00 r8 : cf8fe040 [ 127.916656] r7 : 000000f0 r6 : cf8fe02c r5 : cf8fe000 r4 : cf8fe01c [ 127.923553] r3 : c05f8d00 r2 : 000000f0 r1 : cf8fe000 r0 : dde1ef10 [ 127.930450] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 127.938018] Control: 10c5387d Table: 8f8f0019 DAC: 00000051 [ 127.944091] Process w1_bus_master1 (pid: 1022, stack limit = 0x9135699f) [ 127.951171] Stack: (0xcf885f48 to 0xcf886000) [ 127.955810] 5f40: cf8fe000 00000000 cf884000 cf8fe090 000003e8 c05f8d00 [ 127.964477] 5f60: dde5fc34 c05f9700 ddf1e100 ddf1e540 cf884000 cf8fe000 c05f9694 00000000 [ 127.973114] 5f80: dde5fc34 c01499a4 00000000 ddf1e540 c0149874 00000000 00000000 00000000 [ 127.981781] 5fa0: 00000000 00000000 00000000 c01010e8 00000000 00000000 00000000 00000000 [ 127.990447] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 127.999114] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ 128.007781] [<c05f9580>] (w1_search_process_cb) from [<c05f9700>] (w1_process+0x6c/0x118) [ 128.016479] [<c05f9700>] (w1_process) from [<c01499a4>] (kthread+0x130/0x148) [ 128.024047] [<c01499a4>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c) [ 128.031677] Exception stack(0xcf885fb0 to 0xcf885ff8) [ 128.037017] 5fa0: 00000000 00000000 00000000 00000000 [ 128.045684] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 128.054351] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 128.061340] Code: bad PC value [ 128.064697] ---[ end trace af066e33c0e14119 ]---
--- drivers/w1/masters/omap_hdq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/w1/masters/omap_hdq.c +2 -0
@@ -622,6 +622,8 @@ static int omap_hdq_remove(struct platfo/* remove module dependency */ pm_runtime_disable (&pdev->dev); +w1_remove_master_device (&omap_w1_master); +return 0 ; }
PATCH 56/305 VMCI: Resource wildcard match fixed
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jorgen Hansen <[email protected]>
commit 11924ba5e671d6caef1516923e2bd8c72929a3fe upstream.
When adding a VMCI resource, the check for an existing entry would ignore that the new entry could be a wildcard. This could result in multiple resource entries that would match a given handle. One disastrous outcome of this is that the refcounting used to ensure that delayed callbacks for VMCI datagrams have run before the datagram is destroyed can be wrong, since the refcount could be increased on the duplicate entry. This in turn leads to a use after free bug. This issue was discovered by Hangbin Liu using KASAN and syzkaller.
---
drivers/misc/vmw_vmci/vmci_resource.c +2 -1
@@ -56,7 +56,8 @@ static struct vmci_resource *vmci_resourif (r->type == type && rid == handle.resource && - (cid == handle.context || cid ==VMCI_INVALID_ID )) { + (cid == handle.context || cid ==VMCI_INVALID_ID || + handle.context ==VMCI_INVALID_ID )) { resource = r;break ; }
PATCH 57/305 Drivers: hv: kvp: Fix two "this statement may fall through" warnings
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dexuan Cui <[email protected]>
commit fc62c3b1977d62e6374fd6e28d371bb42dfa5c9d upstream.
We don't need to call process_ib_ipinfo() if message->kvp_hdr.operation is KVP_OP_GET_IP_INFO in kvp_send_key(), because here we just need to pass on the op code from the host to the userspace; when the userspace returns the info requested by the host, we pass the info on to the host in kvp_respond_to_host() -> process_ob_ipinfo(). BTW, the current buggy code actually doesn't cause any harm, because only message->kvp_hdr.operation is used by the userspace, in the case of KVP_OP_GET_IP_INFO.
The patch also adds a missing "break;" in kvp_send_key(). BTW, the current buggy code actually doesn't cause any harm, because in the case of KVP_OP_SET, the unexpected fall-through corrupts message->body.kvp_set.data.key_size, but that is not really used: see the definition of struct hv_kvp_exchg_msg_value.
--- drivers/hv/hv_kvp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hv/hv_kvp.c +4 -2
@@ -326,7 +326,6 @@ static void process_ib_ipinfo(void *in_m out->body.kvp_ip_val.dhcp_enabled = in->kvp_ip_val.dhcp_enabled; -default : utf16s_to_utf8s((wchar_t *)in->kvp_ip_val.adapter_id, MAX_ADAPTER_ID_SIZE, UTF16_LITTLE_ENDIAN,
@@ -379,7 +378,7 @@ kvp_send_key(struct work_struct *dummy)process_ib_ipinfo (in_msg, message,KVP_OP_SET_IP_INFO );break ;case KVP_OP_GET_IP_INFO : -process_ib_ipinfo (in_msg, message,KVP_OP_GET_IP_INFO ); +/* We only need to pass on message->kvp_hdr.operation. */ break ;case KVP_OP_SET :switch (in_msg->body.kvp_set.data.value_type) {
@@ -419,6 +418,9 @@ kvp_send_key(struct work_struct *dummy)break ; } + +break ; +case KVP_OP_GET : message->body.kvp_set.data.key_size = utf16s_to_utf8s(
PATCH 58/305 ext4: initialize retries variable in ext4_da_write_inline_data_begin()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit 625ef8a3acd111d5f496d190baf99d1a815bd03e upstream.
Variable retries is not initialized in ext4_da_write_inline_data_begin() which can lead to nondeterministic number of retries in case we hit ENOSPC. Initialize retries to zero as we do everywhere else.
--- fs/ext4/inline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inline.c +1 -1
@@ -859,7 +859,7 @@ int ext4_da_write_inline_data_begin(struhandle_t *handle;struct page *page;struct ext4_iloc iloc; -int retries; +int retries =0 ; ret =ext4_get_inode_loc (inode, &iloc);if (ret)
PATCH 59/305 powerpc/pseries: Fix DTL buffer registration
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Naveen N. Rao" <[email protected]>
commit db787af1b8a6b4be428ee2ea7d409dafcaa4a43c upstream.
When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we register the DTL buffer for a cpu when the associated file under powerpc/dtl in debugfs is opened. When doing so, we need to set the size of the buffer being registered in the second u32 word of the buffer. This needs to be in big endian, but we are not doing the conversion resulting in the below error showing up in dmesg:
dtl_start: DTL registration for cpu 0 (hw 0) failed with -4
Fix this in the obvious manner.
--- arch/powerpc/platforms/pseries/dtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/dtl.c +1 -1
@@ -149,7 +149,7 @@ static int dtl_start(struct dtl *dtl)/* Register our dtl buffer with the hypervisor. The HV expects the * buffer size to be passed in the second word of the buffer */ - ((u32 *)dtl->buf)[1 ] =DISPATCH_LOG_BYTES ; + ((u32 *)dtl->buf)[1 ] =cpu_to_be32 (DISPATCH_LOG_BYTES ); hwcpu =get_hard_smp_processor_id (dtl->cpu); addr =__pa (dtl->buf);
PATCH 60/305 powerpc/pseries: Fix how we iterate over the DTL entries
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Naveen N. Rao" <[email protected]>
commit 9258227e9dd1da8feddb07ad9702845546a581c9 upstream.
When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we look up dtl_idx in the lppaca to determine the number of entries in the buffer. Since lppaca is in big endian, we need to do an endian conversion before using this in our calculation to determine the number of entries in the buffer. Without this, we do not iterate over the existing entries in the DTL buffer properly.
--- arch/powerpc/platforms/pseries/dtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/pseries/dtl.c +1 -1
@@ -184,7 +184,7 @@ static void dtl_stop(struct dtl *dtl)static u64 dtl_current_index (struct dtl *dtl) { -return lppaca_of (dtl->cpu).dtl_idx; +return be64_to_cpu (lppaca_of (dtl->cpu).dtl_idx); }#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
PATCH 61/305 x86, hibernate: Fix nosave_regions setup for hibernation
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Zhimin Gu <[email protected]>
commit cc55f7537db6af371e9c1c6a71161ee40f918824 upstream.
On 32bit systems, nosave_regions(non RAM areas) located between max_low_pfn and max_pfn are not excluded from hibernation snapshot currently, which may result in a machine check exception when trying to access these unsafe regions during hibernation:
[ 612.800453] Disabling lock debugging due to kernel taint
[ 612.805786] mce: [Hardware Error]: CPU 0: Machine Check Exception: 5 Bank 6: fe00000000801136
[ 612.814344] mce: [Hardware Error]: RIP !INEXACT! 60:<00000000d90be566> {swsusp_save+0x436/0x560}
[ 612.823167] mce: [Hardware Error]: TSC 1f5939fe276 ADDR dd000000 MISC 30e0000086
[ 612.830677] mce: [Hardware Error]: PROCESSOR 0:306c3 TIME 1529487426 SOCKET 0 APIC 0 microcode 24
[ 612.839581] mce: [Hardware Error]: Run the above through 'mcelog --ascii'
[ 612.846394] mce: [Hardware Error]: Machine check: Processor context corrupt
[ 612.853380] Kernel panic - not syncing: Fatal machine check
[ 612.858978] Kernel Offset: 0x18000000 from 0xc1000000 (relocation range: 0xc0000000-0xf7ffdfff)This is because on 32bit systems, pages above max_low_pfn are regarded as high memeory, and accessing unsafe pages might cause expected MCE. On the problematic 32bit system, there are reserved memory above low memory, which triggered the MCE:
e820 memory mapping:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009d7ff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009d800-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000d160cfff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d160d000-0x00000000d1613fff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x00000000d1614000-0x00000000d1a44fff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d1a45000-0x00000000d1ecffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000d1ed0000-0x00000000d7eeafff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d7eeb000-0x00000000d7ffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000d8000000-0x00000000d875ffff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d8760000-0x00000000d87fffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000d8800000-0x00000000d8fadfff] usable [ 0.000000] BIOS-e820: [mem 0x00000000d8fae000-0x00000000d8ffffff] ACPI data [ 0.000000] BIOS-e820: [mem 0x00000000d9000000-0x00000000da71bfff] usable [ 0.000000] BIOS-e820: [mem 0x00000000da71c000-0x00000000da7fffff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x00000000da800000-0x00000000dbb8bfff] usable [ 0.000000] BIOS-e820: [mem 0x00000000dbb8c000-0x00000000dbffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000dd000000-0x00000000df1fffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fed00000-0x00000000fed03fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000041edfffff] usable
Fix this problem by changing pfn limit from max_low_pfn to max_pfn. This fix does not impact 64bit system because on 64bit max_low_pfn is the same as max_pfn.
--- arch/x86/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/setup.c +1 -1
@@ -1234,7 +1234,7 @@ void __init setup_arch(char **cmdline_p)kvm_guest_init ();e820_reserve_resources (); -e820_mark_nosave_regions (max_low_pfn); +e820_mark_nosave_regions (max_pfn); x86_init.resources.reserve_resources ();
PATCH 62/305 IB/mthca: Fix error return code in __mthca_init_one()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 39f2495618c5e980d2873ea3f2d1877dd253e07a upstream.
Fix to return a negative error code from the mthca_cmd_init() error handling case instead of 0, as done elsewhere in this function.
--- drivers/infiniband/hw/mthca/mthca_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mthca/mthca_main.c +2 -1
@@ -989,7 +989,8 @@ static int __mthca_init_one(struct pci_d goto err_free_dev; } -if (mthca_cmd_init (mdev)) { + err =mthca_cmd_init (mdev); +if (err) {mthca_err (mdev,"Failed to init command interface, aborting.\n" ); goto err_free_dev; }
PATCH 63/305 ALSA: usb-audio: update quirk for B&W PX to remove microphone
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Huaman <[email protected]>
commit c369c8db15d51fa175d2ba85928f79d16af6b562 upstream.
A quirk in snd-usb-audio was added to automate setting sample rate to 4800k and remove the previously exposed nonfunctional microphone for the Bowers & Wilkins PX:
commit 240a8af929c7c57dcde28682725b29cf8474e8e5
https://lore.kernel.org/patchwork/patch/919689/
However the headphones where updated shortly after that to remove the unintentional microphone functionality. I guess because of this the headphones now crash when connecting them via USB while the quirk is active. Dmesg:
snd-usb-audio: probe of 2-3:1.0 failed with error -22 usb 2-3: 2:1: cannot get min/max values for control 2 (id 2)
This patch removes the microfone and allows the headphones to connect and work out of the box. It is based on the current mainline kernel
and successfully applied an tested on my machine (4.18.10.arch1-1).
--- sound/usb/quirks-table.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/usb/quirks-table.h +2 -7
@@ -3281,19 +3281,14 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge .ifnum = 0, .type = QUIRK_AUDIO_STANDARD_MIXER, }, - /* Capture */ - { - .ifnum = 1, - .type = QUIRK_IGNORE_INTERFACE, - },/* Playback */ { - .ifnum = 2, + .ifnum = 1, .type = QUIRK_AUDIO_FIXED_ENDPOINT, .data = &(const struct audioformat) { .formats = SNDRV_PCM_FMTBIT_S16_LE, .channels = 2, - .iface = 2, + .iface = 1, .altsetting = 1, .altset_idx = 1, .attributes = UAC_EP_CS_ATTR_FILL_MAX |
PATCH 64/305 USB: serial: cypress_m8: fix interrupt-out transfer length
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 56445eef55cb5904096fed7a73cf87b755dfffc7 upstream.
Fix interrupt-out transfer length which was being set to the transfer-buffer length rather than the size of the outgoing packet.
Note that no slab data was leaked as the whole transfer buffer is always cleared before each transfer.
--- drivers/usb/serial/cypress_m8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/cypress_m8.c +1 -1
@@ -773,7 +773,7 @@ send:usb_fill_int_urb (port->interrupt_out_urb, port->serial->dev,usb_sndintpipe (port->serial->dev, port->interrupt_out_endpointAddress), - port->interrupt_out_buffer, port->interrupt_out_size, + port->interrupt_out_buffer, actual_size, cypress_write_int_callback, port, priv->write_urb_interval); result =usb_submit_urb (port->interrupt_out_urb,GFP_ATOMIC );if (result) {
PATCH 65/305 printk: Fix panic caused by passing log_buf_len to command line
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: He Zhe <[email protected]>
commit 277fcdb2cfee38ccdbe07e705dbd4896ba0c9930 upstream.
log_buf_len_setup does not check input argument before passing it to simple_strtoull. The argument would be a NULL pointer if "log_buf_len", without its value, is set in command line and thus causes the following panic.
PANIC: early exception 0xe3 IP 10:ffffffffaaeacd0d error 0 cr2 0x0
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.0-rc4-yocto-standard+ #1 [ 0.000000] RIP: 0010:_parse_integer_fixup_radix+0xd/0x70 ... [ 0.000000] Call Trace: [ 0.000000] simple_strtoull+0x29/0x70 [ 0.000000] memparse+0x26/0x90 [ 0.000000] log_buf_len_setup+0x17/0x22 [ 0.000000] do_early_param+0x57/0x8e [ 0.000000] parse_args+0x208/0x320 [ 0.000000] ? rdinit_setup+0x30/0x30 [ 0.000000] parse_early_options+0x29/0x2d [ 0.000000] ? rdinit_setup+0x30/0x30 [ 0.000000] parse_early_param+0x36/0x4d [ 0.000000] setup_arch+0x336/0x99e [ 0.000000] start_kernel+0x6f/0x4ee [ 0.000000] x86_64_start_reservations+0x24/0x26 [ 0.000000] x86_64_start_kernel+0x6f/0x72 [ 0.000000] secondary_startup_64+0xa4/0xb0
This patch adds a check to prevent the panic.
--- kernel/printk/printk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/printk/printk.c +6 -1
@@ -837,7 +837,12 @@ static unsigned long __initdata new_log_/* save requested log_buf_len since it's too early to process it */ static int __init log_buf_len_setup (char *str) { -unsigned size =memparse (str, &str); +unsigned int size; + +if (!str) +return -EINVAL ; + + size =memparse (str, &str);if (size) size =roundup_pow_of_two (size);
PATCH 66/305 mach64: fix display corruption on big endian machines
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 3c6c6a7878d00a3ac997a779c5b9861ff25dfcc8 upstream.
The code for manual bit triple is not endian-clean. It builds the variable "hostdword" using byte accesses, therefore we must read the variable with "le32_to_cpu".
The patch also enables (hardware or software) bit triple only if the image is monochrome (image->depth). If we want to blit full-color image, we shouldn't use the triple code.
--- drivers/video/fbdev/aty/mach64_accel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/fbdev/aty/mach64_accel.c +3 -3
@@ -344,7 +344,7 @@ void atyfb_imageblit(struct fb_info *inf* since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit * this hwaccelerated triple has an issue with not aligned data */ -if (M64_HAS (HW_TRIPLE ) && image->width %8 ==0 ) +if (image->depth ==1 &&M64_HAS (HW_TRIPLE ) && image->width %8 ==0 ) pix_width |=DP_HOST_TRIPLE_EN ; }
@@ -381,7 +381,7 @@ void atyfb_imageblit(struct fb_info *inf src_bytes = (((image->width * image->depth) +7 ) /8 ) * image->height;/* manual triple each pixel */ -if (info->var.bits_per_pixel ==24 && !(pix_width &DP_HOST_TRIPLE_EN )) { +if (image->depth ==1 && info->var.bits_per_pixel ==24 && !(pix_width &DP_HOST_TRIPLE_EN )) {int inbit, outbit, mult24, byte_id_in_dword, width;u8 *pbitmapin = (u8 *)image->data, *pbitmapout;u32 hostdword;
@@ -414,7 +414,7 @@ void atyfb_imageblit(struct fb_info *inf } }wait_for_fifo (1 , par); -aty_st_le32 (HOST_DATA0 , hostdword, par); +aty_st_le32 (HOST_DATA0 ,le32_to_cpu (hostdword), par); } }else {u32 *pbitmap, dwords = (src_bytes +3 ) /4 ;
PATCH 67/305 mach64: fix image corruption due to reading accelerator registers
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit c09bcc91bb94ed91f1391bffcbe294963d605732 upstream.
Reading the registers without waiting for engine idle returns unpredictable values. These unpredictable values result in display corruption - if atyfb_imageblit reads the content of DP_PIX_WIDTH with the bit DP_HOST_TRIPLE_EN set (from previous invocation), the driver would never ever clear the bit, resulting in display corruption.
We don't want to wait for idle because it would degrade performance, so this patch modifies the driver so that it never reads accelerator registers.
HOST_CNTL doesn't have to be read, we can just write it with HOST_BYTE_ALIGN because no other part of the driver cares if HOST_BYTE_ALIGN is set.
DP_PIX_WIDTH is written in the functions atyfb_copyarea and atyfb_fillrect with the default value and in atyfb_imageblit with the value set according to the source image data.
--- drivers/video/fbdev/aty/mach64_accel.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
drivers/video/fbdev/aty/mach64_accel.c +9 -13
@@ -126,7 +126,7 @@ void aty_init_engine(struct atyfb_par *p/* set host attributes */ wait_for_fifo (13 , par); -aty_st_le32 (HOST_CNTL ,0 , par); +aty_st_le32 (HOST_CNTL ,HOST_BYTE_ALIGN , par);/* set pattern attributes */ aty_st_le32 (PAT_REG0 ,0 , par);
@@ -232,7 +232,8 @@ void atyfb_copyarea(struct fb_info *info rotation =rotation24bpp (dx, direction); } -wait_for_fifo (4 , par); +wait_for_fifo (5 , par); +aty_st_le32 (DP_PIX_WIDTH , par->crtc.dp_pix_width, par);aty_st_le32 (DP_SRC ,FRGD_SRC_BLIT , par);aty_st_le32 (SRC_Y_X , (sx <<16 ) | sy, par);aty_st_le32 (SRC_HEIGHT1_WIDTH1 , (width <<16 ) | area->height, par);
@@ -268,7 +269,8 @@ void atyfb_fillrect(struct fb_info *info rotation =rotation24bpp (dx,DST_X_LEFT_TO_RIGHT ); } -wait_for_fifo (3 , par); +wait_for_fifo (4 , par); +aty_st_le32 (DP_PIX_WIDTH , par->crtc.dp_pix_width, par);aty_st_le32 (DP_FRGD_CLR , color, par); aty_st_le32(DP_SRC, BKGD_SRC_BKGD_CLR | FRGD_SRC_FRGD_CLR | MONO_SRC_ONE,
@@ -283,7 +285,7 @@ void atyfb_imageblit(struct fb_info *inf {struct atyfb_par *par = (struct atyfb_par *) info->par;u32 src_bytes, dx = image->dx, dy = image->dy, width = image->width; -u32 pix_width_save, pix_width, host_cntl, rotation =0 , src, mix; +u32 pix_width, rotation =0 , src, mix;if (par->asleep)return ;
@@ -295,8 +297,7 @@ void atyfb_imageblit(struct fb_info *infreturn ; } - pix_width = pix_width_save =aty_ld_le32 (DP_PIX_WIDTH , par); - host_cntl =aty_ld_le32 (HOST_CNTL , par) |HOST_BYTE_ALIGN ; + pix_width = par->crtc.dp_pix_width;switch (image->depth) {case 1 :
@@ -369,12 +370,11 @@ void atyfb_imageblit(struct fb_info *inf mix =FRGD_MIX_D_XOR_S |BKGD_MIX_D ; } -wait_for_fifo (6 , par); -aty_st_le32 (DP_WRITE_MASK ,0xFFFFFFFF , par); +wait_for_fifo (5 , par);aty_st_le32 (DP_PIX_WIDTH , pix_width, par);aty_st_le32 (DP_MIX , mix, par);aty_st_le32 (DP_SRC , src, par); -aty_st_le32 (HOST_CNTL , host_cntl, par); +aty_st_le32 (HOST_CNTL ,HOST_BYTE_ALIGN , par);aty_st_le32 (DST_CNTL ,DST_Y_TOP_TO_BOTTOM |DST_X_LEFT_TO_RIGHT | rotation, par);draw_rect (dx, dy, width, image->height, par);
@@ -423,8 +423,4 @@ void atyfb_imageblit(struct fb_info *infaty_st_le32 (HOST_DATA0 ,get_unaligned_le32 (pbitmap), par); } } - -/* restore pix_width */ -wait_for_fifo (1 , par); -aty_st_le32 (DP_PIX_WIDTH , pix_width_save, par); }
PATCH 68/305 bcache: fix wrong cache_misses statistics
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "tang.junhui" <[email protected]>
commit c157313791a999646901b3e3c6888514ebc36d62 upstream.
Currently, Cache missed IOs are identified by s->cache_miss, but actually, there are many situations that missed IOs are not assigned a value for s->cache_miss in cached_dev_cache_miss(), for example, a bypassed IO (s->iop.bypass = 1), or the cache_bio allocate failed. In these situations, it will go to out_put or out_submit, and s->cache_miss is null, which leads bch_mark_cache_accounting() to treat this IO as a hit IO.
[ML: applied by 3-way merge]
--- drivers/md/bcache/request.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/md/bcache/request.c +5 -1
@@ -462,6 +462,7 @@ struct search { unsigned recoverable:1; unsigned write:1; unsigned read_dirty_data:1; + unsigned cache_missed:1;unsigned long start_time;
@@ -651,6 +652,7 @@ static inline struct search *search_allo s->orig_bio = bio; s->cache_miss =NULL ; + s->cache_missed =0 ; s->d = d; s->recoverable =1 ; s->write = (bio->bi_rw &REQ_WRITE ) !=0 ;
@@ -774,7 +776,7 @@ static void cached_dev_read_done_bh(stru struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);bch_mark_cache_accounting (s->iop.c, s->d, - !s->cache_miss, s->iop.bypass); + !s->cache_missed, s->iop.bypass);trace_bcache_read (s->orig_bio, !s->cache_miss, s->iop.bypass);if (s->iop.error)
@@ -793,6 +795,8 @@ static int cached_dev_cache_miss(struct struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);struct bio *miss, *cache_bio; + s->cache_missed =1 ; +if (s->cache_miss || s->iop.bypass) { miss =bio_next_split (bio, sectors,GFP_NOIO , s->d->bio_split); ret = miss == bio ?MAP_DONE :MAP_CONTINUE ;
PATCH 69/305 bcache: fix miss key refill->end in writeback
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tang Junhui <[email protected]>
commit 2d6cb6edd2c7fb4f40998895bda45006281b1ac5 upstream.
refill->end record the last key of writeback, for example, at the first time, keys (1,128K) to (1,1024K) are flush to the backend device, but the end key (1,1024K) is not included, since the bellow code:
if (bkey_cmp(k, refill->end) >= 0) {
ret = MAP_DONE;
goto out;
}And in the next time when we refill writeback keybuf again, we searched key start from (1,1024K), and got a key bigger than it, so the key (1,1024K) missed.
This patch modify the above code, and let the end key to be included to the writeback key buffer.
--- drivers/md/bcache/btree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/btree.c +1 -1
@@ -2354,7 +2354,7 @@ static int refill_keybuf_fn(struct btreestruct keybuf *buf = refill->buf;int ret =MAP_CONTINUE ; -if (bkey_cmp (k, refill->end) >=0 ) { +if (bkey_cmp (k, refill->end) >0 ) { ret =MAP_DONE ; goto out; }
PATCH 70/305 mtd: spi-nor: fsl-quadspi: fix api naming typo _init_ahb_read
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yogesh Gaur <[email protected]>
commit dd50a1c4e56d6d2ea753f87a35b1f1e09cb877d7 upstream.
Fix api naming typo _init_ahb_read fsl_qspi_init_abh_read --> fsl_qspi_init_ahb_read
--- drivers/mtd/spi-nor/fsl-quadspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/fsl-quadspi.c +2 -2
@@ -574,7 +574,7 @@ static void fsl_qspi_set_map_addr(struct* causes the controller to clear the buffer, and use the sequence pointed * by the QUADSPI_BFGENCR[SEQID] to initiate a read from the flash. */ -static void fsl_qspi_init_abh_read (struct fsl_qspi *q) +static void fsl_qspi_init_ahb_read (struct fsl_qspi *q) {void __iomem *base = q->iobase;int seqid;
@@ -647,7 +647,7 @@ static int fsl_qspi_nor_setup_last(strucfsl_qspi_init_lut (q);/* Init for AHB read */ -fsl_qspi_init_abh_read (q); +fsl_qspi_init_ahb_read (q);return 0 ; }
PATCH 71/305 mtd: spi-nor: fsl-quadspi: Don't let -EINVAL on the bus
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ahmad Fatoum <[email protected]>
commit 000412276370a9bcfec73b3752ceefd9a927f1db upstream.
fsl_qspi_get_seqid() may return -EINVAL, but fsl_qspi_init_ahb_read() doesn't check for error codes with the result that -EINVAL could find itself signalled over the bus.
In conjunction with the LS1046A SoC's A-009283 errata ("Illegal accesses to SPI flash memory can result in a system hang") this illegal access to SPI flash memory results in a system hang if userspace attempts reading later on.
Avoid this by always checking fsl_qspi_get_seqid()'s return value and bail out otherwise.
--- drivers/mtd/spi-nor/fsl-quadspi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/mtd/spi-nor/fsl-quadspi.c +10 -4
@@ -451,6 +451,9 @@ fsl_qspi_runcmd(struct fsl_qspi *q, u8 c/* trigger the LUT now */ seqid =fsl_qspi_get_seqid (q, cmd); +if (seqid <0 ) +return seqid; +writel ((seqid <<QUADSPI_IPCR_SEQID_SHIFT ) | len, base +QUADSPI_IPCR );/* Wait for the interrupt. */
@@ -574,7 +577,7 @@ static void fsl_qspi_set_map_addr(struct* causes the controller to clear the buffer, and use the sequence pointed * by the QUADSPI_BFGENCR[SEQID] to initiate a read from the flash. */ -static void fsl_qspi_init_ahb_read (struct fsl_qspi *q) +static int fsl_qspi_init_ahb_read (struct fsl_qspi *q) {void __iomem *base = q->iobase;int seqid;
@@ -592,8 +595,13 @@ static void fsl_qspi_init_ahb_read(struc/* Set the default lut sequence for AHB Read. */ seqid =fsl_qspi_get_seqid (q, q->nor[0 ].read_opcode); +if (seqid <0 ) +return seqid; +writel (seqid <<QUADSPI_BFGENCR_SEQID_SHIFT , q->iobase +QUADSPI_BFGENCR ); + +return 0 ; }/* We use this function to do some basic init for spi_nor_scan(). */
@@ -647,9 +655,7 @@ static int fsl_qspi_nor_setup_last(strucfsl_qspi_init_lut (q);/* Init for AHB read */ -fsl_qspi_init_ahb_read (q); - -return 0 ; +return fsl_qspi_init_ahb_read (q); }static struct of_device_id fsl_qspi_dt_ids[] = {
PATCH 72/305 media: cx231xx: fix potential sign-extension overflow on large shift
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 32ae592036d7aeaabcccb2b1715373a68639a768 upstream.
Shifting the u8 value[3] by an int can lead to sign-extension overflow. For example, if value[3] is 0xff and the shift is 24 then it is promoted to int and then the top bit is sign-extended so that all upper 32 bits are set. Fix this by casting value[3] to a u32 before the shift.
Detected by CoverityScan, CID#1016522 ("Unintended sign extension")
--- drivers/media/usb/cx231xx/cx231xx-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/cx231xx/cx231xx-video.c +1 -1
@@ -1271,7 +1271,7 @@ int cx231xx_g_register(struct file *file ret =cx231xx_read_ctrl_reg (dev,VRT_GET_REGISTER , (u16 )reg->reg, value,4 ); reg->val = value[0 ] | value[1 ] <<8 | - value[2 ] <<16 | value[3 ] <<24 ; + value[2 ] <<16 | (u32 )value[3 ] <<24 ; reg->size =4 ;break ;case 1 :/* AFE - read byte */
PATCH 73/305 staging: comedi: ni_mio_common: protect register write overflow
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Spencer E. Olson" <[email protected]>
commit 1cbca5852d6c16e85a21487a15d211195aacd4a1 upstream.
Fixes two problems introduced as early as
commit 03aef4b6dc12 ("Staging: comedi: add ni_mio_common code"):
(1) Ensures that the last four bits of NISTC_RTSI_TRIGB_OUT_REG register is not unduly overwritten on e-series devices. On e-series devices, the first three of the last four bits are reserved. The last bit defines the output selection of the RGOUT0 pin, otherwise known as RTSI_Sub_Selection. For m-series devices, these last four bits are indeed used as the output selection of the RTSI7 pin (and the RTSI_Sub_Selection bit for the RGOUT0 pin is moved to the RTSI_Trig_Direction register.
(2) Allows all 4 RTSI_BRD lines to be treated as valid sources for RTSI lines.
This patch also cleans up the ni_get_rtsi_routing command for readability.
[bwh: Backported to 3.16:
- Use NI_RTSI_OUTPUT_RTSI_BRD_0 + n instead of NI_RTSI_OUTPUT_RTSI_BRD(n)
- Use num_configurable_rtsi_channels() instead of NISTC_RTSI_TRIG_NUM_CHAN()
- Use old_RTSI_clock_channel instead of NISTC_RTSI_TRIG_OLD_CLK_CHAN
- Adjust context]
--- .../staging/comedi/drivers/ni_mio_common.c | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/staging/comedi/drivers/ni_mio_common.c +16 -6
@@ -5486,6 +5486,9 @@ static int ni_valid_rtsi_output_source(scase NI_RTSI_OUTPUT_G_GATE0 :case NI_RTSI_OUTPUT_RGOUT0 :case NI_RTSI_OUTPUT_RTSI_BRD_0 : +case NI_RTSI_OUTPUT_RTSI_BRD_0 +1 : +case NI_RTSI_OUTPUT_RTSI_BRD_0 +2 : +case NI_RTSI_OUTPUT_RTSI_BRD_0 +3 :return 1 ;break ;case NI_RTSI_OUTPUT_RTSI_OSC :
@@ -5513,12 +5516,19 @@ static int ni_set_rtsi_routing(struct coRTSI_Trig_Output_Bits (chan, source); devpriv->stc_writew (dev, devpriv->rtsi_trig_a_output_reg, RTSI_Trig_A_Output_Register); - }else if (chan <8 ) { + }else if (chan <num_configurable_rtsi_channels (dev)) { devpriv->rtsi_trig_b_output_reg &= ~RTSI_Trig_Output_Mask (chan); devpriv->rtsi_trig_b_output_reg |=RTSI_Trig_Output_Bits (chan, source); devpriv->stc_writew (dev, devpriv->rtsi_trig_b_output_reg, RTSI_Trig_B_Output_Register); + }else if (chan != old_RTSI_clock_channel) { +/* probably should never reach this, since the +* ni_valid_rtsi_output_source above errors out if chan is too +* high +*/ +dev_err (dev->class_dev,"%s: unknown rtsi channel\n" , __func__); +return -EINVAL ; }return 2 ; }
@@ -5533,12 +5543,12 @@ static unsigned ni_get_rtsi_routing(stru }else if (chan <num_configurable_rtsi_channels (dev)) {return RTSI_Trig_Output_Source (chan, devpriv->rtsi_trig_b_output_reg); - }else { -if (chan == old_RTSI_clock_channel) -return NI_RTSI_OUTPUT_RTSI_OSC ; -printk ("%s: bug! should never get here?\n" , __func__); -return 0 ; + }else if (chan == old_RTSI_clock_channel) { +return NI_RTSI_OUTPUT_RTSI_OSC ; } + +dev_err (dev->class_dev,"%s: unknown rtsi channel\n" , __func__); +return -EINVAL ; } static int ni_rtsi_insn_config(struct comedi_device *dev,
PATCH 74/305 ima: fix showing large 'violations' or 'runtime_measurements_count'
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 1e4c8dafbb6bf72fb5eca035b861e39c5896c2b7 upstream.
The 12 character temporary buffer is not necessarily long enough to hold a 'long' value. Increase it.
--- security/integrity/ima/ima_fs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
security/integrity/ima/ima_fs.c +3 -3
@@ -26,14 +26,14 @@#include "ima.h" static int valid_policy =1 ; -#define TMPBUFLEN 12 +static ssize_t ima_show_htable_value (char __user *buf,size_t count,loff_t *ppos,atomic_long_t *val) { -char tmpbuf[TMPBUFLEN ]; +char tmpbuf[32 ];/* greater than largest 'long' string value */ ssize_t len; - len =scnprintf (tmpbuf,TMPBUFLEN ,"%li\n" ,atomic_long_read (val)); + len =scnprintf (tmpbuf,sizeof (tmpbuf),"%li\n" ,atomic_long_read (val));return simple_read_from_buffer (buf, count, ppos, tmpbuf, len); }
PATCH 75/305 PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bin Meng <[email protected]>
commit d0c9606b31a21028fb5b753c8ad79626292accfd upstream.
Add Device IDs to the Intel GPU "spurious interrupt" quirk table.
For these devices, unplugging the VGA cable and plugging it in again causes spurious interrupts from the IGD. Linux eventually disables the interrupt, but of course that disables any other devices sharing the interrupt.
The theory is that this is a VGA BIOS defect: it should have disabled the IGD interrupt but failed to do so.
See f67fd55fa96f ("PCI: Add quirk for still enabled interrupts on Intel Sandy Bridge GPUs") and 7c82126a94e6 ("PCI: Add new ID for Intel GPU "spurious interrupt" quirk") for some history.
[bhelgaas: See link below for discussion about how to fix this more generically instead of adding device IDs for every new Intel GPU. I hope this is the last patch to add device IDs.]
--- drivers/pci/quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/quirks.c +4 -0
@@ -3068,7 +3068,11 @@ static void disable_igfx_irq(struct pci_pci_iounmap (dev, regs); } +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0042 , disable_igfx_irq); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0046 , disable_igfx_irq); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x004a , disable_igfx_irq);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0102 , disable_igfx_irq); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0106 , disable_igfx_irq);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x010a , disable_igfx_irq);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x0152 , disable_igfx_irq);
PATCH 76/305 ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905)
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Cline <[email protected]>
commit e7bb6ad5685f05685dd8a6a5eda7bfcd14d5f95b upstream.
The Lenovo G50-30, like other G50 models, has a Conexant codec that requires a quirk for its inverted stereo dmic.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1249364
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -3465,6 +3465,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x17aa ,0x21da ,"Lenovo X220" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21db ,"Lenovo X220-tablet" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x38af ,"Lenovo IdeaPad Z560" ,CXT_FIXUP_MUTE_LED_EAPD ), +SND_PCI_QUIRK (0x17aa ,0x3905 ,"Lenovo G50-30" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3975 ,"Lenovo U300s" ,CXT_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
PATCH 77/305 ext4: fix use-after-free race in ext4_remount()'s error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 33458eaba4dfe778a426df6a19b7aad2ff9f7eec upstream.
It's possible for ext4_show_quota_options() to try reading s_qf_names[i] while it is being modified by ext4_remount() --- most notably, in ext4_remount's error path when the original values of the quota file name gets restored.
[bwh: Backported to 3.16:
- s/EXT4_MAXQUOTAS/MAXQUOTAS/
- Adjust context]
---
fs/ext4/ext4.h +2 -1
@@ -1300,7 +1300,8 @@ struct ext4_sb_info {u32 s_min_batch_time;struct block_device *journal_bdev;#ifdef CONFIG_QUOTA -char *s_qf_names[MAXQUOTAS ];/* Names of quota files with journalled quota */ +/* Names of quota files with journalled quota */ +char __rcu *s_qf_names[MAXQUOTAS ];int s_jquota_fmt;/* Format of quota to use */ #endif unsigned int s_want_extra_isize;/* New inodes should reserve # bytes */
fs/ext4/super.c +50 -25
169 lines not on this page · raw message
PATCH 78/305 gfs2_meta: ->mount() can get NULL dev_name
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 3df629d873f8683af6f0d34dfc743f637966d483 upstream.
get in sync with mount_bdev() handling of the same
--- fs/gfs2/ops_fstype.c | 3 +++ 1 file changed, 3 insertions(+)
fs/gfs2/ops_fstype.c +3 -0
@@ -1365,6 +1365,9 @@ static struct dentry *gfs2_mount_meta(ststruct path path;int error; +if (!dev_name || !*dev_name) +return ERR_PTR (-EINVAL ); + error =kern_path (dev_name,LOOKUP_FOLLOW , &path);if (error) { pr_warn("path_lookup on %s returned error %d\n",
PATCH 79/305 iwlwifi: mvm: check return value of rs_rate_from_ucode_rate()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Luca Coelho <[email protected]>
commit 3d71c3f1f50cf309bd20659422af549bc784bfff upstream.
The rs_rate_from_ucode_rate() function may return -EINVAL if the rate is invalid, but none of the callsites check for the error, potentially making us access arrays with index IWL_RATE_INVALID, which is larger than the arrays, causing an out-of-bounds access. This will trigger KASAN warnings, such as the one reported in the bugzilla issue mentioned below.
This fixes https://bugzilla.kernel.org/show_bug.cgi?id=200659
[bwh: Backported to 3.16:
- Fix up one additional caller
- Adjust filename, context
---
drivers/net/wireless/iwlwifi/mvm/rs.c +23 -6
@@ -1057,7 +1057,10 @@ static void rs_tx_status(void *mvm_r, st*/ table = &lq_sta->lq; ucode_rate =le32_to_cpu (table->rs_table[0 ]); -rs_rate_from_ucode_rate (ucode_rate, info->band, &rate); +if (rs_rate_from_ucode_rate (ucode_rate, info->band, &rate)) { +WARN_ON_ONCE (1 ); +return ; + }if (info->band ==IEEE80211_BAND_5GHZ ) rate.index -=IWL_FIRST_OFDM_RATE ; mac_flags = info->status.rates[0 ].flags;
@@ -1161,7 +1164,10 @@ static void rs_tx_status(void *mvm_r, st*/ if (info->flags &IEEE80211_TX_STAT_AMPDU ) { ucode_rate =le32_to_cpu (table->rs_table[0 ]); -rs_rate_from_ucode_rate (ucode_rate, info->band, &rate); +if (rs_rate_from_ucode_rate (ucode_rate, info->band, &rate)) { +WARN_ON_ONCE (1 ); +return ; + } rs_collect_tx_data(lq_sta, curr_tbl, rate.index, info->status.ampdu_len, info->status.ampdu_ack_len,
@@ -1186,7 +1192,12 @@ static void rs_tx_status(void *mvm_r, st/* Collect data for each rate used during failed TX attempts */ for (i =0 ; i <= retries; ++i) { ucode_rate =le32_to_cpu (table->rs_table[i]); -rs_rate_from_ucode_rate (ucode_rate, info->band, &rate); +if (rs_rate_from_ucode_rate (ucode_rate, info->band, + &rate)) { +WARN_ON_ONCE (1 ); +return ; + } +/* * Only collect stats if retried rate is in the same RS * table as active/search.
@@ -2677,7 +2688,10 @@ static void rs_build_rates_table_from_fifor (i =0 ; i < num_rates; i++) lq_cmd->rs_table[i] = ucode_rate_le32; -rs_rate_from_ucode_rate (ucode_rate, band, &rate); +if (rs_rate_from_ucode_rate (ucode_rate, band, &rate)) { +WARN_ON_ONCE (1 ); +return ; + }if (is_mimo (&rate)) lq_cmd->mimo_delim = num_rates -1 ;
@@ -2928,8 +2942,11 @@ static void rs_program_fix_rate(struct iif (lq_sta->dbg_fixed_rate) {struct rs_rate rate; -rs_rate_from_ucode_rate (lq_sta->dbg_fixed_rate, - lq_sta->band, &rate); +if (rs_rate_from_ucode_rate (lq_sta->dbg_fixed_rate, + lq_sta->band, &rate)) { +WARN_ON_ONCE (1 ); +return ; + }rs_fill_lq_cmd (mvm,NULL , lq_sta, &rate);iwl_mvm_send_lq_cmd (lq_sta->drv, &lq_sta->lq, false); }
PATCH 80/305 libertas: don't set URB_ZERO_PACKET on IN USB transfer
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lubomir Rintel <[email protected]>
commit 6528d88047801b80d2a5370ad46fb6eff2f509e0 upstream.
The USB core gets rightfully upset:
usb 1-1: BOGUS urb flags, 240 --> 200
WARNING: CPU: 0 PID: 60 at drivers/usb/core/urb.c:503 usb_submit_urb+0x2f8/0x3ed Modules linked in: CPU: 0 PID: 60 Comm: kworker/0:3 Not tainted 4.19.0-rc6-00319-g5206d00a45c7 #39 Hardware name: OLPC XO/XO, BIOS OLPC Ver 1.00.01 06/11/2014 Workqueue: events request_firmware_work_func EIP: usb_submit_urb+0x2f8/0x3ed Code: 75 06 8b 8f 80 00 00 00 8d 47 78 89 4d e4 89 55 e8 e8 35 1c f6 ff 8b 55 e8 56 52 8b 4d e4 51 50 68 e3 ce c7 c0 e8 ed 18 c6 ff <0f> 0b 83 c4 14 80 7d ef 01 74 0a 80 7d ef 03 0f 85 b8 00 00 00 8b EAX: 00000025 EBX: ce7d4980 ECX: 00000000 EDX: 00000001 ESI: 00000200 EDI: ce7d8800 EBP: ce7f5ea8 ESP: ce7f5e70 DS: 007b ES: 007b FS: 0000 GS: 00e0 SS: 0068 EFLAGS: 00210292 CR0: 80050033 CR2: 00000000 CR3: 00e80000 CR4: 00000090 Call Trace: ? if_usb_fw_timeo+0x64/0x64 __if_usb_submit_rx_urb+0x85/0xe6 ? if_usb_fw_timeo+0x64/0x64 if_usb_submit_rx_urb_fwload+0xd/0xf if_usb_prog_firmware+0xc0/0x3db ? _request_firmware+0x54/0x47b ? _request_firmware+0x89/0x47b ? if_usb_probe+0x412/0x412 lbs_fw_loaded+0x55/0xa6 ? debug_smp_processor_id+0x12/0x14 helper_firmware_cb+0x3c/0x3f request_firmware_work_func+0x37/0x6f process_one_work+0x164/0x25a worker_thread+0x1c4/0x284 kthread+0xec/0xf1 ? cancel_delayed_work_sync+0xf/0xf ? kthread_create_on_node+0x1a/0x1a ret_from_fork+0x2e/0x38 ---[ end trace 3ef1e3b2dd53852f ]---
--- drivers/net/wireless/libertas/if_usb.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/libertas/if_usb.c +0 -2
@@ -467,8 +467,6 @@ static int __if_usb_submit_rx_urb(structMRVDRV_ETH_RX_PACKET_BUFFER_SIZE , callbackfn, cardp); - cardp->rx_urb->transfer_flags |=URB_ZERO_PACKET ; -lbs_deb_usb2 (&cardp->udev->dev,"Pointer for rx_urb %p\n" , cardp->rx_urb);if ((ret =usb_submit_urb (cardp->rx_urb,GFP_ATOMIC ))) {lbs_deb_usbd (&cardp->udev->dev,"Submit Rx URB failed: %d\n" , ret);
PATCH 81/305 spi: sh-msiof: fix deferred probing
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Shtylyov <[email protected]>
commit f34c6e6257aa477cdfe7e9bbbecd3c5648ecda69 upstream.
Since commit 9ec36cafe43b ("of/irq: do irq resolution in platform_get_irq") platform_get_irq() can return -EPROBE_DEFER. However, the driver overrides an error returned by that function with -ENOENT which breaks the deferred probing. Propagate upstream an error code returned by platform_get_irq() and remove the bogus "platform" from the error message, while at it...
--- drivers/spi/spi-sh-msiof.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-sh-msiof.c +2 -2
@@ -766,8 +766,8 @@ static int sh_msiof_spi_probe(struct pla i =platform_get_irq (pdev,0 );if (i <0 ) { -dev_err (&pdev->dev,"cannot get platform IRQ\n" ); - ret = -ENOENT ; +dev_err (&pdev->dev,"cannot get IRQ\n" ); + ret = i; goto err1; }
PATCH 82/305 btrfs: fix error handling in btrfs_dev_replace_start
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
commit 5c06147128fbbdf7a84232c5f0d808f53153defe upstream.
When we fail to start a transaction in btrfs_dev_replace_start, we leave dev_replace->replace_start set to STARTED but clear ->srcdev and ->tgtdev. Later, that can result in an Oops in btrfs_dev_replace_progress when having state set to STARTED or SUSPENDED implies that ->srcdev is valid.
Also fix error handling when the state is already STARTED or SUSPENDED while starting. That, too, will clear ->srcdev and ->tgtdev even though it doesn't own them. This should be an impossible case to hit since we should be protected by the BTRFS_FS_EXCL_OP bit being set. Let's add an ASSERT there while we're at it.
--- fs/btrfs/dev-replace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/btrfs/dev-replace.c +5 -2
@@ -362,6 +362,7 @@ int btrfs_dev_replace_start(struct btrfsbreak ;case BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED :case BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED : +ASSERT (0 ); args->result =BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED ; goto leave; }
@@ -406,6 +407,10 @@ int btrfs_dev_replace_start(struct btrfsif (IS_ERR (trans)) { ret =PTR_ERR (trans);btrfs_dev_replace_lock (dev_replace); + dev_replace->replace_state = +BTRFS_IOCTL_DEV_REPLACE_STATE_NEVER_STARTED ; + dev_replace->srcdev =NULL ; + dev_replace->tgtdev =NULL ; goto leave; }
@@ -423,8 +428,6 @@ int btrfs_dev_replace_start(struct btrfsreturn 0 ; leave: - dev_replace->srcdev =NULL ; - dev_replace->tgtdev =NULL ;btrfs_dev_replace_unlock (dev_replace); leave_no_lock:if (tgt_device)
PATCH 83/305 btrfs: wait on caching when putting the bg cache
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit 3aa7c7a31c26321696b92841d5103461c6f3f517 upstream.
While testing my backport I noticed there was a panic if I ran generic/416 generic/417 generic/418 all in a row. This just happened to uncover a race where we had outstanding IO after we destroy all of our workqueues, and then we'd go to queue the endio work on those free'd workqueues.
This is because we aren't waiting for the caching threads to be done before freeing everything up, so to fix this make sure we wait on any outstanding caching that's being done before we free up the block group, so we're sure to be done with all IO by the time we get to btrfs_stop_all_workers(). This fixes the panic I was seeing consistently in testing.
------------[ cut here ]------------ kernel BUG at fs/btrfs/volumes.c:6112! SMP PTI Modules linked in: CPU: 1 PID: 27165 Comm: kworker/u4:7 Not tainted 4.16.0-02155-g3553e54a578d-dirty #875 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014 Workqueue: btrfs-cache btrfs_cache_helper RIP: 0010:btrfs_map_bio+0x346/0x370 RSP: 0000:ffffc900061e79d0 EFLAGS: 00010202 RAX: 0000000000000000 RBX: ffff880071542e00 RCX: 0000000000533000 RDX: ffff88006bb74380 RSI: 0000000000000008 RDI: ffff880078160000 RBP: 0000000000000001 R08: ffff8800781cd200 R09: 0000000000503000 R10: ffff88006cd21200 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: ffff8800781cd200 R15: ffff880071542e00 FS: 0000000000000000(0000) GS:ffff88007fd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000817ffc4 CR3: 0000000078314000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: btree_submit_bio_hook+0x8a/0xd0 submit_one_bio+0x5d/0x80 read_extent_buffer_pages+0x18a/0x320 btree_read_extent_buffer_pages+0xbc/0x200 ? alloc_extent_buffer+0x359/0x3e0 read_tree_block+0x3d/0x60 read_block_for_search.isra.30+0x1a5/0x360 btrfs_search_slot+0x41b/0xa10 btrfs_next_old_leaf+0x212/0x470 caching_thread+0x323/0x490 normal_work_helper+0xc5/0x310 process_one_work+0x141/0x340 worker_thread+0x44/0x3c0 kthread+0xf8/0x130 ? process_one_work+0x340/0x340 ? kthread_bind+0x10/0x10 ret_from_fork+0x35/0x40 RIP: btrfs_map_bio+0x346/0x370 RSP: ffffc900061e79d0 ---[ end trace 827eb13e50846033 ]--- Kernel panic - not syncing: Fatal exception Kernel Offset: disabled ---[ end Kernel panic - not syncing: Fatal exception
--- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/extent-tree.c +1 -0
@@ -8590,6 +8590,7 @@ void btrfs_put_block_group_cache(struct block_group =btrfs_lookup_first_block_group (info, last);while (block_group) { +wait_block_group_cache_done (block_group);spin_lock (&block_group->lock);if (block_group->iref)break ;
PATCH 84/305 Btrfs: don't clean dirty pages during buffered writes
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit 7703bdd8d23e6ef057af3253958a793ec6066b28 upstream.
During buffered writes, we follow this basic series of steps:
again:
lock all the pages
wait for writeback on all the pages Take the extent range lock
wait for ordered extents on the whole range clean all the pages
if (copy_from_user_in_atomic() hits a fault) {
drop our locks
goto again;
}
dirty all the pages
release all the locks
The extra waiting, cleaning and locking are there to make sure we don't modify pages in flight to the drive, after they've been crc'd.
If some of the pages in the range were already dirty when the write began, and we need to goto again, we create a window where a dirty page has been cleaned and unlocked. It may be reclaimed before we're able to lock it again, which means we'll read the old contents off the drive and lose any modifications that had been pending writeback.
We don't actually need to clean the pages. All of the other locking in place makes sure we don't start IO on the pages, so we can just leave them dirty for the duration of the write.
[bwh: Backported to 3.16:
- Keep passing additional argument of GFP_NOFS to clear_extent_bit()
- Adjust context]
---
fs/btrfs/file.c +24 -6
@@ -506,6 +506,16 @@ int btrfs_dirty_pages(struct btrfs_root num_bytes =ALIGN (write_bytes + pos - start_pos, root->sectorsize); end_of_last_block = start_pos + num_bytes -1 ; + +/* +* The pages may have already been dirty, clear out old accounting so +* we can set things up properly +*/ +clear_extent_bit (&BTRFS_I (inode)->io_tree, start_pos, end_of_last_block, +EXTENT_DIRTY |EXTENT_DELALLOC | +EXTENT_DO_ACCOUNTING |EXTENT_DEFRAG ,0 ,0 , cached, +GFP_NOFS ); + err =btrfs_set_extent_delalloc (inode, start_pos, end_of_last_block, cached);if (err)
@@ -1408,18 +1418,26 @@ lock_and_cleanup_extent_if_need(struct iif (ordered)btrfs_put_ordered_extent (ordered); -clear_extent_bit (&BTRFS_I (inode)->io_tree, start_pos, - last_pos,EXTENT_DIRTY |EXTENT_DELALLOC | -EXTENT_DO_ACCOUNTING |EXTENT_DEFRAG , -0 ,0 , cached_state,GFP_NOFS ); *lockstart = start_pos; *lockend = last_pos; ret =1 ; } +/* +* It's possible the pages are dirty right now, but we don't want +* to clean them yet because copy_from_user may catch a page fault +* and we might have to fall back to one page at a time. If that +* happens, we'll unlock these pages and we'd have a window where +* reclaim could sneak in and drop the once-dirty page on the floor +* without writing it. +* +* We have the pages locked and the extent range locked, so there's +* no way someone can start IO on any dirty pages in this range. +* +* We'll call btrfs_dirty_pages() later on, and that will flip around +* delalloc bits and dirty the pages as required. +*/ for (i =0 ; i < num_pages; i++) { -if (clear_page_dirty_for_io (pages[i])) -account_page_redirty (pages[i]);set_page_extent_mapped (pages[i]);WARN_ON (!PageLocked (pages[i])); }
PATCH 85/305 hwmon: (pmbus) Fix page count auto-detection.
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Bazhenov <[email protected]>
commit e7c6a55606b5c46b449d76588968b4d8caae903f upstream.
Devices with compatible="pmbus" field have zero initial page count, and pmbus_clear_faults() being called before the page count auto- detection does not actually clear faults because it depends on the page count. Non-cleared faults in its turn may fail the subsequent page count auto-detection.
This patch fixes this problem by calling pmbus_clear_fault_page() for currently set page and calling pmbus_clear_faults() after the page count was detected.
--- drivers/hwmon/pmbus/pmbus.c | 2 ++ drivers/hwmon/pmbus/pmbus_core.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus.c +2 -0
@@ -117,6 +117,8 @@ static int pmbus_identify(struct i2c_cli }else { info->pages =1 ; } + +pmbus_clear_faults (client); }if (pmbus_check_byte_register (client,0 ,PMBUS_VOUT_MODE )) {
drivers/hwmon/pmbus/pmbus_core.c +4 -1
@@ -1705,7 +1705,10 @@ static int pmbus_init_common(struct i2c_ } } -pmbus_clear_faults (client); +if (data->info->pages) +pmbus_clear_faults (client); +else +pmbus_clear_fault_page (client,-1 );if (info->identify) { ret = (*info->identify)(client, info);
PATCH 86/305 tun: Consistently configure generic netdev params via rtnetlink
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Serhey Popovych <[email protected]>
commit df52eab23d703142c766ac00bdb8db19d71238d0 upstream.
Configuring generic network device parameters on tun will fail in presence of IFLA_INFO_KIND attribute in IFLA_LINKINFO nested attribute since tun_validate() always return failure.
This can be visualized with following ip-link(8) command sequences:
# ip link set dev tun0 group 100 # ip link set dev tun0 group 100 type tun RTNETLINK answers: Invalid argument
with contrast to dummy and veth drivers:
# ip link set dev dummy0 group 100 # ip link set dev dummy0 type dummy
# ip link set dev veth0 group 100 # ip link set dev veth0 group 100 type veth
Fix by returning zero in tun_validate() when @data is NULL that is always in case since rtnl_link_ops->maxtype is zero in tun driver.
--- drivers/net/tun.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/tun.c +2 -0
@@ -1415,6 +1415,8 @@ static void tun_setup(struct net_device*/ static int tun_validate (struct nlattr *tb[],struct nlattr *data[]) { +if (!data) +return 0 ;return -EINVAL ; }
PATCH 87/305 jffs2: free jffs2_sb_info through jffs2_kill_sb()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 92e2921f7eee63450a5f953f4b15dc6210219430 upstream.
When an invalid mount option is passed to jffs2, jffs2_parse_options() will fail and jffs2_sb_info will be freed, but then jffs2_sb_info will be used (use-after-free) and freeed (double-free) in jffs2_kill_sb().
Fix it by removing the buggy invocation of kfree() when getting invalid mount options.
--- fs/jffs2/super.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/jffs2/super.c +1 -3
@@ -285,10 +285,8 @@ static int jffs2_fill_super(struct super sb->s_fs_info = c; ret =jffs2_parse_options (c, data); -if (ret) { -kfree (c); +if (ret)return -EINVAL ; - }/* Initialize JFFS2 superblock locks, the further initialization will * be done later */
PATCH 88/305 IB/{cm, umad}: Handle av init error
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
commit 0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f upstream.
cm_init_av_for_response depends on ib_init_ah_from_wc() whose return status is ignored.ib_init_ah_from_wc() can fail and its return status should be handled as done in this patch.
--- drivers/infiniband/core/cm.c | 34 ++++++++++++++++++------------ drivers/infiniband/core/user_mad.c | 10 ++++++--- 2 files changed, 28 insertions(+), 16 deletions(-)
drivers/infiniband/core/cm.c +21 -13
@@ -380,13 +380,13 @@ static void cm_set_private_data(struct c cm_id_priv->private_data_len = private_data_len; } -static void cm_init_av_for_response (struct cm_port *port,struct ib_wc *wc, -struct ib_grh *grh,struct cm_av *av) +static int cm_init_av_for_response (struct cm_port *port,struct ib_wc *wc, +struct ib_grh *grh,struct cm_av *av) { av->port = port; av->pkey_index = wc->pkey_index; -ib_init_ah_from_wc (port->cm_dev->ib_device, port->port_num, wc, - grh, &av->ah_attr); +return ib_init_ah_from_wc (port->cm_dev->ib_device, port->port_num, wc, + grh, &av->ah_attr); } static int cm_init_av_by_path(struct ib_sa_path_rec *path, struct cm_av *av,
@@ -1601,9 +1601,11 @@ static int cm_req_handler(struct cm_work cm_id_priv = container_of(cm_id, struct cm_id_private, id); cm_id_priv->id.remote_id = req_msg->local_comm_id; -cm_init_av_for_response (work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret =cm_init_av_for_response (work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); +if (ret) + goto destroy; cm_id_priv->timewait_info =cm_create_timewait_info (cm_id_priv-> id.local_id);if (IS_ERR (cm_id_priv->timewait_info)) {
@@ -2807,9 +2809,11 @@ static int cm_lap_handler(struct cm_work cm_id_priv->id.lap_state =IB_CM_LAP_RCVD ; cm_id_priv->tid = lap_msg->hdr.tid; -cm_init_av_for_response (work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret =cm_init_av_for_response (work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); +if (ret) + goto unlock;cm_init_av_by_path (param->alternate_path, &cm_id_priv->alt_av, cm_id_priv); ret =atomic_inc_and_test (&cm_id_priv->work_count);
@@ -3060,6 +3064,7 @@ static int cm_sidr_req_handler(struct cmstruct cm_id_private *cm_id_priv, *cur_cm_id_priv;struct cm_sidr_req_msg *sidr_req_msg;struct ib_wc *wc; +int ret; cm_id =ib_create_cm_id (work->port->cm_dev->ib_device,NULL ,NULL );if (IS_ERR (cm_id))
@@ -3072,9 +3077,12 @@ static int cm_sidr_req_handler(struct cm wc = work->mad_recv_wc->wc; cm_id_priv->av.dgid.global.subnet_prefix =cpu_to_be64 (wc->slid); cm_id_priv->av.dgid.global.interface_id =0 ; -cm_init_av_for_response (work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); + ret =cm_init_av_for_response (work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); +if (ret) + goto out; + cm_id_priv->id.remote_id = sidr_req_msg->request_id; cm_id_priv->tid = sidr_req_msg->hdr.tid;atomic_inc (&cm_id_priv->work_count);
drivers/infiniband/core/user_mad.c +7 -3
@@ -234,10 +234,14 @@ static void recv_handler(struct ib_mad_a packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags &IB_WC_GRH );if (packet->mad.hdr.grh_present) {struct ib_ah_attr ah_attr; +int ret; -ib_init_ah_from_wc (agent->device, agent->port_num, - mad_recv_wc->wc, mad_recv_wc->recv_buf.grh, - &ah_attr); + ret =ib_init_ah_from_wc (agent->device, agent->port_num, + mad_recv_wc->wc, + mad_recv_wc->recv_buf.grh, + &ah_attr); +if (ret) + goto err2; packet->mad.hdr.gid_index = ah_attr.grh.sgid_index; packet->mad.hdr.hop_limit = ah_attr.grh.hop_limit;
PATCH 89/305 IB/cm: Fix sleeping while spin lock is held
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
commit 33f93e1ebcf5acfaef06cda2d3e373730519e33e upstream.
In case of LAP are used for RoCE, it can lead to a problem of sleeping a context while spin lock is held in below flow.
cm_lap_handler
->spin_lock -> <..switch_case..> -> cm_init_av_for_response -> ib_init_ah_from_wc -> rdma_addr_find_l2_eth_by_grh wait_for_completion()
Therefore ah attribute initialization is done for incoming lap requests outside of the lock context.
--- drivers/infiniband/core/cm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/infiniband/core/cm.c +6 -5
@@ -2770,6 +2770,12 @@ static int cm_lap_handler(struct cm_workif (!cm_id_priv)return -EINVAL ; + ret =cm_init_av_for_response (work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); +if (ret) + goto deref; + param = &work->cm_event.param.lap_rcvd; param->alternate_path = &work->path[0 ];cm_format_path_from_lap (cm_id_priv, param->alternate_path, lap_msg);
@@ -2809,11 +2815,6 @@ static int cm_lap_handler(struct cm_work cm_id_priv->id.lap_state =IB_CM_LAP_RCVD ; cm_id_priv->tid = lap_msg->hdr.tid; - ret =cm_init_av_for_response (work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); -if (ret) - goto unlock;cm_init_av_by_path (param->alternate_path, &cm_id_priv->alt_av, cm_id_priv); ret =atomic_inc_and_test (&cm_id_priv->work_count);
PATCH 90/305 IB/cm: Avoid AV ah_attr overwriting during LAP message handling
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
commit a5c57d327272bdf3a8b19686eaca2ec683449e67 upstream.
AH attribute of the cm_id can be overwritten if LAP message is received on CM request which is in progress. This bug got introduced to avoid sleeping when spin lock is held as part of commit in Fixes tag.
Therefore validate the cm_id state first and continue to perform AV ah_attr initialization.
Given that Aleternative path related messages are not supported for RoCE, init_av_from_response/path is such messages are ok to be called from blocking context.
--- drivers/infiniband/core/cm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/infiniband/core/cm.c +8 -8
@@ -2770,12 +2770,6 @@ static int cm_lap_handler(struct cm_workif (!cm_id_priv)return -EINVAL ; - ret =cm_init_av_for_response (work->port, work->mad_recv_wc->wc, - work->mad_recv_wc->recv_buf.grh, - &cm_id_priv->av); -if (ret) - goto deref; - param = &work->cm_event.param.lap_rcvd; param->alternate_path = &work->path[0 ];cm_format_path_from_lap (cm_id_priv, param->alternate_path, lap_msg);
@@ -2813,10 +2807,16 @@ static int cm_lap_handler(struct cm_work goto unlock; } - cm_id_priv->id.lap_state =IB_CM_LAP_RCVD ; - cm_id_priv->tid = lap_msg->hdr.tid; + ret =cm_init_av_for_response (work->port, work->mad_recv_wc->wc, + work->mad_recv_wc->recv_buf.grh, + &cm_id_priv->av); +if (ret) + goto unlock; +cm_init_av_by_path (param->alternate_path, &cm_id_priv->alt_av, cm_id_priv); + cm_id_priv->id.lap_state =IB_CM_LAP_RCVD ; + cm_id_priv->tid = lap_msg->hdr.tid; ret =atomic_inc_and_test (&cm_id_priv->work_count);if (!ret)list_add_tail (&work->list, &cm_id_priv->work_list);
PATCH 91/305 RDMA/cm: Respect returned status of cm_init_av_by_path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit e54b6a3bcd1ec972b25a164bdf495d9e7120b107 upstream.
Add missing check for failure of cm_init_av_by_path
[bwh: Backported to 3.16: cm_init_av_by_path() doesn't take an sgid_attr
parameter]
--- drivers/infiniband/core/cm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/core/cm.c +5 -2
@@ -2813,8 +2813,11 @@ static int cm_lap_handler(struct cm_workif (ret) goto unlock; -cm_init_av_by_path (param->alternate_path, &cm_id_priv->alt_av, - cm_id_priv); + ret =cm_init_av_by_path (param->alternate_path, + &cm_id_priv->alt_av, cm_id_priv); +if (ret) + goto unlock; + cm_id_priv->id.lap_state =IB_CM_LAP_RCVD ; cm_id_priv->tid = lap_msg->hdr.tid; ret =atomic_inc_and_test (&cm_id_priv->work_count);
PATCH 92/305 clk: s2mps11: Fix matching when built as module and DT node contains compatible
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 8985167ecf57f97061599a155bb9652c84ea4913 upstream.
When driver is built as module and DT node contains clocks compatible (e.g. "samsung,s2mps11-clk"), the module will not be autoloaded because module aliases won't match.
The modalias from uevent: of:NclocksT<NULL>Csamsung,s2mps11-clk The modalias from driver: platform:s2mps11-clk
The devices are instantiated by parent's MFD. However both Device Tree bindings and parent define the compatible for clocks devices. In case of module matching this DT compatible will be used.
The issue will not happen if this is a built-in (no need for module matching) or when clocks DT node does not contain compatible (not correct from bindings perspective but working for driver).
Note when backporting to stable kernels: adjust the list of device ID entries.
---
drivers/clk/clk-s2mps11.c +27 -0
@@ -296,6 +296,33 @@ static const struct platform_device_id s };MODULE_DEVICE_TABLE (platform, s2mps11_clk_id); +#ifdef CONFIG_OF +/* +* Device is instantiated through parent MFD device and device matching is done +* through platform_device_id. +* +* However if device's DT node contains proper clock compatible and driver is +* built as a module, then the *module* matching will be done trough DT aliases. +* This requires of_device_id table. In the same time this will not change the +* actual *device* matching so do not add .of_match_table. +*/ +static const struct of_device_id s2mps11_dt_match[] = { + { + .compatible ="samsung,s2mps11-clk" , + .data = (void *)S2MPS11X , + }, { + .compatible ="samsung,s2mps14-clk" , + .data = (void *)S2MPS14X , + }, { + .compatible ="samsung,s5m8767-clk" , + .data = (void *)S5M8767X , + }, { +/* Sentinel */ + }, +}; +MODULE_DEVICE_TABLE (of, s2mps11_dt_match); +#endif +static struct platform_driver s2mps11_clk_driver = { .driver = { .name ="s2mps11-clk" ,
PATCH 93/305 KVM: x86: remove code for lazy FPU handling
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Bonzini <[email protected]>
commit bd7e5b0899a429445cc6e3037c13f8b5ae3be903 upstream.
The FPU is always active now when running KVM.
[bwh: Backported to 3.16:
- eagerfpu is still optional (but enabled by default) so disable KVM if eagerfpu is disabled
- Remove one additional use of KVM_REQ_DEACTIVATE_FPU which was removed earlier upstream in commit c592b5734706
"x86/fpu: Remove use_eager_fpu()"
- Adjust context]
---
arch/x86/include/asm/kvm_host.h +0 -2
@@ -711,8 +711,6 @@ struct kvm_x86_ops {void (*cache_reg)(struct kvm_vcpu *vcpu,enum kvm_reg reg);unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);void (*set_rflags)(struct kvm_vcpu *vcpu,unsigned long rflags); -void (*fpu_activate)(struct kvm_vcpu *vcpu); -void (*fpu_deactivate)(struct kvm_vcpu *vcpu);void (*tlb_flush)(struct kvm_vcpu *vcpu);
arch/x86/kvm/svm.c +3 -39
93 lines not on this page · raw message
arch/x86/kvm/vmx.c +15 -96
194 lines not on this page · raw message
arch/x86/kvm/x86.c +7 -7
@@ -5698,6 +5698,12 @@ int kvm_arch_init(void *opaque) goto out; } +if (!boot_cpu_has (X86_FEATURE_EAGER_FPU )) { +pr_err ("kvm: requires eagerfpu\n" ); + r = -EOPNOTSUPP ; + goto out; + } +if (!ops->cpu_has_kvm_support ()) {printk (KERN_ERR "kvm: no hardware support\n" ); r = -EOPNOTSUPP ;
@@ -6099,10 +6105,6 @@ static int vcpu_enter_guest(struct kvm_v r =0 ; goto out; } -if (kvm_check_request (KVM_REQ_DEACTIVATE_FPU , vcpu)) { - vcpu->fpu_active =0 ; - kvm_x86_ops->fpu_deactivate (vcpu); - }if (kvm_check_request (KVM_REQ_APF_HALT , vcpu)) {/* Page is swapped out. Do synthetic halt */ vcpu->arch.apf.halted = true;
@@ -6159,8 +6161,7 @@ static int vcpu_enter_guest(struct kvm_vpreempt_disable (); kvm_x86_ops->prepare_guest_switch (vcpu); -if (vcpu->fpu_active) -kvm_load_guest_fpu (vcpu); +kvm_load_guest_fpu (vcpu); vcpu->mode =IN_GUEST_MODE ;srcu_read_unlock (&vcpu->kvm->srcu, vcpu->srcu_idx);
@@ -6917,7 +6918,6 @@ void kvm_put_guest_fpu(struct kvm_vcpu *fpu_save_init (&vcpu->arch.guest_fpu);__kernel_fpu_end (); ++vcpu->stat.fpu_reload; -kvm_make_request (KVM_REQ_DEACTIVATE_FPU , vcpu);trace_kvm_fpu (0 ); }
include/linux/kvm_host.h +0 -2
@@ -121,7 +121,6 @@ static inline bool is_error_page(struct#define KVM_REQ_MMU_SYNC 7#define KVM_REQ_CLOCK_UPDATE 8#define KVM_REQ_KICK 9 -#define KVM_REQ_DEACTIVATE_FPU 10#define KVM_REQ_EVENT 11#define KVM_REQ_APF_HALT 12#define KVM_REQ_STEAL_UPDATE 13
@@ -232,7 +231,6 @@ struct kvm_vcpu {struct mutex mutex;struct kvm_run *run; -int fpu_active;int guest_fpu_loaded, guest_xcr0_loaded;wait_queue_head_t wq;struct pid *pid;
PATCH 94/305 KVM: nVMX: Always reflect #NM VM-exits to L1
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jim Mattson <[email protected]>
commit 3c6e099fa15fdb6fb1892199ed8709012e1294f2 upstream.
When bit 3 (corresponding to CR0.TS) of the VMCS12 cr0_guest_host_mask field is clear, the VMCS12 guest_cr0 field does not necessarily hold the current value of the L2 CR0.TS bit, so the code that checked for L2's CR0.TS bit being set was incorrect. Moreover, I'm not sure that the CR0.TS check was adequate. (What if L2's CR0.EM was set, for instance?)
Fortunately, lazy FPU has gone away, so L0 has lost all interest in intercepting #NM exceptions. See commit bd7e5b0899a4 ("KVM: x86:
remove code for lazy FPU handling"). Therefore, there is no longer any question of which hypervisor gets first dibs. The #NM VM-exit should always be reflected to L1. (Note that the corresponding bit must be set in the VMCS12 exception_bitmap field for there to be an #NM VM-exit at all.)
[bwh: Backported to 3.16:
- is_no_device() hadn't been converted to use is_exception_n()
- Adjust context]
--- arch/x86/kvm/vmx.c | 8 -------- 1 file changed, 8 deletions(-)
arch/x86/kvm/vmx.c +0 -10
@@ -847,13 +847,6 @@ static inline bool is_page_fault(u32 int (INTR_TYPE_HARD_EXCEPTION |PF_VECTOR |INTR_INFO_VALID_MASK ); } -static inline bool is_no_device (u32 intr_info) -{ -return (intr_info & (INTR_INFO_INTR_TYPE_MASK |INTR_INFO_VECTOR_MASK | -INTR_INFO_VALID_MASK )) == - (INTR_TYPE_HARD_EXCEPTION |NM_VECTOR |INTR_INFO_VALID_MASK ); -} -static inline bool is_invalid_opcode (u32 intr_info) { return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VECTOR_MASK |
@@ -6939,9 +6932,6 @@ static bool nested_vmx_exit_handled(strureturn 0 ; else if (is_page_fault(intr_info)) return enable_ept; - else if (is_no_device(intr_info) && - !(vmcs12->guest_cr0 & X86_CR0_TS)) -return 0 ;return vmcs12->exception_bitmap & (1u << (intr_info &INTR_INFO_VECTOR_MASK ));case EXIT_REASON_EXTERNAL_INTERRUPT :
PATCH 95/305 parisc: Fix map_pages() to not overwrite existing pte entries
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 3c229b3f2dd8133f61bb81d3cb018be92f4bba39 upstream.
Fix a long-existing small nasty bug in the map_pages() implementation which leads to overwriting already written pte entries with zero, *if* map_pages() is called a second time with an end address which isn't aligned on a pmd boundry. This happens for example if we want to remap only the text segment read/write in order to run alternative patching on the code. Exiting the loop when we reach the end address fixes this.
--- arch/parisc/mm/init.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/parisc/mm/init.c +2 -6
@@ -492,12 +492,8 @@ static void __init map_pages(unsigned lo#endif pte =__mk_pte (address, pgprot); -if (address >= end_paddr) { -if (force) -break ; -else -pte_val (pte) =0 ; - } +if (address >= end_paddr) +break ;set_pte (pg_table, pte);
PATCH 96/305 parisc: Fix address in HPMC IVA
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: John David Anglin <[email protected]>
commit 1138b6718ff74d2a934459643e3754423d23b5e2 upstream.
Helge noticed that the address of the os_hpmc handler was not being correctly calculated in the hpmc macro. As a result, PDCE_CHECK would fail to call os_hpmc:
<Cpu2> e800009802e00000 0000000000000000 CC_ERR_CHECK_HPMC <Cpu2> 37000f7302e00000 8040004000000000 CC_ERR_CPU_CHECK_SUMMARY <Cpu2> f600105e02e00000 fffffff0f0c00000 CC_MC_HPMC_MONARCH_SELECTED <Cpu2> 140003b202e00000 000000000000000b CC_ERR_HPMC_STATE_ENTRY <Cpu2> 5600100b02e00000 00000000000001a0 CC_MC_OS_HPMC_LEN_ERR <Cpu2> 5600106402e00000 fffffff0f0438e70 CC_MC_BR_TO_OS_HPMC_FAILED <Cpu2> e800009802e00000 0000000000000000 CC_ERR_CHECK_HPMC <Cpu2> 37000f7302e00000 8040004000000000 CC_ERR_CPU_CHECK_SUMMARY <Cpu2> 4000109f02e00000 0000000000000000 CC_MC_HPMC_INITIATED <Cpu2> 4000101902e00000 0000000000000000 CC_MC_MULTIPLE_HPMCS <Cpu2> 030010d502e00000 0000000000000000 CC_CPU_STOP
The address problem can be seen by dumping the fault vector:
0000000040159000 <fault_vector_20>:
40159000: 63 6f 77 73 stb r15,-2447(dp)
40159004: 20 63 61 6e ldil L%b747000,r3
40159008: 20 66 6c 79 ldil L%-1c3b3000,r3
...
40159020: 08 00 02 40 nop
40159024: 20 6e 60 02 ldil L%15d000,r3
40159028: 34 63 00 00 ldo 0(r3),r3
4015902c: e8 60 c0 02 bv,n r0(r3)
40159030: 08 00 02 40 nop
40159034: 00 00 00 00 break 0,0
40159038: c0 00 70 00 bb,*< r0,sar,40159840 <fault_vector_20+0x840>
4015903c: 00 00 00 00 break 0,0Location 40159038 should contain the physical address of os_hpmc:
000000004015d000 <os_hpmc>:
4015d000: 08 1a 02 43 copy r26,r3
4015d004: 01 c0 08 a4 mfctl iva,r4
4015d008: 48 85 00 68 ldw 34(r4),r5This patch moves the address setup into initialize_ivt to resolve the above problem. I tested the change by dumping the HPMC entry after setup:
0000000040209020: 8000240
0000000040209024: 206a2004
0000000040209028: 34630ac0000000004020902c: e860c002
0000000040209030: 8000240
0000000040209034: 1bdddce6
0000000040209038: 15d000000000004020903c: 1a0
--- arch/parisc/kernel/entry.S | 2 +- arch/parisc/kernel/traps.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/parisc/kernel/entry.S +1 -1
@@ -176,7 +176,7 @@ bv,n 0(%r3) nop .word 0 /* checksum (will be patched) */ - .word PA(os_hpmc) /* address of handler */ + .word 0 /* address of handler */ .word 0 /* length of handler */ .endm
arch/parisc/kernel/traps.c +2 -1
@@ -833,7 +833,8 @@ int __init check_ivt(void *iva)for (i =0 ; i <8 ; i++) *ivap++ =0 ; -/* Compute Checksum for HPMC handler */ +/* Setup IVA and compute checksum for HPMC handler */ + ivap[6 ] = (u32 )__pa (os_hpmc); length = os_hpmc_size; ivap[7 ] = length;
PATCH 97/305 Btrfs: fix null pointer dereference on compressed write path error
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 3527a018c00e5dbada2f9d7ed5576437b6dd5cfb upstream.
At inode.c:compress_file_range(), under the "free_pages_out" label, we can end up dereferencing the "pages" pointer when it has a NULL value. This case happens when "start" has a value of 0 and we fail to allocate memory for the "pages" pointer. When that happens we jump to the "cont" label and then enter the "if (start == 0)" branch where we immediately call the cow_file_range_inline() function. If that function returns 0 (success creating an inline extent) or an error (like -ENOMEM for example) we jump to the "free_pages_out" label and then access "pages[i]" leading to a NULL pointer dereference, since "nr_pages" has a value greater than zero at that point.
Fix this by setting "nr_pages" to 0 when we fail to allocate memory for the "pages" pointer.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201119
--- fs/btrfs/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/inode.c +1 -0
@@ -452,6 +452,7 @@ again: pages =kzalloc (sizeof (struct page *) * nr_pages,GFP_NOFS );if (!pages) {/* just bail out to the uncompressed code */ + nr_pages =0 ; goto cont; }
PATCH 98/305 drm/i915: Large page offsets for pread/pwrite
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit ab0d6a141843e0b4b2709dfd37b53468b5452c3a upstream.
Handle integer overflow when computing the sub-page length for shmem backed pread/pwrite.
[bwh: Backported to 3.16:
- Length variable is page_length, not length
- Page-offset variable is shmem_page_offset, not offset]
---
drivers/gpu/drm/i915/i915_gem.c +6 -9
@@ -573,7 +573,7 @@ i915_gem_shmem_pread(struct drm_device *char __user *user_data;ssize_t remain;loff_t offset; -int shmem_page_offset, page_length, ret =0 ; +int shmem_page_offset, ret =0 ;int obj_do_bit17_swizzling, page_do_bit17_swizzling;int prefaulted =0 ;int needs_clflush =0 ;
@@ -593,6 +593,7 @@ i915_gem_shmem_pread(struct drm_device *for_each_sg_page (obj->pages->sgl, &sg_iter, obj->pages->nents, offset >>PAGE_SHIFT ) {struct page *page =sg_page_iter_page (&sg_iter); +unsigned int page_length;if (remain <=0 )break ;
@@ -603,9 +604,7 @@ i915_gem_shmem_pread(struct drm_device ** page_length = bytes to copy for this page */ shmem_page_offset =offset_in_page (offset); - page_length = remain; -if ((shmem_page_offset + page_length) >PAGE_SIZE ) - page_length =PAGE_SIZE - shmem_page_offset; + page_length =min_t (u64, remain,PAGE_SIZE - shmem_page_offset); page_do_bit17_swizzling = obj_do_bit17_swizzling && (page_to_phys (page) & (1 <<17 )) !=0 ;
@@ -870,7 +869,7 @@ i915_gem_shmem_pwrite(struct drm_devicessize_t remain;loff_t offset;char __user *user_data; -int shmem_page_offset, page_length, ret =0 ; +int shmem_page_offset, ret =0 ;int obj_do_bit17_swizzling, page_do_bit17_swizzling;int hit_slowpath =0 ;int needs_clflush_after =0 ;
@@ -913,6 +912,7 @@ i915_gem_shmem_pwrite(struct drm_device offset >> PAGE_SHIFT) {struct page *page =sg_page_iter_page (&sg_iter);int partial_cacheline_write; +unsigned int page_length;if (remain <=0 )break ;
@@ -923,10 +923,7 @@ i915_gem_shmem_pwrite(struct drm_device* page_length = bytes to copy for this page */ shmem_page_offset =offset_in_page (offset); - - page_length = remain; -if ((shmem_page_offset + page_length) >PAGE_SIZE ) - page_length =PAGE_SIZE - shmem_page_offset; + page_length =min_t (u64, remain,PAGE_SIZE - shmem_page_offset);/* If we don't overwrite a cacheline completely we need to be * careful to have up-to-date data by first clflushing. Don't
PATCH 99/305 scsi: esp_scsi: Track residual for PIO transfers
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
commit fd47d919d0c336e7c22862b51ee94927ffea227a upstream.
If a target disconnects during a PIO data transfer the command may fail when the target reconnects:
scsi host1: DMA length is zero!
scsi host1: cur adr[04380000] len[00000000]
The scsi bus is then reset. This happens because the residual reached zero before the transfer was completed.
The usual residual calculation relies on the Transfer Count registers. That works for DMA transfers but not for PIO transfers. Fix the problem by storing the PIO transfer residual and using that to correctly calculate bytes_sent.
--- drivers/scsi/esp_scsi.c | 1 + drivers/scsi/esp_scsi.h | 2 ++ drivers/scsi/mac_esp.c | 2 ++ 3 files changed, 5 insertions(+)
drivers/scsi/esp_scsi.c +1 -0
@@ -1316,6 +1316,7 @@ static int esp_data_bytes_sent(struct es bytes_sent = esp->data_dma_len; bytes_sent -= ecount; + bytes_sent -= esp->send_cmd_residual;if (!(ent->flags &ESP_CMD_FLAG_WRITE )) bytes_sent -= fifo_cnt;
drivers/scsi/esp_scsi.h +2 -0
@@ -524,6 +524,8 @@ struct esp {void *dma;int dmarev; + +u32 send_cmd_residual; };/* A front-end driver for the ESP chip should do the following in
drivers/scsi/mac_esp.c +2 -0
@@ -426,6 +426,8 @@ static void mac_esp_send_pio_cmd(structscsi_esp_cmd (esp,ESP_CMD_TI ); } } + + esp->send_cmd_residual = esp_count; }static int mac_esp_irq_pending (struct esp *esp)
PATCH 100/305 xfs: Fix xqmstats offsets in /proc/fs/xfs/xqmstat
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Maiolino <[email protected]>
commit 41657e5507b13e963be906d5d874f4f02374fd5c upstream.
The addition of FIBT, RMAP and REFCOUNT changed the offsets into __xfssats structure.
This caused xqmstat_proc_show() to display garbage data via /proc/fs/xfs/xqmstat, once it relies on the offsets marked via macros.
Fix it.
[bwh: Backported to 3.16:
- Only the FIBT stats have been added, so start from XFSSTAT_END_FIBT_V2
- Adjust context]
--- fs/xfs/xfs_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_stats.c +1 -1
@@ -135,7 +135,7 @@ static int xqmstat_proc_show(struct seq_int j;seq_printf (m,"qm" ); -for (j =XFSSTAT_END_IBT_V2 ; j <XFSSTAT_END_XQMSTAT ; j++) +for (j =XFSSTAT_END_FIBT_V2 ; j <XFSSTAT_END_XQMSTAT ; j++)seq_printf (m," %u" ,counter_val (j));seq_putc (m,'\n' );return 0 ;
PATCH 101/305 ACPICA: AML interpreter: add region addresses in global list during initialization
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Erik Schmauss <[email protected]>
commit 4abb951b73ff0a8a979113ef185651aa3c8da19b upstream.
The table load process omitted adding the operation region address range to the global list. This omission is problematic because the OS queries the global list to check for address range conflicts before deciding which drivers to load. This commit may result in warning messages that look like the following:
[ 7.871761] ACPI Warning: system_IO range 0x00000428-0x0000042F conflicts with op_region 0x00000400-0x0000047F (\PMIO) (20180531/utaddress-213) [ 7.871769] ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
However, these messages do not signify regressions. It is a result of properly adding address ranges within the global address list.
--- drivers/acpi/acpica/dsopcode.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/acpica/dsopcode.c +4 -0
@@ -449,6 +449,10 @@ acpi_ds_eval_region_operands(struct acpiACPI_FORMAT_UINT64 (obj_desc->region.address), obj_desc->region.length)); + status =acpi_ut_add_address_range (obj_desc->region.space_id, + obj_desc->region.address, + obj_desc->region.length, node); +/* Now the address and length are valid for this opregion */ obj_desc->region.flags |=AOPOBJ_DATA_VALID ;
PATCH 102/305 dm ioctl: harden copy_params()'s copy_from_user() from malicious users
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wenwen Wang <[email protected]>
commit 800a7340ab7dd667edf95e74d8e4f23a17e87076 upstream.
In copy_params(), the struct 'dm_ioctl' is first copied from the user space buffer 'user' to 'param_kernel' and the field 'data_size' is checked against 'minimum_data_size' (size of 'struct dm_ioctl' payload up to its 'data' member). If the check fails, an error code EINVAL will be returned. Otherwise, param_kernel->data_size is used to do a second copy, which copies from the same user-space buffer to 'dmi'. After the second copy, only 'dmi->data_size' is checked against 'param_kernel->data_size'. Given that the buffer 'user' resides in the user space, a malicious user-space process can race to change the content in the buffer between the two copies. This way, the attacker can inject inconsistent data into 'dmi' (versus previously validated 'param_kernel').
Fix redundant copying of 'minimum_data_size' from user-space buffer by using the first copy stored in 'param_kernel'. Also remove the 'data_size' check after the second copy because it is now unnecessary.
--- drivers/md/dm-ioctl.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/md/dm-ioctl.c +6 -12
@@ -1681,8 +1681,7 @@ static void free_params(struct dm_ioctl }static int copy_params (struct dm_ioctl __user *user,struct dm_ioctl *param_kernel, -int ioctl_flags, -struct dm_ioctl **param,int *param_flags) +int ioctl_flags,struct dm_ioctl **param,int *param_flags) {struct dm_ioctl *dmi;int secure_data;
@@ -1730,18 +1729,13 @@ static int copy_params(struct dm_ioctl _return -ENOMEM ; } -if (copy_from_user (dmi, user, param_kernel->data_size)) - goto bad; +/* Copy from param_kernel (which was already copied from user) */ +memcpy (dmi, param_kernel, minimum_data_size); -data_copied: -/* -* Abort if something changed the ioctl data while it was being copied. -*/ -if (dmi->data_size != param_kernel->data_size) { -DMERR ("rejecting ioctl: data size modified while processing parameters" ); +if (copy_from_user (&dmi->data, (char __user *)user + minimum_data_size, + param_kernel->data_size - minimum_data_size)) goto bad; - } - +data_copied:/* Wipe the user buffer so we do not return it to userspace */ if (secure_data &&clear_user (user, param_kernel->data_size)) goto bad;
PATCH 103/305 clk: s2mps11: Add used attribute to s2mps11_dt_match
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 9c940bbe2bb47e03ca5e937d30b6a50bf9c0e671 upstream.
Clang warns after commit 8985167ecf57 ("clk: s2mps11: Fix matching when built as module and DT node contains compatible"):
drivers/clk/clk-s2mps11.c:242:34: warning: variable 's2mps11_dt_match' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct of_device_id s2mps11_dt_match[] = {
^1 warning generated.
This warning happens when a variable is used in some construct that doesn't require a reference to that variable to be emitted in the symbol table; in this case, it's MODULE_DEVICE_TABLE, which only needs to hold the data of the variable, not the variable itself.
$ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_dt_match 00000078 000003d4 R __mod_of__s2mps11_dt_match_device_table
Normally, with device ID table variables, it means that the variable just needs to be tied to the device declaration at the bottom of the file, like s2mps11_clk_id:
$ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_clk_id 00000000 00000078 R __mod_platform__s2mps11_clk_id_device_table 00000000 00000078 r s2mps11_clk_id
However, because the comment above this deliberately doesn't want this variable added to .of_match_table, we need to mark s2mps11_dt_match as __used to silence this warning. This makes it clear to Clang that the variable is used for something, even if a reference to it isn't being emitted.
--- drivers/clk/clk-s2mps11.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-s2mps11.c +1 -1
@@ -306,7 +306,7 @@ MODULE_DEVICE_TABLE(platform, s2mps11_cl* This requires of_device_id table. In the same time this will not change the * actual *device* matching so do not add .of_match_table. */ -static const struct of_device_id s2mps11_dt_match[] = { +static const struct of_device_id s2mps11_dt_match[]__used = { { .compatible ="samsung,s2mps11-clk" , .data = (void *)S2MPS11X ,
PATCH 104/305 xen-swiotlb: use actually allocated size on check physical continuous
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joe Jin <[email protected]>
commit 7250f422da0480d8512b756640f131b9b893ccda upstream.
xen_swiotlb_{alloc,free}_coherent() allocate/free memory based on the order of the pages and not size argument (bytes). This is inconsistent with range_straddles_page_boundary and memset which use the 'size' value, which may lead to not exchanging memory with Xen (range_straddles_page_boundary() returned true). And then the call to xen_swiotlb_free_coherent() would actually try to exchange the memory with Xen, leading to the kernel hitting an BUG (as the hypercall returned an error).
This patch fixes it by making the 'size' variable be of the same size as the amount of memory allocated.
[bwh: Backported to 3.16:
- Use PAGE_SHIFT instead of XEN_PAGE_SHIFT
- Adjust context]
--- drivers/xen/swiotlb-xen.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/xen/swiotlb-xen.c +6 -0
@@ -311,6 +311,9 @@ xen_swiotlb_alloc_coherent(struct device*/ flags &= ~(__GFP_DMA | __GFP_HIGHMEM); +/* Convert the size to actually allocated. */ + size =1UL << (order +PAGE_SHIFT ); +if (dma_alloc_from_coherent (hwdev, size, dma_handle, &ret))return ret;
@@ -366,6 +369,9 @@ xen_swiotlb_free_coherent(struct device* physical address */ phys =xen_bus_to_phys (dev_addr); +/* Convert the size to actually allocated. */ + size =1UL << (order +PAGE_SHIFT ); +if (((dev_addr + size -1 <= dma_mask)) ||range_straddles_page_boundary (phys, size))xen_destroy_contiguous_region (phys, order);
PATCH 105/305 genirq: Fix race on spurious interrupt detection
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Wunner <[email protected]>
commit 746a923b863a1065ef77324e1e43f19b1a3eab5c upstream.
Commit 1e77d0a1ed74 ("genirq: Sanitize spurious interrupt detection of threaded irqs") made detection of spurious interrupts work for threaded handlers by:
a) incrementing a counter every time the thread returns IRQ_HANDLED, and
b) checking whether that counter has increased every time the thread is woken.
However for oneshot interrupts, the commit unmasks the interrupt before incrementing the counter. If another interrupt occurs right after unmasking but before the counter is incremented, that interrupt is incorrectly considered spurious:
time
| irq_thread() | irq_thread_fn() | action->thread_fn() | irq_finalize_oneshot() | unmask_threaded_irq() /* interrupt is unmasked */ | | /* interrupt fires, incorrectly deemed spurious */ | | atomic_inc(&desc->threads_handled); /* counter is incremented */
v
This is observed with a hi3110 CAN controller receiving data at high volume (from a separate machine sending with "cangen -g 0 -i -x"): The controller signals a huge number of interrupts (hundreds of millions per day) and every second there are about a dozen which are deemed spurious.
In theory with high CPU load and the presence of higher priority tasks, the number of incorrectly detected spurious interrupts might increase beyond the 99,900 threshold and cause disablement of the interrupt.
In practice it just increments the spurious interrupt count. But that can cause people to waste time investigating it over and over.
Fix it by moving the accounting before the invocation of irq_finalize_oneshot().
[ tglx: Folded change log update ]
--- kernel/irq/manage.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/irq/manage.c +6 -2
@@ -805,6 +805,9 @@ irq_forced_thread_fn(struct irq_desc *delocal_bh_disable (); ret = action->thread_fn (action->irq, action->dev_id); +if (ret ==IRQ_HANDLED ) +atomic_inc (&desc->threads_handled); +irq_finalize_oneshot (desc, action);local_bh_enable ();return ret;
@@ -821,6 +824,9 @@ static irqreturn_t irq_thread_fn(structirqreturn_t ret; ret = action->thread_fn (action->irq, action->dev_id); +if (ret ==IRQ_HANDLED ) +atomic_inc (&desc->threads_handled); +irq_finalize_oneshot (desc, action);return ret; }
@@ -886,8 +892,6 @@ static int irq_thread(void *data)irq_thread_check_affinity (desc, action); action_ret =handler_fn (desc, action); -if (action_ret ==IRQ_HANDLED ) -atomic_inc (&desc->threads_handled);wake_threads_waitq (desc); }
PATCH 106/305 libceph: bump CEPH_MSG_MAX_DATA_LEN
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit 94e6992bb560be8bffb47f287194adf070b57695 upstream.
If the read is large enough, we end up spinning in the messenger:
libceph: osd0 192.168.122.1:6801 io error
libceph: osd0 192.168.122.1:6801 io error
libceph: osd0 192.168.122.1:6801 io error
This is a receive side limit, so only reads were affected.
--- include/linux/ceph/libceph.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/linux/ceph/libceph.h +7 -1
@@ -67,7 +67,13 @@ struct ceph_options {#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)#define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) -#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) + +/* +* Handle the largest possible rbd object in one message. +* There is no limit on the size of cephfs objects, but it has to obey +* rsize and wsize mount options anyway. +*/ +#define CEPH_MSG_MAX_DATA_LEN (32*1024*1024)#define CEPH_AUTH_NAME_DEFAULT "guest"
PATCH 107/305 Btrfs: fix use-after-free when dumping free space
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 9084cb6a24bf5838a665af92ded1af8363f9e563 upstream.
We were iterating a block group's free space cache rbtree without locking first the lock that protects it (the free_space_ctl->free_space_offset rbtree is protected by the free_space_ctl->tree_lock spinlock).
KASAN reported an use-after-free problem when iterating such a rbtree due to a concurrent rbtree delete:
[ 9520.359168] ==================================================================
[ 9520.359656] BUG: KASAN: use-after-free in rb_next+0x13/0x90
[ 9520.359949] Read of size 8 at addr ffff8800b7ada500 by task btrfs-transacti/1721
[ 9520.360357]
[ 9520.360530] CPU: 4 PID: 1721 Comm: btrfs-transacti Tainted: G L 4.19.0-rc8-nbor #555
[ 9520.360990] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 9520.362682] Call Trace:
[ 9520.362887] dump_stack+0xa4/0xf5
[ 9520.363146] print_address_description+0x78/0x280
[ 9520.363412] kasan_report+0x263/0x390
[ 9520.363650] ? rb_next+0x13/0x90
[ 9520.363873] __asan_load8+0x54/0x90
[ 9520.364102] rb_next+0x13/0x90
[ 9520.364380] btrfs_dump_free_space+0x146/0x160 [btrfs]
[ 9520.364697] dump_space_info+0x2cd/0x310 [btrfs]
[ 9520.364997] btrfs_reserve_extent+0x1ee/0x1f0 [btrfs]
[ 9520.365310] __btrfs_prealloc_file_range+0x1cc/0x620 [btrfs]
[ 9520.365646] ? btrfs_update_time+0x180/0x180 [btrfs]
[ 9520.365923] ? _raw_spin_unlock+0x27/0x40
[ 9520.366204] ? btrfs_alloc_data_chunk_ondemand+0x2c0/0x5c0 [btrfs]
[ 9520.366549] btrfs_prealloc_file_range_trans+0x23/0x30 [btrfs]
[ 9520.366880] cache_save_setup+0x42e/0x580 [btrfs]
[ 9520.367220] ? btrfs_check_data_free_space+0xd0/0xd0 [btrfs]
[ 9520.367518] ? lock_downgrade+0x2f0/0x2f0
[ 9520.367799] ? btrfs_write_dirty_block_groups+0x11f/0x6e0 [btrfs]
[ 9520.368104] ? kasan_check_read+0x11/0x20
[ 9520.368349] ? do_raw_spin_unlock+0xa8/0x140
[ 9520.368638] btrfs_write_dirty_block_groups+0x2af/0x6e0 [btrfs]
[ 9520.368978] ? btrfs_start_dirty_block_groups+0x870/0x870 [btrfs]
[ 9520.369282] ? do_raw_spin_unlock+0xa8/0x140
[ 9520.369534] ? _raw_spin_unlock+0x27/0x40
[ 9520.369811] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
[ 9520.370137] commit_cowonly_roots+0x4b9/0x610 [btrfs]
[ 9520.370560] ? commit_fs_roots+0x350/0x350 [btrfs]
[ 9520.370926] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
[ 9520.371285] btrfs_commit_transaction+0x5e5/0x10e0 [btrfs]
[ 9520.371612] ? btrfs_apply_pending_changes+0x90/0x90 [btrfs]
[ 9520.371943] ? start_transaction+0x168/0x6c0 [btrfs]
[ 9520.372257] transaction_kthread+0x21c/0x240 [btrfs]
[ 9520.372537] kthread+0x1d2/0x1f0
[ 9520.372793] ? btrfs_cleanup_transaction+0xb50/0xb50 [btrfs]
[ 9520.373090] ? kthread_park+0xb0/0xb0
[ 9520.373329] ret_from_fork+0x3a/0x50
[ 9520.373567]
[ 9520.373738] Allocated by task 1804:
[ 9520.373974] kasan_kmalloc+0xff/0x180
[ 9520.374208] kasan_slab_alloc+0x11/0x20
[ 9520.374447] kmem_cache_alloc+0xfc/0x2d0
[ 9520.374731] __btrfs_add_free_space+0x40/0x580 [btrfs]
[ 9520.375044] unpin_extent_range+0x4f7/0x7a0 [btrfs]
[ 9520.375383] btrfs_finish_extent_commit+0x15f/0x4d0 [btrfs]
[ 9520.375707] btrfs_commit_transaction+0xb06/0x10e0 [btrfs]
[ 9520.376027] btrfs_alloc_data_chunk_ondemand+0x237/0x5c0 [btrfs]
[ 9520.376365] btrfs_check_data_free_space+0x81/0xd0 [btrfs]
[ 9520.376689] btrfs_delalloc_reserve_space+0x25/0x80 [btrfs]
[ 9520.377018] btrfs_direct_IO+0x42e/0x6d0 [btrfs]
[ 9520.377284] generic_file_direct_write+0x11e/0x220
[ 9520.377587] btrfs_file_write_iter+0x472/0xac0 [btrfs]
[ 9520.377875] aio_write+0x25c/0x360
[ 9520.378106] io_submit_one+0xaa0/0xdc0
[ 9520.378343] __se_sys_io_submit+0xfa/0x2f0
[ 9520.378589] __x64_sys_io_submit+0x43/0x50
[ 9520.378840] do_syscall_64+0x7d/0x240
[ 9520.379081] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 9520.379387]
[ 9520.379557] Freed by task 1802:
[ 9520.379782] __kasan_slab_free+0x173/0x260
[ 9520.380028] kasan_slab_free+0xe/0x10
[ 9520.380262] kmem_cache_free+0xc1/0x2c0
[ 9520.380544] btrfs_find_space_for_alloc+0x4cd/0x4e0 [btrfs]
[ 9520.380866] find_free_extent+0xa99/0x17e0 [btrfs]
[ 9520.381166] btrfs_reserve_extent+0xd5/0x1f0 [btrfs]
[ 9520.381474] btrfs_get_blocks_direct+0x60b/0xbd0 [btrfs]
[ 9520.381761] __blockdev_direct_IO+0x10ee/0x58a1
[ 9520.382059] btrfs_direct_IO+0x25a/0x6d0 [btrfs]
[ 9520.382321] generic_file_direct_write+0x11e/0x220
[ 9520.382623] btrfs_file_write_iter+0x472/0xac0 [btrfs]
[ 9520.382904] aio_write+0x25c/0x360
[ 9520.383172] io_submit_one+0xaa0/0xdc0
[ 9520.383416] __se_sys_io_submit+0xfa/0x2f0
[ 9520.383678] __x64_sys_io_submit+0x43/0x50
[ 9520.383927] do_syscall_64+0x7d/0x240
[ 9520.384165] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 9520.384439]
[ 9520.384610] The buggy address belongs to the object at ffff8800b7ada500
which belongs to the cache btrfs_free_space of size 72
[ 9520.385175] The buggy address is located 0 bytes inside of
72-byte region [ffff8800b7ada500, ffff8800b7ada548)
[ 9520.385691] The buggy address belongs to the page:
[ 9520.385957] page:ffffea0002deb680 count:1 mapcount:0 mapping:ffff880108a1d700 index:0x0 compound_mapcount: 0
[ 9520.388030] flags: 0x8100(slab|head)
[ 9520.388281] raw: 0000000000008100 ffffea0002deb608 ffffea0002728808 ffff880108a1d700
[ 9520.388722] raw: 0000000000000000 0000000000130013 00000001ffffffff 0000000000000000
[ 9520.389169] page dumped because: kasan: bad access detected
[ 9520.389473]
[ 9520.389658] Memory state around the buggy address:
[ 9520.389943] ffff8800b7ada400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 9520.390368] ffff8800b7ada480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 9520.390796] >ffff8800b7ada500: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
[ 9520.391223] ^
[ 9520.391461] ffff8800b7ada580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 9520.391885] ffff8800b7ada600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 9520.392313] ==================================================================
[ 9520.392772] BTRFS critical (device vdc): entry offset 2258497536, bytes 131072, bitmap no
[ 9520.393247] BUG: unable to handle kernel NULL pointer dereference at 0000000000000011
[ 9520.393705] PGD 800000010dbab067 P4D 800000010dbab067 PUD 107551067 PMD 0
[ 9520.394059] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
[ 9520.394378] CPU: 4 PID: 1721 Comm: btrfs-transacti Tainted: G B L 4.19.0-rc8-nbor #555
[ 9520.394858] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 9520.395350] RIP: 0010:rb_next+0x3c/0x90
[ 9520.396461] RSP: 0018:ffff8801074ff780 EFLAGS: 00010292
[ 9520.396762] RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81b5ac4c
[ 9520.397115] RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000011
[ 9520.397468] RBP: ffff8801074ff7a0 R08: ffffed0021d64ccc R09: ffffed0021d64ccc
[ 9520.397821] R10: 0000000000000001 R11: ffffed0021d64ccb R12: ffff8800b91e0000
[ 9520.398188] R13: ffff8800a3ceba48 R14: ffff8800b627bf80 R15: 0000000000020000
[ 9520.398555] FS: 0000000000000000(0000) GS:ffff88010eb00000(0000) knlGS:0000000000000000
[ 9520.399007] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9520.399335] CR2: 0000000000000011 CR3: 0000000106b52000 CR4: 00000000000006a0
[ 9520.399679] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 9520.400023] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 9520.400400] Call Trace:
[ 9520.400648] btrfs_dump_free_space+0x146/0x160 [btrfs]
[ 9520.400974] dump_space_info+0x2cd/0x310 [btrfs]
[ 9520.401287] btrfs_reserve_extent+0x1ee/0x1f0 [btrfs]
[ 9520.401609] __btrfs_prealloc_file_range+0x1cc/0x620 [btrfs]
[ 9520.401952] ? btrfs_update_time+0x180/0x180 [btrfs]
[ 9520.402232] ? _raw_spin_unlock+0x27/0x40
[ 9520.402522] ? btrfs_alloc_data_chunk_ondemand+0x2c0/0x5c0 [btrfs]
[ 9520.402882] btrfs_prealloc_file_range_trans+0x23/0x30 [btrfs]
[ 9520.403261] cache_save_setup+0x42e/0x580 [btrfs]
[ 9520.403570] ? btrfs_check_data_free_space+0xd0/0xd0 [btrfs]
[ 9520.403871] ? lock_downgrade+0x2f0/0x2f0
[ 9520.404161] ? btrfs_write_dirty_block_groups+0x11f/0x6e0 [btrfs]
[ 9520.404481] ? kasan_check_read+0x11/0x20
[ 9520.404732] ? do_raw_spin_unlock+0xa8/0x140
[ 9520.405026] btrfs_write_dirty_block_groups+0x2af/0x6e0 [btrfs]
[ 9520.405375] ? btrfs_start_dirty_block_groups+0x870/0x870 [btrfs]
[ 9520.405694] ? do_raw_spin_unlock+0xa8/0x140
[ 9520.405958] ? _raw_spin_unlock+0x27/0x40
[ 9520.406243] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
[ 9520.406574] commit_cowonly_roots+0x4b9/0x610 [btrfs]
[ 9520.406899] ? commit_fs_roots+0x350/0x350 [btrfs]
[ 9520.407253] ? btrfs_run_delayed_refs+0x1b8/0x230 [btrfs]
[ 9520.407589] btrfs_commit_transaction+0x5e5/0x10e0 [btrfs]
[ 9520.407925] ? btrfs_apply_pending_changes+0x90/0x90 [btrfs]
[ 9520.408262] ? start_transaction+0x168/0x6c0 [btrfs]
[ 9520.408582] transaction_kthread+0x21c/0x240 [btrfs]
[ 9520.408870] kthread+0x1d2/0x1f0
[ 9520.409138] ? btrfs_cleanup_transaction+0xb50/0xb50 [btrfs]
[ 9520.409440] ? kthread_park+0xb0/0xb0
[ 9520.409682] ret_from_fork+0x3a/0x50
[ 9520.410508] Dumping ftrace buffer:
[ 9520.410764] (ftrace buffer empty)
[ 9520.411007] CR2: 0000000000000011
[ 9520.411297] ---[ end trace 01a0863445cf360a ]---
[ 9520.411568] RIP: 0010:rb_next+0x3c/0x90
[ 9520.412644] RSP: 0018:ffff8801074ff780 EFLAGS: 00010292
[ 9520.412932] RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81b5ac4c
[ 9520.413274] RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000011
[ 9520.413616] RBP: ffff8801074ff7a0 R08: ffffed0021d64ccc R09: ffffed0021d64ccc
[ 9520.414007] R10: 0000000000000001 R11: ffffed0021d64ccb R12: ffff8800b91e0000
[ 9520.414349] R13: ffff8800a3ceba48 R14: ffff8800b627bf80 R15: 0000000000020000
[ 9520.416074] FS: 0000000000000000(0000) GS:ffff88010eb00000(0000) knlGS:0000000000000000
[ 9520.416536] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9520.416848] CR2: 0000000000000011 CR3: 0000000106b52000 CR4: 00000000000006a0
[ 9520.418477] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 9520.418846] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 9520.419204] Kernel panic - not syncing: Fatal exception
[ 9520.419666] Dumping ftrace buffer:
[ 9520.419930] (ftrace buffer empty)
[ 9520.420168] Kernel Offset: disabled
[ 9520.420406] ---[ end Kernel panic - not syncing: Fatal exception ]---Fix this by acquiring the respective lock before iterating the rbtree.
--- fs/btrfs/free-space-cache.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/free-space-cache.c +2 -0
@@ -2141,6 +2141,7 @@ void btrfs_dump_free_space(struct btrfs_struct rb_node *n;int count =0 ; +spin_lock (&ctl->tree_lock);for (n =rb_first (&ctl->free_space_offset); n; n =rb_next (n)) { info = rb_entry(n, struct btrfs_free_space, offset_index);if (info->bytes >= bytes && !block_group->ro)
@@ -2150,6 +2151,7 @@ void btrfs_dump_free_space(struct btrfs_ info->offset, info->bytes, (info->bitmap) ? "yes" : "no"); } +spin_unlock (&ctl->tree_lock);btrfs_info (block_group->fs_info,"block group has cluster?: %s" ,list_empty (&block_group->cluster_list) ?"no" :"yes" ); btrfs_info(block_group->fs_info,
PATCH 108/305 qlcnic: fix a return in qlcnic_dcb_get_capability()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit c94f026fb742b2d3199422751dbc4f6fc0e753d8 upstream.
These functions are supposed to return one on failure and zero on success. Returning a zero here could cause uninitialized variable bugs in several of the callers. For example:
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c:1660 get_iscsi_dcb_priority()
error: uninitialized symbol 'caps'.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.c +1 -1
@@ -883,7 +883,7 @@ static u8 qlcnic_dcb_get_capability(strustruct qlcnic_adapter *adapter =netdev_priv (netdev);if (!test_bit (QLCNIC_DCB_STATE , &adapter->dcb->state)) -return 0 ; +return 1 ;switch (capid) {case DCB_CAP_ATTR_PG :
PATCH 109/305 llc: do not use sk_eat_skb()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 604d415e2bd642b7e02c80e719e0396b9d4a77a6 upstream.
syzkaller triggered a use-after-free [1], caused by a combination of skb_get() in llc_conn_state_process() and usage of sk_eat_skb()
sk_eat_skb() is assuming the skb about to be freed is only used by the current thread. TCP/DCCP stacks enforce this because current thread holds the socket lock.
llc_conn_state_process() wants to make sure skb does not disappear, and holds a reference on the skb it manipulates. But as soon as this skb is added to socket receive queue, another thread can consume it.
This means that llc must use regular skb_unlink() and kfree_skb() so that both producer and consumer can safely work on the same skb.
[1]
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:43 [inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:967 [inline]
BUG: KASAN: use-after-free in kfree_skb+0xb7/0x580 net/core/skbuff.c:655
Read of size 4 at addr ffff8801d1f6fba4 by task ksoftirqd/1/18
CPU: 1 PID: 18 Comm: ksoftirqd/1 Not tainted 4.19.0-rc8+ #295
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/0x2b6 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
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]
refcount_read include/linux/refcount.h:43 [inline]
skb_unref include/linux/skbuff.h:967 [inline]
kfree_skb+0xb7/0x580 net/core/skbuff.c:655
llc_sap_state_process+0x9b/0x550 net/llc/llc_sap.c:224
llc_sap_rcv+0x156/0x1f0 net/llc/llc_sap.c:297
llc_sap_handler+0x65e/0xf80 net/llc/llc_sap.c:438
llc_rcv+0x79e/0xe20 net/llc/llc_input.c:208
__netif_receive_skb_one_core+0x14d/0x200 net/core/dev.c:4913
__netif_receive_skb+0x2c/0x1e0 net/core/dev.c:5023
process_backlog+0x218/0x6f0 net/core/dev.c:5829
napi_poll net/core/dev.c:6249 [inline]
net_rx_action+0x7c5/0x1950 net/core/dev.c:6315
__do_softirq+0x30c/0xb03 kernel/softirq.c:292
run_ksoftirqd+0x94/0x100 kernel/softirq.c:653
smpboot_thread_fn+0x68b/0xa00 kernel/smpboot.c:164
kthread+0x35a/0x420 kernel/kthread.c:246
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413
Allocated by task 18:
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_node+0x144/0x730 mm/slab.c:3644
__alloc_skb+0x119/0x770 net/core/skbuff.c:193
alloc_skb include/linux/skbuff.h:995 [inline]
llc_alloc_frame+0xbc/0x370 net/llc/llc_sap.c:54
llc_station_ac_send_xid_r net/llc/llc_station.c:52 [inline]
llc_station_rcv+0x1dc/0x1420 net/llc/llc_station.c:111
llc_rcv+0xc32/0xe20 net/llc/llc_input.c:220
__netif_receive_skb_one_core+0x14d/0x200 net/core/dev.c:4913
__netif_receive_skb+0x2c/0x1e0 net/core/dev.c:5023
process_backlog+0x218/0x6f0 net/core/dev.c:5829
napi_poll net/core/dev.c:6249 [inline]
net_rx_action+0x7c5/0x1950 net/core/dev.c:6315
__do_softirq+0x30c/0xb03 kernel/softirq.c:292
Freed by task 16383:
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
kfree_skbmem+0x154/0x230 net/core/skbuff.c:582
__kfree_skb+0x1d/0x20 net/core/skbuff.c:642
sk_eat_skb include/net/sock.h:2366 [inline]
llc_ui_recvmsg+0xec2/0x1610 net/llc/af_llc.c:882
sock_recvmsg_nosec net/socket.c:794 [inline]
sock_recvmsg+0xd0/0x110 net/socket.c:801
___sys_recvmsg+0x2b6/0x680 net/socket.c:2278
__sys_recvmmsg+0x303/0xb90 net/socket.c:2390
do_sys_recvmmsg+0x181/0x1a0 net/socket.c:2466
__do_sys_recvmmsg net/socket.c:2484 [inline]
__se_sys_recvmmsg net/socket.c:2480 [inline]
__x64_sys_recvmmsg+0xbe/0x150 net/socket.c:2480
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
The buggy address belongs to the object at ffff8801d1f6fac0
which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 228 bytes inside of
232-byte region [ffff8801d1f6fac0, ffff8801d1f6fba8)
The buggy address belongs to the page:
page:ffffea000747dbc0 count:1 mapcount:0 mapping:ffff8801d9be7680 index:0xffff8801d1f6fe80
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea0007346e88 ffffea000705b108 ffff8801d9be7680
raw: ffff8801d1f6fe80 ffff8801d1f6f0c0 000000010000000b 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8801d1f6fa80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8801d1f6fb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801d1f6fb80: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
^
ffff8801d1f6fc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801d1f6fc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc[bwh: Backported to 3.16:
- sk_eat_skb() takes a third parameter here
- Adjust indentation]
--- net/llc/af_llc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
net/llc/af_llc.c +5 -8
@@ -723,7 +723,6 @@ static int llc_ui_recvmsg(struct kiocb *struct sk_buff *skb =NULL ;struct sock *sk = sock->sk;struct llc_sock *llc =llc_sk (sk); -unsigned long cpu_flags;size_t copied =0 ;u32 peek_seq =0 ;u32 *seq, skb_len;
@@ -849,9 +848,8 @@ static int llc_ui_recvmsg(struct kiocb * goto copy_uaddr;if (!(flags &MSG_PEEK )) { -spin_lock_irqsave (&sk->sk_receive_queue.lock, cpu_flags); -sk_eat_skb (sk, skb, false); -spin_unlock_irqrestore (&sk->sk_receive_queue.lock, cpu_flags); +skb_unlink (skb, &sk->sk_receive_queue); +kfree_skb (skb); *seq =0 ; }
@@ -872,10 +870,9 @@ copy_uaddr:llc_cmsg_rcv (msg, skb);if (!(flags &MSG_PEEK )) { -spin_lock_irqsave (&sk->sk_receive_queue.lock, cpu_flags); -sk_eat_skb (sk, skb, false); -spin_unlock_irqrestore (&sk->sk_receive_queue.lock, cpu_flags); - *seq =0 ; +skb_unlink (skb, &sk->sk_receive_queue); +kfree_skb (skb); + *seq =0 ; } goto out;
PATCH 110/305 of: add helper to lookup compatible child node
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 36156f9241cb0f9e37d998052873ca7501ad4b36 upstream.
Add of_get_compatible_child() helper that can be used to lookup compatible child nodes.
Several drivers currently use of_find_compatible_node() to lookup child nodes while failing to notice that the of_find_ functions search the entire tree depth-first (from a given start node) and therefore can match unrelated nodes. The fact that these functions also drop a reference to the node they start searching from (e.g. the parent node) is typically also overlooked, something which can lead to use-after-free bugs.
--- drivers/of/base.c | 25 +++++++++++++++++++++++++ include/linux/of.h | 8 ++++++++ 2 files changed, 33 insertions(+)
drivers/of/base.c +25 -0
@@ -768,6 +768,31 @@ struct device_node *of_get_next_availablEXPORT_SYMBOL (of_get_next_available_child);/** +* of_get_compatible_child - Find compatible child node +* @parent: parent node +* @compatible: compatible string +* +* Lookup child node whose compatible property contains the given compatible +* string. +* +* Returns a node pointer with refcount incremented, use of_node_put() on it +* when done; or NULL if not found. +*/ +struct device_node *of_get_compatible_child (const struct device_node *parent, +const char *compatible) +{ +struct device_node *child; + +for_each_child_of_node (parent, child) { +if (of_device_is_compatible (child, compatible)) +break ; + } + +return child; +} +EXPORT_SYMBOL (of_get_compatible_child); + +/** * of_get_child_by_name - Find the child node by name for a given parent * @node: parent node * @name: child name to look for.
include/linux/of.h +8 -0
@@ -237,6 +237,8 @@ extern struct device_node *of_get_next_cextern struct device_node *of_get_next_available_child (const struct device_node *node,struct device_node *prev); +extern struct device_node *of_get_compatible_child (const struct device_node *parent, +const char *compatible);extern struct device_node *of_get_child_by_name (const struct device_node *node,const char *name);
@@ -412,6 +414,12 @@ static inline bool of_have_populated_dt(return false; } +static inline struct device_node *of_get_compatible_child (const struct device_node *parent, +const char *compatible) +{ +return NULL ; +} +static inline struct device_node *of_get_child_by_name (const struct device_node *node,const char *name)
PATCH 111/305 net: bcmgenet: fix OF child-node lookup
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit d397dbe606120a1ea1b11b0020c3f7a3852da5ac upstream.
Use the new of_get_compatible_child() helper to lookup the mdio child node instead of using of_find_compatible_node(), which searches the entire tree from a given start node and thus can return an unrelated (i.e. non-child) node.
This also addresses a potential use-after-free (e.g. after probe deferral) as the tree-wide helper drops a reference to its first argument (i.e. the node of the device being probed).
--- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmmii.c +1 -1
@@ -410,7 +410,7 @@ static int bcmgenet_mii_of_init(struct bif (!compat)return -ENOMEM ; - mdio_dn =of_find_compatible_node (dn,NULL , compat); + mdio_dn =of_get_compatible_child (dn, compat);kfree (compat);if (!mdio_dn) {dev_err (kdev,"unable to find MDIO bus node\n" );
PATCH 112/305 smb3: allow stats which track session and share reconnects to be reset
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 2c887635cd6ab3af619dc2be94e5bf8f2e172b78 upstream.
Currently, "echo 0 > /proc/fs/cifs/Stats" resets all of the stats except the session and share reconnect counts. Fix it to reset those as well.
--- fs/cifs/cifs_debug.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cifs/cifs_debug.c +3 -0
@@ -383,6 +383,9 @@ static int cifs_stats_proc_show(struct sif (server->ops->print_stats) server->ops->print_stats (m, tcon); } +atomic_set (&tcpSesReconnectCount,0 ); +atomic_set (&tconInfoReconnectCount,0 ); + } }spin_unlock (&cifs_tcp_ses_lock);
PATCH 113/305 smb3: do not attempt cifs operation in smb3 query info error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 1e77a8c204c9d1b655c61751b8ad0fde22421dbb upstream.
If backupuid mount option is sent, we can incorrectly retry (on access denied on query info) with a cifs (FindFirst) operation on an smb3 mount which causes the server to force the session close.
We set backup intent on open so no need for this fallback.
See kernel bugzilla 201435
--- fs/cifs/inode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/cifs/inode.c +9 -1
@@ -735,7 +735,15 @@ cifs_get_inode_info(struct inode **inode }else if (rc == -EREMOTE ) {cifs_create_dfs_fattr (&fattr, sb); rc =0 ; - }else if (rc == -EACCES &&backup_cred (cifs_sb)) { + }else if ((rc == -EACCES ) &&backup_cred (cifs_sb) && + (strcmp (server->vals->version_string,SMB1_VERSION_STRING ) + ==0 )) { +/* +* For SMB2 and later the backup intent flag is already +* sent if needed on open and there is no path based +* FindFirst operation to use to retry with +*/ + srchinf =kzalloc (sizeof (struct cifs_search_info ),GFP_KERNEL );if (srchinf ==NULL ) {
PATCH 114/305 thermal: rcar_thermal: Prevent hardware access during system suspend
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 3a31386217628ffe2491695be2db933c25dde785 upstream.
On r8a7791/koelsch, sometimes the following message is printed during system suspend:
rcar_thermal e61f0000.thermal: thermal sensor was broken
This happens if the workqueue runs while the device is already suspended. Fix this by using the freezable system workqueue instead, cfr. commit 51e20d0e3a60cf46 ("thermal: Prevent polling from happening during system suspend").
--- drivers/thermal/rcar_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/rcar_thermal.c +2 -2
@@ -351,8 +351,8 @@ static irqreturn_t rcar_thermal_irq(intrcar_thermal_for_each_priv (priv, common) {if (rcar_thermal_had_changed (priv, status)) {rcar_thermal_irq_disable (priv); -schedule_delayed_work (&priv->work, -msecs_to_jiffies (300 )); +queue_delayed_work (system_freezable_wq, &priv->work, +msecs_to_jiffies (300 )); } }
PATCH 115/305 thermal: rcar: Make error and remove paths symmetrical with init
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit ac71c7025ebc1ed25114b1be77dc60b7f8cb8544 upstream.
Swap interrupt disable and thermal zone unregistration in the error and remove paths, to make them more symmetrical with the initialization path.
--- drivers/thermal/rcar_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/rcar_thermal.c +2 -2
@@ -462,9 +462,9 @@ static int rcar_thermal_probe(struct pla error_unregister:rcar_thermal_for_each_priv (priv, common) { -thermal_zone_device_unregister (priv->zone);if (rcar_has_irq_support (priv))rcar_thermal_irq_disable (priv); +thermal_zone_device_unregister (priv->zone); }pm_runtime_put (dev);
@@ -480,9 +480,9 @@ static int rcar_thermal_remove(struct plstruct rcar_thermal_priv *priv;rcar_thermal_for_each_priv (priv, common) { -thermal_zone_device_unregister (priv->zone);if (rcar_has_irq_support (priv))rcar_thermal_irq_disable (priv); +thermal_zone_device_unregister (priv->zone); }pm_runtime_put (dev);
PATCH 116/305 thermal: rcar_thermal: Prevent doing work after unbind
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 697ee786f15d7b65c7f3045d45fe3a05d28e0911 upstream.
When testing bind/unbind on r8a7791/koelsch:
WARNING: CPU: 1 PID: 697 at lib/debugobjects.c:329 debug_print_object+0x8c/0xb4
ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x10This happens if the workqueue runs after the device has been unbound. Fix this by cancelling any queued work during remove.
--- drivers/thermal/rcar_thermal.c | 1 + 1 file changed, 1 insertion(+)
drivers/thermal/rcar_thermal.c +1 -0
@@ -464,6 +464,7 @@ error_unregister:rcar_thermal_for_each_priv (priv, common) {if (rcar_has_irq_support (priv))rcar_thermal_irq_disable (priv); +cancel_delayed_work_sync (&priv->work);thermal_zone_device_unregister (priv->zone); }
PATCH 117/305 HID: hiddev: fix potential Spectre v1
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
commit f11274396a538b31bc010f782e05c2ce3f804c13 upstream.
uref->usage_index can be indirectly controlled by userspace, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
This field is used as an array index by the hiddev_ioctl_usage() function, when 'cmd' is either HIDIOCGCOLLECTIONINDEX, HIDIOCGUSAGES or HIDIOCSUSAGES.
For cmd == HIDIOCGCOLLECTIONINDEX case, uref->usage_index is compared to field->maxusage and then used as an index to dereference field->usage array. The same thing happens to the cmd == HIDIOC{G,S}USAGES cases, where uref->usage_index is checked against an array maximum value and then it is used as an index in an array.
This is a summary of the HIDIOCGCOLLECTIONINDEX case, which matches the traditional Spectre V1 first load:
copy_from_user(uref, user_arg, sizeof(*uref)) if (uref->usage_index >= field->maxusage) goto inval; i = field->usage[uref->usage_index].collection_index; return i;
This patch fixes this by sanitizing field uref->usage_index before using it to index field->usage (HIDIOCGCOLLECTIONINDEX) or field->value in HIDIOC{G,S}USAGES arrays, thus, avoiding speculation in the first load.
--
v2: Contemplate cmd == HIDIOC{G,S}USAGES case
--- drivers/hid/usbhid/hiddev.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/hid/usbhid/hiddev.c +14 -4
@@ -521,14 +521,24 @@ static noinline int hiddev_ioctl_usage(sif (cmd ==HIDIOCGCOLLECTIONINDEX ) {if (uref->usage_index >= field->maxusage) goto inval; + uref->usage_index = +array_index_nospec (uref->usage_index, + field->maxusage); }else if (uref->usage_index >= field->report_count) goto inval; } -if ((cmd ==HIDIOCGUSAGES || cmd ==HIDIOCSUSAGES ) && - (uref_multi->num_values >HID_MAX_MULTI_USAGES || - uref->usage_index + uref_multi->num_values > field->report_count)) - goto inval; +if (cmd ==HIDIOCGUSAGES || cmd ==HIDIOCSUSAGES ) { +if (uref_multi->num_values >HID_MAX_MULTI_USAGES || + uref->usage_index + uref_multi->num_values > + field->report_count) + goto inval; + + uref->usage_index = +array_index_nospec (uref->usage_index, + field->report_count - + uref_multi->num_values); + }switch (cmd) {case HIDIOCGUSAGE :
PATCH 118/305 ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Brivio <[email protected]>
commit ee1abcf689353f36d9322231b4320926096bdee0 upstream.
Commit a61bbcf28a8c ("[NET]: Store skb->timestamp as offset to a base timestamp") introduces a neighbour control buffer and zeroes it out in ndisc_rcv(), as ndisc_recv_ns() uses it.
Commit f2776ff04722 ("[IPV6]: Fix address/interface handling in UDP and DCCP, according to the scoping architecture.") introduces the usage of the IPv6 control buffer in protocol error handlers (e.g. inet6_iif() in present-day __udp6_lib_err()).
Now, with commit b94f1c0904da ("ipv6: Use icmpv6_notify() to propagate redirect, instead of rt6_redirect()."), we call protocol error handlers from ndisc_redirect_rcv(), after the control buffer is already stolen and some parts are already zeroed out. This implies that inet6_iif() on this path will always return zero.
This gives unexpected results on UDP socket lookup in __udp6_lib_err(), as we might actually need to match sockets for a given interface.
Instead of always claiming the control buffer in ndisc_rcv(), do that only when needed.
--- net/ipv6/ndisc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv6/ndisc.c +1 -2
@@ -1568,10 +1568,9 @@ int ndisc_rcv(struct sk_buff *skb)return 0 ; } -memset (NEIGH_CB (skb),0 ,sizeof (struct neighbour_cb )); -switch (msg->icmph.icmp6_type) {case NDISC_NEIGHBOUR_SOLICITATION : +memset (NEIGH_CB (skb),0 ,sizeof (struct neighbour_cb ));ndisc_recv_ns (skb);break ;
PATCH 119/305 hugetlbfs: dirty pages as they are added to pagecache
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Kravetz <[email protected]>
commit 22146c3ce98962436e401f7b7016a6f664c9ffb5 upstream.
Some test systems were experiencing negative huge page reserve counts and incorrect file block counts. This was traced to /proc/sys/vm/drop_caches removing clean pages from hugetlbfs file pagecaches. When non-hugetlbfs explicit code removes the pages, the appropriate accounting is not performed.
This can be recreated as follows:
fallocate -l 2M /dev/hugepages/foo
echo 1 > /proc/sys/vm/drop_caches
fallocate -l 2M /dev/hugepages/foo
grep -i huge /proc/meminfo
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
HugePages_Total: 2048
HugePages_Free: 2047
HugePages_Rsvd: 18446744073709551615
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 4194304 kB
ls -lsh /dev/hugepages/foo
4.0M -rw-r--r--. 1 root root 2.0M Oct 17 20:05 /dev/hugepages/foo
To address this issue, dirty pages as they are added to pagecache. This can easily be reproduced with fallocate as shown above. Read faulted pages will eventually end up being marked dirty. But there is a window where they are clean and could be impacted by code such as drop_caches. So, just dirty them all as they are added to the pagecache.
--- mm/hugetlb.c | 6 ++++++ 1 file changed, 6 insertions(+)
mm/hugetlb.c +6 -0
@@ -3085,6 +3085,12 @@ retry: }ClearPagePrivate (page); +/* +* set page dirty so that it will not be removed from +* cache/file by non-hugetlbfs specific code paths. +*/ +set_page_dirty (page); +spin_lock (&inode->i_lock); inode->i_blocks +=blocks_per_huge_page (h);spin_unlock (&inode->i_lock);
PATCH 120/305 net: sched: gred: pass the right attribute to gred_change_table_def()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
commit 38b4f18d56372e1e21771ab7b0357b853330186c upstream.
gred_change_table_def() takes a pointer to TCA_GRED_DPS attribute, and expects it will be able to interpret its contents as struct tc_gred_sopt. Pass the correct gred attribute, instead of TCA_OPTIONS.
This bug meant the table definition could never be changed after Qdisc was initialized (unless whatever TCA_OPTIONS contained both passed netlink validation and was a valid struct tc_gred_sopt...).
Old behaviour:
$ ip link add type dummy
$ tc qdisc replace dev dummy0 parent root handle 7: \
gred setup vqs 4 default 0
$ tc qdisc replace dev dummy0 parent root handle 7: \
gred setup vqs 4 default 0
RTNETLINK answers: Invalid argumentNow:
$ ip link add type dummy
$ tc qdisc replace dev dummy0 parent root handle 7: \
gred setup vqs 4 default 0
$ tc qdisc replace dev dummy0 parent root handle 7: \
gred setup vqs 4 default 0
$ tc qdisc replace dev dummy0 parent root handle 7: \
gred setup vqs 4 default 0--- net/sched/sch_gred.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_gred.c +1 -1
@@ -437,7 +437,7 @@ static int gred_change(struct Qdisc *schreturn err;if (tb[TCA_GRED_PARMS ] ==NULL && tb[TCA_GRED_STAB ] ==NULL ) -return gred_change_table_def (sch, opt); +return gred_change_table_def (sch, tb[TCA_GRED_DPS ]);if (tb[TCA_GRED_PARMS ] ==NULL || tb[TCA_GRED_STAB ] ==NULL )
PATCH 121/305 ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Stanoev <[email protected]>
commit ac237c28d5ac1b241d58b1b7b4b9fa10efb22fb5 upstream.
The Creative Audigy SE (SB0570) card currently exhibits an audible pop whenever playback is stopped or resumed, or during silent periods of an audio stream. Initialise the IZD bit to the 0 to eliminate these pops.
The Infinite Zero Detection (IZD) feature on the DAC causes the output to be shunted to Vcap after 2048 samples of silence. This discharges the AC coupling capacitor through the output and causes the aforementioned pop/click noise.
The behaviour of the IZD bit is described on page 15 of the WM8768GEDS
datasheet: "With IZD=1, applying MUTE for 1024 consecutive input samples will cause all outputs to be connected directly to VCAP. This also happens if 2048 consecutive zero input samples are applied to all 6 channels, and IZD=0. It will be removed as soon as any channel receives a non-zero input". I believe the second sentence might be referring to IZD=1 instead of IZD=0 given the observed behaviour of the card.
This change should make the DAC initialisation consistent with Creative's Windows driver, as this popping persists when initialising the card in Linux and soft rebooting into Windows, but is not present on a cold boot to Windows.
--- sound/pci/ca0106/ca0106.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/ca0106/ca0106.h +1 -1
@@ -582,7 +582,7 @@#define SPI_PL_BIT_R_R (2<<7)/* right channel = right */ #define SPI_PL_BIT_R_C (3<<7)/* right channel = (L+R)/2 */ #define SPI_IZD_REG 2 -#define SPI_IZD_BIT (1<<4)/* infinite zero detect */ +#define SPI_IZD_BIT (0<<4)/* infinite zero detect */ #define SPI_FMT_REG 3#define SPI_FMT_BIT_RJ (0<<0)/* right justified mode */
PATCH 122/305 nfsd: Fix an Oops in free_session()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit bb6ad5572c0022e17e846b382d7413cdcf8055be upstream.
In call_xpt_users(), we delete the entry from the list, but we do not reinitialise it. This triggers the list poisoning when we later call unregister_xpt_user() in nfsd4_del_conns().
--- net/sunrpc/svc_xprt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/svc_xprt.c +1 -1
@@ -906,7 +906,7 @@ static void call_xpt_users(struct svc_xpspin_lock (&xprt->xpt_lock);while (!list_empty (&xprt->xpt_users)) { u = list_first_entry(&xprt->xpt_users, struct svc_xpt_user, list); -list_del (&u->list); +list_del_init (&u->list); u->callback (u); }spin_unlock (&xprt->xpt_lock);
PATCH 123/305 lockd: fix access beyond unterminated strings in prints
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit 93f38b6fae0ea8987e22d9e6c38f8dfdccd867ee upstream.
printk format used %*s instead of %.*s, so hostname_len does not limit the number of bytes accessed from hostname.
--- fs/lockd/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/lockd/host.c +1 -1
@@ -339,7 +339,7 @@ struct nlm_host *nlmsvc_lookup_host(cons };struct lockd_net *ln =net_generic (net, lockd_net_id); -dprintk ("lockd: %s(host='%*s', vers=%u, proto=%s)\n" , __func__, +dprintk ("lockd: %s(host='%.*s', vers=%u, proto=%s)\n" , __func__, (int )hostname_len, hostname, rqstp->rq_vers, (rqstp->rq_prot ==IPPROTO_UDP ?"udp" :"tcp" ));
PATCH 124/305 um: Drop own definition of PTRACE_SYSEMU/_SINGLESTEP
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 0676b957c24bfb6e495449ba7b7e72c5b5d79233 upstream.
32bit UML used to define PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP own its own because many years ago not all libcs had these request codes in their UAPI.
These days PTRACE_SYSEMU/_SINGLESTEP is well known and part of glibc and our own define becomes problematic.
With change c48831d0eebf ("linux/x86: sync sys/ptrace.h with Linux 4.14 [BZ #22433]") glibc turned PTRACE_SYSEMU/_SINGLESTEP into a enum and UML failed to build.
Let's drop our define and rely on the fact that every libc has PTRACE_SYSEMU/_SINGLESTEP.
--- arch/x86/um/shared/sysdep/ptrace_32.h | 10 ---------- 1 file changed, 10 deletions(-)
arch/x86/um/shared/sysdep/ptrace_32.h +0 -10
@@ -10,20 +10,10 @@static inline void update_debugregs (int seq) {} -/* syscall emulation path in ptrace */ - -#ifndef PTRACE_SYSEMU -#define PTRACE_SYSEMU 31 -#endif -void set_using_sysemu (int value);int get_using_sysemu (void );extern int sysemu_supported; -#ifndef PTRACE_SYSEMU_SINGLESTEP -#define PTRACE_SYSEMU_SINGLESTEP 32 -#endif -#define UPT_SYSCALL_ARG1 (r) UPT_BX(r)#define UPT_SYSCALL_ARG2 (r) UPT_CX(r)#define UPT_SYSCALL_ARG3 (r) UPT_DX(r)
PATCH 125/305 um: Give start_idle_thread() a return code
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 7ff1e34bbdc15acab823b1ee4240e94623d50ee8 upstream.
Fixes:arch/um/os-Linux/skas/process.c:613:1: warning: control reaches end of non-void function [-Wreturn-type]
longjmp() never returns but gcc still warns that the end of the function can be reached.
Add a return code and debug aid to detect this impossible case.
--- arch/um/os-Linux/skas/process.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/um/os-Linux/skas/process.c +5 -0
@@ -694,6 +694,11 @@ int start_idle_thread(void *stack, jmp_bfatal_sigsegv (); }longjmp (*switch_buf,1 ); + +/* unreachable */ +printk (UM_KERN_ERR "impossible long jump!" ); +fatal_sigsegv (); +return 0 ; }void initial_thread_cb_skas (void (*proc)(void *),void *arg)
PATCH 126/305 xtensa: add NOTES section to the linker script
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 4119ba211bc4f1bf638f41e50b7a0f329f58aa16 upstream.
This section collects all source .note.* sections together in the vmlinux image. Without it .note.Linux section may be placed at address 0, while the rest of the kernel is at its normal address, resulting in a huge vmlinux.bin image that may not be linked into the xtensa Image.elf.
--- arch/xtensa/boot/Makefile | 2 +- arch/xtensa/kernel/vmlinux.lds.S | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/boot/Makefile +1 -1
@@ -31,7 +31,7 @@ $(bootdir-y): $(addprefix $(obj)/,$(subd $(addprefix $(obj)/,$(host-progs)) $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) -OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary +OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary vmlinux.bin: vmlinux FORCE $(call if_changed,objcopy)
arch/xtensa/kernel/vmlinux.lds.S +1 -0
@@ -110,6 +110,7 @@ SECTIONS .fixup : { *(.fixup) } EXCEPTION_TABLE(16) + NOTES /* Data section */ _sdata = .;
PATCH 127/305 rtnetlink: Disallow FDB configuration for non-Ethernet device
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
commit da71577545a52be3e0e9225a946e5fd79cfab015 upstream.
When an FDB entry is configured, the address is validated to have the length of an Ethernet address, but the device for which the address is configured can be of any type.
The above can result in the use of uninitialized memory when the address is later compared against existing addresses since 'dev->addr_len' is used and it may be greater than ETH_ALEN, as with ip6tnl devices.
Fix this by making sure that FDB entries are only configured for Ethernet devices.
BUG: KMSAN: uninit-value in memcmp+0x11d/0x180 lib/string.c:863 CPU: 1 PID: 4318 Comm: syz-executor998 Not tainted 4.19.0-rc3+ #49 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+0x14b/0x190 lib/dump_stack.c:113 kmsan_report+0x183/0x2b0 mm/kmsan/kmsan.c:956 __msan_warning+0x70/0xc0 mm/kmsan/kmsan_instr.c:645 memcmp+0x11d/0x180 lib/string.c:863 dev_uc_add_excl+0x165/0x7b0 net/core/dev_addr_lists.c:464 ndo_dflt_fdb_add net/core/rtnetlink.c:3463 [inline] rtnl_fdb_add+0x1081/0x1270 net/core/rtnetlink.c:3558 rtnetlink_rcv_msg+0xa0b/0x1530 net/core/rtnetlink.c:4715 netlink_rcv_skb+0x36e/0x5f0 net/netlink/af_netlink.c:2454 rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4733 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x1638/0x1720 net/netlink/af_netlink.c:1343 netlink_sendmsg+0x1205/0x1290 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg net/socket.c:631 [inline] ___sys_sendmsg+0xe70/0x1290 net/socket.c:2114 __sys_sendmsg net/socket.c:2152 [inline] __do_sys_sendmsg net/socket.c:2161 [inline] __se_sys_sendmsg+0x2a3/0x3d0 net/socket.c:2159 __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2159 do_syscall_64+0xb8/0x100 arch/x86/entry/common.c:291 entry_SYSCALL_64_after_hwframe+0x63/0xe7 RIP: 0033:0x440ee9 Code: e8 cc ab 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 bb 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fff6a93b518 EFLAGS: 00000213 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000440ee9
RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000213 R12: 000000000000b4b0
R13: 0000000000401ec0 R14: 0000000000000000 R15: 0000000000000000
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:256 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:181 kmsan_kmalloc+0x98/0x100 mm/kmsan/kmsan_hooks.c:91 kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan_hooks.c:100 slab_post_alloc_hook mm/slab.h:446 [inline] slab_alloc_node mm/slub.c:2718 [inline] __kmalloc_node_track_caller+0x9e7/0x1160 mm/slub.c:4351 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2f5/0x9e0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:996 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1189 [inline] netlink_sendmsg+0xb49/0x1290 net/netlink/af_netlink.c:1883 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg net/socket.c:631 [inline] ___sys_sendmsg+0xe70/0x1290 net/socket.c:2114 __sys_sendmsg net/socket.c:2152 [inline] __do_sys_sendmsg net/socket.c:2161 [inline] __se_sys_sendmsg+0x2a3/0x3d0 net/socket.c:2159 __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2159 do_syscall_64+0xb8/0x100 arch/x86/entry/common.c:291 entry_SYSCALL_64_after_hwframe+0x63/0xe7
v2:
* Make error message more specific (David)
--- net/core/rtnetlink.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/core/rtnetlink.c +10 -0
@@ -2360,6 +2360,11 @@ static int rtnl_fdb_add(struct sk_buff *return -EINVAL ; } +if (dev->type !=ARPHRD_ETHER ) { +pr_info ("PF_BRIDGE: FDB add only supported for Ethernet devices\n" ); +return -EINVAL ; + } + addr =nla_data (tb[NDA_LLADDR ]); err = -EOPNOTSUPP ;
@@ -2457,6 +2462,11 @@ static int rtnl_fdb_del(struct sk_buff *return -EINVAL ; } +if (dev->type !=ARPHRD_ETHER ) { +pr_info ("PF_BRIDGE: FDB delete only supported for Ethernet devices\n" ); +return -EINVAL ; + } + addr =nla_data (tb[NDA_LLADDR ]); err = -EOPNOTSUPP ;
PATCH 128/305 Cramfs: fix abad comparison when wrap-arounds occur
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
commit 672ca9dd13f1aca0c17516f76fc5b0e8344b3e46 upstream.
It is possible for corrupted filesystem images to produce very large block offsets that may wrap when a length is added, and wrongly pass the buffer size test.
--- fs/cramfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cramfs/inode.c +2 -1
@@ -183,7 +183,8 @@ static void *cramfs_read(struct super_blcontinue ; blk_offset = (blocknr - buffer_blocknr[i]) <<PAGE_CACHE_SHIFT ; blk_offset += offset; -if (blk_offset + len >BUFFER_SIZE ) +if (blk_offset >BUFFER_SIZE || + blk_offset + len >BUFFER_SIZE )continue ;return read_buffers[i] + blk_offset; }
PATCH 129/305 kbuild: fix kernel/bounds.c 'W=1' warning
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 6a32c2469c3fbfee8f25bcd20af647326650a6cf upstream.
Building any configuration with 'make W=1' produces a warning:
kernel/bounds.c:16:6: warning: no previous prototype for 'foo' [-Wmissing-prototypes]
When also passing -Werror, this prevents us from building any other files. Nobody ever calls the function, but we can't make it 'static' either since we want the compiler output.
Calling it 'main' instead however avoids the warning, because gcc does not insist on having a declaration for main.
--- kernel/bounds.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/bounds.c +3 -1
@@ -13,7 +13,7 @@#include <linux/log2.h> #include <linux/spinlock_types.h> -void foo (void ) +int main (void ) {/* The enum constants to put into include/generated/bounds.h */ DEFINE (NR_PAGEFLAGS , __NR_PAGEFLAGS);
@@ -24,4 +24,6 @@ void foo(void)#endif DEFINE (SPINLOCK_SIZE ,sizeof (spinlock_t));/* End of constants */ + +return 0 ; }
PATCH 130/305 smb3: on kerberos mount if server doesn't specify auth type use krb5
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 926674de6705f0f1dbf29a62fd758d0977f535d6 upstream.
Some servers (e.g. Azure) do not include a spnego blob in the SMB3 negotiate protocol response, so on kerberos mounts ("sec=krb5") we can fail, as we expected the server to list its supported auth types (OIDs in the spnego blob in the negprot response). Change this so that on krb5 mounts we default to trying krb5 if the server doesn't list its supported protocol mechanisms.
--- fs/cifs/cifs_spnego.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/cifs/cifs_spnego.c +4 -2
@@ -148,8 +148,10 @@ cifs_get_spnego_key(struct cifs_ses *sessprintf (dp,";sec=krb5" ); else if (server->sec_mskerberos) sprintf(dp, ";sec=mskrb5"); - else - goto out; + else { +cifs_dbg (VFS ,"unknown or missing server auth type, use krb5\n" ); +sprintf (dp,";sec=krb5" ); + } dp = description +strlen (description); sprintf(dp, ";uid=0x%x",
PATCH 131/305 netfilter: x_tables: add and use xt_check_proc_name
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit b1d0a5d0cba4597c0394997b2d5fced3e3841b4e upstream.
recent and hashlimit both create /proc files, but only check that name is 0 terminated.
This can trigger WARN() from procfs when name is "" or "/". Add helper for this and then use it for both.
[bwh: Backported to 3.16:
- xt_hashlimit has only one check function
- Adjust context]
---
include/linux/netfilter/x_tables.h +2 -0
@@ -247,6 +247,8 @@ unsigned int *xt_alloc_entry_offsets(unsbool xt_find_jump_offset (const unsigned int *offsets,unsigned int target,unsigned int size); +int xt_check_proc_name (const char *name,unsigned int size); +int xt_check_match (struct xt_mtchk_param *,unsigned int size,u_int8_t proto,bool inv_proto); int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
net/netfilter/x_tables.c +30 -0
@@ -380,6 +380,36 @@ textify_hooks(char *buf, size_t size, unreturn buf; } +/** +* xt_check_proc_name - check that name is suitable for /proc file creation +* +* @name: file name candidate +* @size: length of buffer +* +* some x_tables modules wish to create a file in /proc. +* This function makes sure that the name is suitable for this +* purpose, it checks that name is NUL terminated and isn't a 'special' +* name, like "..". +* +* returns negative number on error or 0 if name is useable. +*/ +int xt_check_proc_name (const char *name,unsigned int size) +{ +if (name[0 ] =='\0' ) +return -EINVAL ; + +if (strnlen (name, size) == size) +return -ENAMETOOLONG ; + +if (strcmp (name,"." ) ==0 || +strcmp (name,".." ) ==0 || +strchr (name,'/' )) +return -EINVAL ; + +return 0 ; +} +EXPORT_SYMBOL (xt_check_proc_name); +int xt_check_match (struct xt_mtchk_param *par,unsigned int size,u_int8_t proto,bool inv_proto) {
net/netfilter/xt_hashlimit.c +3 -2
@@ -668,8 +668,9 @@ static int hashlimit_mt_check(const struif (info->cfg.gc_interval ==0 || info->cfg.expire ==0 )return -EINVAL ; -if (info->name[sizeof (info->name)-1 ] !='\0' ) -return -EINVAL ; + ret =xt_check_proc_name (info->name,sizeof (info->name)); +if (ret) +return ret;if (par->family ==NFPROTO_IPV4 ) {if (info->cfg.srcmask >32 || info->cfg.dstmask >32 )return -EINVAL ;
net/netfilter/xt_recent.c +3 -3
@@ -355,9 +355,9 @@ static int recent_mt_check(const struct info->hit_count, ip_pkt_list_tot);return -EINVAL ; } -if (info->name[0 ] =='\0' || -strnlen (info->name,XT_RECENT_NAME_LEN ) ==XT_RECENT_NAME_LEN ) -return -EINVAL ; + ret =xt_check_proc_name (info->name,sizeof (info->name)); +if (ret) +return ret;mutex_lock (&recent_mutex); t =recent_table_lookup (recent_net, info->name);
PATCH 132/305 netfilter: xt_IDLETIMER: add sysfs filename checking routine
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Taehee Yoo <[email protected]>
commit 54451f60c8fa061af9051a53be9786393947367c upstream.
When IDLETIMER rule is added, sysfs file is created under /sys/class/xt_idletimer/timers/
But some label name shouldn't be used.
".", "..", "power", "uevent", "subsystem", etc... So that sysfs filename checking routine is needed.
test commands:
%iptables -I INPUT -j IDLETIMER --timeout 1 --label "power"
splat looks like:
[95765.423132] sysfs: cannot create duplicate filename '/devices/virtual/xt_idletimer/timers/power' [95765.433418] CPU: 0 PID: 8446 Comm: iptables Not tainted 4.19.0-rc6+ #20 [95765.449755] Call Trace: [95765.449755] dump_stack+0xc9/0x16b [95765.449755] ? show_regs_print_info+0x5/0x5 [95765.449755] sysfs_warn_dup+0x74/0x90 [95765.449755] sysfs_add_file_mode_ns+0x352/0x500 [95765.449755] sysfs_create_file_ns+0x179/0x270 [95765.449755] ? sysfs_add_file_mode_ns+0x500/0x500 [95765.449755] ? idletimer_tg_checkentry+0x3e5/0xb1b [xt_IDLETIMER] [95765.449755] ? rcu_read_lock_sched_held+0x114/0x130 [95765.449755] ? __kmalloc_track_caller+0x211/0x2b0 [95765.449755] ? memcpy+0x34/0x50 [95765.449755] idletimer_tg_checkentry+0x4e2/0xb1b [xt_IDLETIMER]
[ ... ]
--- net/netfilter/xt_IDLETIMER.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
net/netfilter/xt_IDLETIMER.c +20 -0
@@ -116,6 +116,22 @@ static void idletimer_tg_expired(unsigneschedule_work (&timer->work); } +static int idletimer_check_sysfs_name (const char *name,unsigned int size) +{ +int ret; + + ret =xt_check_proc_name (name, size); +if (ret <0 ) +return ret; + +if (!strcmp (name,"power" ) || + !strcmp (name,"subsystem" ) || + !strcmp (name,"uevent" )) +return -EINVAL ; + +return 0 ; +} +static int idletimer_tg_create (struct idletimer_tg_info *info) {int ret;
@@ -126,6 +142,10 @@ static int idletimer_tg_create(struct id goto out; } + ret =idletimer_check_sysfs_name (info->label,sizeof (info->label)); +if (ret <0 ) + goto out_free_timer; + info->timer->attr.attr.name =kstrdup (info->label,GFP_KERNEL );if (!info->timer->attr.attr.name) { ret = -ENOMEM ;
PATCH 133/305 ocfs2: fix a misuse a of brelse after failing ocfs2_check_dir_entry
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Changwei Ge <[email protected]>
commit 29aa30167a0a2e6045a0d6d2e89d8168132333d5 upstream.
Somehow, file system metadata was corrupted, which causes ocfs2_check_dir_entry() to fail in function ocfs2_dir_foreach_blk_el().
According to the original design intention, if above happens we should skip the problematic block and continue to retrieve dir entry. But there is obviouse misuse of brelse around related code.
After failure of ocfs2_check_dir_entry(), current code just moves to next position and uses the problematic buffer head again and again during which the problematic buffer head is released for multiple times. I suppose, this a serious issue which is long-lived in ocfs2. This may cause other file systems which is also used in a the same host insane.
So we should also consider about bakcporting this patch into linux -stable.
--- fs/ocfs2/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ocfs2/dir.c +1 -2
@@ -1906,8 +1906,7 @@ static int ocfs2_dir_foreach_blk_el(stru/* On error, skip the f_pos to the next block. */ ctx->pos = (ctx->pos | (sb->s_blocksize -1 )) +1 ; -brelse (bh); -continue ; +break ; }if (le64_to_cpu (de->inode)) {unsigned char d_type =DT_UNKNOWN ;
PATCH 134/305 memory_hotplug: cond_resched in __remove_pages
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit dd33ad7b251f900481701b2a82d25de583867708 upstream.
We have received a bug report that unbinding a large pmem (>1TB) can result in a soft lockup:
NMI watchdog: BUG: soft lockup - CPU#9 stuck for 23s! [ndctl:4365] [...]
Supported: Yes
CPU: 9 PID: 4365 Comm: ndctl Not tainted 4.12.14-94.40-default #1 SLE12-SP4 Hardware name: Intel Corporation S2600WFD/S2600WFD, BIOS SE5C620.86B.01.00.0833.051120182255 05/11/2018 task: ffff9cce7d4410c0 task.stack: ffffbe9eb1bc4000 RIP: 0010:__put_page+0x62/0x80 Call Trace: devm_memremap_pages_release+0x152/0x260 release_nodes+0x18d/0x1d0 device_release_driver_internal+0x160/0x210 unbind_store+0xb3/0xe0 kernfs_fop_write+0x102/0x180 __vfs_write+0x26/0x150 vfs_write+0xad/0x1a0 SyS_write+0x42/0x90 do_syscall_64+0x74/0x150 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x7fd13166b3d0
It has been reported on an older (4.12) kernel but the current upstream code doesn't cond_resched in the hot remove code at all and the given range to remove might be really large. Fix the issue by calling cond_resched once per memory section.
--- mm/memory_hotplug.c | 1 + 1 file changed, 1 insertion(+)
mm/memory_hotplug.c +2 -0
@@ -780,6 +780,8 @@ int __remove_pages(struct zone *zone, un sections_to_remove = nr_pages /PAGES_PER_SECTION ;for (i =0 ; i < sections_to_remove; i++) {unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION ; + +cond_resched (); ret =__remove_section (zone,__pfn_to_section (pfn));if (ret)break ;
PATCH 135/305 ext4: avoid potential extra brelse in setup_new_flex_group_blocks()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit 9e4028935cca3f9ef9b6a90df9da6f1f94853536 upstream.
Currently bh is set to NULL only during first iteration of for cycle, then this pointer is not cleared after end of using.
Therefore rollback after errors can lead to extra brelse(bh) call, decrements bh counter and later trigger an unexpected warning in __brelse()
Patch moves brelse() calls in body of cycle to exclude requirement of brelse() call in rollback.
--- fs/ext4/resize.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
fs/ext4/resize.c +2 -6
@@ -588,7 +588,6 @@ handle_bb: bh =bclean (handle, sb, block);if (IS_ERR (bh)) { err =PTR_ERR (bh); - bh =NULL ; goto out; } overhead =ext4_group_overhead_blocks (sb, group);
@@ -600,9 +599,9 @@ handle_bb:ext4_mark_bitmap_end (group_data[i].blocks_count, sb->s_blocksize *8 , bh->b_data); err =ext4_handle_dirty_metadata (handle,NULL , bh); +brelse (bh);if (err) goto out; -brelse (bh); handle_ib:if (bg_flags[i] &EXT4_BG_INODE_UNINIT )
@@ -617,18 +616,16 @@ handle_ib: bh =bclean (handle, sb, block);if (IS_ERR (bh)) { err =PTR_ERR (bh); - bh =NULL ; goto out; }ext4_mark_bitmap_end (EXT4_INODES_PER_GROUP (sb), sb->s_blocksize *8 , bh->b_data); err =ext4_handle_dirty_metadata (handle,NULL , bh); +brelse (bh);if (err) goto out; -brelse (bh); } - bh =NULL ;/* Mark group tables in block bitmap */ for (j =0 ; j <GROUP_TABLE_COUNT ; j++) {
@@ -659,7 +656,6 @@ handle_ib: } out: -brelse (bh); err2 =ext4_journal_stop (handle);if (err2 && !err) err = err2;
PATCH 136/305 ext4: add missing brelse() in set_flexbg_block_bitmap()'s error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit cea5794122125bf67559906a0762186cf417099c upstream.
--- fs/ext4/resize.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext4/resize.c +4 -2
@@ -442,16 +442,18 @@ static int set_flexbg_block_bitmap(strucBUFFER_TRACE (bh,"get_write_access" ); err =ext4_journal_get_write_access (handle, bh); -if (err) +if (err) { +brelse (bh);return err; + }ext4_debug ("mark block bitmap %#04llx (+%llu/%u)\n" , block, block - start, count2);ext4_set_bits (bh->b_data, block - start, count2); err =ext4_handle_dirty_metadata (handle,NULL , bh); +brelse (bh);if (unlikely (err))return err; -brelse (bh); }return 0 ;
PATCH 137/305 ext4: add missing brelse() add_new_gdb_meta_bg()'s error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit 61a9c11e5e7a0dab5381afa5d9d4dd5ebf18f7a0 upstream.
--- fs/ext4/resize.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/ext4/resize.c +1 -2
@@ -896,6 +896,7 @@ static int add_new_gdb_meta_bg(struct susizeof (struct buffer_head *), GFP_NOFS);if (!n_group_desc) { +brelse (gdb_bh); err = -ENOMEM ;ext4_warning (sb,"not enough memory for %lu groups" , gdb_num +1 );
@@ -911,8 +912,6 @@ static int add_new_gdb_meta_bg(struct suext4_kvfree (o_group_desc);BUFFER_TRACE (gdb_bh,"get_write_access" ); err =ext4_journal_get_write_access (handle, gdb_bh); -if (unlikely (err)) -brelse (gdb_bh);return err; }
PATCH 138/305 ext4: add missing brelse() update_backups()'s error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit ea0abbb648452cdb6e1734b702b6330a7448fcf8 upstream.
--- fs/ext4/resize.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/resize.c +3 -1
@@ -1093,8 +1093,10 @@ static void update_backups(struct super_ backup_block, backup_block - ext4_group_first_block_no(sb, group));BUFFER_TRACE (bh,"get_write_access" ); -if ((err =ext4_journal_get_write_access (handle, bh))) +if ((err =ext4_journal_get_write_access (handle, bh))) { +brelse (bh);break ; + }lock_buffer (bh);memcpy (bh->b_data, data, size);if (rest)
PATCH 139/305 clockevents/drivers/i8253: Add support for PIT shutdown quirk
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 35b69a420bfb56b7b74cb635ea903db05e357bec upstream.
Add support for platforms where pit_shutdown() doesn't work because of a quirk in the PIT emulation. On these platforms setting the counter register to zero causes the PIT to start running again, negating the shutdown.
Provide a global variable that controls whether the counter register is zero'ed, which platform specific code can override.
[bwh: Backported to 3.16:
- Don't use __ro_after_init
- Adjust context, indentation]
--- drivers/clocksource/i8253.c | 14 ++++++++++++-- include/linux/i8253.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/clocksource/i8253.c +12 -2
@@ -19,6 +19,13 @@DEFINE_RAW_SPINLOCK (i8253_lock);EXPORT_SYMBOL (i8253_lock); +/* +* Handle PIT quirk in pit_shutdown() where zeroing the counter register +* restarts the PIT, negating the shutdown. On platforms with the quirk, +* platform specific code can set this to false. +*/ +bool i8253_clear_counter_on_shutdown = true; +#ifdef CONFIG_CLKSRC_I8253 /* * Since the PIT overflows every tick, its not very useful
@@ -123,8 +130,11 @@ static void init_pit_timer(enum clock_evif (evt->mode ==CLOCK_EVT_MODE_PERIODIC || evt->mode ==CLOCK_EVT_MODE_ONESHOT ) {outb_p (0x30 ,PIT_MODE ); -outb_p (0 ,PIT_CH0 ); -outb_p (0 ,PIT_CH0 ); + +if (i8253_clear_counter_on_shutdown) { +outb_p (0 ,PIT_CH0 ); +outb_p (0 ,PIT_CH0 ); + } }break ;
include/linux/i8253.h +1 -0
@@ -21,6 +21,7 @@#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)extern raw_spinlock_t i8253_lock; +extern bool i8253_clear_counter_on_shutdown;extern struct clock_event_device i8253_clockevent;extern void clockevent_i8253_init (bool oneshot);
PATCH 139/305 clockevents/drivers/i8253: Add support for PIT shutdown quirk
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 35b69a420bfb56b7b74cb635ea903db05e357bec upstream.
Add support for platforms where pit_shutdown() doesn't work because of a quirk in the PIT emulation. On these platforms setting the counter register to zero causes the PIT to start running again, negating the shutdown.
Provide a global variable that controls whether the counter register is zero'ed, which platform specific code can override.
[bwh: Backported to 3.16:
- Don't use __ro_after_init
- Adjust context, indentation]
--- drivers/clocksource/i8253.c | 14 ++++++++++++-- include/linux/i8253.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/clocksource/i8253.c +12 -2
@@ -19,6 +19,13 @@DEFINE_RAW_SPINLOCK (i8253_lock);EXPORT_SYMBOL (i8253_lock); +/* +* Handle PIT quirk in pit_shutdown() where zeroing the counter register +* restarts the PIT, negating the shutdown. On platforms with the quirk, +* platform specific code can set this to false. +*/ +bool i8253_clear_counter_on_shutdown = true; +#ifdef CONFIG_CLKSRC_I8253 /* * Since the PIT overflows every tick, its not very useful
@@ -123,8 +130,11 @@ static void init_pit_timer(enum clock_evif (evt->mode ==CLOCK_EVT_MODE_PERIODIC || evt->mode ==CLOCK_EVT_MODE_ONESHOT ) {outb_p (0x30 ,PIT_MODE ); -outb_p (0 ,PIT_CH0 ); -outb_p (0 ,PIT_CH0 ); + +if (i8253_clear_counter_on_shutdown) { +outb_p (0 ,PIT_CH0 ); +outb_p (0 ,PIT_CH0 ); + } }break ;
include/linux/i8253.h +1 -0
@@ -21,6 +21,7 @@#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)extern raw_spinlock_t i8253_lock; +extern bool i8253_clear_counter_on_shutdown;extern struct clock_event_device i8253_clockevent;extern void clockevent_i8253_init (bool oneshot);
PATCH 140/305 x86/hyper-v: Enable PIT shutdown quirk
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 1de72c706488b7be664a601cf3843bd01e327e58 upstream.
Hyper-V emulation of the PIT has a quirk such that the normal PIT shutdown path doesn't work, because clearing the counter register restarts the timer.
Disable the counter clearing on PIT shutdown.
--- arch/x86/kernel/cpu/mshyperv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/kernel/cpu/mshyperv.c +11 -0
@@ -18,6 +18,7 @@#include <linux/efi.h> #include <linux/interrupt.h> #include <linux/irq.h> +#include <linux/i8253.h> #include <asm/processor.h> #include <asm/hypervisor.h> #include <asm/hyperv.h>
@@ -143,6 +144,16 @@ static void __init ms_hyperv_init_platfo no_timer_check =1 ;#endif +/* +* Hyper-V VMs have a PIT emulation quirk such that zeroing the +* counter register during PIT shutdown restarts the PIT. So it +* continues to interrupt @18.2 HZ. Setting i8253_clear_counter +* to false tells pit_shutdown() not to zero the counter so that +* the PIT really is shutdown. Generation 2 VMs don't have a PIT, +* and setting this value has no effect. +*/ + i8253_clear_counter_on_shutdown = false; + }const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
PATCH 140/305 x86/hyper-v: Enable PIT shutdown quirk
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Kelley <[email protected]>
commit 1de72c706488b7be664a601cf3843bd01e327e58 upstream.
Hyper-V emulation of the PIT has a quirk such that the normal PIT shutdown path doesn't work, because clearing the counter register restarts the timer.
Disable the counter clearing on PIT shutdown.
--- arch/x86/kernel/cpu/mshyperv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/kernel/cpu/mshyperv.c +11 -0
@@ -18,6 +18,7 @@#include <linux/efi.h> #include <linux/interrupt.h> #include <linux/irq.h> +#include <linux/i8253.h> #include <asm/processor.h> #include <asm/hypervisor.h> #include <asm/hyperv.h>
@@ -143,6 +144,16 @@ static void __init ms_hyperv_init_platfo no_timer_check =1 ;#endif +/* +* Hyper-V VMs have a PIT emulation quirk such that zeroing the +* counter register during PIT shutdown restarts the PIT. So it +* continues to interrupt @18.2 HZ. Setting i8253_clear_counter +* to false tells pit_shutdown() not to zero the counter so that +* the PIT really is shutdown. Generation 2 VMs don't have a PIT, +* and setting this value has no effect. +*/ + i8253_clear_counter_on_shutdown = false; + }const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
PATCH 141/305 mtd: docg3: don't set conflicting BCH_CONST_PARAMS option
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit be2e1c9dcf76886a83fb1c433a316e26d4ca2550 upstream.
I noticed during the creation of another bugfix that the BCH_CONST_PARAMS option that is set by DOCG3 breaks setting variable parameters for any other users of the BCH library code.
The only other user we have today is the MTD_NAND software BCH implementation (most flash controllers use hardware BCH these days and are not affected). I considered removing BCH_CONST_PARAMS entirely because of the inherent conflict, but according to the description in lib/bch.c there is a significant performance benefit in keeping it.
To avoid the immediate problem of the conflict between MTD_NAND_BCH and DOCG3, this only sets the constant parameters if MTD_NAND_BCH is disabled, which should fix the problem for all cases that are affected. This should also work for all stable kernels.
Note that there is only one machine that actually seems to use the DOCG3 driver (arch/arm/mach-pxa/mioa701.c), so most users should have the driver disabled, but it almost certainly shows up if we wanted to test random kernels on machines that use software BCH in MTD.
--- drivers/mtd/devices/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/devices/Kconfig +1 -1
@@ -200,7 +200,7 @@ comment "Disk-On-Chip Device Drivers" config MTD_DOCG3 tristate "M-Systems Disk-On-Chip G3" select BCH - select BCH_CONST_PARAMS + select BCH_CONST_PARAMS if !MTD_NAND_BCH select BITREVERSE ---help--- This provides an MTD device driver for the M-Systems DiskOnChip
PATCH 142/305 sunrpc: correct the computation for page_ptr when truncating
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Frank Sorenson <[email protected]>
commit 5d7a5bcb67c70cbc904057ef52d3fcfeb24420bb upstream.
When truncating the encode buffer, the page_ptr is getting advanced, causing the next page to be skipped while encoding. The page is still included in the response, so the response contains a page of bogus data.
We need to adjust the page_ptr backwards to ensure we encode the next page into the correct place.
We saw this triggered when concurrent directory modifications caused nfsd4_encode_direct_fattr() to return nfserr_noent, and the resulting call to xdr_truncate_encode() corrupted the READDIR reply.
--- net/sunrpc/xdr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/sunrpc/xdr.c +2 -3
@@ -637,11 +637,10 @@ void xdr_truncate_encode(struct xdr_stre/* xdr->iov should already be NULL */ return ; } -if (fraglen) { +if (fraglen) xdr->end = head->iov_base + head->iov_len; - xdr->page_ptr--; - }/* (otherwise assume xdr->end is already set) */ + xdr->page_ptr--; head->iov_len = len; buf->len = len; xdr->p = head->iov_base + head->iov_len;
PATCH 143/305 xtensa: make sure bFLT stack is 16 byte aligned
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 0773495b1f5f1c5e23551843f87b5ff37e7af8f7 upstream.
Xtensa ABI requires stack alignment to be at least 16. In noMMU configuration ARCH_SLAB_MINALIGN is used to align stack. Make it at least 16.
This fixes the following runtime error in noMMU configuration, caused by interaction between insufficiently aligned stack and alloca function, that results in corruption of on-stack variable in the libc function glob:
Caught unhandled exception in 'sh' (pid = 47, pc = 0x02d05d65)
- should not happen
EXCCAUSE is 15
--- arch/xtensa/include/asm/processor.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/xtensa/include/asm/processor.h +5 -1
@@ -25,7 +25,11 @@# error Linux requires the Xtensa Windowed Registers Option.#endif -#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH +/* Xtensa ABI requires stack alignment to be at least 16 */ + +#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16) + +#define ARCH_SLAB_MINALIGN STACK_ALIGN/* * User space process size: 1 GB.
PATCH 144/305 xfrm: Fix bucket count reported to userspace
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
commit ca92e173ab34a4f7fc4128bd372bd96f1af6f507 upstream.
sadhcnt is reported by ip -s xfrm state count as "buckets count", not the hash mask.
--- net/xfrm/xfrm_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_state.c +1 -1
@@ -631,7 +631,7 @@ void xfrm_sad_getinfo(struct net *net, s {spin_lock_bh (&net->xfrm.xfrm_state_lock); si->sadcnt = net->xfrm.state_num; - si->sadhcnt = net->xfrm.state_hmask; + si->sadhcnt = net->xfrm.state_hmask +1 ; si->sadhmcnt = xfrm_state_hashmax;spin_unlock_bh (&net->xfrm.xfrm_state_lock); }
PATCH 145/305 Btrfs: fix cur_offset in the error case for nocow
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Robbie Ko <[email protected]>
commit 506481b20e818db40b6198815904ecd2d6daee64 upstream.
When the cow_file_range fails, the related resources are unlocked according to the range [start..end), so the unlock cannot be repeated in run_delalloc_nocow.
In some cases (e.g. cur_offset <= end && cow_start != -1), cur_offset is not updated correctly, so move the cur_offset update before cow_file_range.
kernel BUG at mm/page-writeback.c:2663!
Internal error: Oops - BUG: 0 [#1] SMP CPU: 3 PID: 31525 Comm: kworker/u8:7 Tainted: P O Hardware name: Realtek_RTD1296 (DT) Workqueue: writeback wb_workfn (flush-btrfs-1) task: ffffffc076db3380 ti: ffffffc02e9ac000 task.ti: ffffffc02e9ac000 PC is at clear_page_dirty_for_io+0x1bc/0x1e8 LR is at clear_page_dirty_for_io+0x14/0x1e8 pc : [<ffffffc00033c91c>] lr : [<ffffffc00033c774>] pstate: 40000145 sp : ffffffc02e9af4f0 Process kworker/u8:7 (pid: 31525, stack limit = 0xffffffc02e9ac020) Call trace: [<ffffffc00033c91c>] clear_page_dirty_for_io+0x1bc/0x1e8 [<ffffffbffc514674>] extent_clear_unlock_delalloc+0x1e4/0x210 [btrfs] [<ffffffbffc4fb168>] run_delalloc_nocow+0x3b8/0x948 [btrfs] [<ffffffbffc4fb948>] run_delalloc_range+0x250/0x3a8 [btrfs] [<ffffffbffc514c0c>] writepage_delalloc.isra.21+0xbc/0x1d8 [btrfs] [<ffffffbffc516048>] __extent_writepage+0xe8/0x248 [btrfs] [<ffffffbffc51630c>] extent_write_cache_pages.isra.17+0x164/0x378 [btrfs] [<ffffffbffc5185a8>] extent_writepages+0x48/0x68 [btrfs] [<ffffffbffc4f5828>] btrfs_writepages+0x20/0x30 [btrfs] [<ffffffc00033d758>] do_writepages+0x30/0x88 [<ffffffc0003ba0f4>] __writeback_single_inode+0x34/0x198 [<ffffffc0003ba6c4>] writeback_sb_inodes+0x184/0x3c0 [<ffffffc0003ba96c>] __writeback_inodes_wb+0x6c/0xc0 [<ffffffc0003bac20>] wb_writeback+0x1b8/0x1c0 [<ffffffc0003bb0f0>] wb_workfn+0x150/0x250 [<ffffffc0002b0014>] process_one_work+0x1dc/0x388 [<ffffffc0002b02f0>] worker_thread+0x130/0x500 [<ffffffc0002b6344>] kthread+0x10c/0x110 [<ffffffc000284590>] ret_from_fork+0x10/0x40 Code: d503201f a9025bb5 a90363b7 f90023b9 (d4210000)
--- fs/btrfs/inode.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/inode.c +2 -3
@@ -1449,12 +1449,11 @@ out_check: }btrfs_release_path (path); -if (cur_offset <= end && cow_start == (u64)-1 ) { +if (cur_offset <= end && cow_start == (u64)-1 ) cow_start = cur_offset; - cur_offset = end; - }if (cow_start != (u64)-1 ) { + cur_offset = end; ret =cow_file_range (inode, locked_page, cow_start, end, page_started, nr_written,1 );if (ret)
PATCH 146/305 Btrfs: fix data corruption due to cloning of eof block
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit ac765f83f1397646c11092a032d4f62c3d478b81 upstream.
We currently allow cloning a range from a file which includes the last block of the file even if the file's size is not aligned to the block size. This is fine and useful when the destination file has the same size, but when it does not and the range ends somewhere in the middle of the destination file, it leads to corruption because the bytes between the EOF and the end of the block have undefined data (when there is support for discard/trimming they have a value of 0x00).
Example:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt
$ export foo_size=$((256 * 1024 + 100)) $ xfs_io -f -c "pwrite -S 0x3c 0 $foo_size" /mnt/foo $ xfs_io -f -c "pwrite -S 0xb5 0 1M" /mnt/bar
$ xfs_io -c "reflink /mnt/foo 0 512K $foo_size" /mnt/bar
$ od -A d -t x1 /mnt/bar 0000000 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 * 0524288 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c 3c * 0786528 3c 3c 3c 3c 00 00 00 00 00 00 00 00 00 00 00 00 0786544 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0790528 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 b5 * 1048576
The bytes in the range from 786532 (512Kb + 256Kb + 100 bytes) to 790527 (512Kb + 256Kb + 4Kb - 1) got corrupted, having now a value of 0x00 instead of 0xb5.
This is similar to the problem we had for deduplication that got recently fixed by commit de02b9f6bb65 ("Btrfs: fix data corruption when deduplicating between different files").
Fix this by not allowing such operations to be performed and return the errno -EINVAL to user space. This is what XFS is doing as well at the VFS level. This change however now makes us return -EINVAL instead of -EOPNOTSUPP for cases where the source range maps to an inline extent and the destination range's end is smaller then the destination file's size, since the detection of inline extents is done during the actual process of dropping file extent items (at __btrfs_drop_extents()). Returning the -EINVAL error is done early on and solely based on the input parameters (offsets and length) and destination file's size. This makes us consistent with XFS and anyone else supporting cloning since this case is now checked at a higher level in the VFS and is where the -EINVAL will be returned from starting with kernel 4.20 (the VFS changed was introduced in 4.20-rc1 by commit 07d19dc9fbe9 ("vfs: avoid problematic remapping requests into partial EOF block"). So this change is more geared towards stable kernels, as it's unlikely the new VFS checks get removed intentionally.
A test case for fstests follows soon, as well as an update to filter existing tests that expect -EOPNOTSUPP to accept -EINVAL as well.
--- fs/btrfs/ioctl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/btrfs/ioctl.c +10 -2
@@ -3806,9 +3806,17 @@ static noinline long btrfs_ioctl_clone(s goto out_unlock;if (len ==0 ) olen = len = src->i_size - off; -/* if we extend to eof, continue to block boundary */ -if (off + len == src->i_size) +/* +* If we extend to eof, continue to block boundary if and only if the +* destination end offset matches the destination file's size, otherwise +* we would be corrupting data by placing the eof block into the middle +* of a file. +*/ +if (off + len == src->i_size) { +if (!IS_ALIGNED (len, bs) && destoff + len < inode->i_size) + goto out_unlock; len =ALIGN (src->i_size, bs) - off; + }if (len ==0 ) { ret =0 ;
PATCH 147/305 ext4: fix missing cleanup if ext4_alloc_flex_bg_array() fails while resizing
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit f348e2241fb73515d65b5d77dd9c174128a7fbf2 upstream.
--- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/resize.c +1 -1
@@ -1993,7 +1993,7 @@ retry: err =ext4_alloc_flex_bg_array (sb, n_group +1 );if (err) -return err; + goto out; err =ext4_mb_alloc_groupinfo (sb, n_group +1 );if (err)
PATCH 148/305 ext4: fix possible inode leak in the retry loop of ext4_resize_fs()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit db6aee62406d9fbb53315fcddd81f1dc271d49fa upstream.
--- fs/ext4/resize.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ext4/resize.c +4 -0
@@ -2029,6 +2029,10 @@ retry: n_blocks_count_retry =0 ;free_flex_gd (flex_gd); flex_gd =NULL ; +if (resize_inode) { +iput (resize_inode); + resize_inode =NULL ; + } goto retry; }
PATCH 149/305 ext4: avoid buffer leak in ext4_orphan_add() after prior errors
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit feaf264ce7f8d54582e2f66eb82dd9dd124c94f3 upstream.
--- fs/ext4/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/namei.c +3 -1
@@ -2629,7 +2629,9 @@ int ext4_orphan_add(handle_t *handle, stlist_del_init (&EXT4_I (inode)->i_orphan);mutex_unlock (&sbi->s_orphan_lock); } - } + }else +brelse (iloc.bh); +jbd_debug (4 ,"superblock will point to %lu\n" , inode->i_ino);jbd_debug (4 ,"orphan inode %lu will point to %d\n" , inode->i_ino,NEXT_ORPHAN (inode));
PATCH 150/305 ext4: avoid possible double brelse() in add_new_gdb() on error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 4f32c38b4662312dd3c5f113d8bdd459887fb773 upstream.
--- fs/ext4/resize.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/resize.c +1 -0
@@ -845,6 +845,7 @@ static int add_new_gdb(handle_t *handle, err =ext4_handle_dirty_metadata (handle,NULL , gdb_bh);if (unlikely (err)) {ext4_std_error (sb, err); + iloc.bh =NULL ; goto exit_inode; }brelse (dind);
PATCH 151/305 USB: Wait for extra delay time after USB_PORT_FEAT_RESET for quirky hub
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit 781f0766cc41a9dd2e5d118ef4b1d5d89430257b upstream.
Devices connected under Terminus Technology Inc. Hub (1a40:0101) may fail to work after the system resumes from suspend:
[ 206.063325] usb 3-2.4: reset full-speed USB device number 4 using xhci_hcd [ 206.143691] usb 3-2.4: device descriptor read/64, error -32 [ 206.351671] usb 3-2.4: device descriptor read/64, error -32
Info for this hub:
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=480 MxCh= 4 D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1a40 ProdID=0101 Rev=01.11 S: Product=USB 2.0 Hub C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
Some expirements indicate that the USB devices connected to the hub are innocent, it's the hub itself is to blame. The hub needs extra delay time after it resets its port.
Hence wait for extra delay, if the device is connected to this quirky hub.
[bwh: Backported to 3.16:
- Drop module parameter changes
- We don't have a USB_PORT_QUIRK_FAST_ENUM quirk]
---
drivers/usb/core/hub.c +9 -1
@@ -2671,6 +2671,7 @@ static int hub_port_reset(struct usb_hubint i, status;u16 portchange, portstatus;struct usb_port *port_dev = hub->ports[port1 -1 ]; +int reset_recovery_time;if (!hub_is_superspeed (hub->hdev)) {if (warm) {
@@ -2760,7 +2761,14 @@ static int hub_port_reset(struct usb_hub done:if (status ==0 ) {/* TRSTRCY = 10 ms; plus some extra */ -msleep (10 +40 ); + reset_recovery_time =10 +40 ; + +/* Hub needs extra delay after resetting its port. */ +if (hub->hdev->quirks &USB_QUIRK_HUB_SLOW_RESET ) + reset_recovery_time +=100 ; + +msleep (reset_recovery_time); +if (udev) {struct usb_hcd *hcd =bus_to_hcd (udev->bus);
drivers/usb/core/quirks.c +3 -0
@@ -229,6 +229,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1a0a, 0x0200), .driver_info = USB_QUIRK_LINEAR_UFRAME_INTR_BINTERVAL }, + /* Terminus Technology Inc. Hub */ + { USB_DEVICE(0x1a40, 0x0101), .driver_info = USB_QUIRK_HUB_SLOW_RESET }, + /* Corsair K70 RGB */ { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
include/linux/usb/quirks.h +3 -0
@@ -59,4 +59,7 @@/* Device needs a pause after every control message. */ #define USB_QUIRK_DELAY_CTRL_MSG BIT(13) +/* Hub needs extra delay after resetting its port. */ +#define USB_QUIRK_HUB_SLOW_RESET BIT(14) +#endif /* __LINUX_USB_QUIRKS_H */
PATCH 152/305 usb: quirks: Add delay-init quirk for Corsair K70 LUX RGB
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Pescosta <[email protected]>
commit a77112577667cbda7c6292c52d909636aef31fd9 upstream.
Following on from this patch: https://lkml.org/lkml/2017/11/3/516,
Corsair K70 LUX RGB keyboards also require the DELAY_INIT quirk to start correctly at boot.
Dmesg output:
usb 1-6: string descriptor 0 read error: -110
usb 1-6: New USB device found, idVendor=1b1c, idProduct=1b33 usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-6: can't set config #1, error -110
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -243,6 +243,9 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | USB_QUIRK_DELAY_CTRL_MSG }, + /* Corsair K70 LUX RGB */ + { USB_DEVICE(0x1b1c, 0x1b33), .driver_info = USB_QUIRK_DELAY_INIT }, + /* Corsair K70 LUX */ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT },
PATCH 153/305 USB: quirks: Add no-lpm quirk for Raydium touchscreens
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit deefd24228a172d1b27d4a9adbfd2cdacd60ae64 upstream.
Raydium USB touchscreen fails to set config if LPM is enabled:
[ 2.030658] usb 1-8: New USB device found, idVendor=2386, idProduct=3119 [ 2.030659] usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 2.030660] usb 1-8: Product: Raydium Touch System [ 2.030661] usb 1-8: Manufacturer: Raydium Corporation [ 7.132209] usb 1-8: can't set config #1, error -110
Same behavior can be observed on 2386:3114.
Raydium claims the touchscreen supports LPM under Windows, so I used Microsoft USB Test Tools (MUTT) [1] to check its LPM status. MUTT shows that the LPM doesn't work under Windows, either. So let's just disable LPM for Raydium touchscreens.
[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-test-tools
--- drivers/usb/core/quirks.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/core/quirks.c +5 -0
@@ -266,6 +266,11 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x2040, 0x7200), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Raydium Touchscreen */ + { USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM }, + + { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM }, + /* DJI CineSSD */ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
PATCH 154/305 USB: misc: appledisplay: add 20" Apple Cinema Display
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mattias Jacobsson <[email protected]>
commit f6501f49199097b99e4e263644d88c90d1ec1060 upstream.
Add another Apple Cinema Display to the list of supported displays
--- drivers/usb/misc/appledisplay.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/appledisplay.c +1 -0
@@ -63,6 +63,7 @@ static const struct usb_device_id appled { APPLEDISPLAY_DEVICE(0x9219) }, { APPLEDISPLAY_DEVICE(0x921c) }, { APPLEDISPLAY_DEVICE(0x921d) }, + { APPLEDISPLAY_DEVICE(0x9222) }, { APPLEDISPLAY_DEVICE(0x9236) },/* Terminating entry */
PATCH 155/305 ext4: fix possible leak of sbi->s_group_desc_leak in error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 9e463084cdb22e0b56b2dfbc50461020409a5fd3 upstream.
--- fs/ext4/super.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/ext4/super.c +8 -8
@@ -3980,6 +3980,14 @@ static int ext4_fill_super(struct super_ sbi->s_groups_count = blocks_count; sbi->s_blockfile_groups =min_t (ext4_group_t, sbi->s_groups_count, (EXT4_MAX_BLOCK_FILE_PHYS /EXT4_BLOCKS_PER_GROUP (sb))); +if (((u64 )sbi->s_groups_count * sbi->s_inodes_per_group) != +le32_to_cpu (es->s_inodes_count)) { +ext4_msg (sb,KERN_ERR ,"inodes count not valid: %u vs %llu" , +le32_to_cpu (es->s_inodes_count), + ((u64 )sbi->s_groups_count * sbi->s_inodes_per_group)); + ret = -EINVAL ; + goto failed_mount; + } db_count = (sbi->s_groups_count +EXT4_DESC_PER_BLOCK (sb) -1 ) /EXT4_DESC_PER_BLOCK (sb);if (EXT4_HAS_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_META_BG )) {
@@ -3999,14 +4007,6 @@ static int ext4_fill_super(struct super_ ret = -ENOMEM ; goto failed_mount; } -if (((u64 )sbi->s_groups_count * sbi->s_inodes_per_group) != -le32_to_cpu (es->s_inodes_count)) { -ext4_msg (sb,KERN_ERR ,"inodes count not valid: %u vs %llu" , -le32_to_cpu (es->s_inodes_count), - ((u64 )sbi->s_groups_count * sbi->s_inodes_per_group)); - ret = -EINVAL ; - goto failed_mount; - }if (ext4_proc_root) sbi->s_proc =proc_mkdir (sb->s_id, ext4_proc_root);
PATCH 156/305 ext4: release bs.bh before re-using in ext4_xattr_block_find()
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit 45ae932d246f721e6584430017176cbcadfde610 upstream.
bs.bh was taken in previous ext4_xattr_block_find() call, it should be released before re-using
--- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/xattr.c +2 -0
@@ -1202,6 +1202,8 @@ ext4_xattr_set_handle(handle_t *handle, error =ext4_xattr_block_set (handle, inode, &i, &bs); }else if (error == -ENOSPC ) {if (EXT4_I (inode)->i_file_acl && !bs.s.base) { +brelse (bs.bh); + bs.bh =NULL ; error =ext4_xattr_block_find (inode, &i, &bs);if (error) goto cleanup;
PATCH 157/305 ext4: fix buffer leak in ext4_xattr_move_to_block() on error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit 6bdc9977fcdedf47118d2caf7270a19f4b6d8a8f upstream.
--- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/xattr.c +2 -0
@@ -1529,6 +1529,8 @@ cleanup:kfree (buffer);if (is)brelse (is->iloc.bh); +if (bs) +brelse (bs->bh);kfree (is);kfree (bs);brelse (bh);
PATCH 158/305 ext4: fix buffer leak in __ext4_read_dirblock() on error path
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit de59fae0043f07de5d25e02ca360f7d57bfa5866 upstream.
--- fs/ext4/namei.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/namei.c +1 -0
@@ -122,6 +122,7 @@ static struct buffer_head *__ext4_read_dif (!is_dx_block && type ==INDEX ) {ext4_error_inode (inode, __func__, line, block,"directory leaf block found instead of index block" ); +brelse (bh);return ERR_PTR (-EIO ); } if (!ext4_has_metadata_csum(inode->i_sb) ||
PATCH 159/305 mount: Retest MNT_LOCKED in do_umount
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 25d202ed820ee347edec0bf3bf553544556bf64b upstream.
It was recently pointed out that the one instance of testing MNT_LOCKED outside of the namespace_sem is in ksys_umount.
Fix that by adding a test inside of do_umount with namespace_sem and the mount_lock held. As it helps to fail fails the existing test is maintained with an additional comment pointing out that it may be racy because the locks are not held.
--- fs/namespace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/namespace.c +8 -2
@@ -1423,8 +1423,13 @@ static int do_umount(struct mount *mnt,namespace_lock ();lock_mount_hash (); - event++; +/* Recheck MNT_LOCKED with the locks held */ + retval = -EINVAL ; +if (mnt->mnt.mnt_flags &MNT_LOCKED ) + goto out; + + event++;if (flags &MNT_DETACH ) {if (!list_empty (&mnt->mnt_list))umount_tree (mnt,UMOUNT_PROPAGATE );
@@ -1438,6 +1443,7 @@ static int do_umount(struct mount *mnt, retval =0 ; } } +out:unlock_mount_hash ();namespace_unlock ();return retval;
@@ -1484,7 +1490,7 @@ SYSCALL_DEFINE2(umount, char __user *, n goto dput_and_out;if (!check_mnt (mnt)) goto dput_and_out; -if (mnt->mnt.mnt_flags &MNT_LOCKED ) +if (mnt->mnt.mnt_flags &MNT_LOCKED )/* Check optimistically */ goto dput_and_out; retval = -EPERM ;if (flags &MNT_FORCE && !capable (CAP_SYS_ADMIN ))
PATCH 160/305 mount: Don't allow copying MNT_UNBINDABLE|MNT_LOCKED mounts
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit df7342b240185d58d3d9665c0bbf0a0f5570ec29 upstream.
Jonathan Calmels from NVIDIA reported that he's able to bypass the mount visibility security check in place in the Linux kernel by using a combination of the unbindable property along with the private mount propagation option to allow a unprivileged user to see a path which was purposefully hidden by the root user.
Reproducer:
# Hide a path to all users using a tmpfs
root@castiana:~# mount -t tmpfs tmpfs /sys/devices/ root@castiana:~#
# As an unprivileged user, unshare user namespace and mount namespace
stgraber@castiana:~$ unshare -U -m -r
# Confirm the path is still not accessible
root@castiana:~# ls /sys/devices/
# Make /sys recursively unbindable and private root@castiana:~# mount --make-runbindable /sys root@castiana:~# mount --make-private /sys # Recursively bind-mount the rest of /sys over to /mnnt root@castiana:~# mount --rbind /sys/ /mnt
# Access our hidden /sys/device as an unprivileged user
root@castiana:~# ls /mnt/devices/ breakpoint cpu cstate_core cstate_pkg i915 intel_pt isa kprobe LNXSYSTM:00 msr pci0000:00 platform pnp0 power software system tracepoint uncore_arb uncore_cbox_0 uncore_cbox_1 uprobe virtual
Solve this by teaching copy_tree to fail if a mount turns out to be both unbindable and locked.
--- fs/namespace.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/namespace.c +8 -2
@@ -1574,8 +1574,14 @@ struct mount *copy_tree(struct mount *mnstruct mount *t =NULL ;if (!(flag &CL_COPY_UNBINDABLE ) &&IS_MNT_UNBINDABLE (s)) { - s =skip_mnt_tree (s); -continue ; +if (s->mnt.mnt_flags &MNT_LOCKED ) { +/* Both unbindable and locked. */ + q =ERR_PTR (-EPERM ); + goto out; + }else { + s =skip_mnt_tree (s); +continue ; + } }if (!(flag &CL_COPY_MNT_NS_FILE ) &&is_mnt_ns_file (s->mnt.mnt_root)) {
PATCH 161/305 mount: Prevent MNT_DETACH from disconnecting locked mounts
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 9c8e0a1b683525464a2abe9fb4b54404a50ed2b4 upstream.
Quoted 40 lines · Timothy Baldwin
As per
mount_namespaces(7)unprivileged users should not be able to look under mount points:Mounts that come as a single unit from more privileged mount are locked together and may not be separated in a less privileged mount namespace.
However they can:
1. Create a mount namespace.
2. In the mount namespace open a file descriptor to the parent of a mount point.
3. Destroy the mount namespace.
4. Use the file descriptor to look under the mount point.I have reproduced this with Linux 4.16.18 and Linux 4.18-rc8.
The setup:
$ sudo sysctl kernel.unprivileged_userns_clone=1 kernel.unprivileged_userns_clone = 1 $ mkdir -p A/B/Secret $ sudo mount -t tmpfs hide A/B"Secret" is indeed hidden as expected:
$ ls -lR A A: total 0 drwxrwxrwt 2 root root 40 Feb 12 21:08 BA/B:
total 0The attack revealing "Secret":
$ unshare -Umr sh -c "exec unshare -m ls -lR /proc/self/fd/4/ 4<A" /proc/self/fd/4/: total 0 drwxr-xr-x 3 root root 60 Feb 12 21:08 B
Quoted 6 lines
/proc/self/fd/4/B:
total 0
drwxr-xr-x 2 root root 40 Feb 12 21:08 Secret
/proc/self/fd/4/B/Secret:
total 0
I tracked this down to put_mnt_ns running passing UMOUNT_SYNC and disconnecting all of the mounts in a mount namespace. Fix this by factoring drop_mounts out of drop_collected_mounts and passing 0 instead of UMOUNT_SYNC.
There are two possible behavior differences that result from this.
- No longer setting UMOUNT_SYNC will no longer set MNT_SYNC_UMOUNT on the vfsmounts being unmounted. This effects the lazy rcu walk by kicking the walk out of rcu mode and forcing it to be a non-lazy walk.
- No longer disconnecting locked mounts will keep some mounts around longer as they stay because the are locked to other mounts.
There are only two users of drop_collected mounts: audit_tree.c and put_mnt_ns.
In audit_tree.c the mounts are private and there are no rcu lazy walks only calls to iterate_mounts. So the changes should have no effect except for a small timing effect as the connected mounts are disconnected.
In put_mnt_ns there may be references from process outside the mount namespace to the mounts. So the mounts remaining connected will be the bug fix that is needed. That rcu walks are allowed to continue appears not to be a problem especially as the rcu walk change was about an implementation detail not about semantics.
--- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
@@ -1641,7 +1641,7 @@ void drop_collected_mounts(struct vfsmou {namespace_lock ();lock_mount_hash (); -umount_tree (real_mount (mnt),UMOUNT_SYNC ); +umount_tree (real_mount (mnt),0 );unlock_mount_hash ();namespace_unlock (); }
PATCH 162/305 iommu/ipmmu-vmsa: Fix crash on early domain free
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit e5b78f2e349eef5d4fca5dc1cf5a3b4b2cc27abd upstream.
If iommu_ops.add_device() fails, iommu_ops.domain_free() is still called, leading to a crash, as the domain was only partially initialized:
ipmmu-vmsa e67b0000.mmu: Cannot accommodate DMA translation for IOMMU page tables
sata_rcar ee300000.sata: Unable to initialize IPMMU context
iommu: Failed to add device ee300000.sata to group 0: -22
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000038
...
Call trace:
ipmmu_domain_free+0x1c/0xa0
iommu_group_release+0x48/0x68
kobject_put+0x74/0xe8
kobject_del.part.0+0x3c/0x50
kobject_put+0x60/0xe8
iommu_group_get_for_dev+0xa8/0x1f0
ipmmu_add_device+0x1c/0x40
of_iommu_configure+0x118/0x190Fix this by checking if the domain's context already exists, before trying to destroy it.
--- drivers/iommu/ipmmu-vmsa.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/ipmmu-vmsa.c +3 -0
@@ -383,6 +383,9 @@ static int ipmmu_domain_init_context(strstatic void ipmmu_domain_destroy_context (struct ipmmu_vmsa_domain *domain) { +if (!domain->mmu) +return ; +/* * Disable the context. Flush the TLB as required when modifying the * context registers.
PATCH 163/305 HID: Add quirk for Microsoft PIXART OEM mouse
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Parschauer <[email protected]>
commit e82e62e390d39c3819641cd721695702180d54fb upstream.
The PixArt OEM mice are known for disconnecting every minute in runlevel 1 or 3 if they are not always polled. So add quirk ALWAYS_POLL for this one as well.
References:
https://www.spinics.net/lists/linux-usb/msg88965.html
http://linet.gr.jp/~kojima/PlamoWeb/ML/htdocs/201808/msg00019.html
[bwh: Backported to 3.16:
- Don't use HID_USB_DEVICE
- Adjust filename, context]
--- drivers/hid/hid-ids.h | 1 + drivers/hid/usbhid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -704,6 +704,7 @@#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP 0x07e9#define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07de#define USB_DEVICE_ID_MS_POWER_COVER 0x07da +#define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb#define USB_VENDOR_ID_MOJO 0x8282#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -117,6 +117,7 @@ static const struct hid_blacklist { { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS }, + { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
PATCH 164/305 termios, tty/tty_baudrate.c: fix buffer overrun
In reply to Ben Hutchings3.16.63-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 991a25194097006ec1e0d2e0814ff920e59e3465 upstream.
On architectures with CBAUDEX == 0 (Alpha and PowerPC), the code in tty_baudrate.c does not do any limit checking on the tty_baudrate[] array, and in fact a buffer overrun is possible on both architectures. Add a limit check to prevent that situation.
This will be followed by a much bigger cleanup/simplification patch.
--- drivers/tty/tty_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/tty_ioctl.c +2 -2
@@ -327,7 +327,7 @@ speed_t tty_termios_baud_rate(struct kteelse cbaud +=15 ; } -return baud_table[cbaud]; +return cbaud >= n_baud_table ?0 : baud_table[cbaud]; }EXPORT_SYMBOL (tty_termios_baud_rate);
@@ -363,7 +363,7 @@ speed_t tty_termios_input_baud_rate(stru else cbaud += 15; } -return baud_table[cbaud]; +return cbaud >= n_baud_table ?0 : baud_table[cbaud];#else return tty_termios_baud_rate (termios);#endif