3.16.74-rc1 review
Subsystems (3)
cover 3.16.74-rc1 review
This is the start of the stable review cycle for the 3.16.74 release. There are 132 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 Mon Sep 23 20: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.
-------------
Alan Stern (3):
media: usb: siano: Fix false-positive "uninitialized variable" warning
[45457c01171fd1488a7000d1751c06ed8560ee38]
media: usb: siano: Fix general protection fault in smsusb
[31e0456de5be379b10fea0fa94a681057114a96e]
p54usb: Fix race between disconnect and firmware loading
[6e41e2257f1094acc37618bf6c856115374c6922]
Alexander Kochetkov (1):
net: arc_emac: fix koops caused by sk_buff free
[c278c253f3d992c6994d08aa0efb2b6806ca396f]
Andrew Vasquez (1):
scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
[5cbdae10bf11f96e30b4d14de7b08c8b490e903c]
Andy Lutomirski (2):
x86/speculation/mds: Improve CPU buffer clear documentation
[9d8d0294e78a164d407133dea05caf4b84247d6a]
x86/speculation/mds: Revert CPU buffer clear on double fault exit
[88640e1dcd089879530a49a8d212d1814678dfe7]
Arik Nemtsov (1):
mac80211: add API to request TDLS operation from userspace
[c887f0d3a03283cb6fe2c32aae62229bebd3fa32]
Arnd Bergmann (3):
appletalk: Fix compile regression
[27da0d2ef998e222a876c0cec72aa7829a626266]
media: davinci-isif: avoid uninitialized variable use
[0e633f97162c1c74c68e2eb20bbd9259dce87cd9]
scsi: qla4xxx: avoid freeing unallocated dma memory
[608f729c31d4caf52216ea00d20092a80959256d]
Bart Van Assche (1):
scsi: qla2xxx: Unregister chrdev if module initialization fails
[c794d24ec9eb6658909955772e70f34bef5b5b91]
Ben Hutchings (1):
media: poseidon: Depend on PM_RUNTIME
[not upstream; driver has been removed]
Bob Peterson (2):
GFS2: Fix rgrp end rounding problem for bsize < page size
[31dddd9eb9ebae9a2a9b502750e9e481d752180a]
GFS2: don't set rgrp gl_object until it's inserted into rgrp tree
[36e4ad0316c017d5b271378ed9a1c9a4b77fab5f]
Brian Masney (1):
backlight: lm3630a: Return 0 on success in update_status functions
[d3f48ec0954c6aac736ab21c34a35d7554409112]
Christian König (1):
drm/radeon: prefer lower reference dividers
[2e26ccb119bde03584be53406bbd22e711b0d6e6]
Christoph Probst (1):
cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()
[6a54b2e002c9d00b398d35724c79f9fe0d9b38fb]
Christoph Vogtländer (1):
pwm: tiehrpwm: Update shadow register for disabling PWMs
[b00ef53053191d3025c15e8041699f8c9d132daf]
Christophe Leroy (1):
net: ucc_geth - fix Oops when changing number of buffers in the ring
[ee0df19305d9fabd9479b785918966f6e25b733b]
Colin Ian King (2):
RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure
[a6d2a5a92e67d151c98886babdc86d530d27111c]
platform/x86: alienware-wmi: fix kfree on potentially uninitialized pointer
[98e2630284ab741804bd0713e932e725466f2f84]
Coly Li (1):
bcache: never set KEY_PTRS of journal key to 0 in journal_reclaim()
[1bee2addc0c8470c8aaa65ef0599eeae96dd88bc]
Dan Carpenter (11):
ath6kl: add some bounds checking
[5d6751eaff672ea77642e74e92e6c0ac7f9709ab]
drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl
[c8ea3663f7a8e6996d44500ee818c9330ac4fd88]
kdb: do a sanity check on the cpu in kdb_per_cpu()
[b586627e10f57ee3aa8f0cfab0d6f7dc4ae63760]
media: cx18: update *pos correctly in cx18_read_pos()
[7afb0df554292dca7568446f619965fb8153085d]
media: davinci/vpbe: array underflow in vpbe_enum_outputs()
[b72845ee5577b227131b1fef23f9d9a296621d7b]
media: ivtv: update *pos correctly in ivtv_read_pos()
[f8e579f3ca0973daef263f513da5edff520a6c0d]
media: omap_vout: potential buffer overflow in vidioc_dqbuf()
[dd6e2a981bfe83aa4a493143fd8cf1edcda6c091]
media: pvrusb2: Prevent a buffer overflow
[c1ced46c7b49ad7bc064e68d966e0ad303f917fb]
media: wl128x: Fix an error code in fm_download_firmware()
[ef4bb63dc1f7213c08e13f6943c69cd27f69e4a3]
media: wl128x: prevent two potential buffer overflows
[9c2ccc324b3a6cbc865ab8b3e1a09e93d3c8ade9]
platform/x86: alienware-wmi: printing the wrong error code
[6d1f8b3d75419a8659ac916a1e9543bb3513a882]
Dave Chinner (1):
xfs: clear sb->s_fs_info on mount failure
[c9fbd7bbc23dbdd73364be4d045e5d3612cf6e82]David Ahern (1):
ipv4: Fix raw socket lookup for local traffic
[19e4e768064a87b073a4b4c138b55db70e0cfb9f]
Dmitry Osipenko (1):
clk: tegra: Fix PLLM programming on Tegra124+ when PMC overrides divider
[40db569d6769ffa3864fd1b89616b1a7323568a8]
Elazar Leibovich (1):
tracing: Fix partial reading of trace event's id file
[cbe08bcbbe787315c425dde284dcb715cfbf3f39]
Eric Biggers (4):
crypto: arm/aes-neonbs - don't access already-freed walk.iv
[767f015ea0b7ab9d60432ff6cd06b664fd71f50f]
crypto: crct10dif-generic - fix use via crypto_shash_digest()
[307508d1072979f4435416f87936f87eaeb82054]
crypto: salsa20 - don't access already-freed walk.iv
[edaf28e996af69222b2cb40455dbb5459c2b875a]
crypto: x86/crct10dif-pcl - fix use via crypto_shash_digest()
[dec3d0b1071a0f3194e66a83d26ecf4aa8c5910e]
Florian Westphal (1):
netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
[680f6af5337c98d116e4f127cea7845339dba8da]
Geert Uytterhoeven (2):
spi: rspi: Fix register initialization while runtime-suspended
[42bdaaece121b3bb50fd4d1203d6d0170279f9fa]
spi: rspi: Fix sequencer reset during initialization
[26843bb128590edd7eba1ad7ce22e4b9f1066ce3]
Guenter Roeck (6):
hwmon: (f71805f) Use request_muxed_region for Super-IO accesses
[73e6ff71a7ea924fb7121d576a2d41e3be3fc6b5]
hwmon: (pc87427) Use request_muxed_region for Super-IO accesses
[755a9b0f8aaa5639ba5671ca50080852babb89ce]
hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses
[8c0826756744c0ac1df600a5e4cca1a341b13101]
hwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses
[d6410408ad2a798c4cc685252c1baa713be0ad69]
hwmon: (vt1211) Use request_muxed_region for Super-IO accesses
[14b97ba5c20056102b3dd22696bf17b057e60976]
hwmon: (w83627hf) Use request_muxed_region for Super-IO accesses
[e95fd518d05bfc087da6fcdea4900a57cfb083bd]
Gustavo A. R. Silva (2):
cxgb3/l2t: Fix undefined behaviour
[76497732932f15e7323dc805e8ea8dc11bb587cf]
platform/x86: sony-laptop: Fix unintentional fall-through
[1cbd7a64959d33e7a2a1fa2bf36a62b350a9fcbd]
Hui Peng (2):
ALSA: usb-audio: Fix a stack buffer overflow bug in check_input_term
[19bce474c45be69a284ecee660aa12d8f1e88f18]
ALSA: usb-audio: Fix an OOB bug in parse_audio_mixer_unit
[daac07156b330b18eb5071aec4b3ddca1c377f2c]
Hui Wang (1):
ALSA: hda/hdmi - Read the pin sense from register when repolling
[8c2e6728c2bf95765b724e07d0278ae97cd1ee0d]
Ian Abbott (1):
staging: comedi: dt282x: fix a null pointer deref on interrupt
[b8336be66dec06bef518030a0df9847122053ec5]
James Prestwood (1):
PCI: Mark Atheros AR9462 to avoid bus reset
[6afb7e26978da5e86e57e540fdce65c8b04f398a]
Janusz Krzysztofik (1):
media: ov6650: Fix sensor possibly not detected on probe
[933c1320847f5ed6b61a7d10f0a948aa98ccd7b0]
Jarod Wilson (1):
bonding: fix arp_validate toggling in active-backup mode
[a9b8a2b39ce65df45687cf9ef648885c2a99fe75]
Jason Yan (1):
scsi: libsas: delete sas port if expander discover failed
[3b0541791453fbe7f42867e310e0c9eb6295364d]
Jeff Layton (1):
ceph: flush dirty inodes before proceeding with remount
[00abf69dd24f4444d185982379c5cc3bb7b6d1fc]
Jiri Slaby (1):
TTY: serial_core, add ->install
[4cdd17ba1dff20ffc99fdbd2e6f0201fc7fe67df]Jiufei Xue (1):
jbd2: check superblock mapped prior to committing
[742b06b5628f2cd23cb51a034cb54dc33c6162c5]
Johan Hovold (3):
USB: cdc-acm: fix unthrottle races
[764478f41130f1b8d8057575b89e69980a0f600d]
USB: serial: fix initial-termios handling
[579bebe5dd522580019e7b10b07daaf500f9fb1e]
USB: serial: fix unthrottle races
[3f5edd58d040bfa4b74fb89bc02f0bc6b9cd06ab]
Johannes Berg (1):
mac80211: drop robust management frames from unknown TA
[588f7d39b3592a36fb7702ae3b8bdd9be4621e2f]
Jon Hunter (1):
ASoC: max98090: Fix restore of DAPM Muxes
[ecb2795c08bc825ebd604997e5be440b060c5b18]
Julia Lawall (1):
powerpc/83xx: Add missing of_node_put() after of_device_is_available()
[4df2cb633b5b22ba152511f1a55e718efca6c0d9]
Kailang Yang (1):
ALSA: hda/realtek - EAPD turn on later
[607ca3bd220f4022e6f5356026b19dafc363863a]
Karthik D A (1):
mwifiex: vendor_ie length check for parse WMM IEs
[113630b581d6d423998d2113a8e892ed6e6af6f9]
Kees Cook (1):
selftests/ipc: Fix msgque compiler warnings
[a147faa96f832f76e772b1e448e94ea84c774081]
Kefeng Wang (1):
Bluetooth: hci_ldisc: Postpone HCI_UART_PROTO_READY bit set in hci_uart_set_proto()
[56897b217a1d0a91c9920cb418d6b3fe922f590a]
Kirill Tkhai (1):
ext4: actually request zeroing of inode table after grow
[310a997fd74de778b9a4848a64be9cda9f18764a]
Ladislav Michl (2):
cdc-acm: handle read pipe errors
[1aba579f3cf51fd0fe0b4d46cc13823fd1200acb]
cdc-acm: store in and out pipes in acm structure
[74bccc9b71dc41d37e73fcdbcbec85310a670751]
Laurentiu Tudor (1):
powerpc/booke64: set RI in default MSR
[5266e58d6cd90ac85c187d673093ad9cb649e16d]
Liang Chen (1):
bcache: fix a race between cache register and cacheset unregister
[a4b732a248d12cbdb46999daf0bf288c011335eb]
Liu Bo (1):
fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
[0cbade024ba501313da3b7e5dd2a188a6bc491b5]
Loic Poulain (1):
Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data
[84cb3df02aea4b00405521e67c4c67c2d525c364]
Lu Baolu (1):
iommu/vt-d: Set intel_iommu_gfx_mapped correctly
[cf1ec4539a50bdfe688caad4615ca47646884316]
Lukas Czerner (1):
ext4: fix data corruption caused by overlapping unaligned and aligned IO
[57a0da28ced8707cb9f79f071a016b9d005caf5a]
Luke Nowakowski-Krijger (1):
media: radio-raremono: change devm_k*alloc to k*alloc
[c666355e60ddb4748ead3bdd983e3f7f2224aaf0]
Lyude Paul (1):
PCI: Reset Lenovo ThinkPad P50 nvgpu at boot if necessary
[e0547c81bfcfad01cbbfa93a5e66bb98ab932f80]
Marcel Holtmann (2):
Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
[d5bb334a8e171b262e48f378bd2096c0ea458265]
Bluetooth: Fix regression with minimum encryption key size alignment
[693cd8ce3f882524a5d06f7800dd8492411877b3]
Matias Karhumaa (1):
Bluetooth: Fix faulty expression for minimum encryption key size check
[eca94432934fe5f141d084f2e36ee2c0e614cc04]
Matt Delco (1):
KVM: coalesced_mmio: add bounds checking
[b60fe990c6b07ef6d4df67bc0530c7c90a62623a]
Mauro Carvalho Chehab (1):
media: smsusb: better handle optional alignment
[a47686636d84eaec5c9c6e84bd5f96bed34d526d]
Miklos Szeredi (2):
fuse: fallocate: fix return with locked inode
[35d6fcbb7c3e296a52136347346a698a35af3fda]
fuse: fix writepages on 32bit
[9de5be06d0a89ca97b5ab902694d42dfd2bb77d2]
Miroslav Lichvar (1):
ntp: Allow TAI-UTC offset to be set to zero
[fdc6bae940ee9eb869e493990540098b8c0fd6ab]
Noralf Trønnes (1):
drm/fb-helper: dpms_legacy(): Only set on connectors in use
[65a102f68005891d7f39354cfd79099908df6d51]
Oliver Neukum (5):
USB: rio500: refuse more than one device at a time
[3864d33943b4a76c6e64616280e98d2410b1190f]
USB: serial: use variable for status
[3161da970d38cd6ed2ba8cadec93874d1d06e11e]
USB: sisusbvga: fix oops in error path of sisusb_probe
[9a5729f68d3a82786aea110b1bfe610be318f80a]
cdc-acm: fix race between callback and unthrottle
[36e59e0d70d6150e7a2155c54612ea875e88ce8d]
media: cpia2_usb: first wake up, then free in disconnect
[eff73de2b1600ad8230692f00bc0ab49b166512a]
Pan Bian (1):
p54: drop device reference count if fails to enable device
[8149069db81853570a665f5e5648c0e526dc0e43]
Peter Zijlstra (1):
x86/uaccess: Dont leak the AC flag into __put_user() argument evaluation
[6ae865615fc43d014da2fd1f1bba7e81ee622d1b]
Petr Štetiar (1):
mwl8k: Fix rate_idx underflow
[6b583201fa219b7b1b6aebd8966c8fd9357ef9f4]
Phong Hoang (1):
pwm: Fix deadlock warning when removing PWM device
[347ab9480313737c0f1aaa08e8f2e1a791235535]
Phong Tran (1):
of: fix clang -Wunsequenced for be32_to_cpu()
[440868661f36071886ed360d91de83bd67c73b4f]
Romain Izard (1):
usb: cdc-acm: fix race during wakeup blocking TX traffic
[93e1c8a638308980309e009cc40b5a57ef87caf1]
S.j. Wang (1):
ASoC: fsl_esai: Fix missing break in switch statement
[903c220b1ece12f17c868e43f2243b8f81ff2d4c]
Sanjay Konduri (1):
rsi: add fix for crash during assertions
[abd39c6ded9db53aa44c2540092bdd5fb6590fa8]
Sebastian Andrzej Siewior (1):
smpboot: Place the __percpu annotation correctly
[d4645d30b50d1691c26ff0f8fa4e718b08f8d3bb]
Sergei Trofimovich (1):
tty/vt: fix write/write race in ioctl(KDSKBSENT) handler
[46ca3f735f345c9d87383dd3a09fa5d43870770e]
Shuning Zhang (1):
ocfs2: fix ocfs2 read inode data panic in ocfs2_iget
[e091eab028f9253eac5c04f9141bbc9d170acab3]
Slava Pestov (1):
bcache: fix memory corruption in init error path
[c9a78332b42cbdcdd386a95192a716b67d1711a4]
Stefan Mätje (2):
PCI: Factor out pcie_retrain_link() function
[86fa6a344209d9414ea962b1f1ac6ade9dd7563a]
PCI: Work around Pericom PCIe-to-PCI bridge Retrain Link erratum
[4ec73791a64bab25cabf16a6067ee478692e506d]
Stephen Suryaputra (1):
ipv4: Use return value of inet_iif() for __raw_v4_lookup in the while loop
[38c73529de13e1e10914de7030b659a2f8b01c3b]
Steve Twiss (1):
mfd: da9063: Fix OTP control register names to match datasheets for DA9063/63L
[6b4814a9451add06d457e198be418bf6a3e6a990]
Stuart Menefy (1):
ARM: dts: exynos: Fix interrupt for shared EINTs on Exynos5260
[b7ed69d67ff0788d8463e599dd5dd1b45c701a7e]
Takashi Iwai (3):
ALSA: hda/realtek - Fix overridden device-specific initialization
[89781d0806c2c4f29072d3f00cb2dd4274aabc3d]
ALSA: line6: Fix write on zero-sized buffer
[3450121997ce872eb7f1248417225827ea249710]
ALSA: usb-audio: Handle the error from snd_usb_mixer_apply_create_quirk()
[328e9f6973be2ee67862cb17bf6c0c5c5918cd72]
Tetsuo Handa (1):
kobject: Don't trigger kobject_uevent(KOBJ_REMOVE) twice.
[c03a0fd0b609e2f5c669c2b7f27c8e1928e9196e]
Tony Lindgren (1):
ARM: OMAP2+: Fix potentially uninitialized return value for _setup_reset()
[7f0d078667a494466991aa7133f49594f32ff6a2]
Vincenzo Frascino (1):
arm64: compat: Reduce address limit
[d263119387de9975d2acba1dfd3392f7c5979c18]
Wen Huang (1):
mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings
[7caac62ed598a196d6ddf8d9c121e12e082cac3a]
Wenwen Wang (1):
ALSA: usb-audio: Fix a memory leak bug
[cb5173594d50c72b7bfa14113dfc5084b4d2f726]
Wolfram Sang (1):
rtc: don't reference bogus function pointer in kdoc
[c48cadf5bf4becefcd0751b97995d2350aa9bb57]
Yongduan (1):
vhost: make sure log_num < in_num
[060423bfdee3f8bc6e2c1bac97de24d5415e2bc4]
Yu Wang (1):
mac80211: handle deauthentication/disassociation from TDLS peer
[79c92ca42b5a3e0ea172ea2ce8df8e125af237da]
YueHaibing (4):
ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data"
[9ee8578d953023cc57e7e736ae48502c707c0210]
appletalk: Fix use-after-free in atalk_proc_exit
[6377f787aeb945cae7abbb6474798de129e1f3ac]
at76c50x-usb: Don't register led_trigger if usb_register_driver failed
[09ac2694b0475f96be895848687ebcbba97eeecf]
ehea: Fix a copy-paste err in ehea_init_port_res
[c8f191282f819ab4e9b47b22a65c6c29734cefce]ZhangXiaoxu (1):
NFS4: Fix v4.0 client state corruption when mount
[f02f3755dbd14fb935d24b14650fff9ba92243b8]
Documentation/x86/mds.rst | 44 ++------- Makefile | 4 +- arch/arm/boot/dts/exynos5260.dtsi | 2 +- arch/arm/crypto/aesbs-glue.c | 4 + arch/arm/mach-omap2/omap_hwmod.c | 2 +- arch/arm/plat-pxa/ssp.c | 6 -- arch/arm64/include/asm/memory.h | 8 ++ arch/powerpc/include/asm/reg_booke.h | 2 +- arch/powerpc/platforms/83xx/usb.c | 4 +- arch/x86/crypto/crct10dif-pclmul_glue.c | 13 +-- arch/x86/include/asm/uaccess.h | 7 +- arch/x86/kernel/traps.c | 8 -- crypto/crct10dif_generic.c | 11 +-- crypto/salsa20_generic.c | 2 +- drivers/bluetooth/hci_ldisc.c | 10 +- drivers/bluetooth/hci_uart.h | 1 + drivers/clk/tegra/clk-pll.c | 4 +- drivers/gpu/drm/drm_fb_helper.c | 11 +-- drivers/gpu/drm/radeon/radeon_display.c | 4 +- drivers/hwmon/f71805f.c | 15 ++- drivers/hwmon/pc87427.c | 14 ++- drivers/hwmon/smsc47b397.c | 13 ++- drivers/hwmon/smsc47m1.c | 28 ++++-- drivers/hwmon/vt1211.c | 15 ++- drivers/hwmon/w83627hf.c | 42 +++++++- drivers/infiniband/hw/cxgb4/cm.c | 2 + drivers/iommu/intel-iommu.c | 7 +- drivers/md/bcache/journal.c | 11 ++- drivers/md/bcache/super.c | 13 ++- drivers/media/i2c/soc_camera/ov6650.c | 2 + drivers/media/pci/cx18/cx18-fileops.c | 2 +- drivers/media/pci/ivtv/ivtv-fileops.c | 2 +- drivers/media/platform/davinci/isif.c | 9 -- drivers/media/platform/davinci/vpbe.c | 2 +- drivers/media/platform/omap/omap_vout.c | 15 ++- drivers/media/radio/radio-raremono.c | 30 ++++-- drivers/media/radio/wl128x/fmdrv_common.c | 13 ++- drivers/media/usb/cpia2/cpia2_usb.c | 3 +- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 + drivers/media/usb/pvrusb2/pvrusb2-hdw.h | 1 + drivers/media/usb/siano/smsusb.c | 33 ++++--- drivers/media/usb/tlg2300/Kconfig | 1 + drivers/net/bonding/bond_options.c | 7 -- drivers/net/ethernet/arc/emac_main.c | 9 +- drivers/net/ethernet/chelsio/cxgb3/l2t.h | 2 +- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 8 +- drivers/net/ethernet/ibm/ehea/ehea_main.c | 2 +- drivers/net/wireless/at76c50x-usb.c | 4 +- drivers/net/wireless/ath/ath6kl/wmi.c | 10 +- drivers/net/wireless/mwifiex/ie.c | 3 + drivers/net/wireless/mwifiex/uap_cmd.c | 17 +++- drivers/net/wireless/mwl8k.c | 13 ++- drivers/net/wireless/p54/p54pci.c | 3 +- drivers/net/wireless/p54/p54usb.c | 43 ++++---- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 1 + drivers/pci/pcie/aspm.c | 49 +++++++--- drivers/pci/quirks.c | 76 +++++++++++++++ drivers/platform/x86/alienware-wmi.c | 19 ++-- drivers/platform/x86/sony-laptop.c | 8 +- drivers/pwm/core.c | 10 +- drivers/pwm/pwm-tiehrpwm.c | 2 + drivers/pwm/sysfs.c | 14 +-- drivers/rtc/interface.c | 7 +- drivers/scsi/libsas/sas_expander.c | 2 + drivers/scsi/qla2xxx/qla_attr.c | 4 +- drivers/scsi/qla2xxx/qla_os.c | 34 ++++--- drivers/scsi/qla4xxx/ql4_os.c | 2 +- drivers/spi/spi-rspi.c | 48 +++++---- drivers/staging/comedi/drivers/dt282x.c | 3 +- drivers/staging/line6/pcm.c | 5 + drivers/tty/serial/serial_core.c | 15 ++- drivers/tty/vt/keyboard.c | 33 +++++-- drivers/usb/class/cdc-acm.c | 113 +++++++++++++++++----- drivers/usb/class/cdc-acm.h | 4 + drivers/usb/misc/rio500.c | 24 +++-- drivers/usb/misc/sisusbvga/sisusb.c | 15 +-- drivers/usb/serial/generic.c | 57 ++++++++--- drivers/usb/serial/usb-serial.c | 11 ++- drivers/vhost/vhost.c | 4 +- drivers/video/backlight/lm3630a_bl.c | 4 +- drivers/virt/fsl_hypervisor.c | 26 ++--- fs/ceph/super.c | 7 ++ fs/cifs/smb2ops.c | 14 +-- fs/ext4/file.c | 7 ++ fs/ext4/ioctl.c | 2 +- fs/fuse/file.c | 9 +- fs/gfs2/rgrp.c | 12 ++- fs/jbd2/journal.c | 4 + fs/nfs/nfs4state.c | 4 + fs/ocfs2/export.c | 30 +++++- fs/xfs/xfs_super.c | 10 ++ include/linux/atalk.h | 20 +++- include/linux/ieee80211.h | 3 + include/linux/mfd/da9063/registers.h | 6 +- include/linux/of.h | 4 +- include/linux/pci.h | 2 + include/linux/pwm.h | 5 - include/linux/smpboot.h | 2 +- include/media/davinci/vpbe.h | 2 +- include/net/bluetooth/hci_core.h | 3 + include/net/mac80211.h | 13 +++ kernel/debug/kdb/kdb_main.c | 2 +- kernel/time/ntp.c | 2 +- kernel/trace/trace_events.c | 3 - lib/kobject_uevent.c | 9 +- net/appletalk/atalk_proc.c | 2 +- net/appletalk/ddp.c | 37 +++++-- net/appletalk/sysctl_net_atalk.c | 5 +- net/bluetooth/hci_conn.c | 10 +- net/bluetooth/l2cap_core.c | 34 +++++-- net/bridge/netfilter/ebtables.c | 4 +- net/ipv4/raw.c | 6 +- net/mac80211/ieee80211_i.h | 3 + net/mac80211/mlme.c | 16 ++- net/mac80211/rx.c | 2 + net/mac80211/tdls.c | 40 ++++++++ sound/pci/hda/hda_generic.c | 3 +- sound/pci/hda/hda_generic.h | 1 + sound/pci/hda/patch_hdmi.c | 6 ++ sound/pci/hda/patch_realtek.c | 5 +- sound/soc/codecs/max98090.c | 12 +-- sound/soc/fsl/fsl_esai.c | 1 + sound/usb/mixer.c | 36 +++++-- tools/testing/selftests/ipc/msgque.c | 11 ++- virt/kvm/coalesced_mmio.c | 17 ++-- 125 files changed, 1070 insertions(+), 489 deletions(-)
Signature · 3 lines
Ben Hutchings Nothing is ever a complete failure; it can always serve as a bad example.
PATCH 1/132 spi: rspi: Fix register initialization while runtime-suspended
3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 42bdaaece121b3bb50fd4d1203d6d0170279f9fa upstream.
The Renesas RSPI/QSPI driver performs SPI controller register initialization in its spi_operations.setup() callback, without calling pm_runtime_get_sync() first, which may cause spurious failures.
So far this went unnoticed, as this SPI controller is typically used with a single SPI NOR FLASH containing the boot loader:
1. If the device's module clock is still enabled (left enabled by the bootloader, and not yet disabled by the clk_disable_unused() late initcall), register initialization succeeds,
2. If the device's module clock is disabled, register writes don't seem to cause lock-ups or crashes.
Data received in the first SPI message may be corrupted, though. Subsequent SPI messages seem to be OK.
E.g. on r8a7791/koelsch, one bit is lost while receiving the 6th byte of the JEDEC ID for the s25fl512s FLASH, corrupting that byte and all later bytes. But until commit a2126b0a010905e5 ("mtd:
spi-nor: refine Spansion S25FL512S ID"), the 6th byte was not considered for FLASH identification.
Fix this by moving all initialization from the .setup() to the .prepare_message() callback. The latter is always called after the device has been runtime-resumed by the SPI core.
This also makes the driver follow the rule that .setup() must not change global driver state or register values, as that might break a transfer in progress.
--- drivers/spi/spi-rspi.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-)
drivers/spi/spi-rspi.c +16 -23
@@ -726,28 +726,6 @@ static int qspi_transfer_one(struct spi_ } } -static int rspi_setup (struct spi_device *spi) -{ -struct rspi_data *rspi =spi_master_get_devdata (spi->master); - - rspi->max_speed_hz = spi->max_speed_hz; - - rspi->spcmd =SPCMD_SSLKP ; -if (spi->mode &SPI_CPOL ) - rspi->spcmd |=SPCMD_CPOL ; -if (spi->mode &SPI_CPHA ) - rspi->spcmd |=SPCMD_CPHA ; - -/* CMOS output mode and MOSI signal from previous transfer */ - rspi->sppcr =0 ; -if (spi->mode &SPI_LOOP ) - rspi->sppcr |=SPPCR_SPLP ; - -set_config_register (rspi,8 ); - -return 0 ; -} -static u16 qspi_transfer_mode (const struct spi_transfer *xfer) {if (xfer->tx_buf)
@@ -817,8 +795,24 @@ static int rspi_prepare_message(struct s struct spi_message *msg) {struct rspi_data *rspi =spi_master_get_devdata (master); +struct spi_device *spi = msg->spi;int ret; + rspi->max_speed_hz = spi->max_speed_hz; + + rspi->spcmd =SPCMD_SSLKP ; +if (spi->mode &SPI_CPOL ) + rspi->spcmd |=SPCMD_CPOL ; +if (spi->mode &SPI_CPHA ) + rspi->spcmd |=SPCMD_CPHA ; + +/* CMOS output mode and MOSI signal from previous transfer */ + rspi->sppcr =0 ; +if (spi->mode &SPI_LOOP ) + rspi->sppcr |=SPPCR_SPLP ; + +set_config_register (rspi,8 ); +if (msg->spi->mode & (SPI_TX_DUAL |SPI_TX_QUAD |SPI_RX_DUAL |SPI_RX_QUAD )) {/* Setup sequencer for messages with multiple transfer modes */
@@ -1119,7 +1113,6 @@ static int rspi_probe(struct platform_deinit_waitqueue_head (&rspi->wait); master->bus_num = pdev->id; - master->setup = rspi_setup; master->auto_runtime_pm = true; master->transfer_one = ops->transfer_one; master->prepare_message = rspi_prepare_message;
PATCH 2/132 spi: rspi: Fix sequencer reset during initialization
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 26843bb128590edd7eba1ad7ce22e4b9f1066ce3 upstream.
While the sequencer is reset after each SPI message since commit 880c6d114fd79a69 ("spi: rspi: Add support for Quad and Dual SPI Transfers on QSPI"), it was never reset for the first message, thus relying on reset state or bootloader settings.
Fix this by initializing it explicitly during configuration.
--- drivers/spi/spi-rspi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/spi/spi-rspi.c +6 -3
@@ -277,7 +277,8 @@ static int rspi_set_config_register(stru/* Sets parity, interrupt mask */ rspi_write8 (rspi,0x00 ,RSPI_SPCR2 ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR ); rspi->spcmd |=SPCMD_SPB_8_TO_16 (access_size);rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );
@@ -311,7 +312,8 @@ static int rspi_rz_set_config_register(srspi_write8 (rspi,0x00 ,RSPI_SSLND );rspi_write8 (rspi,0x00 ,RSPI_SPND ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR ); rspi->spcmd |=SPCMD_SPB_8_TO_16 (access_size);rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );
@@ -362,7 +364,8 @@ static int qspi_set_config_register(stru/* Sets buffer to allow normal operation */ rspi_write8 (rspi,0x00 ,QSPI_SPBFCR ); -/* Sets SPCMD */ +/* Resets sequencer */ +rspi_write8 (rspi,0 ,RSPI_SPSCR );rspi_write16 (rspi, rspi->spcmd,RSPI_SPCMD0 );/* Enables SPI function in master mode */
PATCH 3/132 media: ivtv: update *pos correctly in ivtv_read_pos()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit f8e579f3ca0973daef263f513da5edff520a6c0d upstream.
We had intended to update *pos, but the current code is a no-op.
--- drivers/media/pci/ivtv/ivtv-fileops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/ivtv/ivtv-fileops.c +1 -1
@@ -420,7 +420,7 @@ static ssize_t ivtv_read_pos(struct ivtvIVTV_DEBUG_HI_FILE ("read %zd from %s, got %zd\n" , count, s->name, rc);if (rc >0 ) - pos += rc; + *pos += rc;return rc; }
PATCH 4/132 media: cx18: update *pos correctly in cx18_read_pos()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 7afb0df554292dca7568446f619965fb8153085d upstream.
We should be updating *pos. The current code is a no-op.
--- drivers/media/pci/cx18/cx18-fileops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/cx18/cx18-fileops.c +1 -1
@@ -489,7 +489,7 @@ static ssize_t cx18_read_pos(struct cx18CX18_DEBUG_HI_FILE ("read %zd from %s, got %zd\n" , count, s->name, rc);if (rc >0 ) - pos += rc; + *pos += rc;return rc; }
PATCH 5/132 ARM: dts: exynos: Fix interrupt for shared EINTs on Exynos5260
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stuart Menefy <[email protected]>
commit b7ed69d67ff0788d8463e599dd5dd1b45c701a7e upstream.
Fix the interrupt information for the GPIO lines with a shared EINT interrupt.
--- arch/arm/boot/dts/exynos5260.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5260.dtsi +1 -1
@@ -211,7 +211,7 @@ wakeup-interrupt-controller { compatible = "samsung,exynos4210-wakeup-eint"; interrupt-parent = <&gic>; - interrupts = <0 32 0>; + interrupts = <0 48 0>; }; };
PATCH 6/132 media: wl128x: Fix an error code in fm_download_firmware()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit ef4bb63dc1f7213c08e13f6943c69cd27f69e4a3 upstream.
We forgot to set "ret" on this error path.
--- drivers/media/radio/wl128x/fmdrv_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/radio/wl128x/fmdrv_common.c +3 -2
@@ -1278,8 +1278,9 @@ static int fm_download_firmware(struct fswitch (action->type) {case ACTION_SEND_COMMAND :/* Send */ -if (fmc_send_cmd (fmdev,0 ,0 , action->data, - action->size,NULL ,NULL )) + ret =fmc_send_cmd (fmdev,0 ,0 , action->data, + action->size,NULL ,NULL ); +if (ret) goto rel_fw; cmd_cnt++;
PATCH 7/132 pwm: Fix deadlock warning when removing PWM device
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Phong Hoang <[email protected]>
commit 347ab9480313737c0f1aaa08e8f2e1a791235535 upstream.
This patch fixes deadlock warning if removing PWM device when CONFIG_PROVE_LOCKING is enabled.
This issue can be reproceduced by the following steps on the R-Car H3 Salvator-X board if the backlight is disabled:
# cd /sys/class/pwm/pwmchip0 # echo 0 > export # ls device export npwm power pwm0 subsystem uevent unexport # cd device/driver # ls bind e6e31000.pwm uevent unbind # echo e6e31000.pwm > unbind
[ 87.659974] ======================================================
[ 87.666149] WARNING: possible circular locking dependency detected
[ 87.672327] 5.0.0 #7 Not tainted
[ 87.675549] ------------------------------------------------------
[ 87.681723] bash/2986 is trying to acquire lock:
[ 87.686337] 000000005ea0e178 (kn->count#58){++++}, at: kernfs_remove_by_name_ns+0x50/0xa0
[ 87.694528]
[ 87.694528] but task is already holding lock:
[ 87.700353] 000000006313b17c (pwm_lock){+.+.}, at: pwmchip_remove+0x28/0x13c
[ 87.707405]
[ 87.707405] which lock already depends on the new lock.
[ 87.707405]
[ 87.715574]
[ 87.715574] the existing dependency chain (in reverse order) is:
[ 87.723048]
[ 87.723048] -> #1 (pwm_lock){+.+.}:
[ 87.728017] __mutex_lock+0x70/0x7e4
[ 87.732108] mutex_lock_nested+0x1c/0x24
[ 87.736547] pwm_request_from_chip.part.6+0x34/0x74
[ 87.741940] pwm_request_from_chip+0x20/0x40
[ 87.746725] export_store+0x6c/0x1f4
[ 87.750820] dev_attr_store+0x18/0x28
[ 87.754998] sysfs_kf_write+0x54/0x64
[ 87.759175] kernfs_fop_write+0xe4/0x1e8
[ 87.763615] __vfs_write+0x40/0x184
[ 87.767619] vfs_write+0xa8/0x19c
[ 87.771448] ksys_write+0x58/0xbc
[ 87.775278] __arm64_sys_write+0x18/0x20
[ 87.779721] el0_svc_common+0xd0/0x124
[ 87.783986] el0_svc_compat_handler+0x1c/0x24
[ 87.788858] el0_svc_compat+0x8/0x18
[ 87.792947]
[ 87.792947] -> #0 (kn->count#58){++++}:
[ 87.798260] lock_acquire+0xc4/0x22c
[ 87.802353] __kernfs_remove+0x258/0x2c4
[ 87.806790] kernfs_remove_by_name_ns+0x50/0xa0
[ 87.811836] remove_files.isra.1+0x38/0x78
[ 87.816447] sysfs_remove_group+0x48/0x98
[ 87.820971] sysfs_remove_groups+0x34/0x4c
[ 87.825583] device_remove_attrs+0x6c/0x7c
[ 87.830197] device_del+0x11c/0x33c
[ 87.834201] device_unregister+0x14/0x2c
[ 87.838638] pwmchip_sysfs_unexport+0x40/0x4c
[ 87.843509] pwmchip_remove+0xf4/0x13c
[ 87.847773] rcar_pwm_remove+0x28/0x34
[ 87.852039] platform_drv_remove+0x24/0x64
[ 87.856651] device_release_driver_internal+0x18c/0x21c
[ 87.862391] device_release_driver+0x14/0x1c
[ 87.867175] unbind_store+0xe0/0x124
[ 87.871265] drv_attr_store+0x20/0x30
[ 87.875442] sysfs_kf_write+0x54/0x64
[ 87.879618] kernfs_fop_write+0xe4/0x1e8
[ 87.884055] __vfs_write+0x40/0x184
[ 87.888057] vfs_write+0xa8/0x19c
[ 87.891887] ksys_write+0x58/0xbc
[ 87.895716] __arm64_sys_write+0x18/0x20
[ 87.900154] el0_svc_common+0xd0/0x124
[ 87.904417] el0_svc_compat_handler+0x1c/0x24
[ 87.909289] el0_svc_compat+0x8/0x18
[ 87.913378]
[ 87.913378] other info that might help us debug this:
[ 87.913378]
[ 87.921374] Possible unsafe locking scenario:
[ 87.921374]
[ 87.927286] CPU0 CPU1
[ 87.931808] ---- ----
[ 87.936331] lock(pwm_lock);
[ 87.939293] lock(kn->count#58);
[ 87.945120] lock(pwm_lock);
[ 87.950599] lock(kn->count#58);
[ 87.953908]
[ 87.953908] *** DEADLOCK ***
[ 87.953908]
[ 87.959821] 4 locks held by bash/2986:
[ 87.963563] #0: 00000000ace7bc30 (sb_writers#6){.+.+}, at: vfs_write+0x188/0x19c
[ 87.971044] #1: 00000000287991b2 (&of->mutex){+.+.}, at: kernfs_fop_write+0xb4/0x1e8
[ 87.978872] #2: 00000000f739d016 (&dev->mutex){....}, at: device_release_driver_internal+0x40/0x21c
[ 87.988001] #3: 000000006313b17c (pwm_lock){+.+.}, at: pwmchip_remove+0x28/0x13c
[ 87.995481]
[ 87.995481] stack backtrace:
[ 87.999836] CPU: 0 PID: 2986 Comm: bash Not tainted 5.0.0 #7
[ 88.005489] Hardware name: Renesas Salvator-X board based on r8a7795 ES1.x (DT)
[ 88.012791] Call trace:
[ 88.015235] dump_backtrace+0x0/0x190
[ 88.018891] show_stack+0x14/0x1c
[ 88.022204] dump_stack+0xb0/0xec
[ 88.025514] print_circular_bug.isra.32+0x1d0/0x2e0
[ 88.030385] __lock_acquire+0x1318/0x1864
[ 88.034388] lock_acquire+0xc4/0x22c
[ 88.037958] __kernfs_remove+0x258/0x2c4
[ 88.041874] kernfs_remove_by_name_ns+0x50/0xa0
[ 88.046398] remove_files.isra.1+0x38/0x78
[ 88.050487] sysfs_remove_group+0x48/0x98
[ 88.054490] sysfs_remove_groups+0x34/0x4c
[ 88.058580] device_remove_attrs+0x6c/0x7c
[ 88.062671] device_del+0x11c/0x33c
[ 88.066154] device_unregister+0x14/0x2c
[ 88.070070] pwmchip_sysfs_unexport+0x40/0x4c
[ 88.074421] pwmchip_remove+0xf4/0x13c
[ 88.078163] rcar_pwm_remove+0x28/0x34
[ 88.081906] platform_drv_remove+0x24/0x64
[ 88.085996] device_release_driver_internal+0x18c/0x21c
[ 88.091215] device_release_driver+0x14/0x1c
[ 88.095478] unbind_store+0xe0/0x124
[ 88.099048] drv_attr_store+0x20/0x30
[ 88.102704] sysfs_kf_write+0x54/0x64
[ 88.106359] kernfs_fop_write+0xe4/0x1e8
[ 88.110275] __vfs_write+0x40/0x184
[ 88.113757] vfs_write+0xa8/0x19c
[ 88.117065] ksys_write+0x58/0xbc
[ 88.120374] __arm64_sys_write+0x18/0x20
[ 88.124291] el0_svc_common+0xd0/0x124
[ 88.128034] el0_svc_compat_handler+0x1c/0x24
[ 88.132384] el0_svc_compat+0x8/0x18The sysfs unexport in pwmchip_remove() is completely asymmetric to what we do in pwmchip_add_with_polarity() and commit 0733424c9ba9 ("pwm: Unexport children before chip removal") is a strong indication that this was wrong to begin with. We should just move pwmchip_sysfs_unexport() where it belongs, which is right after pwmchip_sysfs_unexport_children(). In that case, we do not need separate functions anymore either.
We also really want to remove sysfs irrespective of whether or not the chip will be removed as a result of pwmchip_remove(). We can only assume that the driver will be gone after that, so we shouldn't leave any dangling sysfs files around.
This warning disappears if we move pwmchip_sysfs_unexport() to the top of pwmchip_remove(), pwmchip_sysfs_unexport_children(). That way it is also outside of the pwm_lock section, which indeed doesn't seem to be needed.
Moving the pwmchip_sysfs_export() call outside of that section also seems fine and it'd be perfectly symmetric with pwmchip_remove() again.
So, this patch fixes them.
--- drivers/pwm/core.c | 10 +++++----- drivers/pwm/sysfs.c | 14 +------------- include/linux/pwm.h | 5 ----- 3 files changed, 6 insertions(+), 23 deletions(-)
drivers/pwm/core.c +5 -5
@@ -273,10 +273,12 @@ int pwmchip_add(struct pwm_chip *chip)if (IS_ENABLED (CONFIG_OF ))of_pwmchip_add (chip); -pwmchip_sysfs_export (chip); - out:mutex_unlock (&pwm_lock); + +if (!ret) +pwmchip_sysfs_export (chip); +return ret; }EXPORT_SYMBOL_GPL (pwmchip_add);
@@ -293,7 +295,7 @@ int pwmchip_remove(struct pwm_chip *chipunsigned int i;int ret =0 ; -pwmchip_sysfs_unexport_children (chip); +pwmchip_sysfs_unexport (chip);mutex_lock (&pwm_lock);
@@ -313,8 +315,6 @@ int pwmchip_remove(struct pwm_chip *chipfree_pwms (chip); -pwmchip_sysfs_unexport (chip); - out:mutex_unlock (&pwm_lock);return ret;
drivers/pwm/sysfs.c +1 -13
@@ -330,19 +330,6 @@ void pwmchip_sysfs_export(struct pwm_chivoid pwmchip_sysfs_unexport (struct pwm_chip *chip) {struct device *parent; - - parent =class_find_device (&pwm_class,NULL , chip, - pwmchip_sysfs_match); -if (parent) { -/* for class_find_device() */ -put_device (parent); -device_unregister (parent); - } -} - -void pwmchip_sysfs_unexport_children (struct pwm_chip *chip) -{ -struct device *parent;unsigned int i; parent = class_find_device(&pwm_class, NULL, chip,
@@ -358,6 +345,7 @@ void pwmchip_sysfs_unexport_children(str }put_device (parent); +device_unregister (parent); }static int __init pwm_sysfs_init (void )
include/linux/pwm.h +0 -5
@@ -299,7 +299,6 @@ static inline void pwm_add_table(struct#ifdef CONFIG_PWM_SYSFS void pwmchip_sysfs_export (struct pwm_chip *chip);void pwmchip_sysfs_unexport (struct pwm_chip *chip); -void pwmchip_sysfs_unexport_children (struct pwm_chip *chip);#else static inline void pwmchip_sysfs_export (struct pwm_chip *chip) {
@@ -308,10 +307,6 @@ static inline void pwmchip_sysfs_export(static inline void pwmchip_sysfs_unexport (struct pwm_chip *chip) { } - -static inline void pwmchip_sysfs_unexport_children (struct pwm_chip *chip) -{ -}#endif /* CONFIG_PWM_SYSFS */ #endif /* __LINUX_PWM_H */
PATCH 8/132 pwm: tiehrpwm: Update shadow register for disabling PWMs
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Vogtländer
<[email protected]>
commit b00ef53053191d3025c15e8041699f8c9d132daf upstream.
It must be made sure that immediate mode is not already set, when modifying shadow register value in ehrpwm_pwm_disable(). Otherwise modifications to the action-qualifier continuous S/W force register(AQSFRC) will be done in the active register.
This may happen when both channels are being disabled. In this case, only the first channel state will be recorded as disabled in the shadow register. Later, when enabling the first channel again, the second channel would be enabled as well. Setting RLDCSF to zero, first, ensures that the shadow register is updated as desired.
--- drivers/pwm/pwm-tiehrpwm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pwm/pwm-tiehrpwm.c +2 -0
@@ -379,6 +379,8 @@ static void ehrpwm_pwm_disable(struct pw }/* Update shadow register first before modifying active register */ +ehrpwm_modify (pc->mmio_base,AQSFRC ,AQSFRC_RLDCSF_MASK , +AQSFRC_RLDCSF_ZRO );ehrpwm_modify (pc->mmio_base,AQCSFRC , aqcsfrc_mask, aqcsfrc_val);/* * Changes to immediate action on Action Qualifier. This puts
PATCH 9/132 scsi: qla4xxx: avoid freeing unallocated dma memory
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 608f729c31d4caf52216ea00d20092a80959256d upstream.
Clang -Wuninitialized notices that on is_qla40XX we never allocate any DMA memory in get_fw_boot_info() but attempt to free it anyway:
drivers/scsi/qla4xxx/ql4_os.c:5915:7: error: variable 'buf_dma' is used uninitialized whenever 'if' condition is false
[-Werror,-Wsometimes-uninitialized]
if (!(val & 0x07)) {
^~~~~~~~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5985:47: note: uninitialized use occurs here
dma_free_coherent(&ha->pdev->dev, size, buf, buf_dma);
^~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5915:3: note: remove the 'if' if its condition is always true
if (!(val & 0x07)) {
^~~~~~~~~~~~~~~~~~~
drivers/scsi/qla4xxx/ql4_os.c:5885:20: note: initialize the variable 'buf_dma' to silence this warning
dma_addr_t buf_dma;
^
= 0Skip the call to dma_free_coherent() here.
--- drivers/scsi/qla4xxx/ql4_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla4xxx/ql4_os.c +1 -1
@@ -5923,7 +5923,7 @@ static int get_fw_boot_info(struct scsi_ val =rd_nvram_byte (ha, sec_addr);if (val &BIT_7 ) ddb_index[1 ] = (val &0x7f ); - + goto exit_boot_info; }else if (is_qla80XX (ha)) { buf =dma_alloc_coherent (&ha->pdev->dev, size, &buf_dma,GFP_KERNEL );
PATCH 10/132 ARM: OMAP2+: Fix potentially uninitialized return value for _setup_reset()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
commit 7f0d078667a494466991aa7133f49594f32ff6a2 upstream.
Commit 747834ab8347 ("ARM: OMAP2+: hwmod: revise hardreset behavior") made the call to _enable() conditional based on no oh->rst_lines_cnt. This caused the return value to be potentially uninitialized. Curiously we see no compiler warnings for this, probably as this gets inlined.
We call _setup_reset() from _setup() and only _setup_postsetup() if the return value is zero. Currently the return value can be uninitialized for cases where oh->rst_lines_cnt is set and HWMOD_INIT_NO_RESET is not set.
--- arch/arm/mach-omap2/omap_hwmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/omap_hwmod.c +1 -1
@@ -2617,7 +2617,7 @@ static void __init _setup_iclk_autoidle(*/ static int __init _setup_reset (struct omap_hwmod *oh) { -int r; +int r =0 ;if (oh->_state != _HWMOD_STATE_INITIALIZED)return -EINVAL ;
PATCH 11/132 tty/vt: fix write/write race in ioctl(KDSKBSENT) handler
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Trofimovich <[email protected]>
commit 46ca3f735f345c9d87383dd3a09fa5d43870770e upstream.
The bug manifests as an attempt to access deallocated memory:
BUG: unable to handle kernel paging request at ffff9c8735448000
#PF error: [PROT] [WRITE]
PGD 288a05067 P4D 288a05067 PUD 288a07067 PMD 7f60c2063 PTE 80000007f5448161
Oops: 0003 [#1] PREEMPT SMP
CPU: 6 PID: 388 Comm: loadkeys Tainted: G C 5.0.0-rc6-00153-g5ded5871030e #91
Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H77M-D3H, BIOS F12 11/14/2013
RIP: 0010:__memmove+0x81/0x1a0
Code: 4c 89 4f 10 4c 89 47 18 48 8d 7f 20 73 d4 48 83 c2 20 e9 a2 00 00 00 66 90 48 89 d1 4c 8b 5c 16 f8 4c 8d 54 17 f8 48 c1 e9 03 <f3> 48 a5 4d 89 1a e9 0c 01 00 00 0f 1f 40 00 48 89 d1 4c 8b 1e 49
RSP: 0018:ffffa1b9002d7d08 EFLAGS: 00010203
RAX: ffff9c873541af43 RBX: ffff9c873541af43 RCX: 00000c6f105cd6bf
RDX: 0000637882e986b6 RSI: ffff9c8735447ffb RDI: ffff9c8735447ffb
RBP: ffff9c8739cd3800 R08: ffff9c873b802f00 R09: 00000000fffff73b
R10: ffffffffb82b35f1 R11: 00505b1b004d5b1b R12: 0000000000000000
R13: ffff9c873541af3d R14: 000000000000000b R15: 000000000000000c
FS: 00007f450c390580(0000) GS:ffff9c873f180000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff9c8735448000 CR3: 00000007e213c002 CR4: 00000000000606e0
Call Trace:
vt_do_kdgkb_ioctl+0x34d/0x440
vt_ioctl+0xba3/0x1190
? __bpf_prog_run32+0x39/0x60
? mem_cgroup_commit_charge+0x7b/0x4e0
tty_ioctl+0x23f/0x920
? preempt_count_sub+0x98/0xe0
? __seccomp_filter+0x67/0x600
do_vfs_ioctl+0xa2/0x6a0
? syscall_trace_enter+0x192/0x2d0
ksys_ioctl+0x3a/0x70
__x64_sys_ioctl+0x16/0x20
do_syscall_64+0x54/0xe0
entry_SYSCALL_64_after_hwframe+0x49/0xbeThe bug manifests on systemd systems with multiple vtcon devices:
# cat /sys/devices/virtual/vtconsole/vtcon0/name (S) dummy device # cat /sys/devices/virtual/vtconsole/vtcon1/name (M) frame buffer device
There systemd runs 'loadkeys' tool in tapallel for each vtcon instance. This causes two parallel ioctl(KDSKBSENT) calls to race into adding the same entry into 'func_table' array at:
drivers/tty/vt/keyboard.c:vt_do_kdgkb_ioctl()
The function has no locking around writes to 'func_table'.
The simplest reproducer is to have initrams with the following init on a 8-CPU machine x86_64:
#!/bin/sh
loadkeys -q windowkeys ru4 &
loadkeys -q windowkeys ru4 &
loadkeys -q windowkeys ru4 &
loadkeys -q windowkeys ru4 &
loadkeys -q windowkeys ru4 &
loadkeys -q windowkeys ru4 &
loadkeys -q windowkeys ru4 &
loadkeys -q windowkeys ru4 &
wait
The change adds lock on write path only. Reads are still racy.
--- drivers/tty/vt/keyboard.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)
drivers/tty/vt/keyboard.c +27 -6
@@ -120,6 +120,7 @@ static const int NR_TYPES = ARRAY_SIZE(mstatic struct input_handler kbd_handler;static DEFINE_SPINLOCK (kbd_event_lock);static DEFINE_SPINLOCK (led_lock); +static DEFINE_SPINLOCK (func_buf_lock);/* guard 'func_buf' and friends */ static unsigned long key_down[BITS_TO_LONGS (KEY_CNT )];/* keyboard key bitmap */ static unsigned char shift_down[NR_SHIFT ];/* shift state counters.. */ static bool dead_key_next;
@@ -1865,11 +1866,12 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbchar *p;u_char *q;u_char __user *up; -int sz; +int sz, fnw_sz;int delta;char *first_free, *fj, *fnw;int i, j, k;int ret; +unsigned long flags;if (!capable (CAP_SYS_TTY_CONFIG )) perm =0 ;
@@ -1912,7 +1914,14 @@ int vt_do_kdgkb_ioctl(int cmd, struct kb goto reterr; } + fnw =NULL ; + fnw_sz =0 ; +/* race aginst other writers */ + again: +spin_lock_irqsave (&func_buf_lock, flags); q = func_table[i]; + +/* fj pointer to next entry after 'q' */ first_free = funcbufptr + (funcbufsize - funcbufleft);for (j = i+1 ; j <MAX_NR_FUNC && !func_table[j]; j++) ;
@@ -1920,10 +1929,12 @@ int vt_do_kdgkb_ioctl(int cmd, struct kb fj = func_table[j]; else fj = first_free; - +/* buffer usage increase by new entry */ delta = (q ? -strlen (q) :1 ) +strlen (kbs->kb_string); +if (delta <= funcbufleft) {/* it fits in current buf */ if (j <MAX_NR_FUNC ) { +/* make enough space for new entry at 'fj' */ memmove (fj + delta, fj, first_free - fj);for (k = j; k <MAX_NR_FUNC ; k++)if (func_table[k])
@@ -1936,20 +1947,28 @@ int vt_do_kdgkb_ioctl(int cmd, struct kb sz =256 ;while (sz < funcbufsize - funcbufleft + delta) sz <<=1 ; - fnw =kmalloc (sz,GFP_KERNEL ); -if (!fnw) { - ret = -ENOMEM ; - goto reterr; +if (fnw_sz != sz) { +spin_unlock_irqrestore (&func_buf_lock, flags); +kfree (fnw); + fnw =kmalloc (sz,GFP_KERNEL ); + fnw_sz = sz; +if (!fnw) { + ret = -ENOMEM ; + goto reterr; + } + goto again; }if (!q) func_table[i] = fj; +/* copy data before insertion point to new location */ if (fj > funcbufptr)memmove (fnw, funcbufptr, fj - funcbufptr);for (k =0 ; k < j; k++)if (func_table[k]) func_table[k] = fnw + (func_table[k] - funcbufptr); +/* copy data after insertion point to new location */ if (first_free > fj) {memmove (fnw + (fj - funcbufptr) + delta, fj, first_free - fj);for (k = j; k <MAX_NR_FUNC ; k++)
@@ -1962,7 +1981,9 @@ int vt_do_kdgkb_ioctl(int cmd, struct kb funcbufleft = funcbufleft - delta + sz - funcbufsize; funcbufsize = sz; } +/* finally insert item itself */ strcpy (func_table[i], kbs->kb_string); +spin_unlock_irqrestore (&func_buf_lock, flags);break ; } ret =0 ;
PATCH 12/132 media: davinci-isif: avoid uninitialized variable use
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 0e633f97162c1c74c68e2eb20bbd9259dce87cd9 upstream.
clang warns about a possible variable use that gcc never complained about:
drivers/media/platform/davinci/isif.c:982:32: error: variable 'frame_size' is uninitialized when used here
[-Werror,-Wuninitialized]
dm365_vpss_set_pg_frame_size(frame_size);
^~~~~~~~~~
drivers/media/platform/davinci/isif.c:887:2: note: variable 'frame_size' is declared here
struct vpss_pg_frame_size frame_size;
^1 error generated.
There is no initialization for this variable at all, and there has never been one in the mainline kernel, so we really should not put that stack data into an mmio register.
On the other hand, I suspect that gcc checks the condition more closely and notices that the global isif_cfg.bayer.config_params.test_pat_gen flag is initialized to zero and never written to from any code path, so anything depending on it can be eliminated.
To shut up the clang warning, just remove the dead code manually, it has probably never been used because any attempt to do so would have resulted in undefined behavior.
--- drivers/media/platform/davinci/isif.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/media/platform/davinci/isif.c +0 -9
@@ -890,9 +890,7 @@ static int isif_set_hw_if_params(structstatic int isif_config_ycbcr (void ) {struct isif_ycbcr_config *params = &isif_cfg.ycbcr; -struct vpss_pg_frame_size frame_size;u32 modeset =0 , ccdcfg =0 ; -struct vpss_sync_pol sync;dev_dbg (isif_cfg.dev,"\nStarting isif_config_ycbcr..." );
@@ -980,13 +978,6 @@ static int isif_config_ycbcr(void)/* two fields are interleaved in memory */ regw (0x00000249 ,SDOFST ); -/* Setup test pattern if enabled */ -if (isif_cfg.bayer.config_params.test_pat_gen) { - sync.ccdpg_hdpol = params->hd_pol; - sync.ccdpg_vdpol = params->vd_pol; -dm365_vpss_set_sync_pol (sync); -dm365_vpss_set_pg_frame_size (frame_size); - }return 0 ; }
PATCH 13/132 media: wl128x: prevent two potential buffer overflows
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 9c2ccc324b3a6cbc865ab8b3e1a09e93d3c8ade9 upstream.
Smatch marks skb->data as untrusted so it warns that "evt_hdr->dlen" can copy up to 255 bytes and we only have room for two bytes. Even if this comes from the firmware and we trust it, the new policy generally is just to fix it as kernel hardenning.
I can't test this code so I tried to be very conservative. I considered not allowing "evt_hdr->dlen == 1" because it doesn't initialize the whole variable but in the end I decided to allow it and manually initialized "asic_id" and "asic_ver" to zero.
---
drivers/media/radio/wl128x/fmdrv_common.c +6 -2
@@ -494,7 +494,8 @@ int fmc_send_cmd(struct fmdev *fmdev, u8return -EIO ; }/* Send response data to caller */ -if (response !=NULL && response_len !=NULL && evt_hdr->dlen) { +if (response !=NULL && response_len !=NULL && evt_hdr->dlen && + evt_hdr->dlen <= payload_len) {/* Skip header info and copy only response data */ skb_pull (skb,sizeof (struct fm_event_msg_hdr ));memcpy (response, skb->data, evt_hdr->dlen);
@@ -590,6 +591,8 @@ static void fm_irq_handle_flag_getcmd_rereturn ; fm_evt_hdr = (void *)skb->data; +if (fm_evt_hdr->dlen >sizeof (fmdev->irq_info.flag)) +return ;/* Skip header info and copy only response data */ skb_pull (skb,sizeof (struct fm_event_msg_hdr ));
@@ -1318,7 +1321,8 @@ static int load_default_rx_configuration/* Does FM power on sequence */ static int fm_power_up (struct fmdev *fmdev,u8 mode) { -u16 payload, asic_id, asic_ver; +u16 payload; +__be16 asic_id =0 , asic_ver =0 ;int resp_len, ret;u8 fw_name[50 ];
PATCH 14/132 kobject: Don't trigger kobject_uevent(KOBJ_REMOVE) twice.
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit c03a0fd0b609e2f5c669c2b7f27c8e1928e9196e upstream.
syzbot is hitting use-after-free bug in uinput module [1]. This is because kobject_uevent(KOBJ_REMOVE) is called again due to commit 0f4dafc0563c6c49 ("Kobject: auto-cleanup on final unref") after memory allocation fault injection made kobject_uevent(KOBJ_REMOVE) from device_del() from input_unregister_device() fail, while uinput_destroy_device() is expecting that kobject_uevent(KOBJ_REMOVE) is not called after device_del() from input_unregister_device() completed.
That commit intended to catch cases where nobody even attempted to send "remove" uevents. But there is no guarantee that an event will ultimately be sent. We are at the point of no return as far as the rest of the kernel is concerned; there are no repeats or do-overs.
Also, it is not clear whether some subsystem depends on that commit. If no subsystem depends on that commit, it will be better to remove the state_{add,remove}_uevent_sent logic. But we don't want to risk a regression (in a patch which will be backported) by trying to remove that logic. Therefore, as a first step, let's avoid the use-after-free bug by making sure that kobject_uevent(KOBJ_REMOVE) won't be triggered twice.
[1] https://syzkaller.appspot.com/bug?id=8b17c134fe938bbddd75a45afaa9e68af43a362d
---
lib/kobject_uevent.c +7 -2
@@ -178,6 +178,13 @@ int kobject_uevent_env(struct kobject *kstruct uevent_sock *ue_sk;#endif +/* +* Mark "remove" event done regardless of result, for some subsystems +* do not want to re-trigger "remove" event via automatic cleanup. +*/ +if (action ==KOBJ_REMOVE ) + kobj->state_remove_uevent_sent =1 ; +pr_debug ("kobject: '%s' (%p): %s\n" ,kobject_name (kobj), kobj, __func__);
@@ -275,8 +282,6 @@ int kobject_uevent_env(struct kobject *k*/ if (action ==KOBJ_ADD ) kobj->state_add_uevent_sent =1 ; -else if (action ==KOBJ_REMOVE ) - kobj->state_remove_uevent_sent =1 ;mutex_lock (&uevent_sock_mutex);/* we will send an event, so request a new sequence number */
PATCH 15/132 cxgb3/l2t: Fix undefined behaviour
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
commit 76497732932f15e7323dc805e8ea8dc11bb587cf upstream.
The use of zero-sized array causes undefined behaviour when it is not the last member in a structure. As it happens to be in this case.
Also, the current code makes use of a language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as this one is a flexible array member, introduced in C99:
struct foo {
int stuff;
struct boo array[];
};By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last. Which is beneficial to cultivate a high-quality code.
--- drivers/net/ethernet/chelsio/cxgb3/l2t.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb3/l2t.h +1 -1
@@ -75,8 +75,8 @@ struct l2t_data {struct l2t_entry *rover;/* starting point for next allocation */ atomic_t nfree;/* number of free entries */ rwlock_t lock; -struct l2t_entry l2tab[0 ];struct rcu_head rcu_head;/* to handle rcu cleanup */ +struct l2t_entry l2tab[]; }; typedef void (*arp_failure_handler_func)(struct t3cdev * dev,
PATCH 16/132 drm/fb-helper: dpms_legacy(): Only set on connectors in use
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Noralf Trønnes <[email protected]>
commit 65a102f68005891d7f39354cfd79099908df6d51 upstream.
For each enabled crtc the functions sets dpms on all registered connectors. Limit this to only doing it once and on the connectors actually in use.
--- drivers/gpu/drm/drm_fb_helper.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +5 -6
@@ -453,8 +453,8 @@ static void drm_fb_helper_dpms(struct fb {struct drm_fb_helper *fb_helper = info->par;struct drm_device *dev = fb_helper->dev; -struct drm_crtc *crtc;struct drm_connector *connector; +struct drm_mode_set *modeset;int i, j;/*
@@ -475,14 +475,13 @@ static void drm_fb_helper_dpms(struct fb }for (i =0 ; i < fb_helper->crtc_count; i++) { - crtc = fb_helper->crtc_info[i].mode_set.crtc; + modeset = &fb_helper->crtc_info[i].mode_set; -if (!crtc->enabled) +if (!modeset->crtc->enabled)continue ; -/* Walk the connectors & encoders on this fb turning them on/off */ -for (j =0 ; j < fb_helper->connector_count; j++) { - connector = fb_helper->connector_info[j]->connector; +for (j =0 ; j < modeset->num_connectors; j++) { + connector = modeset->connectors[j]; connector->funcs->dpms (connector, dpms_mode);drm_object_property_set_value (&connector->base, dev->mode_config.dpms_property, dpms_mode);
PATCH 17/132 scsi: qla2xxx: Fix incorrect region-size setting in optrom SYSFS routines
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Vasquez <[email protected]>
commit 5cbdae10bf11f96e30b4d14de7b08c8b490e903c upstream.
Commit e6f77540c067 ("scsi: qla2xxx: Fix an integer overflow in sysfs code") incorrectly set 'optrom_region_size' to 'start+size', which can overflow option-rom boundaries when 'start' is non-zero. Continue setting optrom_region_size to the proper adjusted value of 'size'.
--- drivers/scsi/qla2xxx/qla_attr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +2 -2
@@ -423,7 +423,7 @@ qla2x00_sysfs_write_optrom_ctl(struct fi } ha->optrom_region_start = start; - ha->optrom_region_size = start + size; + ha->optrom_region_size = size; ha->optrom_state =QLA_SREADING ; ha->optrom_buffer =vmalloc (ha->optrom_region_size);
@@ -495,7 +495,7 @@ qla2x00_sysfs_write_optrom_ctl(struct fi } ha->optrom_region_start = start; - ha->optrom_region_size = start + size; + ha->optrom_region_size = size; ha->optrom_state =QLA_SWRITING ; ha->optrom_buffer =vmalloc (ha->optrom_region_size);
PATCH 18/132 rtc: don't reference bogus function pointer in kdoc
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
commit c48cadf5bf4becefcd0751b97995d2350aa9bb57 upstream.
The mentioned function pointer is long gone since early 2011. Remove the reference in the comment and reword it slightly.
--- drivers/rtc/interface.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/rtc/interface.c +3 -4
@@ -492,10 +492,9 @@ out:mutex_unlock (&rtc->ops_lock);#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL /* -* Enable emulation if the driver did not provide -* the update_irq_enable function pointer or if returned -* -EINVAL to signal that it has been configured without -* interrupts or that are not available at the moment. +* Enable emulation if the driver returned -EINVAL to signal that it has +* been configured without interrupts or they are not available at the +* moment. */ if (err == -EINVAL ) err =rtc_dev_update_irq_enable_emul (rtc, enabled);
PATCH 19/132 ehea: Fix a copy-paste err in ehea_init_port_res
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
commit c8f191282f819ab4e9b47b22a65c6c29734cefce upstream.
pr->tx_bytes should be assigned to tx_bytes other than rx_bytes.
--- drivers/net/ethernet/ibm/ehea/ehea_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ibm/ehea/ehea_main.c +1 -1
@@ -1476,7 +1476,7 @@ static int ehea_init_port_res(struct ehememset (pr,0 ,sizeof (struct ehea_port_res )); - pr->tx_bytes = rx_bytes; + pr->tx_bytes = tx_bytes; pr->tx_packets = tx_packets; pr->rx_bytes = rx_bytes; pr->rx_packets = rx_packets;
PATCH 20/132 PCI: Factor out pcie_retrain_link() function
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Mätje <[email protected]>
commit 86fa6a344209d9414ea962b1f1ac6ade9dd7563a upstream.
Factor out pcie_retrain_link() to use for Pericom Retrain Link quirk. No functional change intended.
--- drivers/pci/pcie/aspm.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-)
drivers/pci/pcie/aspm.c +24 -16
@@ -175,6 +175,29 @@ static void pcie_clkpm_cap_init(struct p link->clkpm_capable = (blacklist) ?0 : capable; } +static bool pcie_retrain_link (struct pcie_link_state *link) +{ +struct pci_dev *parent = link->pdev; +unsigned long start_jiffies; +u16 reg16; + +pcie_capability_read_word (parent,PCI_EXP_LNKCTL , ®16); + reg16 |=PCI_EXP_LNKCTL_RL ; +pcie_capability_write_word (parent,PCI_EXP_LNKCTL , reg16); + +/* Wait for link training end. Break out after waiting for timeout */ + start_jiffies = jiffies; +for (;;) { +pcie_capability_read_word (parent,PCI_EXP_LNKSTA , ®16); +if (!(reg16 &PCI_EXP_LNKSTA_LT )) +break ; +if (time_after (jiffies, start_jiffies +LINK_RETRAIN_TIMEOUT )) +break ; +msleep (1 ); + } +return !(reg16 &PCI_EXP_LNKSTA_LT ); +} +/* * pcie_aspm_configure_common_clock: check if the 2 ends of a link * could use common clock. If they are, configure them to use the
@@ -184,7 +207,6 @@ static void pcie_aspm_configure_common_c {int same_clock =1 ;u16 reg16, parent_reg, child_reg[8 ]; -unsigned long start_jiffies;struct pci_dev *child, *parent = link->pdev;struct pci_bus *linkbus = parent->subordinate;/*
@@ -224,21 +246,7 @@ static void pcie_aspm_configure_common_c reg16 &= ~PCI_EXP_LNKCTL_CCC ;pcie_capability_write_word (parent,PCI_EXP_LNKCTL , reg16); -/* Retrain link */ - reg16 |=PCI_EXP_LNKCTL_RL ; -pcie_capability_write_word (parent,PCI_EXP_LNKCTL , reg16); - -/* Wait for link training end. Break out after waiting for timeout */ - start_jiffies = jiffies; -for (;;) { -pcie_capability_read_word (parent,PCI_EXP_LNKSTA , ®16); -if (!(reg16 &PCI_EXP_LNKSTA_LT )) -break ; -if (time_after (jiffies, start_jiffies +LINK_RETRAIN_TIMEOUT )) -break ; -msleep (1 ); - } -if (!(reg16 &PCI_EXP_LNKSTA_LT )) +if (pcie_retrain_link (link))return ;/* Training failed. Restore common clock configurations */
PATCH 21/132 PCI: Work around Pericom PCIe-to-PCI bridge Retrain Link erratum
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Mätje <[email protected]>
commit 4ec73791a64bab25cabf16a6067ee478692e506d upstream.
Due to an erratum in some Pericom PCIe-to-PCI bridges in reverse mode (conventional PCI on primary side, PCIe on downstream side), the Retrain Link bit needs to be cleared manually to allow the link training to complete successfully.
If it is not cleared manually, the link training is continuously restarted and no devices below the PCI-to-PCIe bridge can be accessed. That means drivers for devices below the bridge will be loaded but won't work and may even crash because the driver is only reading 0xffff.
See the Pericom Errata Sheet PI7C9X111SLB_errata_rev1.2_102711.pdf for details. Devices known as affected so far are: PI7C9X110, PI7C9X111SL, PI7C9X130.
Add a new flag, clear_retrain_link, in struct pci_dev. Quirks for affected devices set this bit.
Note that pcie_retrain_link() lives in aspm.c because that's currently the only place we use it, but this erratum is not specific to ASPM, and we may retrain links for other reasons in the future.
[bwh: Backported to 3.16:
- Use dev_info() instead of pci_info()
- Adjust context]
--- drivers/pci/pcie/aspm.c | 9 +++++++++ drivers/pci/quirks.c | 17 +++++++++++++++++ include/linux/pci.h | 2 ++ 3 files changed, 28 insertions(+)
drivers/pci/pcie/aspm.c +9 -0
@@ -184,6 +184,15 @@ static bool pcie_retrain_link(struct pcipcie_capability_read_word (parent,PCI_EXP_LNKCTL , ®16); reg16 |=PCI_EXP_LNKCTL_RL ;pcie_capability_write_word (parent,PCI_EXP_LNKCTL , reg16); +if (parent->clear_retrain_link) { +/* +* Due to an erratum in some devices the Retrain Link bit +* needs to be cleared again manually to allow the link +* training to succeed. +*/ + reg16 &= ~PCI_EXP_LNKCTL_RL ; +pcie_capability_write_word (parent,PCI_EXP_LNKCTL , reg16); + }/* Wait for link training end. Break out after waiting for timeout */ start_jiffies = jiffies;
drivers/pci/quirks.c +17 -0
@@ -2047,6 +2047,23 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x10f4 , quirk_disable_aspm_l0s);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x1508 , quirk_disable_aspm_l0s); +/* +* Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain +* Link bit cleared after starting the link retrain process to allow this +* process to finish. +* +* Affected devices: PI7C9X110, PI7C9X111SL, PI7C9X130. See also the +* Pericom Errata Sheet PI7C9X111SLB_errata_rev1.2_102711.pdf. +*/ +static void quirk_enable_clear_retrain_link (struct pci_dev *dev) +{ + dev->clear_retrain_link =1 ; +dev_info (&dev->dev,"Enable PCIe Retrain Link quirk\n" ); +} +DECLARE_PCI_FIXUP_HEADER (0x12d8 ,0xe110 , quirk_enable_clear_retrain_link); +DECLARE_PCI_FIXUP_HEADER (0x12d8 ,0xe111 , quirk_enable_clear_retrain_link); +DECLARE_PCI_FIXUP_HEADER (0x12d8 ,0xe130 , quirk_enable_clear_retrain_link); +static void fixup_rev1_53c810 (struct pci_dev *dev) {/* rev 1 ncr53c810 chips don't set the class at all which means
include/linux/pci.h +2 -0
@@ -308,6 +308,8 @@ struct pci_dev {powered on/off by the corresponding bridge */ unsigned int ignore_hotplug:1; /* Ignore hotplug events */ + unsigned int clear_retrain_link:1; /* Need to clear Retrain Link +bit manually */ unsigned int d3_delay;/* D3->D0 transition time in ms */ unsigned int d3cold_delay;/* D3cold->D0 transition time in ms */
PATCH 22/132 jbd2: check superblock mapped prior to committing
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiufei Xue <[email protected]>
commit 742b06b5628f2cd23cb51a034cb54dc33c6162c5 upstream.
We hit a BUG at fs/buffer.c:3057 if we detached the nbd device before unmounting ext4 filesystem.
The typical chain of events leading to the BUG:jbd2_write_superblock
submit_bh
submit_bh_wbc
BUG_ON(!buffer_mapped(bh));The block device is removed and all the pages are invalidated. JBD2 was trying to write journal superblock to the block device which is no longer present.
Fix this by checking the journal superblock's buffer head prior to submitting.
--- fs/jbd2/journal.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/jbd2/journal.c +4 -0
@@ -1344,6 +1344,10 @@ static int jbd2_write_superblock(journaljournal_superblock_t *sb = journal->j_superblock;int ret; +/* Buffer got discarded which means block device got invalidated */ +if (!buffer_mapped (bh)) +return -EIO ; +trace_jbd2_write_superblock (journal, write_op);if (!(journal->j_flags &JBD2_BARRIER )) write_op &= ~(REQ_FUA |REQ_FLUSH );
PATCH 23/132 crypto: crct10dif-generic - fix use via crypto_shash_digest()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 307508d1072979f4435416f87936f87eaeb82054 upstream.
The ->digest() method of crct10dif-generic reads the current CRC value from the shash_desc context. But this value is uninitialized, causing crypto_shash_digest() to compute the wrong result. Fix it.
Probably this wasn't noticed before because lib/crc-t10dif.c only uses crypto_shash_update(), not crypto_shash_digest(). Likewise, crypto_shash_digest() is not yet tested by the crypto self-tests because those only test the ahash API which only uses shash init/update/final.
This bug was detected by my patches that improve testmgr to fuzz algorithms against their generic implementation.
--- crypto/crct10dif_generic.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
crypto/crct10dif_generic.c +4 -7
@@ -65,10 +65,9 @@ static int chksum_final(struct shash_desreturn 0 ; } -static int __chksum_finup (__u16 *crcp,const u8 *data,unsigned int len, -u8 *out) +static int __chksum_finup (__u16 crc,const u8 *data,unsigned int len,u8 *out) { - *(__u16 *)out =crc_t10dif_generic (*crcp, data, len); + *(__u16 *)out =crc_t10dif_generic (crc, data, len);return 0 ; }
@@ -77,15 +76,13 @@ static int chksum_finup(struct shash_des {struct chksum_desc_ctx *ctx =shash_desc_ctx (desc); -return __chksum_finup (&ctx->crc, data, len, out); +return __chksum_finup (ctx->crc, data, len, out); }static int chksum_digest (struct shash_desc *desc,const u8 *data,unsigned int length,u8 *out) { -struct chksum_desc_ctx *ctx =shash_desc_ctx (desc); - -return __chksum_finup (&ctx->crc, data, length, out); +return __chksum_finup (0 , data, length, out); }static struct shash_alg alg = {
PATCH 24/132 crypto: x86/crct10dif-pcl - fix use via crypto_shash_digest()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit dec3d0b1071a0f3194e66a83d26ecf4aa8c5910e upstream.
The ->digest() method of crct10dif-pclmul reads the current CRC value from the shash_desc context. But this value is uninitialized, causing crypto_shash_digest() to compute the wrong result. Fix it.
Probably this wasn't noticed before because lib/crc-t10dif.c only uses crypto_shash_update(), not crypto_shash_digest(). Likewise, crypto_shash_digest() is not yet tested by the crypto self-tests because those only test the ahash API which only uses shash init/update/final.
--- arch/x86/crypto/crct10dif-pclmul_glue.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
arch/x86/crypto/crct10dif-pclmul_glue.c +5 -8
@@ -76,15 +76,14 @@ static int chksum_final(struct shash_desreturn 0 ; } -static int __chksum_finup (__u16 *crcp,const u8 *data,unsigned int len, -u8 *out) +static int __chksum_finup (__u16 crc,const u8 *data,unsigned int len,u8 *out) {if (irq_fpu_usable ()) {kernel_fpu_begin (); - *(__u16 *)out =crc_t10dif_pcl (*crcp, data, len); + *(__u16 *)out =crc_t10dif_pcl (crc, data, len);kernel_fpu_end (); }else - *(__u16 *)out =crc_t10dif_generic (*crcp, data, len); + *(__u16 *)out =crc_t10dif_generic (crc, data, len);return 0 ; }
@@ -93,15 +92,13 @@ static int chksum_finup(struct shash_des {struct chksum_desc_ctx *ctx =shash_desc_ctx (desc); -return __chksum_finup (&ctx->crc, data, len, out); +return __chksum_finup (ctx->crc, data, len, out); }static int chksum_digest (struct shash_desc *desc,const u8 *data,unsigned int length,u8 *out) { -struct chksum_desc_ctx *ctx =shash_desc_ctx (desc); - -return __chksum_finup (&ctx->crc, data, length, out); +return __chksum_finup (0 , data, length, out); }static struct shash_alg alg = {
PATCH 25/132 scsi: qla2xxx: Unregister chrdev if module initialization fails
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit c794d24ec9eb6658909955772e70f34bef5b5b91 upstream.
If module initialization fails after the character device has been registered, unregister the character device. Additionally, avoid duplicating error path code.
--- drivers/scsi/qla2xxx/qla_os.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +21 -13
@@ -5775,8 +5775,7 @@ qla2x00_module_init(void)/* Initialize target kmem_cache and mem_pools */ ret =qlt_init ();if (ret <0 ) { -kmem_cache_destroy (srb_cachep); -return ret; + goto destroy_cache; }else if (ret >0 ) {/* * If initiator mode is explictly disabled by qlt_init(),
@@ -5795,11 +5794,10 @@ qla2x00_module_init(void) qla2xxx_transport_template =fc_attach_transport (&qla2xxx_transport_functions);if (!qla2xxx_transport_template) { -kmem_cache_destroy (srb_cachep);ql_log (ql_log_fatal,NULL ,0x0002 ,"fc_attach_transport failed...Failing load!.\n" ); -qlt_exit (); -return -ENODEV ; + ret = -ENODEV ; + goto qlt_exit; } apidev_major =register_chrdev (0 ,QLA2XXX_APIDEV , &apidev_fops);
@@ -5811,27 +5809,37 @@ qla2x00_module_init(void) qla2xxx_transport_vport_template =fc_attach_transport (&qla2xxx_transport_vport_functions);if (!qla2xxx_transport_vport_template) { -kmem_cache_destroy (srb_cachep); -qlt_exit (); -fc_release_transport (qla2xxx_transport_template);ql_log (ql_log_fatal,NULL ,0x0004 ,"fc_attach_transport vport failed...Failing load!.\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto unreg_chrdev; }ql_log (ql_log_info,NULL ,0x0005 ,"QLogic Fibre Channel HBA Driver: %s.\n" , qla2x00_version_str); ret =pci_register_driver (&qla2xxx_pci_driver);if (ret) { -kmem_cache_destroy (srb_cachep); -qlt_exit (); -fc_release_transport (qla2xxx_transport_template); -fc_release_transport (qla2xxx_transport_vport_template);ql_log (ql_log_fatal,NULL ,0x0006 ,"pci_register_driver failed...ret=%d Failing load!.\n" , ret); + goto release_vport_transport; }return ret; + +release_vport_transport: +fc_release_transport (qla2xxx_transport_vport_template); + +unreg_chrdev: +if (apidev_major >=0 ) +unregister_chrdev (apidev_major,QLA2XXX_APIDEV ); +fc_release_transport (qla2xxx_transport_template); + +qlt_exit: +qlt_exit (); + +destroy_cache: +kmem_cache_destroy (srb_cachep); +return ret; }/**
PATCH 26/132 arm64: compat: Reduce address limit
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vincenzo Frascino <[email protected]>
commit d263119387de9975d2acba1dfd3392f7c5979c18 upstream.
Currently, compat tasks running on arm64 can allocate memory up to TASK_SIZE_32 (UL(0x100000000)).
This means that mmap() allocations, if we treat them as returning an array, are not compliant with the sections 6.5.8 of the C standard (C99) which states that: "If the expression P points to an element of an array object and the expression Q points to the last element of the same array object, the pointer expression Q+1 compares greater than P".
Redefine TASK_SIZE_32 to address the issue.
--- arch/arm64/include/asm/memory.h | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/include/asm/memory.h +8 -0
@@ -53,7 +53,15 @@#define TASK_SIZE_64 (UL(1) << VA_BITS)#ifdef CONFIG_COMPAT +#ifdef CONFIG_ARM64_64K_PAGES +/* +* With CONFIG_ARM64_64K_PAGES enabled, the last page is occupied +* by the compat vectors page. +*/ #define TASK_SIZE_32 UL(0x100000000) +#else +#define TASK_SIZE_32 (UL(0x100000000) - PAGE_SIZE) +#endif /* CONFIG_ARM64_64K_PAGES */ #define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ TASK_SIZE_32 : TASK_SIZE_64)#define TASK_SIZE_OF (tsk) (test_tsk_thread_flag(tsk, TIF_32BIT) ? \
PATCH 27/132 ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data"
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
commit 9ee8578d953023cc57e7e736ae48502c707c0210 upstream.
Since commit 1c459de1e645 ("ARM: pxa: ssp: use devm_ functions") kfree, iounmap, clk_put etc are not needed anymore in remove path.
--- arch/arm/plat-pxa/ssp.c | 6 ------ 1 file changed, 6 deletions(-)
arch/arm/plat-pxa/ssp.c +0 -6
@@ -232,18 +232,12 @@ static int pxa_ssp_probe(struct platformstatic int pxa_ssp_remove (struct platform_device *pdev) { -struct resource *res;struct ssp_device *ssp; ssp =platform_get_drvdata (pdev);if (ssp ==NULL )return -ENODEV ; - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -release_mem_region (res->start,resource_size (res)); - -clk_put (ssp->clk); -mutex_lock (&ssp_lock);list_del (&ssp->node);mutex_unlock (&ssp_lock);
PATCH 28/132 hwmon: (f71805f) Use request_muxed_region for Super-IO accesses
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 73e6ff71a7ea924fb7121d576a2d41e3be3fc6b5 upstream.
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Unable to handle kernel paging request at virtual address ffffffbffee0002e pgd = ffffffc1d68d4000 [ffffffbffee0002e] *pgd=0000000000000000, *pud=0000000000000000 Internal error: Oops: 94000046 [#1] PREEMPT SMP Modules linked in: f71805f(+) hwmon CPU: 3 PID: 1659 Comm: insmod Not tainted 4.5.0+ #88 Hardware name: linux,dummy-virt (DT) task: ffffffc1f6665400 ti: ffffffc1d6418000 task.ti: ffffffc1d6418000 PC is at f71805f_find+0x6c/0x358 [f71805f]
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/f71805f.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/hwmon/f71805f.c +12 -3
@@ -96,17 +96,23 @@ superio_select(int base, int ld)outb (ld, base +1 ); } -static inline void +static inline int superio_enter (int base) { +if (!request_muxed_region (base,2 ,DRVNAME )) +return -EBUSY ; +outb (0x87 , base);outb (0x87 , base); + +return 0 ; }static inline void superio_exit (int base) {outb (0xaa , base); +release_region (base,2 ); }/*
@@ -1562,7 +1568,7 @@ exit:static int __init f71805f_find (int sioaddr,unsigned short *address,struct f71805f_sio_data *sio_data) { -int err = -ENODEV ; +int err;u16 devid;static const char *const names[] = {
@@ -1570,8 +1576,11 @@ static int __init f71805f_find(int sioad "F71872F/FG or F71806F/FG", }; -superio_enter (sioaddr); + err =superio_enter (sioaddr); +if (err) +return err; + err = -ENODEV ; devid =superio_inw (sioaddr,SIO_REG_MANID );if (devid !=SIO_FINTEK_ID ) goto exit;
PATCH 29/132 hwmon: (pc87427) Use request_muxed_region for Super-IO accesses
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 755a9b0f8aaa5639ba5671ca50080852babb89ce upstream.
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/pc87427.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/hwmon/pc87427.c +13 -1
@@ -106,6 +106,13 @@ static const char *logdev_str[2] = { DRV#define LD_IN 1#define LD_TEMP 1 +static inline int superio_enter (int sioaddr) +{ +if (!request_muxed_region (sioaddr,2 ,DRVNAME )) +return -EBUSY ; +return 0 ; +} +static inline void superio_outb (int sioaddr,int reg,int val) {outb (reg, sioaddr);
@@ -122,6 +129,7 @@ static inline void superio_exit(int sioa {outb (0x02 , sioaddr);outb (0x02 , sioaddr +1 ); +release_region (sioaddr,2 ); }/*
@@ -1221,7 +1229,11 @@ static int __init pc87427_find(int sioad {u16 val;u8 cfg, cfg_b; -int i, err =0 ; +int i, err; + + err =superio_enter (sioaddr); +if (err) +return err;/* Identify device */ val = force_id ? force_id :superio_inb (sioaddr,SIOREG_DEVID );
PATCH 30/132 hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 8c0826756744c0ac1df600a5e4cca1a341b13101 upstream.
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/smsc47b397.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/hwmon/smsc47b397.c +11 -2
@@ -72,14 +72,19 @@ static inline void superio_select(int ldsuperio_outb (0x07 , ld); } -static inline void superio_enter (void ) +static inline int superio_enter (void ) { +if (!request_muxed_region (REG ,2 ,DRVNAME )) +return -EBUSY ; +outb (0x55 ,REG ); +return 0 ; }static inline void superio_exit (void ) {outb (0xAA ,REG ); +release_region (REG ,2 ); }#define SUPERIO_REG_DEVID 0x20
@@ -338,8 +343,12 @@ static int __init smsc47b397_find(void)u8 id, rev;char *name;unsigned short addr; +int err; + + err =superio_enter (); +if (err) +return err; -superio_enter (); id = force_id ? force_id :superio_inb (SUPERIO_REG_DEVID );switch (id) {
PATCH 31/132 hwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit d6410408ad2a798c4cc685252c1baa713be0ad69 upstream.
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/smsc47m1.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/hwmon/smsc47m1.c +19 -9
@@ -73,16 +73,21 @@ superio_inb(int reg)/* logical device for fans is 0x0A */ #define superio_select () superio_outb(0x07, 0x0A) -static inline void +static inline int superio_enter (void ) { +if (!request_muxed_region (REG ,2 ,DRVNAME )) +return -EBUSY ; +outb (0x55 ,REG ); +return 0 ; }static inline void superio_exit (void ) {outb (0xAA ,REG ); +release_region (REG ,2 ); }#define SUPERIO_REG_ACT 0x30
@@ -495,8 +500,12 @@ static int __init smsc47m1_find(struct s {u8 val;unsigned short addr; +int err; + + err =superio_enter (); +if (err) +return err; -superio_enter (); val = force_id ? force_id :superio_inb (SUPERIO_REG_DEVID );/*
@@ -572,13 +581,14 @@ static int __init smsc47m1_find(struct sstatic void smsc47m1_restore (const struct smsc47m1_sio_data *sio_data) {if ((sio_data->activate &0x01 ) ==0 ) { -superio_enter (); -superio_select (); - -pr_info ("Disabling device\n" ); -superio_outb (SUPERIO_REG_ACT , sio_data->activate); - -superio_exit (); +if (!superio_enter ()) { +superio_select (); +pr_info ("Disabling device\n" ); +superio_outb (SUPERIO_REG_ACT , sio_data->activate); +superio_exit (); + }else { +pr_warn ("Failed to disable device\n" ); + } } }
PATCH 32/132 hwmon: (w83627hf) Use request_muxed_region for Super-IO accesses
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit e95fd518d05bfc087da6fcdea4900a57cfb083bd upstream.
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/w83627hf.c | 42 +++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-)
drivers/hwmon/w83627hf.c +37 -5
@@ -130,17 +130,23 @@ superio_select(struct w83627hf_sio_dataoutb (ld, sio->sioaddr +1 ); } -static inline void +static inline int superio_enter (struct w83627hf_sio_data *sio) { +if (!request_muxed_region (sio->sioaddr,2 ,DRVNAME )) +return -EBUSY ; +outb (0x87 , sio->sioaddr);outb (0x87 , sio->sioaddr); + +return 0 ; }static inline void superio_exit (struct w83627hf_sio_data *sio) {outb (0xAA , sio->sioaddr); +release_region (sio->sioaddr,2 ); }#define W627_DEVID 0x52
@@ -1273,7 +1279,7 @@ static DEVICE_ATTR(name, S_IRUGO, show_nstatic int __init w83627hf_find (int sioaddr,unsigned short *addr,struct w83627hf_sio_data *sio_data) { -int err = -ENODEV ; +int err;u16 val;static __initconst char *const names[] = {
@@ -1285,7 +1291,11 @@ static int __init w83627hf_find(int sioa }; sio_data->sioaddr = sioaddr; -superio_enter (sio_data); + err =superio_enter (sio_data); +if (err) +return err; + + err = -ENODEV ; val = force_id ? force_id :superio_inb (sio_data,DEVID );switch (val) {case W627_DEVID :
@@ -1639,9 +1649,21 @@ static int w83627thf_read_gpio5(struct pstruct w83627hf_sio_data *sio_data =dev_get_platdata (&pdev->dev);int res =0xff , sel; -superio_enter (sio_data); +if (superio_enter (sio_data)) { +/* +* Some other driver reserved the address space for itself. +* We don't want to fail driver instantiation because of that, +* so display a warning and keep going. +*/ +dev_warn (&pdev->dev, +"Can not read VID data: Failed to enable SuperIO access\n" ); +return res; + } +superio_select (sio_data,W83627HF_LD_GPIO5 ); + res =0xff ; +/* Make sure these GPIO pins are enabled */ if (!(superio_inb (sio_data,W83627THF_GPIO5_EN ) & (1 <<3 ))) {dev_dbg (&pdev->dev,"GPIO5 disabled, no VID function\n" );
@@ -1672,7 +1694,17 @@ static int w83687thf_read_vid(struct plastruct w83627hf_sio_data *sio_data =dev_get_platdata (&pdev->dev);int res =0xff ; -superio_enter (sio_data); +if (superio_enter (sio_data)) { +/* +* Some other driver reserved the address space for itself. +* We don't want to fail driver instantiation because of that, +* so display a warning and keep going. +*/ +dev_warn (&pdev->dev, +"Can not read VID data: Failed to enable SuperIO access\n" ); +return res; + } +superio_select (sio_data,W83627HF_LD_HWM );/* Make sure these GPIO pins are enabled */
PATCH 33/132 hwmon: (vt1211) Use request_muxed_region for Super-IO accesses
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 14b97ba5c20056102b3dd22696bf17b057e60976 upstream.
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time, resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested address space is supported, and to ensure that access by multiple drivers is synchronized.
--- drivers/hwmon/vt1211.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/hwmon/vt1211.c +12 -3
@@ -226,15 +226,21 @@ static inline void superio_select(int sioutb (ldn, sio_cip +1 ); } -static inline void superio_enter (int sio_cip) +static inline int superio_enter (int sio_cip) { +if (!request_muxed_region (sio_cip,2 ,DRVNAME )) +return -EBUSY ; +outb (0x87 , sio_cip);outb (0x87 , sio_cip); + +return 0 ; }static inline void superio_exit (int sio_cip) {outb (0xaa , sio_cip); +release_region (sio_cip,2 ); }/* ---------------------------------------------------------------------
@@ -1280,11 +1286,14 @@ EXIT:static int __init vt1211_find (int sio_cip,unsigned short *address) { -int err = -ENODEV ; +int err;int devid; -superio_enter (sio_cip); + err =superio_enter (sio_cip); +if (err) +return err; + err = -ENODEV ; devid = force_id ? force_id :superio_inb (sio_cip,SIO_VT1211_DEVID );if (devid !=SIO_VT1211_ID ) goto EXIT;
PATCH 34/132 RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit a6d2a5a92e67d151c98886babdc86d530d27111c upstream.
Currently if alloc_skb fails to allocate the skb a null skb is passed to t4_set_arp_err_handler and this ends up dereferencing the null skb. Avoid the NULL pointer dereference by checking for a NULL skb and returning early.
Addresses-Coverity: ("Dereference null return")
--- drivers/infiniband/hw/cxgb4/cm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/cxgb4/cm.c +2 -0
@@ -346,6 +346,8 @@ static struct sk_buff *get_skb(struct skskb_reset_transport_header (skb); }else { skb =alloc_skb (len, gfp); +if (!skb) +return NULL ; }t4_set_arp_err_handler (skb,NULL ,NULL );return skb;
PATCH 35/132 platform/x86: alienware-wmi: fix kfree on potentially uninitialized pointer
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 98e2630284ab741804bd0713e932e725466f2f84 upstream.
Currently the kfree of output.pointer can be potentially freeing an uninitalized pointer in the case where out_data is NULL. Fix this by reworking the case where out_data is not-null to perform the ACPI status check and also the kfree of outpoint.pointer in one block and hence ensuring the pointer is only freed when it has been used.
Also replace the if (ptr != NULL) idiom with just if (ptr).
--- drivers/platform/x86/alienware-wmi.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/platform/x86/alienware-wmi.c +8 -9
@@ -433,23 +433,22 @@ static acpi_status alienware_hdmi_comman input.length = (acpi_size )sizeof (*in_args); input.pointer = in_args; -if (out_data !=NULL ) { +if (out_data) { output.length =ACPI_ALLOCATE_BUFFER ; output.pointer =NULL ; status =wmi_evaluate_method (WMAX_CONTROL_GUID ,1 , command, &input, &output); - }else +if (ACPI_SUCCESS (status)) { + obj = (union acpi_object *)output.pointer; +if (obj && obj->type ==ACPI_TYPE_INTEGER ) + *out_data = (u32 )obj->integer.value; + } +kfree (output.pointer); + }else { status =wmi_evaluate_method (WMAX_CONTROL_GUID ,1 , command, &input,NULL ); - -if (ACPI_SUCCESS (status) && out_data !=NULL ) { - obj = (union acpi_object *)output.pointer; -if (obj && obj->type ==ACPI_TYPE_INTEGER ) - *out_data = (u32 ) obj->integer.value; } -kfree (output.pointer);return status; - } static ssize_t show_hdmi_cable(struct device *dev,
PATCH 36/132 crypto: salsa20 - don't access already-freed walk.iv
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit edaf28e996af69222b2cb40455dbb5459c2b875a upstream.
If the user-provided IV needs to be aligned to the algorithm's alignmask, then skcipher_walk_virt() copies the IV into a new aligned buffer walk.iv. But skcipher_walk_virt() can fail afterwards, and then if the caller unconditionally accesses walk.iv, it's a use-after-free.
salsa20-generic doesn't set an alignmask, so currently it isn't affected by this despite unconditionally accessing walk.iv. However this is more subtle than desired, and it was actually broken prior to the alignmask being removed by commit b62b3db76f73 ("crypto: salsa20-generic - cleanup and convert to skcipher API").
Since salsa20-generic does not update the IV and does not need any IV alignment, update it to use req->iv instead of walk.iv.
--- crypto/salsa20_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/salsa20_generic.c +1 -1
@@ -186,7 +186,7 @@ static int encrypt(struct blkcipher_descblkcipher_walk_init (&walk, dst, src, nbytes); err =blkcipher_walk_virt_block (desc, &walk,64 ); -salsa20_ivsetup (ctx, walk.iv); +salsa20_ivsetup (ctx, desc->info);while (walk.nbytes >=64 ) { salsa20_encrypt_bytes(ctx, walk.dst.virt.addr,
PATCH 37/132 crypto: arm/aes-neonbs - don't access already-freed walk.iv
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 767f015ea0b7ab9d60432ff6cd06b664fd71f50f upstream.
If the user-provided IV needs to be aligned to the algorithm's alignmask, then skcipher_walk_virt() copies the IV into a new aligned buffer walk.iv. But skcipher_walk_virt() can fail afterwards, and then if the caller unconditionally accesses walk.iv, it's a use-after-free.
arm32 xts-aes-neonbs doesn't set an alignmask, so currently it isn't affected by this despite unconditionally accessing walk.iv. However this is more subtle than desired, and it was actually broken prior to the alignmask being removed by commit cc477bf64573 ("crypto: arm/aes - replace bit-sliced OpenSSL NEON code"). Thus, update xts-aes-neonbs to start checking the return value of skcipher_walk_virt().
--- arch/arm/crypto/aesbs-glue.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/crypto/aesbs-glue.c +4 -0
@@ -259,6 +259,8 @@ static int aesbs_xts_encrypt(struct blkcblkcipher_walk_init (&walk, dst, src, nbytes); err =blkcipher_walk_virt_block (desc, &walk,8 *AES_BLOCK_SIZE ); +if (err) +return err;/* generate the initial tweak */ AES_encrypt (walk.iv, walk.iv, &ctx->twkey);
@@ -283,6 +285,8 @@ static int aesbs_xts_decrypt(struct blkcblkcipher_walk_init (&walk, dst, src, nbytes); err =blkcipher_walk_virt_block (desc, &walk,8 *AES_BLOCK_SIZE ); +if (err) +return err;/* generate the initial tweak */ AES_encrypt (walk.iv, walk.iv, &ctx->twkey);
PATCH 38/132 selftests/ipc: Fix msgque compiler warnings
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit a147faa96f832f76e772b1e448e94ea84c774081 upstream.
This fixes the various compiler warnings when building the msgque selftest. The primary change is using sys/msg.h instead of linux/msg.h directly to gain the API declarations.
--- tools/testing/selftests/ipc/msgque.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tools/testing/selftests/ipc/msgque.c +6 -5
@@ -1,8 +1,9 @@ +#define _GNU_SOURCE#include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> -#include <linux/msg.h> +#include <sys/msg.h> #include <fcntl.h> #define MAX_MSG_SIZE 32
@@ -70,7 +71,7 @@ int restore_queue(struct msgque_data *msreturn 0 ; destroy: -if (msgctl (id,IPC_RMID ,0 )) +if (msgctl (id,IPC_RMID ,NULL ))printf ("Failed to destroy queue: %d\n" , -errno);return ret; }
@@ -117,7 +118,7 @@ int check_and_destroy_queue(struct msgqu ret =0 ; err: -if (msgctl (msgque->msq_id,IPC_RMID ,0 )) { +if (msgctl (msgque->msq_id,IPC_RMID ,NULL )) {printf ("Failed to destroy queue: %d\n" , -errno);return -errno; }
@@ -126,7 +127,7 @@ err:int dump_queue (struct msgque_data *msgque) { -struct msqid64_ds ds; +struct msqid_ds ds;int kern_id;int i, ret;
@@ -243,7 +244,7 @@ int main(int argc, char **argv)return 0 ; err_destroy: -if (msgctl (msgque.msq_id,IPC_RMID ,0 )) { +if (msgctl (msgque.msq_id,IPC_RMID ,NULL )) {printf ("Failed to destroy queue: %d\n" , -errno);return -errno; }
PATCH 39/132 powerpc/83xx: Add missing of_node_put() after of_device_is_available()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julia Lawall <[email protected]>
commit 4df2cb633b5b22ba152511f1a55e718efca6c0d9 upstream.
Add an of_node_put() when a tested device node is not available.
--- arch/powerpc/platforms/83xx/usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/83xx/usb.c +3 -1
@@ -222,8 +222,10 @@ int mpc837x_usb_cfg(void)int ret =0 ; np =of_find_compatible_node (NULL ,NULL ,"fsl-usb2-dr" ); -if (!np || !of_device_is_available (np)) +if (!np || !of_device_is_available (np)) { +of_node_put (np);return -ENODEV ; + } prop =of_get_property (np,"phy_type" ,NULL );if (!prop || (strcmp (prop,"ulpi" ) &&strcmp (prop,"serial" ))) {
PATCH 40/132 media: ov6650: Fix sensor possibly not detected on probe
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Janusz Krzysztofik <[email protected]>
commit 933c1320847f5ed6b61a7d10f0a948aa98ccd7b0 upstream.
After removal of clock_start() from before soc_camera_init_i2c() in soc_camera_probe() by commit 9aea470b399d ("[media] soc-camera: switch I2C subdevice drivers to use v4l2-clk") introduced in v3.11, the ov6650 driver could no longer probe the sensor successfully because its clock was no longer turned on in advance. The issue was initially worked around by adding that missing clock_start() equivalent to OMAP1 camera interface driver - the only user of this sensor - but a propoer fix should be rather implemented in the sensor driver code itself.
Fix the issue by inserting a delay between the clock is turned on and the sensor I2C registers are read for the first time.
Tested on Amstrad Delta with now out of tree but still locally maintained omap1_camera host driver.
--- drivers/media/i2c/soc_camera/ov6650.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/soc_camera/ov6650.c +2 -0
@@ -829,6 +829,8 @@ static int ov6650_video_probe(struct i2cif (ret <0 )return ret; +msleep (20 ); +/* * check and show product ID and manufacturer ID */
PATCH 41/132 media: pvrusb2: Prevent a buffer overflow
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit c1ced46c7b49ad7bc064e68d966e0ad303f917fb upstream.
The ctrl_check_input() function is called from pvr2_ctrl_range_check(). It's supposed to validate user supplied input and return true or false depending on whether the input is valid or not. The problem is that negative shifts or shifts greater than 31 are undefined in C. In practice with GCC they result in shift wrapping so this function returns true for some inputs which are not valid and this could result in a buffer overflow:
drivers/media/usb/pvrusb2/pvrusb2-ctrl.c:205 pvr2_ctrl_get_valname()
warn: uncapped user index 'names[val]'
The cptr->hdw->input_allowed_mask mask is configured in pvr2_hdw_create() and the highest valid bit is BIT(4).
--- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 ++ drivers/media/usb/pvrusb2/pvrusb2-hdw.h | 1 + 2 files changed, 3 insertions(+)
drivers/media/usb/pvrusb2/pvrusb2-hdw.c +2 -0
@@ -670,6 +670,8 @@ static int ctrl_get_input(struct pvr2_ctstatic int ctrl_check_input (struct pvr2_ctrl *cptr,int v) { +if (v <0 || v >PVR2_CVAL_INPUT_MAX ) +return 0 ;return ((1 << v) & cptr->hdw->input_allowed_mask) !=0 ; }
drivers/media/usb/pvrusb2/pvrusb2-hdw.h +1 -0
@@ -54,6 +54,7 @@#define PVR2_CVAL_INPUT_COMPOSITE 2#define PVR2_CVAL_INPUT_SVIDEO 3#define PVR2_CVAL_INPUT_RADIO 4 +#define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIOenum pvr2_config { pvr2_config_empty,/* No configuration */
PATCH 42/132 PCI: Mark Atheros AR9462 to avoid bus reset
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: James Prestwood <[email protected]>
commit 6afb7e26978da5e86e57e540fdce65c8b04f398a upstream.
When using PCI passthrough with this device, the host machine locks up completely when starting the VM, requiring a hard reboot. Add a quirk to avoid bus resets on this device.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -3154,6 +3154,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0032 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003c , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0034 , quirk_no_bus_reset);static void pci_do_fixups (struct pci_dev *dev,struct pci_fixup *f,struct pci_fixup *end)
PATCH 43/132 smpboot: Place the __percpu annotation correctly
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit d4645d30b50d1691c26ff0f8fa4e718b08f8d3bb upstream.
The test robot reported a wrong assignment of a per-CPU variable which it detected by using sparse and sent a report. The assignment itself is correct. The annotation for sparse was wrong and hence the report. The first pointer is a "normal" pointer and points to the per-CPU memory area. That means that the __percpu annotation has to be moved.
Move the __percpu annotation to pointer which points to the per-CPU area. This change affects only the sparse tool (and is ignored by the compiler).
--- include/linux/smpboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/smpboot.h +1 -1
@@ -31,7 +31,7 @@ struct smpboot_thread_data;* @thread_comm: The base name of the thread */ struct smp_hotplug_thread { -struct task_struct __percpu **store; +struct task_struct *__percpu *store;struct list_head list;int (*thread_should_run)(unsigned int cpu);void (*thread_fn)(unsigned int cpu);
PATCH 44/132 x86/uaccess: Dont leak the AC flag into __put_user() argument evaluation
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 6ae865615fc43d014da2fd1f1bba7e81ee622d1b upstream.
The __put_user() macro evaluates it's @ptr argument inside the __uaccess_begin() / __uaccess_end() region. While this would normally not be expected to be an issue, an UBSAN bug (it ignored -fwrapv, fixed in GCC 8+) would transform the @ptr evaluation for:
drivers/gpu/drm/i915/i915_gem_execbuffer.c: if (unlikely(__put_user(offset, &urelocs[r-stack].presumed_offset))) {into a signed-overflow-UB check and trigger the objtool AC validation.
Finish this commit:
2a418cf3f5f1 ("x86/uaccess: Don't leak the AC flag into __put_user() value evaluation")
and explicitly evaluate all 3 arguments early.
--- arch/x86/include/asm/uaccess.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/include/asm/uaccess.h +4 -3
@@ -422,10 +422,11 @@ do { \#define __put_user_nocheck (x, ptr, size) \ ({ \ int __pu_err; \ - __typeof__(*(ptr)) __pu_val; \ - __pu_val = x; \ + __typeof__(*(ptr)) __pu_val = (x); \ + __typeof__(ptr) __pu_ptr = (ptr); \ + __typeof__(size) __pu_size = (size); \ __uaccess_begin(); \ - __put_user_size(__pu_val, (ptr), (size), __pu_err, -EFAULT); \ + __put_user_size(__pu_val, __pu_ptr, __pu_size, __pu_err, -EFAULT); \ __uaccess_end(); \ __pu_err; \ })
PATCH 45/132 ALSA: usb-audio: Handle the error from snd_usb_mixer_apply_create_quirk()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 328e9f6973be2ee67862cb17bf6c0c5c5918cd72 upstream.
The error from snd_usb_mixer_apply_create_quirk() is ignored in the current usb-audio driver code, which will continue the probing even after the error. Let's take it more serious.
--- sound/usb/mixer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/usb/mixer.c +3 -1
@@ -2499,7 +2499,9 @@ int snd_usb_create_mixer(struct snd_usb_ (err = snd_usb_mixer_status_create(mixer)) < 0) goto _error; -snd_usb_mixer_apply_create_quirk (mixer); + err =snd_usb_mixer_apply_create_quirk (mixer); +if (err <0 ) + goto _error; err =snd_device_new (chip->card,SNDRV_DEV_CODEC , mixer, &dev_ops);if (err <0 )
PATCH 46/132 fuse: fix writepages on 32bit
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 9de5be06d0a89ca97b5ab902694d42dfd2bb77d2 upstream.
Writepage requests were cropped to i_size & 0xffffffff, which meant that mmaped writes to any file larger than 4G might be silently discarded.
Fix by storing the file size in a properly sized variable (loff_t instead of size_t).
--- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +1 -1
@@ -1597,7 +1597,7 @@ __acquires(fc->lock) {struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_inode *fi =get_fuse_inode (inode); -size_t crop =i_size_read (inode); +loff_t crop =i_size_read (inode);struct fuse_req *req;while (fi->writectr >=0 && !list_empty (&fi->queued_writes)) {
PATCH 47/132 fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
commit 0cbade024ba501313da3b7e5dd2a188a6bc491b5 upstream.
fstests generic/228 reported this failure that fuse fallocate does not honor what 'ulimit -f' has set.
This adds the necessary inode_newsize_ok() check.
--- fs/fuse/file.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/fuse/file.c +7 -0
@@ -3017,6 +3017,13 @@ static long fuse_file_fallocate(struct f } } +if (!(mode &FALLOC_FL_KEEP_SIZE ) && + offset + length >i_size_read (inode)) { + err =inode_newsize_ok (inode, offset + length); +if (err) +return err; + } +if (!(mode &FALLOC_FL_KEEP_SIZE ))set_bit (FUSE_I_SIZE_UNSTABLE , &fi->state);
PATCH 48/132 fuse: fallocate: fix return with locked inode
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 35d6fcbb7c3e296a52136347346a698a35af3fda upstream.
Do the proper cleanup in case the size check fails.
Tested with xfstests:generic/228
--- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +1 -1
@@ -3021,7 +3021,7 @@ static long fuse_file_fallocate(struct f offset + length > i_size_read(inode)) { err =inode_newsize_ok (inode, offset + length);if (err) -return err; + goto out; }if (!(mode &FALLOC_FL_KEEP_SIZE ))
PATCH 49/132 bcache: fix memory corruption in init error path
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Slava Pestov <[email protected]>
commit c9a78332b42cbdcdd386a95192a716b67d1711a4 upstream.
If register_cache_set() failed, we would touch ca->set after it had already been freed. Also, fix an assertion to catch this.
--- drivers/md/bcache/super.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/md/bcache/super.c +8 -3
@@ -1365,8 +1365,11 @@ static void cache_set_free(struct closurbch_journal_free (c);for_each_cache (ca, c, i) -if (ca) +if (ca) { + ca->set =NULL ; + c->cache[ca->sb.nr_this_dev] =NULL ;kobject_put (&ca->kobj); + }bch_bset_sort_state_free (&c->sort);free_pages ((unsigned long ) c->uuids,ilog2 (bucket_pages (c)));
@@ -1804,8 +1807,10 @@ void bch_cache_release(struct kobject *k struct cache *ca = container_of(kobj, struct cache, kobj);unsigned i; -if (ca->set) +if (ca->set) { +BUG_ON (ca->set->cache[ca->sb.nr_this_dev] != ca); ca->set->cache[ca->sb.nr_this_dev] =NULL ; + }bio_split_pool_free (&ca->bio_split_hook);
@@ -1868,7 +1873,7 @@ static int cache_alloc(struct cache_sb * }static int register_cache (struct cache_sb *sb,struct page *sb_page, -struct block_device *bdev,struct cache *ca) +struct block_device *bdev,struct cache *ca) {char name[BDEVNAME_SIZE ];const char *err =NULL ;/* must be set for any error case */
PATCH 50/132 bcache: fix a race between cache register and cacheset unregister
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Liang Chen <[email protected]>
commit a4b732a248d12cbdb46999daf0bf288c011335eb upstream.
There is a race between cache device register and cache set unregister. For an already registered cache device, register_bcache will call bch_is_open to iterate through all cachesets and check every cache there. The race occurs if cache_set_free executes at the same time and clears the caches right before ca is dereferenced in bch_is_open_cache. To close the race, let's make sure the clean up work is protected by the bch_register_lock as well.
This issue can be reproduced as follows,
while true; do echo /dev/XXX> /sys/fs/bcache/register ; done& while true; do echo 1> /sys/block/XXX/bcache/set/unregister ; done &
and results in the following oops,
[ +0.000053] BUG: unable to handle kernel NULL pointer dereference at 0000000000000998 [ +0.000457] #PF error: [normal kernel read fault] [ +0.000464] PGD 800000003ca9d067 P4D 800000003ca9d067 PUD 3ca9c067 PMD 0 [ +0.000388] Oops: 0000 [#1] SMP PTI [ +0.000269] CPU: 1 PID: 3266 Comm: bash Not tainted 5.0.0+ #6 [ +0.000346] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.fc28 04/01/2014 [ +0.000472] RIP: 0010:register_bcache+0x1829/0x1990 [bcache] [ +0.000344] Code: b0 48 83 e8 50 48 81 fa e0 e1 10 c0 0f 84 a9 00 00 00 48 89 c6 48 89 ca 0f b7 ba 54 04 00 00 4c 8b 82 60 0c 00 00 85 ff 74 2f <49> 3b a8 98 09 00 00 74 4e 44 8d 47 ff 31 ff 49 c1 e0 03 eb 0d [ +0.000839] RSP: 0018:ffff92ee804cbd88 EFLAGS: 00010202 [ +0.000328] RAX: ffffffffc010e190 RBX: ffff918b5c6b5000 RCX: ffff918b7d8e0000 [ +0.000399] RDX: ffff918b7d8e0000 RSI: ffffffffc010e190 RDI: 0000000000000001 [ +0.000398] RBP: ffff918b7d318340 R08: 0000000000000000 R09: ffffffffb9bd2d7a [ +0.000385] R10: ffff918b7eb253c0 R11: ffffb95980f51200 R12: ffffffffc010e1a0 [ +0.000411] R13: fffffffffffffff2 R14: 000000000000000b R15: ffff918b7e232620 [ +0.000384] FS: 00007f955bec2740(0000) GS:ffff918b7eb00000(0000) knlGS:0000000000000000 [ +0.000420] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ +0.000801] CR2: 0000000000000998 CR3: 000000003cad6000 CR4: 00000000001406e0 [ +0.000837] Call Trace: [ +0.000682] ? _cond_resched+0x10/0x20 [ +0.000691] ? __kmalloc+0x131/0x1b0 [ +0.000710] kernfs_fop_write+0xfa/0x170 [ +0.000733] __vfs_write+0x2e/0x190 [ +0.000688] ? inode_security+0x10/0x30 [ +0.000698] ? selinux_file_permission+0xd2/0x120 [ +0.000752] ? security_file_permission+0x2b/0x100 [ +0.000753] vfs_write+0xa8/0x1a0 [ +0.000676] ksys_write+0x4d/0xb0 [ +0.000699] do_syscall_64+0x3a/0xf0 [ +0.000692] entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/super.c +1 -1
@@ -1364,6 +1364,7 @@ static void cache_set_free(struct closurbch_btree_cache_free (c);bch_journal_free (c); +mutex_lock (&bch_register_lock);for_each_cache (ca, c, i)if (ca) { ca->set =NULL ;
@@ -1386,7 +1387,6 @@ static void cache_set_free(struct closurmempool_destroy (c->search);kfree (c->devices); -mutex_lock (&bch_register_lock);list_del (&c->list);mutex_unlock (&bch_register_lock);
PATCH 51/132 bcache: never set KEY_PTRS of journal key to 0 in journal_reclaim()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Coly Li <[email protected]>
commit 1bee2addc0c8470c8aaa65ef0599eeae96dd88bc upstream.
In journal_reclaim() ja->cur_idx of each cache will be update to reclaim available journal buckets. Variable 'int n' is used to count how many cache is successfully reclaimed, then n is set to c->journal.key by SET_KEY_PTRS(). Later in journal_write_unlocked(), a for_each_cache() loop will write the jset data onto each cache.
The problem is, if all jouranl buckets on each cache is full, the following code in journal_reclaim(),
529 for_each_cache(ca, c, iter) {
530 struct journal_device *ja = &ca->journal;
531 unsigned int next = (ja->cur_idx + 1) % ca->sb.njournal_buckets;
532
533 /* No space available on this device */
534 if (next == ja->discard_idx)
535 continue;
536
537 ja->cur_idx = next;
538 k->ptr[n++] = MAKE_PTR(0,
539 bucket_to_sector(c, ca->sb.d[ja->cur_idx]),
540 ca->sb.nr_this_dev);
541 }
542
543 bkey_init(k);
544 SET_KEY_PTRS(k, n);
If there is no available bucket to reclaim, the if() condition at line 534 will always true, and n remains 0. Then at line 544, SET_KEY_PTRS() will set KEY_PTRS field of c->journal.key to 0.
Setting KEY_PTRS field of c->journal.key to 0 is wrong. Because in journal_write_unlocked() the journal data is written in following loop,
649 for (i = 0; i < KEY_PTRS(k); i++) {
650-671 submit journal data to cache device
672 }
If KEY_PTRS field is set to 0 in jouranl_reclaim(), the journal data won't be written to cache device here. If system crahed or rebooted before bkeys of the lost journal entries written into btree nodes, data corruption will be reported during bcache reload after rebooting the system.
Indeed there is only one cache in a cache set, there is no need to set KEY_PTRS field in journal_reclaim() at all. But in order to keep the for_each_cache() logic consistent for now, this patch fixes the above problem by not setting 0 KEY_PTRS of journal key, if there is no bucket available to reclaim.
--- drivers/md/bcache/journal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/md/bcache/journal.c +7 -4
@@ -507,11 +507,11 @@ static void journal_reclaim(struct cache ca->sb.nr_this_dev); } -bkey_init (k); -SET_KEY_PTRS (k, n); - -if (n) +if (n) { +bkey_init (k); +SET_KEY_PTRS (k, n); c->journal.blocks_free = c->sb.bucket_size >> c->block_bits; + } out:if (!journal_full (&c->journal))__closure_wake_up (&c->journal.wait);
@@ -635,6 +635,9 @@ static void journal_write_unlocked(struc ca->journal.seq[ca->journal.cur_idx] = w->data->seq; } +/* If KEY_PTRS(k) == 0, this jset gets lost in air */ +BUG_ON (i ==0 ); +atomic_dec_bug (&fifo_back (&c->journal.pin));bch_journal_next (&c->journal);journal_reclaim (c);
PATCH 52/132 TTY: serial_core, add ->install
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit 4cdd17ba1dff20ffc99fdbd2e6f0201fc7fe67df upstream.
We need to compute the uart state only on the first open. This is usually what is done in the ->install hook. serial_core used to do this in ->open on every open. So move it to ->install.
As a side effect, it ensures the state is set properly in the window after tty_init_dev is called, but before uart_open. This fixes a bunch of races between tty_open and flush_to_ldisc we were dealing with recently.
One of such bugs was attempted to fix in commit fedb5760648a (serial:
fix race between flush_to_ldisc and tty_open), but it only took care of a couple of functions (uart_start and uart_unthrottle). I was able to reproduce the crash on a SLE system, but in uart_write_room which is also called from flush_to_ldisc via process_echoes. I was *unable* to reproduce the bug locally. It is due to having this patch in my queue since 2012!
general protection fault: 0000 [#1] SMP KASAN PTI CPU: 1 PID: 5 Comm: kworker/u4:0 Tainted: G L 4.12.14-396-default #1 SLE15-SP1 (unreleased) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c89-prebuilt.qemu.org 04/01/2014 Workqueue: events_unbound flush_to_ldisc task: ffff8800427d8040 task.stack: ffff8800427f0000 RIP: 0010:uart_write_room+0xc4/0x590 RSP: 0018:ffff8800427f7088 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 000000000000002f RSI: 00000000000000ee RDI: ffff88003888bd90 RBP: ffffffffb9545850 R08: 0000000000000001 R09: 0000000000000400 R10: ffff8800427d825c R11: 000000000000006e R12: 1ffff100084fee12 R13: ffffc900004c5000 R14: ffff88003888bb28 R15: 0000000000000178 FS: 0000000000000000(0000) GS:ffff880043300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000561da0794148 CR3: 000000000ebf4000 CR4: 00000000000006e0 Call Trace: tty_write_room+0x6d/0xc0 __process_echoes+0x55/0x870 n_tty_receive_buf_common+0x105e/0x26d0 tty_ldisc_receive_buf+0xb7/0x1c0 tty_port_default_receive_buf+0x107/0x180 flush_to_ldisc+0x35d/0x5c0
...
0 in rbx means tty->driver_data is NULL in uart_write_room. 0x178 is tried to be dereferenced (0x178 >> 3 is 0x2f in rdx) at uart_write_room+0xc4. 0x178 is exactly (struct uart_state *)NULL->refcount used in uart_port_lock from uart_write_room.
So revert the upstream commit here as my local patch should fix the whole family.
[bwh: Backported to 3.16: The previous fix didn't apply, so we don't need
to revert it here.]
---
drivers/tty/serial/serial_core.c +12 -3
@@ -1541,6 +1541,16 @@ static void uart_dtr_rts(struct tty_portuart_clear_mctrl (uport,TIOCM_DTR |TIOCM_RTS ); } +static int uart_install (struct tty_driver *driver,struct tty_struct *tty) +{ +struct uart_driver *drv = driver->driver_state; +struct uart_state *state = drv->state + tty->index; + + tty->driver_data = state; + +return tty_standard_install (driver, tty); +} +/* * Calls to uart_open are serialised by the tty_lock in * drivers/tty/tty_io.c:tty_open()
@@ -1553,9 +1563,8 @@ static void uart_dtr_rts(struct tty_port*/ static int uart_open (struct tty_struct *tty,struct file *filp) { -struct uart_driver *drv = (struct uart_driver *)tty->driver->driver_state;int retval, line = tty->index; -struct uart_state *state = drv->state + line; +struct uart_state *state = tty->driver_data;struct tty_port *port = &state->port;pr_debug ("uart_open(%d) called\n" , line);
@@ -1583,7 +1592,6 @@ static int uart_open(struct tty_struct ** uart_close() will decrement the driver module use count. * Any failures from here onwards should not touch the count. */ - tty->driver_data = state; state->uart_port->state = state; state->port.low_latency = (state->uart_port->flags &UPF_LOW_LATENCY ) ?1 :0 ;
@@ -2265,6 +2273,7 @@ static void uart_poll_put_char(struct tt#endif static const struct tty_operations uart_ops = { + .install = uart_install, .open = uart_open, .close = uart_close, .write = uart_write,
PATCH 53/132 PCI: Reset Lenovo ThinkPad P50 nvgpu at boot if necessary
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lyude Paul <[email protected]>
commit e0547c81bfcfad01cbbfa93a5e66bb98ab932f80 upstream.
On ThinkPad P50 SKUs with an Nvidia Quadro M1000M instead of the M2000M variant, the BIOS does not always reset the secondary Nvidia GPU during reboot if the laptop is configured in Hybrid Graphics mode. The reason is unknown, but the following steps and possibly a good bit of patience will reproduce the issue:
1. Boot up the laptop normally in Hybrid Graphics mode
2. Make sure nouveau is loaded and that the GPU is awake
3. Allow the Nvidia GPU to runtime suspend itself after being idle
4. Reboot the machine, the more sudden the better (e.g. sysrq-b may help)
5. If nouveau loads up properly, reboot the machine again and go back to step 2 until you reproduce the issue
This results in some very strange behavior: the GPU will be left in exactly the same state it was in when the previously booted kernel started the reboot. This has all sorts of bad side effects: for starters, this completely breaks nouveau starting with a mysterious EVO channel failure that happens well before we've actually used the EVO channel for anything:
nouveau 0000:01:00.0: disp: chid 0 mthd 0000 data 00000400 00001000 00000002
This causes a timeout trying to bring up the GR ctx:
nouveau 0000:01:00.0: timeout
WARNING: CPU: 0 PID: 12 at drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c:1547 gf100_grctx_generate+0x7b2/0x850 [nouveau] Hardware name: LENOVO 20EQS64N0B/20EQS64N0B, BIOS N1EET82W (1.55 ) 12/18/2018 Workqueue: events_long drm_dp_mst_link_probe_work [drm_kms_helper] ... nouveau 0000:01:00.0: gr: wait for idle timeout (en: 1, ctxsw: 0, busy: 1) nouveau 0000:01:00.0: gr: wait for idle timeout (en: 1, ctxsw: 0, busy: 1) nouveau 0000:01:00.0: fifo: fault 01 [WRITE] at 0000000000008000 engine 00 [GR] client 15 [HUB/SCC_NB] reason c4 [] on channel -1 [0000000000 unknown]
The GPU never manages to recover. Booting without loading nouveau causes issues as well, since the GPU starts sending spurious interrupts that cause other device's IRQs to get disabled by the kernel:
irq 16: nobody cared (try booting with the "irqpoll" option)
...
handlers:
[<000000007faa9e99>] i801_isr [i2c_i801]
Disabling IRQ #16
...
serio: RMI4 PS/2 pass-through port at rmi4-00.fn03
i801_smbus 0000:00:1f.4: Timeout waiting for interrupt!
i801_smbus 0000:00:1f.4: Transaction timeout
rmi4_f03 rmi4-00.fn03: rmi_f03_pt_write: Failed to write to F03 TX register (-110). i801_smbus 0000:00:1f.4: Timeout waiting for interrupt!
i801_smbus 0000:00:1f.4: Transaction timeout
rmi4_physical rmi4-00: rmi_driver_set_irq_bits: Failed to change enabled interrupts!
This causes the touchpad and sometimes other things to get disabled.
Since this happens without nouveau, we can't fix this problem from nouveau itself.
Add a PCI quirk for the specific P50 variant of this GPU. Make sure the GPU is advertising NoReset- so we don't reset the GPU when the machine is in Dedicated graphics mode (where the GPU being initialized by the BIOS is normal and expected). Map the GPU MMIO space and read the magic 0x2240c register, which will have bit 1 set if the device was POSTed during a previous boot. Once we've confirmed all of this, reset the GPU and re-disable it - bringing it back to a healthy state.
[bwh: Backported to 3.16:
- Use dev_{err,info}() instead of pci_{err,info}()
- Adjust context]
--- drivers/pci/quirks.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
drivers/pci/quirks.c +58 -0
@@ -3900,3 +3900,61 @@ void pci_dev_specific_enable_acs(struct } } } + +/* +* On Lenovo Thinkpad P50 SKUs with a Nvidia Quadro M1000M, the BIOS does +* not always reset the secondary Nvidia GPU between reboots if the system +* is configured to use Hybrid Graphics mode. This results in the GPU +* being left in whatever state it was in during the *previous* boot, which +* causes spurious interrupts from the GPU, which in turn causes us to +* disable the wrong IRQ and end up breaking the touchpad. Unsurprisingly, +* this also completely breaks nouveau. +* +* Luckily, it seems a simple reset of the Nvidia GPU brings it back to a +* clean state and fixes all these issues. +* +* When the machine is configured in Dedicated display mode, the issue +* doesn't occur. Fortunately the GPU advertises NoReset+ when in this +* mode, so we can detect that and avoid resetting it. +*/ +static void quirk_reset_lenovo_thinkpad_p50_nvgpu (struct pci_dev *pdev) +{ +void __iomem *map; +int ret; + +if (pdev->subsystem_vendor !=PCI_VENDOR_ID_LENOVO || + pdev->subsystem_device !=0x222e || + !pdev->reset_fn) +return ; + +if (pci_enable_device_mem (pdev)) +return ; + +/* +* Based on nvkm_device_ctor() in +* drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +*/ + map =pci_iomap (pdev,0 ,0x23000 ); +if (!map) { +dev_err (&pdev->dev,"Can't map MMIO space\n" ); + goto out_disable; + } + +/* +* Make sure the GPU looks like it's been POSTed before resetting +* it. +*/ +if (ioread32 (map +0x2240c ) &0x2 ) { +dev_info (&pdev->dev,FW_BUG "GPU left initialized by EFI, resetting\n" ); + ret =pci_reset_function (pdev); +if (ret <0 ) +dev_err (&pdev->dev,"Failed to reset GPU: %d\n" , ret); + } + +iounmap (map); +out_disable: +pci_disable_device (pdev); +} +DECLARE_PCI_FIXUP_CLASS_FINAL (PCI_VENDOR_ID_NVIDIA ,0x13b1 , +PCI_CLASS_DISPLAY_VGA ,8 , + quirk_reset_lenovo_thinkpad_p50_nvgpu);
PATCH 54/132 Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit d5bb334a8e171b262e48f378bd2096c0ea458265 upstream.
The minimum encryption key size for LE connections is 56 bits and to align LE with BR/EDR, enforce 56 bits of minimum encryption key size for BR/EDR connections as well.
--- include/net/bluetooth/hci_core.h | 3 +++ net/bluetooth/hci_conn.c | 8 ++++++++ 2 files changed, 11 insertions(+)
include/net/bluetooth/hci_core.h +3 -0
@@ -142,6 +142,9 @@ struct oob_data {#define HCI_MAX_SHORT_NAME_LENGTH 10 +/* Min encryption key size to match with SMP */ +#define HCI_MIN_ENC_KEY_SIZE 7 +/* Default LE RPA expiry time, 15 minutes */ #define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
net/bluetooth/hci_conn.c +8 -0
@@ -868,6 +868,14 @@ int hci_conn_check_link_mode(struct hci_if (hci_conn_ssp_enabled (conn) && !(conn->link_mode &HCI_LM_ENCRYPT ))return 0 ; +/* The minimum encryption key size needs to be enforced by the +* host stack before establishing any L2CAP connections. The +* specification in theory allows a minimum of 1, but to align +* BR/EDR and LE transports, a minimum of 7 is chosen. +*/ +if (conn->enc_key_size <HCI_MIN_ENC_KEY_SIZE ) +return 0 ; +return 1 ; }
PATCH 55/132 Bluetooth: Fix regression with minimum encryption key size alignment
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Holtmann <[email protected]>
commit 693cd8ce3f882524a5d06f7800dd8492411877b3 upstream.
When trying to align the minimum encryption key size requirement for Bluetooth connections, it turns out doing this in a central location in the HCI connection handling code is not possible.
Original Bluetooth version up to 2.0 used a security model where the L2CAP service would enforce authentication and encryption. Starting with Bluetooth 2.1 and Secure Simple Pairing that model has changed into that the connection initiator is responsible for providing an encrypted ACL link before any L2CAP communication can happen.
Now connecting Bluetooth 2.1 or later devices with Bluetooth 2.0 and before devices are causing a regression. The encryption key size check needs to be moved out of the HCI connection handling into the L2CAP channel setup.
To achieve this, the current check inside hci_conn_security() has been moved into l2cap_check_enc_key_size() helper function and then called from four decisions point inside L2CAP to cover all combinations of Secure Simple Pairing enabled devices and device using legacy pairing and legacy service security model.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203643
[bwh: Backported to 3.16:
- Encryption flag is in hci_conn::link_mode not hci_conn::flags
- Adjust context, indentation]
--- net/bluetooth/hci_conn.c | 18 +++++++++--------- net/bluetooth/l2cap_core.c | 33 ++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 14 deletions(-)
net/bluetooth/hci_conn.c +9 -9
@@ -868,14 +868,6 @@ int hci_conn_check_link_mode(struct hci_if (hci_conn_ssp_enabled (conn) && !(conn->link_mode &HCI_LM_ENCRYPT ))return 0 ; -/* The minimum encryption key size needs to be enforced by the -* host stack before establishing any L2CAP connections. The -* specification in theory allows a minimum of 1, but to align -* BR/EDR and LE transports, a minimum of 7 is chosen. -*/ -if (conn->enc_key_size <HCI_MIN_ENC_KEY_SIZE ) -return 0 ; -return 1 ; }
@@ -988,8 +980,16 @@ auth:return 0 ; encrypt: -if (conn->link_mode &HCI_LM_ENCRYPT ) +if (conn->link_mode &HCI_LM_ENCRYPT ) { +/* Ensure that the encryption key size has been read, +* otherwise stall the upper layer responses. +*/ +if (!conn->enc_key_size) +return 0 ; + +/* Nothing else needed, all requirements are met */ return 1 ; + }hci_conn_encrypt (conn);return 0 ;
net/bluetooth/l2cap_core.c +28 -6
@@ -1260,6 +1260,21 @@ static void l2cap_start_connection(struc } } +static bool l2cap_check_enc_key_size (struct hci_conn *hcon) +{ +/* The minimum encryption key size needs to be enforced by the +* host stack before establishing any L2CAP connections. The +* specification in theory allows a minimum of 1, but to align +* BR/EDR and LE transports, a minimum of 7 is chosen. +* +* This check might also be called for unencrypted connections +* that have no key size requirements. Ensure that the link is +* actually encrypted before enforcing a key size. +*/ +return (!(hcon->link_mode &HCI_LM_ENCRYPT ) || + hcon->enc_key_size >HCI_MIN_ENC_KEY_SIZE ); +} +static void l2cap_do_start (struct l2cap_chan *chan) {struct l2cap_conn *conn = chan->conn;
@@ -1273,10 +1288,14 @@ static void l2cap_do_start(struct l2cap_if (!(conn->info_state &L2CAP_INFO_FEAT_MASK_REQ_DONE ))return ; -if (l2cap_chan_check_security (chan) && -__l2cap_no_conn_pending (chan)) { +if (!l2cap_chan_check_security (chan) || + !__l2cap_no_conn_pending (chan)) +return ; + +if (l2cap_check_enc_key_size (conn->hcon))l2cap_start_connection (chan); - } +else +__set_chan_timer (chan,L2CAP_DISC_TIMEOUT ); }else {struct l2cap_info_req req; req.type =cpu_to_le16 (L2CAP_IT_FEAT_MASK );
@@ -1366,7 +1385,10 @@ static void l2cap_conn_start(struct l2cacontinue ; } -l2cap_start_connection (chan); +if (l2cap_check_enc_key_size (conn->hcon)) +l2cap_start_connection (chan); +else +l2cap_chan_close (chan,ECONNREFUSED ); }else if (chan->state ==BT_CONNECT2 ) {struct l2cap_conn_rsp rsp;
@@ -7352,7 +7374,7 @@ int l2cap_security_cfm(struct hci_conn * }if (chan->state ==BT_CONNECT ) { -if (!status) +if (!status &&l2cap_check_enc_key_size (hcon))l2cap_start_connection (chan);else __set_chan_timer (chan,L2CAP_DISC_TIMEOUT );
@@ -7360,7 +7382,7 @@ int l2cap_security_cfm(struct hci_conn *struct l2cap_conn_rsp rsp;__u16 res, stat; -if (!status) { +if (!status &&l2cap_check_enc_key_size (hcon)) {if (test_bit (FLAG_DEFER_SETUP , &chan->flags)) { res =L2CAP_CR_PEND ; stat =L2CAP_CS_AUTHOR_PEND ;
PATCH 56/132 Bluetooth: Fix faulty expression for minimum encryption key size check
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matias Karhumaa <[email protected]>
commit eca94432934fe5f141d084f2e36ee2c0e614cc04 upstream.
Fix minimum encryption key size check so that HCI_MIN_ENC_KEY_SIZE is also allowed as stated in the comment.
This bug caused connection problems with devices having maximum encryption key size of 7 octets (56-bit).
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203997
--- net/bluetooth/l2cap_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +1 -1
@@ -1272,7 +1272,7 @@ static bool l2cap_check_enc_key_size(str* actually encrypted before enforcing a key size. */ return (!(hcon->link_mode &HCI_LM_ENCRYPT ) || - hcon->enc_key_size >HCI_MIN_ENC_KEY_SIZE ); + hcon->enc_key_size >=HCI_MIN_ENC_KEY_SIZE ); }static void l2cap_do_start (struct l2cap_chan *chan)
PATCH 57/132 clk: tegra: Fix PLLM programming on Tegra124+ when PMC overrides divider
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Osipenko <[email protected]>
commit 40db569d6769ffa3864fd1b89616b1a7323568a8 upstream.
There are wrongly set parenthesis in the code that are resulting in a wrong configuration being programmed for PLLM. The original fix was made by Danny Huang in the downstream kernel. The patch was tested on Nyan Big Tegra124 chromebook, PLLM rate changing works correctly now and system doesn't lock up after changing the PLLM rate due to EMC scaling.
--- drivers/clk/tegra/clk-pll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-pll.c +2 -2
@@ -486,8 +486,8 @@ static void _update_pll_mnp(struct tegrapll_override_writel (val, params->pmc_divp_reg, pll); val =pll_override_readl (params->pmc_divnm_reg, pll); - val &= ~(divm_mask (pll) << div_nmp->override_divm_shift) | - ~(divn_mask (pll) << div_nmp->override_divn_shift); + val &= ~((divm_mask (pll) << div_nmp->override_divm_shift) | + (divn_mask (pll) << div_nmp->override_divn_shift)); val |= (cfg->m << div_nmp->override_divm_shift) | (cfg->n << div_nmp->override_divn_shift);pll_override_writel (val, params->pmc_divnm_reg, pll);
PATCH 58/132 at76c50x-usb: Don't register led_trigger if usb_register_driver failed
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
commit 09ac2694b0475f96be895848687ebcbba97eeecf upstream.
Syzkaller report this:
[ 1213.468581] BUG: unable to handle kernel paging request at fffffbfff83bf338 [ 1213.469530] #PF error: [normal kernel read fault] [ 1213.469530] PGD 237fe4067 P4D 237fe4067 PUD 237e60067 PMD 1c868b067 PTE 0 [ 1213.473514] Oops: 0000 [#1] SMP KASAN PTI [ 1213.473514] CPU: 0 PID: 6321 Comm: syz-executor.0 Tainted: G C 5.1.0-rc3+ #8 [ 1213.473514] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 [ 1213.473514] RIP: 0010:strcmp+0x31/0xa0 [ 1213.473514] Code: 00 00 00 00 fc ff df 55 53 48 83 ec 08 eb 0a 84 db 48 89 ef 74 5a 4c 89 e6 48 89 f8 48 89 fa 48 8d 6f 01 48 c1 e8 03 83 e2 07 <42> 0f b6 04 28 38 d0 7f 04 84 c0 75 50 48 89 f0 48 89 f2 0f b6 5d [ 1213.473514] RSP: 0018:ffff8881f2b7f950 EFLAGS: 00010246 [ 1213.473514] RAX: 1ffffffff83bf338 RBX: ffff8881ea6f7240 RCX: ffffffff825350c6 [ 1213.473514] RDX: 0000000000000000 RSI: ffffffffc1ee19c0 RDI: ffffffffc1df99c0 [ 1213.473514] RBP: ffffffffc1df99c1 R08: 0000000000000001 R09: 0000000000000004 [ 1213.473514] R10: 0000000000000000 R11: ffff8881de353f00 R12: ffff8881ee727900 [ 1213.473514] R13: dffffc0000000000 R14: 0000000000000001 R15: ffffffffc1eeaaf0 [ 1213.473514] FS: 00007fa66fa01700(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000 [ 1213.473514] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1213.473514] CR2: fffffbfff83bf338 CR3: 00000001ebb9e005 CR4: 00000000007606f0 [ 1213.473514] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1213.473514] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1213.473514] PKRU: 55555554 [ 1213.473514] Call Trace: [ 1213.473514] led_trigger_register+0x112/0x3f0 [ 1213.473514] led_trigger_register_simple+0x7a/0x110 [ 1213.473514] ? 0xffffffffc1c10000 [ 1213.473514] at76_mod_init+0x77/0x1000 [at76c50x_usb] [ 1213.473514] do_one_initcall+0xbc/0x47d [ 1213.473514] ? perf_trace_initcall_level+0x3a0/0x3a0 [ 1213.473514] ? kasan_unpoison_shadow+0x30/0x40 [ 1213.473514] ? kasan_unpoison_shadow+0x30/0x40 [ 1213.473514] do_init_module+0x1b5/0x547 [ 1213.473514] load_module+0x6405/0x8c10 [ 1213.473514] ? module_frob_arch_sections+0x20/0x20 [ 1213.473514] ? kernel_read_file+0x1e6/0x5d0 [ 1213.473514] ? find_held_lock+0x32/0x1c0 [ 1213.473514] ? cap_capable+0x1ae/0x210 [ 1213.473514] ? __do_sys_finit_module+0x162/0x190 [ 1213.473514] __do_sys_finit_module+0x162/0x190 [ 1213.473514] ? __ia32_sys_init_module+0xa0/0xa0 [ 1213.473514] ? __mutex_unlock_slowpath+0xdc/0x690 [ 1213.473514] ? wait_for_completion+0x370/0x370 [ 1213.473514] ? vfs_write+0x204/0x4a0 [ 1213.473514] ? do_syscall_64+0x18/0x450 [ 1213.473514] do_syscall_64+0x9f/0x450 [ 1213.473514] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 1213.473514] RIP: 0033:0x462e99 [ 1213.473514] Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 [ 1213.473514] RSP: 002b:00007fa66fa00c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 1213.473514] RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 [ 1213.473514] RDX: 0000000000000000 RSI: 0000000020000300 RDI: 0000000000000003 [ 1213.473514] RBP: 00007fa66fa00c70 R08: 0000000000000000 R09: 0000000000000000 [ 1213.473514] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fa66fa016bc [ 1213.473514] R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004
If usb_register failed, no need to call led_trigger_register_simple.
--- drivers/net/wireless/at76c50x-usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/at76c50x-usb.c +2 -2
@@ -2582,8 +2582,8 @@ static int __init at76_mod_init(void)if (result <0 ) printk(KERN_ERR DRIVER_NAME": usb_register failed (status %d)\n" , result); - -led_trigger_register_simple ("at76_usb-tx" , &ledtrig_tx); +else +led_trigger_register_simple ("at76_usb-tx" , &ledtrig_tx);return result; }
PATCH 59/132 mwl8k: Fix rate_idx underflow
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Petr Štetiar <[email protected]>
commit 6b583201fa219b7b1b6aebd8966c8fd9357ef9f4 upstream.
It was reported on OpenWrt bug tracking system[1], that several users are affected by the endless reboot of their routers if they configure 5GHz interface with channel 44 or 48.
The reboot loop is caused by the following excessive number of WARN_ON messages:
WARNING: CPU: 0 PID: 0 at backports-4.19.23-1/net/mac80211/rx.c:4516
ieee80211_rx_napi+0x1fc/0xa54 [mac80211]as the messages are being correctly emitted by the following guard:
case RX_ENC_LEGACY:
if (WARN_ON(status->rate_idx >= sband->n_bitrates))
as the rate_idx is in this case erroneously set to 251 (0xfb). This fix simply converts previously used magic number to proper constant and guards against substraction which is leading to the currently observed underflow.
1. https://bugs.openwrt.org/index.php?do=details&task_id=2218
--- drivers/net/wireless/mwl8k.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/wireless/mwl8k.c +9 -4
@@ -436,6 +436,9 @@ static const struct ieee80211_rate mwl8k#define MWL8K_CMD_UPDATE_STADB 0x1123#define MWL8K_CMD_BASTREAM 0x1125 +#define MWL8K_LEGACY_5G_RATE_OFFSET \ + (ARRAY_SIZE(mwl8k_rates_24) - ARRAY_SIZE(mwl8k_rates_50)) +static const char *mwl8k_cmd_name (__le16 cmd,char *buf,int bufsize) {u16 command =le16_to_cpu (cmd);
@@ -1011,8 +1014,9 @@ mwl8k_rxd_ap_process(void *_rxd, structif (rxd->channel >14 ) { status->band =IEEE80211_BAND_5GHZ ; -if (!(status->flag &RX_FLAG_HT )) - status->rate_idx -=5 ; +if (!(status->flag &RX_FLAG_HT ) && + status->rate_idx >=MWL8K_LEGACY_5G_RATE_OFFSET ) + status->rate_idx -=MWL8K_LEGACY_5G_RATE_OFFSET ; }else { status->band =IEEE80211_BAND_2GHZ ; }
@@ -1119,8 +1123,9 @@ mwl8k_rxd_sta_process(void *_rxd, structif (rxd->channel >14 ) { status->band =IEEE80211_BAND_5GHZ ; -if (!(status->flag &RX_FLAG_HT )) - status->rate_idx -=5 ; +if (!(status->flag &RX_FLAG_HT ) && + status->rate_idx >=MWL8K_LEGACY_5G_RATE_OFFSET ) + status->rate_idx -=MWL8K_LEGACY_5G_RATE_OFFSET ; }else { status->band =IEEE80211_BAND_2GHZ ; }
PATCH 60/132 p54: drop device reference count if fails to enable device
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pan Bian <[email protected]>
commit 8149069db81853570a665f5e5648c0e526dc0e43 upstream.
The function p54p_probe takes an extra reference count of the PCI device. However, the extra reference count is not dropped when it fails to enable the PCI device. This patch fixes the bug.
--- drivers/net/wireless/p54/p54pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/p54/p54pci.c +2 -1
@@ -551,7 +551,7 @@ static int p54p_probe(struct pci_dev *pd err =pci_enable_device (pdev);if (err) {dev_err (&pdev->dev,"Cannot enable new PCI device\n" ); -return err; + goto err_put; } mem_addr =pci_resource_start (pdev,0 );
@@ -636,6 +636,7 @@ static int p54p_probe(struct pci_dev *pdpci_release_regions (pdev); err_disable_dev:pci_disable_device (pdev); +err_put:pci_dev_put (pdev);return err; }
PATCH 61/132 ext4: actually request zeroing of inode table after grow
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kirill Tkhai <[email protected]>
commit 310a997fd74de778b9a4848a64be9cda9f18764a upstream.
It is never possible, that number of block groups decreases, since only online grow is supported.
But after a growing occured, we have to zero inode tables for just created new block groups.
--- fs/ext4/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ioctl.c +1 -1
@@ -634,7 +634,7 @@ group_add_out:if (err ==0 ) err = err2;mnt_drop_write_file (filp); -if (!err && (o_group >EXT4_SB (sb)->s_groups_count) && +if (!err && (o_group <EXT4_SB (sb)->s_groups_count) &&ext4_has_group_desc_csum (sb) &&test_opt (sb,INIT_INODE_TABLE )) err =ext4_register_li_request (sb, o_group);
PATCH 62/132 USB: serial: fix initial-termios handling
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 579bebe5dd522580019e7b10b07daaf500f9fb1e upstream.
The USB-serial driver init_termios callback is used to override the default initial terminal settings provided by USB-serial core.
After a bug was fixed in the original implementation introduced by commit fe1ae7fdd2ee ("tty: USB serial termios bits"), the init_termios callback was no longer called just once on first use as intended but rather on every (first) open.
This specifically meant that the terminal settings saved on (final) close were ignored when reopening a port for drivers overriding the initial settings.
Also update the outdated function header referring to the creation of termios objects.
--- drivers/usb/serial/usb-serial.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/usb/serial/usb-serial.c +7 -4
@@ -167,9 +167,9 @@ void usb_serial_put(struct usb_serial *s* @driver: the driver (USB in our case) * @tty: the tty being created * -* Create the termios objects for this tty. We use the default +* Initialise the termios structure for this tty. We use the default * USB serial settings but permit them to be overridden by -* serial->type->init_termios. +* serial->type->init_termios on first open. * * This is the first place a new tty gets used. Hence this is where we * acquire references to the usb_serial structure and the driver module,
@@ -181,6 +181,7 @@ static int serial_install(struct tty_driint idx = tty->index;struct usb_serial *serial;struct usb_serial_port *port; +bool init_termios;int retval = -ENODEV ; port =usb_serial_port_get_by_minor (idx);
@@ -195,14 +196,16 @@ static int serial_install(struct tty_driif (retval) goto error_get_interface; + init_termios = (driver->termios[idx] ==NULL ); + retval =tty_port_install (&port->port, driver, tty);if (retval) goto error_init_termios;mutex_unlock (&serial->disc_mutex); -/* allow the driver to update the settings */ -if (serial->type->init_termios) +/* allow the driver to update the initial settings */ +if (init_termios && serial->type->init_termios) serial->type->init_termios (tty); tty->driver_data = port;
PATCH 63/132 ALSA: hda/realtek - EAPD turn on later
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
commit 607ca3bd220f4022e6f5356026b19dafc363863a upstream.
Let EAPD turn on after set pin output.
[ NOTE: This change is supposed to reduce the possible click noises at
(runtime) PM resume. The functionality should be same (i.e. the verbs are executed correctly) no matter which order is, so this should be safe to apply for all codecs -- tiwai ]
--- sound/pci/hda/patch_realtek.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +1 -2
@@ -831,11 +831,10 @@ static int alc_init(struct hda_codec *coif (spec->init_hook) spec->init_hook (codec); +snd_hda_gen_init (codec);alc_fix_pll (codec);alc_auto_init_amp (codec, spec->init_amp); -snd_hda_gen_init (codec); -snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_INIT );return 0 ;
PATCH 64/132 ALSA: hda/realtek - Fix overridden device-specific initialization
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 89781d0806c2c4f29072d3f00cb2dd4274aabc3d upstream.
The recent change to shuffle the codec initialization procedure for Realtek via commit 607ca3bd220f ("ALSA: hda/realtek - EAPD turn on later") caused the silent output on some machines. This change was supposed to be safe, but it isn't actually; some devices have quirk setups to override the EAPD via COEF or BTL in the additional verb table, which is applied at the beginning of snd_hda_gen_init(). And this EAPD setup is again overridden in alc_auto_init_amp().
For recovering from the regression, tell snd_hda_gen_init() not to apply the verbs there by a new flag, then apply the verbs in alc_init().
--- sound/pci/hda/hda_generic.c | 3 ++- sound/pci/hda/hda_generic.h | 1 + sound/pci/hda/patch_realtek.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-)
sound/pci/hda/hda_generic.c +2 -1
@@ -5348,7 +5348,8 @@ int snd_hda_gen_init(struct hda_codec *cif (spec->init_hook) spec->init_hook (codec); -snd_hda_apply_verbs (codec); +if (!spec->skip_verbs) +snd_hda_apply_verbs (codec); codec->cached_write =1 ;
sound/pci/hda/hda_generic.h +1 -0
@@ -238,6 +238,7 @@ struct hda_gen_spec { unsigned int indep_hp_enabled:1; /* independent HP enabled */ unsigned int have_aamix_ctl:1; unsigned int hp_mic_jack_modes:1; + unsigned int skip_verbs:1; /* don't apply verbs at snd_hda_gen_init() *//* additional mute flags (only effective with auto_mute_via_amp=1) */ u64 mute_bits;
sound/pci/hda/patch_realtek.c +2 -0
@@ -831,9 +831,11 @@ static int alc_init(struct hda_codec *coif (spec->init_hook) spec->init_hook (codec); + spec->gen.skip_verbs =1 ;/* applied in below */ snd_hda_gen_init (codec);alc_fix_pll (codec);alc_auto_init_amp (codec, spec->init_amp); +snd_hda_apply_verbs (codec);/* apply verbs here after own init */ snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_INIT );
PATCH 65/132 ALSA: usb-audio: Fix a memory leak bug
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wenwen Wang <[email protected]>
commit cb5173594d50c72b7bfa14113dfc5084b4d2f726 upstream.
In parse_audio_selector_unit(), the string array 'namelist' is allocated through kmalloc_array(), and each string pointer in this array, i.e., 'namelist[]', is allocated through kmalloc() in the following for loop. Then, a control instance 'kctl' is created by invoking snd_ctl_new1(). If an error occurs during the creation process, the string array 'namelist', including all string pointers in the array 'namelist[]', should be freed, before the error code ENOMEM is returned. However, the current code does not free 'namelist[]', resulting in memory leaks.
To fix the above issue, free all string pointers 'namelist[]' in a loop.
--- sound/usb/mixer.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/mixer.c +2 -0
@@ -2090,6 +2090,8 @@ static int parse_audio_selector_unit(str kctl =snd_ctl_new1 (&mixer_selectunit_ctl, cval);if (! kctl) {usb_audio_err (state->chip,"cannot malloc kcontrol\n" ); +for (i =0 ; i < desc->bNrInPins; i++) +kfree (namelist[i]);kfree (namelist);kfree (cval);return -ENOMEM ;
PATCH 66/132 cdc-acm: fix race between callback and unthrottle
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 36e59e0d70d6150e7a2155c54612ea875e88ce8d upstream.
Abn URB may be may marked free only after the buffer has been processed or there is a small window during which it could be submitted on another CPU and overwrite an unprocessed buffer
--- drivers/usb/class/cdc-acm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/class/cdc-acm.c +10 -2
@@ -419,19 +419,21 @@ static void acm_read_bulk_callback(strucstruct acm_rb *rb = urb->context;struct acm *acm = rb->instance;unsigned long flags; +int status = urb->status;dev_vdbg (&acm->data->dev,"%s - urb %d, len %d\n" , __func__, rb->index, urb->actual_length); -set_bit (rb->index, &acm->read_urbs_free);if (!acm->dev) { +set_bit (rb->index, &acm->read_urbs_free);dev_dbg (&acm->data->dev,"%s - disconnected\n" , __func__);return ; }if (urb->status) { +set_bit (rb->index, &acm->read_urbs_free);dev_dbg (&acm->data->dev,"%s - non-zero urb status: %d\n" , - __func__, urb->status); + __func__, status);if ((urb->status != -ENOENT ) || (urb->actual_length ==0 ))return ; }
@@ -439,6 +441,12 @@ static void acm_read_bulk_callback(strucusb_mark_last_busy (acm->dev);acm_process_read_urb (acm, urb); +/* +* Unthrottle may run on another CPU which needs to see events +* in the same order. Submission has an implict barrier +*/ +smp_mb__before_atomic (); +set_bit (rb->index, &acm->read_urbs_free);/* throttle device if requested by tty */ spin_lock_irqsave (&acm->read_lock, flags);
PATCH 67/132 cdc-acm: store in and out pipes in acm structure
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ladislav Michl <[email protected]>
commit 74bccc9b71dc41d37e73fcdbcbec85310a670751 upstream.
Clearing stall needs pipe descriptor, store it in acm structure.
--- drivers/usb/class/cdc-acm.c | 33 +++++++++++++++++---------------- drivers/usb/class/cdc-acm.h | 1 + 2 files changed, 18 insertions(+), 16 deletions(-)
drivers/usb/class/cdc-acm.c +17 -16
@@ -1355,8 +1355,16 @@ made_compressed_probe:spin_lock_init (&acm->read_lock);mutex_init (&acm->mutex); acm->is_int_ep =usb_endpoint_xfer_int (epread); -if (acm->is_int_ep) +if (acm->is_int_ep) { acm->bInterval = epread->bInterval; + acm->in =usb_rcvintpipe (usb_dev, epread->bEndpointAddress); + }else { + acm->in =usb_rcvbulkpipe (usb_dev, epread->bEndpointAddress); + } +if (usb_endpoint_xfer_int (epwrite)) + acm->out =usb_sndintpipe (usb_dev, epwrite->bEndpointAddress); +else + acm->out =usb_sndbulkpipe (usb_dev, epwrite->bEndpointAddress);tty_port_init (&acm->port); acm->port.ops = &acm_port_ops;init_usb_anchor (&acm->delayed);
@@ -1401,20 +1409,15 @@ made_compressed_probe: } urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ; urb->transfer_dma = rb->dma; -if (acm->is_int_ep) { -usb_fill_int_urb (urb, acm->dev, -usb_rcvintpipe (usb_dev, epread->bEndpointAddress), - rb->base, +if (acm->is_int_ep) +usb_fill_int_urb (urb, acm->dev, acm->in, rb->base, acm->readsize, acm_read_bulk_callback, rb, acm->bInterval); - }else { -usb_fill_bulk_urb (urb, acm->dev, -usb_rcvbulkpipe (usb_dev, epread->bEndpointAddress), - rb->base, +else +usb_fill_bulk_urb (urb, acm->dev, acm->in, rb->base, acm->readsize, acm_read_bulk_callback, rb); - } acm->read_urbs[i] = urb;__set_bit (i, &acm->read_urbs_free);
@@ -1430,12 +1433,10 @@ made_compressed_probe: }if (usb_endpoint_xfer_int (epwrite)) -usb_fill_int_urb (snd->urb, usb_dev, -usb_sndintpipe (usb_dev, epwrite->bEndpointAddress), +usb_fill_int_urb (snd->urb, usb_dev, acm->out,NULL , acm->writesize, acm_write_bulk, snd, epwrite->bInterval);else -usb_fill_bulk_urb (snd->urb, usb_dev, -usb_sndbulkpipe (usb_dev, epwrite->bEndpointAddress), +usb_fill_bulk_urb (snd->urb, usb_dev, acm->out,NULL , acm->writesize, acm_write_bulk, snd); snd->urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ;if (quirks &SEND_ZERO_PACKET )
@@ -1504,8 +1505,8 @@ skip_countries: }if (quirks &CLEAR_HALT_CONDITIONS ) { -usb_clear_halt (usb_dev,usb_rcvbulkpipe (usb_dev, epread->bEndpointAddress)); -usb_clear_halt (usb_dev,usb_sndbulkpipe (usb_dev, epwrite->bEndpointAddress)); +usb_clear_halt (usb_dev, acm->in); +usb_clear_halt (usb_dev, acm->out); }return 0 ;
drivers/usb/class/cdc-acm.h +1 -0
@@ -83,6 +83,7 @@ struct acm {struct usb_device *dev;/* the corresponding usb device */ struct usb_interface *control;/* control interface */ struct usb_interface *data;/* data interface */ +unsigned in, out;/* i/o pipes */ struct tty_port port;/* our tty port data */ struct urb *ctrlurb;/* urbs */ u8 *ctrl_buffer;/* buffers of urbs */
PATCH 68/132 cdc-acm: handle read pipe errors
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ladislav Michl <[email protected]>
commit 1aba579f3cf51fd0fe0b4d46cc13823fd1200acb upstream.
Read urbs are submitted back only on success, causing read pipe running out of urbs after few errors. No more characters can be read from tty device then until it is reopened and no errors are reported.
Fix that by always submitting urbs back and clearing stall on -EPIPE.
--- drivers/usb/class/cdc-acm.c | 60 ++++++++++++++++++++++++++++++------- drivers/usb/class/cdc-acm.h | 3 ++ 2 files changed, 53 insertions(+), 10 deletions(-)
drivers/usb/class/cdc-acm.c +50 -12
@@ -424,29 +424,41 @@ static void acm_read_bulk_callback(strucdev_vdbg (&acm->data->dev,"%s - urb %d, len %d\n" , __func__, rb->index, urb->actual_length); +set_bit (rb->index, &acm->read_urbs_free); +if (!acm->dev) { -set_bit (rb->index, &acm->read_urbs_free);dev_dbg (&acm->data->dev,"%s - disconnected\n" , __func__);return ; } -if (urb->status) { -set_bit (rb->index, &acm->read_urbs_free); -dev_dbg (&acm->data->dev,"%s - non-zero urb status: %d\n" , - __func__, status); -if ((urb->status != -ENOENT ) || (urb->actual_length ==0 )) -return ; +switch (status) { +case 0 : +usb_mark_last_busy (acm->dev); +acm_process_read_urb (acm, urb); +break ; +case -EPIPE : +set_bit (EVENT_RX_STALL , &acm->flags); +schedule_work (&acm->work); +return ; +case -ENOENT : +case -ECONNRESET : +case -ESHUTDOWN : +dev_dbg (&acm->data->dev, +"%s - urb shutting down with status: %d\n" , + __func__, status); +return ; +default : +dev_dbg (&acm->data->dev, +"%s - nonzero urb status received: %d\n" , + __func__, status); +break ; } -usb_mark_last_busy (acm->dev); - -acm_process_read_urb (acm, urb);/* * Unthrottle may run on another CPU which needs to see events * in the same order. Submission has an implict barrier */ smp_mb__before_atomic (); -set_bit (rb->index, &acm->read_urbs_free);/* throttle device if requested by tty */ spin_lock_irqsave (&acm->read_lock, flags);
@@ -476,16 +488,32 @@ static void acm_write_bulk(struct urb *uspin_lock_irqsave (&acm->write_lock, flags);acm_write_done (acm, wb);spin_unlock_irqrestore (&acm->write_lock, flags); +set_bit (EVENT_TTY_WAKEUP , &acm->flags);schedule_work (&acm->work); }static void acm_softint (struct work_struct *work) { +int i; struct acm *acm = container_of(work, struct acm, work);dev_vdbg (&acm->data->dev,"%s\n" , __func__); -tty_port_tty_wakeup (&acm->port); +if (test_bit (EVENT_RX_STALL , &acm->flags)) { +if (!(usb_autopm_get_interface (acm->data))) { +for (i =0 ; i < acm->rx_buflimit; i++) +usb_kill_urb (acm->read_urbs[i]); +usb_clear_halt (acm->dev, acm->in); +acm_submit_read_urbs (acm,GFP_KERNEL ); +usb_autopm_put_interface (acm->data); + } +clear_bit (EVENT_RX_STALL , &acm->flags); + } + +if (test_bit (EVENT_TTY_WAKEUP , &acm->flags)) { +tty_port_tty_wakeup (&acm->port); +clear_bit (EVENT_TTY_WAKEUP , &acm->flags); + } }/*
@@ -1680,6 +1708,15 @@ static int acm_reset_resume(struct usb_i#endif /* CONFIG_PM */ +static int acm_pre_reset (struct usb_interface *intf) +{ +struct acm *acm =usb_get_intfdata (intf); + +clear_bit (EVENT_RX_STALL , &acm->flags); + +return 0 ; +} +#define NOKIA_PCSUITE_ACM_INFO (x) \ USB_DEVICE_AND_INTERFACE_INFO(0x0421, x, \ USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, \
@@ -1955,6 +1992,7 @@ static struct usb_driver acm_driver = { .resume = acm_resume, .reset_resume = acm_reset_resume, #endif + .pre_reset = acm_pre_reset, .id_table = acm_ids, #ifdef CONFIG_PM .supports_autosuspend = 1,
drivers/usb/class/cdc-acm.h +3 -0
@@ -102,6 +102,9 @@ struct acm {spinlock_t write_lock;struct mutex mutex;bool disconnected; +unsigned long flags; +# define EVENT_TTY_WAKEUP 0 +# define EVENT_RX_STALL 1struct usb_cdc_line_coding line;/* bits, stop, parity */ struct work_struct work;/* work queue entry for line discipline waking up */ unsigned int ctrlin;/* input control lines (DCD, DSR, RI, break, overruns) */
PATCH 69/132 usb: cdc-acm: fix race during wakeup blocking TX traffic
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Romain Izard <[email protected]>
commit 93e1c8a638308980309e009cc40b5a57ef87caf1 upstream.
When the kernel is compiled with preemption enabled, the URB completion handler can run in parallel with the work responsible for waking up the tty layer. If the URB handler sets the EVENT_TTY_WAKEUP bit during the call to tty_port_tty_wakeup() to signal that there is room for additional input, it will be cleared at the end of this call. As a result, TX traffic on the upper layer will be blocked.
This can be seen with a kernel configured with CONFIG_PREEMPT, and a fast modem connected with PPP running over a USB CDC-ACM port.
Use test_and_clear_bit() instead, which ensures that each wakeup requested by the URB completion code will trigger a call to tty_port_tty_wakeup().
--- drivers/usb/class/cdc-acm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/usb/class/cdc-acm.c +1 -3
@@ -510,10 +510,8 @@ static void acm_softint(struct work_struclear_bit (EVENT_RX_STALL , &acm->flags); } -if (test_bit (EVENT_TTY_WAKEUP , &acm->flags)) { +if (test_and_clear_bit (EVENT_TTY_WAKEUP , &acm->flags))tty_port_tty_wakeup (&acm->port); -clear_bit (EVENT_TTY_WAKEUP , &acm->flags); - } }/*
PATCH 70/132 USB: cdc-acm: fix unthrottle races
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 764478f41130f1b8d8057575b89e69980a0f600d upstream.
Fix two long-standing bugs which could potentially lead to memory corruption or leave the port throttled until it is reopened (on weakly ordered systems), respectively, when read-URB completion races with unthrottle().
First, the URB must not be marked as free before processing is complete to prevent it from being submitted by unthrottle() on another CPU.
CPU 1 CPU 2 ================ ================ complete() unthrottle() process_urb(); smp_mb__before_atomic(); set_bit(i, free); if (test_and_clear_bit(i, free)) submit_urb();
Second, the URB must be marked as free before checking the throttled flag to prevent unthrottle() on another CPU from failing to observe that the URB needs to be submitted if complete() sees that the throttled flag is set.
CPU 1 CPU 2 ================ ================ complete() unthrottle() set_bit(i, free); throttled = 0; smp_mb__after_atomic(); smp_mb(); if (throttled) if (test_and_clear_bit(i, free)) return; submit_urb();
Note that test_and_clear_bit() only implies barriers when the test is successful. To handle the case where the URB is still in use an explicit barrier needs to be added to unthrottle() for the second race condition.
Also note that the first race was fixed by 36e59e0d70d6 ("cdc-acm: fix race between callback and unthrottle") back in 2015, but the bug was reintroduced a year later.
--- drivers/usb/class/cdc-acm.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-)
drivers/usb/class/cdc-acm.c +25 -7
@@ -420,12 +420,12 @@ static void acm_read_bulk_callback(strucstruct acm *acm = rb->instance;unsigned long flags;int status = urb->status; +bool stopped = false; +bool stalled = false;dev_vdbg (&acm->data->dev,"%s - urb %d, len %d\n" , __func__, rb->index, urb->actual_length); -set_bit (rb->index, &acm->read_urbs_free); -if (!acm->dev) {dev_dbg (&acm->data->dev,"%s - disconnected\n" , __func__);return ;
@@ -438,15 +438,16 @@ static void acm_read_bulk_callback(strucbreak ;case -EPIPE :set_bit (EVENT_RX_STALL , &acm->flags); -schedule_work (&acm->work); -return ; + stalled = true; +break ;case -ENOENT :case -ECONNRESET :case -ESHUTDOWN :dev_dbg (&acm->data->dev,"%s - urb shutting down with status: %d\n" , __func__, status); -return ; + stopped = true; +break ;default : dev_dbg(&acm->data->dev, "%s - nonzero urb status received: %d\n",
@@ -455,10 +456,24 @@ static void acm_read_bulk_callback(struc }/* -* Unthrottle may run on another CPU which needs to see events -* in the same order. Submission has an implict barrier +* Make sure URB processing is done before marking as free to avoid +* racing with unthrottle() on another CPU. Matches the barriers +* implied by the test_and_clear_bit() in acm_submit_read_urb(). */ smp_mb__before_atomic (); +set_bit (rb->index, &acm->read_urbs_free); +/* +* Make sure URB is marked as free before checking the throttled flag +* to avoid racing with unthrottle() on another CPU. Matches the +* smp_mb() in unthrottle(). +*/ +smp_mb__after_atomic (); + +if (stopped || stalled) { +if (stalled) +schedule_work (&acm->work); +return ; + }/* throttle device if requested by tty */ spin_lock_irqsave (&acm->read_lock, flags);
@@ -807,6 +822,9 @@ static void acm_tty_unthrottle(struct tt acm->throttle_req =0 ;spin_unlock_irq (&acm->read_lock); +/* Matches the smp_mb__after_atomic() in acm_read_bulk_callback(). */ +smp_mb (); +if (was_throttled)acm_submit_read_urbs (acm,GFP_KERNEL ); }
PATCH 71/132 USB: serial: use variable for status
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 3161da970d38cd6ed2ba8cadec93874d1d06e11e upstream.
This patch turns status in a variable read once from the URB. The long term plan is to deliver status to the callback. In addition it makes the code a bit more elegant.
--- drivers/usb/serial/generic.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/usb/serial/generic.c +10 -8
@@ -350,6 +350,7 @@ void usb_serial_generic_read_bulk_callbastruct usb_serial_port *port = urb->context;unsigned char *data = urb->transfer_buffer;unsigned long flags; +int status = urb->status;int i;for (i =0 ; i <ARRAY_SIZE (port->read_urbs); ++i) {
@@ -360,22 +361,22 @@ void usb_serial_generic_read_bulk_callbadev_dbg (&port->dev,"%s - urb %d, len %d\n" , __func__, i, urb->actual_length); -switch (urb->status) { +switch (status) {case 0 :break ;case -ENOENT :case -ECONNRESET :case -ESHUTDOWN :dev_dbg (&port->dev,"%s - urb stopped: %d\n" , - __func__, urb->status); + __func__, status);return ;case -EPIPE :dev_err (&port->dev,"%s - urb stopped: %d\n" , - __func__, urb->status); + __func__, status);return ;default :dev_dbg (&port->dev,"%s - nonzero urb status: %d\n" , - __func__, urb->status); + __func__, status); goto resubmit; }
@@ -399,6 +400,7 @@ void usb_serial_generic_write_bulk_callb {unsigned long flags;struct usb_serial_port *port = urb->context; +int status = urb->status;int i;for (i =0 ; i <ARRAY_SIZE (port->write_urbs); ++i) {
@@ -410,22 +412,22 @@ void usb_serial_generic_write_bulk_callbset_bit (i, &port->write_urbs_free);spin_unlock_irqrestore (&port->lock, flags); -switch (urb->status) { +switch (status) {case 0 :break ;case -ENOENT :case -ECONNRESET :case -ESHUTDOWN :dev_dbg (&port->dev,"%s - urb stopped: %d\n" , - __func__, urb->status); + __func__, status);return ;case -EPIPE :dev_err_console (port,"%s - urb stopped: %d\n" , - __func__, urb->status); + __func__, status);return ;default :dev_err_console (port,"%s - nonzero urb status: %d\n" , - __func__, urb->status); + __func__, status); goto resubmit; }
PATCH 72/132 USB: serial: fix unthrottle races
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 3f5edd58d040bfa4b74fb89bc02f0bc6b9cd06ab upstream.
Fix two long-standing bugs which could potentially lead to memory corruption or leave the port throttled until it is reopened (on weakly ordered systems), respectively, when read-URB completion races with unthrottle().
First, the URB must not be marked as free before processing is complete to prevent it from being submitted by unthrottle() on another CPU.
CPU 1 CPU 2 ================ ================ complete() unthrottle() process_urb(); smp_mb__before_atomic(); set_bit(i, free); if (test_and_clear_bit(i, free)) submit_urb();
Second, the URB must be marked as free before checking the throttled flag to prevent unthrottle() on another CPU from failing to observe that the URB needs to be submitted if complete() sees that the throttled flag is set.
CPU 1 CPU 2 ================ ================ complete() unthrottle() set_bit(i, free); throttled = 0; smp_mb__after_atomic(); smp_mb(); if (throttled) if (test_and_clear_bit(i, free)) return; submit_urb();
Note that test_and_clear_bit() only implies barriers when the test is successful. To handle the case where the URB is still in use an explicit barrier needs to be added to unthrottle() for the second race condition.
--- drivers/usb/serial/generic.c | 39 +++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-)
drivers/usb/serial/generic.c +32 -7
@@ -350,6 +350,7 @@ void usb_serial_generic_read_bulk_callbastruct usb_serial_port *port = urb->context;unsigned char *data = urb->transfer_buffer;unsigned long flags; +bool stopped = false;int status = urb->status;int i;
@@ -357,33 +358,51 @@ void usb_serial_generic_read_bulk_callbaif (urb == port->read_urbs[i])break ; } -set_bit (i, &port->read_urbs_free);dev_dbg (&port->dev,"%s - urb %d, len %d\n" , __func__, i, urb->actual_length);switch (status) {case 0 : +usb_serial_debug_data (&port->dev, __func__, urb->actual_length, + data); + port->serial->type->process_read_urb (urb);break ;case -ENOENT :case -ECONNRESET :case -ESHUTDOWN :dev_dbg (&port->dev,"%s - urb stopped: %d\n" , __func__, status); -return ; + stopped = true; +break ;case -EPIPE :dev_err (&port->dev,"%s - urb stopped: %d\n" , __func__, status); -return ; + stopped = true; +break ;default :dev_dbg (&port->dev,"%s - nonzero urb status: %d\n" , __func__, status); - goto resubmit; +break ; } -usb_serial_debug_data (&port->dev, __func__, urb->actual_length, data); - port->serial->type->process_read_urb (urb); +/* +* Make sure URB processing is done before marking as free to avoid +* racing with unthrottle() on another CPU. Matches the barriers +* implied by the test_and_clear_bit() in +* usb_serial_generic_submit_read_urb(). +*/ +smp_mb__before_atomic (); +set_bit (i, &port->read_urbs_free); +/* +* Make sure URB is marked as free before checking the throttled flag +* to avoid racing with unthrottle() on another CPU. Matches the +* smp_mb() in unthrottle(). +*/ +smp_mb__after_atomic (); + +if (stopped) +return ; -resubmit:/* Throttle the device if requested by tty */ spin_lock_irqsave (&port->lock, flags); port->throttled = port->throttle_req;
@@ -458,6 +477,12 @@ void usb_serial_generic_unthrottle(struc port->throttled = port->throttle_req =0 ;spin_unlock_irq (&port->lock); +/* +* Matches the smp_mb__after_atomic() in +* usb_serial_generic_read_bulk_callback(). +*/ +smp_mb (); +if (was_throttled)usb_serial_generic_submit_read_urbs (port,GFP_KERNEL ); }
PATCH 73/132 of: fix clang -Wunsequenced for be32_to_cpu()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Phong Tran <[email protected]>
commit 440868661f36071886ed360d91de83bd67c73b4f upstream.
Now, make the loop explicit to avoid clang warning.
./include/linux/of.h:238:37: warning: multiple unsequenced modifications to 'cell' [-Wunsequenced]
r = (r << 32) | be32_to_cpu(*(cell++));
^~
./include/linux/byteorder/generic.h:95:21: note: expanded from macro
'be32_to_cpu'
^
./include/uapi/linux/byteorder/little_endian.h:40:59: note: expanded
from macro '__be32_to_cpu'
^
./include/uapi/linux/swab.h:118:21: note: expanded from macro '__swab32'
___constant_swab32(x) : \
^
./include/uapi/linux/swab.h:18:12: note: expanded from macro
'___constant_swab32'
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
^--- include/linux/of.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/of.h +2 -2
@@ -171,8 +171,8 @@ extern struct device_node *of_find_all_nstatic inline u64 of_read_number (const __be32 *cell,int size) {u64 r =0 ; -while (size--) - r = (r <<32 ) |be32_to_cpu (*(cell++)); +for (; size--; cell++) + r = (r <<32 ) |be32_to_cpu (*cell);return r; }
PATCH 74/132 ASoC: fsl_esai: Fix missing break in switch statement
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "S.j. Wang" <[email protected]>
commit 903c220b1ece12f17c868e43f2243b8f81ff2d4c upstream.
case ESAI_HCKT_EXTAL and case ESAI_HCKR_EXTAL should be independent of each other, so replace fall-through with break.
---
sound/soc/fsl/fsl_esai.c +1 -0
@@ -245,6 +245,7 @@ static int fsl_esai_set_dai_sysclk(strucbreak ;case ESAI_HCKT_EXTAL : ecr |=ESAI_ECR_ETI ; +break ;case ESAI_HCKR_EXTAL : ecr |=ESAI_ECR_ERI ;break ;
PATCH 75/132 powerpc/booke64: set RI in default MSR
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Laurentiu Tudor <[email protected]>
commit 5266e58d6cd90ac85c187d673093ad9cb649e16d upstream.
Set RI in the default kernel's MSR so that the architected way of detecting unrecoverable machine check interrupts has a chance to work. This is inline with the MSR setup of the rest of booke powerpc architectures configured here.
--- arch/powerpc/include/asm/reg_booke.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/reg_booke.h +1 -1
@@ -29,7 +29,7 @@#if defined(CONFIG_PPC_BOOK3E_64 )#define MSR_64BIT MSR_CM -#define MSR_ (MSR_ME | MSR_CE) +#define MSR_ (MSR_ME | MSR_RI | MSR_CE)#define MSR_KERNEL (MSR_ | MSR_64BIT)#define MSR_USER32 (MSR_ | MSR_PR | MSR_EE)#define MSR_USER64 (MSR_USER32 | MSR_64BIT)
PATCH 76/132 iommu/vt-d: Set intel_iommu_gfx_mapped correctly
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit cf1ec4539a50bdfe688caad4615ca47646884316 upstream.
The intel_iommu_gfx_mapped flag is exported by the Intel IOMMU driver to indicate whether an IOMMU is used for the graphic device. In a virtualized IOMMU environment (e.g. QEMU), an include-all IOMMU is used for graphic device. This flag is found to be clear even the IOMMU is used.
--- drivers/iommu/intel-iommu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/iommu/intel-iommu.c +4 -3
@@ -3578,9 +3578,7 @@ static void __init init_no_remapping_dev/* This IOMMU has *only* gfx devices. Either bypass it or set the gfx_mapped flag, as appropriate */ -if (dmar_map_gfx) { - intel_iommu_gfx_mapped =1 ; - }else { +if (!dmar_map_gfx) { drhd->ignored =1 ;for_each_active_dev_scope (drhd->devices, drhd->devices_cnt, i, dev)
@@ -4074,6 +4072,9 @@ int __init intel_iommu_init(void) goto out_free_reserved_range; } +if (dmar_map_gfx) + intel_iommu_gfx_mapped =1 ; +init_no_remapping_devices (); ret =init_dmars ();
PATCH 77/132 net: ucc_geth - fix Oops when changing number of buffers in the ring
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
commit ee0df19305d9fabd9479b785918966f6e25b733b upstream.
When changing the number of buffers in the RX ring while the interface is running, the following Oops is encountered due to the new number of buffers being taken into account immediately while their allocation is done when opening the device only.
[ 69.882706] Unable to handle kernel paging request for data at address 0xf0000100 [ 69.890172] Faulting instruction address: 0xc033e164 [ 69.895122] Oops: Kernel access of bad area, sig: 11 [#1] [ 69.900494] BE PREEMPT CMPCPRO [ 69.907120] CPU: 0 PID: 0 Comm: swapper Not tainted 4.14.115-00006-g179ade8ce3-dirty #269 [ 69.915956] task: c0684310 task.stack: c06da000 [ 69.920470] NIP: c033e164 LR: c02e44d0 CTR: c02e41fc [ 69.925504] REGS: dfff1e20 TRAP: 0300 Not tainted (4.14.115-00006-g179ade8ce3-dirty) [ 69.934161] MSR: 00009032 <EE,ME,IR,DR,RI> CR: 22004428 XER: 20000000 [ 69.940869] DAR: f0000100 DSISR: 20000000 [ 69.940869] GPR00: c0352d70 dfff1ed0 c0684310 f00000a4 00000040 dfff1f68 00000000 0000001f [ 69.940869] GPR08: df53f410 1cc00040 00000021 c0781640 42004424 100c82b6 f00000a4 df53f5b0 [ 69.940869] GPR16: df53f6c0 c05daf84 00000040 00000000 00000040 c0782be4 00000000 00000001 [ 69.940869] GPR24: 00000000 df53f400 000001b0 df53f410 df53f000 0000003f df708220 1cc00044 [ 69.978348] NIP [c033e164] skb_put+0x0/0x5c [ 69.982528] LR [c02e44d0] ucc_geth_poll+0x2d4/0x3f8 [ 69.987384] Call Trace: [ 69.989830] [dfff1ed0] [c02e4554] ucc_geth_poll+0x358/0x3f8 (unreliable) [ 69.996522] [dfff1f20] [c0352d70] net_rx_action+0x248/0x30c [ 70.002099] [dfff1f80] [c04e93e4] __do_softirq+0xfc/0x310 [ 70.007492] [dfff1fe0] [c0021124] irq_exit+0xd0/0xd4 [ 70.012458] [dfff1ff0] [c000e7e0] call_do_irq+0x24/0x3c [ 70.017683] [c06dbe80] [c0006bac] do_IRQ+0x64/0xc4 [ 70.022474] [c06dbea0] [c001097c] ret_from_except+0x0/0x14 [ 70.027964] --- interrupt: 501 at rcu_idle_exit+0x84/0x90 [ 70.027964] LR = rcu_idle_exit+0x74/0x90 [ 70.037585] [c06dbf60] [20000000] 0x20000000 (unreliable) [ 70.042984] [c06dbf80] [c004bb0c] do_idle+0xb4/0x11c [ 70.047945] [c06dbfa0] [c004bd14] cpu_startup_entry+0x18/0x1c [ 70.053682] [c06dbfb0] [c05fb034] start_kernel+0x370/0x384 [ 70.059153] [c06dbff0] [00003438] 0x3438 [ 70.063062] Instruction dump: [ 70.066023] 38a00000 38800000 90010014 4bfff015 80010014 7c0803a6 3123ffff 7c691910 [ 70.073767] 38210010 4e800020 38600000 4e800020 <80e3005c> 80c30098 3107ffff 7d083910 [ 70.081690] ---[ end trace be7ccd9c1e1a9f12 ]---
This patch forbids the modification of the number of buffers in the ring while the interface is running.
--- drivers/net/ethernet/freescale/ucc_geth_ethtool.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/freescale/ucc_geth_ethtool.c +3 -5
@@ -253,14 +253,12 @@ uec_set_ringparam(struct net_device *netreturn -EINVAL ; } +if (netif_running (netdev)) +return -EBUSY ; + ug_info->bdRingLenRx[queue] = ring->rx_pending; ug_info->bdRingLenTx[queue] = ring->tx_pending; -if (netif_running (netdev)) { -/* FIXME: restart automatically */ -netdev_info (netdev,"Please re-open the interface\n" ); - } -return ret; }
PATCH 78/132 ALSA: hda/hdmi - Read the pin sense from register when repolling
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hui Wang <[email protected]>
commit 8c2e6728c2bf95765b724e07d0278ae97cd1ee0d upstream.
The driver will check the monitor presence when resuming from suspend, starting poll or interrupt triggers. In these 3 situations, the jack_dirty will be set to 1 first, then the hda_jack.c reads the pin_sense from register, after reading the register, the jack_dirty will be set to 0. But hdmi_repoll_work() is enabled in these 3 situations, It will read the pin_sense a couple of times subsequently, since the jack_dirty is 0 now, It does not read the register anymore, instead it uses the shadow pin_sense which is read at the first time.
It is meaningless to check the shadow pin_sense a couple of times, we need to read the register to check the real plugging state, so we set the jack_dirty to 1 in the hdmi_repoll_work().
---
sound/pci/hda/patch_hdmi.c +6 -0
@@ -1632,6 +1632,12 @@ static void hdmi_repoll_eld(struct work_ {struct hdmi_spec_per_pin *per_pin = container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); +struct hda_codec *codec = per_pin->codec; +struct hda_jack_tbl *jack; + + jack =snd_hda_jack_tbl_get (codec, per_pin->pin_nid); +if (jack) + jack->jack_dirty =1 ;if (per_pin->repoll_count++ >6 ) per_pin->repoll_count =0 ;
PATCH 79/132 ASoC: max98090: Fix restore of DAPM Muxes
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jon Hunter <[email protected]>
commit ecb2795c08bc825ebd604997e5be440b060c5b18 upstream.
The max98090 driver defines 3 DAPM muxes; one for the right line output (LINMOD Mux), one for the left headphone mixer source (MIXHPLSEL Mux) and one for the right headphone mixer source (MIXHPRSEL Mux). The same bit is used for the mux as well as the DAPM enable, and although the mux can be correctly configured, after playback has completed, the mux will be reset during the disable phase. This is preventing the state of these muxes from being saved and restored correctly on system reboot. Fix this by marking these muxes as SND_SOC_NOPM.
Note this has been verified this on the Tegra124 Nyan Big which features the MAX98090 codec.
--- sound/soc/codecs/max98090.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/codecs/max98090.c +6 -6
@@ -1271,14 +1271,14 @@ static const struct snd_soc_dapm_widget &max98090_right_rcv_mixer_controls[0], ARRAY_SIZE(max98090_right_rcv_mixer_controls)), -SND_SOC_DAPM_MUX ("LINMOD Mux" ,M98090_REG_LOUTR_MIXER , -M98090_LINMOD_SHIFT ,0 , &max98090_linmod_mux), +SND_SOC_DAPM_MUX ("LINMOD Mux" ,SND_SOC_NOPM ,0 ,0 , + &max98090_linmod_mux), -SND_SOC_DAPM_MUX ("MIXHPLSEL Mux" ,M98090_REG_HP_CONTROL , -M98090_MIXHPLSEL_SHIFT ,0 , &max98090_mixhplsel_mux), +SND_SOC_DAPM_MUX ("MIXHPLSEL Mux" ,SND_SOC_NOPM ,0 ,0 , + &max98090_mixhplsel_mux), -SND_SOC_DAPM_MUX ("MIXHPRSEL Mux" ,M98090_REG_HP_CONTROL , -M98090_MIXHPRSEL_SHIFT ,0 , &max98090_mixhprsel_mux), +SND_SOC_DAPM_MUX ("MIXHPRSEL Mux" ,SND_SOC_NOPM ,0 ,0 , + &max98090_mixhprsel_mux),SND_SOC_DAPM_PGA ("HP Left Out" ,M98090_REG_OUTPUT_ENABLE , M98090_HPLEN_SHIFT, 0, NULL, 0),
PATCH 80/132 ceph: flush dirty inodes before proceeding with remount
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 00abf69dd24f4444d185982379c5cc3bb7b6d1fc upstream.
xfstest generic/452 was triggering a "Busy inodes after umount" warning. ceph was allowing the mount to go read-only without first flushing out dirty inodes in the cache. Ensure we sync out the filesystem before allowing a remount to proceed.
--- fs/ceph/super.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ceph/super.c +7 -0
@@ -706,6 +706,12 @@ static void ceph_umount_begin(struct supreturn ; } +static int ceph_remount (struct super_block *sb,int *flags,char *data) +{ +sync_filesystem (sb); +return 0 ; +} +static const struct super_operations ceph_super_ops = { .alloc_inode = ceph_alloc_inode, .destroy_inode = ceph_destroy_inode,
@@ -713,6 +719,7 @@ static const struct super_operations cep .drop_inode = ceph_drop_inode, .sync_fs = ceph_sync_fs, .put_super = ceph_put_super, + .remount_fs = ceph_remount, .show_options = ceph_show_options, .statfs = ceph_statfs, .umount_begin = ceph_umount_begin,
PATCH 81/132 cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Probst <[email protected]>
commit 6a54b2e002c9d00b398d35724c79f9fe0d9b38fb upstream.
Change strcat to strncpy in the "None" case to fix a buffer overflow when cinode->oplock is reset to 0 by another thread accessing the same cinode. It is never valid to append "None" to any other message.
Consolidate multiple writes to cinode->oplock to reduce raciness.
--- fs/cifs/smb2ops.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/cifs/smb2ops.c +8 -6
@@ -1000,26 +1000,28 @@ smb21_set_oplock_level(struct cifsInodeI unsigned int epoch, bool *purge_cache) { char message[5] = {0}; +unsigned int new_oplock =0 ; oplock &=0xFF ;if (oplock ==SMB2_OPLOCK_LEVEL_NOCHANGE )return ; - cinode->oplock =0 ;if (oplock &SMB2_LEASE_READ_CACHING_HE ) { - cinode->oplock |=CIFS_CACHE_READ_FLG ; + new_oplock |=CIFS_CACHE_READ_FLG ;strcat (message,"R" ); }if (oplock &SMB2_LEASE_HANDLE_CACHING_HE ) { - cinode->oplock |=CIFS_CACHE_HANDLE_FLG ; + new_oplock |=CIFS_CACHE_HANDLE_FLG ;strcat (message,"H" ); }if (oplock &SMB2_LEASE_WRITE_CACHING_HE ) { - cinode->oplock |=CIFS_CACHE_WRITE_FLG ; + new_oplock |=CIFS_CACHE_WRITE_FLG ;strcat (message,"W" ); } -if (!cinode->oplock) -strcat (message,"None" ); +if (!new_oplock) +strncpy (message,"None" ,sizeof (message)); + + cinode->oplock = new_oplock;cifs_dbg (FYI ,"%s Lease granted on inode %p\n" , message, &cinode->vfs_inode); }
PATCH 82/132 tracing: Fix partial reading of trace event's id file
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Elazar Leibovich <[email protected]>
commit cbe08bcbbe787315c425dde284dcb715cfbf3f39 upstream.
When reading only part of the id file, the ppos isn't tracked correctly. This is taken care by simple_read_from_buffer.
Reading a single byte, and then the next byte would result EOF.
While this seems like not a big deal, this breaks abstractions that reads information from files unbuffered. See for example
https://github.com/golang/go/issues/29399
This code was mentioned as problematic in commit cd458ba9d5a5
("tracing: Do not (ab)use trace_seq in event_id_read()")
An example C code that show this bug is:
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char **argv) {
if (argc < 2)
return 1;
int fd = open(argv[1], O_RDONLY);
char c;
read(fd, &c, 1);
printf("First %c\n", c);
read(fd, &c, 1);
printf("Second %c\n", c);
}Then run with, e.g.
sudo ./a.out /sys/kernel/debug/tracing/events/tcp/tcp_set_state/id
You'll notice you're getting the first character twice, instead of the first two characters in the id file.
--- kernel/trace/trace_events.c | 3 --- 1 file changed, 3 deletions(-)
kernel/trace/trace_events.c +0 -3
@@ -1007,9 +1007,6 @@ event_id_read(struct file *filp, char __char buf[32 ];int len; -if (*ppos) -return 0 ; -if (unlikely (!id))return -ENODEV ;
PATCH 83/132 ipv4: Fix raw socket lookup for local traffic
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
commit 19e4e768064a87b073a4b4c138b55db70e0cfb9f upstream.
inet_iif should be used for the raw socket lookup. inet_iif considers rt_iif which handles the case of local traffic.
As it stands, ping to a local address with the '-I <dev>' option fails ever since ping was changed to use SO_BINDTODEVICE instead of cmsg + IP_PKTINFO.
IPv6 works fine.
--- net/ipv4/raw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/raw.c +2 -2
@@ -167,6 +167,7 @@ static int icmp_filter(const struct sock*/ static int raw_v4_input (struct sk_buff *skb,const struct iphdr *iph,int hash) { +int dif =inet_iif (skb);struct sock *sk;struct hlist_head *head;int delivered =0 ;
@@ -179,8 +180,7 @@ static int raw_v4_input(struct sk_buff * net =dev_net (skb->dev); sk =__raw_v4_lookup (net,__sk_head (head), iph->protocol, - iph->saddr, iph->daddr, - skb->dev->ifindex); + iph->saddr, iph->daddr, dif);while (sk) { delivered =1 ;
PATCH 84/132 ipv4: Use return value of inet_iif() for __raw_v4_lookup in the while loop
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Suryaputra <[email protected]>
commit 38c73529de13e1e10914de7030b659a2f8b01c3b upstream.
In commit 19e4e768064a8 ("ipv4: Fix raw socket lookup for local traffic"), the dif argument to __raw_v4_lookup() is coming from the returned value of inet_iif() but the change was done only for the first lookup. Subsequent lookups in the while loop still use skb->dev->ifIndex.
--- net/ipv4/raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/raw.c +1 -1
@@ -193,7 +193,7 @@ static int raw_v4_input(struct sk_buff * } sk =__raw_v4_lookup (net,sk_next (sk), iph->protocol, iph->saddr, iph->daddr, - skb->dev->ifindex); + dif); } out:read_unlock (&raw_v4_hashinfo.lock);
PATCH 85/132 media: omap_vout: potential buffer overflow in vidioc_dqbuf()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit dd6e2a981bfe83aa4a493143fd8cf1edcda6c091 upstream.
The "b->index" is a u32 the comes from the user in the ioctl. It hasn't been checked. We aren't supposed to use it but we're instead supposed to use the value that gets written to it when we call videobuf_dqbuf().
The videobuf_dqbuf() first memsets it to zero and then re-initializes it inside the videobuf_status() function. It's this final value which we want.
Hans Verkuil pointed out that we need to check the return from videobuf_dqbuf(). I ended up doing a little cleanup related to that as well.
--- drivers/media/platform/omap/omap_vout.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/media/platform/omap/omap_vout.c +6 -9
@@ -1596,23 +1596,20 @@ static int vidioc_dqbuf(struct file *filunsigned long size;struct videobuf_buffer *vb; - vb = q->bufs[b->index]; -if (!vout->streaming)return -EINVAL ; -if (file->f_flags &O_NONBLOCK ) -/* Call videobuf_dqbuf for non blocking mode */ - ret =videobuf_dqbuf (q, (struct v4l2_buffer *)b,1 ); -else -/* Call videobuf_dqbuf for blocking mode */ - ret =videobuf_dqbuf (q, (struct v4l2_buffer *)b,0 ); + ret =videobuf_dqbuf (q, b, !!(file->f_flags &O_NONBLOCK )); +if (ret) +return ret; + + vb = q->bufs[b->index]; addr = (unsigned long ) vout->buf_phy_addr[vb->i]; size = (unsigned long ) vb->size;dma_unmap_single (vout->vid_dev->v4l2_dev.dev, addr, size,DMA_TO_DEVICE ); -return ret; +return 0 ; }static int vidioc_streamon (struct file *file,void *fh,enum v4l2_buf_type i)
PATCH 86/132 media: davinci/vpbe: array underflow in vpbe_enum_outputs()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b72845ee5577b227131b1fef23f9d9a296621d7b upstream.
In vpbe_enum_outputs() we check if (temp_index >= cfg->num_outputs) but the problem is that "temp_index" can be negative. This patch changes the types to unsigned to address this array underflow bug.
--- drivers/media/platform/davinci/vpbe.c | 2 +- include/media/davinci/vpbe.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpbe.c +1 -1
@@ -130,7 +130,7 @@ static int vpbe_enum_outputs(struct vpbe struct v4l2_output *output) {struct vpbe_config *cfg = vpbe_dev->cfg; -int temp_index = output->index; +unsigned int temp_index = output->index;if (temp_index >= cfg->num_outputs)return -EINVAL ;
include/media/davinci/vpbe.h +1 -1
@@ -96,7 +96,7 @@ struct vpbe_config {struct encoder_config_info *ext_encoders;/* amplifier information goes here */ struct amp_config_info *amp; -int num_outputs; +unsigned int num_outputs;/* Order is venc outputs followed by LCD and then external encoders */ struct vpbe_output *outputs; };
PATCH 87/132 platform/x86: alienware-wmi: printing the wrong error code
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 6d1f8b3d75419a8659ac916a1e9543bb3513a882 upstream.
The "out_data" variable is uninitialized at the point. Originally, this used to print "status" instead and that seems like the correct thing to print.
--- drivers/platform/x86/alienware-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/alienware-wmi.c +1 -1
@@ -494,7 +494,7 @@ static ssize_t show_hdmi_source(struct dreturn scnprintf (buf,PAGE_SIZE ,"input [gpu] unknown\n" ); } -pr_err ("alienware-wmi: unknown HDMI source status: %d\n" , out_data); +pr_err ("alienware-wmi: unknown HDMI source status: %u\n" , status);return scnprintf (buf,PAGE_SIZE ,"input gpu [unknown]\n" ); }
PATCH 88/132 platform/x86: sony-laptop: Fix unintentional fall-through
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
commit 1cbd7a64959d33e7a2a1fa2bf36a62b350a9fcbd upstream.
It seems that the default case should return AE_CTRL_TERMINATE, instead of falling through to case ACPI_RESOURCE_TYPE_END_TAG and returning AE_OK; otherwise the line of code at the end of the function is unreachable and makes no sense:
return AE_CTRL_TERMINATE;
This fix is based on the following thread of discussion:
https://lore.kernel.org/patchwork/patch/959782/
--- drivers/platform/x86/sony-laptop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/sony-laptop.c +5 -3
@@ -4401,14 +4401,16 @@ sony_pic_read_possible_resource(struct a }return AE_OK ; } + +case ACPI_RESOURCE_TYPE_END_TAG : +return AE_OK ; +default :dprintk ("Resource %d isn't an IRQ nor an IO port\n" , resource->type); +return AE_CTRL_TERMINATE ; -case ACPI_RESOURCE_TYPE_END_TAG : -return AE_OK ; } -return AE_CTRL_TERMINATE ; }static int sony_pic_possible_resources (struct acpi_device *device)
PATCH 89/132 netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 680f6af5337c98d116e4f127cea7845339dba8da upstream.
If userspace provides a rule blob with trailing data after last target, we trigger a splat, then convert ruleset to 64bit format (with trailing data), then pass that to do_replace_finish() which then returns -EINVAL.
Erroring out right away avoids the splat plus unneeded translation and error unwind.
--- net/bridge/netfilter/ebtables.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bridge/netfilter/ebtables.c +3 -1
@@ -2139,7 +2139,9 @@ static int compat_copy_entries(unsignedif (ret <0 )return ret; -WARN_ON (size_remaining); +if (size_remaining) +return -EINVAL ; +return state->buf_kern_offset; }
PATCH 90/132 ntp: Allow TAI-UTC offset to be set to zero
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miroslav Lichvar <[email protected]>
commit fdc6bae940ee9eb869e493990540098b8c0fd6ab upstream.
The ADJ_TAI adjtimex mode sets the TAI-UTC offset of the system clock. It is typically set by NTP/PTP implementations and it is automatically updated by the kernel on leap seconds. The initial value is zero (which applications may interpret as unknown), but this value cannot be set by adjtimex. This limitation seems to go back to the original "nanokernel" implementation by David Mills.
Change the ADJ_TAI check to accept zero as a valid TAI-UTC offset in order to allow setting it back to the initial value.
--- kernel/time/ntp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/ntp.c +1 -1
@@ -588,7 +588,7 @@ static inline void process_adjtimex_mode time_constant =max (time_constant,0l ); } -if (txc->modes &ADJ_TAI && txc->constant >0 ) +if (txc->modes &ADJ_TAI && txc->constant >=0 ) *time_tai = txc->constant;if (txc->modes &ADJ_OFFSET )
PATCH 91/132 NFS4: Fix v4.0 client state corruption when mount
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: ZhangXiaoxu <[email protected]>
commit f02f3755dbd14fb935d24b14650fff9ba92243b8 upstream.
stat command with soft mount never return after server is stopped.
When alloc a new client, the state of the client will be set to NFS4CLNT_LEASE_EXPIRED.
When the server is stopped, the state manager will work, and accord the state to recover. But the state is NFS4CLNT_LEASE_EXPIRED, it will drain the slot table and lead other task to wait queue, until the client recovered. Then the stat command is hung.
When discover server trunking, the client will renew the lease, but check the client state, it lead the client state corruption.
So, we need to call state manager to recover it when detect server ip trunking.
--- fs/nfs/nfs4state.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/nfs/nfs4state.c +4 -0
@@ -140,6 +140,10 @@ int nfs40_discover_server_trunking(struc/* Sustain the lease, even if it's empty. If the clientid4 * goes stale it's of no use for trunking discovery. */ nfs4_schedule_state_renewal (*result); + +/* If the client state need to recover, do it. */ +if (clp->cl_state) +nfs4_schedule_state_manager (clp); } out:return status;
PATCH 92/132 drm/radeon: prefer lower reference dividers
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit 2e26ccb119bde03584be53406bbd22e711b0d6e6 upstream.
Instead of the closest reference divider prefer the lowest, this fixes flickering issues on HP Compaq nx9420.
Bugs: https://bugs.freedesktop.org/show_bug.cgi?id=108514
--- drivers/gpu/drm/radeon/radeon_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_display.c +2 -2
@@ -942,12 +942,12 @@ static void avivo_get_fb_ref_div(unsigne ref_div_max =max (min (100 / post_div, ref_div_max),1u );/* get matching reference and feedback divider */ - *ref_div =min (max (DIV_ROUND_CLOSEST (den, post_div),1u ), ref_div_max); + *ref_div =min (max (den/post_div,1u ), ref_div_max); *fb_div =DIV_ROUND_CLOSEST (nom * *ref_div * post_div, den);/* limit fb divider to its maximum */ if (*fb_div > fb_div_max) { - *ref_div =DIV_ROUND_CLOSEST (*ref_div * fb_div_max, *fb_div); + *ref_div = (*ref_div * fb_div_max)/(*fb_div); *fb_div = fb_div_max; } }
PATCH 93/132 ext4: fix data corruption caused by overlapping unaligned and aligned IO
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit 57a0da28ced8707cb9f79f071a016b9d005caf5a upstream.
Unaligned AIO must be serialized because the zeroing of partial blocks of unaligned AIO can result in data corruption in case it's overlapping another in flight IO.
Currently we wait for all unwritten extents before we submit unaligned AIO which protects data in case of unaligned AIO is following overlapping IO. However if a unaligned AIO is followed by overlapping aligned AIO we can still end up corrupting data.
To fix this, we must make sure that the unaligned AIO is the only IO in flight by waiting for unwritten extents conversion not just before the IO submission, but right after it as well.
This problem can be reproduced by xfstest generic/538
[bwh: Backported to 3.16:
- Test aio_mutex instead of unaligned_aio
- Adjust context]
--- fs/ext4/file.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ext4/file.c +7 -0
@@ -173,6 +173,13 @@ ext4_file_write_iter(struct kiocb *iocb, } ret =__generic_file_write_iter (iocb, from); +/* +* Unaligned direct AIO must be the only IO in flight. Otherwise +* overlapping aligned IO after unaligned might result in data +* corruption. +*/ +if (ret == -EIOCBQUEUED && aio_mutex) +ext4_unwritten_wait (inode);mutex_unlock (&inode->i_mutex);if (ret >0 ) {
PATCH 94/132 kdb: do a sanity check on the cpu in kdb_per_cpu()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit b586627e10f57ee3aa8f0cfab0d6f7dc4ae63760 upstream.
The "whichcpu" comes from argv[3]. The cpu_online() macro looks up the cpu in a bitmap of online cpus, but if the value is too high then it could read beyond the end of the bitmap and possibly Oops.
--- kernel/debug/kdb/kdb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/debug/kdb/kdb_main.c +1 -1
@@ -2569,7 +2569,7 @@ static int kdb_per_cpu(int argc, const c diag =kdbgetularg (argv[3 ], &whichcpu);if (diag)return diag; -if (!cpu_online (whichcpu)) { +if (whichcpu >= nr_cpu_ids || !cpu_online (whichcpu)) {kdb_printf ("cpu %ld is not online\n" , whichcpu);return KDB_BADCPUNUM ; }
PATCH 95/132 bonding: fix arp_validate toggling in active-backup mode
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jarod Wilson <[email protected]>
commit a9b8a2b39ce65df45687cf9ef648885c2a99fe75 upstream.
There's currently a problem with toggling arp_validate on and off with an active-backup bond. At the moment, you can start up a bond, like so:
modprobe bonding mode=1 arp_interval=100 arp_validate=0 arp_ip_targets=192.168.1.1 ip link set bond0 down
echo "ens4f0" > /sys/class/net/bond0/bonding/slaves
echo "ens4f1" > /sys/class/net/bond0/bonding/slaves
ip link set bond0 up
ip addr add 192.168.1.2/24 dev bond0
Pings to 192.168.1.1 work just fine. Now turn on arp_validate:
echo 1 > /sys/class/net/bond0/bonding/arp_validate
Pings to 192.168.1.1 continue to work just fine. Now when you go to turn arp_validate off again, the link falls flat on it's face:
echo 0 > /sys/class/net/bond0/bonding/arp_validate dmesg
...
[133191.911987] bond0: Setting arp_validate to none (0) [133194.257793] bond0: bond_should_notify_peers: slave ens4f0 [133194.258031] bond0: link status definitely down for interface ens4f0, disabling it [133194.259000] bond0: making interface ens4f1 the new active one [133197.330130] bond0: link status definitely down for interface ens4f1, disabling it [133197.331191] bond0: now running without any active interface!
The problem lies in bond_options.c, where passing in arp_validate=0 results in bond->recv_probe getting set to NULL. This flies directly in the face of commit 3fe68df97c7f, which says we need to set recv_probe = bond_arp_recv, even if we're not using arp_validate. Said commit fixed this in bond_option_arp_interval_set, but missed that we can get to that same state in bond_option_arp_validate_set as well.
One solution would be to universally set recv_probe = bond_arp_recv here as well, but I don't think bond_option_arp_validate_set has any business touching recv_probe at all, and that should be left to the arp_interval code, so we can just make things much tidier here.
--- drivers/net/bonding/bond_options.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/bonding/bond_options.c +0 -7
@@ -1068,13 +1068,6 @@ static int bond_option_arp_validate_set( {pr_info ("%s: Setting arp_validate to %s (%llu)\n" , bond->dev->name, newval->string, newval->value); - -if (bond->dev->flags &IFF_UP ) { -if (!newval->value) - bond->recv_probe =NULL ; -else if (bond->params.arp_interval) - bond->recv_probe = bond_arp_rcv; - } bond->params.arp_validate = newval->value;return 0 ;
PATCH 96/132 mfd: da9063: Fix OTP control register names to match datasheets for DA9063/63L
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve Twiss <[email protected]>
commit 6b4814a9451add06d457e198be418bf6a3e6a990 upstream.
Mismatch between what is found in the Datasheets for DA9063 and DA9063L provided by Dialog Semiconductor, and the register names provided in the MFD registers file. The changes are for the OTP (one-time-programming) control registers. The two naming errors are OPT instead of OTP, and COUNT instead of CONT (i.e. control).
--- include/linux/mfd/da9063/registers.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/mfd/da9063/registers.h +3 -3
@@ -204,9 +204,9 @@/* DA9063 Configuration registers */ /* OTP */ -#define DA9063_REG_OPT_COUNT 0x101 -#define DA9063_REG_OPT_ADDR 0x102 -#define DA9063_REG_OPT_DATA 0x103 +#define DA9063_REG_OTP_CONT 0x101 +#define DA9063_REG_OTP_ADDR 0x102 +#define DA9063_REG_OTP_DATA 0x103/* Customer Trim and Configuration */ #define DA9063_REG_T_OFFSET 0x104
PATCH 97/132 backlight: lm3630a: Return 0 on success in update_status functions
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Brian Masney <[email protected]>
commit d3f48ec0954c6aac736ab21c34a35d7554409112 upstream.
lm3630a_bank_a_update_status() and lm3630a_bank_b_update_status() both return the brightness value if the brightness was successfully updated. Writing to these attributes via sysfs would cause a 'Bad address' error to be returned. These functions should return 0 on success, so let's change it to correct that error.
--- drivers/video/backlight/lm3630a_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/lm3630a_bl.c +2 -2
@@ -201,7 +201,7 @@ static int lm3630a_bank_a_update_status( LM3630A_LEDA_ENABLE, LM3630A_LEDA_ENABLE);if (ret <0 ) goto out_i2c_err; -return bl->props.brightness; +return 0 ; out_i2c_err:dev_err (pchip->dev,"i2c failed to access\n" );
@@ -278,7 +278,7 @@ static int lm3630a_bank_b_update_status( LM3630A_LEDB_ENABLE, LM3630A_LEDB_ENABLE);if (ret <0 ) goto out_i2c_err; -return bl->props.brightness; +return 0 ; out_i2c_err:dev_err (pchip->dev,"i2c failed to access REG_CTRL\n" );
PATCH 98/132 ocfs2: fix ocfs2 read inode data panic in ocfs2_iget
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Shuning Zhang <[email protected]>
commit e091eab028f9253eac5c04f9141bbc9d170acab3 upstream.
In some cases, ocfs2_iget() reads the data of inode, which has been deleted for some reason. That will make the system panic. So We should judge whether this inode has been deleted, and tell the caller that the inode is a bad inode.
For example, the ocfs2 is used as the backed of nfs, and the client is nfsv3. This issue can be reproduced by the following steps.
on the nfs server side,
..../patha/pathb
Step 1: The process A was scheduled before calling the function fh_verify.
Step 2: The process B is removing the 'pathb', and just completed the call to function dput. Then the dentry of 'pathb' has been deleted from the dcache, and all ancestors have been deleted also. The relationship of dentry and inode was deleted through the function hlist_del_init. The following is the call stack. dentry_iput->hlist_del_init(&dentry->d_u.d_alias)
At this time, the inode is still in the dcache.
Step 3: The process A call the function ocfs2_get_dentry, which get the inode from dcache. Then the refcount of inode is 1. The following is the call stack. nfsd3_proc_getacl->fh_verify->exportfs_decode_fh->fh_to_dentry(ocfs2_get_dentry)
Step 4: Dirty pages are flushed by bdi threads. So the inode of 'patha' is evicted, and this directory was deleted. But the inode of 'pathb' can't be evicted, because the refcount of the inode was 1.
Step 5: The process A keep running, and call the function reconnect_path(in exportfs_decode_fh), which call function ocfs2_get_parent of ocfs2. Get the block number of parent directory(patha) by the name of ... Then read the data from disk by the block number. But this inode has been deleted, so the system panic.
Process A Process B
1. in nfsd3_proc_getacl | 2. | dput 3. fh_to_dentry(ocfs2_get_dentry) | 4. bdi flush dirty cache | 5. ocfs2_iget |
[283465.542049] OCFS2: ERROR (device sdp): ocfs2_validate_inode_block:
Invalid dinode #580640: OCFS2_VALID_FL not set
[283465.545490] Kernel panic - not syncing: OCFS2: (device sdp): panic forced
after error
[283465.546889] CPU: 5 PID: 12416 Comm: nfsd Tainted: G W 4.1.12-124.18.6.el6uek.bug28762940v3.x86_64 #2 [283465.548382] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 09/21/2015 [283465.549657] 0000000000000000 ffff8800a56fb7b8 ffffffff816e839c ffffffffa0514758 [283465.550392] 000000000008dc20 ffff8800a56fb838 ffffffff816e62d3 0000000000000008 [283465.551056] ffff880000000010 ffff8800a56fb848 ffff8800a56fb7e8 ffff88005df9f000 [283465.551710] Call Trace: [283465.552516] [<ffffffff816e839c>] dump_stack+0x63/0x81 [283465.553291] [<ffffffff816e62d3>] panic+0xcb/0x21b [283465.554037] [<ffffffffa04e66b0>] ocfs2_handle_error+0xf0/0xf0 [ocfs2] [283465.554882] [<ffffffffa04e7737>] __ocfs2_error+0x67/0x70 [ocfs2] [283465.555768] [<ffffffffa049c0f9>] ocfs2_validate_inode_block+0x229/0x230 [ocfs2] [283465.556683] [<ffffffffa047bcbc>] ocfs2_read_blocks+0x46c/0x7b0 [ocfs2] [283465.557408] [<ffffffffa049bed0>] ? ocfs2_inode_cache_io_unlock+0x20/0x20 [ocfs2] [283465.557973] [<ffffffffa049f0eb>] ocfs2_read_inode_block_full+0x3b/0x60 [ocfs2] [283465.558525] [<ffffffffa049f5ba>] ocfs2_iget+0x4aa/0x880 [ocfs2] [283465.559082] [<ffffffffa049146e>] ocfs2_get_parent+0x9e/0x220 [ocfs2] [283465.559622] [<ffffffff81297c05>] reconnect_path+0xb5/0x300 [283465.560156] [<ffffffff81297f46>] exportfs_decode_fh+0xf6/0x2b0 [283465.560708] [<ffffffffa062faf0>] ? nfsd_proc_getattr+0xa0/0xa0 [nfsd] [283465.561262] [<ffffffff810a8196>] ? prepare_creds+0x26/0x110 [283465.561932] [<ffffffffa0630860>] fh_verify+0x350/0x660 [nfsd] [283465.562862] [<ffffffffa0637804>] ? nfsd_cache_lookup+0x44/0x630 [nfsd] [283465.563697] [<ffffffffa063a8b9>] nfsd3_proc_getattr+0x69/0xf0 [nfsd] [283465.564510] [<ffffffffa062cf60>] nfsd_dispatch+0xe0/0x290 [nfsd] [283465.565358] [<ffffffffa05eb892>] ? svc_tcp_adjust_wspace+0x12/0x30 [sunrpc] [283465.566272] [<ffffffffa05ea652>] svc_process_common+0x412/0x6a0 [sunrpc] [283465.567155] [<ffffffffa05eaa03>] svc_process+0x123/0x210 [sunrpc] [283465.568020] [<ffffffffa062c90f>] nfsd+0xff/0x170 [nfsd] [283465.568962] [<ffffffffa062c810>] ? nfsd_destroy+0x80/0x80 [nfsd] [283465.570112] [<ffffffff810a622b>] kthread+0xcb/0xf0 [283465.571099] [<ffffffff810a6160>] ? kthread_create_on_node+0x180/0x180 [283465.572114] [<ffffffff816f11b8>] ret_from_fork+0x58/0x90 [283465.573156] [<ffffffff810a6160>] ? kthread_create_on_node+0x180/0x180
--- fs/ocfs2/export.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
fs/ocfs2/export.c +29 -1
@@ -148,16 +148,24 @@ static struct dentry *ocfs2_get_parent(su64 blkno;struct dentry *parent;struct inode *dir = child->d_inode; +int set;trace_ocfs2_get_parent (child, child->d_name.len, child->d_name.name, (unsigned long long )OCFS2_I (dir)->ip_blkno); + status =ocfs2_nfs_sync_lock (OCFS2_SB (dir->i_sb),1 ); +if (status <0 ) { +mlog (ML_ERROR ,"getting nfs sync lock(EX) failed %d\n" , status); + parent =ERR_PTR (status); + goto bail; + } + status =ocfs2_inode_lock (dir,NULL ,0 );if (status <0 ) {if (status != -ENOENT )mlog_errno (status); parent =ERR_PTR (status); - goto bail; + goto unlock_nfs_sync; } status =ocfs2_lookup_ino_from_name (dir,".." ,2 , &blkno);
@@ -166,11 +174,31 @@ static struct dentry *ocfs2_get_parent(s goto bail_unlock; } + status =ocfs2_test_inode_bit (OCFS2_SB (dir->i_sb), blkno, &set); +if (status <0 ) { +if (status == -EINVAL ) { + status = -ESTALE ; + }else +mlog (ML_ERROR ,"test inode bit failed %d\n" , status); + parent =ERR_PTR (status); + goto bail_unlock; + } + +trace_ocfs2_get_dentry_test_bit (status, set); +if (!set) { + status = -ESTALE ; + parent =ERR_PTR (status); + goto bail_unlock; + } + parent =d_obtain_alias (ocfs2_iget (OCFS2_SB (dir->i_sb), blkno,0 ,0 )); bail_unlock:ocfs2_inode_unlock (dir,0 ); +unlock_nfs_sync: +ocfs2_nfs_sync_unlock (OCFS2_SB (dir->i_sb),1 ); + bail:trace_ocfs2_get_parent_end (parent);
PATCH 99/132 drivers/virt/fsl_hypervisor.c: dereferencing error pointers in ioctl
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit c8ea3663f7a8e6996d44500ee818c9330ac4fd88 upstream.
strndup_user() returns error pointers on error, and then in the error handling we pass the error pointers to kfree(). It will cause an Oops.
--- drivers/virt/fsl_hypervisor.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/virt/fsl_hypervisor.c +13 -13
@@ -338,8 +338,8 @@ static long ioctl_dtprop(struct fsl_hv_istruct fsl_hv_ioctl_prop param;char __user *upath, *upropname;void __user *upropval; -char *path =NULL , *propname =NULL ; -void *propval =NULL ; +char *path, *propname; +void *propval;int ret =0 ;/* Get the parameters from the user. */
@@ -351,32 +351,30 @@ static long ioctl_dtprop(struct fsl_hv_i upropval = (void __user *)(uintptr_t )param.propval; path =strndup_user (upath,FH_DTPROP_MAX_PATHLEN ); -if (IS_ERR (path)) { - ret =PTR_ERR (path); - goto out; - } +if (IS_ERR (path)) +return PTR_ERR (path); propname =strndup_user (upropname,FH_DTPROP_MAX_PATHLEN );if (IS_ERR (propname)) { ret =PTR_ERR (propname); - goto out; + goto err_free_path; }if (param.proplen >FH_DTPROP_MAX_PROPLEN ) { ret = -EINVAL ; - goto out; + goto err_free_propname; } propval =kmalloc (param.proplen,GFP_KERNEL );if (!propval) { ret = -ENOMEM ; - goto out; + goto err_free_propname; }if (set) {if (copy_from_user (propval, upropval, param.proplen)) { ret = -EFAULT ; - goto out; + goto err_free_propval; } param.ret = fh_partition_set_dtprop(param.handle,
@@ -395,7 +393,7 @@ static long ioctl_dtprop(struct fsl_hv_iif (copy_to_user (upropval, propval, param.proplen) ||put_user (param.proplen, &p->proplen)) { ret = -EFAULT ; - goto out; + goto err_free_propval; } } }
@@ -403,10 +401,12 @@ static long ioctl_dtprop(struct fsl_hv_iif (put_user (param.ret, &p->ret)) ret = -EFAULT ; -out: -kfree (path); +err_free_propval:kfree (propval); +err_free_propname:kfree (propname); +err_free_path: +kfree (path);return ret; }
PATCH 100/132 x86/speculation/mds: Revert CPU buffer clear on double fault exit
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 88640e1dcd089879530a49a8d212d1814678dfe7 upstream.
The double fault ESPFIX path doesn't return to user mode at all -- it returns back to the kernel by simulating a #GP fault. prepare_exit_to_usermode() will run on the way out of general_protection before running user code.
--- Documentation/x86/mds.rst | 7 ------- arch/x86/kernel/traps.c | 8 -------- 2 files changed, 15 deletions(-)
Documentation/x86/mds.rst +0 -7
@@ -158,13 +158,6 @@ Mitigation points mitigated on the return from do_nmi() to provide almost complete coverage. - - Double fault (#DF): - - A double fault is usually fatal, but the ESPFIX workaround, which can - be triggered from user space through modify_ldt(2) is a recoverable - double fault. #DF uses the paranoid exit path, so explicit mitigation - in the double fault handler is required. - - Machine Check Exception (#MC): Another corner case is a #MC which hits between the CPU buffer clear
arch/x86/kernel/traps.c +0 -8
@@ -55,7 +55,6 @@#include <asm/fixmap.h> #include <asm/mach_traps.h> #include <asm/alternative.h> -#include <asm/nospec-branch.h> #ifdef CONFIG_X86_64 #include <asm/x86_init.h>
@@ -260,13 +259,6 @@ dotraplinkage void do_double_fault(struc regs->ip = (unsigned long )general_protection; regs->sp = (unsigned long )&normal_regs->orig_ax; -/* -* This situation can be triggered by userspace via -* modify_ldt(2) and the return does not take the regular -* user space exit, so a CPU buffer clear is required when -* MDS mitigation is enabled. -*/ -mds_user_clear_cpu_buffers (); return; }#endif
PATCH 101/132 x86/speculation/mds: Improve CPU buffer clear documentation
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 9d8d0294e78a164d407133dea05caf4b84247d6a upstream.
On x86_64, all returns to usermode go through prepare_exit_to_usermode(), with the sole exception of do_nmi(). This even includes machine checks -- this was added several years ago to support MCE recovery. Update the documentation.
--- Documentation/x86/mds.rst | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-)
Documentation/x86/mds.rst +7 -32
@@ -142,38 +142,13 @@ Mitigation points mds_user_clear. The mitigation is invoked in prepare_exit_to_usermode() which covers - most of the kernel to user space transitions. There are a few exceptions - which are not invoking prepare_exit_to_usermode() on return to user - space. These exceptions use the paranoid exit code. - - - Non Maskable Interrupt (NMI): - - Access to sensible data like keys, credentials in the NMI context is - mostly theoretical: The CPU can do prefetching or execute a - misspeculated code path and thereby fetching data which might end up - leaking through a buffer. - - But for mounting other attacks the kernel stack address of the task is - already valuable information. So in full mitigation mode, the NMI is - mitigated on the return from do_nmi() to provide almost complete - coverage. - - - Machine Check Exception (#MC): - - Another corner case is a #MC which hits between the CPU buffer clear - invocation and the actual return to user. As this still is in kernel - space it takes the paranoid exit path which does not clear the CPU - buffers. So the #MC handler repopulates the buffers to some - extent. Machine checks are not reliably controllable and the window is - extremly small so mitigation would just tick a checkbox that this - theoretical corner case is covered. To keep the amount of special - cases small, ignore #MC. - - - Debug Exception (#DB): - - This takes the paranoid exit path only when the INT1 breakpoint is in - kernel space. #DB on a user space address takes the regular exit path, - so no extra mitigation required. + all but one of the kernel to user space transitions. The exception + is when we return from a Non Maskable Interrupt (NMI), which is + handled directly in do_nmi(). + + (The reason that NMI is special is that prepare_exit_to_usermode() can + enable IRQs. In NMI context, NMIs are blocked, and we don't want to + enable IRQs with NMIs blocked.) 2. C-State transition
PATCH 102/132 GFS2: Fix rgrp end rounding problem for bsize < page size
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bob Peterson <[email protected]>
commit 31dddd9eb9ebae9a2a9b502750e9e481d752180a upstream.
This patch fixes a bug introduced by commit 7005c3e. That patch tries to map a vm range for resource groups, but the calculation breaks down when the block size is less than the page size.
--- fs/gfs2/rgrp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/gfs2/rgrp.c +3 -2
@@ -926,8 +926,9 @@ static int read_rindex_entry(struct gfs2 goto fail; rgd->rd_gl->gl_object = rgd; - rgd->rd_gl->gl_vm.start = rgd->rd_addr * bsize; - rgd->rd_gl->gl_vm.end = rgd->rd_gl->gl_vm.start + (rgd->rd_length * bsize) -1 ; + rgd->rd_gl->gl_vm.start = (rgd->rd_addr * bsize) &PAGE_CACHE_MASK ; + rgd->rd_gl->gl_vm.end =PAGE_CACHE_ALIGN ((rgd->rd_addr + + rgd->rd_length) * bsize) -1 ; rgd->rd_rgl = (struct gfs2_rgrp_lvb *)rgd->rd_gl->gl_lksb.sb_lvbptr; rgd->rd_flags &= ~GFS2_RDF_UPTODATE ;if (rgd->rd_data > sdp->sd_max_rg_data)
PATCH 103/132 GFS2: don't set rgrp gl_object until it's inserted into rgrp tree
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bob Peterson <[email protected]>
commit 36e4ad0316c017d5b271378ed9a1c9a4b77fab5f upstream.
Before this patch, function read_rindex_entry would set a rgrp glock's gl_object pointer to itself before inserting the rgrp into the rgrp rbtree. The problem is: if another process was also reading the rgrp in, and had already inserted its newly created rgrp, then the second call to read_rindex_entry would overwrite that value, then return a bad return code to the caller. Later, other functions would reference the now-freed rgrp memory by way of gl_object. In some cases, that could result in gfs2_rgrp_brelse being called twice for the same rgrp: once for the failed attempt and once for the "real" rgrp release. Eventually the kernel would panic. There are also a number of other things that could go wrong when a kernel module is accessing freed storage. For example, this could result in rgrp corruption because the fake rgrp would point to a fake bitmap in memory too, causing gfs2_inplace_reserve to search some random memory for free blocks, and find some, since we were never setting rgd->rd_bits to NULL before freeing it.
This patch fixes the problem by not setting gl_object until we have successfully inserted the rgrp into the rbtree. Also, it sets rd_bits to NULL as it frees them, which will ensure any accidental access to the wrong rgrp will result in a kernel panic rather than file system corruption, which is preferred.
---
fs/gfs2/rgrp.c +8 -5
@@ -731,6 +731,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sgfs2_free_clones (rgd);kfree (rgd->rd_bits); + rgd->rd_bits =NULL ;return_all_reservations (rgd);kmem_cache_free (gfs2_rgrpd_cachep, rgd); }
@@ -925,10 +926,6 @@ static int read_rindex_entry(struct gfs2if (error) goto fail; - rgd->rd_gl->gl_object = rgd; - rgd->rd_gl->gl_vm.start = (rgd->rd_addr * bsize) &PAGE_CACHE_MASK ; - rgd->rd_gl->gl_vm.end =PAGE_CACHE_ALIGN ((rgd->rd_addr + - rgd->rd_length) * bsize) -1 ; rgd->rd_rgl = (struct gfs2_rgrp_lvb *)rgd->rd_gl->gl_lksb.sb_lvbptr; rgd->rd_flags &= ~GFS2_RDF_UPTODATE ;if (rgd->rd_data > sdp->sd_max_rg_data)
@@ -936,14 +933,20 @@ static int read_rindex_entry(struct gfs2spin_lock (&sdp->sd_rindex_spin); error =rgd_insert (rgd);spin_unlock (&sdp->sd_rindex_spin); -if (!error) +if (!error) { + rgd->rd_gl->gl_object = rgd; + rgd->rd_gl->gl_vm.start = (rgd->rd_addr * bsize) &PAGE_MASK ; + rgd->rd_gl->gl_vm.end =PAGE_ALIGN ((rgd->rd_addr + + rgd->rd_length) * bsize) -1 ;return 0 ; + } error =0 ;/* someone else read in the rgrp; free it and ignore it */ gfs2_glock_put (rgd->rd_gl); fail:kfree (rgd->rd_bits); + rgd->rd_bits =NULL ;kmem_cache_free (gfs2_rgrpd_cachep, rgd);return error; }
PATCH 104/132 net: arc_emac: fix koops caused by sk_buff free
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Kochetkov <[email protected]>
commit c278c253f3d992c6994d08aa0efb2b6806ca396f upstream.
There is a race between arc_emac_tx() and arc_emac_tx_clean(). sk_buff got freed by arc_emac_tx_clean() while arc_emac_tx() submitting sk_buff.
In order to free sk_buff arc_emac_tx_clean() checks:
if ((info & FOR_EMAC) || !txbd->data)
break;
...
dev_kfree_skb_irq(skb);If condition false, arc_emac_tx_clean() free sk_buff.
In order to submit txbd, arc_emac_tx() do:
priv->tx_buff[*txbd_curr].skb = skb;
...
priv->txbd[*txbd_curr].data = cpu_to_le32(addr);
...
... <== arc_emac_tx_clean() check condition here
... <== (info & FOR_EMAC) is false
... <== !txbd->data is false
...
*info = cpu_to_le32(FOR_EMAC | FIRST_OR_LAST_MASK | len);In order to reproduce the situation,
run device:
# iperf -s
run on host:
# iperf -t 600 -c <device-ip-addr>[ 28.396284] ------------[ cut here ]------------ [ 28.400912] kernel BUG at .../net/core/skbuff.c:1355! [ 28.414019] Internal error: Oops - BUG: 0 [#1] SMP ARM [ 28.419150] Modules linked in: [ 28.422219] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G B 4.4.0+ #120 [ 28.429516] Hardware name: Rockchip (Device Tree) [ 28.434216] task: c0665070 ti: c0660000 task.ti: c0660000 [ 28.439622] PC is at skb_put+0x10/0x54 [ 28.443381] LR is at arc_emac_poll+0x260/0x474 [ 28.447821] pc : [<c03af580>] lr : [<c028fec4>] psr: a0070113 [ 28.447821] sp : c0661e58 ip : eea68502 fp : ef377000 [ 28.459280] r10: 0000012c r9 : f08b2000 r8 : eeb57100 [ 28.464498] r7 : 00000000 r6 : ef376594 r5 : 00000077 r4 : ef376000 [ 28.471015] r3 : 0030488b r2 : ef13e880 r1 : 000005ee r0 : eeb57100 [ 28.477534] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 28.484658] Control: 10c5387d Table: 8eaf004a DAC: 00000051 [ 28.490396] Process swapper/0 (pid: 0, stack limit = 0xc0660210) [ 28.496393] Stack: (0xc0661e58 to 0xc0662000) [ 28.500745] 1e40: 00000002 00000000 [ 28.508913] 1e60: 00000000 ef376520 00000028 f08b23b8 00000000 ef376520 ef7b6900 c028fc64 [ 28.517082] 1e80: 2f158000 c0661ea8 c0661eb0 0000012c c065e900 c03bdeac ffff95e9 c0662100 [ 28.525250] 1ea0: c0663924 00000028 c0661ea8 c0661ea8 c0661eb0 c0661eb0 0000001e c0660000 [ 28.533417] 1ec0: 40000003 00000008 c0695a00 0000000a c066208c 00000100 c0661ee0 c0027410 [ 28.541584] 1ee0: ef0fb700 2f158000 00200000 ffff95e8 00000004 c0662100 c0662080 00000003 [ 28.549751] 1f00: 00000000 00000000 00000000 c065b45c 0000001e ef005000 c0647a30 00000000 [ 28.557919] 1f20: 00000000 c0027798 00000000 c005cf40 f0802100 c0662ffc c0661f60 f0803100 [ 28.566088] 1f40: c0661fb8 c00093bc c000ffb4 60070013 ffffffff c0661f94 c0661fb8 c00137d4 [ 28.574267] 1f60: 00000001 00000000 00000000 c001ffa0 00000000 c0660000 00000000 c065a364 [ 28.582441] 1f80: c0661fb8 c0647a30 00000000 00000000 00000000 c0661fb0 c000ffb0 c000ffb4 [ 28.590608] 1fa0: 60070013 ffffffff 00000051 00000000 00000000 c005496c c0662400 c061bc40 [ 28.598776] 1fc0: ffffffff ffffffff 00000000 c061b680 00000000 c0647a30 00000000 c0695294 [ 28.606943] 1fe0: c0662488 c0647a2c c066619c 6000406a 413fc090 6000807c 00000000 00000000 [ 28.615127] [<c03af580>] (skb_put) from [<ef376520>] (0xef376520) [ 28.621218] Code: e5902054 e590c090 e3520000 0a000000 (e7f001f2) [ 28.627307] ---[ end trace 4824734e2243fdb6 ]---
[ 34.377068] Internal error: Oops: 17 [#1] SMP ARM [ 34.382854] Modules linked in: [ 34.385947] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 4.4.0+ #120 [ 34.392219] Hardware name: Rockchip (Device Tree) [ 34.396937] task: ef02d040 ti: ef05c000 task.ti: ef05c000 [ 34.402376] PC is at __dev_kfree_skb_irq+0x4/0x80 [ 34.407121] LR is at arc_emac_poll+0x130/0x474 [ 34.411583] pc : [<c03bb640>] lr : [<c028fd94>] psr: 60030013 [ 34.411583] sp : ef05de68 ip : 0008e83c fp : ef377000 [ 34.423062] r10: c001bec4 r9 : 00000000 r8 : f08b24c8 [ 34.428296] r7 : f08b2400 r6 : 00000075 r5 : 00000019 r4 : ef376000 [ 34.434827] r3 : 00060000 r2 : 00000042 r1 : 00000001 r0 : 00000000 [ 34.441365] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 34.448507] Control: 10c5387d Table: 8f25c04a DAC: 00000051 [ 34.454262] Process ksoftirqd/0 (pid: 3, stack limit = 0xef05c210) [ 34.460449] Stack: (0xef05de68 to 0xef05e000) [ 34.464827] de60: ef376000 c028fd94 00000000 c0669480 c0669480 ef376520 [ 34.473022] de80: 00000028 00000001 00002ae4 ef376520 ef7b6900 c028fc64 2f158000 ef05dec0 [ 34.481215] dea0: ef05dec8 0000012c c065e900 c03bdeac ffff983f c0662100 c0663924 00000028 [ 34.489409] dec0: ef05dec0 ef05dec0 ef05dec8 ef05dec8 ef7b6000 ef05c000 40000003 00000008 [ 34.497600] dee0: c0695a00 0000000a c066208c 00000100 ef05def8 c0027410 ef7b6000 40000000 [ 34.505795] df00: 04208040 ffff983e 00000004 c0662100 c0662080 00000003 ef05c000 ef027340 [ 34.513985] df20: ef05c000 c0666c2c 00000000 00000001 00000002 00000000 00000000 c0027568 [ 34.522176] df40: ef027340 c003ef48 ef027300 00000000 ef027340 c003edd4 00000000 00000000 [ 34.530367] df60: 00000000 c003c37c ffffff7f 00000001 00000000 ef027340 00000000 00030003 [ 34.538559] df80: ef05df80 ef05df80 00000000 00000000 ef05df90 ef05df90 ef05dfac ef027300 [ 34.546750] dfa0: c003c2a4 00000000 00000000 c000f578 00000000 00000000 00000000 00000000 [ 34.554939] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 34.563129] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff dfff7fff [ 34.571360] [<c03bb640>] (__dev_kfree_skb_irq) from [<c028fd94>] (arc_emac_poll+0x130/0x474) [ 34.579840] [<c028fd94>] (arc_emac_poll) from [<c03bdeac>] (net_rx_action+0xdc/0x28c) [ 34.587712] [<c03bdeac>] (net_rx_action) from [<c0027410>] (__do_softirq+0xcc/0x1f8) [ 34.595482] [<c0027410>] (__do_softirq) from [<c0027568>] (run_ksoftirqd+0x2c/0x50) [ 34.603168] [<c0027568>] (run_ksoftirqd) from [<c003ef48>] (smpboot_thread_fn+0x174/0x18c) [ 34.611466] [<c003ef48>] (smpboot_thread_fn) from [<c003c37c>] (kthread+0xd8/0xec) [ 34.619075] [<c003c37c>] (kthread) from [<c000f578>] (ret_from_fork+0x14/0x3c) [ 34.626317] Code: e8bd8010 e3a00000 e12fff1e e92d4010 (e59030a4) [ 34.632572] ---[ end trace cca5a3d86a82249a ]---
--- drivers/net/ethernet/arc/emac_main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/arc/emac_main.c +7 -2
@@ -150,7 +150,7 @@ static void arc_emac_tx_clean(struct netstruct sk_buff *skb = tx_buff->skb;unsigned int info =le32_to_cpu (txbd->info); -if ((info &FOR_EMAC ) || !txbd->data) +if ((info &FOR_EMAC ) || !txbd->data || !skb)break ;if (unlikely (info & (DROP |DEFR |LTCL |UFLO ))) {
@@ -178,6 +178,7 @@ static void arc_emac_tx_clean(struct net txbd->data =0 ; txbd->info =0 ; + tx_buff->skb =NULL ; *txbd_dirty = (*txbd_dirty +1 ) %TX_BD_NUM ;
@@ -594,7 +595,6 @@ static int arc_emac_tx(struct sk_buff *sdma_unmap_addr_set (&priv->tx_buff[*txbd_curr], addr, addr);dma_unmap_len_set (&priv->tx_buff[*txbd_curr], len, len); - priv->tx_buff[*txbd_curr].skb = skb; priv->txbd[*txbd_curr].data =cpu_to_le32 (addr);/* Make sure pointer to data buffer is set */
@@ -604,6 +604,11 @@ static int arc_emac_tx(struct sk_buff *s *info =cpu_to_le32 (FOR_EMAC |FIRST_OR_LAST_MASK | len); +/* Make sure info word is set */ +wmb (); + + priv->tx_buff[*txbd_curr].skb = skb; +/* Increment index to point to the next BD */ *txbd_curr = (*txbd_curr +1 ) %TX_BD_NUM ;
PATCH 105/132 xfs: clear sb->s_fs_info on mount failure
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit c9fbd7bbc23dbdd73364be4d045e5d3612cf6e82 upstream.
We recently had an oops reported on a 4.14 kernel in xfs_reclaim_inodes_count() where sb->s_fs_info pointed to garbage and so the m_perag_tree lookup walked into lala land.
Essentially, the machine was under memory pressure when the mount was being run, xfs_fs_fill_super() failed after allocating the xfs_mount and attaching it to sb->s_fs_info. It then cleaned up and freed the xfs_mount, but the sb->s_fs_info field still pointed to the freed memory. Hence when the superblock shrinker then ran it fell off the bad pointer.
With the superblock shrinker problem fixed at teh VFS level, this stale s_fs_info pointer is still a problem - we use it unconditionally in ->put_super when the superblock is being torn down, and hence we can still trip over it after a ->fill_super call failure. Hence we need to clear s_fs_info if xfs-fs_fill_super() fails, and we need to check if it's valid in the places it can potentially be dereferenced after a ->fill_super failure.
--- fs/xfs/xfs_super.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/xfs/xfs_super.c +10 -0
@@ -1038,6 +1038,10 @@ xfs_fs_put_super( {struct xfs_mount *mp =XFS_M (sb); +/* if ->fill_super failed, we have no mount to tear down */ +if (!sb->s_fs_info) +return ; +xfs_filestream_unmount (mp);xfs_unmountfs (mp);
@@ -1045,6 +1049,8 @@ xfs_fs_put_super(xfs_icsb_destroy_counters (mp);xfs_destroy_mount_workqueues (mp);xfs_close_devices (mp); + + sb->s_fs_info =NULL ;xfs_free_fsname (mp);kfree (mp); }
@@ -1514,6 +1520,7 @@ out_destroy_workqueues: out_close_devices:xfs_close_devices (mp); out_free_fsname: + sb->s_fs_info =NULL ;xfs_free_fsname (mp);kfree (mp); out:
@@ -1540,6 +1547,9 @@ xfs_fs_nr_cached_objects( struct super_block *sb, int nid) { +/* Paranoia: catch incorrect calls during mount setup or teardown */ +if (WARN_ON_ONCE (!sb->s_fs_info)) +return 0 ;return xfs_reclaim_inodes_count (XFS_M (sb)); }
PATCH 106/132 rsi: add fix for crash during assertions
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sanjay Konduri <[email protected]>
commit abd39c6ded9db53aa44c2540092bdd5fb6590fa8 upstream.
Observed crash in some scenarios when assertion has occurred, this is because hw structure is freed and is tried to get accessed in some functions where null check is already present. So, avoided the crash by making the hw to NULL after freeing.
--- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rsi/rsi_91x_mac80211.c +1 -0
@@ -199,6 +199,7 @@ void rsi_mac80211_detach(struct rsi_hw *ieee80211_stop_queues (hw);ieee80211_unregister_hw (hw);ieee80211_free_hw (hw); + adapter->hw =NULL ; }rsi_remove_dbgfs (adapter);
PATCH 107/132 mac80211: add API to request TDLS operation from userspace
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arik Nemtsov <[email protected]>
commit c887f0d3a03283cb6fe2c32aae62229bebd3fa32 upstream.
Write a mac80211 to the cfg80211 API for requesting a userspace TDLS operation. Define TDLS specific reason codes that can be used here.
--- include/linux/ieee80211.h | 3 +++ include/net/mac80211.h | 13 +++++++++++++ net/mac80211/tdls.c | 17 +++++++++++++++++ 3 files changed, 33 insertions(+)
include/linux/ieee80211.h +3 -0
@@ -1621,6 +1621,9 @@ enum ieee80211_reasoncode {WLAN_REASON_INVALID_RSN_IE_CAP =22 ,WLAN_REASON_IEEE8021X_FAILED =23 ,WLAN_REASON_CIPHER_SUITE_REJECTED =24 , +/* TDLS (802.11z) */ +WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE =25 , +WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED =26 ,/* 802.11e */ WLAN_REASON_DISASSOC_UNSPECIFIED_QOS =32 , WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
include/net/mac80211.h +13 -0
@@ -4815,4 +4815,17 @@ int ieee80211_parse_p2p_noa(const struct*/ void ieee80211_update_p2p_noa (struct ieee80211_noa_data *data,u32 tsf); +/** +* ieee80211_tdls_oper - request userspace to perform a TDLS operation +* @vif: virtual interface +* @peer: the peer's destination address +* @oper: the requested TDLS operation +* @reason_code: reason code for the operation, valid for TDLS teardown +* @gfp: allocation flags +* +* See cfg80211_tdls_oper_request(). +*/ +void ieee80211_tdls_oper_request (struct ieee80211_vif *vif,const u8 *peer, +enum nl80211_tdls_operation oper, +u16 reason_code,gfp_t gfp);#endif /* MAC80211_H */
net/mac80211/tdls.c +17 -0
@@ -8,6 +8,7 @@*/ #include <linux/ieee80211.h> +#include <net/cfg80211.h> #include "ieee80211_i.h" static void ieee80211_tdls_add_ext_capab (struct sk_buff *skb)
@@ -323,3 +324,19 @@ int ieee80211_tdls_oper(struct wiphy *wireturn 0 ; } + +void ieee80211_tdls_oper_request (struct ieee80211_vif *vif,const u8 *peer, +enum nl80211_tdls_operation oper, +u16 reason_code,gfp_t gfp) +{ +struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); + +if (vif->type !=NL80211_IFTYPE_STATION || !vif->bss_conf.assoc) { +sdata_err (sdata,"Discarding TDLS oper %d - not STA or disconnected\n" , + oper); +return ; + } + +cfg80211_tdls_oper_request (sdata->dev, peer, oper, reason_code, gfp); +} +EXPORT_SYMBOL (ieee80211_tdls_oper_request);
PATCH 108/132 mac80211: drop robust management frames from unknown TA
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 588f7d39b3592a36fb7702ae3b8bdd9be4621e2f upstream.
When receiving a robust management frame, drop it if we don't have rx->sta since then we don't have a security association and thus couldn't possibly validate the frame.
--- net/mac80211/rx.c | 2 ++ 1 file changed, 2 insertions(+)
net/mac80211/rx.c +2 -0
@@ -3084,6 +3084,8 @@ static bool prepare_for_handlers(structcase NL80211_IFTYPE_STATION :if (!bssid && !sdata->u.mgd.use_4addr)return false; +if (ieee80211_is_robust_mgmt_frame (skb) && !rx->sta) +return false;if (!multicast && !ether_addr_equal (sdata->vif.addr, hdr->addr1)) { if (!(sdata->dev->flags & IFF_PROMISC) ||
PATCH 109/132 mac80211: handle deauthentication/disassociation from TDLS peer
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yu Wang <[email protected]>
commit 79c92ca42b5a3e0ea172ea2ce8df8e125af237da upstream.
When receiving a deauthentication/disassociation frame from a TDLS peer, a station should not disconnect the current AP, but only disable the current TDLS link if it's enabled.
Without this change, a TDLS issue can be reproduced by following the steps as below:
1. STA-1 and STA-2 are connected to AP, bidirection traffic is running between STA-1 and STA-2.
2. Set up TDLS link between STA-1 and STA-2, stay for a while, then teardown TDLS link.
3. Repeat step #2 and monitor the connection between STA and AP.
During the test, one STA may send a deauthentication/disassociation frame to another, after TDLS teardown, with reason code 6/7, which
means: Class 2/3 frame received from nonassociated STA.
On receive this frame, the receiver STA will disconnect the current AP and then reconnect. It's not a expected behavior, purpose of this frame should be disabling the TDLS link, not the link with AP.
[bwh: Backported to 3.16:
- Initialise reason_code earlier in ieee80211_rx_mgmt_deauth()
- Adjust context]
---
net/mac80211/ieee80211_i.h +3 -0
@@ -1858,6 +1858,9 @@ int ieee80211_tdls_mgmt(struct wiphy *wi const u8 *extra_ies, size_t extra_ies_len);int ieee80211_tdls_oper (struct wiphy *wiphy,struct net_device *dev,const u8 *peer,enum nl80211_tdls_operation oper); +void ieee80211_tdls_handle_disconnect (struct ieee80211_sub_if_data *sdata, +const u8 *peer,u16 reason); +const char *ieee80211_get_reason_code_string (u16 reason_code);#ifdef CONFIG_MAC80211_NOINLINE
net/mac80211/mlme.c +12 -4
@@ -2298,7 +2298,7 @@ static void ieee80211_rx_mgmt_auth(struc#define case_WLAN (type) \ case WLAN_REASON_##type: return #type -static const char *ieee80211_get_reason_code_string (u16 reason_code) +const char *ieee80211_get_reason_code_string (u16 reason_code) {switch (reason_code) {case_WLAN (UNSPECIFIED );
@@ -2357,21 +2357,24 @@ static void ieee80211_rx_mgmt_deauth(str {struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;const u8 *bssid =NULL ; -u16 reason_code; +u16 reason_code =le16_to_cpu (mgmt->u.deauth.reason_code);sdata_assert_lock (sdata);if (len <24 +2 )return ; +if (!ether_addr_equal (mgmt->bssid, mgmt->sa)) { +ieee80211_tdls_handle_disconnect (sdata, mgmt->sa, reason_code); +return ; + } +if (!ifmgd->associated || !ether_addr_equal (mgmt->bssid, ifmgd->associated->bssid))return ; bssid = ifmgd->associated->bssid; - reason_code =le16_to_cpu (mgmt->u.deauth.reason_code); -sdata_info (sdata,"deauthenticated from %pM (Reason: %u=%s)\n" , bssid, reason_code,ieee80211_get_reason_code_string (reason_code));
@@ -2398,6 +2401,11 @@ static void ieee80211_rx_mgmt_disassoc(s reason_code =le16_to_cpu (mgmt->u.disassoc.reason_code); +if (!ether_addr_equal (mgmt->bssid, mgmt->sa)) { +ieee80211_tdls_handle_disconnect (sdata, mgmt->sa, reason_code); +return ; + } +sdata_info (sdata,"disassociated from %pM (Reason: %u)\n" , mgmt->sa, reason_code);
net/mac80211/tdls.c +23 -0
@@ -340,3 +340,26 @@ void ieee80211_tdls_oper_request(structcfg80211_tdls_oper_request (sdata->dev, peer, oper, reason_code, gfp); }EXPORT_SYMBOL (ieee80211_tdls_oper_request); + +void ieee80211_tdls_handle_disconnect (struct ieee80211_sub_if_data *sdata, +const u8 *peer,u16 reason) +{ +struct ieee80211_sta *sta; + +rcu_read_lock (); + sta =ieee80211_find_sta (&sdata->vif, peer); +if (!sta || !sta->tdls) { +rcu_read_unlock (); +return ; + } +rcu_read_unlock (); + +tdls_dbg (sdata,"disconnected from TDLS peer %pM (Reason: %u=%s)\n" , + peer, reason, +ieee80211_get_reason_code_string (reason)); + +ieee80211_tdls_oper_request (&sdata->vif, peer, +NL80211_TDLS_TEARDOWN , +WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE , +GFP_ATOMIC ); +}
PATCH 110/132 mwifiex: vendor_ie length check for parse WMM IEs
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Karthik D A <[email protected]>
commit 113630b581d6d423998d2113a8e892ed6e6af6f9 upstream.
While copying the vendor_ie obtained from the cfg80211_find_vendor_ie() to the struct mwifiex_types_wmm_info, length/size was inappropriate. This patch corrects the required length needed to the mwifiex_types_wmm_info
--- drivers/net/wireless/mwifiex/uap_cmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/mwifiex/uap_cmd.c +4 -4
@@ -364,7 +364,7 @@ mwifiex_set_wmm_params(struct mwifiex_pr struct cfg80211_ap_settings *params) {const u8 *vendor_ie; -struct ieee_types_header *wmm_ie; +const u8 *wmm_ie;u8 wmm_oui[] = {0x00 ,0x50 ,0xf2 ,0x02 }; vendor_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT,
@@ -372,9 +372,9 @@ mwifiex_set_wmm_params(struct mwifiex_pr params->beacon.tail, params->beacon.tail_len);if (vendor_ie) { - wmm_ie = (struct ieee_types_header *)vendor_ie; -memcpy (&bss_cfg->wmm_info, wmm_ie +1 , -sizeof (bss_cfg->wmm_info)); + wmm_ie = vendor_ie; +memcpy (&bss_cfg->wmm_info, wmm_ie + +sizeof (struct ieee_types_header ), *(wmm_ie +1 )); priv->wmm_enabled =1 ; }else {memset (&bss_cfg->wmm_info,0 ,sizeof (bss_cfg->wmm_info));
PATCH 111/132 mwifiex: Fix three heap overflow at parsing element in cfg80211_ap_settings
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wen Huang <[email protected]>
commit 7caac62ed598a196d6ddf8d9c121e12e082cac3a upstream.
mwifiex_update_vs_ie(),mwifiex_set_uap_rates() and mwifiex_set_wmm_params() call memcpy() without checking the destination size.Since the source is given from user-space, this may trigger a heap buffer overflow.
Fix them by putting the length check before performing memcpy().
This fix addresses CVE-2019-14814,CVE-2019-14815,CVE-2019-14816.
--- drivers/net/wireless/mwifiex/ie.c | 3 +++ drivers/net/wireless/mwifiex/uap_cmd.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/mwifiex/ie.c +3 -0
@@ -240,6 +240,9 @@ static int mwifiex_update_vs_ie(const u8 } vs_ie = (struct ieee_types_header *)vendor_ie; +if (le16_to_cpu (ie->ie_length) + vs_ie->len +2 > +IEEE_MAX_IE_SIZE ) +return -EINVAL ;memcpy (ie->ie_buffer +le16_to_cpu (ie->ie_length), vs_ie, vs_ie->len +2 );le16_add_cpu (&ie->ie_length, vs_ie->len +2 );
drivers/net/wireless/mwifiex/uap_cmd.c +8 -1
@@ -247,6 +247,8 @@ mwifiex_set_uap_rates(struct mwifiex_uap rate_ie = (void *)cfg80211_find_ie (WLAN_EID_SUPP_RATES , var_pos, len);if (rate_ie) { +if (rate_ie->len >MWIFIEX_SUPPORTED_RATES ) +return ;memcpy (bss_cfg->rates, rate_ie +1 , rate_ie->len); rate_len = rate_ie->len; }
@@ -254,8 +256,11 @@ mwifiex_set_uap_rates(struct mwifiex_uap rate_ie = (void *)cfg80211_find_ie (WLAN_EID_EXT_SUPP_RATES , params->beacon.tail, params->beacon.tail_len); -if (rate_ie) +if (rate_ie) { +if (rate_ie->len >MWIFIEX_SUPPORTED_RATES - rate_len) +return ;memcpy (bss_cfg->rates + rate_len, rate_ie +1 , rate_ie->len); + }return ; }
@@ -373,6 +378,8 @@ mwifiex_set_wmm_params(struct mwifiex_pr params->beacon.tail_len);if (vendor_ie) { wmm_ie = vendor_ie; +if (*(wmm_ie +1 ) >sizeof (struct mwifiex_types_wmm_info )) +return ;memcpy (&bss_cfg->wmm_info, wmm_ie +sizeof (struct ieee_types_header ), *(wmm_ie +1 )); priv->wmm_enabled =1 ;
PATCH 112/132 vhost: make sure log_num < in_num
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: yongduan <[email protected]>
commit 060423bfdee3f8bc6e2c1bac97de24d5415e2bc4 upstream.
The code assumes log_num < in_num everywhere, and that is true as long as in_num is incremented by descriptor iov count, and log_num by 1. However this breaks if there's a zero sized descriptor.
As a result, if a malicious guest creates a vring desc with desc.len = 0, it may cause the host kernel to crash by overflowing the log array. This bug can be triggered during the VM migration.
There's no need to log when desc.len = 0, so just don't increment log_num in this case.
--- drivers/vhost/vhost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vhost/vhost.c +2 -2
@@ -1194,7 +1194,7 @@ static int get_indirect(struct vhost_vir/* If this is an input descriptor, increment that count. */ if (desc.flags &VRING_DESC_F_WRITE ) { *in_num += ret; -if (unlikely (log)) { +if (unlikely (log && ret)) { log[*log_num].addr = desc.addr; log[*log_num].len = desc.len; ++*log_num;
@@ -1317,7 +1317,7 @@ int vhost_get_vq_desc(struct vhost_virtq/* If this is an input descriptor, * increment that count. */ *in_num += ret; -if (unlikely (log)) { +if (unlikely (log && ret)) { log[*log_num].addr = desc.addr; log[*log_num].len = desc.len; ++*log_num;
PATCH 113/132 ALSA: usb-audio: Fix an OOB bug in parse_audio_mixer_unit
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hui Peng <[email protected]>
commit daac07156b330b18eb5071aec4b3ddca1c377f2c upstream.
The uac_mixer_unit_descriptor shown as below is read from the device side. In parse_audio_mixer_unit, baSourceID field is accessed from index 0 to bNrInPins - 1, the current implementation assumes that descriptor is always valid (the length of descriptor is no shorter than 5 + bNrInPins). If a descriptor read from the device side is invalid, it may trigger out-of-bound memory access.
```
struct uac_mixer_unit_descriptor {
__u8 bLength;
__u8 bDescriptorType;
__u8 bDescriptorSubtype;
__u8 bUnitID;
__u8 bNrInPins;
__u8 baSourceID[];
}
```This patch fixes the bug by add a sanity check on the length of the descriptor.
--- sound/usb/mixer.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/mixer.c +1 -0
@@ -1594,6 +1594,7 @@ static int parse_audio_mixer_unit(structint pin, ich, err;if (desc->bLength <11 || !(input_pins = desc->bNrInPins) || + desc->bLength <sizeof (*desc) + desc->bNrInPins || !(num_outs =uac_mixer_unit_bNrChannels (desc))) { usb_audio_err(state->chip, "invalid MIXER UNIT descriptor %d\n",
PATCH 114/132 ALSA: usb-audio: Fix a stack buffer overflow bug in check_input_term
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hui Peng <[email protected]>
commit 19bce474c45be69a284ecee660aa12d8f1e88f18 upstream.
check_input_term recursively calls itself with input from device side (e.g., uac_input_terminal_descriptor.bCSourceID) as argument (id). In check_input_term, if check_input_term is called with the same id argument as the caller, it triggers endless recursive call, resulting kernel space stack overflow.
This patch fixes the bug by adding a bitmap to struct mixer_build to keep track of the checked ids and stop the execution if some id has been checked (similar to how parse_audio_unit handles unitid argument).
--- sound/usb/mixer.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
sound/usb/mixer.c +24 -5
@@ -81,6 +81,7 @@ struct mixer_build {unsigned char *buffer;unsigned int buflen;DECLARE_BITMAP (unitbitmap,MAX_ID_ELEMS ); +DECLARE_BITMAP (termbitmap,MAX_ID_ELEMS );struct usb_audio_term oterm;const struct usbmix_name_map *map;const struct usbmix_selector_map *selector_map;
@@ -685,15 +686,24 @@ static int get_term_name(struct mixer_bu* parse the source unit recursively until it reaches to a terminal * or a branched unit. */ -static int check_input_term (struct mixer_build *state,int id, +static int __check_input_term (struct mixer_build *state,int id,struct usb_audio_term *term) {int err;void *p1; +unsigned char *hdr;memset (term,0 ,sizeof (*term)); -while ((p1 =find_audio_control_unit (state, id)) !=NULL ) { -unsigned char *hdr = p1; +for (;;) { +/* a loop in the terminal chain? */ +if (test_and_set_bit (id, state->termbitmap)) +return -EINVAL ; + + p1 =find_audio_control_unit (state, id); +if (!p1) +break ; + + hdr = p1; term->id = id;switch (hdr[2 ]) {case UAC_INPUT_TERMINAL :
@@ -711,7 +721,7 @@ static int check_input_term(struct mixer term->name = d->iTerminal;/* call recursively to get the clock selectors */ - err =check_input_term (state, d->bCSourceID, term); + err =__check_input_term (state, d->bCSourceID, term);if (err <0 )return err; }
@@ -734,7 +744,7 @@ static int check_input_term(struct mixercase UAC2_CLOCK_SELECTOR : {struct uac_selector_unit_descriptor *d = p1;/* call recursively to retrieve the channel info */ - err =check_input_term (state, d->baSourceID[0 ], term); + err =__check_input_term (state, d->baSourceID[0 ], term);if (err <0 )return err; term->type = d->bDescriptorSubtype <<16 ;/* virtual type */
@@ -781,6 +791,15 @@ static int check_input_term(struct mixerreturn -ENODEV ; } + +static int check_input_term (struct mixer_build *state,int id, +struct usb_audio_term *term) +{ +memset (term,0 ,sizeof (*term)); +memset (state->termbitmap,0 ,sizeof (state->termbitmap)); +return __check_input_term (state, id, term); +} +/* * Feature Unit */
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 3.16 114/132] ALSA: usb-audio: Fix a stack buffer overflow bug in check_input_term
Quoted 5 lines · Hui Peng
I want to confirm the patches.
Which version of GCC do you use to compile 3.16?
I tried gcc-4.8, it seems that the built kernel can not be boot by qemu.
[...]
For my own limited testing, I build for x86 with gcc 4.9. Debian's packages are built with gcc 4.8 (arm) or 4.9 (x86).
Guenter Roeck does build and boot tests on multiple architectures using a variety of (mostly quite recent) compiler versions.
Ben.
Signature · 2 lines
Ben Hutchings If the facts do not conform to your theory, they must be disposed of.
PATCH 115/132 media: radio-raremono: change devm_k*alloc to k*alloc
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Luke Nowakowski-Krijger <[email protected]>
commit c666355e60ddb4748ead3bdd983e3f7f2224aaf0 upstream.
Change devm_k*alloc to k*alloc to manually allocate memory
The manual allocation and freeing of memory is necessary because when the USB radio is disconnected, the memory associated with devm_k*alloc is freed. Meaning if we still have unresolved references to the radio device, then we get use-after-free errors.
This patch fixes this by manually allocating memory, and freeing it in the v4l2.release callback that gets called when the last radio device exits.
--- drivers/media/radio/radio-raremono.c | 30 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
drivers/media/radio/radio-raremono.c +23 -7
@@ -283,6 +283,14 @@ static int vidioc_g_frequency(struct filreturn 0 ; } +static void raremono_device_release (struct v4l2_device *v4l2_dev) +{ +struct raremono_device *radio =to_raremono_dev (v4l2_dev); + +kfree (radio->buffer); +kfree (radio); +} +/* File system interface */ static const struct v4l2_file_operations usb_raremono_fops = { .owner =THIS_MODULE ,
@@ -307,12 +315,14 @@ static int usb_raremono_probe(struct usbstruct raremono_device *radio;int retval =0 ; - radio =devm_kzalloc (&intf->dev,sizeof (struct raremono_device ),GFP_KERNEL ); -if (radio) - radio->buffer =devm_kmalloc (&intf->dev,BUFFER_LENGTH ,GFP_KERNEL ); - -if (!radio || !radio->buffer) + radio =kzalloc (sizeof (*radio),GFP_KERNEL ); +if (!radio) +return -ENOMEM ; + radio->buffer =kmalloc (BUFFER_LENGTH ,GFP_KERNEL ); +if (!radio->buffer) { +kfree (radio);return -ENOMEM ; + } radio->usbdev =interface_to_usbdev (intf); radio->intf = intf;
@@ -336,7 +346,8 @@ static int usb_raremono_probe(struct usbif (retval !=3 || (get_unaligned_be16 (&radio->buffer[1 ]) &0xfff ) ==0x0242 ) {dev_info (&intf->dev,"this is not Thanko's Raremono.\n" ); -return -ENODEV ; + retval = -ENODEV ; + goto free_mem; } dev_info(&intf->dev, "Thanko's Raremono connected: (%04X:%04X)\n",
@@ -345,7 +356,7 @@ static int usb_raremono_probe(struct usb retval =v4l2_device_register (&intf->dev, &radio->v4l2_dev);if (retval <0 ) {dev_err (&intf->dev,"couldn't register v4l2_device\n" ); -return retval; + goto free_mem; }mutex_init (&radio->lock);
@@ -357,6 +368,7 @@ static int usb_raremono_probe(struct usb radio->vdev.ioctl_ops = &usb_raremono_ioctl_ops; radio->vdev.lock = &radio->lock; radio->vdev.release = video_device_release_empty; + radio->v4l2_dev.release = raremono_device_release;usb_set_intfdata (intf, &radio->v4l2_dev);
@@ -373,6 +385,10 @@ static int usb_raremono_probe(struct usb }dev_err (&intf->dev,"could not register video device\n" );v4l2_device_unregister (&radio->v4l2_dev); + +free_mem: +kfree (radio->buffer); +kfree (radio);return retval; }
PATCH 116/132 USB: rio500: refuse more than one device at a time
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 3864d33943b4a76c6e64616280e98d2410b1190f upstream.
This driver is using a global variable. It cannot handle more than one device at a time. The issue has been existing since the dawn of the driver.
--- drivers/usb/misc/rio500.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/usb/misc/rio500.c +18 -6
@@ -464,15 +464,23 @@ static int probe_rio(struct usb_interfac {struct usb_device *dev =interface_to_usbdev (intf);struct rio_usb_data *rio = &rio_instance; -int retval; +int retval =0 ; -dev_info (&intf->dev,"USB Rio found at address %d\n" , dev->devnum); +mutex_lock (&rio500_mutex); +if (rio->present) { +dev_info (&intf->dev,"Second USB Rio at address %d refused\n" , dev->devnum); + retval = -EBUSY ; + goto bail_out; + }else { +dev_info (&intf->dev,"USB Rio found at address %d\n" , dev->devnum); + } retval =usb_register_dev (intf, &usb_rio_class);if (retval) {dev_err (&dev->dev,"Not able to get a minor for this device.\n" ); -return -ENOMEM ; + retval = -ENOMEM ; + goto bail_out; } rio->rio_dev = dev;
@@ -481,7 +489,8 @@ static int probe_rio(struct usb_interfacdev_err (&dev->dev,"probe_rio: Not enough memory for the output buffer\n" );usb_deregister_dev (intf, &usb_rio_class); -return -ENOMEM ; + retval = -ENOMEM ; + goto bail_out; }dev_dbg (&intf->dev,"obuf address:%p\n" , rio->obuf);
@@ -490,7 +499,8 @@ static int probe_rio(struct usb_interfac "probe_rio: Not enough memory for the input buffer\n");usb_deregister_dev (intf, &usb_rio_class);kfree (rio->obuf); -return -ENOMEM ; + retval = -ENOMEM ; + goto bail_out; }dev_dbg (&intf->dev,"ibuf address:%p\n" , rio->ibuf);
@@ -498,8 +508,10 @@ static int probe_rio(struct usb_interfacusb_set_intfdata (intf, rio); rio->present =1 ; +bail_out: +mutex_unlock (&rio500_mutex); -return 0 ; +return retval; }static void disconnect_rio (struct usb_interface *intf)
PATCH 117/132 media: cpia2_usb: first wake up, then free in disconnect
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit eff73de2b1600ad8230692f00bc0ab49b166512a upstream.
Kasan reported a use after free in cpia2_usb_disconnect() It first freed everything and then woke up those waiting. The reverse order is correct.
--- drivers/media/usb/cpia2/cpia2_usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/cpia2/cpia2_usb.c +2 -1
@@ -884,7 +884,6 @@ static void cpia2_usb_disconnect(structcpia2_unregister_camera (cam);v4l2_device_disconnect (&cam->v4l2_dev);mutex_unlock (&cam->v4l2_lock); -v4l2_device_put (&cam->v4l2_dev);if (cam->buffers) {DBG ("Wakeup waiting processes\n" );
@@ -897,6 +896,8 @@ static void cpia2_usb_disconnect(structDBG ("Releasing interface\n" );usb_driver_release_interface (&cpia2_driver, intf); +v4l2_device_put (&cam->v4l2_dev); +LOG ("CPiA2 camera disconnected.\n" ); }
PATCH 118/132 media: usb: siano: Fix general protection fault in smsusb
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 31e0456de5be379b10fea0fa94a681057114a96e upstream.
The syzkaller USB fuzzer found a general-protection-fault bug in the smsusb part of the Siano DVB driver. The fault occurs during probe because the driver assumes without checking that the device has both IN and OUT endpoints and the IN endpoint is ep1.
By slightly rearranging the driver's initialization code, we can make the appropriate checks early on and thus avoid the problem. If the expected endpoints aren't present, the new code safely returns -ENODEV from the probe routine.
--- drivers/media/usb/siano/smsusb.c | 33 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)
drivers/media/usb/siano/smsusb.c +20 -13
@@ -359,6 +359,7 @@ static int smsusb_init_device(struct usbstruct smsdevice_params_t params;struct smsusb_device_t *dev;int i, rc; +int in_maxp;/* create device object */ dev =kzalloc (sizeof (struct smsusb_device_t ),GFP_KERNEL );
@@ -372,6 +373,24 @@ static int smsusb_init_device(struct usb dev->udev =interface_to_usbdev (intf); dev->state =SMSUSB_DISCONNECTED ; +for (i =0 ; i < intf->cur_altsetting->desc.bNumEndpoints; i++) { +struct usb_endpoint_descriptor *desc = + &intf->cur_altsetting->endpoint[i].desc; + +if (desc->bEndpointAddress &USB_DIR_IN ) { + dev->in_ep = desc->bEndpointAddress; + in_maxp =usb_endpoint_maxp (desc); + }else { + dev->out_ep = desc->bEndpointAddress; + } + } + +pr_debug ("in_ep = %02x, out_ep = %02x\n" , dev->in_ep, dev->out_ep); +if (!dev->in_ep || !dev->out_ep) {/* Missing endpoints? */ +smsusb_term_device (intf); +return -ENODEV ; + } + params.device_type =sms_get_board (board_id)->type;switch (params.device_type) {
@@ -386,24 +405,12 @@ static int smsusb_init_device(struct usb/* fall-thru */ default : dev->buffer_size =USB2_BUFFER_SIZE ; - dev->response_alignment = -le16_to_cpu (dev->udev->ep_in[1 ]->desc.wMaxPacketSize) - -sizeof (struct sms_msg_hdr ); + dev->response_alignment = in_maxp -sizeof (struct sms_msg_hdr ); params.flags |=SMS_DEVICE_FAMILY2 ;break ; } -for (i =0 ; i < intf->cur_altsetting->desc.bNumEndpoints; i++) { -if (intf->cur_altsetting->endpoint[i].desc. bEndpointAddress &USB_DIR_IN ) - dev->in_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress; -else - dev->out_ep = intf->cur_altsetting->endpoint[i].desc.bEndpointAddress; - } - -sms_info ("in_ep = %02x, out_ep = %02x" , - dev->in_ep, dev->out_ep); - params.device = &dev->udev->dev; params.buffer_size = dev->buffer_size; params.num_buffers =MAX_BUFFERS ;
PATCH 119/132 media: usb: siano: Fix false-positive "uninitialized variable" warning
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 45457c01171fd1488a7000d1751c06ed8560ee38 upstream.
GCC complains about an apparently uninitialized variable recently added to smsusb_init_device(). It's a false positive, but to silence the warning this patch adds a trivial initialization.
--- drivers/media/usb/siano/smsusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/siano/smsusb.c +1 -1
@@ -359,7 +359,7 @@ static int smsusb_init_device(struct usbstruct smsdevice_params_t params;struct smsusb_device_t *dev;int i, rc; -int in_maxp; +int in_maxp =0 ;/* create device object */ dev =kzalloc (sizeof (struct smsusb_device_t ),GFP_KERNEL );
PATCH 120/132 media: smsusb: better handle optional alignment
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit a47686636d84eaec5c9c6e84bd5f96bed34d526d upstream.
Most Siano devices require an alignment for the response.
Changeset f3be52b0056a ("media: usb: siano: Fix general protection fault in smsusb") changed the logic with gets such aligment, but it now produces a sparce warning:
drivers/media/usb/siano/smsusb.c: In function 'smsusb_init_device':drivers/media/usb/siano/smsusb.c:447:37: warning: 'in_maxp' may be used uninitialized in this function [-Wmaybe-uninitialized]
447 | dev->response_alignment = in_maxp - sizeof(struct sms_msg_hdr);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~The sparse message itself is bogus, but a broken (or fake) USB eeprom could produce a negative value for response_alignment.
So, change the code in order to check if the result is not negative.
--- drivers/media/usb/siano/smsusb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/usb/siano/smsusb.c +4 -4
@@ -359,7 +359,7 @@ static int smsusb_init_device(struct usbstruct smsdevice_params_t params;struct smsusb_device_t *dev;int i, rc; -int in_maxp =0 ; +int align =0 ;/* create device object */ dev =kzalloc (sizeof (struct smsusb_device_t ),GFP_KERNEL );
@@ -379,14 +379,14 @@ static int smsusb_init_device(struct usbif (desc->bEndpointAddress &USB_DIR_IN ) { dev->in_ep = desc->bEndpointAddress; - in_maxp =usb_endpoint_maxp (desc); + align =usb_endpoint_maxp (desc) -sizeof (struct sms_msg_hdr ); }else { dev->out_ep = desc->bEndpointAddress; } }pr_debug ("in_ep = %02x, out_ep = %02x\n" , dev->in_ep, dev->out_ep); -if (!dev->in_ep || !dev->out_ep) {/* Missing endpoints? */ +if (!dev->in_ep || !dev->out_ep || align <0 ) {/* Missing endpoints? */ smsusb_term_device (intf);return -ENODEV ; }
@@ -405,7 +405,7 @@ static int smsusb_init_device(struct usb/* fall-thru */ default : dev->buffer_size =USB2_BUFFER_SIZE ; - dev->response_alignment = in_maxp -sizeof (struct sms_msg_hdr ); + dev->response_alignment = align; params.flags |=SMS_DEVICE_FAMILY2 ;break ;
PATCH 121/132 USB: sisusbvga: fix oops in error path of sisusb_probe
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit 9a5729f68d3a82786aea110b1bfe610be318f80a upstream.
The pointer used to log a failure of usb_register_dev() must be set before the error is logged.
v2: fix that minor is not available before registration
--- drivers/usb/misc/sisusbvga/sisusb.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/usb/misc/sisusbvga/sisusb.c +8 -7
@@ -3093,6 +3093,13 @@ static int sisusb_probe(struct usb_intermutex_init (&(sisusb->lock)); + sisusb->sisusb_dev = dev; + sisusb->vrambase =SISUSB_PCI_MEMBASE ; + sisusb->mmiobase =SISUSB_PCI_MMIOBASE ; + sisusb->mmiosize =SISUSB_PCI_MMIOSIZE ; + sisusb->ioportbase =SISUSB_PCI_IOPORTBASE ; +/* Everything else is zero */ +/* Register device */ if ((retval =usb_register_dev (intf, &usb_sisusb_class))) { dev_err(&sisusb->sisusb_dev->dev, "Failed to get a minor for device %d\n",
@@ -3101,13 +3108,7 @@ static int sisusb_probe(struct usb_inter goto error_1; } - sisusb->sisusb_dev = dev; - sisusb->minor = intf->minor; - sisusb->vrambase =SISUSB_PCI_MEMBASE ; - sisusb->mmiobase =SISUSB_PCI_MMIOBASE ; - sisusb->mmiosize =SISUSB_PCI_MMIOSIZE ; - sisusb->ioportbase =SISUSB_PCI_IOPORTBASE ; -/* Everything else is zero */ + sisusb->minor = intf->minor;/* Allocate buffers */ sisusb->ibufsize =SISUSB_IBUF_SIZE ;
PATCH 122/132 p54usb: Fix race between disconnect and firmware loading
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 6e41e2257f1094acc37618bf6c856115374c6922 upstream.
The syzbot fuzzer found a bug in the p54 USB wireless driver. The issue involves a race between disconnect and the firmware-loader callback routine, and it has several aspects.
One big problem is that when the firmware can't be loaded, the callback routine tries to unbind the driver from the USB _device_ (by calling device_release_driver) instead of from the USB _interface_ to which it is actually bound (by calling usb_driver_release_interface).
The race involves access to the private data structure. The driver's disconnect handler waits for a completion that is signalled by the firmware-loader callback routine. As soon as the completion is signalled, you have to assume that the private data structure may have been deallocated by the disconnect handler -- even if the firmware was loaded without errors. However, the callback routine does access the private data several times after that point.
Another problem is that, in order to ensure that the USB device structure hasn't been freed when the callback routine runs, the driver takes a reference to it. This isn't good enough any more, because now that the callback routine calls usb_driver_release_interface, it has to ensure that the interface structure hasn't been freed.
Finally, the driver takes an unnecessary reference to the USB device structure in the probe function and drops the reference in the disconnect handler. This extra reference doesn't accomplish anything, because the USB core already guarantees that a device structure won't be deallocated while a driver is still bound to any of its interfaces.
To fix these problems, this patch makes the following changes:
Call usb_driver_release_interface() rather than device_release_driver().
Don't signal the completion until after the important information has been copied out of the private data structure, and don't refer to the private data at all thereafter.
Lock udev (the interface's parent) before unbinding the driver instead of locking udev->parent.
During the firmware loading process, take a reference to the USB interface instead of the USB device.
Don't take an unnecessary reference to the device during probe (and then don't drop it during disconnect).
--- drivers/net/wireless/p54/p54usb.c | 43 +++++++++------------- 1 file changed, 18 insertions(+), 25 deletions(-)
drivers/net/wireless/p54/p54usb.c +18 -25
@@ -33,6 +33,8 @@ MODULE_ALIAS("prism54usb");MODULE_FIRMWARE ("isl3886usb" );MODULE_FIRMWARE ("isl3887usb" ); +static struct usb_driver p54u_driver; +/* * Note: *
@@ -921,9 +923,9 @@ static void p54u_load_firmware_cb(const {struct p54u_priv *priv = context;struct usb_device *udev = priv->udev; +struct usb_interface *intf = priv->intf;int err; -complete (&priv->fw_wait_load);if (firmware) { priv->fw = firmware; err =p54u_start_ops (priv);
@@ -932,26 +934,22 @@ static void p54u_load_firmware_cb(constdev_err (&udev->dev,"Firmware not found.\n" ); } -if (err) { -struct device *parent = priv->udev->dev.parent; - -dev_err (&udev->dev,"failed to initialize device (%d)\n" , err); - -if (parent) -device_lock (parent); +complete (&priv->fw_wait_load); +/* +* At this point p54u_disconnect may have already freed +* the "priv" context. Do not use it anymore! +*/ + priv =NULL ; -device_release_driver (&udev->dev); -/* -* At this point p54u_disconnect has already freed -* the "priv" context. Do not use it anymore! -*/ - priv =NULL ; +if (err) { +dev_err (&intf->dev,"failed to initialize device (%d)\n" , err); -if (parent) -device_unlock (parent); +usb_lock_device (udev); +usb_driver_release_interface (&p54u_driver, intf); +usb_unlock_device (udev); } -usb_put_dev (udev); +usb_put_intf (intf); } static int p54u_load_firmware(struct ieee80211_hw *dev,
@@ -972,14 +970,14 @@ static int p54u_load_firmware(struct ieedev_info (&priv->udev->dev,"Loading firmware file %s\n" , p54u_fwlist[i].fw); -usb_get_dev (udev); +usb_get_intf (intf); err =request_firmware_nowait (THIS_MODULE ,1 , p54u_fwlist[i].fw, device,GFP_KERNEL , priv, p54u_load_firmware_cb);if (err) {dev_err (&priv->udev->dev,"(p54usb) cannot load firmware %s " "(%d)!\n" , p54u_fwlist[i].fw, err); -usb_put_dev (udev); +usb_put_intf (intf); }return err;
@@ -1011,8 +1009,6 @@ static int p54u_probe(struct usb_interfaskb_queue_head_init (&priv->rx_queue);init_usb_anchor (&priv->submitted); -usb_get_dev (udev); -/* really lazy and simple way of figuring out if we're a 3887 */ /* TODO: should just stick the identification in the device table */ i = intf->altsetting->desc.bNumEndpoints;
@@ -1053,10 +1049,8 @@ static int p54u_probe(struct usb_interfa priv->upload_fw = p54u_upload_firmware_net2280; } err =p54u_load_firmware (dev, intf); -if (err) { -usb_put_dev (udev); +if (err)p54_free_common (dev); - }return err; }
@@ -1072,7 +1066,6 @@ static void p54u_disconnect(struct usb_iwait_for_completion (&priv->fw_wait_load);p54_unregister_common (dev); -usb_put_dev (interface_to_usbdev (intf));release_firmware (priv->fw);p54_free_common (dev); }
PATCH 123/132 ALSA: line6: Fix write on zero-sized buffer
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3450121997ce872eb7f1248417225827ea249710 upstream.
LINE6 drivers allocate the buffers based on the value returned from usb_maxpacket() calls. The manipulated device may return zero for this, and this results in the kmalloc() with zero size (and it may succeed) while the other part of the driver code writes the packet data with the fixed size -- which eventually overwrites.
This patch adds a simple sanity check for the invalid buffer size for avoiding that problem.
[bwh: Backported to 3.16:
- Driver doesn't support asymmetrical packet sizes, so only check snd_line6_pcm::max_packet_size
- Adjust filename]
--- drivers/staging/line6/pcm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/line6/pcm.c +5 -0
@@ -492,6 +492,11 @@ int line6_init_pcm(struct usb_line6 *lin usb_rcvisocpipe(line6->usbdev, ep_read), 0),usb_maxpacket (line6->usbdev, usb_sndisocpipe(line6->usbdev, ep_write), 1)); +if (!line6pcm->max_packet_size) { +dev_err (line6pcm->line6->ifcdev, +"cannot get proper max packet size\n" ); +return -EINVAL ; + } line6pcm->properties = properties; line6->line6pcm = line6pcm;
PATCH 124/132 appletalk: Fix use-after-free in atalk_proc_exit
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: YueHaibing <[email protected]>
commit 6377f787aeb945cae7abbb6474798de129e1f3ac upstream.
KASAN report this:
BUG: KASAN: use-after-free in pde_subdir_find+0x12d/0x150 fs/proc/generic.c:71
Read of size 8 at addr ffff8881f41fe5b0 by task syz-executor.0/2806
CPU: 0 PID: 2806 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xfa/0x1ce lib/dump_stack.c:113
print_address_description+0x65/0x270 mm/kasan/report.c:187
kasan_report+0x149/0x18d mm/kasan/report.c:317
pde_subdir_find+0x12d/0x150 fs/proc/generic.c:71
remove_proc_entry+0xe8/0x420 fs/proc/generic.c:667
atalk_proc_exit+0x18/0x820 [appletalk]
atalk_exit+0xf/0x5a [appletalk]
__do_sys_delete_module kernel/module.c:1018 [inline]
__se_sys_delete_module kernel/module.c:961 [inline]
__x64_sys_delete_module+0x3dc/0x5e0 kernel/module.c:961
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x462e99
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fb2de6b9c58 EFLAGS: 00000246 ORIG_RAX: 00000000000000b0
RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200001c0
RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb2de6ba6bc
R13: 00000000004bccaa R14: 00000000006f6bc8 R15: 00000000ffffffff
Allocated by task 2806:
set_track mm/kasan/common.c:85 [inline]
__kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:496
slab_post_alloc_hook mm/slab.h:444 [inline]
slab_alloc_node mm/slub.c:2739 [inline]
slab_alloc mm/slub.c:2747 [inline]
kmem_cache_alloc+0xcf/0x250 mm/slub.c:2752
kmem_cache_zalloc include/linux/slab.h:730 [inline]
__proc_create+0x30f/0xa20 fs/proc/generic.c:408
proc_mkdir_data+0x47/0x190 fs/proc/generic.c:469
0xffffffffc10c01bb
0xffffffffc10c0166
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 2806:
set_track mm/kasan/common.c:85 [inline]
__kasan_slab_free+0x130/0x180 mm/kasan/common.c:458
slab_free_hook mm/slub.c:1409 [inline]
slab_free_freelist_hook mm/slub.c:1436 [inline]
slab_free mm/slub.c:2986 [inline]
kmem_cache_free+0xa6/0x2a0 mm/slub.c:3002
pde_put+0x6e/0x80 fs/proc/generic.c:647
remove_proc_entry+0x1d3/0x420 fs/proc/generic.c:684
0xffffffffc10c031c
0xffffffffc10c0166
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
The buggy address belongs to the object at ffff8881f41fe500
which belongs to the cache proc_dir_entry of size 256
The buggy address is located 176 bytes inside of
256-byte region [ffff8881f41fe500, ffff8881f41fe600)
The buggy address belongs to the page:
page:ffffea0007d07f80 count:1 mapcount:0 mapping:ffff8881f6e69a00 index:0x0
flags: 0x2fffc0000000200(slab)
raw: 02fffc0000000200 dead000000000100 dead000000000200 ffff8881f6e69a00
raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8881f41fe480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8881f41fe500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881f41fe580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881f41fe600: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8881f41fe680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fbIt should check the return value of atalk_proc_init fails, otherwise atalk_exit will trgger use-after-free in pde_subdir_find while unload the module.This patch fix error cleanup path of atalk_init
--- include/linux/atalk.h | 2 +- net/appletalk/atalk_proc.c | 2 +- net/appletalk/ddp.c | 37 ++++++++++++++++++++++++++------ net/appletalk/sysctl_net_atalk.c | 5 ++++- 4 files changed, 37 insertions(+), 9 deletions(-)
include/linux/atalk.h +1 -1
@@ -150,7 +150,7 @@ extern int sysctl_aarp_retransmit_limit;extern int sysctl_aarp_resolve_time;#ifdef CONFIG_SYSCTL -extern void atalk_register_sysctl (void ); +extern int atalk_register_sysctl (void );extern void atalk_unregister_sysctl (void );#else #define atalk_register_sysctl () do { } while(0)
net/appletalk/atalk_proc.c +1 -1
@@ -293,7 +293,7 @@ out_interface: goto out; } -void __exit atalk_proc_exit(void) +void atalk_proc_exit (void ) {remove_proc_entry ("interface" , atalk_proc_dir);remove_proc_entry ("route" , atalk_proc_dir);
net/appletalk/ddp.c +31 -6
@@ -1913,12 +1913,16 @@ static const char atalk_err_snap[] __ini/* Called by proto.c on kernel start up */ static int __init atalk_init (void ) { -int rc =proto_register (&ddp_proto,0 ); +int rc; -if (rc !=0 ) + rc =proto_register (&ddp_proto,0 ); +if (rc) goto out; - (void )sock_register (&atalk_family_ops); + rc =sock_register (&atalk_family_ops); +if (rc) + goto out_proto; + ddp_dl =register_snap_client (ddp_snap_id, atalk_rcv);if (!ddp_dl)printk (atalk_err_snap);
@@ -1926,12 +1930,33 @@ static int __init atalk_init(void)dev_add_pack (<alk_packet_type);dev_add_pack (&ppptalk_packet_type); -register_netdevice_notifier (&ddp_notifier); + rc =register_netdevice_notifier (&ddp_notifier); +if (rc) + goto out_sock; +aarp_proto_init (); -atalk_proc_init (); -atalk_register_sysctl (); + rc =atalk_proc_init (); +if (rc) + goto out_aarp; + + rc =atalk_register_sysctl (); +if (rc) + goto out_proc; out:return rc; +out_proc: +atalk_proc_exit (); +out_aarp: +aarp_cleanup_module (); +unregister_netdevice_notifier (&ddp_notifier); +out_sock: +dev_remove_pack (&ppptalk_packet_type); +dev_remove_pack (<alk_packet_type); +unregister_snap_client (ddp_dl); +sock_unregister (PF_APPLETALK ); +out_proto: +proto_unregister (&ddp_proto); + goto out; }module_init (atalk_init);
net/appletalk/sysctl_net_atalk.c +4 -1
@@ -44,9 +44,12 @@ static struct ctl_table atalk_table[] =static struct ctl_table_header *atalk_table_header; -void atalk_register_sysctl (void ) +int __init atalk_register_sysctl (void ) { atalk_table_header =register_net_sysctl (&init_net,"net/appletalk" , atalk_table); +if (!atalk_table_header) +return -ENOMEM ; +return 0 ; }void atalk_unregister_sysctl (void )
PATCH 125/132 appletalk: Fix compile regression
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 27da0d2ef998e222a876c0cec72aa7829a626266 upstream.
A bugfix just broke compilation of appletalk when CONFIG_SYSCTL is disabled:
In file included from net/appletalk/ddp.c:65:net/appletalk/ddp.c: In function 'atalk_init':include/linux/atalk.h:164:34: error: expected expression before 'do'
#define atalk_register_sysctl() do { } while(0)
^~net/appletalk/ddp.c:1934:7: note: in expansion of macro 'atalk_register_sysctl'
rc = atalk_register_sysctl();
This is easier to avoid by using conventional inline functions as stubs rather than macros. The header already has inline functions for other purposes, so I'm changing over all the macros for consistency.
--- include/linux/atalk.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
include/linux/atalk.h +14 -4
@@ -153,16 +153,26 @@ extern int sysctl_aarp_resolve_time;extern int atalk_register_sysctl (void );extern void atalk_unregister_sysctl (void );#else -#define atalk_register_sysctl () do { } while(0) -#define atalk_unregister_sysctl () do { } while(0) +static inline int atalk_register_sysctl (void ) +{ +return 0 ; +} +static inline void atalk_unregister_sysctl (void ) +{ +}#endif #ifdef CONFIG_PROC_FS extern int atalk_proc_init (void );extern void atalk_proc_exit (void );#else -#define atalk_proc_init () ({ 0; }) -#define atalk_proc_exit () do { } while(0) +static inline int atalk_proc_init (void ) +{ +return 0 ; +} +static inline void atalk_proc_exit (void ) +{ +}#endif /* CONFIG_PROC_FS */ #endif /* __LINUX_ATALK_H__ */
PATCH 126/132 scsi: libsas: delete sas port if expander discover failed
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Yan <[email protected]>
commit 3b0541791453fbe7f42867e310e0c9eb6295364d upstream.
The sas_port(phy->port) allocated in sas_ex_discover_expander() will not be deleted when the expander failed to discover. This will cause resource leak and a further issue of kernel BUG like below:
[159785.843156] port-2:17:29: trying to add phy phy-2:17:29 fails: it's already part of another port [159785.852144] ------------[ cut here ]------------ [159785.856833] kernel BUG at drivers/scsi/scsi_transport_sas.c:1086! [159785.863000] Internal error: Oops - BUG: 0 [#1] SMP [159785.867866] CPU: 39 PID: 16993 Comm: kworker/u96:2 Tainted: G W OE 4.19.25-vhulk1901.1.0.h111.aarch64 #1 [159785.878458] Hardware name: Huawei Technologies Co., Ltd. Hi1620EVBCS/Hi1620EVBCS, BIOS Hi1620 CS B070 1P TA 03/21/2019 [159785.889231] Workqueue: 0000:74:02.0_disco_q sas_discover_domain [159785.895224] pstate: 40c00009 (nZcv daif +PAN +UAO) [159785.900094] pc : sas_port_add_phy+0x188/0x1b8 [159785.904524] lr : sas_port_add_phy+0x188/0x1b8 [159785.908952] sp : ffff0001120e3b80 [159785.912341] x29: ffff0001120e3b80 x28: 0000000000000000 [159785.917727] x27: ffff802ade8f5400 x26: ffff0000681b7560 [159785.923111] x25: ffff802adf11a800 x24: ffff0000680e8000 [159785.928496] x23: ffff802ade8f5728 x22: ffff802ade8f5708 [159785.933880] x21: ffff802adea2db40 x20: ffff802ade8f5400 [159785.939264] x19: ffff802adea2d800 x18: 0000000000000010 [159785.944649] x17: 00000000821bf734 x16: ffff00006714faa0 [159785.950033] x15: ffff0000e8ab4ecf x14: 7261702079646165 [159785.955417] x13: 726c612073277469 x12: ffff00006887b830 [159785.960802] x11: ffff00006773eaa0 x10: 7968702079687020 [159785.966186] x9 : 0000000000002453 x8 : 726f702072656874 [159785.971570] x7 : 6f6e6120666f2074 x6 : ffff802bcfb21290 [159785.976955] x5 : ffff802bcfb21290 x4 : 0000000000000000 [159785.982339] x3 : ffff802bcfb298c8 x2 : 337752b234c2ab00 [159785.987723] x1 : 337752b234c2ab00 x0 : 0000000000000000 [159785.993108] Process kworker/u96:2 (pid: 16993, stack limit = 0x0000000072dae094) [159786.000576] Call trace: [159786.003097] sas_port_add_phy+0x188/0x1b8 [159786.007179] sas_ex_get_linkrate.isra.5+0x134/0x140 [159786.012130] sas_ex_discover_expander+0x128/0x408 [159786.016906] sas_ex_discover_dev+0x218/0x4c8 [159786.021249] sas_ex_discover_devices+0x9c/0x1a8 [159786.025852] sas_discover_root_expander+0x134/0x160 [159786.030802] sas_discover_domain+0x1b8/0x1e8 [159786.035148] process_one_work+0x1b4/0x3f8 [159786.039230] worker_thread+0x54/0x470 [159786.042967] kthread+0x134/0x138 [159786.046269] ret_from_fork+0x10/0x18 [159786.049918] Code: 91322300 f0004402 91178042 97fe4c9b (d4210000) [159786.056083] Modules linked in: hns3_enet_ut(OE) hclge(OE) hnae3(OE) hisi_sas_test_hw(OE) hisi_sas_test_main(OE) serdes(OE) [159786.067202] ---[ end trace 03622b9e2d99e196 ]--- [159786.071893] Kernel panic - not syncing: Fatal exception [159786.077190] SMP: stopping secondary CPUs [159786.081192] Kernel Offset: disabled [159786.084753] CPU features: 0x2,a2a00a38
--- drivers/scsi/libsas/sas_expander.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/libsas/sas_expander.c +2 -0
@@ -977,6 +977,8 @@ static struct domain_device *sas_ex_disclist_del (&child->dev_list_node);spin_unlock_irq (&parent->port->dev_list_lock);sas_put_device (child); +sas_port_delete (phy->port); + phy->port =NULL ;return NULL ; }list_add_tail (&child->siblings, &parent->ex_dev.children);
PATCH 127/132 Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Loic Poulain <[email protected]>
commit 84cb3df02aea4b00405521e67c4c67c2d525c364 upstream.
HCI_UART_PROTO_SET flag is set before hci_uart_set_proto call. If we receive data from tty layer during this procedure, proto pointer may not be assigned yet, leading to null pointer dereference in rx method hci_uart_tty_receive.
This patch fixes this issue by introducing HCI_UART_PROTO_READY flag in order to avoid any proto operation before proto opening and assignment.
--- drivers/bluetooth/hci_ldisc.c | 11 +++++++---- drivers/bluetooth/hci_uart.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_ldisc.c +7 -4
@@ -225,7 +225,7 @@ static int hci_uart_flush(struct hci_devtty_ldisc_flush (tty);tty_driver_flush_buffer (tty); -if (test_bit (HCI_UART_PROTO_SET , &hu->flags)) +if (test_bit (HCI_UART_PROTO_READY , &hu->flags)) hu->proto->flush (hu);return 0 ;
@@ -342,7 +342,7 @@ static void hci_uart_tty_close(struct ttcancel_work_sync (&hu->write_work); -if (test_and_clear_bit (HCI_UART_PROTO_SET , &hu->flags)) { +if (test_and_clear_bit (HCI_UART_PROTO_READY , &hu->flags)) {if (hdev) {if (test_bit (HCI_UART_REGISTERED , &hu->flags))hci_unregister_dev (hdev);
@@ -350,6 +350,7 @@ static void hci_uart_tty_close(struct tt } hu->proto->close (hu); } +clear_bit (HCI_UART_PROTO_SET , &hu->flags);kfree (hu); }
@@ -376,7 +377,7 @@ static void hci_uart_tty_wakeup(struct tif (tty != hu->tty)return ; -if (test_bit (HCI_UART_PROTO_SET , &hu->flags)) +if (test_bit (HCI_UART_PROTO_READY , &hu->flags))hci_uart_tx_wakeup (hu); }
@@ -399,7 +400,7 @@ static void hci_uart_tty_receive(structif (!hu || tty != hu->tty)return ; -if (!test_bit (HCI_UART_PROTO_SET , &hu->flags)) +if (!test_bit (HCI_UART_PROTO_READY , &hu->flags))return ;spin_lock (&hu->rx_lock);
@@ -476,9 +477,11 @@ static int hci_uart_set_proto(struct hcireturn err; hu->proto = p; +set_bit (HCI_UART_PROTO_READY , &hu->flags); err =hci_uart_register_dev (hu);if (err) { +clear_bit (HCI_UART_PROTO_READY , &hu->flags); p->close (hu);return err; }
drivers/bluetooth/hci_uart.h +1 -0
@@ -81,6 +81,7 @@ struct hci_uart {/* HCI_UART proto flag bits */ #define HCI_UART_PROTO_SET 0#define HCI_UART_REGISTERED 1 +#define HCI_UART_PROTO_READY 2/* TX states */ #define HCI_UART_SENDING 1
PATCH 128/132 Bluetooth: hci_ldisc: Postpone HCI_UART_PROTO_READY bit set in hci_uart_set_proto()
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kefeng Wang <[email protected]>
commit 56897b217a1d0a91c9920cb418d6b3fe922f590a upstream.
task A: task B: hci_uart_set_proto flush_to_ldisc - p->open(hu) -> h5_open //alloc h5 - receive_buf
- set_bit HCI_UART_PROTO_READY - tty_port_default_receive_buf
- hci_uart_register_dev - tty_ldisc_receive_buf
- hci_uart_tty_receive
- test_bit HCI_UART_PROTO_READY
- h5_recv
- clear_bit HCI_UART_PROTO_READY while() {
- p->open(hu) -> h5_close //free h5
- h5_rx_3wire_hdr
- h5_reset() //use-after-free
}
It could use ioctl to set hci uart proto, but there is a use-after-free issue when hci_uart_register_dev() fail in hci_uart_set_proto(), see stack above, fix this by setting HCI_UART_PROTO_READY bit only when hci_uart_register_dev() return success.
--- drivers/bluetooth/hci_ldisc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bluetooth/hci_ldisc.c +1 -2
@@ -477,15 +477,14 @@ static int hci_uart_set_proto(struct hcireturn err; hu->proto = p; -set_bit (HCI_UART_PROTO_READY , &hu->flags); err =hci_uart_register_dev (hu);if (err) { -clear_bit (HCI_UART_PROTO_READY , &hu->flags); p->close (hu);return err; } +set_bit (HCI_UART_PROTO_READY , &hu->flags);return 0 ; }
PATCH 129/132 ath6kl: add some bounds checking
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 5d6751eaff672ea77642e74e92e6c0ac7f9709ab upstream.
The "ev->traffic_class" and "reply->ac" variables come from the network and they're used as an offset into the wmi->stream_exist_for_ac[] array. Those variables are u8 so they can be 0-255 but the stream_exist_for_ac[] array only has WMM_NUM_AC (4) elements. We need to add a couple bounds checks to prevent array overflows.
I also modified one existing check from "if (traffic_class > 3) {" to "if (traffic_class >= WMM_NUM_AC) {" just to make them all consistent.
--- drivers/net/wireless/ath/ath6kl/wmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/wmi.c +9 -1
@@ -1155,6 +1155,10 @@ static int ath6kl_wmi_pstream_timeout_evreturn -EINVAL ; ev = (struct wmi_pstream_timeout_event *) datap; +if (ev->traffic_class >=WMM_NUM_AC ) { +ath6kl_err ("invalid traffic class: %d\n" , ev->traffic_class); +return -EINVAL ; + }/* * When the pstream (fat pipe == AC) timesout, it means there were
@@ -1496,6 +1500,10 @@ static int ath6kl_wmi_cac_event_rx(strucreturn -EINVAL ; reply = (struct wmi_cac_event *) datap; +if (reply->ac >=WMM_NUM_AC ) { +ath6kl_err ("invalid AC: %d\n" , reply->ac); +return -EINVAL ; + }if ((reply->cac_indication ==CAC_INDICATION_ADMISSION_RESP ) && (reply->status_code !=IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED )) {
@@ -2608,7 +2616,7 @@ int ath6kl_wmi_delete_pstream_cmd(structu16 active_tsids =0 ;int ret; -if (traffic_class >3 ) { +if (traffic_class >=WMM_NUM_AC ) {ath6kl_err ("invalid traffic class: %d\n" , traffic_class);return -EINVAL ; }
PATCH 130/132 KVM: coalesced_mmio: add bounds checking
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matt Delco <[email protected]>
commit b60fe990c6b07ef6d4df67bc0530c7c90a62623a upstream.
The first/last indexes are typically shared with a user app. The app can change the 'last' index that the kernel uses to store the next result. This change sanity checks the index before using it for writing to a potentially arbitrary address.
This fixes CVE-2019-14821.
[bwh: Backported to 3.16:
- Use ACCESS_ONCE() instead of READ_ONCE()
- kvm_coalesced_mmio_zone::pio field is not supported]
--- virt/kvm/coalesced_mmio.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
virt/kvm/coalesced_mmio.c +10 -7
@@ -39,7 +39,7 @@ static int coalesced_mmio_in_range(strucreturn 1 ; } -static int coalesced_mmio_has_room (struct kvm_coalesced_mmio_dev *dev) +static int coalesced_mmio_has_room (struct kvm_coalesced_mmio_dev *dev,u32 last) {struct kvm_coalesced_mmio_ring *ring;unsigned avail;
@@ -51,7 +51,7 @@ static int coalesced_mmio_has_room(struc* there is always one unused entry in the buffer */ ring = dev->kvm->coalesced_mmio_ring; - avail = (ring->first - ring->last -1 ) %KVM_COALESCED_MMIO_MAX ; + avail = (ring->first - last -1 ) %KVM_COALESCED_MMIO_MAX ;if (avail ==0 ) {/* full */ return 0 ;
@@ -65,24 +65,27 @@ static int coalesced_mmio_write(struct k {struct kvm_coalesced_mmio_dev *dev =to_mmio (this);struct kvm_coalesced_mmio_ring *ring = dev->kvm->coalesced_mmio_ring; +__u32 insert;if (!coalesced_mmio_in_range (dev, addr, len))return -EOPNOTSUPP ;spin_lock (&dev->kvm->ring_lock); -if (!coalesced_mmio_has_room (dev)) { + insert =ACCESS_ONCE (ring->last); +if (!coalesced_mmio_has_room (dev, insert) || + insert >=KVM_COALESCED_MMIO_MAX ) {spin_unlock (&dev->kvm->ring_lock);return -EOPNOTSUPP ; }/* copy data in first free entry of the ring */ - ring->coalesced_mmio[ring->last].phys_addr = addr; - ring->coalesced_mmio[ring->last].len = len; -memcpy (ring->coalesced_mmio[ring->last].data, val, len); + ring->coalesced_mmio[insert].phys_addr = addr; + ring->coalesced_mmio[insert].len = len; +memcpy (ring->coalesced_mmio[insert].data, val, len);smp_wmb (); - ring->last = (ring->last +1 ) %KVM_COALESCED_MMIO_MAX ; + ring->last = (insert +1 ) %KVM_COALESCED_MMIO_MAX ;spin_unlock (&dev->kvm->ring_lock);return 0 ; }
PATCH 131/132 media: poseidon: Depend on PM_RUNTIME
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
This is a stable-only patch as the driver has been removed upstream.
Commit c2b71462d294 "USB: core: Fix bug caused by duplicate interface PM usage counter" switched USB to using only the standard runtime PM mechanism. In my backport I changed poseidon to read the runtime PM counter, but that means it now needs to depend on PM_RUNTIME.
---
drivers/media/usb/tlg2300/Kconfig +1 -0
@@ -7,6 +7,7 @@ config VIDEO_TLG2300 select VIDEOBUF_VMALLOC select SND_PCM select VIDEOBUF_DVB + depends on PM_RUNTIME ---help--- This is a video4linux driver for Telegent tlg2300 based TV cards.
PATCH 132/132 staging: comedi: dt282x: fix a null pointer deref on interrupt
In reply to Ben Hutchings3.16.74-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit b8336be66dec06bef518030a0df9847122053ec5 upstream.
The interrupt handler dt282x_interrupt() causes a null pointer dereference for those supported boards that have no analog output support. For these boards, dev->write_subdev will be NULL and therefore the s_ao subdevice pointer variable will be NULL. In that case, the following call near the end of the interrupt handler results in a null pointer dereference:
cfc_handle_events(dev, s_ao);
[ Upstream equivalent:
comedi_handle_events(dev, s_ao);
-- IA ]
Fix it by only calling the above function if s_ao is valid.
(There are other uses of s_ao by the interrupt handler that may or may not be reached depending on values of hardware registers. Trust that they are reliable for now.)
--- drivers/staging/comedi/drivers/dt282x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/dt282x.c +2 -1
@@ -483,7 +483,8 @@ static irqreturn_t dt282x_interrupt(int }#endif cfc_handle_events (dev, s); -cfc_handle_events (dev, s_ao); +if (s_ao) +cfc_handle_events (dev, s_ao);return IRQ_RETVAL (handled); }
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.74 release. There are 132 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 Mon Sep 23 20:00:00 UTC 2019. Anything received after that time might be too late.
Build results:
total: 136 pass: 135 fail: 1 Failed builds: arm:allmodconfig Qemu test results: total: 229 pass: 229 fail: 0
Build errors in arm:allmodconfig are along the line of
In file included from include/linux/printk.h:5,
from include/linux/kernel.h:13,
from include/linux/clk.h:16,
from drivers/gpu/drm/tilcdc/tilcdc_drv.h:21,
from drivers/gpu/drm/tilcdc/tilcdc_drv.c:20:include/linux/init.h:343:7: error: 'cleanup_module'
specifies less restrictive attribute than its target 'tilcdc_drm_fini': 'cold'
In addition to a few errors like that, there are literally thousands of similar warnings.
Guenter
Quoted 27 lines · Guenter Roeck
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.74 release. There are 132 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 Mon Sep 23 20:00:00 UTC 2019. Anything received after that time might be too late.
Build results:
total: 136 pass: 135 fail: 1 Failed builds: arm:allmodconfig Qemu test results: total: 229 pass: 229 fail: 0Build errors in arm:allmodconfig are along the line of
In file included from
include/linux/printk.h:5,
frominclude/linux/kernel.h:13,
frominclude/linux/clk.h:16,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.h:21,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.c:20:include/linux/init.h:343:7: error: 'cleanup_module'
specifies less restrictive attribute than its target 'tilcdc_drm_fini': 'cold'
Quoted 2 lines
In addition to a few errors like that, there are literally thousands of similar warnings.
It looks like this is triggered by you switching arm builds from gcc 8 to 9, rather than by any code change.
Does it actually make sense to try to support building Linux 3.16 with gcc 9? If so, I suppose I'll need to add:
commit edc966de8725f9186cc9358214da89d335f0e0bd
Author: Miguel Ojeda <[email protected]> Date: Fri Aug 2 12:37:56 2019 +0200
Backport minimal compiler_attributes.h to support GCC 9
commit a6e60d84989fa0e91db7f236eda40453b0e44afa
Author: Miguel Ojeda <[email protected]> Date: Sat Jan 19 20:59:34 2019 +0100
include/linux/module.h: copy __init/__exit attrs to init/cleanup_module
Ben.
Signature · 3 lines
Ben Hutchings Nothing is ever a complete failure; it can always serve as a bad example.
Quoted 28 lines · Ben Hutchings
Quoted 27 lines · Guenter Roeck
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.74 release. There are 132 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 Mon Sep 23 20:00:00 UTC 2019. Anything received after that time might be too late.
Build results:
total: 136 pass: 135 fail: 1 Failed builds: arm:allmodconfig Qemu test results: total: 229 pass: 229 fail: 0Build errors in arm:allmodconfig are along the line of
In file included from
include/linux/printk.h:5,
frominclude/linux/kernel.h:13,
frominclude/linux/clk.h:16,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.h:21,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.c:20:include/linux/init.h:343:7: error: 'cleanup_module'
specifies less restrictive attribute than its target 'tilcdc_drm_fini': 'cold'
Quoted 6 lines
Quoted 2 lines
In addition to a few errors like that, there are literally thousands of similar warnings.
It looks like this is triggered by you switching arm builds from gcc 8 to 9, rather than by any code change.
Ah, good point.
Quoted 3 lines
Does it actually make sense to try to support building Linux 3.16 with gcc 9? If so, I suppose I'll need to add:
It helps streamline my builds and reduces the number of compilers I have to keep around. No problem, though; I can switch back to an older compiler for arm on 3.16.
Guenter
Quoted 28 lines · Ben Hutchings
Quoted 27 lines · Guenter Roeck
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.74 release. There are 132 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 Mon Sep 23 20:00:00 UTC 2019. Anything received after that time might be too late.
Build results:
total: 136 pass: 135 fail: 1 Failed builds: arm:allmodconfig Qemu test results: total: 229 pass: 229 fail: 0Build errors in arm:allmodconfig are along the line of
In file included from
include/linux/printk.h:5,
frominclude/linux/kernel.h:13,
frominclude/linux/clk.h:16,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.h:21,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.c:20:include/linux/init.h:343:7: error: 'cleanup_module'
specifies less restrictive attribute than its target 'tilcdc_drm_fini': 'cold'
Quoted 6 lines
Quoted 2 lines
In addition to a few errors like that, there are literally thousands of similar warnings.
It looks like this is triggered by you switching arm builds from gcc 8 to 9, rather than by any code change.
After reverting to gcc 8.3.0 for arm, I get:
Build results:
total: 136 pass: 136 fail: 0 Qemu test results: total: 229 pass: 229 fail: 0
Sorry for the noise.
Guenter
Quoted 36 lines · Guenter Roeck
Quoted 28 lines · Ben Hutchings
Quoted 27 lines · Guenter Roeck
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.74 release. There are 132 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 Mon Sep 23 20:00:00 UTC 2019. Anything received after that time might be too late.
Build results:
total: 136 pass: 135 fail: 1 Failed builds: arm:allmodconfig Qemu test results: total: 229 pass: 229 fail: 0Build errors in arm:allmodconfig are along the line of
In file included from
include/linux/printk.h:5,
frominclude/linux/kernel.h:13,
frominclude/linux/clk.h:16,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.h:21,
fromdrivers/gpu/drm/tilcdc/tilcdc_drv.c:20:include/linux/init.h:343:7: error: 'cleanup_module'
specifies less restrictive attribute than its target 'tilcdc_drm_fini': 'cold'Quoted 6 lines
Quoted 2 lines
In addition to a few errors like that, there are literally thousands of similar warnings.
It looks like this is triggered by you switching arm builds from gcc 8 to 9, rather than by any code change.
Quoted 8 lines
After reverting to gcc 8.3.0 for arm, I get:
Build results:
total: 136 pass: 136 fail: 0 Qemu test results: total: 229 pass: 229 fail: 0Sorry for the noise.
Great, thanks for checking.
Ben.
Signature · 3 lines
Ben Hutchings I'm always amazed by the number of people who take up solipsism because they heard someone else explain it. - E*Borg on alt.fan.pratchett
Quoted 11 lines · Ben Hutchings
It looks like this is triggered by you switching arm builds from gcc 8 to 9, rather than by any code change.
Does it actually make sense to try to support building Linux 3.16 with gcc 9? If so, I suppose I'll need to add:
commit
edc966de8725f9186cc9358214da89d335f0e0bdAuthor: Miguel Ojeda <[email protected]> Date: Fri Aug 2 12:37:56 2019 +0200
Quoted 7 lines
Backport minimal
compiler_attributes.hto support GCC 9commit
a6e60d84989fa0e91db7f236eda40453b0e44afaAuthor: Miguel Ojeda <[email protected]> Date: Sat Jan 19 20:59:34 2019 +0100
include/linux/module.h: copy __init/__exit attrs toinit/cleanup_module
Yeah, those should fix it.
Cheers,
Miguel
Quoted 13 lines · Miguel Ojeda
Quoted 12 lines · Ben Hutchings
It looks like this is triggered by you switching arm builds from gcc 8 to 9, rather than by any code change.
Does it actually make sense to try to support building Linux 3.16 with gcc 9? If so, I suppose I'll need to add:
commit
edc966de8725f9186cc9358214da89d335f0e0bdAuthor: Miguel Ojeda <[email protected]> Date: Fri Aug 2 12:37:56 2019 +0200Backport minimal
compiler_attributes.hto support GCC 9
Quoted 7 lines
Quoted 5 lines
commit
a6e60d84989fa0e91db7f236eda40453b0e44afaAuthor: Miguel Ojeda <[email protected]> Date: Sat Jan 19 20:59:34 2019 +0100
include/linux/module.h: copy __init/__exit attrs toinit/cleanup_moduleYeah, those should fix it.
A week or two back I tried building 3.16 for x86_64 with gcc 8, which produced some warnings but did succeed (and I know Guenter successfully build-tests 3.16 with gcc 8 for many architectures). However, the kernel didn't boot on a test system, while the same code built with gcc 4.9 (if I remember correctly) did boot.
While I'm not about to remove support for gcc 8, this makes me think that there are some not-so-obvious fixes required to make 3.16 properly compatible with recent gcc versions. So I would rather not continue adding superficial support for them, that may lead to people wasting time building broken kernels.
Ben.
Signature · 2 lines
Ben Hutchings Theory and practice are closer in theory than in practice - John Levine
Quoted 28 lines · Ben Hutchings
Quoted 13 lines · Miguel Ojeda
Quoted 12 lines · Ben Hutchings
It looks like this is triggered by you switching arm builds from gcc 8 to 9, rather than by any code change.
Does it actually make sense to try to support building Linux 3.16 with gcc 9? If so, I suppose I'll need to add:
commit
edc966de8725f9186cc9358214da89d335f0e0bdAuthor: Miguel Ojeda <[email protected]> Date: Fri Aug 2 12:37:56 2019 +0200Backport minimal
compiler_attributes.hto support GCC 9Quoted 7 lines
Quoted 5 lines
commit
a6e60d84989fa0e91db7f236eda40453b0e44afaAuthor: Miguel Ojeda <[email protected]> Date: Sat Jan 19 20:59:34 2019 +0100
include/linux/module.h: copy __init/__exit attrs toinit/cleanup_moduleYeah, those should fix it.
A week or two back I tried building 3.16 for
x86_64with gcc 8, which produced some warnings but did succeed (and I know Guenter successfully build-tests 3.16 with gcc 8 for many architectures). However, the kernel didn't boot on a test system, while the same code built with gcc 4.9 (if I remember correctly) did boot.
Quoted 6 lines
While I'm not about to remove support for gcc 8, this makes me think that there are some not-so-obvious fixes required to make 3.16 properly compatible with recent gcc versions. So I would rather not continue adding superficial support for them, that may lead to people wasting time building broken kernels.
I kind of agree. It would make my life easier since I'd be able to drop older compilers, but on the other side anyone actually using 3.16 kernels will very likely not update their compilers for the same reason they don't update the kernel.
Guenter