3.16.60-rc1 review
Subsystems (6)
cover 3.16.60-rc1 review
This is the start of the stable review cycle for the 3.16.60 release. There are 366 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Oct 19 17:00:00 UTC 2018. Anything received after that time might be too late.
All the patches have also been committed to the linux-3.16.y-rc branch of
https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable-rc.git . A shortlog and diffstat can be found below.
Ben.
-------------
Aaron Ma (2):
HID: core: Fix size as type u32
[6de0b13cc0b4ba10e98a9263d7a83b940720b77a]
HID: i2c-hid: fix size check and type usage
[ac75a041048b8c1f7418e27621ca5efda8571043]
Al Viro (12):
Don't leak MNT_INTERNAL away from internal mounts
[16a34adb9392b2fe4195267475ab5b472e55292c]
affs_lookup(): close a race with affs_remove_link()
[30da870ce4a4e007c901858a96e9e394a1daa74a]
aio: fix io_destroy(2) vs. lookup_ioctx() race
[baf10564fbb66ea222cae66fbff11c444590ffd9]
do d_instantiate/unlock_new_inode combinations safely
[1e2e547a93a00ebc21582c06ca3c6cfea2a309ee]
ext2: fix a block leak
[5aa1437d2d9a068c0334bd7c9dafa8ec4f97f13b]
fix io_destroy()/aio_complete() race
[4faa99965e027cc057c5145ce45fa772caa04e8d]
hypfs_kill_super(): deal with failed allocations
[a24cd490739586a7d2da3549a1844e1d7c4f4fc4]
jffs2_kill_sb(): deal with failed allocations
[c66b23c2840446a82c389e4cb1a12eb2a71fa2e4]
rpc_pipefs: fix double-dput()
[4a3877c4cedd95543f8726b0a98743ed8db0c0fb]
udf: fix the udf_iget() vs. udf_new_inode() races
[b231509616feb911c2a7a8814d58c0014ef5b17f]
udf: merge the pieces inserting a new non-directory object into directory
[d2be51cb34dc501791f3b8c01a99a3f2064bd8d1]
ufs: deal with nfsd/iget races
[e4502c63f56aeca887ced37f24e0def1ef11cec8]
Alan Cox (1):
tty: handle the case where we cannot restore a line discipline
[8a8dabf2dd68caff842d38057097c23bc514ea6e]
Alan Stern (1):
USB: Accept bulk endpoints with 1024-byte maxpacket
[fb5ee84ea72c5f1b6cabdd1c9d6e8648995ca7c6]
Alex Smith (1):
mmc: jz4740: Fix race condition in IRQ mask update
[a04f0017c22453613d5f423326b190c61e3b4f98]
Alexander Gerasiov (1):
parport_pc: Add support for WCH CH382L PCI-E single parallel port card.
[823f7923833c6cc2b16e601546d607dcfb368004]
Alexey Khoroshilov (2):
vmxnet3: avoid assumption about invalid dma_pa in vmxnet3_set_mc()
[fb5c6cfaec126d9a96b9dd471d4711bf4c737a6f]
vmxnet3: fix checks for dma mapping errors
[5738a09d58d5ad2871f1f9a42bf6a3aa9ece5b3c]
Amir Goldstein (1):
fanotify: fix logic of events on child
[54a307ba8d3cd00a3902337ffaae28f436eeb1a4]
Andrew Morton (1):
fs/reiserfs/journal.c: add missing resierfs_warning() arg
[9ad553abe66f8be3f4755e9fa0a6ba137ce76341]
Andrey Ignatov (1):
ipv4: fix memory leaks in udp_sendmsg, ping_v4_sendmsg
[1b97013bfb11d66f041de691de6f0fec748ce016]
Andy King (1):
VMXNET3: Check for map error in vmxnet3_set_mc
[4ad9a64f53c619969dede1143d56ccda1a453c39]
Aneesh Kumar K.V (1):
powerpc/mm/hugetlb: initialize the pagetable cache correctly for hugetlb
[6fa504835d6969144b2bd3699684dd447c789ba2]
Ard Biesheuvel (1):
efi: Avoid potential crashes, fix the 'struct efi_pci_io_protocol_32' definition for mixed mode
[0b3225ab9407f557a8e20f23f37aa7236c10a9b1]
Arnaldo Carvalho de Melo (1):
perf top: Document --ignore-vmlinux
[a8403912d04e2c8271653bb5b7f6294dc6d322ac]Arnd Bergmann (1):
media: s3c-camif: fix out-of-bounds array access
[a398e043637a4819a0e96467bfecaabf3224dd62]
Bai Ping (1):
thermal: imx: register irq handler later in probe
[84866ee5818e95f6e97194656777c10ac24cb9d3]
Bart Van Assche (1):
IB/srp: Fix srp_abort()
[e68088e78d82920632eba112b968e49d588d02a2]
Ben Hutchings (4):
ALSA: timer: Fix pause event notification
[3ae180972564846e6d794e3615e1ab0a1e6c4ef9]
drm/msm: Fix possible null dereference on failure of get_pages()
[3976626ea3d2011f8fd3f3a47070a8b792018253]
ppp: Fix null pointer dereference on registration failure
[96d934c70db6e1bc135600c57da1285eaf7efb26]
scsi: qla2xxx: Avoid double completion of abort command
[3a9910d7b686546dcc9986e790af17e148f1c888]
Bharat Potnuri (1):
iw_cxgb4: Atomically flush per QP HW CQEs
[2df19e19ae90d94fd8724083f161f368a2797537]
Bin Liu (1):
usb: musb: host: fix potential NULL pointer dereference
[2b63f1329df2cd814c1f8353fae4853ace6521d1]
Bjorn Helgaas (1):
drm/radeon: make MacBook Pro d3_delay quirk more generic
[5938628c51a711ae2169d68b2e3a4f7d93d4dbea]
Bjørn Mork (1):
qmi_wwan: do not steal interfaces from class drivers
[5697db4a696c41601a1d15c1922150b4dbf5726c]
Brad Volkin (1):
drm/i915: Log a message when rejecting LRM to OACONTROL
[00caf0199f66871b0e2c28d7c2079de0ce1d646c]
Bryan O'Donoghue (1):
rtc: snvs: Fix usage of snvs_rtc_enable
[1485991c024603b2fb4ae77beb7a0d741128a48e]
Chao Yu (2):
f2fs: reposition unlock_new_inode to prevent accessing invalid inode
[b73e52824c8920a5ff754e3c8ff68466a7dd61f9]
udf: avoid unneeded up_write when fail to add entry in ->symlink
[85cd083b498572fb9fa575cce3ed910c8ee84294]Charles Keepax (2):
regmap: Correct offset handling in regmap_volatile_range
[b8f9a03b741ddfdde4aa8b607fa7d88eb63a6338]
regmap: Don't use format_val in regmap_bulk_read
[9ae27a8d1f3ebff09191fb8cb1341414547293b2]
Chris Mason (1):
Btrfs: use insert_inode_locked4 for inode creation
[b0d5d10f41a0f1cd839408dd94427f2db3553bca]
Chris Metcalf (3):
Make asm/word-at-a-time.h available on all architectures
[a6e2f029ae34f41adb6ae3812c32c5d326e1abd2]
string: provide strscpy()
[30035e45753b708e7d47a98398500ca005e02b86]
word-at-a-time.h: fix some Kbuild files
[19c22f3a29fa8669c477f20a65f6c7c27108972a]
Clemens Werther (1):
USB: serial: ftdi_sio: add support for Harman FirmwareHubEmulator
[6555ad13a01952c16485c82a52ad1f3e07e34b3a]
Colin Ian King (5):
KVM: Fix spelling mistake: "cop_unsuable" -> "cop_unusable"
[ba3696e94d9d590d9a7e55f68e81c25dba515191]
RDMA/iwpm: fix memory leak on map_info
[f96416cea7bce9afe619c15e87fced70f93f9098]
media: cx25821: prevent out-of-bounds read on array card
[67300abdbe9f1717532aaf4e037222762716d0f6]
rtc: tx4939: avoid unintended sign extension on a 24 bit shift
[347876ad47b9923ce26e686173bbf46581802ffa]
staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr
[e1a7418529e33bc4efc346324557251a16a3e79b]Collin May (1):
USB: serial: simple: add libtransistor console
[fe710508b6ba9d28730f3021fed70e7043433b2e]
Cong Wang (2):
llc: fix NULL pointer deref for SOCK_ZAPPED
[3a04ce7130a7e5dad4e78d45d50313747f8c830f]
llc: hold llc_sap before release_sock()
[f7e43672683b097bb074a8fe7af9bc600a23f231]
Dan Carpenter (2):
net: ethernet: davinci_emac: fix error handling in probe()
[8005b09d99fac78e6f5fb9da30b5ae94840af03b]
xen/acpi: off by one in read_acpi_id()
[c37a3c94775855567b90f91775b9691e10bd2806]
Daniel Borkmann (1):
bpf, x64: fix memleak when not converging after image
[3aab8884c9eb99189a3569ac4e6b205371c9ac0b]
Danilo Krummrich (1):
fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
[a0b0d1c345d0317efe594df268feb5ccc99f651e]
Danit Goldberg (1):
IB/mlx5: Use unlimited rate when static rate is not supported
[4f32ac2e452c2180cd2df581cbadac183e27ecd0]
Dave Airlie (1):
drm: set FMODE_UNSIGNED_OFFSET for drm files
[76ef6b28ea4f81c3d511866a9b31392caa833126]
David Henningsson (1):
ALSA: core: Report audio_tstamp in snd_pcm_sync_ptr
[f853dcaae2f5bbe021161e421bd1576845bae8f6]
David Howells (1):
afs: Fix directory permissions check
[378831e4daec75fbba6d3612bcf3b4dd00ddbf08]
David Lechner (1):
pinctrl: pinctrl-single: Fix pcs_request_gpio() when bits_per_mux != 0
[45dcb54f014d3d1f5cc3919b5f0c97087d7cb3dd]Davidlohr Bueso (5):
Revert "ipc/shm: Fix shmat mmap nil-page protection"
[a73ab244f0dad8fffb3291b905f73e2d3eaa7c00]
ipc,shm: move BUG_ON check into shm_lock
[c5c8975b2eb4eb7604e8ce4f762987f56d2a96a2]
ipc/sem: make semctl setting sempid consistent
[a5f4db877177d2a3d7ae62a7bac3a5a27e083d7f]
ipc/shm: fix shmat() nil address after round-down when remapping
[8f89c007b6dec16a1793cb88de88fcc02117bbbc]
ipc: convert invalid scenarios to use WARN_ON
[d0edd8528362c07216498340e928159510595e7b]
Dennis Wassenberg (1):
Input: i8042 - add Lenovo ThinkPad L460 to i8042 reset list
[b56af54ac78c54a519d82813836f305d7f76ef27]
Dexuan Cui (1):
tick/broadcast: Use for_each_cpu() specially on UP kernels
[5596fe34495cf0f645f417eb928ef224df3e3cb4]
Dmitry Safonov (1):
tracing/uprobe: Drop isdigit() check in create_trace_uprobe
[5ba8a4a96f6eaa6af88e24c7794f142217aa3b6f]
Dou Liyang (1):
x86/acpi: Prevent X2APIC id 0xffffffff from being accounted
[10daf10ab154e31237a8c07242be3063fb6a9bf4]Eliot Blennerhassett (1):
ALSA: asihpi: used parts of message/response are zeroed before use
[51e6f47dd2e3463dac6f37128fd7b7cb40c500de]
Eric Biggers (5):
KEYS: DNS: limit the length of option strings
[9c438d7a3a52dcc2b9ed095cb87d3a5e83cf7e60]
crypto: x86/cast5-avx - fix ECB encryption when long sg follows short one
[8f461b1e02ed546fbd0f11611138da67fd85a30f]
ext4: correctly detect when an xattr value has an invalid size
[d7614cc16146e3f0b4c33e71875c19607602aed5]
ipc/shm: fix use-after-free of shm file via remap_file_pages()
[3f05317d9889ab75c7190dcd39491d2a97921984]
ppp: remove the PPPIOCDETACH ioctl
[af8d3c7c001ae7df1ed2b2715f058113efc86187]
Eric Dumazet (21):
crypto: af_alg - fix possible uninit-value in alg_bind()
[a466856e0b7ab269cdf9461886d007e88ff575b0]
dccp: fix tasklet usage
[a8d7aa17bbc970971ccdf71988ea19230ab368b1]
ip6_gre: better validate user provided tunnel names
[5f42df013b8bc1b6511af7a04bf93b014884ae2a]
ip6_tunnel: better validate user provided tunnel names
[db7a65e3ab78e5b1c4b17c0870ebee35a4ee3257]
ip_tunnel: better validate user provided tunnel names
[9cb726a212a82c88c98aa9f0037fd04777cd8fe5]
ipv6: add RTA_TABLE and RTA_PREFSRC to rtm_ipv6_policy
[aa8f8778493c85fff480cdf8b349b1e1dcb5f243]
ipv6: sit: better validate user provided tunnel names
[b95211e066fc3494b7c115060b2297b4ba21f025]
llc: better deal with too small mtu
[2c5d5b13c6eb79f5677e206b8aad59b3a2097f60]
net: af_packet: fix race in PACKET_{R|T}X_RING
[5171b37d959641bbc619781caf62e61f7b940871]
net: fix rtnh_ok()
[b1993a2de12c9e75c35729e2ffbc3a92d50c0d31]
net: fix uninit-value in __hw_addr_add_ex()
[77d36398d99f2565c0a8d43a86fd520a82e64bb8]
net: initialize skb->peeked when cloning
[b13dda9f9aa7caceeee61c080c2e544d5f5d85e5]
net_sched: fq: take care of throttled flows before reuse
[7df40c2673a1307c3260aab6f9d4b9bf97ca8fd7]
netlink: fix uninit-value in netlink_sendmsg
[6091f09c2f79730d895149bcfe3d66140288cd0e]
sctp: do not leak kernel memory to user space
[6780db244d6b1537d139dea0ec8aad10cf9e4adb]
soreuseport: initialise timewait reuseport field
[3099a52918937ab86ec47038ad80d377ba16c531]
tcp: fix TCP_REPAIR_QUEUE bound checking
[bf2acc943a45d2b2e8a9f1a5ddff6b6e43cc69d9]
tcp: md5: reject TCP_MD5SIG or TCP_MD5SIG_EXT on established sockets
[7212303268918b9a203aebeacfdbd83b5e87b20d]
tcp: purge write queue in tcp_connect_init()
[7f582b248d0a86bae5788c548d7bb5bca6f7691a]
vti6: better validate user provided tunnel names
[537b361fbcbcc3cd6fe2bb47069fd292b9256d16]
xfrm6: avoid potential infinite loop in _decode_session6()
[d9f92772e8ec388d070752ee8f187ef8fa18621f]Eric W. Biederman (4):
ipc/msg: Fix msgctl(..., IPC_STAT, ...) between pid namespaces
[39a4940eaa185910bb802ca9829c12268fd2c855]
ipc/sem: Fix semctl(..., GETPID, ...) between pid namespaces
[51d6f2635b39709ee5e62479be23d423b760292c]
ipc/shm: Fix shmctl(..., IPC_STAT, ...) between pid namespaces.
[98f929b1bd4d0b7c7a77d0d9776d1b924db2e454]
ipc/util: Helpers for making the sysvipc operations pid namespace aware
[03f1fc09180b345582889a344b012d069b3a6dbe]
Eryu Guan (1):
ext4: protect i_disksize update by i_data_sem in direct write path
[73fdad00b208b139cf43f3163fbc0f67e4c6047c]
Fabián Inostroza (1):
ALSA: line6: Use correct endpoint type for midi output
[7ecb46e9ee9af18e304eb9e7d6804c59a408e846]
Federico Cuello (1):
ALSA: usb: mixer: volume quirk for CM102-A+/102S+
[21493316a3c4598f308d5a9fa31cc74639c4caff]Filipe Manana (3):
Btrfs: don't leave dangling dentry if symlink creation failed
[d50866d00fb39fcf72307001763ee9cc92625a43]
Btrfs: ensure tmpfile inode is always persisted with link count of 0
[5762b5c958abbecb7fb9f4596a6476d1ce91ecf6]
Btrfs: fix copy_items() return value when logging an inode
[8434ec46c6e3232cebc25a910363b29f5c617820]
Florent Flament (1):
drm/i915: Fix drm:intel_enable_lvds ERROR message in kernel log
[280b54ade5914d3b4abe4f0ebe083ddbd4603246]
Florian Fainelli (2):
net: bcmgenet: Fix sparse warnings in bcmgenet_put_tx_csum()
[6f89421180f15867dc1472d9edf68f82b0ed5ee6]
net: systemport: Fix sparse warnings in bcm_sysport_insert_tsb()
[c0eb05585d4184596453622b5abba7d13dd20667]
Florian Westphal (1):
netfilter: nf_tables: can't fail after linking rule into active rule list
[569ccae68b38654f04b6842b034aa33857f605fe]
Francisco Jerez (1):
drm/i915: Fix command parser to validate multiple register access with the same command.
[6a65c5b9326c9dd391afb1b3df75cbedffbaccdb]
Geert Uytterhoeven (6):
serial: arc_uart: Fix out-of-bounds access through DT alias
[f9f5786987e81d166c60833edcb7d1836aa16944]
serial: fsl_lpuart: Fix out-of-bounds access through DT alias
[ffab87fdecc655cc676f8be8dd1a2c5e22bd6d47]
serial: imx: Fix out-of-bounds access through serial port index
[5673444821406dda5fc25e4b52aca419f8065a19]
serial: mxs-auart: Fix out-of-bounds access through serial port index
[dd345a31bfdec350d2593e6de5964e55c7f19c76]
serial: pxa: Fix out-of-bounds access through serial port index
[afc7851fab8329eddcf321c9e0a58c893f351dd6]
serial: xuartps: Fix out-of-bounds access through DT alias
[e7d75e18d0fc3f7193b65282b651f980c778d935]
Govindarajulu Varadarajan (1):
enic: set DMA mask to 47 bit
[322eaa06d55ebc1402a4a8d140945cff536638b4]
Greg Kroah-Hartman (1):
USB: serial: visor: handle potential invalid device configuration
[4842ed5bfcb9daf6660537d70503c18d38dbdbb8]
Guenter Roeck (4):
hwmon: (nct6683) Enable EC access if disabled at boot
[dbac00f0cf634120d77edee10d25e3f6899d7636]
hwmon: (nct6775) Fix writing pwmX_mode
[415eb2a1aaa4881cf85bd86c683356fdd8094a23]
hwmon: (pmbus/adm1275) Accept negative page register values
[ecb29abd4cb0670c616fb563a078f25d777ce530]
hwmon: (pmbus/max8688) Accept negative page register values
[a46f8cd696624ef757be0311eb28f119c36778e8]
Guillaume Nault (12):
l2tp: check sockaddr length in pppol2tp_connect()
[eb1c28c05894a4b1f6b56c5bf072205e64cfa280]
l2tp: fix race in duplicate tunnel detection
[f6cd651b056ffd3b4e8496afd44d4ed44bf69136]
l2tp: fix races in tunnel creation
[6b9f34239b00e6956a267abed2bc559ede556ad6]
l2tp: fix {pppol2tp, l2tp_dfs}_seq_stop() in case of seq_file overflow
[5411b6187adf62909e3b998ac782e722904c7487]
l2tp: hold reference on tunnels in netlink dumps
[5846c131c39b6d0add36ec19dc8650700690f930]
l2tp: hold reference on tunnels printed in l2tp/tunnels debugfs file
[f726214d9b23e5fce8c11937577a289a3202498f]
l2tp: hold reference on tunnels printed in pppol2tp proc file
[0e0c3fee3a59a387aeecc4fca6f3a2e9615a5443]
ppp: fix device unregistration upon netns deletion
[8cb775bc0a34dc596837e7da03fd22c747be618b]
ppp: fix lockdep splat in ppp_dev_uninit()
[58a89ecaca53736aa465170530acea4f8be34ab4]
ppp: fix race in ppp device destruction
[6151b8b37b119e8e3a8401b080d532520c95faf4]
ppp: unlock all_ppp_mutex before registering device
[0171c41835591e9aa2e384b703ef9a6ae367c610]
pppoe: check sockaddr length in pppoe_connect()
[a49e2f5d5fb141884452ddb428f551b123d436b5]
Gustavo A. R. Silva (3):
atm: zatm: Fix potential Spectre v1
[2be147f7459db5bbf292e0a6f135037b55e20b39]
kernel/sys.c: fix potential Spectre v1 issue
[23d6aef74da86a33fa6bb75f79565e0a16ee97c2]
net: atm: Fix potential Spectre v1
[acf784bd0ce257fe43da7ca266f7a10b837479d2]
Hans de Goede (1):
libata: Apply NOLPM quirk for SanDisk SD7UB3Q*G1001 SSDs
[184add2ca23ce5edcac0ab9c3b9be13f91e7b567]
Heinrich Schuchardt (1):
usb: musb: gadget: misplaced out of bounds check
[af6f8529098aeb0e56a68671b450cf74e7a64fcd]
Helge Deller (2):
parisc: Fix HPMC handler by increasing size to multiple of 16 bytes
[d5654e156bc4d68a87bbaa6d7e020baceddf6e68]
parisc: Fix out of array access in match_pci_device()
[615b2665fd20c327b631ff1e79426775de748094]
Hendrik Brueckner (1):
s390/cpum_sf: ensure sample frequency of perf event attributes is non-zero
[4bbaf2584b86b0772413edeac22ff448f36351b1]
Herbert Xu (1):
crypto: ahash - Fix early termination in hash walk
[900a081f6912a8985dc15380ec912752cb66025a]
[email protected] (1):
scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
[1514839b366417934e2f1328edb50ed1e8a719f5]
[email protected] (1):
vmxnet3: set the DMA mask before the first DMA map operation
[61aeecea40afb2b89933e27cd4adb10fc2e75cfd]
Huacai Chen (1):
zboot: fix stack protector in compressed boot phase
[7bbaf27d9c83037b6e60a818e57bdbedf6bc15be]
Ian Kent (1):
autofs: mount point create should honour passed in mode
[1e6306652ba18723015d1b4967fe9de55f042499]
Igor Pylypiv (1):
watchdog: f71808e_wdt: Fix WD_EN register read
[977f6f68331f94bb72ad84ee96b7b87ce737d89d]
Ilya Dryomov (1):
libceph: validate con->state at the top of try_write()
[9c55ad1c214d9f8c4594ac2c3fa392c1c32431a7]Ivan Khoronzhuk (1):
net: ethernet: ti: cpdma: correct error handling for chan create
[8a83c5d7969b8433584e3cf658a8d76c4dc37f4d]
Jack Morgenstein (1):
net/mlx4: Fix irq-unsafe spinlock usage
[d546b67cda015fb92bfee93d5dc0ceadb91deaee]
Jaegeuk Kim (2):
f2fs: call f2fs_unlock_op after error was handled
[44c16156512f33c81e382a1e1df9524e26a7026a]
f2fs: go out for insert_inode_locked failure
[a21c20f0c812925085204fced932ac95f2a76bf0]
James Kelly (1):
ASoC: ssm2602: Replace reg_default_raw with reg_default
[a01df75ce737951ad13a08d101306e88c3f57cb2]
Jan Kara (3):
bdi: Fix oops in wb_workfn()
[b8b784958eccbf8f51ebeee65282ca3fd59ea391]
ufs: Fix possible deadlock when looking up directories
[514d748f69c97a51a2645eb198ac5c6218f22ff9]
ufs: Fix warning from unlock_new_inode()
[12ecbb4b1d765a5076920999298d9625439dbe58]
Jann Horn (1):
tcp: don't read out-of-bounds opsize
[7e5a206ab686f098367b61aca989f5cdfa8114a3]
Jason Andryuk (1):
HID: i2c-hid: Fix "incomplete report" noise
[ef6eaf27274c0351f7059163918f3795da13199c]
Jeff Moyer (1):
block_invalidatepage(): only release page if the full page was invalidated
[3172485f4f8032649c144e4aafa550e1e6179332]
Jens Remus (1):
scsi: zfcp: fix infinite iteration on ERP ready list
[fa89adba1941e4f3b213399b81732a5c12fd9131]
Jerome Brunet (1):
clk: fix mux clock documentation
[fe3f338f0cb2ed4d4f06da054c21ae2f8a36ef2d]
Jimmy Assarsson (1):
can: kvaser_usb: Increase correct stats counter in kvaser_usb_rx_can_msg()
[6ee00865ffe4e8c8ba4a68d26db53c7ec09bbb89]
Jiri Olsa (1):
perf record: Put new line after target override warning
[c3dec27b7f70a9ad5f777d943d51ecdfcd9824d0]
Joakim Tjernlund (3):
mtd: cfi: cmdset_0001: Do not allow read/write to suspend erase block.
[6510bbc88e3258631831ade49033537081950605]
mtd: cfi: cmdset_0001: Workaround Micron Erase suspend bug.
[46a16a2283f9e678a4e26829175e0c37a5191860]
mtd: cfi: cmdset_0002: Do not allow read/write to suspend erase block.
[7b70eb14392a7cf505f9b358d06c33b5af73d1e7]
Joe Jin (1):
xen-swiotlb: fix the check condition for xen_swiotlb_free_coherent
[4855c92dbb7b3b85c23e88ab7ca04f99b9677b41]
Joerg Roedel (1):
x86/mm: Prevent kernel Oops in PTDUMP code with HIGHPTE=y
[d6ef1f194b7569af8b8397876dc9ab07649d63cb]
Johan Hovold (2):
USB: serial: cp210x: add ELDAT Easywave RX09 id
[1f1e82f74c0947e40144688c9e36abe4b3999f49]
rfkill: gpio: fix memory leak in probe error path
[4bf01ca21e2e0e4561d1a03c48c3d740418702db]Jonathan Neuschäfer (1):
net: core: dst: Add kernel-doc for 'net' parameter
[8eb1a8590f5ca114fabf16ebb26a4bce0255ace9]
Julian Anastasov (3):
ipv4: fix fnhe usage by non-cached routes
[94720e3aee6884d8c8beb678001629da60ec6366]
ipvs: fix buffer overflow with sync daemon and service
[52f96757905bbf0edef47f3ee6c7c784e7f8ff8a]
ipvs: fix stats update from local clients
[d5e032fc5697b6c0d6b4958bcacb981a08f8174e]
Julian Wiedmann (5):
s390/qdio: don't merge ERROR output buffers
[0cf1e05157b9e5530dcc3ca9fec9bf617fc93375]
s390/qdio: don't release memory in qdio_setup_irq()
[2e68adcd2fb21b7188ba449f0fab3bee2910e500]
s390/qdio: don't retry EQBS after CCQ 96
[dae55b6fef58530c13df074bcc182c096609339e]
s390/qdio: fix access to uninitialized qdio_q fields
[e521813468f786271a87e78e8644243bead48fad]
s390/qeth: handle failure on workqueue creation
[a936b1ef37ce1e996533878f4b23944f9444dcdf]
Kai-Heng Feng (2):
sky2: Increase D3 delay to sky2 stops working after suspend
[afb133637071be6deeb8b3d0e55593ffbf63c527]
xhci: Fix USB ports for Dell Inspiron 5775
[621faf4f6a181b6e012c1d1865213f36f4159b7f]
Kamil Lulko (1):
usb: core: Add quirk for HP v222w 16GB Mini
[3180dabe08e3653bf0a838553905d88f3773f29c]
Kenny Yu (1):
uprobe: Find last occurrence of ':' when parsing uprobe PATH:OFFSET
[6496bb72bf20c1c7e4d6be44dfa663163e709116]
Kirill A. Shutemov (1):
ipc/shm: handle removed segments gracefully in shm_mmap()
[1ac0b6dec656f3f78d1c3dd216fad84cb4d0a01e]
Krzysztof Mazur (1):
um: Use POSIX ucontext_t instead of struct ucontext
[4d1a535b8ec5e74b42dfd9dc809142653b2597f6]
Kyle Roeschley (1):
USB: serial: cp210x: add ID for NI USB serial console
[1e23aace21515a8f7615a1de016c0ea8d4e0cc6e]Lance Richardson (1):
net: support compat 64-bit time in {s,g}etsockopt
[988bf7243e03ef69238381594e0334a79cef74a6]
Leon Romanovsky (1):
RDMA/mlx5: Protect from shift operand overflow
[002bf2282b2d7318e444dca9ffcb994afc5d5f15]
Leonard Crestez (1):
crypto: arm,arm64 - Fix random regeneration of S_shipped
[6aaf49b495b446ff6eec0ac983f781ca0dc56a73]
Li RongQing (1):
x86/apic: Fix signedness bug in APIC ID validity checks
[a774635db5c430cbf21fa5d2f2df3d23aaa8e782]
Linus Lüssing (1):
batman-adv: Fix TT sync flags for intermediate TT responses
[7072337e52b3e9d5460500d8dc9cbc1ba2db084c]
Linus Torvalds (3):
give up on gcc ilog2() constant optimizations
[474c90156c8dcc2fa815e6716cc9394d7930cb9c]
mmap: introduce sane default mmap limits
[be83bbf806822b1b89e0a0f23cd87cddc409e429]
mmap: relax file size limit for regular files
[423913ad4ae5b3e8fb8983f70969fb522261ba26]
Liu Bo (3):
Btrfs: bail out on error during replay_dir_deletes
[b98def7ca6e152ee55e36863dddf6f41f12d1dc6]
Btrfs: fix NULL pointer dereference in log_dir_items
[80c0b4210a963e31529e15bf90519708ec947596]
Btrfs: fix unexpected cow in run_delalloc_nocow
[5811375325420052fcadd944792a416a43072b7f]
Long Li (1):
cifs: Allocate validate negotiation request through kmalloc
[2796d303e3c5ec213c578ed3a66872205c126eb8]
Maciej W. Rozycki (3):
MIPS: Fix ptrace(2) PTRACE_PEEKUSR and PTRACE_POKEUSR accesses to o32 FGRs
[9a3a92ccfe3620743d4ae57c987dc8e9c5f88996]
MIPS: ptrace: Expose FIR register through FP regset
[71e909c0cdad28a1df1fa14442929e68615dee45]
MIPS: ptrace: Fix PTRACE_PEEKUSR requests for 64-bit FGRs
[c7e814628df65f424fe197dde73bfc67e4a244d7]
Mahesh Rajashekhara (1):
scsi: sd: Defer spinning up drive while SANITIZE is in progress
[505aa4b6a8834a2300971c5220c380c3271ebde3]
Major Hayden (1):
USB: serial: ftdi_sio: add RT Systems VX-8 cable
[9608e5c0f079390473b484ef92334dfd3431bb89]
Marc Dionne (1):
afs: Ignore AFS_ACE_READ and AFS_ACE_WRITE for directories
[fd2498211a551fd42b2d6b9050d649d43536e75c]
Marc Zyngier (1):
KVM: arm/arm64: Close VMID generation race
[f0cf47d939d0b4b4f660c5aaa4276fa3488f3391]
Marek Lindner (1):
batman-adv: prevent TT request storms by not sending inconsistent TT TLVLs
[16116dac23396e73c01eeee97b102e4833a4b205]
Mark Brown (1):
regmap: Support bulk reads for devices without raw formatting
[d5b98eb12420ce856caaf57dc5256eedc56a3747]
Markus Elfring (2):
tracing: Deletion of an unnecessary check before iput()
[16a8ef2751801346f1f76a18685b2beb63cd170f]
video/fbdev/stifb: Return -ENOMEM after a failed kzalloc() in stifb_init_fb()
[f9815f945aff2204b8afbbb9d2182024eb44a194]
Martin K. Petersen (1):
scsi: mptsas: Disable WRITE SAME
[94e5395d2403c8bc2504a7cbe4c4caaacb7b8b84]
Martin Kelly (2):
iio:buffer: make length types match kfifo types
[c043ec1ca5baae63726aae32abbe003192bc6eec]
iio:kfifo_buf: check for uint overflow
[3d13de4b027d5f6276c0f9d3a264f518747d83f2]
Masami Hiramatsu (3):
ARM: 8771/1: kprobes: Prohibit kprobes on do_undefinstr
[eb0146daefdde65665b7f076fbff7b49dade95b9]
ARM: 8772/1: kprobes: Prohibit kprobes on get_user functions
[0d73c3f8e7f6ee2aab1bb350f60c180f5ae21a2c]
tracing/uprobe_event: Fix strncpy corner case
[50268a3d266ecfdd6c5873d62b2758d9732fc598]
Mathieu Desnoyers (1):
tracepoint: Do not warn on ENOMEM
[d66a270be3310d7aa132fec0cea77d3d32a0ff75]
Matt Redfearn (4):
MIPS: memset.S: EVA & fault support for small_memset
[8a8158c85e1e774a44fbe81106fa41138580dfd1]
MIPS: memset.S: Fix clobber of v1 in last_fixup
[c96eebf07692e53bf4dd5987510d8b550e793598]
MIPS: memset.S: Fix return of __clear_user from Lpartial_fixup
[daf70d89f80c6e1772233da9e020114b1254e7e0]
MIPS: uaccess: Add micromips clobbers to bzero invocation
[b3d7e55c3f886493235bfee08e1e5a4a27cbcce8]
Matthew Auld (1):
drm/i915/userptr: reject zero user_size
[c11c7bfd213495784b22ef82a69b6489f8d0092f]
Matthew Wilcox (1):
mm/filemap.c: fix NULL pointer in page_cache_tree_insert()
[abc1be13fd113ddef5e2d807a466286b864caed3]
Mauro Carvalho Chehab (1):
media: v4l2-compat-ioctl32: don't oops on overlay
[85ea29f19eab56ec16ec6b92bc67305998706afa]
Michael Ellerman (1):
powerpc/lib: Fix off-by-one in alternate feature patching
[b8858581febb050688e276b956796bc4a78299ed]
Michael Neuling (3):
powerpc/64s: Clear PCR on boot
[faf37c44a105f3608115785f17cbbf3500f8bc71]
powerpc/eeh: Fix enabling bridge MMIO windows
[13a83eac373c49c0a081cbcd137e79210fe78acd]
powerpc/eeh: Fix race with driver un/bind
[f0295e047fcf52ccb42561fb7de6942f5201b676]
Michael S. Tsirkin (6):
virtio: add ability to iterate over vqs
[24a7e4d20783c0514850f24a5c41ede46ab058f0]
virtio_console: don't tie bufs to a vq
[2855b33514d290c51d52d94e25d3ef942cd4d578]
virtio_console: drop custom control queue cleanup
[61a8950c5c5708cf2068b29ffde94e454e528208]
virtio_console: free buffers after reset
[a7a69ec0d8e4a58be7db88d33cbfa2912807bb2b]
virtio_console: move removal code
[aa44ec867030a72e8aa127977e37dec551d8df19]
virtio_console: reset on out of memory
[5c60300d68da32ca77f7f978039dc72bfc78b06b]
Michal Srb (1):
drm/i915/cmdparser: Do not check past the cmd length.
[3aec7f871c65eb5f76b4125fda432593c834a6f2]
Mika Westerberg (2):
ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status()
[13d3047c81505cc0fb9bdae7810676e70523c8bf]
ahci: Add PCI ID for Cannon Lake PCH-LP AHCI
[4544e403eb25552aed7f0ee181a7a506b8800403]
Mike Frysinger (1):
vt: change SGR 21 to follow the standards
[65d9982d7e523a1a8e7c9af012da0d166f72fc56]
Mike Galbraith (1):
sched/autogroup: Fix 64-bit kernel nice level adjustment
[83929cce95251cc77e5659bf493bd424ae0e7a67]
Mike Kravetz (1):
hugetlbfs: fix bug in pgoff overflow checking
[5df63c2a149ae65a9ec239e7c2af44efa6f79beb]
Mikhail Lappo (1):
thermal: imx: Fix race condition in imx_thermal_probe()
[cf1ba1d73a33944d8c1a75370a35434bf146b8a7]
Moshe Shemesh (1):
net/mlx4_en: Verify coalescing parameters are in range
[6ad4e91c6d796b38a7f0e724db1de28eeb122bad]
Nicholas Piggin (5):
powerpc/64: Fix smp_wmb barrier definition use use lwsync consistently
[0bfdf598900fd62869659f360d3387ed80eb71cf]
powerpc/powernv: Fix NVRAM sleep in invalid context when crashing
[c1d2a31397ec51f0370f6bd17b19b39152c263cb]
powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops
[3b8070335f751aac9f1526ae2e012e6f5b8b0f21]
powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write()
[741de617661794246f84a21a02fc5e327bffc9ad]
powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops
[34dd25de9fe3f60bfdb31b473bf04b28262d0896]
Nico Sneck (1):
drm/radeon: add PX quirk for Asus K73TK
[b1550359d1eb392ee54f7cf47cffcfe0a602f6a7]
Nicolas Dichtel (1):
ip_tunnel: restore binding to ifaces with a large mtu
[82612de1c98e610d194e34178bde3cca7dedce41]
Nicolas Ferre (1):
ARM: dts: at91: at91sam9g25: fix mux-mask pinctrl property
[e8fd0adf105e132fd84545997bbef3d5edc2c9c1]
Nicolin Chen (1):
ASoC: fsl_esai: Fix divisor calculation failure at lower ratio
[c656941df9bc80f7ec65b92ca73c42f8b0b62628]
Nikolay Borisov (3):
btrfs: Fix possible softlock on single core machines
[1e1c50a929bc9e49bc3f9935b92450d9e69f8158]
btrfs: Handle error from btrfs_uuid_tree_rem call in _btrfs_ioctl_set_received_subvol
[d87ff75863e92a500538ab53318c5740f196631e]
btrfs: Refactor transaction handling in received subvolume ioctl
[efd38150af45375b46576d0110a323d7fab7e142]
Ondrej Zary (2):
Input: i8042 - enable MUX on Sony VAIO VGN-CS series to fix touchpad
[04bb1719c4de94700056241d4c0fe3c1413f5aff]
drm/i915: Disable LVDS on Radiant P845
[7f7105f99b75aca4f8c2a748ed6b82c7f8be3293]
Paolo Abeni (2):
netfilter: ebtables: handle string from userspace with care
[94c752f99954797da583a84c4907ff19e92550a4]
team: avoid adding twice the same option to the event list
[4fb0534fb7bbc2346ba7d3a072b538007f4135a5]
Paul Parsons (1):
drm/radeon: Fix PCIe lane width calculation
[85e290d92b4b794d0c758c53007eb4248d385386]
Peng Hao (1):
kvm: x86: fix a compile warning
[3140c156e919b0f5fad5c5f6cf7876c39d1d4f06]
Peter Rosin (3):
i2c: pmcmsp: fix error return from master_xfer
[12d9bbc5a7f347eaa65ff2a9d34995cadc05eb1b]
i2c: pmcmsp: return message count on master_xfer success
[de9a8634f1cb4560a35696d472cc7f1383d9b866]
i2c: viperboard: return message count on master_xfer success
[35cd67a0caf767aba472452865dcb4471fcce2b1]
Peter Zijlstra (5):
clocksource: Initialize cs->wd_list
[5b9e886a4af97574ca3ce1147f35545da0e7afc7]
perf/x86: Fix possible Spectre-v1 indexing for hw_perf_event cache_*
[ef9ee4ad38445a30909c48998624861716f2a994]
perf/x86: Fix possible Spectre-v1 indexing for x86_pmu::event_map()
[46b1b577229a091b137831becaa0fae8690ee15a]
sched/autogroup: Fix possible Spectre-v1 indexing for sched_prio_to_weight[]
[354d7793070611b4df5a79fbb0f12752d0ed0cc5]
sched/core: Fix possible Spectre-v1 indexing for sched_prio_to_weight[]
[7281c8dec8a87685cb54d503d8cceef5a0fc2fdd]Piaojun (1):
ocfs2/dlm: wait for dlm recovery done when migrating all lock resources
[60c7ec9ee4a3410c2cb08850102d363c7e207f48]
Prakash Kamliya (1):
drm/msm: fix leak in failed get_pages
[62e3a3e342af3c313ab38603811ecdb1fcc79edb]
Qu Wenruo (1):
btrfs: tests/qgroup: Fix wrong tree backref level
[3c0efdf03b2d127f0e40e30db4e7aa0429b1b79a]
Raju Rangoju (1):
RDMA/cxgb4: release hw resources on device removal
[26bff1bd74a4f7417509a83295614e9dab995b2a]
Rasmus Villemoes (1):
drivers: tty: Merge alloc_tty_struct and initialize_tty_struct
[2c964a2f4191f2229566895f1a0e85f8339f5dd1]
Ravi Chandra Sadineni (1):
USB: Increment wakeup count on remote wakeup.
[83a62c51ba7b3c0bf45150c4eac7aefc6c785e94]
Richard Weinberger (2):
ubi: Reject MLC NAND
[b5094b7f135be34630e3ea8a98fa215715d0f29d]
ubifs: Check ubifs_wbuf_sync() return code
[aac17948a7ce01fb60b9ee6cf902967a47b3ce26]
Robbie Ko (1):
Btrfs: send, fix invalid access to commit roots due to concurrent snapshotting
[6f2f0b394b54e2b159ef969a0b5274e9bbf82ff2]
Rodrigo Rivas Costa (1):
HID: hidraw: Fix crash on HIDIOCGFEATURE with a destroyed device
[a955358d54695e4ad9f7d6489a7ac4d69a8fc711]
Roland Dreier (3):
RDMA/ucma: Allow resolving address w/o specifying source address
[09abfe7b5b2f442a85f4c4d59ecf582ad76088d7]
RDMA/ucma: Don't allow setting RDMA_OPTION_IB_PATH without an RDMA device
[8435168d50e66fa5eae01852769d20a36f9e5e83]
RDMA/ucma: Introduce safer rdma_addr_size() variants
[84652aefb347297aa08e91e283adf7b18f77c2d5]
Romain Izard (1):
ubi: Fix error for write access
[78a8dfbabbece22bee58ac4cb26cab10e7a19c5d]
Ronnie Sahlberg (1):
cifs: fix memory leak in SMB2_open()
[b7a73c84eb96dabd6bb8e9d7c56f796d83efee8e]
Russell King (1):
ARM: keystone: fix platform_domain_notifier array overrun
[9954b80b8c0e8abc98e17bba0fccd9876211ceaa]
SZ Lin (1):
NET: usb: qmi_wwan: add support for ublox R410M PID 0x90b2
[9306b38e42cb266f98bff6f6f4c1c652aa79ba45]Sachin Grover (1):
selinux: KASAN: slab-out-of-bounds in xattr_getsecurity
[efe3de79e0b52ca281ef6691480c8c68c82a4657]
Sean Young (1):
media: rc: oops in ir_timer_keyup after device unplug
[8d4068810d9926250dd2435719a080b889eb44c3]
Sebastian Ott (1):
s390/cio: update chpid descriptor after resource accessibility event
[af2e460ade0b0180d0f3812ca4f4f59cc9597f3e]
Sekhar Nori (1):
ARM: davinci: board-dm646x-evm: set VPIF capture card name
[bb7298a7e87cf3430eb62be8746e5d7a07ca9d7c]
Sergei Shtylyov (1):
drm: rcar-du: lvds: Fix LVDS startup on R-Car Gen2
[8525d04ba8a6a9ecfa4bd619c988ca873a5fc2a4]
Shamir Rabinovitch (1):
RDMA/ucma: ucma_context reference leak in error path
[ef95a90ae6f4f21990e1f7ced6719784a409e811]
Shuah Khan (2):
usbip: vhci_hcd: Fix usb device and sockfd leaks
[9020a7efe537856eb3e826ebebdf38a5d07a7857]
usbip: vhci_hcd: check rhport before using in vhci_hub_control()
[5b22f676118ff25049382041da0db8012e57c9e8]
Song Liu (1):
tracing: Fix bad use of igrab in trace_uprobe.c
[0c92c7a3c5d416f47b32c5f20a611dfeca5d5f2e]
Stefan Brüns (1):
drm/i915: Try EDID bitbanging on HDMI after failed read
[cfb926e148e99acc02351d72e8b85e32b5f786ef]
Stefan Haberland (1):
s390/dasd: fix IO error for newly defined devices
[5d27a2bf6e14f5c7d1033ad1e993fcd0eba43e83]
Steve French (2):
cifs: do not allow creating sockets except with SMB1 posix exensions
[1d0cffa674cfa7d185a302c8c6850fc50b893bed]
smb3: directory sync should not return an error
[6e70c267e68d77679534dcf4aaf84e66f2cf1425]
Steven Rostedt (3):
tracing/x86/xen: Remove zero data size trace events trace_xen_mmu_flush_tlb{_all}
[45dd9b0666a162f8e4be76096716670cf1741f0e]
tracing: Fix crash when freeing instances with event triggers
[86b389ff22bd6ad8fd3cb98e41cd271886c6d023]
tracing: Fix regex_match_front() to not over compare the test string
[dc432c3d7f9bceb3de6f5b44fb9c657c9810ed6d]Sudhir Sreedharan (1):
rtl8187: Fix NULL pointer dereference in priv->conf_mutex
[7972326a26b5bf8dc2adac575c4e03ee7e9d193a]Sudip Mukherjee (1):
libata: blacklist Micron 500IT SSD with MU01 firmware
[136d769e0b3475d71350aa3648a116a6ee7a8f6c]
Sven Eckelmann (1):
batman-adv: Avoid race in TT TVLV allocator helper
[8ba0f9bd3bdea1058c2b2676bec7905724418e40]
Takashi Iwai (21):
ALSA: aloop: Add missing cable lock to ctl API callbacks
[76b3421b39bd610546931fc923edcf90c18fa395]
ALSA: asihpi: Hardening for potential Spectre v1
[f9d94b57e30fd1575b4935045b32d738668aa74b]
ALSA: control: Hardening for potential Spectre v1
[088e861edffb84879cf0c0d1b02eda078c3a0ffe]
ALSA: hda: Hardening for potential Spectre v1
[69fa6f19b95597618ab30438a27b67ad93daa7c7]
ALSA: hdspm: Hardening for potential Spectre v1
[10513142a7114d251670361ad40cba2c61403406]
ALSA: opl3: Hardening for potential Spectre v1
[7f054a5bee0987f1e2d4e59daea462421c76f2cb]
ALSA: pcm: Avoid potential races between OSS ioctls and read/write
[02a5d6925cd34c3b774bdb8eefb057c40a30e870]
ALSA: pcm: Check PCM state at xfern compat ioctl
[f13876e2c33a657a71bcbb10f767c0951b165020]
ALSA: pcm: Fix UAF at PCM release via PCM timer access
[a820ccbe21e8ce8e86c39cd1d3bc8c7d1cbb949b]
ALSA: pcm: Fix endless loop for XRUN recovery in OSS emulation
[e15dc99dbb9cf99f6432e8e3c0b3a8f7a3403a86]
ALSA: pcm: Fix mutex unbalance in OSS emulation ioctls
[f6d297df4dd47ef949540e4a201230d0c5308325]
ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams
[40cab6e88cb0b6c56d3f30b7491a20e803f948f6]
ALSA: pcm: Use ERESTARTSYS instead of EINTR in OSS emulation
[c64ed5dd9feba193c76eb460b451225ac2a0d87b]
ALSA: rawmidi: Fix missing input substream checks in compat ioctls
[8a56ef4f3ffba9ebf4967b61ef600b0a7ba10f11]
ALSA: rme9652: Hardening for potential Spectre v1
[f526afcd8f71945c23ce581d7864ace93de8a4f7]
ALSA: seq: Fix races at MIDI encoding in snd_virmidi_output_trigger()
[8f22e52528cc372b218b5f100457469615c733ce]
ALSA: seq: oss: Fix unbalanced use lock for synth MIDI device
[f5e94b4c6ebdabe0f602d796e0430180927521a0]
ALSA: seq: oss: Hardening for potential Spectre v1
[8d218dd8116695ecda7164f97631c069938aa22e]
ALSA: timer: Call notifier in the same spinlock
[f65e0d299807d8a11812845c972493c3f9a18e10]
ALSA: usb-audio: Skip broken EU on Dell dock USB-audio
[1d8d6428d1da642ddd75b0be2d1bb1123ff8e017]
resource: fix integer overflow at reallocation
[60bb83b81169820c691fbfa33a6a4aef32aa4b0b]
Tarick Bedeir (1):
net/mlx4_core: Fix error handling in mlx4_init_port_info.
[57f6f99fdad9984801cde05c1db68fe39b474a10]
Tejun Heo (1):
libata: Blacklist some Sandisk SSDs for NCQ
[322579dcc865b94b47345ad1b6002ad167f85405]
Tetsuo Handa (4):
tty: Avoid possible error pointer dereference at tty_ldisc_restore().
[598c2d41ff44889dd8eced4f117403e472158d85]
tty: Don't call panic() at tty_ldisc_init()
[903f9db10f18f735e62ba447147b6c434b6af003]
tty: Use __GFP_NOFAIL for tty_ldisc_get()
[bcdd0ca8cb8730573afebcaae4138f8f4c8eaa20]
x86/kexec: Avoid double free_page() upon do_kexec_load() failure
[a466ef76b815b86748d9870ef2a430af7b39c710]
Theodore Ts'o (6):
ext4: add bounds checking to ext4_xattr_find_entry()
[9496005d6ca4cf8f5ee8f828165a8956872dc59d]
ext4: add extra checks to ext4_xattr_block_get()
[54dd0e0a1b255f115f8647fc6fb93273251b01b9]
ext4: don't update checksum of new initialized bitmaps
[044e6e3d74a3d7103a0c8a9305dfd94d64000660]
ext4: force revalidation of directory pointer after seekdir(2)
[e40ff213898502d299351cc2fe1e350cd186f0d3]
ext4: set h_journal if there is a failure starting a reserved handle
[b2569260d55228b617bd82aba6d0db2faeeb4116]
jbd2: if the journal is aborted then don't allow update of the log tail
[85e0c4e89c1b864e763c4e3bb15d0b6d501ad5d9]
Thinh Nguyen (1):
usb: dwc3: pci: Properly cleanup resource
[cabdf83dadfb3d83eec31e0f0638a92dbd716435]
Tony Lindgren (1):
net: davinci_emac: Fix runtime pm calls for davinci_emac
[b5133e7a988b2cf8e1cd2b23231f36aff35ceffc]
Toshiaki Makita (1):
vlan: Fix reading memory beyond skb->tail in skb_vlan_tagged_multi
[7ce2367254e84753bceb07327aaf5c953cfce117]Uwe Kleine-König (1):
serial: altera: ensure port->regshift is honored consistently
[0e254963b6ba4d63ac911e79537fea38dd03dc50]Vasily Gorbik (1):
s390/ipl: ensure loadparm valid flag is set
[15deb080a6087b73089139569558965750e69d67]
Vasyl Vavrychuk (1):
USB: serial: ftdi_sio: use jtag quirk for Arrow USB Blaster
[470b5d6f0cf4674be2d1ec94e54283a1770b6a1a]
Wei Huang (1):
KVM: x86: Update cpuid properly when CR4.OSXAVE or CR4.PKE is changed
[c4d2188206bafa177ea58e9a25b952baa0bf7712]
Wenwen Wang (1):
ALSA: control: fix a redundant-copy issue
[3f12888dfae2a48741c4caa9214885b3aaf350f9]
Willem de Bruijn (2):
net: test tailroom before appending to linear skb
[113f99c3358564a0647d444c2ae34e8b1abfd5b9]
packet: fix bitfield update race
[a6361f0ca4b25460f2cdf3235ebe8115f622901e]
Wolfgang Bumiller (1):
net: fix deadlock while clearing neighbor proxy table
[53b76cdf7e8fecec1d09e38aad2f8579882591a8]
Xiaoming Gao (1):
x86/tsc: Prevent 32bit truncation in calc_hpet_ref()
[d3878e164dcd3925a237a20e879432400e369172]
Xin Long (5):
bonding: do not set slave_dev npinfo before slave_enable_netpoll in bond_enslave
[ddea788c63094f7c483783265563dd5b50052e28]
sctp: do not check port in sctp_inet6_cmp_addr
[1071ec9d453a38023579714b64a951a2fb982071]
sctp: fix the issue that the cookie-ack with auth can't get processed
[ce402f044e4e432c296f90eaabb8dbe8f3624391]
sctp: handle two v4 addrs comparison in sctp_inet6_cmp_addr
[d625329b06e46bd20baf9ee40847d11982569204]
team: fix netconsole setup over team
[9cf2f437ca5b39828984064fad213e68fc17ef11]
Yazen Ghannam (1):
x86/smpboot: Don't use mwait_play_dead() on AMD systems
[da6fa7ef67f07108a1b0cb9fd9e7fcaabd39c051]
Yishai Hadas (1):
RDMA/mlx5: Don't assume that medium blueFlame register exists
[18b0362e87dfa09e355093b897b9db854e360d28]
Zheng Yan (1):
ceph: always update atime/mtime/ctime for new inode
[ffdeec7aa41aa61ca4ee68fddf4669df9ce661d1]
Zhengjun Xing (1):
USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
[64627388b50158fd24d6ad88132525b95a5ef573]
Łukasz Stelmach (1):
ARM: 8753/1: decompressor: add a missing parameter to the addruart macro
[e07e3c33b9c0b5751ade624f44325c9bf2487ea6]
Documentation/networking/ppp_generic.txt | 6 - Makefile | 4 +- arch/arc/include/asm/Kbuild | 1 + arch/arm/boot/compressed/head.S | 16 +- arch/arm/boot/compressed/misc.c | 9 +- arch/arm/boot/dts/at91sam9g25.dtsi | 2 +- arch/arm/crypto/Makefile | 2 + arch/arm/include/asm/assembler.h | 10 + arch/arm/kernel/traps.c | 5 +- arch/arm/kvm/arm.c | 15 +- arch/arm/lib/getuser.S | 4 + arch/arm/mach-davinci/board-dm646x-evm.c | 3 +- arch/arm/mach-keystone/pm_domain.c | 1 + arch/avr32/include/asm/Kbuild | 1 + arch/blackfin/include/asm/Kbuild | 1 + arch/c6x/include/asm/Kbuild | 1 + arch/cris/include/asm/Kbuild | 1 + arch/frv/include/asm/Kbuild | 1 + arch/hexagon/include/asm/Kbuild | 1 + arch/ia64/include/asm/Kbuild | 1 + arch/m32r/include/asm/Kbuild | 1 + arch/metag/include/asm/Kbuild | 1 + arch/microblaze/include/asm/Kbuild | 1 + arch/mips/include/asm/Kbuild | 1 + arch/mips/include/asm/uaccess.h | 11 +- arch/mips/kernel/ptrace.c | 24 ++- arch/mips/kernel/ptrace32.c | 6 +- arch/mips/kvm/kvm_mips.c | 2 +- arch/mips/lib/memset.S | 11 +- arch/mn10300/include/asm/Kbuild | 1 + arch/parisc/kernel/drivers.c | 4 + arch/parisc/kernel/hpmc.S | 6 +- arch/powerpc/include/asm/barrier.h | 3 +- arch/powerpc/include/asm/opal.h | 3 + arch/powerpc/include/asm/synch.h | 4 - arch/powerpc/kernel/cpu_setup_power.S | 4 + arch/powerpc/kernel/eeh_driver.c | 61 ++++-- arch/powerpc/kernel/eeh_pe.c | 3 +- arch/powerpc/lib/feature-fixups.c | 2 +- arch/powerpc/mm/hugetlbpage.c | 17 +- arch/powerpc/platforms/powernv/opal-nvram.c | 21 +- arch/s390/hypfs/inode.c | 2 +- arch/s390/include/asm/Kbuild | 1 + arch/s390/kernel/ipl.c | 1 + arch/s390/kernel/perf_cpum_sf.c | 4 + arch/score/include/asm/Kbuild | 1 + arch/tile/include/asm/Kbuild | 1 + arch/um/include/asm/Kbuild | 1 + arch/um/os-Linux/signal.c | 2 +- arch/unicore32/include/asm/Kbuild | 1 + arch/x86/boot/compressed/eboot.c | 6 +- arch/x86/crypto/cast5_avx_glue.c | 3 +- arch/x86/include/asm/apic.h | 4 +- arch/x86/include/asm/x2apic.h | 2 +- arch/x86/kernel/acpi/boot.c | 18 +- arch/x86/kernel/apic/apic_numachip.c | 2 +- arch/x86/kernel/apic/x2apic_uv_x.c | 2 +- arch/x86/kernel/cpu/perf_event.c | 8 +- arch/x86/kernel/machine_kexec_32.c | 6 +- arch/x86/kernel/machine_kexec_64.c | 4 +- arch/x86/kernel/smpboot.c | 2 + arch/x86/kernel/tsc.c | 2 +- arch/x86/kvm/x86.c | 7 +- arch/x86/mm/dump_pagetables.c | 10 +- arch/x86/net/bpf_jit_comp.c | 3 +- arch/x86/um/stub_segv.c | 2 +- arch/x86/xen/mmu.c | 6 +- arch/xtensa/include/asm/Kbuild | 1 + crypto/af_alg.c | 8 +- crypto/ahash.c | 7 +- drivers/ata/ahci.c | 1 + drivers/ata/libata-core.c | 8 + drivers/atm/zatm.c | 3 + drivers/base/regmap/regmap.c | 22 +- drivers/char/virtio_console.c | 157 +++++++------- drivers/gpu/drm/drm_fops.c | 1 + drivers/gpu/drm/i915/i915_cmd_parser.c | 80 ++++--- drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/i915_gem_userptr.c | 3 + drivers/gpu/drm/i915/intel_hdmi.c | 14 +- drivers/gpu/drm/i915/intel_lvds.c | 11 +- drivers/gpu/drm/msm/msm_gem.c | 30 ++- drivers/gpu/drm/radeon/radeon_device.c | 15 +- drivers/gpu/drm/radeon/si_dpm.c | 4 +- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 10 +- drivers/hid/hid-core.c | 12 +- drivers/hid/hidraw.c | 5 + drivers/hid/i2c-hid/i2c-hid.c | 13 +- drivers/hwmon/nct6683.c | 4 +- drivers/hwmon/nct6775.c | 10 +- drivers/hwmon/pmbus/adm1275.c | 4 +- drivers/hwmon/pmbus/max8688.c | 2 +- drivers/i2c/busses/i2c-pmcmsp.c | 4 +- drivers/i2c/busses/i2c-viperboard.c | 2 +- drivers/iio/kfifo_buf.c | 11 +- drivers/infiniband/core/addr.c | 16 ++ drivers/infiniband/core/iwpm_util.c | 5 +- drivers/infiniband/core/ucma.c | 43 ++-- drivers/infiniband/hw/cxgb4/cq.c | 11 +- drivers/infiniband/hw/cxgb4/device.c | 8 + drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 6 +- drivers/infiniband/hw/cxgb4/qp.c | 4 +- drivers/infiniband/hw/cxgb4/resource.c | 26 ++- drivers/infiniband/hw/mlx5/qp.c | 39 ++-- drivers/infiniband/ulp/srp/ib_srp.c | 8 +- drivers/input/serio/i8042-x86ia64io.h | 24 +++ drivers/media/pci/cx25821/cx25821-core.c | 7 +- drivers/media/platform/s3c-camif/camif-capture.c | 7 +- drivers/media/rc/rc-main.c | 4 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 +- drivers/message/fusion/mptsas.c | 1 + drivers/mmc/host/jz4740_mmc.c | 2 +- drivers/mtd/chips/cfi_cmdset_0001.c | 33 ++- drivers/mtd/chips/cfi_cmdset_0002.c | 9 +- drivers/mtd/ubi/block.c | 2 +- drivers/mtd/ubi/build.c | 11 + drivers/net/bonding/bond_main.c | 3 +- drivers/net/can/usb/kvaser_usb.c | 2 +- drivers/net/ethernet/broadcom/bcmsysport.c | 11 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 11 +- drivers/net/ethernet/cisco/enic/enic_main.c | 8 +- drivers/net/ethernet/marvell/sky2.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 16 ++ drivers/net/ethernet/mellanox/mlx4/main.c | 4 +- drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 7 +- drivers/net/ethernet/mellanox/mlx4/qp.c | 4 +- drivers/net/ethernet/ti/cpsw.c | 13 +- drivers/net/ethernet/ti/davinci_cpdma.c | 2 +- drivers/net/ethernet/ti/davinci_emac.c | 62 ++++-- drivers/net/ppp/ppp_generic.c | 136 +++++++----- drivers/net/ppp/pppoe.c | 4 + drivers/net/team/team.c | 38 +++- drivers/net/usb/qmi_wwan.c | 13 ++ drivers/net/vmxnet3/vmxnet3_drv.c | 137 ++++++++---- drivers/net/vmxnet3/vmxnet3_int.h | 8 +- drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +- drivers/parport/parport_pc.c | 4 + drivers/pci/hotplug/acpiphp_glue.c | 23 +- drivers/pci/quirks.c | 13 ++ drivers/pinctrl/pinctrl-single.c | 22 +- drivers/rtc/rtc-snvs.c | 15 +- drivers/rtc/rtc-tx4939.c | 6 +- drivers/s390/block/dasd_alias.c | 16 +- drivers/s390/cio/chsc.c | 14 +- drivers/s390/cio/qdio_main.c | 42 ++-- drivers/s390/cio/qdio_setup.c | 12 +- drivers/s390/net/qeth_core_main.c | 8 +- drivers/s390/scsi/zfcp_dbf.c | 23 +- drivers/s390/scsi/zfcp_ext.h | 5 +- drivers/s390/scsi/zfcp_scsi.c | 14 +- drivers/scsi/qla2xxx/qla_init.c | 3 +- drivers/scsi/sd.c | 2 + drivers/staging/line6/midi.c | 2 +- drivers/staging/rtl8192u/r8192U_core.c | 2 + drivers/staging/usbip/usbip_common.h | 2 +- drivers/staging/usbip/vhci_hcd.c | 8 +- drivers/thermal/imx_thermal.c | 19 +- drivers/tty/Makefile | 3 +- drivers/tty/n_null.c | 80 +++++++ drivers/tty/pty.c | 19 +- drivers/tty/serial/altera_uart.c | 6 +- drivers/tty/serial/arc_uart.c | 8 +- drivers/tty/serial/fsl_lpuart.c | 4 + drivers/tty/serial/imx.c | 6 + drivers/tty/serial/mxs-auart.c | 5 + drivers/tty/serial/pxa.c | 4 + drivers/tty/serial/xilinx_uartps.c | 2 +- drivers/tty/tty_io.c | 42 ++-- drivers/tty/tty_ldisc.c | 68 +++--- drivers/tty/vt/vt.c | 6 +- drivers/usb/core/config.c | 4 +- drivers/usb/core/generic.c | 9 +- drivers/usb/core/hcd.c | 1 + drivers/usb/core/hub.c | 10 +- drivers/usb/core/quirks.c | 3 + drivers/usb/dwc3/dwc3-pci.c | 2 +- drivers/usb/host/xhci-pci.c | 5 +- drivers/usb/musb/musb_gadget_ep0.c | 14 +- drivers/usb/musb/musb_host.c | 4 +- drivers/usb/serial/Kconfig | 1 + drivers/usb/serial/cp210x.c | 2 + drivers/usb/serial/ftdi_sio.c | 5 +- drivers/usb/serial/ftdi_sio_ids.h | 9 + drivers/usb/serial/usb-serial-simple.c | 7 + drivers/usb/serial/visor.c | 69 +++--- drivers/video/fbdev/stifb.c | 2 +- drivers/watchdog/f71808e_wdt.c | 2 +- drivers/xen/swiotlb-xen.c | 2 +- drivers/xen/xen-acpi-processor.c | 6 +- fs/affs/namei.c | 10 +- fs/afs/security.c | 13 +- fs/aio.c | 7 +- fs/autofs4/root.c | 2 +- fs/btrfs/ctree.c | 16 +- fs/btrfs/extent-tree.c | 1 + fs/btrfs/inode.c | 231 +++++++++++++------- fs/btrfs/ioctl.c | 22 +- fs/btrfs/tests/qgroup-tests.c | 2 +- fs/btrfs/tree-log.c | 12 +- fs/buffer.c | 2 +- fs/ceph/inode.c | 10 +- fs/cifs/cifsfs.c | 13 ++ fs/cifs/dir.c | 9 +- fs/cifs/smb2pdu.c | 49 +++-- fs/dcache.c | 22 ++ fs/ecryptfs/inode.c | 3 +- fs/ext2/inode.c | 10 - fs/ext2/namei.c | 6 +- fs/ext3/namei.c | 6 +- fs/ext4/balloc.c | 3 +- fs/ext4/dir.c | 8 +- fs/ext4/ialloc.c | 43 +--- fs/ext4/indirect.c | 5 +- fs/ext4/namei.c | 6 +- fs/ext4/xattr.c | 86 +++++--- fs/ext4/xattr.h | 11 + fs/f2fs/f2fs.h | 1 + fs/f2fs/gc.c | 2 +- fs/f2fs/inode.c | 23 ++ fs/f2fs/namei.c | 52 ++--- fs/fs-writeback.c | 2 +- fs/hugetlbfs/inode.c | 10 +- fs/jbd2/journal.c | 5 +- fs/jbd2/transaction.c | 1 + fs/jffs2/dir.c | 12 +- fs/jffs2/super.c | 2 +- fs/jfs/namei.c | 12 +- fs/namespace.c | 3 +- fs/nilfs2/namei.c | 6 +- fs/notify/fanotify/fanotify.c | 34 ++- fs/ocfs2/dlm/dlmcommon.h | 1 + fs/ocfs2/dlm/dlmdomain.c | 15 ++ fs/ocfs2/dlm/dlmrecovery.c | 13 +- fs/proc/proc_sysctl.c | 3 + fs/reiserfs/journal.c | 2 +- fs/reiserfs/namei.c | 12 +- fs/ubifs/super.c | 14 +- fs/udf/ialloc.c | 7 +- fs/udf/namei.c | 106 ++++----- fs/ufs/ialloc.c | 6 +- fs/ufs/namei.c | 14 +- include/asm-generic/word-at-a-time.h | 80 ++++++- include/linux/clk-provider.h | 3 +- include/linux/dcache.h | 1 + include/linux/efi.h | 8 +- include/linux/hid.h | 4 +- include/linux/iio/buffer.h | 6 +- include/linux/log2.h | 13 +- include/linux/msg.h | 4 +- include/linux/mtd/flashchip.h | 1 + include/linux/shm.h | 4 +- include/linux/string.h | 3 + include/linux/tty.h | 6 +- include/linux/virtio.h | 3 + include/net/dst.h | 1 + include/net/inet_timewait_sock.h | 1 + include/net/nexthop.h | 2 +- include/rdma/ib_addr.h | 2 + include/sound/control.h | 7 +- include/sound/pcm_oss.h | 1 + include/trace/events/xen.h | 16 -- include/uapi/linux/ppp-ioctl.h | 2 +- include/uapi/linux/tty.h | 1 + ipc/msg.c | 19 +- ipc/msgutil.c | 2 +- ipc/sem.c | 38 ++-- ipc/shm.c | 116 +++++++--- ipc/util.c | 9 + ipc/util.h | 11 + kernel/resource.c | 3 +- kernel/sched/auto_group.c | 9 +- kernel/sched/core.c | 3 + kernel/sys.c | 4 + kernel/time/clocksource.c | 2 + kernel/time/tick-broadcast.c | 8 + kernel/trace/trace_events_filter.c | 3 + kernel/trace/trace_events_trigger.c | 5 +- kernel/trace/trace_uprobe.c | 32 ++- kernel/tracepoint.c | 4 +- lib/string.c | 88 ++++++++ mm/filemap.c | 7 +- mm/mmap.c | 32 +++ net/atm/lec.c | 9 +- net/batman-adv/translation-table.c | 93 ++++++-- net/bridge/netfilter/ebtables.c | 3 +- net/ceph/messenger.c | 7 + net/compat.c | 6 +- net/core/dev.c | 3 +- net/core/dev_addr_lists.c | 4 +- net/core/neighbour.c | 30 ++- net/core/skbuff.c | 1 + net/dccp/ccids/ccid2.c | 14 +- net/dccp/timer.c | 2 +- net/dns_resolver/dns_key.c | 14 +- net/ipv4/inet_timewait_sock.c | 1 + net/ipv4/ip_output.c | 3 +- net/ipv4/ip_tunnel.c | 17 +- net/ipv4/ping.c | 7 +- net/ipv4/route.c | 118 +++++----- net/ipv4/tcp.c | 8 +- net/ipv4/tcp_input.c | 7 +- net/ipv4/tcp_output.c | 7 +- net/ipv4/udp.c | 7 +- net/ipv6/ip6_gre.c | 8 +- net/ipv6/ip6_output.c | 3 +- net/ipv6/ip6_tunnel.c | 8 +- net/ipv6/ip6_vti.c | 7 +- net/ipv6/route.c | 2 + net/ipv6/sit.c | 8 +- net/ipv6/xfrm6_policy.c | 2 +- net/l2tp/l2tp_core.c | 260 ++++++++++------------- net/l2tp/l2tp_core.h | 7 +- net/l2tp/l2tp_debugfs.c | 18 +- net/l2tp/l2tp_netlink.c | 28 ++- net/l2tp/l2tp_ppp.c | 43 +++- net/llc/af_llc.c | 17 +- net/netfilter/ipvs/ip_vs_core.c | 8 + net/netfilter/ipvs/ip_vs_ctl.c | 15 +- net/netfilter/ipvs/ip_vs_sync.c | 10 +- net/netfilter/nf_tables_api.c | 59 ++--- net/netlink/af_netlink.c | 2 + net/packet/af_packet.c | 86 +++++--- net/packet/internal.h | 10 +- net/rfkill/rfkill-gpio.c | 7 +- net/sched/sch_fq.c | 37 ++-- net/sctp/inqueue.c | 2 +- net/sctp/ipv6.c | 65 +++--- net/sunrpc/rpc_pipe.c | 1 + security/selinux/ss/services.c | 2 +- sound/core/control_compat.c | 3 +- sound/core/oss/pcm_oss.c | 186 ++++++++++++---- sound/core/pcm.c | 8 +- sound/core/pcm_compat.c | 2 + sound/core/pcm_native.c | 1 + sound/core/rawmidi_compat.c | 18 +- sound/core/seq/oss/seq_oss_event.c | 15 +- sound/core/seq/oss/seq_oss_midi.c | 2 + sound/core/seq/oss/seq_oss_synth.c | 85 ++++---- sound/core/seq/oss/seq_oss_synth.h | 3 +- sound/core/seq/seq_virmidi.c | 4 +- sound/core/timer.c | 222 +++++++++---------- sound/drivers/aloop.c | 17 +- sound/drivers/opl3/opl3_synth.c | 7 +- sound/pci/asihpi/hpimsginit.c | 39 ++-- sound/pci/asihpi/hpioctl.c | 4 +- sound/pci/hda/hda_hwdep.c | 12 +- sound/pci/rme9652/hdspm.c | 24 ++- sound/pci/rme9652/rme9652.c | 6 +- sound/soc/codecs/ssm2602.c | 19 +- sound/soc/fsl/fsl_esai.c | 7 + sound/usb/mixer.c | 8 + sound/usb/mixer_maps.c | 3 + tools/perf/Documentation/perf-top.txt | 3 + tools/perf/builtin-record.c | 2 +- 354 files changed, 3603 insertions(+), 1941 deletions(-)
Signature · 2 lines
Ben Hutchings I haven't lost my mind; it's backed up on tape somewhere.
PATCH 1/366 drm/i915: Try EDID bitbanging on HDMI after failed read
3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Brüns <[email protected]>
commit cfb926e148e99acc02351d72e8b85e32b5f786ef upstream.
The ACK/NACK implementation as found in e.g. the G965 has the falling clock edge and the release of the data line after the ACK for the received byte happen at the same time.
This is conformant with the I2C specification, which allows a zero hold time, see footnote [3]: "A device must internally provide a hold time of at least 300 ns for the SDA signal (with respect to the V IH(min) of the SCL signal) to bridge the undefined region of the falling edge of SCL."
Some HDMI-to-VGA converters apparently fail to adhere to this requirement and latch SDA at the falling clock edge, so instead of an ACK sometimes a NACK is read and the slave (i.e. the EDID ROM) ends the transfer.
The bitbanging releases the data line for the ACK only 1/4 bit time after the falling clock edge, so a slave will see the correct value no matter if it samples at the rising or the falling clock edge or in the center.
Fallback to bitbanging is already done for the CRT connector.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92685
--- drivers/gpu/drm/i915/intel_hdmi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +11 -3
@@ -971,6 +971,7 @@ intel_hdmi_detect(struct drm_connector *struct edid *edid;enum intel_display_power_domain power_domain;enum drm_connector_status status = connector_status_disconnected; +struct i2c_adapter *i2c;DRM_DEBUG_KMS ("[CONNECTOR:%d:%s]\n" , connector->base.id, connector->name);
@@ -981,9 +982,16 @@ intel_hdmi_detect(struct drm_connector * intel_hdmi->has_hdmi_sink = false; intel_hdmi->has_audio = false; intel_hdmi->rgb_quant_range_selectable = false; - edid =drm_get_edid (connector, -intel_gmbus_get_adapter (dev_priv, - intel_hdmi->ddc_bus)); + i2c =intel_gmbus_get_adapter (dev_priv, intel_hdmi->ddc_bus); + + edid =drm_get_edid (connector, i2c); + +if (!edid && !intel_gmbus_is_forced_bit (i2c)) { +DRM_DEBUG_KMS ("HDMI GMBUS EDID read failed, retry using GPIO bit-banging\n" ); +intel_gmbus_force_bit (i2c, true); + edid =drm_get_edid (connector, i2c); +intel_gmbus_force_bit (i2c, false); + }if (edid) {if (edid->input &DRM_EDID_INPUT_DIGITAL ) {
PATCH 2/366 drm/i915: Log a message when rejecting LRM to OACONTROL
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Brad Volkin <[email protected]>
commit 00caf0199f66871b0e2c28d7c2079de0ce1d646c upstream.
The other paths in the command parser that reject a batch all log a message indicating the reason. We simply missed this one.
--- drivers/gpu/drm/i915/i915_cmd_parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +3 -1
@@ -887,8 +887,10 @@ static bool check_cmd(const struct intel* OACONTROL writes to only MI_LOAD_REGISTER_IMM commands. */ if (reg_addr ==OACONTROL ) { -if (desc->cmd.value ==MI_LOAD_REGISTER_MEM ) +if (desc->cmd.value ==MI_LOAD_REGISTER_MEM ) { +DRM_DEBUG_DRIVER ("CMD: Rejected LRM to OACONTROL\n" );return false; + }if (desc->cmd.value ==MI_LOAD_REGISTER_IMM (1 )) *oacontrol_set = (cmd[2 ] !=0 );
PATCH 3/366 drm/i915: Fix command parser to validate multiple register access with the same command.
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Francisco Jerez <[email protected]>
commit 6a65c5b9326c9dd391afb1b3df75cbedffbaccdb upstream.
Until now the software command checker assumed that commands could read or write at most a single register per packet. This is not necessarily the case, MI_LOAD_REGISTER_IMM expects a variable-length list of offset/value pairs and writes them in sequence. The previous code would only check whether the first entry was valid, effectively allowing userspace to write unrestricted registers of the MMIO space by sending a multi-register write with a legal first register, with potential security implications on Gen6 and 7 hardware.
Fix it by extending the drm_i915_cmd_descriptor table to represent multi-register access and making validate_cmd() iterate for all register offsets present in the command packet.
--- drivers/gpu/drm/i915/i915_cmd_parser.c | 74 +++++++++++++++----------- drivers/gpu/drm/i915/i915_drv.h | 5 ++ 2 files changed, 48 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +43 -31
@@ -123,7 +123,7 @@ static const struct drm_i915_cmd_descrip CMD( MI_SEMAPHORE_MBOX, SMI, !F, 0xFF, R ), CMD( MI_STORE_DWORD_INDEX, SMI, !F, 0xFF, R ), CMD( MI_LOAD_REGISTER_IMM(1), SMI, !F, 0xFF, W, - .reg = { .offset = 1, .mask = 0x007FFFFC } ), + .reg = { .offset = 1, .mask = 0x007FFFFC, .step = 2 } ), CMD( MI_STORE_REGISTER_MEM(1), SMI, !F, 0xFF, W | B, .reg = { .offset = 1, .mask = 0x007FFFFC }, .bits = {{
@@ -859,7 +859,7 @@ bool i915_needs_cmd_parser(struct intel_static bool check_cmd (const struct intel_engine_cs *ring,const struct drm_i915_cmd_descriptor *desc, -const u32 *cmd, +const u32 *cmd,u32 length,const bool is_master,bool *oacontrol_set) {
@@ -875,38 +875,49 @@ static bool check_cmd(const struct intel }if (desc->flags &CMD_DESC_REGISTER ) { -u32 reg_addr = cmd[desc->reg.offset] & desc->reg.mask; -/* -* OACONTROL requires some special handling for writes. We -* want to make sure that any batch which enables OA also -* disables it before the end of the batch. The goal is to -* prevent one process from snooping on the perf data from -* another process. To do that, we need to check the value -* that will be written to the register. Hence, limit -* OACONTROL writes to only MI_LOAD_REGISTER_IMM commands. +* Get the distance between individual register offset +* fields if the command can perform more than one +* access at a time. */ -if (reg_addr ==OACONTROL ) { -if (desc->cmd.value ==MI_LOAD_REGISTER_MEM ) { -DRM_DEBUG_DRIVER ("CMD: Rejected LRM to OACONTROL\n" ); -return false; - } +const u32 step = desc->reg.step ? desc->reg.step : length; +u32 offset; -if (desc->cmd.value ==MI_LOAD_REGISTER_IMM (1 )) - *oacontrol_set = (cmd[2 ] !=0 ); - } +for (offset = desc->reg.offset; offset < length; + offset += step) { +const u32 reg_addr = cmd[offset] & desc->reg.mask; + +/* +* OACONTROL requires some special handling for +* writes. We want to make sure that any batch which +* enables OA also disables it before the end of the +* batch. The goal is to prevent one process from +* snooping on the perf data from another process. To do +* that, we need to check the value that will be written +* to the register. Hence, limit OACONTROL writes to +* only MI_LOAD_REGISTER_IMM commands. +*/ +if (reg_addr ==OACONTROL ) { +if (desc->cmd.value ==MI_LOAD_REGISTER_MEM ) { +DRM_DEBUG_DRIVER ("CMD: Rejected LRM to OACONTROL\n" ); +return false; + } -if (!valid_reg (ring->reg_table, - ring->reg_count, reg_addr)) { -if (!is_master || - !valid_reg (ring->master_reg_table, - ring->master_reg_count, - reg_addr)) { -DRM_DEBUG_DRIVER ("CMD: Rejected register 0x%08X in command: 0x%08X (ring=%d)\n" , - reg_addr, - *cmd, - ring->id); -return false; +if (desc->cmd.value ==MI_LOAD_REGISTER_IMM (1 )) + *oacontrol_set = (cmd[offset +1 ] !=0 ); + } + +if (!valid_reg (ring->reg_table, + ring->reg_count, reg_addr)) { +if (!is_master || + !valid_reg (ring->master_reg_table, + ring->master_reg_count, + reg_addr)) { +DRM_DEBUG_DRIVER ("CMD: Rejected register 0x%08X in command: 0x%08X (ring=%d)\n" , + reg_addr, *cmd, + ring->id); +return false; + } } } }
@@ -1020,7 +1031,8 @@ int i915_parse_cmds(struct intel_engine_break ; } -if (!check_cmd (ring, desc, cmd, is_master, &oacontrol_set)) { +if (!check_cmd (ring, desc, cmd, length, is_master, + &oacontrol_set)) { ret = -EINVAL ;break ; }
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -1828,10 +1828,15 @@ struct drm_i915_cmd_descriptor {* Describes where to find a register address in the command to check * against the ring's register whitelist. Only valid if flags has the * CMD_DESC_REGISTER bit set. +* +* A non-zero step value implies that the command may access multiple +* registers in sequence (e.g. LRI), in that case step gives the +* distance in dwords between individual offset fields. */ struct {u32 offset;u32 mask; +u32 step; } reg;#define MAX_CMD_DESC_BITMASKS 3
PATCH 4/366 drm/i915/cmdparser: Do not check past the cmd length.
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michal Srb <[email protected]>
commit 3aec7f871c65eb5f76b4125fda432593c834a6f2 upstream.
The command MEDIA_VFE_STATE checks bits at offset +2 dwords. However, it is possible to have MEDIA_VFE_STATE command with length = 0 + LENGTH_BIAS = 2. In that case check_cmd will read bits from the following command, or even past the end of the buffer.
If the offset ends up outside of the command length, reject the command.
--- drivers/gpu/drm/i915/i915_cmd_parser.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_cmd_parser.c +6 -0
@@ -941,6 +941,12 @@ static bool check_cmd(const struct intelcontinue ; } +if (desc->bits[i].offset >= length) { +DRM_DEBUG_DRIVER ("CMD: Rejected command 0x%08X, too short to check bitmask (ring=%d)\n" , + *cmd, ring->id); +return false; + } + dword = cmd[desc->bits[i].offset] & desc->bits[i].mask;
PATCH 5/366 regmap: Correct offset handling in regmap_volatile_range
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit b8f9a03b741ddfdde4aa8b607fa7d88eb63a6338 upstream.
The current implementation is broken for regmaps that have a reg_stride, since it doesn't take the stride into account. Correct this by using the helper function to calculate the register offset.
[bwh: Backported to 3.16: Use simple multiplication instead of
regmap_get_offset()]
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -144,7 +144,7 @@ static bool regmap_volatile_range(structunsigned int i;for (i =0 ; i < num; i++) -if (!regmap_volatile (map, reg + i)) +if (!regmap_volatile (map, reg + (i * map->reg_stride)))return false;return true;
PATCH 6/366 regmap: Support bulk reads for devices without raw formatting
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit d5b98eb12420ce856caaf57dc5256eedc56a3747 upstream.
When doing a bulk read from a device which lacks raw I/O support we fall back to doing register at a time reads but we still use the raw formatters in order to render the data into the word size used by the device (since bulk reads still operate on the device word size rather than unsigned ints). This means that devices without raw formatting such as those that provide reg_read() are not supported. Provide handling for them by copying the values read into native endian values of the appropriate size.
--- drivers/base/regmap/regmap.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/base/regmap/regmap.c +28 -1
@@ -2246,7 +2246,34 @@ int regmap_bulk_read(struct regmap *map, &ival);if (ret !=0 )return ret; - map->format.format_val (val + (i * val_bytes), ival,0 ); + +if (map->format.format_val) { + map->format.format_val (val + (i * val_bytes), ival,0 ); + }else { +/* Devices providing read and write +* operations can use the bulk I/O +* functions if they define a val_bytes, +* we assume that the values are native +* endian. +*/ +u32 *u32 = val; +u16 *u16 = val; +u8 *u8 = val; + +switch (map->format.val_bytes) { +case 4 : + u32[i] = ival; +break ; +case 2 : + u16[i] = ival; +break ; +case 1 : + u8[i] = ival; +break ; +default : +return -EINVAL ; + } + } } }
PATCH 7/366 regmap: Don't use format_val in regmap_bulk_read
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit 9ae27a8d1f3ebff09191fb8cb1341414547293b2 upstream.
A bulk read can be implemented either through regmap_raw_read, or by reading each register individually using regmap_read. Both regmap_read and regmap_bulk_read should return values in native endian. In the individual case the current implementation calls format_val to put the data into the output array, which can cause endian issues. The regmap_read will have already converted the data into native endian, if the hosts endian differs from the device then format_val will switch the endian back again.
Rather than using format_val simply use the code that is called if there is no format_val function. This code supports all cases except 24-bit but there don't appear to be any users of regmap_bulk_read for 24-bit. Additionally, it would have to be a big endian host for the old code to actually function correctly anyway.
[bwh: Backported to 3.16:
- 64-bit I/O is not supported
- Adjust context]
---
drivers/base/regmap/regmap.c +17 -26
@@ -2240,39 +2240,30 @@ int regmap_bulk_read(struct regmap *map,for (i =0 ; i < val_count * val_bytes; i += val_bytes) map->format.parse_inplace (val + i); }else { +u32 *u32 = val; +u16 *u16 = val; +u8 *u8 = val; +for (i =0 ; i < val_count; i++) {unsigned int ival; + ret =regmap_read (map, reg + (i * map->reg_stride), &ival);if (ret !=0 )return ret; -if (map->format.format_val) { - map->format.format_val (val + (i * val_bytes), ival,0 ); - }else { -/* Devices providing read and write -* operations can use the bulk I/O -* functions if they define a val_bytes, -* we assume that the values are native -* endian. -*/ -u32 *u32 = val; -u16 *u16 = val; -u8 *u8 = val; - -switch (map->format.val_bytes) { -case 4 : - u32[i] = ival; -break ; -case 2 : - u16[i] = ival; -break ; -case 1 : - u8[i] = ival; -break ; -default : -return -EINVAL ; - } +switch (map->format.val_bytes) { +case 4 : + u32[i] = ival; +break ; +case 2 : + u16[i] = ival; +break ; +case 1 : + u8[i] = ival; +break ; +default : +return -EINVAL ; } } }
PATCH 8/366 drm: rcar-du: lvds: Fix LVDS startup on R-Car Gen2
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Shtylyov <[email protected]>
commit 8525d04ba8a6a9ecfa4bd619c988ca873a5fc2a4 upstream.
According to the latest revision 2.00 of the R-Car Gen2 manual, the LVDS and the bias circuit must be enabled after the LVDS I/O pins are enabled, not before. Fix the Gen2 LVDS startup sequence accordingly.
While at it, also fix the comment preceding the first LVDCR0 write that still talks about hardcoding the LVDS mode 0.
[bwh: Backported to 3.16:
- Mode is always 0
- Adjust context]
---
drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c +6 -4
@@ -87,10 +87,8 @@ static int rcar_du_lvdsenc_start(structrcar_lvds_write (lvds,LVDCHCR , lvdhcr); -/* Select the input, hardcode mode 0, enable LVDS operation and turn -* bias circuitry on. -*/ - lvdcr0 =LVDCR0_BEN |LVDCR0_LVEN ; +/* Select the input and set the LVDS mode. */ + lvdcr0 =0 ;if (rcrtc->index ==2 ) lvdcr0 |=LVDCR0_DUSEL ;rcar_lvds_write (lvds,LVDCR0 , lvdcr0);
@@ -99,6 +97,10 @@ static int rcar_du_lvdsenc_start(structrcar_lvds_write (lvds,LVDCR1 ,LVDCR1_CHSTBY (3 ) |LVDCR1_CHSTBY (2 ) |LVDCR1_CHSTBY (1 ) |LVDCR1_CHSTBY (0 ) |LVDCR1_CLKSTBY ); +/* Enable LVDS operation and turn bias circuitry on. */ + lvdcr0 |=LVDCR0_BEN |LVDCR0_LVEN ; +rcar_lvds_write (lvds,LVDCR0 , lvdcr0); +/* Turn the PLL on, wait for the startup delay, and turn the output * on. */
PATCH 9/366 HID: i2c-hid: fix size check and type usage
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Ma <[email protected]>
commit ac75a041048b8c1f7418e27621ca5efda8571043 upstream.
When convert char array with signed int, if the inbuf[x] is negative then upper bits will be set to 1. Fix this by using u8 instead of char.
ret_size has to be at least 3, hid_input_report use it after minus 2 bytes.
--- drivers/hid/i2c-hid/i2c-hid.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/hid/i2c-hid/i2c-hid.c +7 -6
@@ -136,10 +136,10 @@ struct i2c_hid {* register of the HID * descriptor. */ unsigned int bufsize;/* i2c buffer size */ -char *inbuf;/* Input buffer */ -char *rawbuf;/* Raw Input buffer */ -char *cmdbuf;/* Command buffer */ -char *argsbuf;/* Command arguments buffer */ +u8 *inbuf;/* Input buffer */ +u8 *rawbuf;/* Raw Input buffer */ +u8 *cmdbuf;/* Command buffer */ +u8 *argsbuf;/* Command arguments buffer */ unsigned long flags;/* device flags */
@@ -373,7 +373,8 @@ static int i2c_hid_hwreset(struct i2c_clstatic void i2c_hid_get_input (struct i2c_hid *ihid) { -int ret, ret_size; +int ret; +u32 ret_size;int size =le16_to_cpu (ihid->hdesc.wMaxInputLength);if (size > ihid->bufsize)
@@ -398,7 +399,7 @@ static void i2c_hid_get_input(struct i2creturn ; } -if (ret_size > size) { +if ((ret_size > size) || (ret_size <=2 )) {dev_err (&ihid->client->dev,"%s: incomplete report (%d/%d)\n" , __func__, size, ret_size);return ;
PATCH 10/366 HID: i2c-hid: Fix "incomplete report" noise
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Andryuk <[email protected]>
commit ef6eaf27274c0351f7059163918f3795da13199c upstream.
Commit ac75a041048b ("HID: i2c-hid: fix size check and type usage") started writing messages when the ret_size is <= 2 from i2c_master_recv. However, my device i2c-DLL07D1 returns 2 for a short period of time (~0.5s) after I stop moving the pointing stick or touchpad. It varies, but you get ~50 messages each time which spams the log hard.
[ 95.925055] i2c_hid i2c-DLL07D1:01: i2c_hid_get_input: incomplete report (83/2)
This has also been observed with a i2c-ALP0017.
[ 1781.266353] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
Only print the message when ret_size is totally invalid and less than 2 to cut down on the log spam.
--- drivers/hid/i2c-hid/i2c-hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/i2c-hid/i2c-hid.c +1 -1
@@ -399,7 +399,7 @@ static void i2c_hid_get_input(struct i2creturn ; } -if ((ret_size > size) || (ret_size <=2 )) { +if ((ret_size > size) || (ret_size <2 )) {dev_err (&ihid->client->dev,"%s: incomplete report (%d/%d)\n" , __func__, size, ret_size);return ;
PATCH 11/366 HID: core: Fix size as type u32
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Ma <[email protected]>
commit 6de0b13cc0b4ba10e98a9263d7a83b940720b77a upstream.
When size is negative, calling memset will make segment fault. Declare the size as type u32 to keep memset safe.
size in struct hid_report is unsigned, fix return type of hid_report_len to u32.
--- drivers/hid/hid-core.c | 10 +++++----- include/linux/hid.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/hid/hid-core.c +6 -6
@@ -1284,7 +1284,7 @@ void hid_output_report(struct hid_report }EXPORT_SYMBOL_GPL (hid_output_report); -static int hid_report_len (struct hid_report *report) +static u32 hid_report_len (struct hid_report *report) {/* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */ return ((report->size -1 ) >>3 ) +1 + (report->id >0 );
@@ -1300,7 +1300,7 @@ u8 *hid_alloc_report_buf(struct hid_repo* of implement() working on 8 byte chunks */ -int len =hid_report_len (report) +7 ; +u32 len =hid_report_len (report) +7 ;return kmalloc (len, flags); }
@@ -1365,7 +1365,7 @@ void __hid_request(struct hid_device *hi {char *buf;int ret; -int len; +u32 len; buf =hid_alloc_report_buf (report,GFP_KERNEL );if (!buf)
@@ -1391,14 +1391,14 @@ out: }EXPORT_SYMBOL_GPL (__hid_request); -int hid_report_raw_event (struct hid_device *hid,int type,u8 *data,int size, +int hid_report_raw_event (struct hid_device *hid,int type,u8 *data,u32 size,int interrupt) {struct hid_report_enum *report_enum = hid->report_enum + type;struct hid_report *report;struct hid_driver *hdrv;unsigned int a; -int rsize, csize = size; +u32 rsize, csize = size;u8 *cdata = data;int ret =0 ;
@@ -1456,7 +1456,7 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);* * This is data entry for lower layers. */ -int hid_input_report (struct hid_device *hid,int type,u8 *data,int size,int interrupt) +int hid_input_report (struct hid_device *hid,int type,u8 *data,u32 size,int interrupt) {struct hid_report_enum *report_enum;struct hid_driver *hdrv;
include/linux/hid.h +2 -2
@@ -757,7 +757,7 @@ extern int hidinput_connect(struct hid_dextern void hidinput_disconnect (struct hid_device *);int hid_set_field (struct hid_field *,unsigned ,__s32 ); -int hid_input_report (struct hid_device *,int type,u8 *,int ,int ); +int hid_input_report (struct hid_device *,int type,u8 *,u32 ,int );int hidinput_find_field (struct hid_device *hid,unsigned int type,unsigned int code,struct hid_field **field);struct hid_field *hidinput_get_led_field (struct hid_device *hid);unsigned int hidinput_count_leds (struct hid_device *hid);
@@ -1055,7 +1055,7 @@ static inline void hid_hw_wait(struct hi hdev->ll_driver->wait (hdev); } -int hid_report_raw_event (struct hid_device *hid,int type,u8 *data,int size, +int hid_report_raw_event (struct hid_device *hid,int type,u8 *data,u32 size,int interrupt);/* HID quirks API */
PATCH 12/366 perf record: Put new line after target override warning
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit c3dec27b7f70a9ad5f777d943d51ecdfcd9824d0 upstream.
There's no new-line after target-override warning, now:
$ perf record -a --per-thread Warning: SYSTEM/CPU switch overriding PER-THREAD^C[ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.705 MB perf.data (2939 samples) ]
with patch:
$ perf record -a --per-thread Warning: SYSTEM/CPU switch overriding PER-THREAD ^C[ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.705 MB perf.data (2939 samples) ]
--- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-record.c +1 -1
@@ -942,7 +942,7 @@ int cmd_record(int argc, const char **ar err =target__validate (&rec->opts.target);if (err) {target__strerror (&rec->opts.target, err, errbuf,BUFSIZ ); -ui__warning ("%s" , errbuf); +ui__warning ("%s\n" , errbuf); } err =target__parse_uid (&rec->opts.target);
PATCH 13/366 jbd2: if the journal is aborted then don't allow update of the log tail
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 85e0c4e89c1b864e763c4e3bb15d0b6d501ad5d9 upstream.
This updates the jbd2 superblock unnecessarily, and on an abort we shouldn't truncate the log.
--- fs/jbd2/journal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/jbd2/journal.c +4 -1
@@ -923,7 +923,7 @@ out: }/* -* This is a variaon of __jbd2_update_log_tail which checks for validity of +* This is a variation of __jbd2_update_log_tail which checks for validity of * provided log tail and locks j_checkpoint_mutex. So it is safe against races * with other threads updating log tail. */
@@ -1399,6 +1399,9 @@ int jbd2_journal_update_sb_log_tail(jourjournal_superblock_t *sb = journal->j_superblock;int ret; +if (is_journal_aborted (journal)) +return -EIO ; +BUG_ON (!mutex_is_locked (&journal->j_checkpoint_mutex));jbd_debug (1 ,"JBD2: updating superblock (start %lu, seq %u)\n" , tail_block, tail_tid);
PATCH 14/366 um: Use POSIX ucontext_t instead of struct ucontext
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Mazur <[email protected]>
commit 4d1a535b8ec5e74b42dfd9dc809142653b2597f6 upstream.
glibc 2.26 removed the 'struct ucontext' to "improve" POSIX compliance and break programs, including User Mode Linux. Fix User Mode Linux by using POSIX ucontext_t.
This fixes:
arch/um/os-Linux/signal.c: In function 'hard_handler':arch/um/os-Linux/signal.c:163:22: error: dereferencing pointer to incomplete type 'struct ucontext'
mcontext_t *mc = &uc->uc_mcontext;arch/x86/um/stub_segv.c: In function 'stub_segv_handler':arch/x86/um/stub_segv.c:16:13: error: dereferencing pointer to incomplete type 'struct ucontext'
&uc->uc_mcontext);
--- arch/um/os-Linux/signal.c | 2 +- arch/x86/um/stub_segv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/um/os-Linux/signal.c +1 -1
@@ -135,7 +135,7 @@ static void (*handlers[_NSIG])(int sig,static void hard_handler (int sig,siginfo_t *si,void *p) { -struct ucontext *uc = p; +ucontext_t *uc = p;mcontext_t *mc = &uc->uc_mcontext;unsigned long pending =1UL << sig;
arch/x86/um/stub_segv.c +1 -1
@@ -10,7 +10,7 @@void __attribute__ ((__section__ (".__syscall_stub" )))stub_segv_handler (int sig,siginfo_t *info,void *p) { -struct ucontext *uc = p; +ucontext_t *uc = p;GET_FAULTINFO_FROM_MC (*((struct faultinfo *)STUB_DATA ), &uc->uc_mcontext);
PATCH 15/366 ext4: don't update checksum of new initialized bitmaps
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 044e6e3d74a3d7103a0c8a9305dfd94d64000660 upstream.
When reading the inode or block allocation bitmap, if the bitmap needs to be initialized, do not update the checksum in the block group descriptor. That's because we're not set up to journal those changes. Instead, just set the verified bit on the bitmap block, so that it's not necessary to validate the checksum.
When a block or inode allocation actually happens, at that point the checksum will be calculated, and update of the bg descriptor block will be properly journalled.
[bwh: Backported to 3.16:
- Deleted code is slightly different
- Adjust context]
--- fs/ext4/balloc.c | 3 +-- fs/ext4/ialloc.c | 47 +++-------------------------------------------- 2 files changed, 4 insertions(+), 46 deletions(-)
fs/ext4/balloc.c +1 -2
@@ -239,8 +239,6 @@ static int ext4_init_block_bitmap(struct*/ ext4_mark_bitmap_end (num_clusters_in_group (sb, block_group), sb->s_blocksize *8 , bh->b_data); -ext4_block_bitmap_csum_set (sb, block_group, gdp, bh); -ext4_group_desc_csum_set (sb, block_group, gdp);return 0 ; }
@@ -464,6 +462,7 @@ ext4_read_block_bitmap_nowait(struct sup err =ext4_init_block_bitmap (sb, bh, block_group, desc);set_bitmap_uptodate (bh);set_buffer_uptodate (bh); +set_buffer_verified (bh);ext4_unlock_group (sb, block_group);unlock_buffer (bh);if (err)
fs/ext4/ialloc.c +3 -40
55 lines not on this page · raw message
PATCH 16/366 media: cx25821: prevent out-of-bounds read on array card
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 67300abdbe9f1717532aaf4e037222762716d0f6 upstream.
Currently an out of range dev->nr is detected by just reporting the issue and later on an out-of-bounds read on array card occurs because of this. Fix this by checking the upper range of dev->nr with the size of array card (removes the hard coded size), move this check earlier and also exit with the error -ENOSYS to avoid the later out-of-bounds array read.
Detected by CoverityScan, CID#711191 ("Out-of-bounds-read")
--- drivers/media/pci/cx25821/cx25821-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/pci/cx25821/cx25821-core.c +4 -3
@@ -871,6 +871,10 @@ static int cx25821_dev_setup(struct cx25 dev->nr = ++cx25821_devcount;sprintf (dev->name,"cx25821[%d]" , dev->nr); +if (dev->nr >=ARRAY_SIZE (card)) { +CX25821_INFO ("dev->nr >= %zd" ,ARRAY_SIZE (card)); +return -ENODEV ; + }if (dev->pci->device !=0x8210 ) {pr_info ("%s(): Exiting. Incorrect Hardware device = 0x%02x\n" , __func__, dev->pci->device);
@@ -887,9 +891,6 @@ static int cx25821_dev_setup(struct cx25 dev->channels[i].sram_channels = &cx25821_sram_channels[i]; } -if (dev->nr >1 ) -CX25821_INFO ("dev->nr > 1!" ); -/* board config */ dev->board =1 ;/* card[dev->nr]; */ dev->_max_num_decoders =MAX_DECODERS ;
PATCH 17/366 serial: altera: ensure port->regshift is honored consistently
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
commit 0e254963b6ba4d63ac911e79537fea38dd03dc50 upstream.
Most register accesses in the altera driver honor port->regshift by using altera_uart_writel(). There are a few accesses however that were missed when the driver was converted to use port->regshift and some others were added later in commit 4d9d7d896d77 ("serial: altera_uart:
add earlycon support").
--- drivers/tty/serial/altera_uart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/tty/serial/altera_uart.c +3 -3
@@ -335,7 +335,7 @@ static int altera_uart_startup(struct ua/* Enable RX interrupts now */ pp->imr =ALTERA_UART_CONTROL_RRDY_MSK ; -writel (pp->imr, port->membase +ALTERA_UART_CONTROL_REG ); +altera_uart_writel (port, pp->imr,ALTERA_UART_CONTROL_REG );spin_unlock_irqrestore (&port->lock, flags);
@@ -351,7 +351,7 @@ static void altera_uart_shutdown(struct/* Disable all interrupts now */ pp->imr =0 ; -writel (pp->imr, port->membase +ALTERA_UART_CONTROL_REG ); +altera_uart_writel (port, pp->imr,ALTERA_UART_CONTROL_REG );spin_unlock_irqrestore (&port->lock, flags);
@@ -441,7 +441,7 @@ static void altera_uart_console_putc(str ALTERA_UART_STATUS_TRDY_MSK))cpu_relax (); -writel (c, port->membase +ALTERA_UART_TXDATA_REG ); +altera_uart_writel (port, c,ALTERA_UART_TXDATA_REG ); } static void altera_uart_console_write(struct console *co, const char *s,
PATCH 18/366 serial: arc_uart: Fix out-of-bounds access through DT alias
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit f9f5786987e81d166c60833edcb7d1836aa16944 upstream.
The arc_uart_ports[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access.
Fix this by adding a range check.
Note that the array size is defined by a Kconfig symbol (CONFIG_SERIAL_ARC_NR_PORTS), so this can even be triggered using a legitimate DTB.
[bwh: Backported to 3.16: Put the check in arc_uart_init_one() and move
initialisation of the uart variable below it]
---
drivers/tty/serial/arc_uart.c +7 -1
@@ -531,8 +531,14 @@ arc_uart_init_one(struct platform_device {struct resource *res, *res2;unsigned long *plat_data; -struct arc_uart_port *uart = &arc_uart_ports[dev_id]; +struct arc_uart_port *uart; +if (dev_id >=ARRAY_SIZE (arc_uart_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , dev_id); +return -EINVAL ; + } + + uart = &arc_uart_ports[dev_id]; plat_data =dev_get_platdata (&pdev->dev);if (!plat_data)return -ENODEV ;
PATCH 19/366 serial: fsl_lpuart: Fix out-of-bounds access through DT alias
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit ffab87fdecc655cc676f8be8dd1a2c5e22bd6d47 upstream.
The lpuart_ports[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access.
Fix this by adding a range check.
--- drivers/tty/serial/fsl_lpuart.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/fsl_lpuart.c +4 -0
@@ -1170,6 +1170,10 @@ static int lpuart_probe(struct platform_dev_err (&pdev->dev,"failed to get alias id, errno %d\n" , ret);return ret; } +if (ret >=ARRAY_SIZE (lpuart_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , ret); +return -EINVAL ; + } sport->port.line = ret; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
PATCH 20/366 serial: imx: Fix out-of-bounds access through serial port index
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 5673444821406dda5fc25e4b52aca419f8065a19 upstream.
The imx_ports[] array is indexed using a value derived from the "serialN" alias in DT, or from platform data, which may lead to an out-of-bounds access.
Fix this by adding a range check.
--- drivers/tty/serial/imx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/tty/serial/imx.c +6 -0
@@ -1919,6 +1919,12 @@ static int serial_imx_probe(struct platfelse if (ret <0 )return ret; +if (sport->port.line >=ARRAY_SIZE (imx_ports)) { +dev_err (&pdev->dev,"serial%d out of range\n" , + sport->port.line); +return -EINVAL ; + } + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); base =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (base))
PATCH 21/366 serial: mxs-auart: Fix out-of-bounds access through serial port index
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit dd345a31bfdec350d2593e6de5964e55c7f19c76 upstream.
The auart_port[] array is indexed using a value derived from the "serialN" alias in DT, or from platform data, which may lead to an out-of-bounds access.
Fix this by adding a range check.
[bwh: Backported to 3.16:
- Explicitly clean up port on error
- Adjust context]
--- drivers/tty/serial/mxs-auart.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/mxs-auart.c +5 -0
@@ -1050,6 +1050,11 @@ static int mxs_auart_probe(struct platfo s->port.line = pdev->id <0 ?0 : pdev->id; else if (ret < 0) goto out_free; + if (s->port.line >= ARRAY_SIZE(auart_port)) { +dev_err (&pdev->dev,"serial%d out of range\n" , s->port.line); + ret = -EINVAL ; + goto out_free; + }if (of_id) { pdev->id_entry = of_id->data;
PATCH 22/366 serial: pxa: Fix out-of-bounds access through serial port index
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit afc7851fab8329eddcf321c9e0a58c893f351dd6 upstream.
The serial_pxa_ports[] array is indexed using a value derived from the "serialN" alias in DT, or from platform data, which may lead to an out-of-bounds access.
Fix this by adding a range check.
--- drivers/tty/serial/pxa.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/pxa.c +4 -0
@@ -888,6 +888,10 @@ static int serial_pxa_probe(struct platf sport->port.line = dev->id; else if (ret < 0) goto err_clk; + if (sport->port.line >= ARRAY_SIZE(serial_pxa_ports)) { +dev_err (&dev->dev,"serial%d out of range\n" , sport->port.line); +return -EINVAL ; + }snprintf (sport->name,PXA_NAME_LEN -1 ,"UART%d" , sport->port.line +1 ); sport->port.membase =ioremap (mmres->start,resource_size (mmres));
PATCH 23/366 serial: xuartps: Fix out-of-bounds access through DT alias
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit e7d75e18d0fc3f7193b65282b651f980c778d935 upstream.
The cdns_uart_port[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access.
Fix this by adding a range check.
--- drivers/tty/serial/xilinx_uartps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/xilinx_uartps.c +1 -1
@@ -1007,7 +1007,7 @@ static struct uart_port *cdns_uart_get_pstruct uart_port *port;/* Try the given port id if failed use default method */ -if (cdns_uart_port[id].mapbase !=0 ) { +if (id <CDNS_UART_NR_PORTS && cdns_uart_port[id].mapbase !=0 ) {/* Find the next unused port */ for (id =0 ; id <CDNS_UART_NR_PORTS ; id++)if (cdns_uart_port[id].mapbase ==0 )
PATCH 24/366 rtl8187: Fix NULL pointer dereference in priv->conf_mutex
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sudhir Sreedharan <[email protected]>
commit 7972326a26b5bf8dc2adac575c4e03ee7e9d193a upstream.
This can be reproduced by bind/unbind the driver multiple times in AM3517 board.
Analysis revealed that rtl8187_start() was invoked before probe finishes(ie. before the mutex is initialized).
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 0 PID: 821 Comm: wpa_supplicant Not tainted 4.9.80-dirty #250 Hardware name: Generic AM3517 (Flattened Device Tree) [<c010e0d8>] (unwind_backtrace) from [<c010beac>] (show_stack+0x10/0x14) [<c010beac>] (show_stack) from [<c017401c>] (register_lock_class+0x4f4/0x55c) [<c017401c>] (register_lock_class) from [<c0176fe0>] (__lock_acquire+0x74/0x1938) [<c0176fe0>] (__lock_acquire) from [<c0178cfc>] (lock_acquire+0xfc/0x23c) [<c0178cfc>] (lock_acquire) from [<c08aa2f8>] (mutex_lock_nested+0x50/0x3b0) [<c08aa2f8>] (mutex_lock_nested) from [<c05f5bf8>] (rtl8187_start+0x2c/0xd54) [<c05f5bf8>] (rtl8187_start) from [<c082dea0>] (drv_start+0xa8/0x320) [<c082dea0>] (drv_start) from [<c084d1d4>] (ieee80211_do_open+0x2bc/0x8e4) [<c084d1d4>] (ieee80211_do_open) from [<c069be94>] (__dev_open+0xb8/0x120) [<c069be94>] (__dev_open) from [<c069c11c>] (__dev_change_flags+0x88/0x14c) [<c069c11c>] (__dev_change_flags) from [<c069c1f8>] (dev_change_flags+0x18/0x48) [<c069c1f8>] (dev_change_flags) from [<c0710b08>] (devinet_ioctl+0x738/0x840) [<c0710b08>] (devinet_ioctl) from [<c067925c>] (sock_ioctl+0x164/0x2f4) [<c067925c>] (sock_ioctl) from [<c02883f8>] (do_vfs_ioctl+0x8c/0x9d0) [<c02883f8>] (do_vfs_ioctl) from [<c0288da8>] (SyS_ioctl+0x6c/0x7c) [<c0288da8>] (SyS_ioctl) from [<c0107760>] (ret_fast_syscall+0x0/0x1c) Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = cd1ec000 [00000000] *pgd=8d1de831, *pte=00000000, *ppte=00000000 Internal error: Oops: 817 [#1] PREEMPT ARM Modules linked in: CPU: 0 PID: 821 Comm: wpa_supplicant Not tainted 4.9.80-dirty #250 Hardware name: Generic AM3517 (Flattened Device Tree) task: ce73eec0 task.stack: cd1ea000 PC is at mutex_lock_nested+0xe8/0x3b0 LR is at mutex_lock_nested+0xd0/0x3b0
--- drivers/net/wireless/rtl818x/rtl8187/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtl818x/rtl8187/dev.c +1 -1
@@ -1454,6 +1454,7 @@ static int rtl8187_probe(struct usb_inte goto err_free_dev; }mutex_init (&priv->io_mutex); +mutex_init (&priv->conf_mutex);SET_IEEE80211_DEV (dev, &intf->dev);usb_set_intfdata (intf, dev);
@@ -1627,7 +1628,6 @@ static int rtl8187_probe(struct usb_inteprintk (KERN_ERR "rtl8187: Cannot register device\n" ); goto err_free_dmabuf; } -mutex_init (&priv->conf_mutex);skb_queue_head_init (&priv->b_tx_status.queue); wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n",
PATCH 25/366 IB/srp: Fix srp_abort()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit e68088e78d82920632eba112b968e49d588d02a2 upstream.
Before commit e494f6a72839 ("[SCSI] improved eh timeout handler") it did not really matter whether or not abort handlers like srp_abort() called .scsi_done() when returning another value than SUCCESS. Since that commit however this matters. Hence only call .scsi_done() when returning SUCCESS.
--- drivers/infiniband/ulp/srp/ib_srp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +5 -3
@@ -2393,9 +2393,11 @@ static int srp_abort(struct scsi_cmnd *s ret =FAST_IO_FAIL ; else ret =FAILED ; -srp_free_req (target, req, scmnd,0 ); - scmnd->result =DID_ABORT <<16 ; - scmnd->scsi_done (scmnd); +if (ret ==SUCCESS ) { +srp_free_req (target, req, scmnd,0 ); + scmnd->result =DID_ABORT <<16 ; + scmnd->scsi_done (scmnd); + }return ret; }
PATCH 26/366 rtc: tx4939: avoid unintended sign extension on a 24 bit shift
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 347876ad47b9923ce26e686173bbf46581802ffa upstream.
The shifting of buf[5] by 24 bits to the left will be promoted to a 32 bit signed int and then sign-extended to an unsigned long. If the top bit of buf[5] is set then all then all the upper bits sec end up as also being set because of the sign-extension. Fix this by casting buf[5] to an unsigned long before the shift.
Detected by CoverityScan, CID#1465292 ("Unintended sign extension")
--- drivers/rtc/rtc-tx4939.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-tx4939.c +4 -2
@@ -86,7 +86,8 @@ static int tx4939_rtc_read_time(struct dfor (i =2 ; i <6 ; i++) buf[i] =__raw_readl (&rtcreg->dat);spin_unlock_irq (&pdata->lock); - sec = (buf[5 ] <<24 ) | (buf[4 ] <<16 ) | (buf[3 ] <<8 ) | buf[2 ]; + sec = ((unsigned long )buf[5 ] <<24 ) | (buf[4 ] <<16 ) | + (buf[3 ] <<8 ) | buf[2 ];rtc_time_to_tm (sec, tm);return rtc_valid_tm (tm); }
@@ -147,7 +148,8 @@ static int tx4939_rtc_read_alarm(struct alrm->enabled = (ctl &TX4939_RTCCTL_ALME ) ?1 :0 ; alrm->pending = (ctl &TX4939_RTCCTL_ALMD ) ?1 :0 ;spin_unlock_irq (&pdata->lock); - sec = (buf[5 ] <<24 ) | (buf[4 ] <<16 ) | (buf[3 ] <<8 ) | buf[2 ]; + sec = ((unsigned long )buf[5 ] <<24 ) | (buf[4 ] <<16 ) | + (buf[3 ] <<8 ) | buf[2 ];rtc_time_to_tm (sec, &alrm->time);return rtc_valid_tm (&alrm->time); }
PATCH 27/366 staging: rtl8192u: return -ENOMEM on failed allocation of priv->oldaddr
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit e1a7418529e33bc4efc346324557251a16a3e79b upstream.
Currently the allocation of priv->oldaddr is not null checked which will lead to subsequent errors when accessing priv->oldaddr. Fix this with a null pointer check and a return of -ENOMEM on allocation failure.
Detected with Coccinelle:
drivers/staging/rtl8192u/r8192U_core.c:1708:2-15: alloc with no test, possible model on line 1723
--- drivers/staging/rtl8192u/r8192U_core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/rtl8192u/r8192U_core.c +2 -0
@@ -1893,6 +1893,8 @@ static short rtl8192_usb_initendpoints(s priv->rx_urb[16 ] =usb_alloc_urb (0 ,GFP_KERNEL ); priv->oldaddr =kmalloc (16 ,GFP_KERNEL ); +if (!priv->oldaddr) +return -ENOMEM ; oldaddr = priv->oldaddr; align = ((long )oldaddr) &3 ;if (align) {
PATCH 28/366 crypto: x86/cast5-avx - fix ECB encryption when long sg follows short one
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 8f461b1e02ed546fbd0f11611138da67fd85a30f upstream.
With ecb-cast5-avx, if a 128+ byte scatterlist element followed a shorter one, then the algorithm accidentally encrypted/decrypted only 8 bytes instead of the expected 128 bytes. Fix it by setting the encryption/decryption 'fn' correctly.
--- arch/x86/crypto/cast5_avx_glue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/crypto/cast5_avx_glue.c +1 -2
@@ -67,8 +67,6 @@ static int ecb_crypt(struct blkcipher_devoid (*fn)(struct cast5_ctx *ctx,u8 *dst,const u8 *src);int err; - fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way; - err =blkcipher_walk_virt (desc, walk); desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP ;
@@ -80,6 +78,7 @@ static int ecb_crypt(struct blkcipher_de/* Process multi-block batch */ if (nbytes >= bsize *CAST5_PARALLEL_BLOCKS ) { + fn = (enc) ? cast5_ecb_enc_16way : cast5_ecb_dec_16way; do { fn(ctx, wdst, wsrc);
PATCH 29/366 net: core: dst: Add kernel-doc for 'net' parameter
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Neuschäfer <[email protected]>
commit 8eb1a8590f5ca114fabf16ebb26a4bce0255ace9 upstream.
This fixes the following kernel-doc warning:
./include/net/dst.h:366: warning: Function parameter or member 'net' not described in 'skb_tunnel_rx'
--- include/net/dst.h | 1 + 1 file changed, 1 insertion(+)
include/net/dst.h +1 -0
@@ -350,6 +350,7 @@ static inline void __skb_tunnel_rx(struc* skb_tunnel_rx - prepare skb for rx reinsert * @skb: buffer * @dev: tunnel device +* @net: netns for packet i/o * * After decapsulation, packet is going to re-enter (netif_rx()) our stack, * so make some cleanups, and perform accounting.
PATCH 30/366 media: s3c-camif: fix out-of-bounds array access
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit a398e043637a4819a0e96467bfecaabf3224dd62 upstream.
While experimenting with older compiler versions, I ran into a warning that no longer shows up on gcc-4.8 or newer:
drivers/media/platform/s3c-camif/camif-capture.c: In function '__camif_subdev_try_format':drivers/media/platform/s3c-camif/camif-capture.c:1265:25: error: array subscript is below array bounds
This is an off-by-one bug, leading to an access before the start of the array, while newer compilers silently assume this undefined behavior cannot happen and leave the loop at index 0 if no other entry matches.
As Sylvester explains, we actually need to ensure that the value is within the range, so this reworks the loop to be easier to parse correctly, and an additional check to fall back on the first format value for any unexpected input.
I found an existing gcc bug for it and added a reduced version of the function there.
--- drivers/media/platform/s3c-camif/camif-capture.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/media/platform/s3c-camif/camif-capture.c +4 -3
@@ -1280,16 +1280,17 @@ static void __camif_subdev_try_format(st {const struct s3c_camif_variant *variant = camif->variant;const struct vp_pix_limits *pix_lim; -int i =ARRAY_SIZE (camif_mbus_formats); +unsigned int i;/* FIXME: constraints against codec or preview path ? */ pix_lim = &variant->vp_pix_limits[VP_CODEC ]; -while (i-- >=0 ) +for (i =0 ; i <ARRAY_SIZE (camif_mbus_formats); i++)if (camif_mbus_formats[i] == mf->code)break ; - mf->code = camif_mbus_formats[i]; +if (i ==ARRAY_SIZE (camif_mbus_formats)) + mf->code = camif_mbus_formats[0 ];if (pad ==CAMIF_SD_PAD_SINK ) { v4l_bound_align_image(&mf->width, 8, CAMIF_MAX_PIX_WIDTH,
PATCH 31/366 Input: i8042 - add Lenovo ThinkPad L460 to i8042 reset list
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dennis Wassenberg <[email protected]>
commit b56af54ac78c54a519d82813836f305d7f76ef27 upstream.
Reset i8042 before probing because of insufficient BIOS initialisation of the i8042 serial controller. This makes Synaptics touchpad detection possible. Without resetting the Synaptics touchpad is not detected because there are always NACK messages from AUX port.
--- drivers/input/serio/i8042-x86ia64io.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +7 -0
@@ -595,6 +595,13 @@ static const struct dmi_system_id __init }, }, { +/* Lenovo ThinkPad L460 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L460"), + }, + }, + {/* Clevo P650RS, 650RP6, Sager NP8152-S, and others */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
PATCH 32/366 watchdog: f71808e_wdt: Fix WD_EN register read
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <[email protected]>
commit 977f6f68331f94bb72ad84ee96b7b87ce737d89d upstream.
F71808FG_FLAG_WD_EN defines bit position, not a bitmask
--- drivers/watchdog/f71808e_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/f71808e_wdt.c +1 -1
@@ -450,7 +450,7 @@ static bool watchdog_is_running(void) is_running = (superio_inb (watchdog.sioaddr,SIO_REG_ENABLE ) &BIT (0 )) && (superio_inb (watchdog.sioaddr,F71808FG_REG_WDT_CONF ) - &F71808FG_FLAG_WD_EN ); + &BIT (F71808FG_FLAG_WD_EN ));superio_exit (watchdog.sioaddr);
PATCH 33/366 hwmon: (pmbus/max8688) Accept negative page register values
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit a46f8cd696624ef757be0311eb28f119c36778e8 upstream.
A negative page register value means that no page needs to be selected. This is used by status register evaluations and needs to be accepted.
--- drivers/hwmon/pmbus/max8688.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/max8688.c +1 -1
@@ -44,7 +44,7 @@ static int max8688_read_word_data(struct {int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
PATCH 34/366 hwmon: (pmbus/adm1275) Accept negative page register values
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit ecb29abd4cb0670c616fb563a078f25d777ce530 upstream.
A negative page register value means that no page needs to be selected. This is used by status register read operations and needs to be accepted. The failure to do so so results in missed status and limit registers.
--- drivers/hwmon/pmbus/adm1275.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/pmbus/adm1275.c +2 -2
@@ -67,7 +67,7 @@ static int adm1275_read_word_data(structconst struct adm1275_data *data =to_adm1275_data (info);int ret =0 ; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
@@ -144,7 +144,7 @@ static int adm1275_write_word_data(struc {int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
PATCH 35/366 clk: fix mux clock documentation
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
commit fe3f338f0cb2ed4d4f06da054c21ae2f8a36ef2d upstream.
The mux documentation mentions the non-existing parameter width instead of mask, so just sed this.
The table field is missing in the documentation of clk_mux. Add a small blurb explaining what it is
--- include/linux/clk-provider.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/clk-provider.h +2 -1
@@ -356,8 +356,9 @@ struct clk *clk_register_divider_table(s* * @hw: handle between common and hardware-specific interfaces * @reg: register controlling multiplexer +* @table: array of register values corresponding to the parent index * @shift: shift to multiplexer bit field -* @width: width of mutliplexer bit field +* @mask: mask of mutliplexer bit field * @flags: hardware-specific flags * @lock: register lock *
PATCH 36/366 thermal: imx: register irq handler later in probe
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bai Ping <[email protected]>
commit 84866ee5818e95f6e97194656777c10ac24cb9d3 upstream.
The irq handler should be registered after the tempmon module has been initialized in a known state and the thermal_zone and cpu_cooling device have been registered successfully. Otherwise, if the irq is triggled earlier before thermal probe has been finished, it may lead to 'NULL' pointer kernel panic.
--- drivers/thermal/imx_thermal.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/thermal/imx_thermal.c +11 -8
@@ -422,14 +422,6 @@ static int imx_thermal_probe(struct platif (data->irq <0 )return data->irq; - ret =devm_request_threaded_irq (&pdev->dev, data->irq, - imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread, -0 ,"imx_thermal" , data); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to request alarm irq: %d\n" , ret); -return ret; - } -platform_set_drvdata (pdev, data); ret =imx_get_sensor_data (pdev);
@@ -492,6 +484,17 @@ static int imx_thermal_probe(struct platregmap_write (map,TEMPSENSE0 +REG_CLR ,TEMPSENSE0_POWER_DOWN );regmap_write (map,TEMPSENSE0 +REG_SET ,TEMPSENSE0_MEASURE_TEMP ); + ret =devm_request_threaded_irq (&pdev->dev, data->irq, + imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread, +0 ,"imx_thermal" , data); +if (ret <0 ) { +dev_err (&pdev->dev,"failed to request alarm irq: %d\n" , ret); +clk_disable_unprepare (data->thermal_clk); +thermal_zone_device_unregister (data->tz); +cpufreq_cooling_unregister (data->cdev); +return ret; + } + data->irq_enabled = true; data->mode =THERMAL_DEVICE_ENABLED ;
PATCH 37/366 thermal: imx: Fix race condition in imx_thermal_probe()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Lappo <[email protected]>
commit cf1ba1d73a33944d8c1a75370a35434bf146b8a7 upstream.
When device boots with T > T_trip_1 and requests interrupt, the race condition takes place. The interrupt comes before THERMAL_DEVICE_ENABLED is set. This leads to an attempt to reading sensor value from irq and disabling the sensor, based on the data->mode field, which expected to be THERMAL_DEVICE_ENABLED, but still stays as THERMAL_DEVICE_DISABLED. Afher this issue sensor is never re-enabled, as the driver state is wrong.
Fix this problem by setting the 'data' members prior to requesting the interrupts.
--- drivers/thermal/imx_thermal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/thermal/imx_thermal.c +3 -3
@@ -484,6 +484,9 @@ static int imx_thermal_probe(struct platregmap_write (map,TEMPSENSE0 +REG_CLR ,TEMPSENSE0_POWER_DOWN );regmap_write (map,TEMPSENSE0 +REG_SET ,TEMPSENSE0_MEASURE_TEMP ); + data->irq_enabled = true; + data->mode =THERMAL_DEVICE_ENABLED ; + ret =devm_request_threaded_irq (&pdev->dev, data->irq, imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread,0 ,"imx_thermal" , data);
@@ -495,9 +498,6 @@ static int imx_thermal_probe(struct platreturn ret; } - data->irq_enabled = true; - data->mode =THERMAL_DEVICE_ENABLED ; -return 0 ; }
PATCH 38/366 parport_pc: Add support for WCH CH382L PCI-E single parallel port card.
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Gerasiov <[email protected]>
commit 823f7923833c6cc2b16e601546d607dcfb368004 upstream.
WCH CH382L is a PCI-E adapter with 1 parallel port. It is similair to CH382 but serial ports are not soldered on board. Detected as
Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])
--- drivers/parport/parport_pc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/parport/parport_pc.c +4 -0
@@ -2616,6 +2616,7 @@ enum parport_pc_pci_cards { netmos_9901, netmos_9865, quatech_sppxp100, + wch_ch382l, };
@@ -2678,6 +2679,7 @@ static struct parport_pc_pci { /* netmos_9901 */ { 1, { { 0, -1 }, } }, /* netmos_9865 */ { 1, { { 0, -1 }, } }, /* quatech_sppxp100 */ { 1, { { 0, 1 }, } }, + /* wch_ch382l */ { 1, { { 2, -1 }, } }, }; static const struct pci_device_id parport_pc_pci_tbl[] = {
@@ -2767,6 +2769,8 @@ static const struct pci_device_id parpor/* Quatech SPPXP-100 Parallel port PCI ExpressCard */ {PCI_VENDOR_ID_QUATECH ,PCI_DEVICE_ID_QUATECH_SPPXP_100 , PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 }, +/* WCH CH382L PCI-E single parallel port card */ + { 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l }, { 0, } /* terminate list */ };MODULE_DEVICE_TABLE (pci, parport_pc_pci_tbl);
PATCH 39/366 vt: change SGR 21 to follow the standards
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Frysinger <[email protected]>
commit 65d9982d7e523a1a8e7c9af012da0d166f72fc56 upstream.
ECMA-48 [1] (aka ISO 6429) has defined SGR 21 as "doubly underlined" since at least March 1984. The Linux kernel has treated it as SGR 22 "normal intensity" since it was added in Linux-0.96b in June 1992. Before that, it was simply ignored. Other terminal emulators have either ignored it, or treat it as double underline now. xterm for example added support in its 304 release (May 2014) [2] where it was previously ignoring it.
Changing this behavior shouldn't be an issue:
- It isn't a named capability in ncurses's terminfo database, so no script is using libtinfo/libcurses to look this up, or using tput to query & output the right sequence.
- Any script assuming SGR 21 will reset intensity in all terminals already do not work correctly on non-Linux VTs (including running under screen/tmux/etc...).
- If someone has written a script that only runs in the Linux VT, and they're using SGR 21 (instead of SGR 22), the output should still be readable.
imo it's important to change this as the Linux VT's non-conformance is sometimes used as an argument for other terminal emulators to not implement SGR 21 at all, or do so incorrectly.
[1]: https://www.ecma-international.org/publications/standards/Ecma-048.htm
[2]: https://github.com/ThomasDickey/xterm-snapshots/commit/2fd29cb98d214cb536bcafbee00bc73b3f1eeb9d
--- drivers/tty/vt/vt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/vt/vt.c +5 -1
@@ -1303,6 +1303,11 @@ static void csi_m(struct vc_data *vc)case 3 : vc->vc_italic =1 ;break ; +case 21 : +/* +* No console drivers support double underline, so +* convert it to a single underline. +*/ case 4 : vc->vc_underline =1 ;break ;
@@ -1339,7 +1344,6 @@ static void csi_m(struct vc_data *vc) vc->vc_disp_ctrl =1 ; vc->vc_toggle_meta =1 ;break ; -case 21 :case 22 : vc->vc_intensity =1 ;break ;
PATCH 40/366 perf top: Document --ignore-vmlinux
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit a8403912d04e2c8271653bb5b7f6294dc6d322ac upstream.
We've had this since 2013, document it.
--- tools/perf/Documentation/perf-top.txt | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/Documentation/perf-top.txt +3 -0
@@ -65,6 +65,9 @@ Default is to monitor all CPUS. --vmlinux=<path>:: Path to vmlinux. Required for annotation functionality. +--ignore-vmlinux:: + Ignore vmlinux files. + -m <pages>:: --mmap-pages=<pages>:: Number of mmap data pages (must be a power of two) or size
PATCH 41/366 ASoC: ssm2602: Replace reg_default_raw with reg_default
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: James Kelly <[email protected]>
commit a01df75ce737951ad13a08d101306e88c3f57cb2 upstream.
SSM2602 driver is broken on recent kernels (at least since 4.9). User space applications such as amixer or alsamixer get EIO when attempting to access codec controls via the relevant IOCTLs.
Root cause of these failures is the regcache_hw_init function in drivers/base/regmap/regcache.c, which prevents regmap cache initalization from the reg_defaults_raw element of the regmap_config structure when registers are write only. It also disables the regmap cache entirely when all registers are write only or volatile as is the case for the SSM2602 driver.
Using the reg_defaults element of the regmap_config structure rather than the reg_defaults_raw element to initalize the regmap cache avoids the logic in the regcache_hw_init function entirely. It also makes this driver consistent with other ASoC codec drivers, as this driver was the ONLY codec driver that used the reg_defaults_raw element to initalize the cache.
Tested on Digilent Zybo Z7 development board which has a SSM2603 codec chip connected to a Xilinx Zynq SoC.
--- sound/soc/codecs/ssm2602.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
sound/soc/codecs/ssm2602.c +13 -6
@@ -54,10 +54,17 @@ struct ssm2602_priv {* using 2 wire for device control, so we cache them instead. * There is no point in caching the reset register */ -static const u16 ssm2602_reg[SSM2602_CACHEREGNUM ] = { -0x0097 ,0x0097 ,0x0079 ,0x0079 , -0x000a ,0x0008 ,0x009f ,0x000a , -0x0000 ,0x0000 +static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM ] = { + { .reg =0x00 , .def =0x0097 }, + { .reg =0x01 , .def =0x0097 }, + { .reg =0x02 , .def =0x0079 }, + { .reg =0x03 , .def =0x0079 }, + { .reg =0x04 , .def =0x000a }, + { .reg =0x05 , .def =0x0008 }, + { .reg =0x06 , .def =0x009f }, + { .reg =0x07 , .def =0x000a }, + { .reg =0x08 , .def =0x0000 }, + { .reg =0x09 , .def =0x0000 } };
@@ -629,8 +636,8 @@ const struct regmap_config ssm2602_regma .volatile_reg = ssm2602_register_volatile, .cache_type = REGCACHE_RBTREE, - .reg_defaults_raw = ssm2602_reg, - .num_reg_defaults_raw = ARRAY_SIZE(ssm2602_reg), + .reg_defaults = ssm2602_reg, + .num_reg_defaults = ARRAY_SIZE(ssm2602_reg), };EXPORT_SYMBOL_GPL (ssm2602_regmap_config);
PATCH 42/366 media: rc: oops in ir_timer_keyup after device unplug
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sean Young <[email protected]>
commit 8d4068810d9926250dd2435719a080b889eb44c3 upstream.
If there is IR in the raw kfifo when ir_raw_event_unregister() is called, then kthread_stop() causes ir_raw_event_thread to be scheduled, decode some scancodes and re-arm timer_keyup. The timer_keyup then fires when the rc device is long gone.
[bwh: Backported to 3.16:
- There's no timer_repeat to move
- Adjust context]
---
drivers/media/rc/rc-main.c +2 -2
@@ -1427,13 +1427,13 @@ void rc_unregister_device(struct rc_devif (!dev)return ; -del_timer_sync (&dev->timer_keyup); -clear_bit (dev->devno, ir_core_dev_number);if (dev->driver_type ==RC_DRIVER_IR_RAW )ir_raw_event_unregister (dev); +del_timer_sync (&dev->timer_keyup); +/* Freeing the table should also call the stop callback */ ir_free_table (&dev->rc_map);IR_dprintk (1 ,"Freed keycode table\n" );
PATCH 43/366 ARM: dts: at91: at91sam9g25: fix mux-mask pinctrl property
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Ferre <[email protected]>
commit e8fd0adf105e132fd84545997bbef3d5edc2c9c1 upstream.
There are only 19 PIOB pins having primary names PB0-PB18. Not all of them have a 'C' function. So the pinctrl property mask ends up being the same as the other SoC of the at91sam9x5 series.
--- arch/arm/boot/dts/at91sam9g25.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/at91sam9g25.dtsi +1 -1
@@ -20,7 +20,7 @@ atmel,mux-mask = < /* A B C */ 0xffffffff 0xffe0399f 0xc000001c /* pioA */ - 0x0007ffff 0x8000fe3f 0x00000000 /* pioB */ + 0x0007ffff 0x00047e3f 0x00000000 /* pioB */ 0x80000000 0x07c0ffff 0xb83fffff /* pioC */ 0x003fffff 0x003f8000 0x00000000 /* pioD */ >;
PATCH 44/366 usb: dwc3: pci: Properly cleanup resource
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit cabdf83dadfb3d83eec31e0f0638a92dbd716435 upstream.
Platform device is allocated before adding resources. Make sure to properly cleanup on error case.
--- drivers/usb/dwc3/dwc3-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-pci.c +1 -1
@@ -144,7 +144,7 @@ static int dwc3_pci_probe(struct pci_dev ret =platform_device_add_resources (dwc3, res,ARRAY_SIZE (res));if (ret) {dev_err (dev,"couldn't add resources to dwc3 device\n" ); -return ret; + goto err3; }pci_set_drvdata (pci, glue);
PATCH 45/366 ext4: protect i_disksize update by i_data_sem in direct write path
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eryu Guan <[email protected]>
commit 73fdad00b208b139cf43f3163fbc0f67e4c6047c upstream.
i_disksize update should be protected by i_data_sem, by either taking the lock explicitly or by using ext4_update_i_disksize() helper. But the i_disksize updates in ext4_direct_IO_write() are not protected at all, which may be racing with i_disksize updates in writeback path in delalloc buffer write path.
This is found by code inspection, and I didn't hit any i_disksize corruption due to this bug. Thanks to Jan Kara for catching this bug and suggesting the fix!
---
fs/ext4/indirect.c +2 -3
@@ -649,7 +649,6 @@ ssize_t ext4_ind_direct_IO(int rw, struc {struct file *file = iocb->ki_filp;struct inode *inode = file->f_mapping->host; -struct ext4_inode_info *ei =EXT4_I (inode);handle_t *handle;ssize_t ret;int orphan =0 ;
@@ -672,7 +671,7 @@ ssize_t ext4_ind_direct_IO(int rw, struc goto out; } orphan =1 ; - ei->i_disksize = inode->i_size; +ext4_update_i_disksize (inode, inode->i_size);ext4_journal_stop (handle); } }
@@ -731,7 +730,7 @@ locked:if (ret >0 ) {loff_t end = offset + ret;if (end > inode->i_size) { - ei->i_disksize = end; +ext4_update_i_disksize (inode, end);i_size_write (inode, end);/* * We're going to return a positive `ret'
PATCH 46/366 USB: serial: ftdi_sio: add RT Systems VX-8 cable
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Major Hayden <[email protected]>
commit 9608e5c0f079390473b484ef92334dfd3431bb89 upstream.
This patch adds a device ID for the RT Systems cable used to program Yaesu VX-8R/VX-8DR handheld radios. It uses the main FTDI VID instead of the common RT Systems VID.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -786,6 +786,7 @@ static const struct usb_device_id id_tab .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, + { USB_DEVICE(FTDI_VID, RTSYSTEMS_USB_VX8_PID) }, { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) },
drivers/usb/serial/ftdi_sio_ids.h +3 -0
@@ -922,6 +922,9 @@/* * RT Systems programming cables for various ham radios */ +/* This device uses the VID of FTDI */ +#define RTSYSTEMS_USB_VX8_PID 0x9e50/* USB-VX8 USB to 7 pin modular plug for Yaesu VX-8 radio */ +#define RTSYSTEMS_VID 0x2100/* Vendor ID */ #define RTSYSTEMS_USB_S03_PID 0x9001/* RTS-03 USB to Serial Adapter */ #define RTSYSTEMS_USB_59_PID 0x9e50/* USB-59 USB to 8 pin plug */
PATCH 47/366 USB: serial: cp210x: add ELDAT Easywave RX09 id
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 1f1e82f74c0947e40144688c9e36abe4b3999f49 upstream.
Add device id for ELDAT Easywave RX09 tranceiver.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -151,6 +151,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */ { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ + { USB_DEVICE(0x155A, 0x1006) }, /* ELDAT Easywave RX09 */ { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */ { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
PATCH 48/366 USB: serial: ftdi_sio: add support for Harman FirmwareHubEmulator
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Clemens Werther <[email protected]>
commit 6555ad13a01952c16485c82a52ad1f3e07e34b3a upstream.
Add device id for Harman FirmwareHubEmulator to make the device auto-detectable by the driver.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -949,6 +949,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_FHE_PID) }, { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -1444,6 +1444,12 @@#define FTDI_CINTERION_MC55I_PID 0xA951/* +* Product: FirmwareHubEmulator +* Manufacturer: Harman Becker Automotive Systems +*/ +#define FTDI_FHE_PID 0xA9A0 + +/* * Product: Comet Caller ID decoder * Manufacturer: Crucible Technologies */
PATCH 49/366 USB:fix USB3 devices behind USB3 hubs not resuming at hibernate thaw
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Zhengjun Xing <[email protected]>
commit 64627388b50158fd24d6ad88132525b95a5ef573 upstream.
USB3 hubs don't support global suspend.
USB3 specification 10.10, Enhanced SuperSpeed hubs only support selective suspend and resume, they do not support global suspend/resume where the hub downstream facing ports states are not affected.
When system enters hibernation it first enters freeze process where only the root hub enters suspend, usb_port_suspend() is not called for other devices, and suspend status flags are not set for them. Other devices are expected to suspend globally. Some external USB3 hubs will suspend the downstream facing port at global suspend. These devices won't be resumed at thaw as the suspend status flag is not set.
A USB3 removable hard disk connected through a USB3 hub that won't resume at thaw will fail to synchronize SCSI cache, return “cmd cmplt err -71” error, and needs a 60 seconds timeout which causing system hang for 60s before the USB host reset the port for the USB3 removable hard disk to recover.
Fix this by always calling usb_port_suspend() during freeze for USB3 devices.
--- drivers/usb/core/generic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/core/generic.c +7 -2
@@ -208,8 +208,13 @@ static int generic_suspend(struct usb_deif (!udev->parent) rc =hcd_bus_suspend (udev, msg); -/* Non-root devices don't need to do anything for FREEZE or PRETHAW */ -else if (msg.event ==PM_EVENT_FREEZE || msg.event ==PM_EVENT_PRETHAW ) +/* +* Non-root USB2 devices don't need to do anything for FREEZE +* or PRETHAW. USB3 devices don't support global suspend and +* needs to be selectively suspended. +*/ +else if ((msg.event ==PM_EVENT_FREEZE || msg.event ==PM_EVENT_PRETHAW ) + && (udev->speed <USB_SPEED_SUPER )) rc =0 ;else rc =usb_port_suspend (udev, msg);
PATCH 50/366 crypto: arm,arm64 - Fix random regeneration of S_shipped
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leonard Crestez <[email protected]>
commit 6aaf49b495b446ff6eec0ac983f781ca0dc56a73 upstream.
The decision to rebuild .S_shipped is made based on the relative timestamps of .S_shipped and .pl files but git makes this essentially random. This means that the perl script might run anyway (usually at most once per checkout), defeating the whole purpose of _shipped.
Fix by skipping the rule unless explicit make variables are provided:REGENERATE_ARM_CRYPTO or REGENERATE_ARM64_CRYPTO.
This can produce nasty occasional build failures downstream, for example for toolchains with broken perl. The solution is minimally intrusive to make it easier to push into stable.
Another report on a similar issue here: https://lkml.org/lkml/2018/3/8/1379
---
arch/arm/crypto/Makefile +2 -0
@@ -10,10 +10,12 @@ aes-arm-y := aes-armv4.o aes_glue.o aes-arm-bs-y := aesbs-core.o aesbs-glue.o sha1-arm-y := sha1-armv4-large.o sha1_glue.o +ifdef REGENERATE_ARM_CRYPTO quiet_cmd_perl = PERL $@ cmd_perl = $(PERL) $(<) > $(@) $(src)/aesbs-core.S_shipped: $(src)/bsaes-armv7.pl $(call cmd,perl) +endif .PRECIOUS: $(obj)/aesbs-core.S
PATCH 51/366 ACPI / hotplug / PCI: Check presence of slot itself in get_slot_status()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
commit 13d3047c81505cc0fb9bdae7810676e70523c8bf upstream.
Mike Lothian reported that plugging in a USB-C device does not work properly in his Dell Alienware system. This system has an Intel Alpine Ridge Thunderbolt controller providing USB-C functionality. In these systems the USB controller (xHCI) is hotplugged whenever a device is connected to the port using ACPI-based hotplug.
The ACPI description of the root port in question is as follows:
Device (RP01)
{
Name (_ADR, 0x001C0000) Device (PXSX)
{
Name (_ADR, 0x02)
Method (_RMV, 0, NotSerialized)
{
// ...
}
}Here _ADR 0x02 means device 0, function 2 on the bus under root port (RP01) but that seems to be incorrect because device 0 is the upstream port of the Alpine Ridge PCIe switch and it has no functions other than 0 (the bridge itself). When we get ACPI Notify() to the root port resulting from connecting a USB-C device, Linux tries to read PCI_VENDOR_ID from device 0, function 2 which of course always returns 0xffffffff because there is no such function and we never find the device.
In Windows this works fine.
Now, since we get ACPI Notify() to the root port and not to the PXSX device we should actually start our scan from there as well and not from the non-existent PXSX device. Fix this by checking presence of the slot itself (function 0) if we fail to do that otherwise.
While there use pci_bus_read_dev_vendor_id() in get_slot_status(), which is the recommended way to read Device and Vendor IDs of devices on PCI buses.
--- drivers/pci/hotplug/acpiphp_glue.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/pci/hotplug/acpiphp_glue.c +16 -7
@@ -601,6 +601,7 @@ static unsigned int get_slot_status(stru {unsigned long long sta =0 ;struct acpiphp_func *func; +u32 dvid;list_for_each_entry (func, &slot->funcs, sibling) {if (func->flags &FUNC_HAS_STA ) {
@@ -611,19 +612,27 @@ static unsigned int get_slot_status(struif (ACPI_SUCCESS (status) && sta)break ; }else { -u32 dvid; - -pci_bus_read_config_dword (slot->bus, -PCI_DEVFN (slot->device, - func->function), -PCI_VENDOR_ID , &dvid); -if (dvid !=0xffffffff ) { +if (pci_bus_read_dev_vendor_id (slot->bus, +PCI_DEVFN (slot->device, func->function), + &dvid,0 )) { sta =ACPI_STA_ALL ;break ; } } } +if (!sta) { +/* +* Check for the slot itself since it may be that the +* ACPI slot is a device below PCIe upstream port so in +* that case it may not even be reachable yet. +*/ +if (pci_bus_read_dev_vendor_id (slot->bus, +PCI_DEVFN (slot->device,0 ), &dvid,0 )) { + sta =ACPI_STA_ALL ; + } + } +return (unsigned int )sta; }
PATCH 52/366 ALSA: pcm: Use ERESTARTSYS instead of EINTR in OSS emulation
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit c64ed5dd9feba193c76eb460b451225ac2a0d87b upstream.
Fix the last standing EINTR in the whole subsystem. Use more correct ERESTARTSYS for pending signals.
--- sound/core/oss/pcm_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/oss/pcm_oss.c +1 -1
@@ -852,7 +852,7 @@ static int snd_pcm_oss_change_params(strif (!(mutex_trylock (&runtime->oss.params_lock)))return -EAGAIN ; }else if (mutex_lock_interruptible (&runtime->oss.params_lock)) -return -EINTR ; +return -ERESTARTSYS ; sw_params =kmalloc (sizeof (*sw_params),GFP_KERNEL ); params =kmalloc (sizeof (*params),GFP_KERNEL ); sparams =kmalloc (sizeof (*sparams),GFP_KERNEL );
PATCH 53/366 ALSA: pcm: Avoid potential races between OSS ioctls and read/write
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 02a5d6925cd34c3b774bdb8eefb057c40a30e870 upstream.
Although we apply the params_lock mutex to the whole read and write operations as well as snd_pcm_oss_change_params(), we may still face some races.
First off, the params_lock is taken inside the read and write loop. This is intentional for avoiding the too long locking, but it allows the in-between parameter change, which might lead to invalid pointers. We check the readiness of the stream and set up via snd_pcm_oss_make_ready() at the beginning of read and write, but it's called only once, by assuming that it remains ready in the rest.
Second, many ioctls that may change the actual parameters (i.e. setting runtime->oss.params=1) aren't protected, hence they can be processed in a half-baked state.
This patch is an attempt to plug these holes. The stream readiness check is moved inside the read/write inner loop, so that the stream is always set up in a proper state before further processing. Also, each ioctl that may change the parameter is wrapped with the params_lock for avoiding the races.
The issues were triggered by syzkaller in a few different scenarios, particularly the one below appearing as GPF in loopback_pos_update.
--- sound/core/oss/pcm_oss.c | 134 +++++++++++++++++++++++++++++++-------- 1 file changed, 106 insertions(+), 28 deletions(-)
sound/core/oss/pcm_oss.c +106 -28
@@ -833,8 +833,8 @@ static int choose_rate(struct snd_pcm_sureturn snd_pcm_hw_param_near (substream, params,SNDRV_PCM_HW_PARAM_RATE , best_rate,NULL ); } -static int snd_pcm_oss_change_params (struct snd_pcm_substream *substream, -bool trylock) +/* call with params_lock held */ +static int snd_pcm_oss_change_params_locked (struct snd_pcm_substream *substream) {struct snd_pcm_runtime *runtime = substream->runtime;struct snd_pcm_hw_params *params, *sparams;
@@ -848,11 +848,8 @@ static int snd_pcm_oss_change_params(strstruct snd_mask sformat_mask;struct snd_mask mask; -if (trylock) { -if (!(mutex_trylock (&runtime->oss.params_lock))) -return -EAGAIN ; - }else if (mutex_lock_interruptible (&runtime->oss.params_lock)) -return -ERESTARTSYS ; +if (!runtime->oss.params) +return 0 ; sw_params =kmalloc (sizeof (*sw_params),GFP_KERNEL ); params =kmalloc (sizeof (*params),GFP_KERNEL ); sparams =kmalloc (sizeof (*sparams),GFP_KERNEL );
@@ -1080,6 +1077,23 @@ failure:kfree (sw_params);kfree (params);kfree (sparams); +return err; +} + +/* this one takes the lock by itself */ +static int snd_pcm_oss_change_params (struct snd_pcm_substream *substream, +bool trylock) +{ +struct snd_pcm_runtime *runtime = substream->runtime; +int err; + +if (trylock) { +if (!(mutex_trylock (&runtime->oss.params_lock))) +return -EAGAIN ; + }else if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ; + + err =snd_pcm_oss_change_params_locked (substream);mutex_unlock (&runtime->oss.params_lock);return err; }
@@ -1108,11 +1122,14 @@ static int snd_pcm_oss_get_active_substrreturn 0 ; } +/* call with params_lock held */ static int snd_pcm_oss_prepare (struct snd_pcm_substream *substream) {int err;struct snd_pcm_runtime *runtime = substream->runtime; +if (!runtime->oss.prepare) +return 0 ; err =snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_PREPARE ,NULL );if (err <0 ) { pcm_dbg(substream->pcm,
@@ -1132,8 +1149,6 @@ static int snd_pcm_oss_make_ready(structstruct snd_pcm_runtime *runtime;int err; -if (substream ==NULL ) -return 0 ; runtime = substream->runtime;if (runtime->oss.params) { err =snd_pcm_oss_change_params (substream, false);
@@ -1141,6 +1156,29 @@ static int snd_pcm_oss_make_ready(structreturn err; }if (runtime->oss.prepare) { +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ; + err =snd_pcm_oss_prepare (substream); +mutex_unlock (&runtime->oss.params_lock); +if (err <0 ) +return err; + } +return 0 ; +} + +/* call with params_lock held */ +static int snd_pcm_oss_make_ready_locked (struct snd_pcm_substream *substream) +{ +struct snd_pcm_runtime *runtime; +int err; + + runtime = substream->runtime; +if (runtime->oss.params) { + err =snd_pcm_oss_change_params_locked (substream); +if (err <0 ) +return err; + } +if (runtime->oss.prepare) { err =snd_pcm_oss_prepare (substream);if (err <0 )return err;
@@ -1368,13 +1406,14 @@ static ssize_t snd_pcm_oss_write1(structif (atomic_read (&substream->mmap_count))return -ENXIO ; -if ((tmp =snd_pcm_oss_make_ready (substream)) <0 ) -return tmp;while (bytes >0 ) {if (mutex_lock_interruptible (&runtime->oss.params_lock)) { tmp = -ERESTARTSYS ;break ; } + tmp =snd_pcm_oss_make_ready_locked (substream); +if (tmp <0 ) + goto err;if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used >0 ) { tmp = bytes;if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes)
@@ -1475,13 +1514,14 @@ static ssize_t snd_pcm_oss_read1(structif (atomic_read (&substream->mmap_count))return -ENXIO ; -if ((tmp =snd_pcm_oss_make_ready (substream)) <0 ) -return tmp;while (bytes >0 ) {if (mutex_lock_interruptible (&runtime->oss.params_lock)) { tmp = -ERESTARTSYS ;break ; } + tmp =snd_pcm_oss_make_ready_locked (substream); +if (tmp <0 ) + goto err;if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used >0 ) {if (runtime->oss.buffer_used ==0 ) { tmp =snd_pcm_oss_read2 (substream, runtime->oss.buffer, runtime->oss.period_bytes,1 );
@@ -1537,10 +1577,12 @@ static int snd_pcm_oss_reset(struct snd_continue ; runtime = substream->runtime;snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_DROP ,NULL ); +mutex_lock (&runtime->oss.params_lock); runtime->oss.prepare =1 ; runtime->oss.buffer_used =0 ; runtime->oss.prev_hw_ptr_period =0 ; runtime->oss.period_ptr =0 ; +mutex_unlock (&runtime->oss.params_lock); }return 0 ; }
@@ -1626,9 +1668,10 @@ static int snd_pcm_oss_sync(struct snd_p goto __direct;if ((err =snd_pcm_oss_make_ready (substream)) <0 )return err; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ; format =snd_pcm_oss_format_from (runtime->oss.format); width =snd_pcm_format_physical_width (format); -mutex_lock (&runtime->oss.params_lock);if (runtime->oss.buffer_used >0 ) {#ifdef OSS_DEBUG pcm_dbg (substream->pcm,"sync: buffer_used\n" );
@@ -1696,7 +1739,9 @@ static int snd_pcm_oss_sync(struct snd_p substream->f_flags = saved_f_flags;if (err <0 )return err; +mutex_lock (&runtime->oss.params_lock); runtime->oss.prepare =1 ; +mutex_unlock (&runtime->oss.params_lock); } substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE ];
@@ -1707,8 +1752,10 @@ static int snd_pcm_oss_sync(struct snd_p err =snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_DROP ,NULL );if (err <0 )return err; +mutex_lock (&runtime->oss.params_lock); runtime->oss.buffer_used =0 ; runtime->oss.prepare =1 ; +mutex_unlock (&runtime->oss.params_lock); }return 0 ; }
@@ -1727,10 +1774,13 @@ static int snd_pcm_oss_set_rate(struct s rate =1000 ; else if (rate > 192000) rate =192000 ; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ;if (runtime->oss.rate != rate) { runtime->oss.params =1 ; runtime->oss.rate = rate; } +mutex_unlock (&runtime->oss.params_lock); }return snd_pcm_oss_get_rate (pcm_oss_file); }
@@ -1758,10 +1808,13 @@ static int snd_pcm_oss_set_channels(struif (substream ==NULL )continue ; runtime = substream->runtime; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ;if (runtime->oss.channels != channels) { runtime->oss.params =1 ; runtime->oss.channels = channels; } +mutex_unlock (&runtime->oss.params_lock); }return snd_pcm_oss_get_channels (pcm_oss_file); }
@@ -1845,10 +1898,13 @@ static int snd_pcm_oss_set_format(structif (substream ==NULL )continue ; runtime = substream->runtime; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ;if (runtime->oss.format != format) { runtime->oss.params =1 ; runtime->oss.format = format; } +mutex_unlock (&runtime->oss.params_lock); } }return snd_pcm_oss_get_format (pcm_oss_file);
@@ -1868,8 +1924,6 @@ static int snd_pcm_oss_set_subdivide1(st {struct snd_pcm_runtime *runtime; -if (substream ==NULL ) -return 0 ; runtime = substream->runtime;if (subdivide ==0 ) { subdivide = runtime->oss.subdivision;
@@ -1893,9 +1947,16 @@ static int snd_pcm_oss_set_subdivide(strfor (idx =1 ; idx >=0 ; --idx) {struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; +struct snd_pcm_runtime *runtime; +if (substream ==NULL )continue ; -if ((err =snd_pcm_oss_set_subdivide1 (substream, subdivide)) <0 ) + runtime = substream->runtime; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ; + err =snd_pcm_oss_set_subdivide1 (substream, subdivide); +mutex_unlock (&runtime->oss.params_lock); +if (err <0 )return err; }return err;
@@ -1905,8 +1966,6 @@ static int snd_pcm_oss_set_fragment1(str {struct snd_pcm_runtime *runtime; -if (substream ==NULL ) -return 0 ; runtime = substream->runtime;if (runtime->oss.subdivision || runtime->oss.fragshift)return -EINVAL ;
@@ -1926,9 +1985,16 @@ static int snd_pcm_oss_set_fragment(strufor (idx =1 ; idx >=0 ; --idx) {struct snd_pcm_substream *substream = pcm_oss_file->streams[idx]; +struct snd_pcm_runtime *runtime; +if (substream ==NULL )continue ; -if ((err =snd_pcm_oss_set_fragment1 (substream, val)) <0 ) + runtime = substream->runtime; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ; + err =snd_pcm_oss_set_fragment1 (substream, val); +mutex_unlock (&runtime->oss.params_lock); +if (err <0 )return err; }return err;
@@ -2012,6 +2078,9 @@ static int snd_pcm_oss_set_trigger(struc }if (psubstream) { runtime = psubstream->runtime; + cmd =0 ; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ;if (trigger &PCM_ENABLE_OUTPUT ) {if (runtime->oss.trigger) goto _skip1;
@@ -2029,13 +2098,19 @@ static int snd_pcm_oss_set_trigger(struc cmd =SNDRV_PCM_IOCTL_DROP ; runtime->oss.prepare =1 ; } - err =snd_pcm_kernel_ioctl (psubstream, cmd,NULL ); -if (err <0 ) -return err; - } _skip1: +mutex_unlock (&runtime->oss.params_lock); +if (cmd) { + err =snd_pcm_kernel_ioctl (psubstream, cmd,NULL ); +if (err <0 ) +return err; + } + }if (csubstream) { runtime = csubstream->runtime; + cmd =0 ; +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ;if (trigger &PCM_ENABLE_INPUT ) {if (runtime->oss.trigger) goto _skip2;
@@ -2050,11 +2125,14 @@ static int snd_pcm_oss_set_trigger(struc cmd =SNDRV_PCM_IOCTL_DROP ; runtime->oss.prepare =1 ; } - err =snd_pcm_kernel_ioctl (csubstream, cmd,NULL ); -if (err <0 ) -return err; - } _skip2: +mutex_unlock (&runtime->oss.params_lock); +if (cmd) { + err =snd_pcm_kernel_ioctl (csubstream, cmd,NULL ); +if (err <0 ) +return err; + } + }return 0 ; }
PATCH 54/366 ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 40cab6e88cb0b6c56d3f30b7491a20e803f948f6 upstream.
OSS PCM stream management isn't modal but it allows ioctls issued at any time for changing the parameters. In the previous hardening patch ("ALSA: pcm: Avoid potential races between OSS ioctls and read/write"), we covered these races and prevent the corruption by protecting the concurrent accesses via params_lock mutex. However, this means that some ioctls that try to change the stream parameter (e.g. channels or format) would be blocked until the read/write finishes, and it may take really long.
Basically changing the parameter while reading/writing is an invalid operation, hence it's even more user-friendly from the API POV if it returns -EBUSY in such a situation.
This patch adds such checks in the relevant ioctls with the addition of read/write access refcount.
--- include/sound/pcm_oss.h | 1 + sound/core/oss/pcm_oss.c | 36 +++++++++++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-)
include/sound/pcm_oss.h +1 -0
@@ -57,6 +57,7 @@ struct snd_pcm_oss_runtime {char *buffer;/* vmallocated period */ size_t buffer_used;/* used length from period buffer */ struct mutex params_lock; +atomic_t rw_ref;/* concurrent read/write accesses */ #ifdef CONFIG_SND_PCM_OSS_PLUGINS struct snd_pcm_plugin *plugin_first;struct snd_pcm_plugin *plugin_last;
sound/core/oss/pcm_oss.c +27 -9
@@ -1406,6 +1406,7 @@ static ssize_t snd_pcm_oss_write1(structif (atomic_read (&substream->mmap_count))return -ENXIO ; +atomic_inc (&runtime->oss.rw_ref);while (bytes >0 ) {if (mutex_lock_interruptible (&runtime->oss.params_lock)) { tmp = -ERESTARTSYS ;
@@ -1469,6 +1470,7 @@ static ssize_t snd_pcm_oss_write1(struct } tmp =0 ; } +atomic_dec (&runtime->oss.rw_ref);return xfer >0 ? (snd_pcm_sframes_t )xfer : tmp; }
@@ -1514,6 +1516,7 @@ static ssize_t snd_pcm_oss_read1(structif (atomic_read (&substream->mmap_count))return -ENXIO ; +atomic_inc (&runtime->oss.rw_ref);while (bytes >0 ) {if (mutex_lock_interruptible (&runtime->oss.params_lock)) { tmp = -ERESTARTSYS ;
@@ -1562,6 +1565,7 @@ static ssize_t snd_pcm_oss_read1(struct } tmp =0 ; } +atomic_dec (&runtime->oss.rw_ref);return xfer >0 ? (snd_pcm_sframes_t )xfer : tmp; }
@@ -1668,8 +1672,11 @@ static int snd_pcm_oss_sync(struct snd_p goto __direct;if ((err =snd_pcm_oss_make_ready (substream)) <0 )return err; -if (mutex_lock_interruptible (&runtime->oss.params_lock)) +atomic_inc (&runtime->oss.rw_ref); +if (mutex_lock_interruptible (&runtime->oss.params_lock)) { +atomic_dec (&runtime->oss.rw_ref);return -ERESTARTSYS ; + } format =snd_pcm_oss_format_from (runtime->oss.format); width =snd_pcm_format_physical_width (format);if (runtime->oss.buffer_used >0 ) {
@@ -1681,10 +1688,8 @@ static int snd_pcm_oss_sync(struct snd_p runtime->oss.buffer + runtime->oss.buffer_used, size); err =snd_pcm_oss_sync1 (substream, runtime->oss.period_bytes); -if (err <0 ) { -mutex_unlock (&runtime->oss.params_lock); -return err; - } +if (err <0 ) + goto unlock; }else if (runtime->oss.period_ptr >0 ) {#ifdef OSS_DEBUG pcm_dbg (substream->pcm,"sync: period_ptr\n" );
@@ -1694,10 +1699,8 @@ static int snd_pcm_oss_sync(struct snd_p runtime->oss.buffer, size * 8 / width); err =snd_pcm_oss_sync1 (substream, size); -if (err <0 ) { -mutex_unlock (&runtime->oss.params_lock); -return err; - } +if (err <0 ) + goto unlock; }/* * The ALSA's period might be a bit large than OSS one.
@@ -1728,7 +1731,11 @@ static int snd_pcm_oss_sync(struct snd_psnd_pcm_lib_writev (substream, buffers, size); } } +unlock:mutex_unlock (&runtime->oss.params_lock); +atomic_dec (&runtime->oss.rw_ref); +if (err <0 ) +return err;/* * finish sync: drain the buffer */
@@ -1776,6 +1783,8 @@ static int snd_pcm_oss_set_rate(struct s rate =192000 ;if (mutex_lock_interruptible (&runtime->oss.params_lock))return -ERESTARTSYS ; +if (atomic_read (&runtime->oss.rw_ref)) +return -EBUSY ;if (runtime->oss.rate != rate) { runtime->oss.params =1 ; runtime->oss.rate = rate;
@@ -1810,6 +1819,8 @@ static int snd_pcm_oss_set_channels(stru runtime = substream->runtime;if (mutex_lock_interruptible (&runtime->oss.params_lock))return -ERESTARTSYS ; +if (atomic_read (&runtime->oss.rw_ref)) +return -EBUSY ;if (runtime->oss.channels != channels) { runtime->oss.params =1 ; runtime->oss.channels = channels;
@@ -1898,6 +1909,8 @@ static int snd_pcm_oss_set_format(structif (substream ==NULL )continue ; runtime = substream->runtime; +if (atomic_read (&runtime->oss.rw_ref)) +return -EBUSY ;if (mutex_lock_interruptible (&runtime->oss.params_lock))return -ERESTARTSYS ;if (runtime->oss.format != format) {
@@ -1952,6 +1965,8 @@ static int snd_pcm_oss_set_subdivide(strif (substream ==NULL )continue ; runtime = substream->runtime; +if (atomic_read (&runtime->oss.rw_ref)) +return -EBUSY ;if (mutex_lock_interruptible (&runtime->oss.params_lock))return -ERESTARTSYS ; err =snd_pcm_oss_set_subdivide1 (substream, subdivide);
@@ -1990,6 +2005,8 @@ static int snd_pcm_oss_set_fragment(struif (substream ==NULL )continue ; runtime = substream->runtime; +if (atomic_read (&runtime->oss.rw_ref)) +return -EBUSY ;if (mutex_lock_interruptible (&runtime->oss.params_lock))return -ERESTARTSYS ; err =snd_pcm_oss_set_fragment1 (substream, val);
@@ -2384,6 +2401,7 @@ static void snd_pcm_oss_init_substream(s runtime->oss.maxfrags =0 ; runtime->oss.subdivision =0 ; substream->pcm_release = snd_pcm_oss_release_substream; +atomic_set (&runtime->oss.rw_ref,0 ); }static int snd_pcm_oss_release_file (struct snd_pcm_oss_file *pcm_oss_file)
PATCH 55/366 pinctrl: pinctrl-single: Fix pcs_request_gpio() when bits_per_mux != 0
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Lechner <[email protected]>
commit 45dcb54f014d3d1f5cc3919b5f0c97087d7cb3dd upstream.
This fixes pcs_request_gpio() in the pinctrl-single driver when bits_per_mux != 0. It appears this was overlooked when the multiple pins per register feature was added.
--- drivers/pinctrl/pinctrl-single.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-single.c +19 -3
@@ -562,9 +562,25 @@ static int pcs_request_gpio(struct pinct || pin < frange->offset)continue ; mux_bytes = pcs->width /BITS_PER_BYTE ; - data = pcs->read (pcs->base + pin * mux_bytes) & ~pcs->fmask; - data |= frange->gpiofunc; - pcs->write (data, pcs->base + pin * mux_bytes); + +if (pcs->bits_per_mux) { +int byte_num, offset, pin_shift; + + byte_num = (pcs->bits_per_pin * pin) /BITS_PER_BYTE ; + offset = (byte_num / mux_bytes) * mux_bytes; + pin_shift = pin % (pcs->width / pcs->bits_per_pin) * + pcs->bits_per_pin; + + data = pcs->read (pcs->base + offset); + data &= ~(pcs->fmask << pin_shift); + data |= frange->gpiofunc << pin_shift; + pcs->write (data, pcs->base + offset); + }else { + data = pcs->read (pcs->base + pin * mux_bytes); + data &= ~pcs->fmask; + data |= frange->gpiofunc; + pcs->write (data, pcs->base + pin * mux_bytes); + }break ; }return 0 ;
PATCH 56/366 Btrfs: fix unexpected cow in run_delalloc_nocow
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
commit 5811375325420052fcadd944792a416a43072b7f upstream.
Fstests generic/475 provides a way to fail metadata reads while checking if checksum exists for the inode inside run_delalloc_nocow(), and csum_exist_in_range() interprets error (-EIO) as inode having checksum and makes its caller enter the cow path.
In case of free space inode, this ends up with a warning in cow_file_range().
The same problem applies to btrfs_cross_ref_exist() since it may also read metadata in between.
With this, run_delalloc_nocow() bails out when errors occur at the two places.
---
fs/btrfs/inode.c +33 -4
@@ -1145,6 +1145,8 @@ static noinline int csum_exist_in_range(list_del (&sums->list);kfree (sums); } +if (ret <0 ) +return ret;return 1 ; }
@@ -1294,10 +1296,23 @@ next_slot: goto out_check;if (btrfs_extent_readonly (root, disk_bytenr)) goto out_check; -if (btrfs_cross_ref_exist (trans, root, ino, - found_key.offset - - extent_offset, disk_bytenr)) + ret =btrfs_cross_ref_exist (trans, root, ino, + found_key.offset - + extent_offset, disk_bytenr); +if (ret) { +/* +* ret could be -EIO if the above fails to read +* metadata. +*/ +if (ret <0 ) { +if (cow_start != (u64)-1 ) + cur_offset = cow_start; + goto error; + } + +WARN_ON_ONCE (nolock); goto out_check; + } disk_bytenr += extent_offset; disk_bytenr += cur_offset - found_key.offset; num_bytes =min (end +1 , extent_end) - cur_offset;
@@ -1315,8 +1330,22 @@ next_slot:* this ensure that csum for a given extent are * either valid or do not exist. */ -if (csum_exist_in_range (root, disk_bytenr, num_bytes)) + ret =csum_exist_in_range (root, disk_bytenr, + num_bytes); +if (ret) { + +/* +* ret could be -EIO if the above fails to read +* metadata. +*/ +if (ret <0 ) { +if (cow_start != (u64)-1 ) + cur_offset = cow_start; + goto error; + } +WARN_ON_ONCE (nolock); goto out_check; + } nocow =1 ; }else if (extent_type ==BTRFS_FILE_EXTENT_INLINE ) { extent_end = found_key.offset +
PATCH 57/366 s390/qdio: don't merge ERROR output buffers
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit 0cf1e05157b9e5530dcc3ca9fec9bf617fc93375 upstream.
On an Output queue, both EMPTY and PENDING buffer states imply that the buffer is ready for completion-processing by the upper-layer drivers.
So for a non-QEBSM Output queue, get_buf_states() merges mixed batches of PENDING and EMPTY buffers into one large batch of EMPTY buffers. The upper-layer driver (ie. qeth) later distuingishes PENDING from EMPTY by inspecting the slsb_state for QDIO_OUTBUF_STATE_FLAG_PENDING.
But the merge logic in get_buf_states() contains a bug that causes us to erronously also merge ERROR buffers into such a batch of EMPTY buffers (ERROR is 0xaf, EMPTY is 0xa1; so ERROR & EMPTY == EMPTY). Effectively, most outbound ERROR buffers are currently discarded silently and processed as if they had succeeded.
Note that this affects _all_ non-QEBSM device types, not just IQD with CQ.
Fix it by explicitly spelling out the exact conditions for merging.
For extracting the "get initial state" part out of the loop, this relies on the fact that get_buf_states() is never called with a count of 0. The QEBSM path already strictly requires this, and the two callers with variable 'count' make sure of it.
--- drivers/s390/cio/qdio_main.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
drivers/s390/cio/qdio_main.c +20 -11
@@ -212,7 +212,10 @@ again:return 0 ; } -/* returns number of examined buffers and their common state in *state */ +/* +* Returns number of examined buffers and their common state in *state. +* Requested number of buffers-to-examine must be > 0. +*/ static inline int get_buf_states (struct qdio_q *q,unsigned int bufnr,unsigned char *state,unsigned int count,int auto_ack,int merge_pending)
@@ -223,17 +226,23 @@ static inline int get_buf_states(structif (is_qebsm (q))return qdio_do_eqbs (q, state, bufnr, count, auto_ack); -for (i =0 ; i < count; i++) { -if (!__state) { - __state = q->slsb.val[bufnr]; -if (merge_pending && __state ==SLSB_P_OUTPUT_PENDING ) - __state =SLSB_P_OUTPUT_EMPTY ; - }else if (merge_pending) { -if ((q->slsb.val[bufnr] & __state) != __state) -break ; - }else if (q->slsb.val[bufnr] != __state) -break ; +/* get initial state: */ + __state = q->slsb.val[bufnr]; +if (merge_pending && __state ==SLSB_P_OUTPUT_PENDING ) + __state =SLSB_P_OUTPUT_EMPTY ; + +for (i =1 ; i < count; i++) { bufnr =next_buf (bufnr); + +/* merge PENDING into EMPTY: */ +if (merge_pending && + q->slsb.val[bufnr] ==SLSB_P_OUTPUT_PENDING && + __state ==SLSB_P_OUTPUT_EMPTY ) +continue ; + +/* stop if next state differs from initial state: */ +if (q->slsb.val[bufnr] != __state) +break ; } *state = __state;return i;
PATCH 58/366 s390/qdio: don't retry EQBS after CCQ 96
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit dae55b6fef58530c13df074bcc182c096609339e upstream.
Immediate retry of EQBS after CCQ 96 means that we potentially misreport the state of buffers inspected during the first EQBS call.
This occurs when
1. the first EQBS finds all inspected buffers still in the initial state set by the driver (ie INPUT EMPTY or OUTPUT PRIMED),
2. the EQBS terminates early with CCQ 96, and
3. by the time that the second EQBS comes around, the state of those previously inspected buffers has changed.
If the state reported by the second EQBS is 'driver-owned', all we know is that the previous buffers are driver-owned now as well. But we can't tell if they all have the same state. So for instance
- the second EQBS reports OUTPUT EMPTY, but any number of the previous buffers could be OUTPUT ERROR by now,
- the second EQBS reports OUTPUT ERROR, but any number of the previous buffers could be OUTPUT EMPTY by now.
Effectively, this can result in both over- and underreporting of errors.
If the state reported by the second EQBS is 'HW-owned', that doesn't guarantee that the previous buffers have not been switched to driver-owned in the mean time. So for instance
- the second EQBS reports INPUT EMPTY, but any number of the previous buffers could be INPUT PRIMED (or INPUT ERROR) by now.
This would result in failure to process pending work on the queue. If it's the final check before yielding initiative, this can cause a (temporary) queue stall due to IRQ avoidance.
--- drivers/s390/cio/qdio_main.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/s390/cio/qdio_main.c +2 -9
@@ -126,7 +126,7 @@ static inline int qdio_check_ccq(structstatic int qdio_do_eqbs (struct qdio_q *q,unsigned char *state,int start,int count,int auto_ack) { -int rc, tmp_count = count, tmp_start = start, nr = q->nr, retried =0 ; +int rc, tmp_count = count, tmp_start = start, nr = q->nr;unsigned int ccq =0 ;qperf_inc (q, eqbs);
@@ -149,14 +149,7 @@ again:qperf_inc (q, eqbs_partial);DBF_DEV_EVENT (DBF_WARN , q->irq_ptr,"EQBS part:%02x" , tmp_count); -/* -* Retry once, if that fails bail out and process the -* extracted buffers before trying again. -*/ -if (!retried++) - goto again; -else -return count - tmp_count; +return count - tmp_count; }DBF_ERROR ("%4x EQBS ERROR" ,SCH_NO (q));
PATCH 59/366 ALSA: pcm: Fix mutex unbalance in OSS emulation ioctls
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit f6d297df4dd47ef949540e4a201230d0c5308325 upstream.
The previous fix 40cab6e88cb0 ("ALSA: pcm: Return -EBUSY for OSS ioctls changing busy streams") introduced some mutex unbalance; the check of runtime->oss.rw_ref was inserted in a wrong place after the mutex lock.
This patch fixes the inconsistency by rewriting with the helper functions to lock/unlock parameters with the stream check.
--- sound/core/oss/pcm_oss.c | 67 +++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 25 deletions(-)
sound/core/oss/pcm_oss.c +42 -25
@@ -833,6 +833,23 @@ static int choose_rate(struct snd_pcm_sureturn snd_pcm_hw_param_near (substream, params,SNDRV_PCM_HW_PARAM_RATE , best_rate,NULL ); } +/* parameter locking: returns immediately if tried during streaming */ +static int lock_params (struct snd_pcm_runtime *runtime) +{ +if (mutex_lock_interruptible (&runtime->oss.params_lock)) +return -ERESTARTSYS ; +if (atomic_read (&runtime->oss.rw_ref)) { +mutex_unlock (&runtime->oss.params_lock); +return -EBUSY ; + } +return 0 ; +} + +static void unlock_params (struct snd_pcm_runtime *runtime) +{ +mutex_unlock (&runtime->oss.params_lock); +} +/* call with params_lock held */ static int snd_pcm_oss_change_params_locked (struct snd_pcm_substream *substream) {
@@ -1774,6 +1791,8 @@ static int snd_pcm_oss_set_rate(struct sfor (idx =1 ; idx >=0 ; --idx) {struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];struct snd_pcm_runtime *runtime; +int err; +if (substream ==NULL )continue ; runtime = substream->runtime;
@@ -1781,15 +1800,14 @@ static int snd_pcm_oss_set_rate(struct s rate =1000 ; else if (rate > 192000) rate =192000 ; -if (mutex_lock_interruptible (&runtime->oss.params_lock)) -return -ERESTARTSYS ; -if (atomic_read (&runtime->oss.rw_ref)) -return -EBUSY ; + err =lock_params (runtime); +if (err <0 ) +return err;if (runtime->oss.rate != rate) { runtime->oss.params =1 ; runtime->oss.rate = rate; } -mutex_unlock (&runtime->oss.params_lock); +unlock_params (runtime); }return snd_pcm_oss_get_rate (pcm_oss_file); }
@@ -1814,18 +1832,19 @@ static int snd_pcm_oss_set_channels(strufor (idx =1 ; idx >=0 ; --idx) {struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];struct snd_pcm_runtime *runtime; +int err; +if (substream ==NULL )continue ; runtime = substream->runtime; -if (mutex_lock_interruptible (&runtime->oss.params_lock)) -return -ERESTARTSYS ; -if (atomic_read (&runtime->oss.rw_ref)) -return -EBUSY ; + err =lock_params (runtime); +if (err <0 ) +return err;if (runtime->oss.channels != channels) { runtime->oss.params =1 ; runtime->oss.channels = channels; } -mutex_unlock (&runtime->oss.params_lock); +unlock_params (runtime); }return snd_pcm_oss_get_channels (pcm_oss_file); }
@@ -1896,6 +1915,7 @@ static int snd_pcm_oss_get_formats(strucstatic int snd_pcm_oss_set_format (struct snd_pcm_oss_file *pcm_oss_file,int format) {int formats, idx; +int err;if (format !=AFMT_QUERY ) { formats =snd_pcm_oss_get_formats (pcm_oss_file);
@@ -1909,15 +1929,14 @@ static int snd_pcm_oss_set_format(structif (substream ==NULL )continue ; runtime = substream->runtime; -if (atomic_read (&runtime->oss.rw_ref)) -return -EBUSY ; -if (mutex_lock_interruptible (&runtime->oss.params_lock)) -return -ERESTARTSYS ; + err =lock_params (runtime); +if (err <0 ) +return err;if (runtime->oss.format != format) { runtime->oss.params =1 ; runtime->oss.format = format; } -mutex_unlock (&runtime->oss.params_lock); +unlock_params (runtime); } }return snd_pcm_oss_get_format (pcm_oss_file);
@@ -1965,12 +1984,11 @@ static int snd_pcm_oss_set_subdivide(strif (substream ==NULL )continue ; runtime = substream->runtime; -if (atomic_read (&runtime->oss.rw_ref)) -return -EBUSY ; -if (mutex_lock_interruptible (&runtime->oss.params_lock)) -return -ERESTARTSYS ; + err =lock_params (runtime); +if (err <0 ) +return err; err =snd_pcm_oss_set_subdivide1 (substream, subdivide); -mutex_unlock (&runtime->oss.params_lock); +unlock_params (runtime);if (err <0 )return err; }
@@ -2005,12 +2023,11 @@ static int snd_pcm_oss_set_fragment(struif (substream ==NULL )continue ; runtime = substream->runtime; -if (atomic_read (&runtime->oss.rw_ref)) -return -EBUSY ; -if (mutex_lock_interruptible (&runtime->oss.params_lock)) -return -ERESTARTSYS ; + err =lock_params (runtime); +if (err <0 ) +return err; err =snd_pcm_oss_set_fragment1 (substream, val); -mutex_unlock (&runtime->oss.params_lock); +unlock_params (runtime);if (err <0 )return err; }
PATCH 60/366 hwmon: (nct6775) Fix writing pwmX_mode
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 415eb2a1aaa4881cf85bd86c683356fdd8094a23 upstream.
pwmX_mode is defined in the ABI as 0=DC mode, 1=pwm mode. The chip register bit is set to 1 for DC mode. This got mixed up, and writing 1 into pwmX_mode resulted in DC mode enabled. Fix it up by using the ABI definition throughout the driver for consistency.
--- drivers/hwmon/nct6775.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hwmon/nct6775.c +5 -5
@@ -1287,7 +1287,7 @@ static void nct6775_update_pwm(struct de duty_is_dc = data->REG_PWM_MODE[i] && (nct6775_read_value (data, data->REG_PWM_MODE[i]) & data->PWM_MODE_MASK[i]); - data->pwm_mode[i] = duty_is_dc; + data->pwm_mode[i] = !duty_is_dc; fanmodecfg =nct6775_read_value (data, data->REG_FAN_MODE[i]);for (j =0 ; j <ARRAY_SIZE (data->REG_PWM); j++) {
@@ -2146,7 +2146,7 @@ show_pwm_mode(struct device *dev, structstruct nct6775_data *data =nct6775_update_device (dev);struct sensor_device_attribute *sattr =to_sensor_dev_attr (attr); -return sprintf (buf,"%d\n" , !data->pwm_mode[sattr->index]); +return sprintf (buf,"%d\n" , data->pwm_mode[sattr->index]); } static ssize_t
@@ -2167,9 +2167,9 @@ store_pwm_mode(struct device *dev, strucif (val >1 )return -EINVAL ; -/* Setting DC mode is not supported for all chips/channels */ +/* Setting DC mode (0) is not supported for all chips/channels */ if (data->REG_PWM_MODE[nr] ==0 ) { -if (val) +if (!val)return -EINVAL ;return count; }
@@ -2178,7 +2178,7 @@ store_pwm_mode(struct device *dev, struc data->pwm_mode[nr] = val; reg =nct6775_read_value (data, data->REG_PWM_MODE[nr]); reg &= ~data->PWM_MODE_MASK[nr]; -if (val) +if (!val) reg |= data->PWM_MODE_MASK[nr];nct6775_write_value (data, data->REG_PWM_MODE[nr], reg);mutex_unlock (&data->update_lock);
PATCH 61/366 parisc: Fix HPMC handler by increasing size to multiple of 16 bytes
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit d5654e156bc4d68a87bbaa6d7e020baceddf6e68 upstream.
Make sure that the HPMC (High Priority Machine Check) handler is 16-byte aligned and that it's length in the IVT is a multiple of 16 bytes. Otherwise PDC may decide not to call the HPMC crash handler.
--- arch/parisc/kernel/hpmc.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/parisc/kernel/hpmc.S +5 -1
@@ -79,6 +79,7 @@ END(hpmc_pim_data) .text .import intr_save, code + .align 16 ENTRY(os_hpmc) .os_hpmc:
@@ -295,11 +296,14 @@ os_hpmc_6: b . nop + .align 16 /* make function length multiple of 16 bytes */ ENDPROC(os_hpmc) .os_hpmc_end: nop .data +.globl os_hpmc_size .align 4 - .export os_hpmc_size + .type os_hpmc_size, @object + .size os_hpmc_size, 4 os_hpmc_size: .word .os_hpmc_end-.os_hpmc
PATCH 62/366 parisc: Fix out of array access in match_pci_device()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 615b2665fd20c327b631ff1e79426775de748094 upstream.
As found by the ubsan checker, the value of the 'index' variable can be out of range for the bc[] array:
UBSAN: Undefined behaviour in arch/parisc/kernel/drivers.c:655:21 index 6 is out of range for type 'char [6]' Backtrace: [<104fa850>] __ubsan_handle_out_of_bounds+0x68/0x80 [<1019d83c>] check_parent+0xc0/0x170 [<1019d91c>] descend_children+0x30/0x6c [<1059e164>] device_for_each_child+0x60/0x98 [<1019cd54>] parse_tree_node+0x40/0x54 [<1019d86c>] check_parent+0xf0/0x170 [<1019d91c>] descend_children+0x30/0x6c [<1059e164>] device_for_each_child+0x60/0x98 [<1019d938>] descend_children+0x4c/0x6c [<1059e164>] device_for_each_child+0x60/0x98 [<1019cd54>] parse_tree_node+0x40/0x54 [<1019cffc>] hwpath_to_device+0xa4/0xc4
--- arch/parisc/kernel/drivers.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/parisc/kernel/drivers.c +4 -0
@@ -648,6 +648,10 @@ static int match_pci_device(struct devic (modpath->mod == PCI_FUNC(devfn))); } +/* index might be out of bounds for bc[] */ +if (index >=6 ) +return 0 ; + id =PCI_SLOT (pdev->devfn) | (PCI_FUNC (pdev->devfn) <<5 );return (modpath->bc[index] == id); }
PATCH 63/366 ipc,shm: move BUG_ON check into shm_lock
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
commit c5c8975b2eb4eb7604e8ce4f762987f56d2a96a2 upstream.
Upon every shm_lock call, we BUG_ON if an error was returned, indicating racing either in idr or in shm_destroy. Move this logic into the locking.
--- ipc/shm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
ipc/shm.c +5 -5
@@ -155,8 +155,11 @@ static inline struct shmid_kernel *shm_l {struct kern_ipc_perm *ipcp =ipc_lock (&shm_ids (ns), id); -if (IS_ERR (ipcp)) -return (struct shmid_kernel *)ipcp; +/* +* We raced in the idr lookup or with shm_destroy(). Either way, the +* ID is busted. +*/ +BUG_ON (IS_ERR (ipcp)); return container_of(ipcp, struct shmid_kernel, shm_perm); }
@@ -190,7 +193,6 @@ static void shm_open(struct vm_area_strustruct shmid_kernel *shp; shp =shm_lock (sfd->ns, sfd->id); -BUG_ON (IS_ERR (shp)); shp->shm_atim =get_seconds (); shp->shm_lprid =task_tgid_vnr (current); shp->shm_nattch++;
@@ -256,7 +258,6 @@ static void shm_close(struct vm_area_strdown_write (&shm_ids (ns).rwsem);/* remove from the list of attaches of the shm segment */ shp =shm_lock (ns, sfd->id); -BUG_ON (IS_ERR (shp)); shp->shm_lprid =task_tgid_vnr (current); shp->shm_dtim =get_seconds (); shp->shm_nattch--;
@@ -1199,7 +1200,6 @@ out_fput: out_nattch:down_write (&shm_ids (ns).rwsem); shp =shm_lock (ns, shmid); -BUG_ON (IS_ERR (shp)); shp->shm_nattch--;if (shm_may_destroy (ns, shp))shm_destroy (ns, shp);
PATCH 64/366 ipc: convert invalid scenarios to use WARN_ON
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
commit d0edd8528362c07216498340e928159510595e7b upstream.
Considering Linus' past rants about the (ab)use of BUG in the kernel, I took a look at how we deal with such calls in ipc. Given that any errors or corruption in ipc code are most likely contained within the set of processes participating in the broken mechanisms, there aren't really many strong fatal system failure scenarios that would require a BUG call. Also, if something is seriously wrong, ipc might not be the place for such a BUG either.
1. For example, recently, a customer hit one of these BUG_ONs in shm after failing shm_lock(). A busted ID imho does not merit a BUG_ON, and WARN would have been better.
2. MSG_COPY functionality of posix msgrcv(2) for checkpoint/restore. I don't see how we can hit this anyway -- at least it should be IS_ERR. The 'copy' arg from do_msgrcv is always set by calling prepare_copy() first and foremost. We could also probably drop this check altogether. Either way, it does not merit a BUG_ON.
3. No ->fault() callback for the fs getting the corresponding page -- seems selfish to make the system unusable.
--- ipc/msgutil.c | 2 +- ipc/shm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
ipc/msgutil.c +1 -1
@@ -120,7 +120,7 @@ struct msg_msg *copy_msg(struct msg_msgsize_t len = src->m_ts;size_t alen; -BUG_ON (dst ==NULL ); +WARN_ON (dst ==NULL );if (src->m_ts > dst->m_ts)return ERR_PTR (-EINVAL );
ipc/shm.c +2 -2
@@ -159,7 +159,7 @@ static inline struct shmid_kernel *shm_l* We raced in the idr lookup or with shm_destroy(). Either way, the * ID is busted. */ -BUG_ON (IS_ERR (ipcp)); +WARN_ON (IS_ERR (ipcp)); return container_of(ipcp, struct shmid_kernel, shm_perm); }
@@ -390,7 +390,7 @@ static int shm_mmap(struct file *file, sreturn ret; sfd->vm_ops = vma->vm_ops;#ifdef CONFIG_MMU -BUG_ON (!sfd->vm_ops->fault); +WARN_ON (!sfd->vm_ops->fault);#endif vma->vm_ops = &shm_vm_ops;shm_open (vma);
PATCH 65/366 ipc/shm: handle removed segments gracefully in shm_mmap()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Kirill A. Shutemov" <[email protected]>
commit 1ac0b6dec656f3f78d1c3dd216fad84cb4d0a01e upstream.
remap_file_pages(2) emulation can reach file which represents removed IPC ID as long as a memory segment is mapped. It breaks expectations of IPC subsystem.
Test case (rewritten to be more human readable, originally autogenerated by syzkaller[1]):
#define _GNU_SOURCE
#include <stdlib.h>
#include <sys/ipc.h>
#include <sys/mman.h>
#include <sys/shm.h>
#define PAGE_SIZE 4096
int main()
{
int id;
void *p;
id = shmget(IPC_PRIVATE, 3 * PAGE_SIZE, 0);
p = shmat(id, NULL, 0);
shmctl(id, IPC_RMID, NULL);
remap_file_pages(p, 3 * PAGE_SIZE, 0, 7, 0);
return 0;
}The patch changes shm_mmap() and code around shm_lock() to propagate locking error back to caller of shm_mmap().
[1] http://github.com/google/syzkaller
--- ipc/shm.c | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-)
ipc/shm.c +43 -10
@@ -156,11 +156,12 @@ static inline struct shmid_kernel *shm_lstruct kern_ipc_perm *ipcp =ipc_lock (&shm_ids (ns), id);/* -* We raced in the idr lookup or with shm_destroy(). Either way, the -* ID is busted. +* Callers of shm_lock() must validate the status of the returned ipc +* object pointer (as returned by ipc_lock()), and error out as +* appropriate. */ -WARN_ON (IS_ERR (ipcp)); - +if (IS_ERR (ipcp)) +return (void *)ipcp; return container_of(ipcp, struct shmid_kernel, shm_perm); }
@@ -185,18 +186,33 @@ static inline void shm_rmid(struct ipc_n } -/* This is called by fork, once for every shm attach. */ -static void shm_open (struct vm_area_struct *vma) +static int __shm_open (struct vm_area_struct *vma) {struct file *file = vma->vm_file;struct shm_file_data *sfd =shm_file_data (file);struct shmid_kernel *shp; shp =shm_lock (sfd->ns, sfd->id); + +if (IS_ERR (shp)) +return PTR_ERR (shp); + shp->shm_atim =get_seconds (); shp->shm_lprid =task_tgid_vnr (current); shp->shm_nattch++;shm_unlock (shp); +return 0 ; +} + +/* This is called by fork, once for every shm attach. */ +static void shm_open (struct vm_area_struct *vma) +{ +int err =__shm_open (vma); +/* +* We raced in the idr lookup or with shm_destroy(). +* Either way, the ID is busted. +*/ +WARN_ON_ONCE (err); }/*
@@ -258,6 +274,14 @@ static void shm_close(struct vm_area_strdown_write (&shm_ids (ns).rwsem);/* remove from the list of attaches of the shm segment */ shp =shm_lock (ns, sfd->id); + +/* +* We raced in the idr lookup or with shm_destroy(). +* Either way, the ID is busted. +*/ +if (WARN_ON_ONCE (IS_ERR (shp))) + goto done;/* no-op */ + shp->shm_lprid =task_tgid_vnr (current); shp->shm_dtim =get_seconds (); shp->shm_nattch--;
@@ -265,6 +289,7 @@ static void shm_close(struct vm_area_strshm_destroy (ns, shp); elseshm_unlock (shp ); +done:up_write (&shm_ids (ns).rwsem); }
@@ -385,17 +410,25 @@ static int shm_mmap(struct file *file, sstruct shm_file_data *sfd =shm_file_data (file);int ret; +/* +* In case of remap_file_pages() emulation, the file can represent +* removed IPC ID: propogate shm_lock() error to caller. +*/ + ret =__shm_open (vma); +if (ret) +return ret; + ret = sfd->file->f_op->mmap (sfd->file, vma); -if (ret !=0 ) +if (ret) { +shm_close (vma);return ret; + } sfd->vm_ops = vma->vm_ops;#ifdef CONFIG_MMU WARN_ON (!sfd->vm_ops->fault);#endif vma->vm_ops = &shm_vm_ops; -shm_open (vma); - -return ret; +return 0 ; }static int shm_release (struct inode *ino,struct file *file)
PATCH 66/366 ipc/util: Helpers for making the sysvipc operations pid namespace aware
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 03f1fc09180b345582889a344b012d069b3a6dbe upstream.
Capture the pid namespace when /proc/sysvipc/msg /proc/sysvipc/shm and /proc/sysvipc/sem are opened, and make it available through the new helper ipc_seq_pid_ns.
This makes it possible to report the pids in these files in the pid namespace of the opener of the files.
Implement ipc_update_pid. A simple impline helper that will only update a struct pid pointer if the new value does not equal the old value. This removes the need for wordy code sequences like:
old = object->pid; object->pid = new; put_pid(old);
and
old = object->pid;
if (old != new) {
object->pid = new;
put_pid(old);
}Allowing the following to be written instead:
ipc_update_pid(&object->pid, new);
Which is easier to read and ensures that the pid reference count is not touched the old and the new values are the same. Not touching the reference count in this case is important to help avoid issues like af_unix experienced, where multiple threads of the same process managed to bounce the struct pid between cpu cache lines, but updating the pids reference count.
--- ipc/util.c | 9 +++++++++ ipc/util.h | 11 +++++++++++ 2 files changed, 20 insertions(+)
ipc/util.c +9 -0
@@ -777,9 +777,16 @@ int ipc_parse_version(int *cmd)#ifdef CONFIG_PROC_FS struct ipc_proc_iter {struct ipc_namespace *ns; +struct pid_namespace *pid_ns;struct ipc_proc_iface *iface; }; +struct pid_namespace *ipc_seq_pid_ns (struct seq_file *s) +{ +struct ipc_proc_iter *iter = s->private; +return iter->pid_ns; +} +/* * This routine locks the ipc structure found at least at position pos. */
@@ -914,6 +921,7 @@ static int sysvipc_proc_open(struct inod iter->iface =PDE_DATA (inode); iter->ns =get_ipc_ns (current->nsproxy->ipc_ns); + iter->pid_ns =get_pid_ns (task_active_pid_ns (current)); out:return ret; }
@@ -923,6 +931,7 @@ static int sysvipc_proc_release(struct istruct seq_file *seq = file->private_data;struct ipc_proc_iter *iter = seq->private;put_ipc_ns (iter->ns); +put_pid_ns (iter->pid_ns);return seq_release_private (inode, file); }
ipc/util.h +11 -0
@@ -20,6 +20,7 @@ void msg_init(void);void shm_init (void );struct ipc_namespace ; +struct pid_namespace ;#ifdef CONFIG_POSIX_MQUEUE extern void mq_clear_sbinfo (struct ipc_namespace *ns);
@@ -90,6 +91,7 @@ void ipc_init_ids(struct ipc_ids *);#ifdef CONFIG_PROC_FS void __init ipc_init_proc_interface (const char *path,const char *header,int ids,int (*show)(struct seq_file *,void *)); +struct pid_namespace *ipc_seq_pid_ns (struct seq_file *);#else #define ipc_init_proc_interface (path, header, ids, show) do {} while (0)#endif
@@ -141,6 +143,15 @@ struct kern_ipc_perm *ipcctl_pre_down_no struct ipc_ids *ids, int id, int cmd, struct ipc64_perm *perm, int extra_perm); +static inline void ipc_update_pid (struct pid **pos,struct pid *pid) +{ +struct pid *old = *pos; +if (old != pid) { + *pos =get_pid (pid); +put_pid (old); + } +} +#ifndef CONFIG_ARCH_WANT_IPC_PARSE_VERSION /* On IA-64, we always use the "64-bit version" of the IPC structures. */ # define ipc_parse_version (cmd) IPC_64
PATCH 67/366 ipc/shm: Fix shmctl(..., IPC_STAT, ...) between pid namespaces.
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 98f929b1bd4d0b7c7a77d0d9776d1b924db2e454 upstream.
Today shm_cpid and shm_lpid are remembered in the pid namespace of the creator and the processes that last touched a sysvipc shared memory
segment. If you have processes in multiple pid namespaces that
is just wrong, and I don't know how this has been over-looked for so long.
As only creation and shared memory attach and shared memory detach update the pids I do not expect there to be a repeat of the issues when struct pid was attached to each af_unix skb, which in some notable cases cut the performance in half. The problem was threads of the same process updating same struct pid from different cpus causing the cache line to be highly contended and bounce between cpus.
As creation, attach, and detach are expected to be rare operations for sysvipc shared memory segments I do not expect that kind of cache line ping pong to cause probems. In addition because the pid is at a fixed location in the structure instead of being dynamic on a skb, the reference count of the pid does not need to be updated on each operation if the pid is the same. This ability to simply skip the pid reference count changes if the pid is unchanging further reduces the likelihood of the a cache line holding a pid reference count ping-ponging between cpus.
---
include/linux/shm.h +2 -2
@@ -14,8 +14,8 @@ struct shmid_kernel /* private to the ketime_t shm_atim;time_t shm_dtim;time_t shm_ctim; -pid_t shm_cprid; -pid_t shm_lprid; +struct pid *shm_cprid; +struct pid *shm_lprid;struct user_struct *mlock_user;/* The task created the shm object. NULL if the task is dead. */
ipc/shm.c +13 -8
@@ -198,7 +198,7 @@ static int __shm_open(struct vm_area_strreturn PTR_ERR (shp); shp->shm_atim =get_seconds (); - shp->shm_lprid =task_tgid_vnr (current); +ipc_update_pid (&shp->shm_lprid,task_tgid (current)); shp->shm_nattch++;shm_unlock (shp);return 0 ;
@@ -238,6 +238,8 @@ static void shm_destroy(struct ipc_nameselse if (shp->mlock_user)user_shm_unlock (file_inode (shm_file)->i_size, shp->mlock_user);fput (shm_file); +ipc_update_pid (&shp->shm_cprid,NULL ); +ipc_update_pid (&shp->shm_lprid,NULL );ipc_rcu_putref (shp, shm_rcu_free); }
@@ -282,7 +284,7 @@ static void shm_close(struct vm_area_strif (WARN_ON_ONCE (IS_ERR (shp))) goto done;/* no-op */ - shp->shm_lprid =task_tgid_vnr (current); +ipc_update_pid (&shp->shm_lprid,task_tgid (current)); shp->shm_dtim =get_seconds (); shp->shm_nattch--;if (shm_may_destroy (ns, shp))
@@ -581,8 +583,8 @@ static int newseg(struct ipc_namespace *if (IS_ERR (file)) goto no_file; - shp->shm_cprid =task_tgid_vnr (current); - shp->shm_lprid =0 ; + shp->shm_cprid =get_pid (task_tgid (current)); + shp->shm_lprid =NULL ; shp->shm_atim = shp->shm_dtim =0 ; shp->shm_ctim =get_seconds (); shp->shm_segsz = size;
@@ -614,6 +616,8 @@ no_id:user_shm_unlock (size, shp->mlock_user);fput (file); no_file: +ipc_update_pid (&shp->shm_cprid,NULL ); +ipc_update_pid (&shp->shm_lprid,NULL );ipc_rcu_putref (shp, shm_rcu_free);return error; }
@@ -952,8 +956,8 @@ static int shmctl_nolock(struct ipc_name tbuf.shm_atime = shp->shm_atim; tbuf.shm_dtime = shp->shm_dtim; tbuf.shm_ctime = shp->shm_ctim; - tbuf.shm_cpid = shp->shm_cprid; - tbuf.shm_lpid = shp->shm_lprid; + tbuf.shm_cpid =pid_vnr (shp->shm_cprid); + tbuf.shm_lpid =pid_vnr (shp->shm_lprid); tbuf.shm_nattch = shp->shm_nattch;rcu_read_unlock ();
@@ -1363,6 +1367,7 @@ SYSCALL_DEFINE1(shmdt, char __user *, sh#ifdef CONFIG_PROC_FS static int sysvipc_shm_proc_show (struct seq_file *s,void *it) { +struct pid_namespace *pid_ns =ipc_seq_pid_ns (s);struct user_namespace *user_ns =seq_user_ns (s);struct shmid_kernel *shp = it;unsigned long rss =0 , swp =0 ;
@@ -1383,8 +1388,8 @@ static int sysvipc_shm_proc_show(struct shp->shm_perm.id, shp->shm_perm.mode, shp->shm_segsz, - shp->shm_cprid, - shp->shm_lprid, +pid_nr_ns (shp->shm_cprid, pid_ns), +pid_nr_ns (shp->shm_lprid, pid_ns), shp->shm_nattch,from_kuid_munged (user_ns, shp->shm_perm.uid), from_kgid_munged(user_ns, shp->shm_perm.gid),
PATCH 68/366 ipc/shm: fix use-after-free of shm file via remap_file_pages()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 3f05317d9889ab75c7190dcd39491d2a97921984 upstream.
syzbot reported a use-after-free of shm_file_data(file)->file->f_op in shm_get_unmapped_area(), called via sys_remap_file_pages().
Unfortunately it couldn't generate a reproducer, but I found a bug which I think caused it. When remap_file_pages() is passed a full System V shared memory segment, the memory is first unmapped, then a new map is created using the ->vm_file. Between these steps, the shm ID can be removed and reused for a new shm segment. But, shm_mmap() only checks whether the ID is currently valid before calling the underlying file's ->mmap(); it doesn't check whether it was reused. Thus it can use the wrong underlying file, one that was already freed.
Fix this by making the "outer" shm file (the one that gets put in ->vm_file) hold a reference to the real shm file, and by making __shm_open() require that the file associated with the shm ID matches the one associated with the "outer" file.
Taking the reference to the real shm file is needed to fully solve the problem, since otherwise sfd->file could point to a freed file, which then could be reallocated for the reused shm ID, causing the wrong shm segment to be mapped (and without the required permission checks).
Commit 1ac0b6dec656 ("ipc/shm: handle removed segments gracefully in shm_mmap()") almost fixed this bug, but it didn't go far enough because it didn't consider the case where the shm ID is reused.
The following program usually reproduces this bug:
#include <stdlib.h>
#include <sys/shm.h>
#include <sys/syscall.h>
#include <unistd.h>
int main()
{
int is_parent = (fork() != 0);
srand(getpid());
for (;;) {
int id = shmget(0xF00F, 4096, IPC_CREAT|0700);
if (is_parent) {
void *addr = shmat(id, NULL, 0);
usleep(rand() % 50);
while (!syscall(__NR_remap_file_pages, addr, 4096, 0, 0, 0));
} else {
usleep(rand() % 50);
shmctl(id, IPC_RMID, NULL);
}
}
}It causes the following NULL pointer dereference due to a 'struct file' being used while it's being freed. (I couldn't actually get a KASAN use-after-free splat like in the syzbot report. But I think it's possible with this bug; it would just take a more extraordinary race...)
BUG: unable to handle kernel NULL pointer dereference at 0000000000000058 PGD 0 P4D 0 Oops: 0000 [#1] SMP NOPTI CPU: 9 PID: 258 Comm: syz_ipc Not tainted 4.16.0-05140-gf8cf2f16a7c95 #189 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-20171110_100015-anatol 04/01/2014 RIP: 0010:d_inode include/linux/dcache.h:519 [inline] RIP: 0010:touch_atime+0x25/0xd0 fs/inode.c:1724 [...] Call Trace: file_accessed include/linux/fs.h:2063 [inline] shmem_mmap+0x25/0x40 mm/shmem.c:2149 call_mmap include/linux/fs.h:1789 [inline] shm_mmap+0x34/0x80 ipc/shm.c:465 call_mmap include/linux/fs.h:1789 [inline] mmap_region+0x309/0x5b0 mm/mmap.c:1712 do_mmap+0x294/0x4a0 mm/mmap.c:1483 do_mmap_pgoff include/linux/mm.h:2235 [inline] SYSC_remap_file_pages mm/mmap.c:2853 [inline] SyS_remap_file_pages+0x232/0x310 mm/mmap.c:2769 do_syscall_64+0x64/0x1a0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7
--- ipc/shm.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
ipc/shm.c +20 -3
@@ -197,6 +197,12 @@ static int __shm_open(struct vm_area_strif (IS_ERR (shp))return PTR_ERR (shp); +if (shp->shm_file != sfd->file) { +/* ID was reused */ +shm_unlock (shp); +return -EINVAL ; + } + shp->shm_atim =get_seconds ();ipc_update_pid (&shp->shm_lprid,task_tgid (current)); shp->shm_nattch++;
@@ -413,8 +419,9 @@ static int shm_mmap(struct file *file, sint ret;/* -* In case of remap_file_pages() emulation, the file can represent -* removed IPC ID: propogate shm_lock() error to caller. +* In case of remap_file_pages() emulation, the file can represent an +* IPC ID that was removed, and possibly even reused by another shm +* segment already. Propagate this case as an error to caller. */ ret =__shm_open (vma);if (ret)
@@ -438,6 +445,7 @@ static int shm_release(struct inode *inostruct shm_file_data *sfd =shm_file_data (file);put_ipc_ns (sfd->ns); +fput (sfd->file);shm_file_data (file) =NULL ;kfree (sfd);return 0 ;
@@ -1197,7 +1205,16 @@ long do_shmat(int shmid, char __user *sh file->f_mapping = shp->shm_file->f_mapping; sfd->id = shp->shm_perm.id; sfd->ns =get_ipc_ns (ns); - sfd->file = shp->shm_file; +/* +* We need to take a reference to the real shm file to prevent the +* pointer from becoming stale in cases where the lifetime of the outer +* file extends beyond that of the shm segment. It's not usually +* possible, but it can happen during remap_file_pages() emulation as +* that unmaps the memory, then does ->mmap() via file reference only. +* We'll deny the ->mmap() if the shm segment was since removed, but to +* detect shm ID reuse we need to compare the file pointers. +*/ + sfd->file =get_file (shp->shm_file); sfd->vm_ops =NULL ; err =security_mmap_file (file, prot, flags);
PATCH 69/366 ipc/msg: Fix msgctl(..., IPC_STAT, ...) between pid namespaces
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 39a4940eaa185910bb802ca9829c12268fd2c855 upstream.
Today msg_lspid and msg_lrpid are remembered in the pid namespace of the creator and the processes that last send or received a sysvipc message. If you have processes in multiple pid namespaces that is just wrong. The process ids reported will not make the least bit of sense.
This fix is slightly more susceptible to a performance problem than the related fix for System V shared memory. By definition the pids are updated by msgsnd and msgrcv, the fast path of System V message queues. The only concern over the previous implementation is the incrementing and decrementing of the pid reference count. As that is the only difference and multiple updates by of the task_tgid by threads in the same process have been shown in af_unix sockets to create a cache line ping-pong between cpus of the same processor.
In this case I don't expect cache lines holding pid reference counts to ping pong between cpus. As senders and receivers update different pids there is a natural separation there. Further if multiple threads of the same process either send or receive messages the pid will be updated to the same value and ipc_update_pid will avoid the reference count update.
Which means in the common case I expect msg_lspid and msg_lrpid to remain constant, and reference counts not to be updated when messages are sent.
In rare cases it may be possible to trigger the issue which was observed for af_unix sockets, but it will require multiple processes with multiple threads to be either sending or receiving messages. It just does not feel likely that anyone would do that in practice.
This change updates msgctl(..., IPC_STAT, ...) to return msg_lspid and msg_lrpid in the pid namespace of the process calling stat.
This change also updates cat /proc/sysvipc/msg to return print msg_lspid and msg_lrpid in the pid namespace of the process that opened the proc file.
---
include/linux/msg.h +2 -2
@@ -23,8 +23,8 @@ struct msg_queue {unsigned long q_cbytes;/* current number of bytes on queue */ unsigned long q_qnum;/* number of messages in queue */ unsigned long q_qbytes;/* max number of bytes on queue */ -pid_t q_lspid;/* pid of last msgsnd */ -pid_t q_lrpid;/* last receive pid */ +struct pid *q_lspid;/* pid of last msgsnd */ +struct pid *q_lrpid;/* last receive pid */ struct list_head q_messages;struct list_head q_receivers;
ipc/msg.c +11 -8
@@ -141,7 +141,7 @@ static int newque(struct ipc_namespace * msq->q_ctime =get_seconds (); msq->q_cbytes = msq->q_qnum =0 ; msq->q_qbytes = ns->msg_ctlmnb; - msq->q_lspid = msq->q_lrpid =0 ; + msq->q_lspid = msq->q_lrpid =NULL ;INIT_LIST_HEAD (&msq->q_messages);INIT_LIST_HEAD (&msq->q_receivers);INIT_LIST_HEAD (&msq->q_senders);
@@ -225,6 +225,8 @@ static void freeque(struct ipc_namespacefree_msg (msg); }atomic_sub (msq->q_cbytes, &ns->msg_bytes); +ipc_update_pid (&msq->q_lspid,NULL ); +ipc_update_pid (&msq->q_lrpid,NULL );ipc_rcu_putref (msq, msg_rcu_free); }
@@ -500,8 +502,8 @@ static int msgctl_nolock(struct ipc_name tbuf.msg_cbytes = msq->q_cbytes; tbuf.msg_qnum = msq->q_qnum; tbuf.msg_qbytes = msq->q_qbytes; - tbuf.msg_lspid = msq->q_lspid; - tbuf.msg_lrpid = msq->q_lrpid; + tbuf.msg_lspid =pid_vnr (msq->q_lspid); + tbuf.msg_lrpid =pid_vnr (msq->q_lrpid);rcu_read_unlock ();if (copy_msqid_to_user (buf, &tbuf, version))
@@ -584,7 +586,7 @@ static inline int pipelined_send(struct msr->r_msg =ERR_PTR (-E2BIG ); }else { msr->r_msg =NULL ; - msq->q_lrpid =task_pid_vnr (msr->r_tsk); +ipc_update_pid (&msq->q_lrpid,task_pid (msr->r_tsk)); msq->q_rtime =get_seconds ();wake_up_process (msr->r_tsk);/*
@@ -693,7 +695,7 @@ long do_msgsnd(int msqid, long mtype, vo } } - msq->q_lspid =task_tgid_vnr (current); +ipc_update_pid (&msq->q_lspid,task_tgid (current)); msq->q_stime =get_seconds ();if (!pipelined_send (msq, msg)) {
@@ -887,7 +889,7 @@ long do_msgrcv(int msqid, void __user *blist_del (&msg->m_list); msq->q_qnum--; msq->q_rtime =get_seconds (); - msq->q_lrpid =task_tgid_vnr (current); +ipc_update_pid (&msq->q_lrpid,task_tgid (current)); msq->q_cbytes -= msg->m_ts;atomic_sub (msg->m_ts, &ns->msg_bytes);atomic_dec (&ns->msg_hdrs);
@@ -1043,6 +1045,7 @@ void msg_exit_ns(struct ipc_namespace *n#ifdef CONFIG_PROC_FS static int sysvipc_msg_proc_show (struct seq_file *s,void *it) { +struct pid_namespace *pid_ns =ipc_seq_pid_ns (s);struct user_namespace *user_ns =seq_user_ns (s);struct msg_queue *msq = it;
@@ -1053,8 +1056,8 @@ static int sysvipc_msg_proc_show(struct msq->q_perm.mode, msq->q_cbytes, msq->q_qnum, - msq->q_lspid, - msq->q_lrpid, +pid_nr_ns (msq->q_lspid, pid_ns), +pid_nr_ns (msq->q_lrpid, pid_ns),from_kuid_munged (user_ns, msq->q_perm.uid),from_kgid_munged (user_ns, msq->q_perm.gid), from_kuid_munged(user_ns, msq->q_perm.cuid),
PATCH 70/366 ipc/sem: make semctl setting sempid consistent
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
commit a5f4db877177d2a3d7ae62a7bac3a5a27e083d7f upstream.
As indicated by bug#112271, Linux sets the sempid value upon semctl, and not only for semop calls. However, within semctl we only do this for SETVAL, leaving SETALL without updating the field, and therefore rather inconsistent behavior when compared to other Unices.
There is really no documentation regarding this and therefore users should not make assumptions. With this patch, along with updating semctl.2 manpages, this scenario should become less ambiguous As such, set sempid on SETALL cmd.
Also update some in-code documentation, specifying where the sempid is set.
Passes ltp and custom testcase where a child (fork) does SETALL to the set.
--- ipc/sem.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
ipc/sem.c +11 -2
@@ -92,7 +92,14 @@/* One semaphore structure for each semaphore in the system. */ struct sem {int semval;/* current value */ -int sempid;/* pid of last operation */ +/* +* PID of the process that last modified the semaphore. For +* Linux, specifically these are: +* - semop +* - semctl, via SETVAL and SETALL. +* - at task exit when performing undo adjustments (see exit_sem). +*/ +int sempid;spinlock_t lock;/* spinlock for fine-grained semtimedop */ struct list_head pending_alter;/* pending single-sop operations */ /* that alter the semaphore */
@@ -1469,8 +1476,10 @@ static int semctl_main(struct ipc_namesp goto out_unlock; } -for (i =0 ; i < nsems; i++) +for (i =0 ; i < nsems; i++) { sma->sem_base[i].semval = sem_io[i]; + sma->sem_base[i].sempid =task_tgid_vnr (current); + }ipc_assert_locked_object (&sma->sem_perm);list_for_each_entry (un, &sma->list_id, list_id) {
PATCH 71/366 ipc/sem: Fix semctl(..., GETPID, ...) between pid namespaces
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 51d6f2635b39709ee5e62479be23d423b760292c upstream.
Today the last process to update a semaphore is remembered and reported in the pid namespace of that process. If there are processes in any other pid namespace querying that process id with GETPID the result will be unusable nonsense as it does not make any sense in your own pid namespace.
Due to ipc_update_pid I don't think you will be able to get System V ipc semaphores into a troublesome cache line ping-pong. Using struct pids from separate process are not a problem because they do not share a cache line. Using struct pid from different threads of the same process are unlikely to be a problem as the reference count update can be avoided.
Further linux futexes are a much better tool for the job of mutual exclusion between processes than System V semaphores. So I expect programs that are performance limited by their interprocess mutual exclusion primitive will be using futexes.
So while it is possible that enhancing the storage of the last rocess of a System V semaphore from an integer to a struct pid will cause a performance regression because of the effect of frequently updating the pid reference count. I don't expect that to happen in practice.
This change updates semctl(..., GETPID, ...) to return the process id of the last process to update a semphore inthe pid namespace of the calling process.
[bwh: Backported to 3.16:
- sem_queue::pid was also used to store an error temporarily; add a new wake_error field for this purpose
- Adjust context]
--- ipc/sem.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
ipc/sem.c +16 -13
@@ -99,7 +99,7 @@ struct sem {* - semctl, via SETVAL and SETALL. * - at task exit when performing undo adjustments (see exit_sem). */ -int sempid; +struct pid *sempid;spinlock_t lock;/* spinlock for fine-grained semtimedop */ struct list_head pending_alter;/* pending single-sop operations */ /* that alter the semaphore */
@@ -113,7 +113,8 @@ struct sem_queue {struct list_head list;/* queue of pending operations */ struct task_struct *sleeper;/* this process */ struct sem_undo *undo;/* undo structure */ -int pid;/* process id of requesting process */ +struct pid *pid;/* process id of requesting process */ +int wake_error;int status;/* completion status of operation */ struct sembuf *sops;/* array of pending operations */ struct sembuf *blocking;/* the operation that blocked */
@@ -644,7 +645,8 @@ SYSCALL_DEFINE3(semget, key_t, key, int,*/ static int perform_atomic_semop (struct sem_array *sma,struct sem_queue *q) { -int result, sem_op, nsops, pid; +int result, sem_op, nsops; +struct pid *pid;struct sembuf *sop;struct sem *curr;struct sembuf *sops;
@@ -682,7 +684,7 @@ static int perform_atomic_semop(struct s sop--; pid = q->pid;while (sop >= sops) { - sma->sem_base[sop->sem_num].sempid = pid; +ipc_update_pid (&sma->sem_base[sop->sem_num].sempid, pid); sop--; }
@@ -730,7 +732,7 @@ static void wake_up_sem_queue_prepare(stpreempt_disable (); } q->status =IN_WAKEUP ; - q->pid = error; + q->wake_error = error;list_add_tail (&q->list, pt); }
@@ -754,7 +756,7 @@ static void wake_up_sem_queue_do(structwake_up_process (q->sleeper);/* q can disappear immediately after writing q->status. */ smp_wmb (); - q->status = q->pid; + q->status = q->wake_error; }if (did_something)preempt_enable ();
@@ -812,7 +814,7 @@ static int check_restart(struct sem_arra* be called with semnum = -1, as well as with the number of each modified * semaphore. * The tasks that must be woken up are added to @pt. The return code -* is stored in q->pid. +* is stored in q->wake_error. * The function returns 1 if at least one operation was completed successfully. */ static int wake_const_ops(struct sem_array *sma, int semnum,
@@ -912,7 +914,7 @@ static int do_smart_wakeup_zero(struct s* be called with semnum = -1, as well as with the number of each modified * semaphore. * The tasks that must be woken up are added to @pt. The return code -* is stored in q->pid. +* is stored in q->wake_error. * The function internally checks if const operations can now succeed. * * The function return 1 if at least one semop was completed successfully.
@@ -1156,6 +1158,7 @@ static void freeary(struct ipc_namespaceunlink_queue (sma, q);wake_up_sem_queue_prepare (&tasks, q, -EIDRM ); } +ipc_update_pid (&sem->sempid,NULL ); }/* Remove the semaphore set from the IDR */
@@ -1357,7 +1360,7 @@ static int semctl_setval(struct ipc_name un->semadj[semnum] =0 ; curr->semval = val; - curr->sempid =task_tgid_vnr (current); +ipc_update_pid (&curr->sempid,task_tgid (current)); sma->sem_ctime =get_seconds ();/* maybe some queued-up processes were waiting for this */ do_smart_update (sma,NULL ,0 ,0 , &tasks);
@@ -1478,7 +1481,7 @@ static int semctl_main(struct ipc_namespfor (i =0 ; i < nsems; i++) { sma->sem_base[i].semval = sem_io[i]; - sma->sem_base[i].sempid =task_tgid_vnr (current); +ipc_update_pid (&sma->sem_base[i].sempid,task_tgid (current)); }ipc_assert_locked_object (&sma->sem_perm);
@@ -1510,7 +1513,7 @@ static int semctl_main(struct ipc_namesp err = curr->semval; goto out_unlock;case GETPID : - err = curr->sempid; + err =pid_vnr (curr->sempid); goto out_unlock;case GETNCNT : err =count_semcnt (sma, semnum,0 );
@@ -1933,7 +1936,7 @@ SYSCALL_DEFINE4(semtimedop, int, semid, queue.sops = sops; queue.nsops = nsops; queue.undo = un; - queue.pid =task_tgid_vnr (current); + queue.pid =task_tgid (current); queue.alter = alter; error =perform_atomic_semop (sma, &queue);
@@ -2193,7 +2196,7 @@ void exit_sem(struct task_struct *tsk) semaphore->semval =0 ;if (semaphore->semval >SEMVMX ) semaphore->semval =SEMVMX ; - semaphore->sempid =task_tgid_vnr (current); +ipc_update_pid (&semaphore->sempid,task_tgid (current)); } }/* maybe some queued-up processes were waiting for this */
PATCH 72/366 video/fbdev/stifb: Return -ENOMEM after a failed kzalloc() in stifb_init_fb()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Markus Elfring <[email protected]>
commit f9815f945aff2204b8afbbb9d2182024eb44a194 upstream.
Replace an error code for the indication of a memory allocation failure in this function.
--- drivers/video/fbdev/stifb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/stifb.c +1 -1
@@ -1091,7 +1091,7 @@ static int __init stifb_init_fb(struct s fb =kzalloc (sizeof (*fb),GFP_ATOMIC );if (!fb) {printk (KERN_ERR "stifb: Could not allocate stifb structure\n" ); -return -ENODEV ; +return -ENOMEM ; } info = &fb->info;
PATCH 73/366 usb: musb: gadget: misplaced out of bounds check
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Heinrich Schuchardt <[email protected]>
commit af6f8529098aeb0e56a68671b450cf74e7a64fcd upstream.
musb->endpoints[] has array size MUSB_C_NUM_EPS.
We must check array bounds before accessing the array and not afterwards.
--- drivers/usb/musb/musb_gadget_ep0.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/usb/musb/musb_gadget_ep0.c +9 -5
@@ -114,15 +114,19 @@ static int service_tx_status_request( } is_in = epnum &USB_DIR_IN ; -if (is_in) { - epnum &=0x0f ; + epnum &=0x0f ; +if (epnum >=MUSB_C_NUM_EPS ) { + handled = -EINVAL ; +break ; + } + +if (is_in) ep = &musb->endpoints[epnum].ep_in; - }else { +else ep = &musb->endpoints[epnum].ep_out; - } regs = musb->endpoints[epnum].regs; -if (epnum >=MUSB_C_NUM_EPS || !ep->desc) { +if (!ep->desc) { handled = -EINVAL ;break ; }
PATCH 74/366 iio:buffer: make length types match kfifo types
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kelly <[email protected]>
commit c043ec1ca5baae63726aae32abbe003192bc6eec upstream.
Currently, we use int for buffer length and bytes_per_datum. However, kfifo uses unsigned int for length and size_t for element size. We need to make sure these matches or we will have bugs related to overflow (in the range between INT_MAX and UINT_MAX for length, for example).
In addition, set_bytes_per_datum uses size_t while bytes_per_datum is an int, which would cause bugs for large values of bytes_per_datum.
Change buffer length to use unsigned int and bytes_per_datum to use size_t.
[bwh: Backported to 3.16:
- Drop change in iio_dma_buffer_set_length()
- Adjust filenames, context]
---
drivers/iio/kfifo_buf.c +2 -2
@@ -19,7 +19,7 @@ struct iio_kfifo {#define iio_to_kfifo (r) container_of(r, struct iio_kfifo, buffer)static inline int __iio_allocate_kfifo (struct iio_kfifo *buf, -int bytes_per_datum,int length) +size_t bytes_per_datum,unsigned int length) {if ((length ==0 ) || (bytes_per_datum ==0 ))return -EINVAL ;
@@ -87,7 +87,7 @@ static int iio_set_bytes_per_datum_kfiforeturn 0 ; } -static int iio_set_length_kfifo (struct iio_buffer *r,int length) +static int iio_set_length_kfifo (struct iio_buffer *r,unsigned int length) {/* Avoid an invalid state */ if (length <2 )
include/linux/iio/buffer.h +3 -3
@@ -52,7 +52,7 @@ struct iio_buffer_access_funcs {int (*get_bytes_per_datum)(struct iio_buffer *buffer);int (*set_bytes_per_datum)(struct iio_buffer *buffer,size_t bpd);int (*get_length)(struct iio_buffer *buffer); -int (*set_length)(struct iio_buffer *buffer,int length); +int (*set_length)(struct iio_buffer *buffer,unsigned int length);void (*release)(struct iio_buffer *buffer); };
@@ -78,8 +78,8 @@ struct iio_buffer_access_funcs {* @ref: [INTERN] reference count of the buffer. */ struct iio_buffer { -int length; -int bytes_per_datum; +unsigned int length; +size_t bytes_per_datum;struct attribute_group *scan_el_attrs;long *scan_mask;bool scan_timestamp;
PATCH 75/366 iio:kfifo_buf: check for uint overflow
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kelly <[email protected]>
commit 3d13de4b027d5f6276c0f9d3a264f518747d83f2 upstream.
Currently, the following causes a kernel OOPS in memcpy:
echo 1073741825 > buffer/length
echo 1 > buffer/enable
Note that using 1073741824 instead of 1073741825 causes "write error:
Cannot allocate memory" but no OOPS.
This is because 1073741824 == 2^30 and 1073741825 == 2^30+1. Since kfifo rounds up to the nearest power of 2, it will actually call kmalloc with roundup_pow_of_two(length) * bytes_per_datum.
Using length == 1073741825 and bytes_per_datum == 2, we get:
kmalloc(roundup_pow_of_two(1073741825) * 2
or kmalloc(2147483648 * 2)
or kmalloc(4294967296)
or kmalloc(UINT_MAX + 1)
so this overflows to 0, causing kmalloc to return ZERO_SIZE_PTR and subsequent memcpy to fail once the device is enabled.
Fix this by checking for overflow prior to allocating a kfifo. With this check added, the above code returns -EINVAL when enabling the buffer, rather than causing an OOPS.
--- drivers/iio/kfifo_buf.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iio/kfifo_buf.c +7 -0
@@ -24,6 +24,13 @@ static inline int __iio_allocate_kfifo(sif ((length ==0 ) || (bytes_per_datum ==0 ))return -EINVAL ; +/* +* Make sure we don't overflow an unsigned int after kfifo rounds up to +* the next power of 2. +*/ +if (roundup_pow_of_two (length) >UINT_MAX / bytes_per_datum) +return -EINVAL ; +return __kfifo_alloc ((struct __kfifo *)&buf->kf, length, bytes_per_datum,GFP_KERNEL ); }
PATCH 76/366 powerpc/powernv: Handle unknown OPAL errors in opal_nvram_write()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit 741de617661794246f84a21a02fc5e327bffc9ad upstream.
opal_nvram_write currently just assumes success if it encounters an error other than OPAL_BUSY or OPAL_BUSY_EVENT. Have it return -EIO on other errors instead.
--- arch/powerpc/platforms/powernv/opal-nvram.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/powernv/opal-nvram.c +4 -0
@@ -58,6 +58,10 @@ static ssize_t opal_nvram_write(char *buif (rc ==OPAL_BUSY_EVENT )opal_poll_events (NULL ); } + +if (rc) +return -EIO ; + *index += count;return count; }
PATCH 77/366 powerpc/64: Fix smp_wmb barrier definition use use lwsync consistently
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit 0bfdf598900fd62869659f360d3387ed80eb71cf upstream.
asm/barrier.h is not always included after asm/synch.h, which meant it was missing __SUBARCH_HAS_LWSYNC, so in some files smp_wmb() would be eieio when it should be lwsync. kernel/time/hrtimer.c is one case.
__SUBARCH_HAS_LWSYNC is only used in one place, so just fold it in to where it's used. Previously with my small simulator config, 377 instances of eieio in the tree. After this patch there are 55.
--- arch/powerpc/include/asm/barrier.h | 3 ++- arch/powerpc/include/asm/synch.h | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/barrier.h +2 -1
@@ -39,7 +39,8 @@#ifdef CONFIG_SMP -#ifdef __SUBARCH_HAS_LWSYNC +/* The sub-arch has lwsync */ +#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC )# define SMPWMB LWSYNC#else # define SMPWMB eieio
arch/powerpc/include/asm/synch.h +0 -4
@@ -5,10 +5,6 @@#include <linux/stringify.h> #include <asm/feature-fixups.h> -#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC ) -#define __SUBARCH_HAS_LWSYNC -#endif -#ifndef __ASSEMBLY__extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup; extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
PATCH 78/366 xen/acpi: off by one in read_acpi_id()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit c37a3c94775855567b90f91775b9691e10bd2806 upstream.
If acpi_id is == nr_acpi_bits, then we access one element beyond the end of the acpi_psd[] array or we set one bit beyond the end of the bit map when we do __set_bit(acpi_id, acpi_id_present);
--- drivers/xen/xen-acpi-processor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/xen/xen-acpi-processor.c +3 -3
@@ -362,9 +362,9 @@ read_acpi_id(acpi_handle handle, u32 lvl }/* There are more ACPI Processor objects than in x2APIC or MADT. * This can happen with incorrect ACPI SSDT declerations. */ -if (acpi_id > nr_acpi_bits) { -pr_debug ("We only have %u, trying to set %u\n" , - nr_acpi_bits, acpi_id); +if (acpi_id >= nr_acpi_bits) { +pr_debug ("max acpi id %u, trying to set %u\n" , + nr_acpi_bits -1 , acpi_id);return AE_OK ; }/* OK, There is a ACPI Processor object */
PATCH 79/366 crypto: ahash - Fix early termination in hash walk
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
commit 900a081f6912a8985dc15380ec912752cb66025a upstream.
When we have an unaligned SG list entry where there is no leftover aligned data, the hash walk code will incorrectly return zero as if the entire SG list has been processed.
This patch fixes it by moving onto the next page instead.
--- crypto/ahash.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
crypto/ahash.c +4 -3
@@ -90,13 +90,14 @@ int crypto_hash_walk_done(struct crypto_if (nbytes && walk->offset & alignmask && !err) { walk->offset =ALIGN (walk->offset, alignmask +1 ); - walk->data += walk->offset; - nbytes =min (nbytes, ((unsigned int )(PAGE_SIZE )) - walk->offset); walk->entrylen -= nbytes; -return nbytes; +if (nbytes) { + walk->data += walk->offset; +return nbytes; + } }if (walk->flags &CRYPTO_ALG_ASYNC )
PATCH 80/366 btrfs: Refactor transaction handling in received subvolume ioctl
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit efd38150af45375b46576d0110a323d7fab7e142 upstream.
If btrfs_transaction_commit fails it will proceed to call cleanup_transaction, which in turn already does btrfs_abort_transaction. So let's remove the unnecessary code duplication. Also let's be explicit about handling failure of btrfs_uuid_tree_add by calling btrfs_end_transaction.
[bwh: Backported to 3.16:
- btrfs_{abort,end}_transaction() take a pointer to btrfs_root
- Adjust context]
--- fs/btrfs/ioctl.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
fs/btrfs/ioctl.c +1 -5
@@ -5077,15 +5077,11 @@ static long _btrfs_ioctl_set_received_su root->root_key.objectid);if (ret <0 && ret != -EEXIST ) {btrfs_abort_transaction (trans, root, ret); +btrfs_end_transaction (trans, root); goto out; } } ret =btrfs_commit_transaction (trans, root); -if (ret <0 ) { -btrfs_abort_transaction (trans, root, ret); - goto out; - } - out:up_write (&root->fs_info->subvol_sem);mnt_drop_write_file (file);
PATCH 81/366 btrfs: Handle error from btrfs_uuid_tree_rem call in _btrfs_ioctl_set_received_subvol
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit d87ff75863e92a500538ab53318c5740f196631e upstream.
As with every function which deals with modifying the btree btrfs_uuid_tree_rem can fail for any number of reasons (ie. EIO/ENOMEM). Handle return error value from this function gracefully by aborting the transaction.
[bwh: Backported to 3.16:
- btrfs_{abort,end}_transaction() take a pointer to btrfs_root
- Adjust context]
---
fs/btrfs/ioctl.c +11 -5
@@ -5051,11 +5051,17 @@ static long _btrfs_ioctl_set_received_su received_uuid_changed =memcmp (root_item->received_uuid, sa->uuid,BTRFS_UUID_SIZE );if (received_uuid_changed && - !btrfs_is_empty_uuid (root_item->received_uuid)) -btrfs_uuid_tree_rem (trans, root->fs_info->uuid_root, - root_item->received_uuid, -BTRFS_UUID_KEY_RECEIVED_SUBVOL , - root->root_key.objectid); + !btrfs_is_empty_uuid (root_item->received_uuid)) { + ret =btrfs_uuid_tree_rem (trans, root->fs_info->uuid_root, + root_item->received_uuid, +BTRFS_UUID_KEY_RECEIVED_SUBVOL , + root->root_key.objectid); +if (ret && ret != -ENOENT ) { +btrfs_abort_transaction (trans, root, ret); +btrfs_end_transaction (trans, root); + goto out; + } + }memcpy (root_item->received_uuid, sa->uuid,BTRFS_UUID_SIZE );btrfs_set_root_stransid (root_item, sa->stransid);btrfs_set_root_rtransid (root_item, sa->rtransid);
PATCH 82/366 ext4: add bounds checking to ext4_xattr_find_entry()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 9496005d6ca4cf8f5ee8f828165a8956872dc59d upstream.
Add some paranoia checks to make sure we don't stray beyond the end of the valid memory region containing ext4 xattr entries while we are scanning for a match.
Also rename the function to xattr_find_entry() since it is static and thus only used in fs/ext4/xattr.c
[bwh: Backported to 3.16:
- Keep passing an explicit size to xattr_find_entry()
- s/EFSCORRUPTED/EIO/]]
--- fs/ext4/xattr.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
fs/ext4/xattr.c +22 -13
@@ -240,18 +240,23 @@ ext4_xattr_check_entry(struct ext4_xattr }static int -ext4_xattr_find_entry (struct ext4_xattr_entry **pentry,int name_index, -const char *name,size_t size,int sorted) +xattr_find_entry (struct inode *inode,struct ext4_xattr_entry **pentry, +void *end,int name_index,const char *name,size_t size, +int sorted) { -struct ext4_xattr_entry *entry; +struct ext4_xattr_entry *entry, *next;size_t name_len;int cmp =1 ;if (name ==NULL )return -EINVAL ; name_len =strlen (name); - entry = *pentry; -for (; !IS_LAST_ENTRY (entry); entry =EXT4_XATTR_NEXT (entry)) { +for (entry = *pentry; !IS_LAST_ENTRY (entry); entry = next) { + next =EXT4_XATTR_NEXT (entry); +if ((void *) next >= end) { +EXT4_ERROR_INODE (inode,"corrupted xattr entries" ); +return -EIO ; + } cmp = name_index - entry->e_name_index;if (!cmp) cmp = name_len - entry->e_name_len;
@@ -273,6 +278,7 @@ ext4_xattr_block_get(struct inode *inodestruct buffer_head *bh =NULL ;struct ext4_xattr_entry *entry;size_t size; +void *end;int error;struct mb_cache *ext4_mb_cache =EXT4_GET_MB_CACHE (inode);
@@ -298,7 +304,9 @@ bad_block: }ext4_xattr_cache_insert (ext4_mb_cache, bh); entry =BFIRST (bh); - error =ext4_xattr_find_entry (&entry, name_index, name, bh->b_size,1 ); + end = bh->b_data + bh->b_size; + error =xattr_find_entry (inode, &entry, end, name_index, name, + bh->b_size,1 );if (error == -EIO ) goto bad_block;if (error)
@@ -342,8 +350,8 @@ ext4_xattr_ibody_get(struct inode *inode error =ext4_xattr_check_names (entry, end, entry);if (error) goto cleanup; - error =ext4_xattr_find_entry (&entry, name_index, name, - end - (void *)entry,0 ); + error =xattr_find_entry (inode, &entry, end, name_index, name, + end - (void *)entry,0 );if (error) goto cleanup; size =le32_to_cpu (entry->e_value_size);
@@ -761,8 +769,9 @@ ext4_xattr_block_find(struct inode *inod bs->s.first =BFIRST (bs->bh); bs->s.end = bs->bh->b_data + bs->bh->b_size; bs->s.here = bs->s.first; - error =ext4_xattr_find_entry (&bs->s.here, i->name_index, - i->name, bs->bh->b_size,1 ); + error =xattr_find_entry (inode, &bs->s.here, bs->s.end, + i->name_index, i->name, + bs->bh->b_size,1 );if (error && error != -ENODATA ) goto cleanup; bs->s.not_found = error;
@@ -1007,9 +1016,9 @@ int ext4_xattr_ibody_find(struct inode *if (error)return error;/* Find the named attribute. */ - error =ext4_xattr_find_entry (&is->s.here, i->name_index, - i->name, is->s.end - - (void *)is->s.base,0 ); + error =xattr_find_entry (inode, &is->s.here, is->s.end, + i->name_index, i->name, + is->s.end - (void *)is->s.base,0 );if (error && error != -ENODATA )return error; is->s.not_found = error;
PATCH 83/366 Btrfs: fix copy_items() return value when logging an inode
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 8434ec46c6e3232cebc25a910363b29f5c617820 upstream.
When logging an inode, at tree-log.c:copy_items(), if we call btrfs_next_leaf() at the loop which checks for the need to log holes, we need to make sure copy_items() returns the value 1 to its caller and not 0 (on success). This is because the path the caller passed was released and is now different from what is was before, and the caller expects a return value of 0 to mean both success and that the path has not changed, while a return value of 1 means both success and signals the caller that it can not reuse the path, it has to perform another tree search.
Even though this is a case that should not be triggered on normal circumstances or very rare at least, its consequences can be very unpredictable (especially when replaying a log tree).
--- fs/btrfs/tree-log.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/tree-log.c +1 -0
@@ -3524,6 +3524,7 @@ fill_holes:ASSERT (ret ==0 ); src = src_path->nodes[0 ]; i =0 ; + need_find_last_extent = true; }btrfs_item_key_to_cpu (src, &key, i);
PATCH 84/366 btrfs: tests/qgroup: Fix wrong tree backref level
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 3c0efdf03b2d127f0e40e30db4e7aa0429b1b79a upstream.
The extent tree of the test fs is like the following:
BTRFS info (device (null)): leaf 16327509003777336587 total ptrs 1 free space 3919
item 0 key (4096 168 4096) itemoff 3944 itemsize 51
extent refs 1 gen 1 flags 2
tree block key (68719476736 0 0) level 1
^^^^^^^
ref#0: tree block backref root 5
And it's using an empty tree for fs tree, so there is no way that its level can be 1.
For REAL (created by mkfs) fs tree backref with no skinny metadata, the result should look like:
item 3 key (30408704 EXTENT_ITEM 4096) itemoff 3845 itemsize 51
refs 1 gen 4 flags TREE_BLOCK
tree block key (256 INODE_ITEM 0) level 0
^^^^^^^
tree block backref root 5
Fix the level to 0, so it won't break later tree level checker.
--- fs/btrfs/tests/qgroup-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tests/qgroup-tests.c +1 -1
@@ -69,7 +69,7 @@ static int insert_normal_tree_ref(structbtrfs_set_extent_generation (leaf, item,1 );btrfs_set_extent_flags (leaf, item,BTRFS_EXTENT_FLAG_TREE_BLOCK ); block_info = (struct btrfs_tree_block_info *)(item +1 ); -btrfs_set_tree_block_level (leaf, block_info,1 ); +btrfs_set_tree_block_level (leaf, block_info,0 ); iref = (struct btrfs_extent_inline_ref *)(block_info +1 );if (parent >0 ) { btrfs_set_extent_inline_ref_type(leaf, iref,
PATCH 85/366 ext4: correctly detect when an xattr value has an invalid size
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit d7614cc16146e3f0b4c33e71875c19607602aed5 upstream.
It was possible for an xattr value to have a very large size, which would then pass validation on 32-bit architectures due to a pointer wraparound. Fix this by validating the size in a way which avoids pointer wraparound.
It was also possible that a value's size would fit in the available space but its padded size would not. This would cause an out-of-bounds memory write in ext4_xattr_set_entry when replacing the xattr value. For example, if an xattr value of unpadded size 253 bytes went until the very end of the inode or block, then using setxattr(2) to replace this xattr's value with 256 bytes would cause a write to the 3 bytes past the end of the inode or buffer, and the new xattr value would be incorrectly truncated. Fix this by requiring that the padded size fit in the available space rather than the unpadded size.
This patch shouldn't have any noticeable effect on non-corrupted/non-malicious filesystems.
[bwh: Backported to 3.16:
- s/EFSCORRUPTED/EIO/
- Adjust context]
--- fs/ext4/xattr.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
fs/ext4/xattr.c +21 -6
@@ -188,6 +188,7 @@ ext4_xattr_check_names(struct ext4_xattr {struct ext4_xattr_entry *e = entry; +/* Find the end of the names list */ while (!IS_LAST_ENTRY (e)) {struct ext4_xattr_entry *next =EXT4_XATTR_NEXT (e);if ((void *)next >= end)
@@ -195,13 +196,27 @@ ext4_xattr_check_names(struct ext4_xattr e = next; } +/* Check the values */ while (!IS_LAST_ENTRY (entry)) { -if (entry->e_value_size !=0 && - (value_start +le16_to_cpu (entry->e_value_offs) < - (void *)e +sizeof (__u32) || - value_start +le16_to_cpu (entry->e_value_offs) + -le32_to_cpu (entry->e_value_size) > end)) -return -EIO ; +if (entry->e_value_size !=0 ) { +u16 offs =le16_to_cpu (entry->e_value_offs); +u32 size =le32_to_cpu (entry->e_value_size); +void *value; + +/* +* The value cannot overlap the names, and the value +* with padding cannot extend beyond 'end'. Check both +* the padded and unpadded sizes, since the size may +* overflow to 0 when adding padding. +*/ +if (offs > end - value_start) +return -EIO ; + value = value_start + offs; +if (value < (void *)e +sizeof (u32) || + size > end - value || +EXT4_XATTR_SIZE (size) > end - value) +return -EIO ; + } entry =EXT4_XATTR_NEXT (entry); }
PATCH 86/366 ext4: add extra checks to ext4_xattr_block_get()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 54dd0e0a1b255f115f8647fc6fb93273251b01b9 upstream.
Add explicit checks in ext4_xattr_block_get() just in case the e_value_offs and e_value_size fields in the the xattr block are corrupted in memory after the buffer_verified bit is set on the xattr block.
[bwh: Backported to 3.16:
- Drop change to ext4_xattr_check_entries() which is only needed for the xattr-in-inode case
- Adjust context, indentation]
---
fs/ext4/xattr.c +18 -6
@@ -327,12 +327,18 @@ bad_block:if (error) goto cleanup; size =le32_to_cpu (entry->e_value_size); + error = -ERANGE ; +if (unlikely (size >EXT4_XATTR_SIZE_MAX )) + goto cleanup;if (buffer) { - error = -ERANGE ; +u16 offset =le16_to_cpu (entry->e_value_offs); +void *p = bh->b_data + offset; +if (size > buffer_size) goto cleanup; -memcpy (buffer, bh->b_data +le16_to_cpu (entry->e_value_offs), - size); +if (unlikely (p + size > end)) + goto cleanup; +memcpy (buffer, p, size); } error = size;
@@ -370,12 +376,18 @@ ext4_xattr_ibody_get(struct inode *inodeif (error) goto cleanup; size =le32_to_cpu (entry->e_value_size); + error = -ERANGE ; +if (unlikely (size >EXT4_XATTR_SIZE_MAX )) + goto cleanup;if (buffer) { - error = -ERANGE ; +u16 offset =le16_to_cpu (entry->e_value_offs); +void *p = (void *)IFIRST (header) + offset; +if (size > buffer_size) goto cleanup; -memcpy (buffer, (void *)IFIRST (header) + -le16_to_cpu (entry->e_value_offs), size); +if (unlikely (p + size > end)) + goto cleanup; +memcpy (buffer, p, size); } error = size;
fs/ext4/xattr.h +11 -0
@@ -67,6 +67,17 @@ struct ext4_xattr_entry { EXT4_I(inode)->i_extra_isize))#define IFIRST (hdr) ((struct ext4_xattr_entry *)((hdr)+1)) +/* +* XATTR_SIZE_MAX is currently 64k, but for the purposes of checking +* for file system consistency errors, we use a somewhat bigger value. +* This allows XATTR_SIZE_MAX to grow in the future, but by using this +* instead of INT_MAX for certain consistency checks, we don't need to +* worry about arithmetic overflows. (Actually XATTR_SIZE_MAX is +* defined in include/uapi/linux/limits.h, so changing it is going +* not going to be trivial....) +*/ +#define EXT4_XATTR_SIZE_MAX (1 << 24) +#define BHDR (bh) ((struct ext4_xattr_header *)((bh)->b_data))#define ENTRY (ptr) ((struct ext4_xattr_entry *)(ptr))#define BFIRST (bh) ENTRY(BHDR(bh)+1)
PATCH 87/366 powerpc/eeh: Fix race with driver un/bind
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit f0295e047fcf52ccb42561fb7de6942f5201b676 upstream.
The current EEH callbacks can race with a driver unbind. This can result in a backtraces like this:
EEH: Frozen PHB#0-PE#1fc detected
EEH: PE location: S000009, PHB location: N/A
CPU: 2 PID: 2312 Comm: kworker/u258:3 Not tainted 4.15.6-openpower1 #2
Workqueue: nvme-wq nvme_reset_work [nvme]
Call Trace:
dump_stack+0x9c/0xd0 (unreliable)
eeh_dev_check_failure+0x420/0x470
eeh_check_failure+0xa0/0xa4
nvme_reset_work+0x138/0x1414 [nvme]
process_one_work+0x1ec/0x328
worker_thread+0x2e4/0x3a8
kthread+0x14c/0x154
ret_from_kernel_thread+0x5c/0xc8
nvme nvme1: Removing after probe failure status: -19
<snip>
cpu 0x23: Vector: 300 (Data Access) at [c000000ff50f3800]
pc: c0080000089a0eb0: nvme_error_detected+0x4c/0x90 [nvme]
lr: c000000000026564: eeh_report_error+0xe0/0x110
sp: c000000ff50f3a80
msr: 9000000000009033
dar: 400
dsisr: 40000000
current = 0xc000000ff507c000
paca = 0xc00000000fdc9d80 softe: 0 irq_happened: 0x01
pid = 782, comm = eehd
Linux version 4.15.6-openpower1 (smc@smc-desktop) (gcc version 6.4.0 (Buildroot 2017.11.2-00008-g4b6188e)) #2 SM P Tue Feb 27 12:33:27 PST 2018
enter ? for help
eeh_report_error+0xe0/0x110
eeh_pe_dev_traverse+0xc0/0xdc
eeh_handle_normal_event+0x184/0x4c4
eeh_handle_event+0x30/0x288
eeh_event_handler+0x124/0x170
kthread+0x14c/0x154
ret_from_kernel_thread+0x5c/0xc8The first part is an EEH (on boot), the second half is the resulting crash. nvme probe starts the nvme_reset_work() worker thread. This worker thread starts touching the device which see a device error (EEH) and hence queues up an event in the powerpc EEH worker thread. nvme_reset_work() then continues and runs nvme_remove_dead_ctrl_work() which results in unbinding the driver from the device and hence releases all resources. At the same time, the EEH worker thread starts doing the EEH .error_detected() driver callback, which no longer works since the resources have been freed.
This fixes the problem in the same way the generic PCIe AER code (in drivers/pci/pcie/aer/aerdrv_core.c) does. It makes the EEH code hold the device_lock() while performing the driver EEH callbacks and associated code. This ensures either the callbacks are no longer register, or if they are registered the driver will not be removed from underneath us.
This has been broken forever. The EEH call backs were first introduced in 2005 (in 77bd7415610) but it's not clear if a lock was needed back then.
---
arch/powerpc/kernel/eeh_driver.c +38 -23
@@ -198,18 +198,18 @@ static void *eeh_report_error(void *dataif (!dev ||eeh_dev_removed (edev))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_frozen; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;eeh_disable_irq (dev);if (!driver->err_handler || - !driver->err_handler->error_detected) { -eeh_pcid_put (dev); -return NULL ; - } + !driver->err_handler->error_detected) + goto out; rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen);
@@ -217,7 +217,10 @@ static void *eeh_report_error(void *dataif (rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc;if (*res ==PCI_ERS_RESULT_NONE ) *res = rc; +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -240,15 +243,14 @@ static void *eeh_report_mmio_enabled(voiif (!dev ||eeh_dev_removed (edev))return NULL ; +device_lock (&dev->dev); driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;if (!driver->err_handler || !driver->err_handler->mmio_enabled || - (edev->mode &EEH_DEV_NO_HANDLER )) { -eeh_pcid_put (dev); -return NULL ; - } + (edev->mode &EEH_DEV_NO_HANDLER )) + goto out; rc = driver->err_handler->mmio_enabled (dev);
@@ -256,7 +258,10 @@ static void *eeh_report_mmio_enabled(voiif (rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc;if (*res ==PCI_ERS_RESULT_NONE ) *res = rc; +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -279,19 +284,19 @@ static void *eeh_report_reset(void *dataif (!dev ||eeh_dev_removed (edev))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_normal; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;eeh_enable_irq (dev);if (!driver->err_handler || !driver->err_handler->slot_reset || - (edev->mode &EEH_DEV_NO_HANDLER )) { -eeh_pcid_put (dev); -return NULL ; - } + (edev->mode &EEH_DEV_NO_HANDLER )) + goto out; rc = driver->err_handler->slot_reset (dev); if ((*res == PCI_ERS_RESULT_NONE) ||
@@ -299,7 +304,10 @@ static void *eeh_report_reset(void *dataif (*res ==PCI_ERS_RESULT_DISCONNECT && rc ==PCI_ERS_RESULT_NEED_RESET ) *res = rc; +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -320,10 +328,12 @@ static void *eeh_report_resume(void *datif (!dev ||eeh_dev_removed (edev))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_normal; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;eeh_enable_irq (dev);
@@ -331,13 +341,15 @@ static void *eeh_report_resume(void *dat !driver->err_handler->resume || (edev->mode & EEH_DEV_NO_HANDLER)) { edev->mode &= ~EEH_DEV_NO_HANDLER ; -eeh_pcid_put (dev); -return NULL ; + goto out; } driver->err_handler->resume (dev); +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
@@ -357,22 +369,25 @@ static void *eeh_report_failure(void *daif (!dev ||eeh_dev_removed (edev))return NULL ; + +device_lock (&dev->dev); dev->error_state = pci_channel_io_perm_failure; driver =eeh_pcid_get (dev); -if (!driver)return NULL ; +if (!driver) goto out_no_dev;eeh_disable_irq (dev);if (!driver->err_handler || - !driver->err_handler->error_detected) { -eeh_pcid_put (dev); -return NULL ; - } + !driver->err_handler->error_detected) + goto out; driver->err_handler->error_detected (dev, pci_channel_io_perm_failure); +out:eeh_pcid_put (dev); +out_no_dev: +device_unlock (&dev->dev);return NULL ; }
PATCH 88/366 sky2: Increase D3 delay to sky2 stops working after suspend
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit afb133637071be6deeb8b3d0e55593ffbf63c527 upstream.
The sky2 ethernet stops working after system resume from suspend:
[ 582.852065] sky2 0000:04:00.0: Refused to change power state, currently in D3
The current 150ms delay is not enough, change it to 200ms can solve the issue.
--- drivers/net/ethernet/marvell/sky2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/sky2.c +1 -1
@@ -5070,7 +5070,7 @@ static int sky2_probe(struct pci_dev *pdINIT_WORK (&hw->restart_work, sky2_restart);pci_set_drvdata (pdev, hw); - pdev->d3_delay =150 ; + pdev->d3_delay =200 ;return 0 ;
PATCH 89/366 cifs: fix memory leak in SMB2_open()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ronnie Sahlberg <[email protected]>
commit b7a73c84eb96dabd6bb8e9d7c56f796d83efee8e upstream.
--- fs/cifs/smb2pdu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.c +3 -1
@@ -1176,8 +1176,10 @@ SMB2_open(const unsigned int xid, struct copy_size +=8 ; copy_path =kzalloc (copy_size,GFP_KERNEL ); -if (!copy_path) +if (!copy_path) { +cifs_small_buf_release (req);return -ENOMEM ; + }memcpy ((char *)copy_path, (const char *)path, uni_path_len); uni_path_len = copy_size;
PATCH 90/366 ext4: force revalidation of directory pointer after seekdir(2)
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit e40ff213898502d299351cc2fe1e350cd186f0d3 upstream.
A malicious user could force the directory pointer to be in an invalid spot by using seekdir(2). Use the mechanism we already have to notice if the directory has changed since the last time we called ext4_readdir() to force a revalidation of the pointer.
--- fs/ext4/dir.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ext4/dir.c +5 -3
@@ -322,13 +322,15 @@ static loff_t ext4_dir_llseek(struct fil {struct inode *inode = file->f_mapping->host;int dx_dir =is_dx_dir (inode); -loff_t htree_max =ext4_get_htree_eof (file); +loff_t ret, htree_max =ext4_get_htree_eof (file);if (likely (dx_dir)) -return generic_file_llseek_size (file, offset, whence, + ret =generic_file_llseek_size (file, offset, whence, htree_max, htree_max);else -return ext4_llseek (file, offset, whence); + ret =ext4_llseek (file, offset, whence); + file->f_version = inode->i_version -1 ; +return ret; }/*
PATCH 91/366 ALSA: pcm: Fix UAF at PCM release via PCM timer access
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit a820ccbe21e8ce8e86c39cd1d3bc8c7d1cbb949b upstream.
The PCM runtime object is created and freed dynamically at PCM stream open / close time. This is tracked via substream->runtime, and it's cleared at snd_pcm_detach_substream().
The runtime object assignment is protected by PCM open_mutex, so for all PCM operations, it's safely handled. However, each PCM substream provides also an ALSA timer interface, and user-space can access to this while closing a PCM substream. This may eventually lead to a UAF, as snd_pcm_timer_resolution() tries to access the runtime while clearing it in other side.
Fortunately, it's the only concurrent access from the PCM timer, and it merely reads runtime->timer_resolution field. So, we can avoid the race by reordering kfree() and wrapping the substream->runtime clearance with the corresponding timer lock.
--- sound/core/pcm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/core/pcm.c +7 -1
@@ -28,6 +28,7 @@#include <sound/core.h> #include <sound/minors.h> #include <sound/pcm.h> +#include <sound/timer.h> #include <sound/control.h> #include <sound/info.h>
@@ -1002,8 +1003,13 @@ void snd_pcm_detach_substream(struct snd#ifdef CONFIG_SND_PCM_XRUN_DEBUG kfree (runtime->hwptr_log);#endif -kfree (runtime); +/* Avoid concurrent access to runtime via PCM timer interface */ +if (substream->timer) +spin_lock_irq (&substream->timer->lock); substream->runtime =NULL ; +if (substream->timer) +spin_unlock_irq (&substream->timer->lock); +kfree (runtime);put_pid (substream->pid); substream->pid =NULL ; substream->pstr->substream_opened--;
PATCH 92/366 rtc: snvs: Fix usage of snvs_rtc_enable
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bryan O'Donoghue <[email protected]>
commit 1485991c024603b2fb4ae77beb7a0d741128a48e upstream.
commit 179a502f8c46 ("rtc: snvs: add Freescale rtc-snvs driver") introduces the SNVS RTC driver with a function snvs_rtc_enable().
snvs_rtc_enable() can return an error on the enable path however this driver does not currently trap that failure on the probe() path and consequently if enabling the RTC fails we encounter a later error spinning forever in rtc_write_sync_lp().
[ 36.093481] [<c010d630>] (__irq_svc) from [<c0c2e9ec>] (_raw_spin_unlock_irqrestore+0x34/0x44) [ 36.102122] [<c0c2e9ec>] (_raw_spin_unlock_irqrestore) from [<c072e32c>] (regmap_read+0x4c/0x5c) [ 36.110938] [<c072e32c>] (regmap_read) from [<c085d0f4>] (rtc_write_sync_lp+0x6c/0x98) [ 36.118881] [<c085d0f4>] (rtc_write_sync_lp) from [<c085d160>] (snvs_rtc_alarm_irq_enable+0x40/0x4c) [ 36.128041] [<c085d160>] (snvs_rtc_alarm_irq_enable) from [<c08567b4>] (rtc_timer_do_work+0xd8/0x1a8) [ 36.137291] [<c08567b4>] (rtc_timer_do_work) from [<c01441b8>] (process_one_work+0x28c/0x76c) [ 36.145840] [<c01441b8>] (process_one_work) from [<c01446cc>] (worker_thread+0x34/0x58c) [ 36.153961] [<c01446cc>] (worker_thread) from [<c014aee4>] (kthread+0x138/0x150) [ 36.161388] [<c014aee4>] (kthread) from [<c0107e14>] (ret_from_fork+0x14/0x20) [ 36.168635] rcu_sched kthread starved for 2602 jiffies! g496 c495 f0x2 RCU_GP_WAIT_FQS(3) ->state=0x0 ->cpu=0 [ 36.178564] rcu_sched R running task 0 8 2 0x00000000 [ 36.185664] [<c0c288b0>] (__schedule) from [<c0c29134>] (schedule+0x3c/0xa0) [ 36.192739] [<c0c29134>] (schedule) from [<c0c2db80>] (schedule_timeout+0x78/0x4e0) [ 36.200422] [<c0c2db80>] (schedule_timeout) from [<c01a7ab0>] (rcu_gp_kthread+0x648/0x1864) [ 36.208800] [<c01a7ab0>] (rcu_gp_kthread) from [<c014aee4>] (kthread+0x138/0x150) [ 36.216309] [<c014aee4>] (kthread) from [<c0107e14>] (ret_from_fork+0x14/0x20)
This patch fixes by parsing the result of rtc_write_sync_lp() and propagating both in the probe and elsewhere. If the RTC doesn't start we don't proceed loading the driver and don't get into this loop mess later on.
[bwh: Backported to 3.16:
- No cleanup is needed on error in snvs_rtc_probe(); just return
- Adjust context]
--- drivers/rtc/rtc-snvs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/rtc/rtc-snvs.c +11 -4
@@ -130,20 +130,23 @@ static int snvs_rtc_set_time(struct devi {struct snvs_rtc_data *data =dev_get_drvdata (dev);unsigned long time; +int ret;rtc_tm_to_time (tm, &time);/* Disable RTC first */ -snvs_rtc_enable (data, false); + ret =snvs_rtc_enable (data, false); +if (ret) +return ret;/* Write 32-bit time to 47-bit timer, leaving 15 LSBs blank */ writel (time <<CNTR_TO_SECS_SH , data->ioaddr +SNVS_LPSRTCLR );writel (time >> (32 -CNTR_TO_SECS_SH ), data->ioaddr +SNVS_LPSRTCMR );/* Enable RTC again */ -snvs_rtc_enable (data, true); + ret =snvs_rtc_enable (data, true); -return 0 ; +return ret; }static int snvs_rtc_read_alarm (struct device *dev,struct rtc_wkalrm *alrm)
@@ -271,7 +274,11 @@ static int snvs_rtc_probe(struct platforwritel (0xffffffff , data->ioaddr +SNVS_LPSR );/* Enable RTC */ -snvs_rtc_enable (data, true); + ret =snvs_rtc_enable (data, true); +if (ret) { +dev_err (&pdev->dev,"failed to enable rtc %d\n" , ret); +return ret; + }device_init_wakeup (&pdev->dev, true);
PATCH 93/366 drm/radeon: Fix PCIe lane width calculation
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Parsons <[email protected]>
commit 85e290d92b4b794d0c758c53007eb4248d385386 upstream.
Two years ago I tried an AMD Radeon E8860 embedded GPU with the drm driver. The dmesg output included driver warnings about an invalid PCIe lane width. Tracking the problem back led to si_set_pcie_lane_width_in_smc(). The calculation of the lane widths via ATOM_PPLIB_PCIE_LINK_WIDTH_MASK and ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT macros did not increment the resulting value, per the comment in pptable.h ("lanes - 1"), and per usage elsewhere. Applying the increment silenced the warnings.
The code has not changed since, so either my analysis was incorrect or the bug has gone unnoticed. Hence submitting this as an RFC.
--- drivers/gpu/drm/radeon/si_dpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/si_dpm.c +2 -2
@@ -5828,9 +5828,9 @@ static void si_set_pcie_lane_width_in_sm {u32 lane_width;u32 new_lane_width = - (radeon_new_state->caps &ATOM_PPLIB_PCIE_LINK_WIDTH_MASK ) >>ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT ; + ((radeon_new_state->caps &ATOM_PPLIB_PCIE_LINK_WIDTH_MASK ) >>ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT ) +1 ;u32 current_lane_width = - (radeon_current_state->caps &ATOM_PPLIB_PCIE_LINK_WIDTH_MASK ) >>ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT ; + ((radeon_current_state->caps &ATOM_PPLIB_PCIE_LINK_WIDTH_MASK ) >>ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT ) +1 ;if (new_lane_width != current_lane_width) {radeon_set_pcie_lanes (rdev, new_lane_width);
PATCH 94/366 RDMA/ucma: Don't allow setting RDMA_OPTION_IB_PATH without an RDMA device
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit 8435168d50e66fa5eae01852769d20a36f9e5e83 upstream.
Check to make sure that ctx->cm_id->device is set before we use it. Otherwise userspace can trigger a NULL dereference by doing RDMA_USER_CM_CMD_SET_OPTION on an ID that is not bound to a device.
--- drivers/infiniband/core/ucma.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/ucma.c +3 -0
@@ -1142,6 +1142,9 @@ static int ucma_set_ib_path(struct ucma_if (!optlen)return -EINVAL ; +if (!ctx->cm_id->device) +return -EINVAL ; +memset (&sa_path,0 ,sizeof (sa_path)); sa_path.vlan_id =0xffff ;
PATCH 95/366 powerpc/mm/hugetlb: initialize the pagetable cache correctly for hugetlb
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Aneesh Kumar K.V" <[email protected]>
commit 6fa504835d6969144b2bd3699684dd447c789ba2 upstream.
With 64k page size, we have hugetlb pte entries at the pmd and pud level for book3s64. We don't need to create a separate page table cache for that. With 4k we need to make sure hugepd page table cache for 16M is placed at PUD level and 16G at the PGD level.
Simplify all these by not using HUGEPD_PD_SHIFT which is confusing for book3s64.
Without this patch, with 64k page size we create pagetable caches with shift value 10 and 7 which are not used at all.
[bwh: Backported to 3.16: Don't use an #ifdef because this implementation of
hugetlbpage_init() is only used if CONFIG_PPC_BOOK3S_64 is enabled.]
---
arch/powerpc/mm/hugetlbpage.c +8 -9
@@ -175,9 +175,6 @@ static int __hugepte_alloc(struct mm_str#ifdef CONFIG_PPC_FSL_BOOK3E #define HUGEPD_PGD_SHIFT PGDIR_SHIFT#define HUGEPD_PUD_SHIFT PUD_SHIFT -#else -#define HUGEPD_PGD_SHIFT PUD_SHIFT -#define HUGEPD_PUD_SHIFT PMD_SHIFT#endif #ifdef CONFIG_PPC_BOOK3S_64
@@ -871,15 +868,17 @@ static int __init hugetlbpage_init(void) shift =mmu_psize_to_shift (psize); -if (add_huge_page_size (1ULL << shift) <0 ) +if (shift >PGDIR_SHIFT )continue ; - -if (shift <PMD_SHIFT ) - pdshift =PMD_SHIFT ; -else if (shift <PUD_SHIFT ) +else if (shift >PUD_SHIFT ) + pdshift =PGDIR_SHIFT ; +else if (shift >PMD_SHIFT ) pdshift =PUD_SHIFT ;else - pdshift =PGDIR_SHIFT ; + pdshift =PMD_SHIFT ; + +if (add_huge_page_size (1ULL << shift) <0 ) +continue ;/* * if we have pdshift and shift value same, we don't * use pgt cache for hugepd.
PATCH 96/366 mmc: jz4740: Fix race condition in IRQ mask update
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Smith <[email protected]>
commit a04f0017c22453613d5f423326b190c61e3b4f98 upstream.
A spinlock is held while updating the internal copy of the IRQ mask, but not while writing it to the actual IMASK register. After the lock is released, an IRQ can occur before the IMASK register is written. If handling this IRQ causes the mask to be changed, when the handler returns back to the middle of the first mask update, a stale value will be written to the mask register.
If this causes an IRQ to become unmasked that cannot have its status cleared by writing a 1 to it in the IREG register, e.g. the SDIO IRQ, then we can end up stuck with the same IRQ repeatedly being fired but not handled. Normally the MMC IRQ handler attempts to clear any unexpected IRQs by writing IREG, but for those that cannot be cleared in this way then the IRQ will just repeatedly fire.
This was resulting in lockups after a while of using Wi-Fi on the CI20 (GitHub issue #19).
Resolve by holding the spinlock until after the IMASK register has been updated.
--- drivers/mmc/host/jz4740_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/jz4740_mmc.c +1 -1
@@ -148,9 +148,9 @@ static void jz4740_mmc_set_irq_enabled(s host->irq_mask &= ~irq; else host->irq_mask |= irq; -spin_unlock_irqrestore (&host->lock, flags);writew (host->irq_mask, host->base +JZ_REG_MMC_IMASK ); +spin_unlock_irqrestore (&host->lock, flags); } static void jz4740_mmc_clock_enable(struct jz4740_mmc_host *host,
PATCH 97/366 net: bcmgenet: Fix sparse warnings in bcmgenet_put_tx_csum()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 6f89421180f15867dc1472d9edf68f82b0ed5ee6 upstream.
skb->protocol is a __be16 which we would be calling htons() against, while this is not wrong per-se as it correctly results in swapping the value on LE hosts, this still upsets sparse. Adopt a similar pattern to what other drivers do and just assign ip_ver to skb->protocol, and then use htons() against the different constants such that the compiler can resolve the values at build time.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +6 -5
@@ -1093,7 +1093,7 @@ static int bcmgenet_put_tx_csum(struct nstruct sk_buff *new_skb;u16 offset;u8 ip_proto; -u16 ip_ver; +__be16 ip_ver;u32 tx_csum_info;if (unlikely (skb_headroom (skb) <sizeof (*status))) {
@@ -1114,12 +1114,12 @@ static int bcmgenet_put_tx_csum(struct n status = (struct status_64 *)skb->data;if (skb->ip_summed ==CHECKSUM_PARTIAL ) { - ip_ver =htons (skb->protocol); + ip_ver = skb->protocol;switch (ip_ver) { -case ETH_P_IP : +case htons (ETH_P_IP ): ip_proto =ip_hdr (skb)->protocol;break ; -case ETH_P_IPV6 : +case htons (ETH_P_IPV6 ): ip_proto =ipv6_hdr (skb)->nexthdr;break ;default :
@@ -1135,7 +1135,8 @@ static int bcmgenet_put_tx_csum(struct n*/ if (ip_proto ==IPPROTO_TCP || ip_proto ==IPPROTO_UDP ) { tx_csum_info |=STATUS_TX_CSUM_LV ; -if (ip_proto ==IPPROTO_UDP && ip_ver ==ETH_P_IP ) +if (ip_proto ==IPPROTO_UDP && + ip_ver ==htons (ETH_P_IP )) tx_csum_info |=STATUS_TX_CSUM_PROTO_UDP ; }else tx_csum_info =0 ;
PATCH 98/366 net: systemport: Fix sparse warnings in bcm_sysport_insert_tsb()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit c0eb05585d4184596453622b5abba7d13dd20667 upstream.
skb->protocol is a __be16 which we would be calling htons() against, while this is not wrong per-se as it correctly results in swapping the value on LE hosts, this still upsets sparse. Adopt a similar pattern to what other drivers do and just assign ip_ver to skb->protocol, and then use htons() against the different constants such that the compiler can resolve the values at build time.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bcmsysport.c +6 -5
@@ -772,7 +772,7 @@ static struct sk_buff *bcm_sysport_inseru32 csum_info;u8 ip_proto;u16 csum_start; -u16 ip_ver; +__be16 ip_ver;/* Re-allocate SKB if needed */ if (unlikely (skb_headroom (skb) <sizeof (*tsb))) {
@@ -791,12 +791,12 @@ static struct sk_buff *bcm_sysport_insermemset (tsb,0 ,sizeof (*tsb));if (skb->ip_summed ==CHECKSUM_PARTIAL ) { - ip_ver =htons (skb->protocol); + ip_ver = skb->protocol;switch (ip_ver) { -case ETH_P_IP : +case htons (ETH_P_IP ): ip_proto =ip_hdr (skb)->protocol;break ; -case ETH_P_IPV6 : +case htons (ETH_P_IPV6 ): ip_proto =ipv6_hdr (skb)->nexthdr;break ;default :
@@ -810,7 +810,8 @@ static struct sk_buff *bcm_sysport_inserif (ip_proto ==IPPROTO_TCP || ip_proto ==IPPROTO_UDP ) { csum_info |=L4_LENGTH_VALID ; -if (ip_proto ==IPPROTO_UDP && ip_ver ==ETH_P_IP ) +if (ip_proto ==IPPROTO_UDP && + ip_ver ==htons (ETH_P_IP )) csum_info |=L4_UDP ; }else csum_info =0 ;
PATCH 99/366 kvm: x86: fix a compile warning
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Peng Hao <[email protected]>
commit 3140c156e919b0f5fad5c5f6cf7876c39d1d4f06 upstream.
fix a "warning: no previous prototype".
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -6640,7 +6640,7 @@ int kvm_task_switch(struct kvm_vcpu *vcp }EXPORT_SYMBOL_GPL (kvm_task_switch); -int kvm_valid_sregs (struct kvm_vcpu *vcpu,struct kvm_sregs *sregs) +static int kvm_valid_sregs (struct kvm_vcpu *vcpu,struct kvm_sregs *sregs) {if ((sregs->efer &EFER_LME ) && (sregs->cr0 &X86_CR0_PG )) {/*
PATCH 100/366 ubifs: Check ubifs_wbuf_sync() return code
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit aac17948a7ce01fb60b9ee6cf902967a47b3ce26 upstream.
If ubifs_wbuf_sync() fails we must not write a master node with the dirty marker cleared.
Otherwise it is possible that in case of an IO error while syncing we mark the filesystem as clean and UBIFS refuses to recover upon next mount.
--- fs/ubifs/super.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
fs/ubifs/super.c +10 -4
@@ -1726,8 +1726,11 @@ static void ubifs_remount_ro(struct ubifdbg_save_space_info (c); -for (i =0 ; i < c->jhead_cnt; i++) -ubifs_wbuf_sync (&c->jheads[i].wbuf); +for (i =0 ; i < c->jhead_cnt; i++) { + err =ubifs_wbuf_sync (&c->jheads[i].wbuf); +if (err) +ubifs_ro_mode (c, err); + } c->mst_node->flags &= ~cpu_to_le32 (UBIFS_MST_DIRTY ); c->mst_node->flags |=cpu_to_le32 (UBIFS_MST_NO_ORPHS );
@@ -1794,8 +1797,11 @@ static void ubifs_put_super(struct superint err;/* Synchronize write-buffers */ -for (i =0 ; i < c->jhead_cnt; i++) -ubifs_wbuf_sync (&c->jheads[i].wbuf); +for (i =0 ; i < c->jhead_cnt; i++) { + err =ubifs_wbuf_sync (&c->jheads[i].wbuf); +if (err) +ubifs_ro_mode (c, err); + }/* * We are being cleanly unmounted which means the
PATCH 101/366 ubi: Fix error for write access
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Romain Izard <[email protected]>
commit 78a8dfbabbece22bee58ac4cb26cab10e7a19c5d upstream.
When opening a device with write access, ubiblock_open returns an error code. Currently, this error code is -EPERM, but this is not the right value.
The open function for other block devices returns -EROFS when opening read-only devices with FMODE_WRITE set. When used with dm-verity, the veritysetup userspace tool is expecting EROFS, and refuses to use the ubiblock device.
Use -EROFS for ubiblock as well. As a result, veritysetup accepts the ubiblock device as valid.
--- drivers/mtd/ubi/block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/block.c +1 -1
@@ -322,7 +322,7 @@ static int ubiblock_open(struct block_de* in any case. */ if (mode &FMODE_WRITE ) { - ret = -EPERM ; + ret = -EROFS ; goto out_unlock; }
PATCH 102/366 ubi: Reject MLC NAND
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit b5094b7f135be34630e3ea8a98fa215715d0f29d upstream.
While UBI and UBIFS seem to work at first sight with MLC NAND, you will most likely lose all your data upon a power-cut or due to read/write disturb.
In order to protect users from bad surprises, refuse to attach to MLC NAND.
--- drivers/mtd/ubi/build.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/mtd/ubi/build.c +11 -0
@@ -905,6 +905,17 @@ int ubi_attach_mtd_dev(struct mtd_info *return -EINVAL ; } +/* +* Both UBI and UBIFS have been designed for SLC NAND and NOR flashes. +* MLC NAND is different and needs special care, otherwise UBI or UBIFS +* will die soon and you will lose all your data. +*/ +if (mtd->type ==MTD_MLCNANDFLASH ) { +pr_err ("ubi: refuse attaching mtd%d - MLC NAND is not supported\n" , + mtd->index); +return -EINVAL ; + } +if (ubi_num ==UBI_DEV_NUM_AUTO ) {/* Search for an empty slot in the @ubi_devices array */ for (ubi_num =0 ; ubi_num <UBI_MAX_DEVICES ; ubi_num++)
PATCH 103/366 Input: i8042 - enable MUX on Sony VAIO VGN-CS series to fix touchpad
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Zary <[email protected]>
commit 04bb1719c4de94700056241d4c0fe3c1413f5aff upstream.
The touch sensor buttons on Sony VAIO VGN-CS series laptops (e.g. VGN-CS31S) are a separate PS/2 device. As the MUX is disabled for all VAIO machines by the nomux blacklist, the data from touch sensor buttons and touchpad are combined. The protocol used by the buttons is probably similar to the touchpad protocol (both are Synaptics) so both devices get enabled. The controller combines the data, creating a mess which results in random button clicks, touchpad stopping working and lost sync error messages:
psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 4 psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 psmouse serio1: TouchPad at isa0060/serio1/input0 lost sync at byte 1 psmouse serio1: issuing reconnect request
Add a new i8042_dmi_forcemux_table whitelist with VGN-CS. With MUX enabled, touch sensor buttons are detected as separate device (and left disabled as there's currently no driver), fixing all touchpad problems.
--- drivers/input/serio/i8042-x86ia64io.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +17 -0
@@ -516,6 +516,20 @@ static const struct dmi_system_id __init { } }; +static const struct dmi_system_id i8042_dmi_forcemux_table[]__initconst = { + { +/* +* Sony Vaio VGN-CS series require MUX or the touch sensor +* buttons will disturb touchpad operation +*/ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Sony Corporation" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"VGN-CS" ), + }, + }, + { } +}; +static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { {/* MSI Wind U-100 */
@@ -1116,6 +1130,9 @@ static int __init i8042_platform_init(voif (dmi_check_system (i8042_dmi_nomux_table)) i8042_nomux = true; +if (dmi_check_system (i8042_dmi_forcemux_table)) + i8042_nomux = false; +if (dmi_check_system (i8042_dmi_notimeout_table)) i8042_notimeout = true;
PATCH 104/366 media: v4l2-compat-ioctl32: don't oops on overlay
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 85ea29f19eab56ec16ec6b92bc67305998706afa upstream.
At put_v4l2_window32(), it tries to access kp->clips. However, kp points to an userspace pointer. So, it should be obtained via get_user(), otherwise it can OOPS:
vivid-000: ================== END STATUS ==================
BUG: unable to handle kernel paging request at 00000000fffb18e0 IP: [<ffffffffc05468d9>] __put_v4l2_format32+0x169/0x220 [videodev] PGD 3f5776067 PUD 3f576f067 PMD 3f5769067 PTE 800000042548f067 Oops: 0001 [#1] SMP Modules linked in: vivid videobuf2_vmalloc videobuf2_memops v4l2_dv_timings videobuf2_core v4l2_common videodev media xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables bluetooth rfkill binfmt_misc snd_hda_codec_hdmi i915 snd_hda_intel snd_hda_controller snd_hda_codec intel_rapl x86_pkg_temp_thermal snd_hwdep intel_powerclamp snd_pcm coretemp snd_seq_midi kvm_intel kvm snd_seq_midi_event snd_rawmidi i2c_algo_bit drm_kms_helper snd_seq drm crct10dif_pclmul e1000e snd_seq_device crc32_pclmul snd_timer ghash_clmulni_intel snd mei_me mei ptp pps_core soundcore lpc_ich video crc32c_intel [last unloaded: media] CPU: 2 PID: 28332 Comm: v4l2-compliance Not tainted 3.18.102+ #107 Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017 task: ffff8804293f8000 ti: ffff8803f5640000 task.ti: ffff8803f5640000 RIP: 0010:[<ffffffffc05468d9>] [<ffffffffc05468d9>] __put_v4l2_format32+0x169/0x220 [videodev] RSP: 0018:ffff8803f5643e28 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000000fffb1ab4 RDX: 00000000fffb1a68 RSI: 00000000fffb18d8 RDI: 00000000fffb1aa8 RBP: ffff8803f5643e48 R08: 0000000000000001 R09: ffff8803f54b0378 R10: 0000000000000000 R11: 0000000000000168 R12: 00000000fffb18c0 R13: 00000000fffb1a94 R14: 00000000fffb18c8 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff880456d00000(0063) knlGS:00000000f7100980 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 00000000fffb18e0 CR3: 00000003f552b000 CR4: 00000000003407e0 Stack: 00000000fffb1a94 00000000c0cc5640 0000000000000056 ffff8804274f3600 ffff8803f5643ed0 ffffffffc0547e16 0000000000000003 ffff8803f5643eb0 ffffffff81301460 ffff88009db44b01 ffff880441942520 ffff8800c0d05640 Call Trace: [<ffffffffc0547e16>] v4l2_compat_ioctl32+0x12d6/0x1b1d [videodev] [<ffffffff81301460>] ? file_has_perm+0x70/0xc0 [<ffffffff81252a2c>] compat_SyS_ioctl+0xec/0x1200 [<ffffffff8173241a>] sysenter_dispatch+0x7/0x21 Code: 00 00 48 8b 80 48 c0 ff ff 48 83 e8 38 49 39 c6 0f 87 2b ff ff ff 49 8d 45 1c e8 a3 ce e3 c0 85 c0 0f 85 1a ff ff ff 41 8d 40 ff <4d> 8b 64 24 20 41 89 d5 48 8d 44 40 03 4d 8d 34 c4 eb 15 0f 1f RIP [<ffffffffc05468d9>] __put_v4l2_format32+0x169/0x220 [videodev] RSP <ffff8803f5643e28> CR2: 00000000fffb18e0
Tested with vivid driver on Kernel v3.18.102.
Same bug happens upstream too:
BUG: KASAN: user-memory-access in __put_v4l2_format32+0x98/0x4d0 [videodev] Read of size 8 at addr 00000000ffe48400 by task v4l2-compliance/8713 CPU: 0 PID: 8713 Comm: v4l2-compliance Not tainted 4.16.0-rc4+ #108 Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017 Call Trace: dump_stack+0x5c/0x7c kasan_report+0x164/0x380 ? __put_v4l2_format32+0x98/0x4d0 [videodev] __put_v4l2_format32+0x98/0x4d0 [videodev] v4l2_compat_ioctl32+0x1aec/0x27a0 [videodev] ? __fsnotify_inode_delete+0x20/0x20 ? __put_v4l2_format32+0x4d0/0x4d0 [videodev] compat_SyS_ioctl+0x646/0x14d0 ? do_ioctl+0x30/0x30 do_fast_syscall_32+0x191/0x3f4 entry_SYSENTER_compat+0x6b/0x7a ================================================================== Disabling lock debugging due to kernel taint BUG: unable to handle kernel paging request at 00000000ffe48400 IP: __put_v4l2_format32+0x98/0x4d0 [videodev] PGD 3a22fb067 P4D 3a22fb067 PUD 39b6f0067 PMD 39b6f1067 PTE 80000003256af067 Oops: 0001 [#1] SMP KASAN Modules linked in: vivid videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops v4l2_tpg v4l2_dv_timings videobuf2_v4l2 videobuf2_common v4l2_common videodev xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack libcrc32c tun bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables bluetooth rfkill ecdh_generic binfmt_misc snd_hda_codec_hdmi intel_rapl x86_pkg_temp_thermal intel_powerclamp i915 coretemp snd_hda_intel snd_hda_codec kvm_intel snd_hwdep snd_hda_core kvm snd_pcm irqbypass crct10dif_pclmul crc32_pclmul snd_seq_midi ghash_clmulni_intel snd_seq_midi_event i2c_algo_bit intel_cstate snd_rawmidi intel_uncore snd_seq drm_kms_helper e1000e snd_seq_device snd_timer intel_rapl_perf drm ptp snd mei_me mei lpc_ich pps_core soundcore video crc32c_intel CPU: 0 PID: 8713 Comm: v4l2-compliance Tainted: G B 4.16.0-rc4+ #108 Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017 RIP: 0010:__put_v4l2_format32+0x98/0x4d0 [videodev] RSP: 0018:ffff8803b9be7d30 EFLAGS: 00010282 RAX: 0000000000000000 RBX: ffff8803ac983e80 RCX: ffffffff8cd929f2 RDX: 1ffffffff1d0a149 RSI: 0000000000000297 RDI: 0000000000000297 RBP: 00000000ffe485c0 R08: fffffbfff1cf5123 R09: ffffffff8e7a8948 R10: 0000000000000001 R11: fffffbfff1cf5122 R12: 00000000ffe483e0 R13: 00000000ffe485c4 R14: ffff8803ac985918 R15: 00000000ffe483e8 FS: 0000000000000000(0000) GS:ffff880407400000(0063) knlGS:00000000f7a46980 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 00000000ffe48400 CR3: 00000003a83f2003 CR4: 00000000003606f0 Call Trace: v4l2_compat_ioctl32+0x1aec/0x27a0 [videodev] ? __fsnotify_inode_delete+0x20/0x20 ? __put_v4l2_format32+0x4d0/0x4d0 [videodev] compat_SyS_ioctl+0x646/0x14d0 ? do_ioctl+0x30/0x30 do_fast_syscall_32+0x191/0x3f4 entry_SYSENTER_compat+0x6b/0x7a Code: 4c 89 f7 4d 8d 7c 24 08 e8 e6 a4 69 cb 48 8b 83 98 1a 00 00 48 83 e8 10 49 39 c7 0f 87 9d 01 00 00 49 8d 7c 24 20 e8 c8 a4 69 cb <4d> 8b 74 24 20 4c 89 ef 4c 89 fe ba 10 00 00 00 e8 23 d9 08 cc RIP: __put_v4l2_format32+0x98/0x4d0 [videodev] RSP: ffff8803b9be7d30 CR2: 00000000ffe48400
--- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-compat-ioctl32.c +3 -1
@@ -101,7 +101,7 @@ static int get_v4l2_window32(struct v4l2static int put_v4l2_window32 (struct v4l2_window __user *kp,struct v4l2_window32 __user *up) { -struct v4l2_clip __user *kclips = kp->clips; +struct v4l2_clip __user *kclips;struct v4l2_clip32 __user *uclips;compat_caddr_t p;u32 clipcount;
@@ -116,6 +116,8 @@ static int put_v4l2_window32(struct v4l2if (!clipcount)return 0 ; +if (get_user (kclips, &kp->clips)) +return -EFAULT ;if (get_user (p, &up->clips))return -EFAULT ; uclips =compat_ptr (p);
PATCH 105/366 Btrfs: fix NULL pointer dereference in log_dir_items
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
commit 80c0b4210a963e31529e15bf90519708ec947596 upstream.
0, 1 and <0 can be returned by btrfs_next_leaf(), and when <0 is returned, path->nodes[0] could be NULL, log_dir_items lacks such a check for <0 and we may run into a null pointer dereference panic.
--- fs/btrfs/tree-log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +5 -2
@@ -3082,8 +3082,11 @@ static noinline int log_dir_items(struct* from this directory and from this transaction */ ret =btrfs_next_leaf (root, path); -if (ret ==1 ) { - last_offset = (u64)-1 ; +if (ret) { +if (ret ==1 ) + last_offset = (u64)-1 ; +else + err = ret; goto done; }btrfs_item_key_to_cpu (path->nodes[0 ], &tmp, path->slots[0 ]);
PATCH 106/366 Btrfs: bail out on error during replay_dir_deletes
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
commit b98def7ca6e152ee55e36863dddf6f41f12d1dc6 upstream.
If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs to bail out, otherwise @ret would be forced to be 0 after 'break;' and the caller won't be aware of it.
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -1979,8 +1979,10 @@ again: nritems =btrfs_header_nritems (path->nodes[0 ]);if (path->slots[0 ] >= nritems) { ret =btrfs_next_leaf (root, path); -if (ret) +if (ret ==1 )break ; +else if (ret <0 ) + goto out; }btrfs_item_key_to_cpu (path->nodes[0 ], &found_key, path->slots[0 ]);
PATCH 107/366 btrfs: Fix possible softlock on single core machines
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit 1e1c50a929bc9e49bc3f9935b92450d9e69f8158 upstream.
do_chunk_alloc implements a loop checking whether there is a pending chunk allocation and if so causes the caller do loop. Generally this loop is executed only once, however testing with btrfs/072 on a single core vm machines uncovered an extreme case where the system could loop indefinitely. This is due to a missing cond_resched when loop which doesn't give a chance to the previous chunk allocator finish its job.
The fix is to simply add the missing cond_resched.
--- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/extent-tree.c +1 -0
@@ -3969,6 +3969,7 @@ again:if (wait_for_alloc) {mutex_unlock (&fs_info->chunk_mutex); wait_for_alloc =0 ; +cond_resched (); goto again; }
PATCH 108/366 ip_tunnel: better validate user provided tunnel names
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 9cb726a212a82c88c98aa9f0037fd04777cd8fe5 upstream.
Use dev_valid_name() to make sure user does not provide illegal device name.
syzbot caught the following bug :
BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300 [inline] BUG: KASAN: stack-out-of-bounds in __ip_tunnel_create+0xca/0x6b0 net/ipv4/ip_tunnel.c:257 Write of size 20 at addr ffff8801ac79f810 by task syzkaller268107/4482 CPU: 0 PID: 4482 Comm: syzkaller268107 Not tainted 4.16.0+ #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b9/0x29f lib/dump_stack.c:53 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267 memcpy+0x37/0x50 mm/kasan/kasan.c:303 strlcpy include/linux/string.h:300 [inline] __ip_tunnel_create+0xca/0x6b0 net/ipv4/ip_tunnel.c:257 ip_tunnel_create net/ipv4/ip_tunnel.c:352 [inline] ip_tunnel_ioctl+0x818/0xd40 net/ipv4/ip_tunnel.c:861 ipip_tunnel_ioctl+0x1c5/0x420 net/ipv4/ipip.c:350 dev_ifsioc+0x43e/0xb90 net/core/dev_ioctl.c:334 dev_ioctl+0x69a/0xcc0 net/core/dev_ioctl.c:525 sock_ioctl+0x47e/0x680 net/socket.c:1015 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x1cf/0x1650 fs/ioctl.c:684 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701 SYSC_ioctl fs/ioctl.c:708 [inline] SyS_ioctl+0x24/0x30 fs/ioctl.c:706 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7
--- net/ipv4/ip_tunnel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/ipv4/ip_tunnel.c +6 -5
@@ -300,13 +300,14 @@ static struct net_device *__ip_tunnel_crstruct net_device *dev;char name[IFNAMSIZ ]; -if (parms->name[0 ]) + err = -E2BIG ; +if (parms->name[0 ]) { +if (!dev_valid_name (parms->name)) + goto failed;strlcpy (name, parms->name,IFNAMSIZ ); -else { -if (strlen (ops->kind) > (IFNAMSIZ -3 )) { - err = -E2BIG ; + }else { +if (strlen (ops->kind) > (IFNAMSIZ -3 )) goto failed; - }strlcpy (name, ops->kind,IFNAMSIZ );strncat (name,"%d" ,2 ); }
PATCH 109/366 ipv6: sit: better validate user provided tunnel names
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit b95211e066fc3494b7c115060b2297b4ba21f025 upstream.
Use dev_valid_name() to make sure user does not provide illegal device name.
syzbot caught the following bug :
BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300 [inline] BUG: KASAN: stack-out-of-bounds in ipip6_tunnel_locate+0x63b/0xaa0 net/ipv6/sit.c:254 Write of size 33 at addr ffff8801b64076d8 by task syzkaller932654/4453 CPU: 0 PID: 4453 Comm: syzkaller932654 Not tainted 4.16.0+ #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b9/0x29f lib/dump_stack.c:53 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267 memcpy+0x37/0x50 mm/kasan/kasan.c:303 strlcpy include/linux/string.h:300 [inline] ipip6_tunnel_locate+0x63b/0xaa0 net/ipv6/sit.c:254 ipip6_tunnel_ioctl+0xe71/0x241b net/ipv6/sit.c:1221 dev_ifsioc+0x43e/0xb90 net/core/dev_ioctl.c:334 dev_ioctl+0x69a/0xcc0 net/core/dev_ioctl.c:525 sock_ioctl+0x47e/0x680 net/socket.c:1015 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x1cf/0x1650 fs/ioctl.c:684 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701 SYSC_ioctl fs/ioctl.c:708 [inline] SyS_ioctl+0x24/0x30 fs/ioctl.c:706 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7
--- net/ipv6/sit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/ipv6/sit.c +5 -3
@@ -244,11 +244,13 @@ static struct ip_tunnel *ipip6_tunnel_loif (!create) goto failed; -if (parms->name[0 ]) +if (parms->name[0 ]) { +if (!dev_valid_name (parms->name)) + goto failed;strlcpy (name, parms->name,IFNAMSIZ ); -else + }else {strcpy (name,"sit%d" ); - + } dev =alloc_netdev (sizeof (*t), name, ipip6_tunnel_setup);if (dev ==NULL )return NULL ;
PATCH 110/366 ip6_gre: better validate user provided tunnel names
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 5f42df013b8bc1b6511af7a04bf93b014884ae2a upstream.
Use dev_valid_name() to make sure user does not provide illegal device name.
syzbot caught the following bug :
BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300 [inline] BUG: KASAN: stack-out-of-bounds in ip6gre_tunnel_locate+0x334/0x860 net/ipv6/ip6_gre.c:339 Write of size 20 at addr ffff8801afb9f7b8 by task syzkaller851048/4466 CPU: 1 PID: 4466 Comm: syzkaller851048 Not tainted 4.16.0+ #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b9/0x29f lib/dump_stack.c:53 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0xac/0x2f5 mm/kasan/report.c:412 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267 memcpy+0x37/0x50 mm/kasan/kasan.c:303 strlcpy include/linux/string.h:300 [inline] ip6gre_tunnel_locate+0x334/0x860 net/ipv6/ip6_gre.c:339 ip6gre_tunnel_ioctl+0x69d/0x12e0 net/ipv6/ip6_gre.c:1195 dev_ifsioc+0x43e/0xb90 net/core/dev_ioctl.c:334 dev_ioctl+0x69a/0xcc0 net/core/dev_ioctl.c:525 sock_ioctl+0x47e/0x680 net/socket.c:1015 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x1cf/0x1650 fs/ioctl.c:684 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701 SYSC_ioctl fs/ioctl.c:708 [inline] SyS_ioctl+0x24/0x30 fs/ioctl.c:706 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7
--- net/ipv6/ip6_gre.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/ipv6/ip6_gre.c +5 -3
@@ -318,11 +318,13 @@ static struct ip6_tnl *ip6gre_tunnel_locif (t || !create)return t; -if (parms->name[0 ]) +if (parms->name[0 ]) { +if (!dev_valid_name (parms->name)) +return NULL ;strlcpy (name, parms->name,IFNAMSIZ ); -else + }else {strcpy (name,"ip6gre%d" ); - + } dev =alloc_netdev (sizeof (*t), name, ip6gre_tunnel_setup);if (!dev)return NULL ;
PATCH 111/366 ip6_tunnel: better validate user provided tunnel names
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit db7a65e3ab78e5b1c4b17c0870ebee35a4ee3257 upstream.
Use valid_name() to make sure user does not provide illegal device name.
[bwh: Backported to 3.16:
- Don't touch err as ip6_tnl_create() does not return an error code
- Adjust context]
---
net/ipv6/ip6_tunnel.c +5 -3
@@ -307,11 +307,13 @@ static struct ip6_tnl *ip6_tnl_create(stchar name[IFNAMSIZ ];int err; -if (p->name[0 ]) +if (p->name[0 ]) { +if (!dev_valid_name (p->name)) + goto failed;strlcpy (name, p->name,IFNAMSIZ ); -else + }else {sprintf (name,"ip6tnl%%d" ); - + } dev =alloc_netdev (sizeof (*t), name, ip6_tnl_dev_setup);if (dev ==NULL ) goto failed;
PATCH 112/366 vti6: better validate user provided tunnel names
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 537b361fbcbcc3cd6fe2bb47069fd292b9256d16 upstream.
Use valid_name() to make sure user does not provide illegal device name.
--- net/ipv6/ip6_vti.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv6/ip6_vti.c +5 -2
@@ -195,10 +195,13 @@ static struct ip6_tnl *vti6_tnl_create(schar name[IFNAMSIZ ];int err; -if (p->name[0 ]) +if (p->name[0 ]) { +if (!dev_valid_name (p->name)) + goto failed;strlcpy (name, p->name,IFNAMSIZ ); -else + }else {sprintf (name,"ip6_vti%%d" ); + } dev =alloc_netdev (sizeof (*t), name, vti6_dev_setup);if (dev ==NULL )
PATCH 113/366 zboot: fix stack protector in compressed boot phase
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 7bbaf27d9c83037b6e60a818e57bdbedf6bc15be upstream.
Calling __stack_chk_guard_setup() in decompress_kernel() is too late that stack checking always fails for decompress_kernel() itself. So remove __stack_chk_guard_setup() and initialize __stack_chk_guard before we call decompress_kernel().
Original code comes from ARM but also used for MIPS and SH, so fix them together. If without this fix, compressed booting of these archs will fail because stack checking is enabled by default (>=4.16).
---
arch/arm/boot/compressed/misc.c +1 -8
@@ -127,12 +127,7 @@ asmlinkage void __div0(void)error ("Attempting division by 0!" ); } -unsigned long __stack_chk_guard; - -void __stack_chk_guard_setup (void ) -{ - __stack_chk_guard =0x000a0dff ; -} +const unsigned long __stack_chk_guard =0x000a0dff ;void __stack_chk_fail (void ) {
@@ -149,8 +144,6 @@ decompress_kernel(unsigned long output_s {int ret; -__stack_chk_guard_setup (); - output_data = (unsigned char *)output_start; free_mem_ptr = free_mem_ptr_p; free_mem_end_ptr = free_mem_ptr_end_p;
PATCH 114/366 hugetlbfs: fix bug in pgoff overflow checking
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Kravetz <[email protected]>
commit 5df63c2a149ae65a9ec239e7c2af44efa6f79beb upstream.
This is a fix for a regression in 32 bit kernels caused by an invalid check for pgoff overflow in hugetlbfs mmap setup. The check incorrectly specified that the size of a loff_t was the same as the size of a long. The regression prevents mapping hugetlbfs files at offsets greater than 4GB on 32 bit kernels.
On 32 bit kernels conversion from a page based unsigned long can not overflow a loff_t byte offset. Therefore, skip this check if sizeof(unsigned long) != sizeof(loff_t).
--- fs/hugetlbfs/inode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/hugetlbfs/inode.c +7 -3
@@ -127,10 +127,14 @@ static int hugetlbfs_file_mmap(struct fi/* * page based offset in vm_pgoff could be sufficiently large to -* overflow a (l)off_t when converted to byte offset. +* overflow a loff_t when converted to byte offset. This can +* only happen on architectures where sizeof(loff_t) == +* sizeof(unsigned long). So, only check in those instances. */ -if (vma->vm_pgoff &PGOFF_LOFFT_MAX ) -return -EINVAL ; +if (sizeof (unsigned long ) ==sizeof (loff_t)) { +if (vma->vm_pgoff &PGOFF_LOFFT_MAX ) +return -EINVAL ; + }/* must be huge page aligned */ if (vma->vm_pgoff & (~huge_page_mask (h) >>PAGE_SHIFT ))
PATCH 115/366 ocfs2/dlm: wait for dlm recovery done when migrating all lock resources
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: piaojun <[email protected]>
commit 60c7ec9ee4a3410c2cb08850102d363c7e207f48 upstream.
Wait for dlm recovery done when migrating all lock resources in case that new lock resource left after leaving dlm domain. And the left lock resource will cause other nodes BUG.
NodeA NodeB NodeC
umount:
dlm_unregister_domain()
dlm_migrate_all_locks()
NodeB down
do recovery for NodeB
and collect a new lockres
form other live nodes:
dlm_do_recovery
dlm_remaster_locks
dlm_request_all_locks:
dlm_mig_lockres_handler
dlm_new_lockres
__dlm_insert_lockres
at last NodeA become the
master of the new lockres
and leave domain:
dlm_leave_domain()
mount:
dlm_join_domain()
touch file and request for the owner of the new lockres, but all the other nodes said 'NO', so NodeC decide to be the owner, and send do assert msg to other nodes:
dlmlock()
dlm_get_lock_resource()
dlm_do_assert_master()
other nodes receive the msg and found two masters exist. at last cause BUG in dlm_assert_master_handler() -->BUG();
--- fs/ocfs2/dlm/dlmcommon.h | 1 + fs/ocfs2/dlm/dlmdomain.c | 15 +++++++++++++++ fs/ocfs2/dlm/dlmrecovery.c | 13 ++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-)
fs/ocfs2/dlm/dlmcommon.h +1 -0
@@ -140,6 +140,7 @@ struct dlm_ctxtu8 node_num;u32 key;u8 joining_node; +u8 migrate_done;/* set to 1 means node has migrated all lock resources */ wait_queue_head_t dlm_join_events;unsigned long live_nodes_map[BITS_TO_LONGS (O2NM_MAX_NODES )];unsigned long domain_map[BITS_TO_LONGS (O2NM_MAX_NODES )];
fs/ocfs2/dlm/dlmdomain.c +15 -0
@@ -460,6 +460,19 @@ redo_bucket:cond_resched_lock (&dlm->spinlock); num += n; } + +if (!num) { +if (dlm->reco.state &DLM_RECO_STATE_ACTIVE ) { +mlog (0 ,"%s: perhaps there are more lock resources " +"need to be migrated after dlm recovery\n" , dlm->name); + ret = -EAGAIN ; + }else { +mlog (0 ,"%s: we won't do dlm recovery after migrating " +"all lock resources\n" , dlm->name); + dlm->migrate_done =1 ; + } + } +spin_unlock (&dlm->spinlock);wake_up (&dlm->dlm_thread_wq);
@@ -2063,6 +2076,8 @@ static struct dlm_ctxt *dlm_alloc_ctxt(c dlm->joining_node =DLM_LOCK_RES_OWNER_UNKNOWN ;init_waitqueue_head (&dlm->dlm_join_events); + dlm->migrate_done =0 ; + dlm->reco.new_master =O2NM_INVALID_NODE_NUM ; dlm->reco.dead_node =O2NM_INVALID_NODE_NUM ;
fs/ocfs2/dlm/dlmrecovery.c +10 -3
@@ -423,12 +423,11 @@ void dlm_wait_for_recovery(struct dlm_ctstatic void dlm_begin_recovery (struct dlm_ctxt *dlm) { -spin_lock (&dlm->spinlock); +assert_spin_locked (&dlm->spinlock);BUG_ON (dlm->reco.state &DLM_RECO_STATE_ACTIVE );printk (KERN_NOTICE "o2dlm: Begin recovery on domain %s for node %u\n" , dlm->name, dlm->reco.dead_node); dlm->reco.state |=DLM_RECO_STATE_ACTIVE ; -spin_unlock (&dlm->spinlock); }static void dlm_end_recovery (struct dlm_ctxt *dlm)
@@ -456,6 +455,13 @@ static int dlm_do_recovery(struct dlm_ctspin_lock (&dlm->spinlock); +if (dlm->migrate_done) { +mlog (0 ,"%s: no need do recovery after migrating all " +"lock resources\n" , dlm->name); +spin_unlock (&dlm->spinlock); +return 0 ; + } +/* check to see if the new master has died */ if (dlm->reco.new_master !=O2NM_INVALID_NODE_NUM &&test_bit (dlm->reco.new_master, dlm->recovery_map)) {
@@ -490,12 +496,13 @@ static int dlm_do_recovery(struct dlm_ctmlog (0 ,"%s(%d):recovery thread found node %u in the recovery map!\n" , dlm->name,task_pid_nr (dlm->dlm_reco_thread_task), dlm->reco.dead_node); -spin_unlock (&dlm->spinlock);/* take write barrier */ /* (stops the list reshuffling thread, proxy ast handling) */ dlm_begin_recovery (dlm); +spin_unlock (&dlm->spinlock); +if (dlm->reco.new_master == dlm->node_num) goto master_here;
PATCH 116/366 block_invalidatepage(): only release page if the full page was invalidated
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Moyer <[email protected]>
commit 3172485f4f8032649c144e4aafa550e1e6179332 upstream.
Prior to commit d47992f86b30 ("mm: change invalidatepage prototype to accept length"), an offset of 0 meant that the full page was being invalidated. After that commit, we need to instead check the length.
Jan said:
:
: The only possible issue is that try_to_release_page() was called more : often than necessary. Otherwise the issue is harmless but still it's good : to have this fixed.
--- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/buffer.c +1 -1
@@ -1575,7 +1575,7 @@ void block_invalidatepage(struct page *p* The get_block cached value has been unconditionally invalidated, * so real IO is not possible anymore. */ -if (offset ==0 ) +if (length ==PAGE_SIZE )try_to_release_page (page,0 ); out:return ;
PATCH 117/366 ALSA: pcm: Fix endless loop for XRUN recovery in OSS emulation
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit e15dc99dbb9cf99f6432e8e3c0b3a8f7a3403a86 upstream.
The commit 02a5d6925cd3 ("ALSA: pcm: Avoid potential races between OSS ioctls and read/write") split the PCM preparation code to a locked version, and it added a sanity check of runtime->oss.prepare flag along with the change. This leaded to an endless loop when the stream gets XRUN: namely, snd_pcm_oss_write3() and co call snd_pcm_oss_prepare() without setting runtime->oss.prepare flag and the loop continues until the PCM state reaches to another one.
As the function is supposed to execute the preparation unconditionally, drop the invalid state check there.
The bug was triggered by syzkaller.
--- sound/core/oss/pcm_oss.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/core/oss/pcm_oss.c +3 -2
@@ -1140,13 +1140,14 @@ static int snd_pcm_oss_get_active_substr }/* call with params_lock held */ +/* NOTE: this always call PREPARE unconditionally no matter whether +* runtime->oss.prepare is set or not +*/ static int snd_pcm_oss_prepare (struct snd_pcm_substream *substream) {int err;struct snd_pcm_runtime *runtime = substream->runtime; -if (!runtime->oss.prepare) -return 0 ; err =snd_pcm_kernel_ioctl (substream,SNDRV_PCM_IOCTL_PREPARE ,NULL );if (err <0 ) { pcm_dbg(substream->pcm,
PATCH 118/366 crypto: af_alg - fix possible uninit-value in alg_bind()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit a466856e0b7ab269cdf9461886d007e88ff575b0 upstream.
syzbot reported :
BUG: KMSAN: uninit-value in alg_bind+0xe3/0xd90 crypto/af_alg.c:162
We need to check addr_len before dereferencing sa (or uaddr)
--- crypto/af_alg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
crypto/af_alg.c +4 -4
@@ -157,16 +157,16 @@ static int alg_bind(struct socket *sock,void *private;int err; -/* If caller uses non-allowed flag, return error. */ -if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) -return -EINVAL ; -if (sock->state ==SS_CONNECTED )return -EINVAL ;if (addr_len !=sizeof (*sa))return -EINVAL ; +/* If caller uses non-allowed flag, return error. */ +if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) +return -EINVAL ; + sa->salg_type[sizeof (sa->salg_type) -1 ] =0 ; sa->salg_name[sizeof (sa->salg_name) -1 ] =0 ;
PATCH 119/366 netlink: fix uninit-value in netlink_sendmsg
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 6091f09c2f79730d895149bcfe3d66140288cd0e upstream.
syzbot reported :
BUG: KMSAN: uninit-value in ffs arch/x86/include/asm/bitops.h:432 [inline] BUG: KMSAN: uninit-value in netlink_sendmsg+0xb26/0x1310 net/netlink/af_netlink.c:1851
--- net/netlink/af_netlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/netlink/af_netlink.c +2 -0
@@ -1658,6 +1658,8 @@ static int netlink_sendmsg(struct kiocbif (msg->msg_namelen) { err = -EINVAL ; +if (msg->msg_namelen <sizeof (struct sockaddr_nl )) + goto out;if (addr->nl_family !=AF_NETLINK ) goto out; dst_portid = addr->nl_pid;
PATCH 120/366 net: fix rtnh_ok()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit b1993a2de12c9e75c35729e2ffbc3a92d50c0d31 upstream.
syzbot reported :
BUG: KMSAN: uninit-value in rtnh_ok include/net/nexthop.h:11 [inline] BUG: KMSAN: uninit-value in fib_count_nexthops net/ipv4/fib_semantics.c:469 [inline] BUG: KMSAN: uninit-value in fib_create_info+0x554/0x8d20 net/ipv4/fib_semantics.c:1091
@remaining is an integer, coming from user space. If it is negative we want rtnh_ok() to return false.
--- include/net/nexthop.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/nexthop.h +1 -1
@@ -6,7 +6,7 @@static inline int rtnh_ok (const struct rtnexthop *rtnh,int remaining) { -return remaining >=sizeof (*rtnh) && +return remaining >= (int )sizeof (*rtnh) && rtnh->rtnh_len >=sizeof (*rtnh) && rtnh->rtnh_len <= remaining; }
PATCH 121/366 net: initialize skb->peeked when cloning
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit b13dda9f9aa7caceeee61c080c2e544d5f5d85e5 upstream.
syzbot reported __skb_try_recv_from_queue() was using skb->peeked while it was potentially unitialized.
We need to clear it in __skb_clone()
--- net/core/skbuff.c | 1 + 1 file changed, 1 insertion(+)
net/core/skbuff.c +1 -0
@@ -767,6 +767,7 @@ static struct sk_buff *__skb_clone(struc n->hdr_len = skb->nohdr ?skb_headroom (skb) : skb->hdr_len; n->cloned =1 ; n->nohdr =0 ; + n->peeked =0 ; n->destructor =NULL ;C (tail);C (end);
PATCH 122/366 net: fix uninit-value in __hw_addr_add_ex()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 77d36398d99f2565c0a8d43a86fd520a82e64bb8 upstream.
syzbot complained :
BUG: KMSAN: uninit-value in memcmp+0x119/0x180 lib/string.c:861 CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.16.0+ #82 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: ipv6_addrconf addrconf_dad_work Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676 memcmp+0x119/0x180 lib/string.c:861 __hw_addr_add_ex net/core/dev_addr_lists.c:60 [inline] __dev_mc_add+0x1c2/0x8e0 net/core/dev_addr_lists.c:670 dev_mc_add+0x6d/0x80 net/core/dev_addr_lists.c:687 igmp6_group_added+0x2db/0xa00 net/ipv6/mcast.c:662 ipv6_dev_mc_inc+0xe9e/0x1130 net/ipv6/mcast.c:914 addrconf_join_solict net/ipv6/addrconf.c:2078 [inline] addrconf_dad_begin net/ipv6/addrconf.c:3828 [inline] addrconf_dad_work+0x427/0x2150 net/ipv6/addrconf.c:3954 process_one_work+0x12c6/0x1f60 kernel/workqueue.c:2113 worker_thread+0x113c/0x24f0 kernel/workqueue.c:2247 kthread+0x539/0x720 kernel/kthread.c:239
--- net/core/dev_addr_lists.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/dev_addr_lists.c +2 -2
@@ -57,8 +57,8 @@ static int __hw_addr_add_ex(struct netdereturn -EINVAL ;list_for_each_entry (ha, &list->list, list) { -if (!memcmp (ha->addr, addr, addr_len) && - ha->type == addr_type) { +if (ha->type == addr_type && + !memcmp (ha->addr, addr, addr_len)) {if (global) {/* check if addr is already used as global */ if (ha->global_use)
PATCH 123/366 soreuseport: initialise timewait reuseport field
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 3099a52918937ab86ec47038ad80d377ba16c531 upstream.
syzbot reported an uninit-value in inet_csk_bind_conflict() [1]
It turns out we never propagated sk->sk_reuseport into timewait socket.
[1]
BUG: KMSAN: uninit-value in inet_csk_bind_conflict+0x5f9/0x990 net/ipv4/inet_connection_sock.c:151 CPU: 1 PID: 3589 Comm: syzkaller008242 Not tainted 4.16.0+ #82 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676 inet_csk_bind_conflict+0x5f9/0x990 net/ipv4/inet_connection_sock.c:151 inet_csk_get_port+0x1d28/0x1e40 net/ipv4/inet_connection_sock.c:320 inet6_bind+0x121c/0x1820 net/ipv6/af_inet6.c:399 SYSC_bind+0x3f2/0x4b0 net/socket.c:1474 SyS_bind+0x54/0x80 net/socket.c:1460 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x4416e9 RSP: 002b:00007ffce6d15c88 EFLAGS: 00000217 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 0100000000000000 RCX: 00000000004416e9 RDX: 000000000000001c RSI: 0000000020402000 RDI: 0000000000000004 RBP: 0000000000000000 R08: 00000000e6d15e08 R09: 00000000e6d15e08 R10: 0000000000000004 R11: 0000000000000217 R12: 0000000000009478 R13: 00000000006cd448 R14: 0000000000000000 R15: 0000000000000000
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_save_stack mm/kmsan/kmsan.c:293 [inline] kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:684 __msan_chain_origin+0x69/0xc0 mm/kmsan/kmsan_instr.c:521 tcp_time_wait+0xf17/0xf50 net/ipv4/tcp_minisocks.c:283 tcp_rcv_state_process+0xebe/0x6490 net/ipv4/tcp_input.c:6003 tcp_v6_do_rcv+0x11dd/0x1d90 net/ipv6/tcp_ipv6.c:1331 sk_backlog_rcv include/net/sock.h:908 [inline] __release_sock+0x2d6/0x680 net/core/sock.c:2271 release_sock+0x97/0x2a0 net/core/sock.c:2786 tcp_close+0x277/0x18f0 net/ipv4/tcp.c:2269 inet_release+0x240/0x2a0 net/ipv4/af_inet.c:427 inet6_release+0xaf/0x100 net/ipv6/af_inet6.c:435 sock_release net/socket.c:595 [inline] sock_close+0xe0/0x300 net/socket.c:1149 __fput+0x49e/0xa10 fs/file_table.c:209 ____fput+0x37/0x40 fs/file_table.c:243 task_work_run+0x243/0x2c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x10e1/0x38d0 kernel/exit.c:867 do_group_exit+0x1a0/0x360 kernel/exit.c:970 SYSC_exit_group+0x21/0x30 kernel/exit.c:981 SyS_exit_group+0x25/0x30 kernel/exit.c:979 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 Uninit was stored to memory at: kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_save_stack mm/kmsan/kmsan.c:293 [inline] kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:684 __msan_chain_origin+0x69/0xc0 mm/kmsan/kmsan_instr.c:521 inet_twsk_alloc+0xaef/0xc00 net/ipv4/inet_timewait_sock.c:182 tcp_time_wait+0xd9/0xf50 net/ipv4/tcp_minisocks.c:258 tcp_rcv_state_process+0xebe/0x6490 net/ipv4/tcp_input.c:6003 tcp_v6_do_rcv+0x11dd/0x1d90 net/ipv6/tcp_ipv6.c:1331 sk_backlog_rcv include/net/sock.h:908 [inline] __release_sock+0x2d6/0x680 net/core/sock.c:2271 release_sock+0x97/0x2a0 net/core/sock.c:2786 tcp_close+0x277/0x18f0 net/ipv4/tcp.c:2269 inet_release+0x240/0x2a0 net/ipv4/af_inet.c:427 inet6_release+0xaf/0x100 net/ipv6/af_inet6.c:435 sock_release net/socket.c:595 [inline] sock_close+0xe0/0x300 net/socket.c:1149 __fput+0x49e/0xa10 fs/file_table.c:209 ____fput+0x37/0x40 fs/file_table.c:243 task_work_run+0x243/0x2c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x10e1/0x38d0 kernel/exit.c:867 do_group_exit+0x1a0/0x360 kernel/exit.c:970 SYSC_exit_group+0x21/0x30 kernel/exit.c:981 SyS_exit_group+0x25/0x30 kernel/exit.c:979 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 Uninit was created at: kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314 kmem_cache_alloc+0xaab/0xb90 mm/slub.c:2756 inet_twsk_alloc+0x13b/0xc00 net/ipv4/inet_timewait_sock.c:163 tcp_time_wait+0xd9/0xf50 net/ipv4/tcp_minisocks.c:258 tcp_rcv_state_process+0xebe/0x6490 net/ipv4/tcp_input.c:6003 tcp_v6_do_rcv+0x11dd/0x1d90 net/ipv6/tcp_ipv6.c:1331 sk_backlog_rcv include/net/sock.h:908 [inline] __release_sock+0x2d6/0x680 net/core/sock.c:2271 release_sock+0x97/0x2a0 net/core/sock.c:2786 tcp_close+0x277/0x18f0 net/ipv4/tcp.c:2269 inet_release+0x240/0x2a0 net/ipv4/af_inet.c:427 inet6_release+0xaf/0x100 net/ipv6/af_inet6.c:435 sock_release net/socket.c:595 [inline] sock_close+0xe0/0x300 net/socket.c:1149 __fput+0x49e/0xa10 fs/file_table.c:209 ____fput+0x37/0x40 fs/file_table.c:243 task_work_run+0x243/0x2c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x10e1/0x38d0 kernel/exit.c:867 do_group_exit+0x1a0/0x360 kernel/exit.c:970 SYSC_exit_group+0x21/0x30 kernel/exit.c:981 SyS_exit_group+0x25/0x30 kernel/exit.c:979 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
--- include/net/inet_timewait_sock.h | 1 + net/ipv4/inet_timewait_sock.c | 1 + 2 files changed, 2 insertions(+)
include/net/inet_timewait_sock.h +1 -0
@@ -108,6 +108,7 @@ struct inet_timewait_sock {#define tw_family __tw_common.skc_family#define tw_state __tw_common.skc_state#define tw_reuse __tw_common.skc_reuse +#define tw_reuseport __tw_common.skc_reuseport#define tw_bound_dev_if __tw_common.skc_bound_dev_if#define tw_node __tw_common.skc_nulls_node#define tw_bind_node __tw_common.skc_bind_node
net/ipv4/inet_timewait_sock.c +1 -0
@@ -191,6 +191,7 @@ struct inet_timewait_sock *inet_twsk_all tw->tw_dport = inet->inet_dport; tw->tw_family = sk->sk_family; tw->tw_reuse = sk->sk_reuse; + tw->tw_reuseport = sk->sk_reuseport; tw->tw_hash = sk->sk_hash; tw->tw_ipv6only =0 ; tw->tw_transparent = inet->transparent;
PATCH 124/366 sctp: do not leak kernel memory to user space
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 6780db244d6b1537d139dea0ec8aad10cf9e4adb upstream.
syzbot produced a nice report [1]
Issue here is that a recvmmsg() managed to leak 8 bytes of kernel memory to user space, because sin_zero (padding field) was not properly cleared.
[1]
BUG: KMSAN: uninit-value in copy_to_user include/linux/uaccess.h:184 [inline] BUG: KMSAN: uninit-value in move_addr_to_user+0x32e/0x530 net/socket.c:227 CPU: 1 PID: 3586 Comm: syzkaller481044 Not tainted 4.16.0+ #82 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 kmsan_internal_check_memory+0x164/0x1d0 mm/kmsan/kmsan.c:1176 kmsan_copy_to_user+0x69/0x160 mm/kmsan/kmsan.c:1199 copy_to_user include/linux/uaccess.h:184 [inline] move_addr_to_user+0x32e/0x530 net/socket.c:227 ___sys_recvmsg+0x4e2/0x810 net/socket.c:2211 __sys_recvmmsg+0x54e/0xdb0 net/socket.c:2313 SYSC_recvmmsg+0x29b/0x3e0 net/socket.c:2394 SyS_recvmmsg+0x76/0xa0 net/socket.c:2378 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x4401c9 RSP: 002b:00007ffc56f73098 EFLAGS: 00000217 ORIG_RAX: 000000000000012b RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004401c9 RDX: 0000000000000001 RSI: 0000000020003ac0 RDI: 0000000000000003 RBP: 00000000006ca018 R08: 0000000020003bc0 R09: 0000000000000010 R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000401af0 R13: 0000000000401b80 R14: 0000000000000000 R15: 0000000000000000
Local variable description: ----addr@___sys_recvmsg Variable was created at:
___sys_recvmsg+0xd5/0x810 net/socket.c:2172 __sys_recvmmsg+0x54e/0xdb0 net/socket.c:2313
Bytes 8-15 of 16 are uninitialized
==================================================================
Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 3586 Comm: syzkaller481044 Tainted: G B 4.16.0+ #82 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 panic+0x39d/0x940 kernel/panic.c:183 kmsan_report+0x238/0x240 mm/kmsan/kmsan.c:1083 kmsan_internal_check_memory+0x164/0x1d0 mm/kmsan/kmsan.c:1176 kmsan_copy_to_user+0x69/0x160 mm/kmsan/kmsan.c:1199 copy_to_user include/linux/uaccess.h:184 [inline] move_addr_to_user+0x32e/0x530 net/socket.c:227 ___sys_recvmsg+0x4e2/0x810 net/socket.c:2211 __sys_recvmmsg+0x54e/0xdb0 net/socket.c:2313 SYSC_recvmmsg+0x29b/0x3e0 net/socket.c:2394 SyS_recvmmsg+0x76/0xa0 net/socket.c:2378 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
--- net/sctp/ipv6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sctp/ipv6.c +3 -1
@@ -700,8 +700,10 @@ static int sctp_v6_addr_to_user(struct ssctp_v6_map_v4 (addr); } -if (addr->sa.sa_family ==AF_INET ) +if (addr->sa.sa_family ==AF_INET ) { +memset (addr->v4.sin_zero,0 ,sizeof (addr->v4.sin_zero));return sizeof (struct sockaddr_in ); + }return sizeof (struct sockaddr_in6 ); }
PATCH 125/366 HID: hidraw: Fix crash on HIDIOCGFEATURE with a destroyed device
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Rivas Costa <[email protected]>
commit a955358d54695e4ad9f7d6489a7ac4d69a8fc711 upstream.
Doing ioctl(HIDIOCGFEATURE) in a tight loop on a hidraw device and then disconnecting the device, or unloading the driver, can cause a NULL pointer dereference.
When a hidraw device is destroyed it sets 0 to dev->exist. Most functions check 'dev->exist' before doing its work, but hidraw_get_report() was missing that check.
--- drivers/hid/hidraw.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/hidraw.c +5 -0
@@ -197,6 +197,11 @@ static ssize_t hidraw_get_report(structint ret =0 , len;unsigned char report_number; +if (!hidraw_table[minor] || !hidraw_table[minor]->exist) { + ret = -ENODEV ; + goto out; + } + dev = hidraw_table[minor]->hid;if (!dev->ll_driver->raw_request) {
PATCH 126/366 fanotify: fix logic of events on child
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit 54a307ba8d3cd00a3902337ffaae28f436eeb1a4 upstream.
When event on child inodes are sent to the parent inode mark and parent inode mark was not marked with FAN_EVENT_ON_CHILD, the event will not be delivered to the listener process. However, if the same process also has a mount mark, the event to the parent inode will be delivered regadless of the mount mark mask.
This behavior is incorrect in the case where the mount mark mask does not contain the specific event type. For example, the process adds a mark on a directory with mask FAN_MODIFY (without FAN_EVENT_ON_CHILD) and a mount mark with mask FAN_CLOSE_NOWRITE (without FAN_ONDIR).
A modify event on a file inside that directory (and inside that mount) should not create a FAN_MODIFY event, because neither of the marks requested to get that event on the file.
--- fs/notify/fanotify/fanotify.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)
fs/notify/fanotify/fanotify.c +15 -19
@@ -92,7 +92,7 @@ static bool fanotify_should_send_event(su32 event_mask, void *data, int data_type) { - __u32 marks_mask, marks_ignored_mask; + __u32 marks_mask = 0, marks_ignored_mask = 0;struct path *path = data; pr_debug("%s: inode_mark=%p vfsmnt_mark=%p mask=%x data=%p"
@@ -108,24 +108,20 @@ static bool fanotify_should_send_event(s !S_ISDIR(path->dentry->d_inode->i_mode))return false; -if (inode_mark && vfsmnt_mark) { - marks_mask = (vfsmnt_mark->mask | inode_mark->mask); - marks_ignored_mask = (vfsmnt_mark->ignored_mask | inode_mark->ignored_mask); - }else if (inode_mark) { -/* -* if the event is for a child and this inode doesn't care about -* events on the child, don't send it! -*/ -if ((event_mask &FS_EVENT_ON_CHILD ) && - !(inode_mark->mask &FS_EVENT_ON_CHILD )) -return false; - marks_mask = inode_mark->mask; - marks_ignored_mask = inode_mark->ignored_mask; - }else if (vfsmnt_mark) { - marks_mask = vfsmnt_mark->mask; - marks_ignored_mask = vfsmnt_mark->ignored_mask; - }else { -BUG (); +/* +* if the event is for a child and this inode doesn't care about +* events on the child, don't send it! +*/ +if (inode_mark && + (!(event_mask &FS_EVENT_ON_CHILD ) || + (inode_mark->mask &FS_EVENT_ON_CHILD ))) { + marks_mask |= inode_mark->mask; + marks_ignored_mask |= inode_mark->ignored_mask; + } + +if (vfsmnt_mark) { + marks_mask |= vfsmnt_mark->mask; + marks_ignored_mask |= vfsmnt_mark->ignored_mask; } if (S_ISDIR(path->dentry->d_inode->i_mode) &&
PATCH 127/366 scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 1514839b366417934e2f1328edb50ed1e8a719f5 upstream.
This patch fixes NULL pointer crash due to active timer running for abort IOCB.
=46romcrash dump analysis it was discoverd that get_next_timer_interrupt() encountered a corrupted entry on the timer list.
#9 [ffff95e1f6f0fd40] page_fault at ffffffff914fe8f8
[exception RIP: get_next_timer_interrupt+440]
RIP: ffffffff90ea3088 RSP: ffff95e1f6f0fdf0 RFLAGS: 00010013
RAX: ffff95e1f6451028 RBX: 000218e2389e5f40 RCX: 00000001232ad600
RDX: 0000000000000001 RSI: ffff95e1f6f0fdf0 RDI: 0000000001232ad6
RBP: ffff95e1f6f0fe40 R8: ffff95e1f6451188 R9: 0000000000000001
R10: 0000000000000016 R11: 0000000000000016 R12: 00000001232ad5f6
R13: ffff95e1f6450000 R14: ffff95e1f6f0fdf8 R15: ffff95e1f6f0fe10
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018Looking at the assembly of get_next_timer_interrupt(), address came from %r8 (ffff95e1f6451188) which is pointing to list_head with single entry at ffff95e5ff621178.
0xffffffff90ea307a <get_next_timer_interrupt+426>: mov (%r8),%rdx 0xffffffff90ea307d <get_next_timer_interrupt+429>: cmp %r8,%rdx 0xffffffff90ea3080 <get_next_timer_interrupt+432>: je 0xffffffff90ea30a7 <get_next_timer_interrupt+471> 0xffffffff90ea3082 <get_next_timer_interrupt+434>: nopw 0x0(%rax,%rax,1) 0xffffffff90ea3088 <get_next_timer_interrupt+440>: testb $0x1,0x18(%rdx)
crash> rd ffff95e1f6451188 10
ffff95e1f6451188: ffff95e5ff621178 ffff95e5ff621178 x.b.....x.b..... ffff95e1f6451198: ffff95e1f6451198 ffff95e1f6451198 ..E.......E..... ffff95e1f64511a8: ffff95e1f64511a8 ffff95e1f64511a8 ..E.......E..... ffff95e1f64511b8: ffff95e77cf509a0 ffff95e77cf509a0 ...|.......|.... ffff95e1f64511c8: ffff95e1f64511c8 ffff95e1f64511c8 ..E.......E.....
crash> rd ffff95e5ff621178 10
ffff95e5ff621178: 0000000000000001 ffff95e15936aa00 ..........6Y.... ffff95e5ff621188: 0000000000000000 00000000ffffffff ................ ffff95e5ff621198: 00000000000000a0 0000000000000010 ................ ffff95e5ff6211a8: ffff95e5ff621198 000000000000000c ..b............. ffff95e5ff6211b8: 00000f5800000000 ffff95e751f8d720 ....X... ..Q....
ffff95e5ff621178 belongs to freed mempool object at ffff95e5ff621080.
CACHE NAME OBJSIZE ALLOCATED TOTAL SLABS SSIZE
ffff95dc7fd74d00 mnt_cache 384 19785 24948 594 16k
SLAB MEMORY NODE TOTAL ALLOCATED FREE
ffffdc5dabfd8800 ffff95e5ff620000 1 42 29 13
FREE / [ALLOCATED]
ffff95e5ff621080 (cpu 6 cache)
Examining the contents of that memory reveals a pointer to a constant string in the driver, "abort\0", which is set by qla24xx_async_abort_cmd().
crash> rd ffffffffc059277c 20
ffffffffc059277c: 6e490074726f6261 0074707572726574 abort.Interrupt. ffffffffc059278c: 00676e696c6c6f50 6920726576697244 Polling.Driver i ffffffffc059279c: 646f6d207325206e 6974736554000a65 n %s mode..Testi ffffffffc05927ac: 636976656420676e 786c252074612065 ng device at %lx ffffffffc05927bc: 6b63656843000a2e 646f727020676e69 ...Checking prod ffffffffc05927cc: 6f20444920746375 0a2e706968632066 uct ID of chip.. ffffffffc05927dc: 5120646e756f4600 204130303232414c .Found QLA2200A ffffffffc05927ec: 43000a2e70696843 20676e696b636568 Chip...Checking ffffffffc05927fc: 65786f626c69616d 6c636e69000a2e73 mailboxes...incl ffffffffc059280c: 756e696c2f656475 616d2d616d642f78 ude/linux/dma-ma
crash> struct -ox srb_iocb
struct srb_iocb {
union {
struct {...} logio;
struct {...} els_logo;
struct {...} tmf;
struct {...} fxiocb;
struct {...} abt;
struct ct_arg ctarg;
struct {...} mbx;
struct {...} nack;
[0x0 ] } u;
[0xb8] struct timer_list timer;
[0x108] void (*timeout)(void *); }
SIZE: 0x110
crash> ! bc
ibase=16
obase=10
B8+40
F8
The object is a srb_t, and at offset 0xf8 within that structure (i.e. ffff95e5ff621080 + f8 -> ffff95e5ff621178) is a struct timer_list.
--- drivers/scsi/qla2xxx/qla_init.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_init.c +1 -0
@@ -363,6 +363,7 @@ qla24xx_abort_sp_done(void *data, void *srb_t *sp = (srb_t *)ptr;struct srb_iocb *abt = &sp->u.iocb_cmd; +del_timer (&sp->u.iocb_cmd.timer);complete (&abt->u.abt.comp); }
PATCH 128/366 scsi: qla2xxx: Avoid double completion of abort command
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 3a9910d7b686546dcc9986e790af17e148f1c888 upstream.
qla2x00_tmf_sp_done() now deletes the timer that will run qla2x00_tmf_iocb_timeout(), but doesn't check whether the timer already expired. Check the return value from del_timer() to avoid calling complete() a second time.
--- drivers/scsi/qla2xxx/qla_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +2 -2
@@ -363,8 +363,8 @@ qla24xx_abort_sp_done(void *data, void *srb_t *sp = (srb_t *)ptr;struct srb_iocb *abt = &sp->u.iocb_cmd; -del_timer (&sp->u.iocb_cmd.timer); -complete (&abt->u.abt.comp); +if (del_timer (&sp->u.iocb_cmd.timer)) +complete (&abt->u.abt.comp); } static int
PATCH 129/366 s390/ipl: ensure loadparm valid flag is set
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Gorbik <[email protected]>
commit 15deb080a6087b73089139569558965750e69d67 upstream.
When loadparm is set in reipl parm block, the kernel should also set DIAG308_FLAGS_LP_VALID flag.
This fixes loadparm ignoring during z/VM fcp -> ccw reipl and kvm direct boot -> ccw reipl.
--- arch/s390/kernel/ipl.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/kernel/ipl.c +1 -0
@@ -825,6 +825,7 @@ static ssize_t reipl_generic_loadparm_st/* copy and convert to ebcdic */ memcpy (ipb->ipl_info.ccw.load_parm, buf, lp_len);ASCEBC (ipb->ipl_info.ccw.load_parm,LOADPARM_LEN ); + ipb->hdr.flags |=DIAG308_FLAGS_LP_VALID ;return len; }
PATCH 130/366 x86/apic: Fix signedness bug in APIC ID validity checks
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
commit a774635db5c430cbf21fa5d2f2df3d23aaa8e782 upstream.
The APIC ID as parsed from ACPI MADT is validity checked with the apic->apic_id_valid() callback, which depends on the selected APIC type.
For non X2APIC types APIC IDs >= 0xFF are invalid, but values > 0x7FFFFFFF are detected as valid. This happens because the 'apicid' argument of the apic_id_valid() callback is type 'int'. So the resulting comparison
apicid < 0xFF
evaluates to true for all unsigned int values > 0x7FFFFFFF which are handed to default_apic_id_valid(). As a consequence, invalid APIC IDs in !X2APIC mode are considered valid and accounted as possible CPUs.
Change the apicid argument type of the apic_id_valid() callback to u32 so the evaluation is unsigned and returns the correct result.
[ tglx: Massaged changelog ]
[bwh: Backported to 3.16:
- Drop change to xen_id_always_valid()
- Adjust filenames, context]
---
arch/x86/include/asm/apic.h +2 -2
@@ -288,7 +288,7 @@ struct apic {int (*probe)(void );int (*acpi_madt_oem_check)(char *oem_id,char *oem_table_id); -int (*apic_id_valid)(int apicid); +int (*apic_id_valid)(u32 apicid);int (*apic_id_registered)(void );u32 irq_delivery_mode;
@@ -547,7 +547,7 @@ static inline unsigned int read_apic_id(return apic->get_apic_id (reg); } -static inline int default_apic_id_valid (int apicid) +static inline int default_apic_id_valid (u32 apicid) {return (apicid <255 ); }
arch/x86/include/asm/x2apic.h +1 -1
@@ -9,7 +9,7 @@#include <asm/ipi.h> #include <linux/cpumask.h> -static int x2apic_apic_id_valid (int apicid) +static int x2apic_apic_id_valid (u32 apicid) {return 1 ; }
arch/x86/kernel/acpi/boot.c +8 -5
@@ -215,7 +215,7 @@ static int __init acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) {struct acpi_madt_local_x2apic *processor =NULL ; -int apic_id; +u32 apic_id;u8 enabled; processor = (struct acpi_madt_local_x2apic *)header;
@@ -235,10 +235,13 @@ acpi_parse_x2apic(struct acpi_subtable_h* to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ -if (!apic->apic_id_valid (apic_id) && enabled) - printk(KERN_WARNING PREFIX "x2apic entry ignored\n"); -else -acpi_register_lapic (apic_id, enabled); +if (!apic->apic_id_valid (apic_id)) { +if (enabled) +pr_warn (PREFIX "x2apic entry ignored\n" ); +return 0 ; + } + +acpi_register_lapic (apic_id, enabled);#else printk(KERN_WARNING PREFIX "x2apic entry ignored\n");#endif
arch/x86/kernel/apic/apic_numachip.c +1 -1
@@ -58,7 +58,7 @@ static unsigned int read_xapic_id(void)return get_apic_id (apic_read (APIC_ID )); } -static int numachip_apic_id_valid (int apicid) +static int numachip_apic_id_valid (u32 apicid) {/* Trust what bootloader passes in MADT */ return 1 ;
arch/x86/kernel/apic/x2apic_uv_x.c +1 -1
@@ -272,7 +272,7 @@ static void uv_send_IPI_all(int vector)uv_send_IPI_mask (cpu_online_mask, vector); } -static int uv_apic_id_valid (int apicid) +static int uv_apic_id_valid (u32 apicid) {return 1 ; }
PATCH 131/366 tracing/uprobe_event: Fix strncpy corner case
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
commit 50268a3d266ecfdd6c5873d62b2758d9732fc598 upstream.
Fix string fetch function to terminate with NUL.
It is OK to drop the rest of string.
--- kernel/trace/trace_uprobe.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/trace_uprobe.c +2 -0
@@ -149,6 +149,8 @@ static void FETCH_FUNC_NAME(memory, strireturn ; ret =strncpy_from_user (dst, src, maxlen); +if (ret == maxlen) + dst[--ret] ='\0' ;if (ret <0 ) {/* Failed to fetch string */ ((u8 *)get_rloc_data (dest))[0 ] ='\0' ;
PATCH 132/366 powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit 34dd25de9fe3f60bfdb31b473bf04b28262d0896 upstream.
This is the start of an effort to tidy up and standardise all the delays. Existing loops have a range of delay/sleep periods from 1ms to 20ms, and some have no delay. They all loop forever except rtc, which times out after 10 retries, and that uses 10ms delays. So use 10ms as our standard delay. The OPAL maintainer agrees 10ms is a reasonable starting point.
The idea is to use the same recipe everywhere, once this is proven to work then it will be documented as an OPAL API standard. Then both firmware and OS can agree, and if a particular call needs something else, then that can be documented with reasoning.
This is not the end-all of this effort, it's just a relatively easy change that fixes some existing high latency delays. There should be provision for standardising timeouts and/or interruptible loops where possible, so non-fatal firmware errors don't cause hangs.
--- arch/powerpc/include/asm/opal.h | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/include/asm/opal.h +3 -0
@@ -707,6 +707,9 @@ typedef struct oppanel_line {uint64_t line_len; } oppanel_line_t; +/* Default time to sleep or delay between OPAL_BUSY/OPAL_BUSY_EVENT loops */ +#define OPAL_BUSY_DELAY_MS 10 +/* /sys/firmware/opal */ extern struct kobject *opal_kobj;
PATCH 133/366 powerpc/powernv: Fix OPAL NVRAM driver OPAL_BUSY loops
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Piggin <[email protected]>
commit 3b8070335f751aac9f1526ae2e012e6f5b8b0f21 upstream.
The OPAL NVRAM driver does not sleep in case it gets OPAL_BUSY or OPAL_BUSY_EVENT from firmware, which causes large scheduling latencies, and various lockup errors to trigger (again, BMC reboot can cause it).
Fix this by converting it to the standard form OPAL_BUSY loop that sleeps.
Depends-on: 34dd25de9fe3 ("powerpc/powernv: define a standard delay for OPAL_BUSY type retry loops")
--- arch/powerpc/platforms/powernv/opal-nvram.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/platforms/powernv/opal-nvram.c +6 -1
@@ -11,6 +11,7 @@#define DEBUG +#include <linux/delay.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/of.h>
@@ -55,8 +56,12 @@ static ssize_t opal_nvram_write(char *buwhile (rc ==OPAL_BUSY || rc ==OPAL_BUSY_EVENT ) { rc =opal_write_nvram (__pa (buf), count, off); -if (rc ==OPAL_BUSY_EVENT ) +if (rc ==OPAL_BUSY_EVENT ) { +msleep (OPAL_BUSY_DELAY_MS );opal_poll_events (NULL ); + }else if (rc ==OPAL_BUSY ) { +msleep (OPAL_BUSY_DELAY_MS ); + } }if (rc)
PATCH 134/366 fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Danilo Krummrich <[email protected]>
commit a0b0d1c345d0317efe594df268feb5ccc99f651e upstream.
proc_sys_link_fill_cache() does not take currently unregistering sysctl tables into account, which might result into a page fault in sysctl_follow_link() - add a check to fix it.
This bug has been present since v3.4.
--- fs/proc/proc_sysctl.c | 3 +++ 1 file changed, 3 insertions(+)
fs/proc/proc_sysctl.c +3 -0
@@ -654,7 +654,10 @@ static bool proc_sys_link_fill_cache(str struct ctl_table *table) {bool ret = true; + head =sysctl_head_grab (head); +if (IS_ERR (head)) +return false;if (S_ISLNK (table->mode)) {/* It is not an error if we can not follow the link ignore it */
PATCH 135/366 fs/reiserfs/journal.c: add missing resierfs_warning() arg
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Morton <[email protected]>
commit 9ad553abe66f8be3f4755e9fa0a6ba137ce76341 upstream.
One use of the reiserfs_warning() macro in journal_init_dev() is missing a parameter, causing the following warning:
REISERFS warning (device loop0): journal_init_dev: Cannot open '%s': %i journal_init_dev:
This also causes a WARN_ONCE() warning in the vsprintf code, and then a panic if panic_on_warn is set.
Please remove unsupported %/ in format string
WARNING: CPU: 1 PID: 4480 at lib/vsprintf.c:2138 format_decode+0x77f/0x830 lib/vsprintf.c:2138 Kernel panic - not syncing: panic_on_warn set ...
Just add another string argument to the macro invocation.
Addresses https://syzkaller.appspot.com/bug?id=0627d4551fdc39bf1ef5d82cd9eef587047f7718
--- fs/reiserfs/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/reiserfs/journal.c +1 -1
@@ -2641,7 +2641,7 @@ static int journal_init_dev(struct superif (IS_ERR (journal->j_dev_bd)) { result =PTR_ERR (journal->j_dev_bd); journal->j_dev_bd =NULL ; -reiserfs_warning (super, +reiserfs_warning (super,"sh-457" ,"journal_init_dev: Cannot open '%s': %i" , jdev_name, result);return result;
PATCH 136/366 drm/radeon: make MacBook Pro d3_delay quirk more generic
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 5938628c51a711ae2169d68b2e3a4f7d93d4dbea upstream.
The PCI Power Management Spec, r1.2, sec 5.6.1, requires a 10 millisecond delay when powering on a device, i.e., transitioning from state D3hot to D0.
Apparently some devices require more time, and d1f9809ed131 ("drm/radeon:
add quirk for d3 delay during switcheroo poweron for apple macbooks") added an additional delay for the Radeon device in a MacBook Pro. 4807c5a8a0c8 ("drm/radeon: add a PX quirk list") made the affected device more explicit.
Add a generic PCI quirk to increase the d3_delay. This means we will use the additional delay for *all* wakeups from D3, not just those initiated by radeon_switcheroo_set_state().
--- drivers/gpu/drm/radeon/radeon_device.c | 11 ----------- drivers/pci/quirks.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/radeon/radeon_device.c +0 -11
@@ -105,7 +105,6 @@ static const char radeon_family_name[][1 };#define RADEON_PX_QUIRK_DISABLE_PX (1 << 0) -#define RADEON_PX_QUIRK_LONG_WAKEUP (1 << 1)struct radeon_px_quirk {u32 chip_vendor;
@@ -132,8 +131,6 @@ static struct radeon_px_quirk radeon_px_* https://bugs.freedesktop.org/show_bug.cgi?id=101491 */ { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, -/* macbook pro 8.2 */ - { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, { 0, 0, 0, 0, 0 }, };
@@ -1180,25 +1177,17 @@ static void radeon_check_arguments(strucstatic void radeon_switcheroo_set_state (struct pci_dev *pdev,enum vga_switcheroo_state state) {struct drm_device *dev =pci_get_drvdata (pdev); -struct radeon_device *rdev = dev->dev_private;if (radeon_is_px (dev) && state ==VGA_SWITCHEROO_OFF )return ;if (state ==VGA_SWITCHEROO_ON ) { -unsigned d3_delay = dev->pdev->d3_delay; -printk (KERN_INFO "radeon: switched on\n" );/* don't suspend or resume card normally */ dev->switch_power_state =DRM_SWITCH_POWER_CHANGING ; -if (d3_delay <20 && (rdev->px_quirk_flags &RADEON_PX_QUIRK_LONG_WAKEUP )) - dev->pdev->d3_delay =20 ; -radeon_resume_kms (dev, true, true); - dev->pdev->d3_delay = d3_delay; - dev->switch_power_state =DRM_SWITCH_POWER_ON ;drm_kms_helper_poll_enable (dev); }else {
drivers/pci/quirks.c +13 -0
@@ -1648,6 +1648,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INDECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260a , quirk_intel_pcie_pm);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_INTEL ,0x260b , quirk_intel_pcie_pm); +static void quirk_radeon_pm (struct pci_dev *dev) +{ +if (dev->subsystem_vendor ==PCI_VENDOR_ID_APPLE && + dev->subsystem_device ==0x00e2 ) { +if (dev->d3_delay <20 ) { + dev->d3_delay =20 ; +dev_info (&dev->dev,"extending delay after power-on from D3 to %d msec\n" , + dev->d3_delay); + } + } +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x6741 , quirk_radeon_pm); +#ifdef CONFIG_X86_IO_APIC static int dmi_disable_ioapicreroute (const struct dmi_system_id *d) {
PATCH 137/366 drm/radeon: add PX quirk for Asus K73TK
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nico Sneck <[email protected]>
commit b1550359d1eb392ee54f7cf47cffcfe0a602f6a7 upstream.
With this the dGPU turns on correctly.
--- drivers/gpu/drm/radeon/radeon_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +4 -0
@@ -131,6 +131,10 @@ static struct radeon_px_quirk radeon_px_* https://bugs.freedesktop.org/show_bug.cgi?id=101491 */ { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, +/* Asus K73TK laptop with AMD A6-3420M APU and Radeon 7670m GPU +* https://bugzilla.kernel.org/show_bug.cgi?id=51381#c52 +*/ + { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2123, RADEON_PX_QUIRK_DISABLE_PX }, { 0, 0, 0, 0, 0 }, };
PATCH 138/366 l2tp: fix races in tunnel creation
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 6b9f34239b00e6956a267abed2bc559ede556ad6 upstream.
l2tp_tunnel_create() inserts the new tunnel into the namespace's tunnel list and sets the socket's ->sk_user_data field, before returning it to the caller. Therefore, there are two ways the tunnel can be accessed and freed, before the caller even had the opportunity to take a reference. In practice, syzbot could crash the module by closing the socket right after a new tunnel was returned to pppol2tp_create().
This patch moves tunnel registration out of l2tp_tunnel_create(), so that the caller can safely hold a reference before publishing the tunnel. This second step is done with the new l2tp_tunnel_register() function, which is now responsible for associating the tunnel to its socket and for inserting it into the namespace's list.
While moving the code to l2tp_tunnel_register(), a few modifications have been done. First, the socket validation tests are done in a helper function, for clarity. Also, modifying the socket is now done after having inserted the tunnel to the namespace's tunnels list. This will allow insertion to fail, without having to revert theses modifications in the error path (a followup patch will check for duplicate tunnels before insertion). Either the socket is a kernel socket which we control, or it is a user-space socket for which we have a reference on the file descriptor. In any case, the socket isn't going to be closed from under us.
[bwh: Backported to 3.16:
- Socket setup is open-coded rather than using setup_udp_tunnel_sock()
- l2tp_nl_cmd_tunnel_create() doesn't call l2tp_tunnel_notify()
--- net/l2tp/l2tp_core.c | 192 ++++++++++++++++++---------------------- net/l2tp/l2tp_core.h | 3 + net/l2tp/l2tp_netlink.c | 16 +++- net/l2tp/l2tp_ppp.c | 9 ++ 4 files changed, 110 insertions(+), 110 deletions(-)
net/l2tp/l2tp_core.c +82 -105
@@ -1560,74 +1560,11 @@ int l2tp_tunnel_create(struct net *net, {struct l2tp_tunnel *tunnel =NULL ;int err; -struct socket *sock =NULL ; -struct sock *sk =NULL ; -struct l2tp_net *pn;enum l2tp_encap_type encap =L2TP_ENCAPTYPE_UDP ; -/* Get the tunnel socket from the fd, which was opened by -* the userspace L2TP daemon. If not specified, create a -* kernel socket. -*/ -if (fd <0 ) { - err =l2tp_tunnel_sock_create (net, tunnel_id, peer_tunnel_id, - cfg, &sock); -if (err <0 ) - goto err; - }else { - sock =sockfd_lookup (fd, &err); -if (!sock) { -pr_err ("tunl %u: sockfd_lookup(fd=%d) returned %d\n" , - tunnel_id, fd, err); - err = -EBADF ; - goto err; - } - -/* Reject namespace mismatches */ -if (!net_eq (sock_net (sock->sk), net)) { -pr_err ("tunl %u: netns mismatch\n" , tunnel_id); - err = -EINVAL ; - goto err; - } - } - - sk = sock->sk; -if (cfg !=NULL ) encap = cfg->encap; -/* Quick sanity checks */ - err = -EPROTONOSUPPORT ; -if (sk->sk_type !=SOCK_DGRAM ) { -pr_debug ("tunl %hu: fd %d wrong socket type\n" , - tunnel_id, fd); - goto err; - } -switch (encap) { -case L2TP_ENCAPTYPE_UDP : -if (sk->sk_protocol !=IPPROTO_UDP ) { -pr_err ("tunl %hu: fd %d wrong protocol, got %d, expected %d\n" , - tunnel_id, fd, sk->sk_protocol,IPPROTO_UDP ); - goto err; - } -break ; -case L2TP_ENCAPTYPE_IP : -if (sk->sk_protocol !=IPPROTO_L2TP ) { -pr_err ("tunl %hu: fd %d wrong protocol, got %d, expected %d\n" , - tunnel_id, fd, sk->sk_protocol,IPPROTO_L2TP ); - goto err; - } -break ; - } - -/* Check if this socket has already been prepped */ - tunnel =l2tp_tunnel (sk); -if (tunnel !=NULL ) { -/* This socket has already been prepped */ - err = -EBUSY ; - goto err; - } - tunnel =kzalloc (sizeof (struct l2tp_tunnel ),GFP_KERNEL );if (tunnel ==NULL ) { err = -ENOMEM ;
@@ -1644,17 +1581,83 @@ int l2tp_tunnel_create(struct net *net,rwlock_init (&tunnel->hlist_lock); tunnel->acpt_newsess = true; -/* The net we belong to */ - tunnel->l2tp_net = net; - pn =l2tp_pernet (net); -if (cfg !=NULL ) tunnel->debug = cfg->debug; -/* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ tunnel->encap = encap; -if (encap ==L2TP_ENCAPTYPE_UDP ) { -/* Mark socket as an encapsulation socket. See net/ipv4/udp.c */ + +atomic_set (&tunnel->ref_count,1 ); + tunnel->fd = fd; + +/* Init delete workqueue struct */ +INIT_WORK (&tunnel->del_work, l2tp_tunnel_del_work); + +INIT_LIST_HEAD (&tunnel->list); + + err =0 ; +err: +if (tunnelp) + *tunnelp = tunnel; + +return err; +} +EXPORT_SYMBOL_GPL (l2tp_tunnel_create); + +static int l2tp_validate_socket (const struct sock *sk,const struct net *net, +enum l2tp_encap_type encap) +{ +if (!net_eq (sock_net (sk), net)) +return -EINVAL ; + +if (sk->sk_type !=SOCK_DGRAM ) +return -EPROTONOSUPPORT ; + +if ((encap ==L2TP_ENCAPTYPE_UDP && sk->sk_protocol !=IPPROTO_UDP ) || + (encap ==L2TP_ENCAPTYPE_IP && sk->sk_protocol !=IPPROTO_L2TP )) +return -EPROTONOSUPPORT ; + +if (sk->sk_user_data) +return -EBUSY ; + +return 0 ; +} + +int l2tp_tunnel_register (struct l2tp_tunnel *tunnel,struct net *net, +struct l2tp_tunnel_cfg *cfg) +{ +struct l2tp_net *pn; +struct socket *sock; +struct sock *sk; +int ret; + +if (tunnel->fd <0 ) { + ret =l2tp_tunnel_sock_create (net, tunnel->tunnel_id, + tunnel->peer_tunnel_id, cfg, + &sock); +if (ret <0 ) + goto err; + }else { + sock =sockfd_lookup (tunnel->fd, &ret); +if (!sock) + goto err; + + ret =l2tp_validate_socket (sock->sk, net, tunnel->encap); +if (ret <0 ) + goto err_sock; + } + + sk = sock->sk; + +sock_hold (sk); + tunnel->sock = sk; + tunnel->l2tp_net = net; + + pn =l2tp_pernet (net); +spin_lock_bh (&pn->l2tp_tunnel_list_lock); +list_add_rcu (&tunnel->list, &pn->l2tp_tunnel_list); +spin_unlock_bh (&pn->l2tp_tunnel_list_lock); + +if (tunnel->encap ==L2TP_ENCAPTYPE_UDP ) {udp_sk (sk)->encap_type =UDP_ENCAP_L2TPINUDP ;udp_sk (sk)->encap_rcv = l2tp_udp_encap_recv;udp_sk (sk)->encap_destroy = l2tp_udp_encap_destroy;
@@ -1668,49 +1671,23 @@ int l2tp_tunnel_create(struct net *net, sk->sk_user_data = tunnel; -/* Bump the reference count. The tunnel context is deleted -* only when this drops to zero. A reference is also held on -* the tunnel socket to ensure that it is not released while -* the tunnel is extant. Must be done before sk_destruct is -* set. -*/ -atomic_set (&tunnel->ref_count,1 ); -sock_hold (sk); - tunnel->sock = sk; - tunnel->fd = fd; - -/* Hook on the tunnel socket destructor so that we can cleanup -* if the tunnel socket goes away. -*/ tunnel->old_sk_destruct = sk->sk_destruct; sk->sk_destruct = &l2tp_tunnel_destruct; -lockdep_set_class_and_name (&sk->sk_lock.slock, &l2tp_socket_class,"l2tp_sock" ); - +lockdep_set_class_and_name (&sk->sk_lock.slock, &l2tp_socket_class, +"l2tp_sock" ); sk->sk_allocation =GFP_ATOMIC ; -/* Init delete workqueue struct */ -INIT_WORK (&tunnel->del_work, l2tp_tunnel_del_work); +if (tunnel->fd >=0 ) +sockfd_put (sock); -/* Add tunnel to our list */ -INIT_LIST_HEAD (&tunnel->list); -spin_lock_bh (&pn->l2tp_tunnel_list_lock); -list_add_rcu (&tunnel->list, &pn->l2tp_tunnel_list); -spin_unlock_bh (&pn->l2tp_tunnel_list_lock); +return 0 ; - err =0 ; +err_sock: +sockfd_put (sock); err: -if (tunnelp) - *tunnelp = tunnel; - -/* If tunnel's socket was created by the kernel, it doesn't -* have a file. -*/ -if (sock && sock->file) -sockfd_put (sock); - -return err; +return ret; } -EXPORT_SYMBOL_GPL (l2tp_tunnel_create); +EXPORT_SYMBOL_GPL (l2tp_tunnel_register);/* This function is used by the netlink TUNNEL_DELETE command. */
net/l2tp/l2tp_core.h +3 -0
@@ -246,6 +246,9 @@ struct l2tp_tunnel *l2tp_tunnel_find_nthint l2tp_tunnel_create (struct net *net,int fd,int version,u32 tunnel_id,u32 peer_tunnel_id,struct l2tp_tunnel_cfg *cfg,struct l2tp_tunnel **tunnelp); +int l2tp_tunnel_register (struct l2tp_tunnel *tunnel,struct net *net, +struct l2tp_tunnel_cfg *cfg); +void l2tp_tunnel_closeall (struct l2tp_tunnel *tunnel);void l2tp_tunnel_delete (struct l2tp_tunnel *tunnel); struct l2tp_session *l2tp_session_create(int priv_size,
net/l2tp/l2tp_netlink.c +11 -0
@@ -192,6 +192,17 @@ static int l2tp_nl_cmd_tunnel_create(strbreak ; } +if (ret <0 ) + goto out; + +l2tp_tunnel_inc_refcount (tunnel); + ret =l2tp_tunnel_register (tunnel, net, &cfg); +if (ret <0 ) { +kfree (tunnel); + goto out; + } +l2tp_tunnel_dec_refcount (tunnel); + out:return ret; }
net/l2tp/l2tp_ppp.c +9 -0
@@ -720,6 +720,15 @@ static int pppol2tp_connect(struct socke error =l2tp_tunnel_create (sock_net (sk), fd, ver, tunnel_id, peer_tunnel_id, &tcfg, &tunnel);if (error <0 ) goto end; + +l2tp_tunnel_inc_refcount (tunnel); + error =l2tp_tunnel_register (tunnel,sock_net (sk), + &tcfg); +if (error <0 ) { +kfree (tunnel); + goto end; + } + drop_tunnel = true; } }else {/* Error if we can't find the tunnel */
PATCH 139/366 l2tp: fix race in duplicate tunnel detection
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit f6cd651b056ffd3b4e8496afd44d4ed44bf69136 upstream.
We can't use l2tp_tunnel_find() to prevent l2tp_nl_cmd_tunnel_create() from creating a duplicate tunnel. A tunnel can be concurrently registered after l2tp_tunnel_find() returns. Therefore, searching for duplicates must be done at registration time.
Finally, remove l2tp_tunnel_find() entirely as it isn't use anywhere anymore.
--- net/l2tp/l2tp_core.c | 35 ++++++++++++++--------------------- net/l2tp/l2tp_core.h | 1 - net/l2tp/l2tp_netlink.c | 6 ------ 3 files changed, 14 insertions(+), 28 deletions(-)
net/l2tp/l2tp_core.c +14 -21
@@ -395,26 +395,6 @@ err_tlock: }EXPORT_SYMBOL_GPL (l2tp_session_register); -/* Lookup a tunnel by id -*/ -struct l2tp_tunnel *l2tp_tunnel_find (struct net *net,u32 tunnel_id) -{ -struct l2tp_tunnel *tunnel; -struct l2tp_net *pn =l2tp_pernet (net); - -rcu_read_lock_bh (); -list_for_each_entry_rcu (tunnel, &pn->l2tp_tunnel_list, list) { -if (tunnel->tunnel_id == tunnel_id) { -rcu_read_unlock_bh (); -return tunnel; - } - } -rcu_read_unlock_bh (); - -return NULL ; -} -EXPORT_SYMBOL_GPL (l2tp_tunnel_find); -struct l2tp_tunnel *l2tp_tunnel_find_nth (struct net *net,int nth) {struct l2tp_net *pn =l2tp_pernet (net);
@@ -1625,6 +1605,7 @@ static int l2tp_validate_socket(const stint l2tp_tunnel_register (struct l2tp_tunnel *tunnel,struct net *net,struct l2tp_tunnel_cfg *cfg) { +struct l2tp_tunnel *tunnel_walk;struct l2tp_net *pn;struct socket *sock;struct sock *sk;
@@ -1653,7 +1634,16 @@ int l2tp_tunnel_register(struct l2tp_tun tunnel->l2tp_net = net; pn =l2tp_pernet (net); +spin_lock_bh (&pn->l2tp_tunnel_list_lock); +list_for_each_entry (tunnel_walk, &pn->l2tp_tunnel_list, list) { +if (tunnel_walk->tunnel_id == tunnel->tunnel_id) { +spin_unlock_bh (&pn->l2tp_tunnel_list_lock); + + ret = -EEXIST ; + goto err_sock; + } + }list_add_rcu (&tunnel->list, &pn->l2tp_tunnel_list);spin_unlock_bh (&pn->l2tp_tunnel_list_lock);
@@ -1683,7 +1673,10 @@ int l2tp_tunnel_register(struct l2tp_tunreturn 0 ; err_sock: -sockfd_put (sock); +if (tunnel->fd <0 ) +sock_release (sock); +else +sockfd_put (sock); err:return ret; }
net/l2tp/l2tp_core.h +0 -1
@@ -240,7 +240,6 @@ struct l2tp_session *l2tp_session_get_ntstruct l2tp_session *l2tp_session_get_by_ifname (const struct net *net,const char *ifname,bool do_ref); -struct l2tp_tunnel *l2tp_tunnel_find (struct net *net,u32 tunnel_id);struct l2tp_tunnel *l2tp_tunnel_find_nth (struct net *net,int nth); int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id,
net/l2tp/l2tp_netlink.c +0 -6
@@ -177,12 +177,6 @@ static int l2tp_nl_cmd_tunnel_create(strif (info->attrs[L2TP_ATTR_DEBUG ]) cfg.debug =nla_get_u32 (info->attrs[L2TP_ATTR_DEBUG ]); - tunnel =l2tp_tunnel_find (net, tunnel_id); -if (tunnel !=NULL ) { - ret = -EEXIST ; - goto out; - } - ret = -EINVAL ;switch (cfg.encap) {case L2TP_ENCAPTYPE_UDP :
PATCH 140/366 ALSA: line6: Use correct endpoint type for midi output
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Fabián Inostroza <[email protected]>
commit 7ecb46e9ee9af18e304eb9e7d6804c59a408e846 upstream.
Sending MIDI messages to a PODxt through the USB connection shows "usb_submit_urb failed" in dmesg and the message is not received by the POD.
The error is caused because in the funcion send_midi_async() in midi.c there is a call to usb_sndbulkpipe() for endpoint 3 OUT, but the PODxt USB descriptor shows that this endpoint it's an interrupt endpoint.
Patch tested with PODxt only.
[ The bug has been present from the very beginning in the staging
driver time, but Fixes below points to the commit moving to sound/ directory so that the fix can be cleanly applied -- tiwai ]
--- drivers/staging/line6/midi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/line6/midi.c +1 -1
@@ -135,7 +135,7 @@ static int send_midi_async(struct usb_li }usb_fill_int_urb (urb, line6->usbdev, -usb_sndbulkpipe (line6->usbdev, +usb_sndintpipe (line6->usbdev, line6->ep_control_write), transfer_buffer, length, midi_sent, line6, line6->interval);
PATCH 141/366 ASoC: fsl_esai: Fix divisor calculation failure at lower ratio
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit c656941df9bc80f7ec65b92ca73c42f8b0b62628 upstream.
When the desired ratio is less than 256, the savesub (tolerance) in the calculation would become 0. This will then fail the loop- search immediately without reporting any errors.
But if the ratio is smaller enough, there is no need to calculate the tolerance because PM divisor alone is enough to get the ratio.
So a simple fix could be just to set PM directly instead of going into the loop-search.
--- sound/soc/fsl/fsl_esai.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/fsl/fsl_esai.c +7 -0
@@ -142,6 +142,13 @@ static int fsl_esai_divisor_cal(struct s psr = ratio <=256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; +/* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */ +if (ratio <=256 ) { + pm = ratio; + fp =1 ; + goto out; + } +/* Set the max fluctuation -- 0.1% of the max devisor */ savesub = (psr ?1 :8 ) *256 * maxfp /1000 ;
PATCH 142/366 tcp: md5: reject TCP_MD5SIG or TCP_MD5SIG_EXT on established sockets
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 7212303268918b9a203aebeacfdbd83b5e87b20d upstream.
syzbot/KMSAN reported an uninit-value in tcp_parse_options() [1]
I believe this was caused by a TCP_MD5SIG being set on live flow.
This is highly unexpected, since TCP option space is limited.
For instance, presence of TCP MD5 option automatically disables TCP TimeStamp option at SYN/SYNACK time, which we can not do once flow has been established.
Really, adding/deleting an MD5 key only makes sense on sockets in CLOSE or LISTEN state.
[1]
BUG: KMSAN: uninit-value in tcp_parse_options+0xd74/0x1a30 net/ipv4/tcp_input.c:3720 CPU: 1 PID: 6177 Comm: syzkaller192004 Not tainted 4.16.0+ #83 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:53 kmsan_report+0x142/0x240 mm/kmsan/kmsan.c:1067 __msan_warning_32+0x6c/0xb0 mm/kmsan/kmsan_instr.c:676 tcp_parse_options+0xd74/0x1a30 net/ipv4/tcp_input.c:3720 tcp_fast_parse_options net/ipv4/tcp_input.c:3858 [inline] tcp_validate_incoming+0x4f1/0x2790 net/ipv4/tcp_input.c:5184 tcp_rcv_established+0xf60/0x2bb0 net/ipv4/tcp_input.c:5453 tcp_v4_do_rcv+0x6cd/0xd90 net/ipv4/tcp_ipv4.c:1469 sk_backlog_rcv include/net/sock.h:908 [inline] __release_sock+0x2d6/0x680 net/core/sock.c:2271 release_sock+0x97/0x2a0 net/core/sock.c:2786 tcp_sendmsg+0xd6/0x100 net/ipv4/tcp.c:1464 inet_sendmsg+0x48d/0x740 net/ipv4/af_inet.c:764 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] SYSC_sendto+0x6c3/0x7e0 net/socket.c:1747 SyS_sendto+0x8a/0xb0 net/socket.c:1715 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x448fe9 RSP: 002b:00007fd472c64d38 EFLAGS: 00000216 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00000000006e5a30 RCX: 0000000000448fe9 RDX: 000000000000029f RSI: 0000000020a88f88 RDI: 0000000000000004 RBP: 00000000006e5a34 R08: 0000000020e68000 R09: 0000000000000010 R10: 00000000200007fd R11: 0000000000000216 R12: 0000000000000000 R13: 00007fff074899ef R14: 00007fd472c659c0 R15: 0000000000000009
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:278 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:188 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:314 kmsan_slab_alloc+0x11/0x20 mm/kmsan/kmsan.c:321 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2737 [inline] __kmalloc_node_track_caller+0xaed/0x11c0 mm/slub.c:4369 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cf/0x9f0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:984 [inline] tcp_send_ack+0x18c/0x910 net/ipv4/tcp_output.c:3624 __tcp_ack_snd_check net/ipv4/tcp_input.c:5040 [inline] tcp_ack_snd_check net/ipv4/tcp_input.c:5053 [inline] tcp_rcv_established+0x2103/0x2bb0 net/ipv4/tcp_input.c:5469 tcp_v4_do_rcv+0x6cd/0xd90 net/ipv4/tcp_ipv4.c:1469 sk_backlog_rcv include/net/sock.h:908 [inline] __release_sock+0x2d6/0x680 net/core/sock.c:2271 release_sock+0x97/0x2a0 net/core/sock.c:2786 tcp_sendmsg+0xd6/0x100 net/ipv4/tcp.c:1464 inet_sendmsg+0x48d/0x740 net/ipv4/af_inet.c:764 sock_sendmsg_nosec net/socket.c:630 [inline] sock_sendmsg net/socket.c:640 [inline] SYSC_sendto+0x6c3/0x7e0 net/socket.c:1747 SyS_sendto+0x8a/0xb0 net/socket.c:1715 do_syscall_64+0x309/0x430 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
--- net/ipv4/tcp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +4 -2
@@ -2683,8 +2683,10 @@ static int do_tcp_setsockopt(struct sock#ifdef CONFIG_TCP_MD5SIG case TCP_MD5SIG : -/* Read the IP->Key mappings from userspace */ - err = tp->af_specific->md5_parse (sk, optval, optlen); +if ((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN )) + err = tp->af_specific->md5_parse (sk, optval, optlen); +else + err = -EINVAL ;break ;#endif case TCP_USER_TIMEOUT :
PATCH 143/366 sctp: do not check port in sctp_inet6_cmp_addr
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
commit 1071ec9d453a38023579714b64a951a2fb982071 upstream.
pf->cmp_addr() is called before binding a v6 address to the sock. It should not check ports, like in sctp_inet_cmp_addr.
But sctp_inet6_cmp_addr checks the addr by invoking af(6)->cmp_addr, sctp_v6_cmp_addr where it also compares the ports.
This would cause that setsockopt(SCTP_SOCKOPT_BINDX_ADD) could bind multiple duplicated IPv6 addresses after Commit 40b4f0fd74e4 ("sctp:
lack the check for ports in sctp_v6_cmp_addr").
This patch is to remove af->cmp_addr called in sctp_inet6_cmp_addr, but do the proper check for both v6 addrs and v4mapped addrs.
v1->v2:
- define __sctp_v6_cmp_addr to do the common address comparison used for both pf and af v6 cmp_addr.
--- net/sctp/ipv6.c | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
net/sctp/ipv6.c +30 -30
@@ -496,46 +496,49 @@ static void sctp_v6_to_addr(union sctp_a addr->v6.sin6_scope_id =0 ; } -/* Compare addresses exactly. -* v4-mapped-v6 is also in consideration. -*/ -static int sctp_v6_cmp_addr (const union sctp_addr *addr1, -const union sctp_addr *addr2) +static int __sctp_v6_cmp_addr (const union sctp_addr *addr1, +const union sctp_addr *addr2) {if (addr1->sa.sa_family != addr2->sa.sa_family) {if (addr1->sa.sa_family ==AF_INET && addr2->sa.sa_family ==AF_INET6 && -ipv6_addr_v4mapped (&addr2->v6.sin6_addr)) { -if (addr2->v6.sin6_port == addr1->v4.sin_port && - addr2->v6.sin6_addr.s6_addr32[3 ] == - addr1->v4.sin_addr.s_addr) -return 1 ; - } +ipv6_addr_v4mapped (&addr2->v6.sin6_addr) && + addr2->v6.sin6_addr.s6_addr32[3 ] == + addr1->v4.sin_addr.s_addr) +return 1 ; +if (addr2->sa.sa_family ==AF_INET && addr1->sa.sa_family ==AF_INET6 && -ipv6_addr_v4mapped (&addr1->v6.sin6_addr)) { -if (addr1->v6.sin6_port == addr2->v4.sin_port && - addr1->v6.sin6_addr.s6_addr32[3 ] == - addr2->v4.sin_addr.s_addr) -return 1 ; - } +ipv6_addr_v4mapped (&addr1->v6.sin6_addr) && + addr1->v6.sin6_addr.s6_addr32[3 ] == + addr2->v4.sin_addr.s_addr) +return 1 ; +return 0 ; } -if (addr1->v6.sin6_port != addr2->v6.sin6_port) -return 0 ; +if (!ipv6_addr_equal (&addr1->v6.sin6_addr, &addr2->v6.sin6_addr))return 0 ; +/* If this is a linklocal address, compare the scope_id. */ -if (ipv6_addr_type (&addr1->v6.sin6_addr) &IPV6_ADDR_LINKLOCAL ) { -if (addr1->v6.sin6_scope_id && addr2->v6.sin6_scope_id && - (addr1->v6.sin6_scope_id != addr2->v6.sin6_scope_id)) { -return 0 ; - } - } +if ((ipv6_addr_type (&addr1->v6.sin6_addr) &IPV6_ADDR_LINKLOCAL ) && + addr1->v6.sin6_scope_id && addr2->v6.sin6_scope_id && + addr1->v6.sin6_scope_id != addr2->v6.sin6_scope_id) +return 0 ;return 1 ; } +/* Compare addresses exactly. +* v4-mapped-v6 is also in consideration. +*/ +static int sctp_v6_cmp_addr (const union sctp_addr *addr1, +const union sctp_addr *addr2) +{ +return __sctp_v6_cmp_addr (addr1, addr2) && + addr1->v6.sin6_port == addr2->v6.sin6_port; +} +/* Initialize addr struct to INADDR_ANY. */ static void sctp_v6_inaddr_any (union sctp_addr *addr,__be16 port) {
@@ -820,8 +823,8 @@ static int sctp_inet6_cmp_addr(const uniconst union sctp_addr *addr2, struct sctp_sock *opt) { - struct sctp_af *af1, *af2; struct sock *sk = sctp_opt2sk(opt); +struct sctp_af *af1, *af2; af1 =sctp_get_af_specific (addr1->sa.sa_family); af2 =sctp_get_af_specific (addr2->sa.sa_family);
@@ -837,10 +840,7 @@ static int sctp_inet6_cmp_addr(const uniif (sctp_is_any (sk, addr1) ||sctp_is_any (sk, addr2))return 1 ; -if (addr1->sa.sa_family != addr2->sa.sa_family) -return 0 ; - -return af1->cmp_addr (addr1, addr2); +return __sctp_v6_cmp_addr (addr1, addr2); }/* Verify that the provided sockaddr looks bindable. Common verification,
PATCH 144/366 net: fix deadlock while clearing neighbor proxy table
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wolfgang Bumiller <[email protected]>
commit 53b76cdf7e8fecec1d09e38aad2f8579882591a8 upstream.
When coming from ndisc_netdev_event() in net/ipv6/ndisc.c, neigh_ifdown() is called with &nd_tbl, locking this while clearing the proxy neighbor entries when eg. deleting an interface. Calling the table's pndisc_destructor() with the lock still held, however, can cause a deadlock: When a multicast listener is available an IGMP packet of type ICMPV6_MGM_REDUCTION may be sent out. When reaching ip6_finish_output2(), if no neighbor entry for the target address is found, __neigh_create() is called with &nd_tbl, which it'll want to lock.
Move the elements into their own list, then unlock the table and perform the destruction.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199289
[bwh: Backported to 3.16:
- Move the (useless) call to release_net() as well
- Adjust context]
---
net/core/neighbour.c +19 -11
@@ -54,7 +54,8 @@ do { \static void neigh_timer_handler (unsigned long arg);static void __neigh_notify (struct neighbour *n,int type,int flags);static void neigh_update_notify (struct neighbour *neigh); -static int pneigh_ifdown (struct neigh_table *tbl,struct net_device *dev); +static int pneigh_ifdown_and_unlock (struct neigh_table *tbl, +struct net_device *dev);static struct neigh_table *neigh_tables;#ifdef CONFIG_PROC_FS
@@ -260,8 +261,7 @@ int neigh_ifdown(struct neigh_table *tbl {write_lock_bh (&tbl->lock);neigh_flush_dev (tbl, dev); -pneigh_ifdown (tbl, dev); -write_unlock_bh (&tbl->lock); +pneigh_ifdown_and_unlock (tbl, dev);del_timer_sync (&tbl->proxy_timer);pneigh_queue_purge (&tbl->proxy_queue);
@@ -659,9 +659,10 @@ int pneigh_delete(struct neigh_table *tbreturn -ENOENT ; } -static int pneigh_ifdown (struct neigh_table *tbl,struct net_device *dev) +static int pneigh_ifdown_and_unlock (struct neigh_table *tbl, +struct net_device *dev) { -struct pneigh_entry *n, **np; +struct pneigh_entry *n, **np, *freelist =NULL ;u32 h;for (h =0 ; h <=PNEIGH_HASHMASK ; h++) {
@@ -669,17 +670,24 @@ static int pneigh_ifdown(struct neigh_tawhile ((n = *np) !=NULL ) {if (!dev || n->dev == dev) { *np = n->next; -if (tbl->pdestructor) - tbl->pdestructor (n); -if (n->dev) -dev_put (n->dev); -release_net (pneigh_net (n)); -kfree (n); + n->next = freelist; + freelist = n;continue ; } np = &n->next; } } +write_unlock_bh (&tbl->lock); +while ((n = freelist)) { + freelist = n->next; + n->next =NULL ; +if (tbl->pdestructor) + tbl->pdestructor (n); +if (n->dev) +dev_put (n->dev); +release_net (pneigh_net (n)); +kfree (n); + }return -ENOENT ; }
PATCH 145/366 l2tp: hold reference on tunnels in netlink dumps
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 5846c131c39b6d0add36ec19dc8650700690f930 upstream.
l2tp_tunnel_find_nth() is unsafe: no reference is held on the returned tunnel, therefore it can be freed whenever the caller uses it. This patch defines l2tp_tunnel_get_nth() which works similarly, but also takes a reference on the returned tunnel. The caller then has to drop it after it stops using the tunnel.
Convert netlink dumps to make them safe against concurrent tunnel deletion.
--- net/l2tp/l2tp_core.c | 20 ++++++++++++++++++++ net/l2tp/l2tp_core.h | 2 ++ net/l2tp/l2tp_netlink.c | 11 ++++++++--- 3 files changed, 30 insertions(+), 3 deletions(-)
net/l2tp/l2tp_core.c +20 -0
@@ -231,6 +231,26 @@ struct l2tp_tunnel *l2tp_tunnel_get(cons }EXPORT_SYMBOL_GPL (l2tp_tunnel_get); +struct l2tp_tunnel *l2tp_tunnel_get_nth (const struct net *net,int nth) +{ +const struct l2tp_net *pn =l2tp_pernet (net); +struct l2tp_tunnel *tunnel; +int count =0 ; + +rcu_read_lock_bh (); +list_for_each_entry_rcu (tunnel, &pn->l2tp_tunnel_list, list) { +if (++count > nth) { +l2tp_tunnel_inc_refcount (tunnel); +rcu_read_unlock_bh (); +return tunnel; + } + } +rcu_read_unlock_bh (); + +return NULL ; +} +EXPORT_SYMBOL_GPL (l2tp_tunnel_get_nth); +/* Like l2tp_session_find() but takes a reference on the returned session. * Optionally calls session->ref() too if do_ref is true. */
net/l2tp/l2tp_core.h +2 -0
@@ -227,6 +227,8 @@ static inline void *l2tp_session_priv(st }struct l2tp_tunnel *l2tp_tunnel_get (const struct net *net,u32 tunnel_id); +struct l2tp_tunnel *l2tp_tunnel_get_nth (const struct net *net,int nth); +void l2tp_tunnel_free (struct l2tp_tunnel *tunnel); struct l2tp_session *l2tp_session_get(const struct net *net,
net/l2tp/l2tp_netlink.c +8 -3
@@ -395,14 +395,17 @@ static int l2tp_nl_cmd_tunnel_dump(strucstruct net *net =sock_net (skb->sk);for (;;) { - tunnel =l2tp_tunnel_find_nth (net, ti); + tunnel =l2tp_tunnel_get_nth (net, ti);if (tunnel ==NULL ) goto out;if (l2tp_nl_tunnel_send (skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq,NLM_F_MULTI , - tunnel) <=0 ) + tunnel) <=0 ) { +l2tp_tunnel_dec_refcount (tunnel); goto out; + } +l2tp_tunnel_dec_refcount (tunnel); ti++; }
@@ -746,7 +749,7 @@ static int l2tp_nl_cmd_session_dump(strufor (;;) {if (tunnel ==NULL ) { - tunnel =l2tp_tunnel_find_nth (net, ti); + tunnel =l2tp_tunnel_get_nth (net, ti);if (tunnel ==NULL ) goto out; }
@@ -754,6 +757,7 @@ static int l2tp_nl_cmd_session_dump(stru session =l2tp_session_get_nth (tunnel, si, false);if (session ==NULL ) { ti++; +l2tp_tunnel_dec_refcount (tunnel); tunnel =NULL ; si =0 ;continue ;
@@ -763,6 +767,7 @@ static int l2tp_nl_cmd_session_dump(stru cb->nlh->nlmsg_seq, NLM_F_MULTI, session) <= 0) {l2tp_session_dec_refcount (session); +l2tp_tunnel_dec_refcount (tunnel);break ; }l2tp_session_dec_refcount (session);
PATCH 146/366 l2tp: hold reference on tunnels printed in pppol2tp proc file
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 0e0c3fee3a59a387aeecc4fca6f3a2e9615a5443 upstream.
Use l2tp_tunnel_get_nth() instead of l2tp_tunnel_find_nth(), to be safe against concurrent tunnel deletion.
Unlike sessions, we can't drop the reference held on tunnels in pppol2tp_seq_show(). Tunnels are reused across several calls to pppol2tp_seq_start() when iterating over sessions. These iterations need the tunnel for accessing the next session. Therefore the only safe moment for dropping the reference is just before searching for the next tunnel.
Normally, the last invocation of pppol2tp_next_tunnel() doesn't find any new tunnel, so it drops the last tunnel without taking any new reference. However, in case of error, pppol2tp_seq_stop() is called directly, so we have to drop the reference there.
--- net/l2tp/l2tp_ppp.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
net/l2tp/l2tp_ppp.c +17 -7
@@ -1583,16 +1583,19 @@ struct pppol2tp_seq_data {static void pppol2tp_next_tunnel (struct net *net,struct pppol2tp_seq_data *pd) { +/* Drop reference taken during previous invocation */ +if (pd->tunnel) +l2tp_tunnel_dec_refcount (pd->tunnel); +for (;;) { - pd->tunnel =l2tp_tunnel_find_nth (net, pd->tunnel_idx); + pd->tunnel =l2tp_tunnel_get_nth (net, pd->tunnel_idx); pd->tunnel_idx++; -if (pd->tunnel ==NULL ) -break ; +/* Only accept L2TPv2 tunnels */ +if (!pd->tunnel || pd->tunnel->version ==2 ) +return ; -/* Ignore L2TPv3 tunnels */ -if (pd->tunnel->version <3 ) -break ; +l2tp_tunnel_dec_refcount (pd->tunnel); } }
@@ -1641,7 +1644,14 @@ static void *pppol2tp_seq_next(struct sestatic void pppol2tp_seq_stop (struct seq_file *p,void *v) { -/* nothing to do */ +struct pppol2tp_seq_data *pd = v; + +if (!pd || pd ==SEQ_START_TOKEN ) +return ; + +/* Drop reference taken by last invocation of pppol2tp_next_tunnel() */ +if (pd->tunnel) +l2tp_tunnel_dec_refcount (pd->tunnel); }static void pppol2tp_seq_tunnel_show (struct seq_file *m,void *v)
PATCH 147/366 l2tp: hold reference on tunnels printed in l2tp/tunnels debugfs file
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit f726214d9b23e5fce8c11937577a289a3202498f upstream.
Use l2tp_tunnel_get_nth() instead of l2tp_tunnel_find_nth(), to be safe against concurrent tunnel deletion.
Use the same mechanism as in l2tp_ppp.c for dropping the reference taken by l2tp_tunnel_get_nth(). That is, drop the reference just before looking up the next tunnel. In case of error, drop the last accessed tunnel in l2tp_dfs_seq_stop().
That was the last use of l2tp_tunnel_find_nth().
--- net/l2tp/l2tp_core.c | 20 -------------------- net/l2tp/l2tp_core.h | 1 - net/l2tp/l2tp_debugfs.c | 15 +++++++++++++-- 3 files changed, 13 insertions(+), 23 deletions(-)
net/l2tp/l2tp_core.c +0 -20
@@ -415,26 +415,6 @@ err_tlock: }EXPORT_SYMBOL_GPL (l2tp_session_register); -struct l2tp_tunnel *l2tp_tunnel_find_nth (struct net *net,int nth) -{ -struct l2tp_net *pn =l2tp_pernet (net); -struct l2tp_tunnel *tunnel; -int count =0 ; - -rcu_read_lock_bh (); -list_for_each_entry_rcu (tunnel, &pn->l2tp_tunnel_list, list) { -if (++count > nth) { -rcu_read_unlock_bh (); -return tunnel; - } - } - -rcu_read_unlock_bh (); - -return NULL ; -} -EXPORT_SYMBOL_GPL (l2tp_tunnel_find_nth); -/***************************************************************************** * Receive data handling *****************************************************************************/
net/l2tp/l2tp_core.h +0 -1
@@ -242,7 +242,6 @@ struct l2tp_session *l2tp_session_get_ntstruct l2tp_session *l2tp_session_get_by_ifname (const struct net *net,const char *ifname,bool do_ref); -struct l2tp_tunnel *l2tp_tunnel_find_nth (struct net *net,int nth); int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg,
net/l2tp/l2tp_debugfs.c +13 -2
@@ -47,7 +47,11 @@ struct l2tp_dfs_seq_data {static void l2tp_dfs_next_tunnel (struct l2tp_dfs_seq_data *pd) { - pd->tunnel =l2tp_tunnel_find_nth (pd->net, pd->tunnel_idx); +/* Drop reference taken during previous invocation */ +if (pd->tunnel) +l2tp_tunnel_dec_refcount (pd->tunnel); + + pd->tunnel =l2tp_tunnel_get_nth (pd->net, pd->tunnel_idx); pd->tunnel_idx++; }
@@ -96,7 +100,14 @@ static void *l2tp_dfs_seq_next(struct sestatic void l2tp_dfs_seq_stop (struct seq_file *p,void *v) { -/* nothing to do */ +struct l2tp_dfs_seq_data *pd = v; + +if (!pd || pd ==SEQ_START_TOKEN ) +return ; + +/* Drop reference taken by last invocation of l2tp_dfs_next_tunnel() */ +if (pd->tunnel) +l2tp_tunnel_dec_refcount (pd->tunnel); }static void l2tp_dfs_seq_tunnel_show (struct seq_file *m,void *v)
PATCH 148/366 resource: fix integer overflow at reallocation
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 60bb83b81169820c691fbfa33a6a4aef32aa4b0b upstream.
We've got a bug report indicating a kernel panic at booting on an x86-32 system, and it turned out to be the invalid PCI resource assigned after reallocation. __find_resource() first aligns the resource start address and resets the end address with start+size-1 accordingly, then checks whether it's contained. Here the end address may overflow the integer, although resource_contains() still returns true because the function validates only start and end address. So this ends up with returning an invalid resource (start > end).
There was already an attempt to cover such a problem in the commit 47ea91b4052d ("Resource: fix wrong resource window calculation"), but this case is an overseen one.
This patch adds the validity check of the newly calculated resource for avoiding the integer overflow problem.
Bugzilla: http://bugzilla.opensuse.org/show_bug.cgi?id=1086739
--- kernel/resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/resource.c +2 -1
@@ -474,7 +474,8 @@ static int __find_resource(struct resour alloc.start = constraint->alignf (constraint->alignf_data, &avail, size, constraint->align); alloc.end = alloc.start + size -1 ; -if (resource_contains (&avail, &alloc)) { +if (alloc.start <= alloc.end && +resource_contains (&avail, &alloc)) { new->start = alloc.start; new->end = alloc.end;return 0 ;
PATCH 149/366 hypfs_kill_super(): deal with failed allocations
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit a24cd490739586a7d2da3549a1844e1d7c4f4fc4 upstream.
hypfs_fill_super() might fail to allocate sbi; hypfs_kill_super() should not oops on that.
--- arch/s390/hypfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/hypfs/inode.c +1 -1
@@ -326,7 +326,7 @@ static void hypfs_kill_super(struct supeif (sb->s_root)hypfs_delete_tree (sb->s_root); -if (sb_info->update_file) +if (sb_info && sb_info->update_file)hypfs_remove (sb_info->update_file);kfree (sb->s_fs_info); sb->s_fs_info =NULL ;
PATCH 150/366 jffs2_kill_sb(): deal with failed allocations
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit c66b23c2840446a82c389e4cb1a12eb2a71fa2e4 upstream.
jffs2_fill_super() might fail to allocate jffs2_sb_info; jffs2_kill_sb() must survive that.
--- fs/jffs2/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jffs2/super.c +1 -1
@@ -345,7 +345,7 @@ static void jffs2_put_super (struct supestatic void jffs2_kill_sb (struct super_block *sb) {struct jffs2_sb_info *c =JFFS2_SB_INFO (sb); -if (!(sb->s_flags &MS_RDONLY )) +if (c && !(sb->s_flags &MS_RDONLY ))jffs2_stop_garbage_collect_thread (c);kill_mtd_super (sb);kfree (c);
PATCH 151/366 rpc_pipefs: fix double-dput()
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 4a3877c4cedd95543f8726b0a98743ed8db0c0fb upstream.
if we ever hit rpc_gssd_dummy_depopulate() dentry passed to it has refcount equal to 1. __rpc_rmpipe() drops it and dput() done after that hits an already freed dentry.
--- net/sunrpc/rpc_pipe.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/rpc_pipe.c +1 -0
@@ -1375,6 +1375,7 @@ rpc_gssd_dummy_depopulate(struct dentrystruct dentry *clnt_dir = pipe_dentry->d_parent;struct dentry *gssd_dir = clnt_dir->d_parent; +dget (pipe_dentry);__rpc_rmpipe (clnt_dir->d_inode, pipe_dentry);__rpc_depopulate (clnt_dir, gssd_dummy_info_file,0 ,1 );__rpc_depopulate (gssd_dir, gssd_dummy_clnt_dir,0 ,1 );
PATCH 152/366 USB: serial: simple: add libtransistor console
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Collin May <[email protected]>
commit fe710508b6ba9d28730f3021fed70e7043433b2e upstream.
Add simple driver for libtransistor USB console.
This device is implemented in software:
https://github.com/reswitched/libtransistor/blob/development/lib/usb_serial.c
--- drivers/usb/serial/Kconfig | 1 + drivers/usb/serial/usb-serial-simple.c | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/usb/serial/Kconfig +1 -0
@@ -62,6 +62,7 @@ config USB_SERIAL_SIMPLE - Fundamental Software dongle. - Google USB serial devices - HP4x calculators + - Libtransistor USB console - a number of Motorola phones - Motorola Tetra devices - Novatel Wireless GPS receivers
drivers/usb/serial/usb-serial-simple.c +7 -0
@@ -66,6 +66,11 @@ DEVICE(flashloader, FLASHLOADER_IDS); 0x01) }DEVICE (google,GOOGLE_IDS ); +/* Libtransistor USB console */ +#define LIBTRANSISTOR_IDS () \ + { USB_DEVICE(0x1209, 0x8b00) } +DEVICE (libtransistor,LIBTRANSISTOR_IDS ); +/* ViVOpay USB Serial Driver */ #define VIVOPAY_IDS () \ { USB_DEVICE(0x1d5f, 0x1004) }/* ViVOpay 8800 */
@@ -113,6 +118,7 @@ static struct usb_serial_driver * const &funsoft_device, &flashloader_device, &google_device, + &libtransistor_device, &vivopay_device, &moto_modem_device, &motorola_tetra_device,
@@ -129,6 +135,7 @@ static const struct usb_device_id id_tabFUNSOFT_IDS (),FLASHLOADER_IDS (),GOOGLE_IDS (), +LIBTRANSISTOR_IDS (),VIVOPAY_IDS (),MOTO_IDS (), MOTOROLA_TETRA_IDS(),
PATCH 153/366 ceph: always update atime/mtime/ctime for new inode
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Yan, Zheng" <[email protected]>
commit ffdeec7aa41aa61ca4ee68fddf4669df9ce661d1 upstream.
For new inode, atime/mtime/ctime are uninitialized. Don't compare against them.
--- fs/ceph/inode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/ceph/inode.c +7 -3
@@ -599,13 +599,15 @@ void ceph_fill_file_time(struct inode *i CEPH_CAP_FILE_BUFFER| CEPH_CAP_AUTH_EXCL| CEPH_CAP_XATTR_EXCL)) { -if (timespec_compare (ctime, &inode->i_ctime) >0 ) { +if (ci->i_version ==0 || +timespec_compare (ctime, &inode->i_ctime) >0 ) {dout ("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n" , inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, ctime->tv_sec, ctime->tv_nsec); inode->i_ctime = *ctime; } -if (ceph_seq_cmp (time_warp_seq, ci->i_time_warp_seq) >0 ) { +if (ci->i_version ==0 || +ceph_seq_cmp (time_warp_seq, ci->i_time_warp_seq) >0 ) {/* the MDS did a utimes() */ dout("mtime %ld.%09ld -> %ld.%09ld " "tw %d -> %d\n",
@@ -719,7 +721,6 @@ static int fill_inode(struct inode *inod new_issued = ~issued &le32_to_cpu (info->cap.caps);/* update inode */ - ci->i_version =le64_to_cpu (info->version); inode->i_version++; inode->i_rdev =le32_to_cpu (info->rdev); inode->i_blkbits =fls (le32_to_cpu (info->layout.fl_stripe_unit)) -1 ;
@@ -779,6 +780,9 @@ static int fill_inode(struct inode *inod xattr_blob =NULL ; } +/* finally update i_version */ + ci->i_version =le64_to_cpu (info->version); + inode->i_mapping->a_ops = &ceph_aops; inode->i_mapping->backing_dev_info = &ceph_sb_to_client (inode->i_sb)->backing_dev_info;
PATCH 154/366 USB: serial: cp210x: add ID for NI USB serial console
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Roeschley <[email protected]>
commit 1e23aace21515a8f7615a1de016c0ea8d4e0cc6e upstream.
Added the USB VID and PID for the USB serial console on some National Instruments devices.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -210,6 +210,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ + { USB_DEVICE(0x3923, 0x7A0B) }, /* National Instruments USB Serial Console */ { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ { } /* Terminating Entry */ };
PATCH 155/366 USB: serial: ftdi_sio: use jtag quirk for Arrow USB Blaster
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vasyl Vavrychuk <[email protected]>
commit 470b5d6f0cf4674be2d1ec94e54283a1770b6a1a upstream.
Arrow USB Blaster integrated on MAX1000 board uses the same vendor ID (0x0403) and product ID (0x6010) as the "original" FTDI device.
This patch avoids picking up by ftdi_sio of the first interface of this USB device. After that this device can be used by Arrow user-space JTAG driver.
--- drivers/usb/serial/ftdi_sio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/serial/ftdi_sio.c +2 -1
@@ -1929,7 +1929,8 @@ static int ftdi_8u2232c_probe(struct usbreturn ftdi_jtag_probe (serial);if (udev->product && - (!strcmp (udev->product,"BeagleBone/XDS100V2" ) || + (!strcmp (udev->product,"Arrow USB Blaster" ) || + !strcmp (udev->product,"BeagleBone/XDS100V2" ) || !strcmp (udev->product,"SNAP Connect E10" )))return ftdi_jtag_probe (serial);
PATCH 156/366 powerpc/lib: Fix off-by-one in alternate feature patching
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit b8858581febb050688e276b956796bc4a78299ed upstream.
When we patch an alternate feature section, we have to adjust any relative branches that branch out of the alternate section.
But currently we have a bug if we have a branch that points to past the last instruction of the alternate section, eg:
FTR_SECTION_ELSE
1: b 2f
or 6,6,6
2:
ALT_FTR_SECTION_END(...)
nop
This will result in a relative branch at 1 with a target that equals the end of the alternate section.
That branch does not need adjusting when it's moved to the non-else location. Currently we do adjust it, resulting in a branch that goes off into the link-time location of the else section, which is junk.
The fix is to not patch branches that have a target == end of the alternate section.
--- arch/powerpc/lib/feature-fixups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/lib/feature-fixups.c +1 -1
@@ -52,7 +52,7 @@ static int patch_alt_instruction(unsigneunsigned int *target = (unsigned int *)branch_target (src);/* Branch within the section doesn't need translating */ -if (target < alt_start || target >= alt_end) { +if (target < alt_start || target > alt_end) { instr =translate_branch (dest, src);if (!instr)return 1 ;
PATCH 157/366 team: avoid adding twice the same option to the event list
In reply to Ben Hutchings3.16.60-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 4fb0534fb7bbc2346ba7d3a072b538007f4135a5 upstream.
When parsing the options provided by the user space, team_nl_cmd_options_set() insert them in a temporary list to send multiple events with a single message.
While each option's attribute is correctly validated, the code does not check for duplicate entries before inserting into the event list.
Exploiting the above, the syzbot was able to trigger the following splat:
kernel BUG at lib/list_debug.c:31!
invalid opcode: 0000 [#1] SMP KASAN
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in: CPU: 0 PID: 4466 Comm: syzkaller556835 Not tainted 4.16.0+ #17 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:__list_add_valid+0xaa/0xb0 lib/list_debug.c:29 RSP: 0018:ffff8801b04bf248 EFLAGS: 00010286 RAX: 0000000000000058 RBX: ffff8801c8fc7a90 RCX: 0000000000000000 RDX: 0000000000000058 RSI: ffffffff815fbf41 RDI: ffffed0036097e3f RBP: ffff8801b04bf260 R08: ffff8801b0b2a700 R09: ffffed003b604f90 R10: ffffed003b604f90 R11: ffff8801db027c87 R12: ffff8801c8fc7a90 R13: ffff8801c8fc7a90 R14: dffffc0000000000 R15: 0000000000000000 FS: 0000000000b98880(0000) GS:ffff8801db000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000043fc30 CR3: 00000001afe8e000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __list_add include/linux/list.h:60 [inline] list_add include/linux/list.h:79 [inline] team_nl_cmd_options_set+0x9ff/0x12b0 drivers/net/team/team.c:2571 genl_family_rcv_msg+0x889/0x1120 net/netlink/genetlink.c:599 genl_rcv_msg+0xc6/0x170 net/netlink/genetlink.c:624 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2448 genl_rcv+0x28/0x40 net/netlink/genetlink.c:635 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x58b/0x740 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x9f0/0xfa0 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:639 ___sys_sendmsg+0x805/0x940 net/socket.c:2117 __sys_sendmsg+0x115/0x270 net/socket.c:2155 SYSC_sendmsg net/socket.c:2164 [inline] SyS_sendmsg+0x29/0x30 net/socket.c:2162 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x4458b9 RSP: 002b:00007ffd1d4a7278 EFLAGS: 00000213 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000000001b RCX: 00000000004458b9 RDX: 0000000000000010 RSI: 0000000020000d00 RDI: 0000000000000004 RBP: 00000000004a74ed R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000213 R12: 00007ffd1d4a7348 R13: 0000000000402a60 R14: 0000000000000000 R15: 0000000000000000 Code: 75 e8 eb a9 48 89 f7 48 89 75 e8 e8 d1 85 7b fe 48 8b 75 e8 eb bb 48 89 f2 48 89 d9 4c 89 e6 48 c7 c7 a0 84 d8 87 e8 ea 67 28 fe <0f> 0b 0f 1f 40 00 48 b8 00 00 00 00 00 fc ff df 55 48 89 e5 41 RIP: __list_add_valid+0xaa/0xb0 lib/list_debug.c:29 RSP: ffff8801b04bf248
This changeset addresses the avoiding list_add() if the current option is already present in the event list.
--- drivers/net/team/team.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/team/team.c +19 -0
@@ -253,6 +253,17 @@ static void __team_option_inst_mark_remo } } +static bool __team_option_inst_tmp_find (const struct list_head *opts, +const struct team_option_inst *needle) +{ +struct team_option_inst *opt_inst; + +list_for_each_entry (opt_inst, opts, tmp_list) +if (opt_inst == needle) +return true; +return false; +} +static int __team_options_register (struct team *team,const struct team_option *option,size_t option_count)
@@ -2520,6 +2531,14 @@ static int team_nl_cmd_options_set(strucif (err) goto team_put; opt_inst->changed = true; + +/* dumb/evil user-space can send us duplicate opt, +* keep only the last one +*/ +if (__team_option_inst_tmp_find (&opt_inst_list, + opt_inst)) +continue ; +list_add (&opt_inst->tmp_list, &opt_inst_list); }if (!opt_found) {