3.16.50-rc1 review
Subsystems (4)
cover 3.16.50-rc1 review
This is the start of the stable review cycle for the 3.16.50 release. There are 294 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 Nov 08 18:00:00 UTC 2017. Anything received after that time might be too late.
A combined patch relative to 3.16.49 will be posted as an additional response to this. A shortlog and diffstat can be found below.
Ben.
-------------
A Raghavendra Rao (1):
Staging: wlan-ng: fix sparse warning in prism2fw.c
[41cb65c4854e14f12b1cbb8215e509d8ad4d0c88]
Aaron Ma (1):
Input: trackpoint - add new trackpoint firmware ID
[ec667683c532c93fb41e100e5d61a518971060e2]
Akinobu Mita (1):
iio: light: tsl2563: use correct event code
[a3507e48d3f99a93a3056a34a5365f310434570f]
Alan Stern (4):
USB: Check for dropped connection before switching to full speed
[94c43b9897abf4ea366ed4dba027494e080c7050]
USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor()
[1c0edc3633b56000e18d82fc241e3995ca18a69e]
USB: uas: fix bug in handling of alternate settings
[786de92b3cb26012d3d0f00ee37adf14527f35c4]
usb: usbtest: fix NULL pointer dereference
[7c80f9e4a588f1925b07134bb2e3689335f6c6d8]
Alan Swanson (1):
uas: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069
[89f23d51defcb94a5026d4b5da13faf4e1150a6f]
Alban Bedel (1):
MIPS: Fix the build on jz4740 after removing the custom gpio.h
[5b235dc2647e4977b17b5c41d959d0f455831c3f]
Alex Vesker (1):
IB/ipoib: Prevent setting negative values to max_nonsrq_conn_qp
[11f74b40359b19f760964e71d04882a6caf530cc]
Alexander Potapenko (1):
sctp: don't dereference ptr before leaving _sctp_walk_{params, errors}()
[b1f5bfc27a19f214006b9b4db7b9126df2dfdf5a]
Andrew Morton (1):
MODULE_DEVICE_TABLE: fix some callsites
[0f989f749b51ec1fd94bb5a42f8ad10c8b9f73cb]
Andrey Ryabinin (1):
module: fix types of device tables aliases
[6301939d97d079f0d3dbe71e750f4daf5d39fc33]
Andy Lutomirski (1):
x86/asm/64: Clear AC on NMI entries
[e93c17301ac55321fc18e0f8316e924e58a83c8c]
Andy Shevchenko (1):
platform/x86: samsung-laptop: Initialize loca variable
[0d2c95354a3b63256e92d9fb865c08902d2c9b0b]
Aneesh Kumar K.V (1):
powerpc/mm/hash: Free the subpage_prot_table correctly
[0da12a7a81f1e2255e89dc783c565e84801475a2]
Anil Gurumurthy (1):
bfa: Fix indentation
[b7f4d6343820af5c2dc3979e91d85e71e638cd3d]
Ard Biesheuvel (2):
ARM: 8221/1: PJ4: allow building in Thumb-2 mode
[13d1b9575ac2c2da143cd2236b6cf0fc314570f8]
ARM: 8452/3: PJ4: make coprocessor access sequences buildable in Thumb2 mode
[5008efc83bf85b647aa1cbc44718b1675bbb7444]
Arend Van Spriel (1):
brcmfmac: add length check in brcmf_cfg80211_escan_handler()
[17df6453d4be17910456e99c5a85025aa1b7a246]
Arnd Bergmann (36):
ARM: 8296/1: cache-l2x0: clean up aurora cache handling
[20e783e39e55c2615fb61d1b3d139ee9edcf6772]
ARM: cns3xxx: shut up frame size warning
[498a92d42596a7a32c042319eb62a4c3d8081cf1]
ARM: pxa: select both FB and FB_W100 for eseries
[1d20d8a9fce8f1e2ef00a0f3d068fa18d59ddf8f]
Disable "frame-address" warning
[124a3d88fa20e1869fc229d7d8c740cc81944264]
MIPS: ip22: Fix ip28 build for modern gcc
[23ca9b522383d3b9b7991d8586db30118992af4a]
MIPS: jz4740: fix build error in irq.h
[not upstream; error was fixed by other changes]
ata: hpt366: fix constant cast warning
[6ec0a86c645be3fce7ade42f165a6a417c3503b1]
brcmfmac: avoid gcc-5.1 warning
[22f44150aad7a1d6b074ab6cf59abee61c7187c6]
cpmac: remove hopeless #warning
[d43e6fb4ac4abfe4ef7c102833ed02330ad701e0]
dm bufio: hide bogus warning
[not upstream; warning is avoided by other changes]
gfs2: remove IS_ERR_VALUE abuse
[287980e49ffc0f6d911601e7e352a812ed27768e]
hostap: avoid uninitialized variable use in hfa384x_get_rid
[48dc5fb3ba53b20418de8514700f63d88c5de3a3]
i2o: hide unsafe ioctl on 64-bit
[not upstream; driver has been removed]
iio: adc: fix building on 64-bit
[e49d99e0ecc88191c2e51a6535b1d0df635f1f3b]
infiniband: mlx5: avoid a compile-time warning
[7835bfb5261501590a508b3de3379e2231cb4853]
iwlegacy: avoid warning about missing braces
[2cce76c3fab410520610a7d2f52faebc3cfcf843]
mISDN: avoid arch specific __builtin_return_address call
[3e7a8716e20b759eec0ad88145255bb33174f0c8]
mlx5: avoid build warnings on 32-bit
[065bd8c28ba37d04c9a5b732173c1508954b1f58]
mtd: cfi: reduce stack size
[d09957fbb4d0b059b3176b510540df69048ad170]
mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy
[906b268477bc03daaa04f739844c120fe4dbc991]
net/xen-netback: disable on 64KB page granularity
[d0089e8a0e4c9723d85b01713671358e3d6960df]
net: am2150: fix nmclan_cs.c shared interrupt handling
[96a30175f927facfb421655ef08b7a0fe546fbed]
net: caif: fix misleading indentation
[8e0cc8c326d99e41468c96fea9785ab78883a281]
net: tulip: turn compile-time warning into dev_warn()
[de92718883ddbcd11b738d36ffcf57617b97fa12]
net: vxge: avoid unused function warnings
[57e7c8cef224af166b8ec932b5e383641418c005]
qlge: avoid memcpy buffer overflow
[e58f95831e7468d25eb6e41f234842ecfe6f014f]
scsi-tgt: fix type conversion warning
[not upstream; driver has been removed]
scsi: advansys: remove #warning message
[6571fb3f8b7f7e9595174e01b7e7f1b1ba0427d4]
staging: bcm: add 32-bit host dependency
[not upstream; driver has been removed]
staging: imx-drm: fix indentation warning
[d083c312cba2735566af9598cb281ea2ae6b729a]
staging: r8192ee: prorperly format warning message
[not upstream; driver has been removed]
staging: vt6655: fix overly large stack usage
[67013f2c0e5811a4fd60c51e3233e1f027d1c1e0]
staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read
[105967ad68d2eb1a041bc041f9cf96af2a653b65]
tty/isicom: fix big-endian compile warning
[f3e2d56dce47dbd0bb3f69f84741b439542fef37]
tty: nozomi: avoid a harmless gcc warning
[a4f642a8a3c2838ad09fe8313d45db46600e1478]
video: mx3fb: always enable BACKLIGHT_LCD_SUPPORT
[9c8ee3c7341393811d5be5eb61b815e76f92c799]
Atsushi Nemoto (2):
MIPS: TXx9: Delete an unused variable in tx4927_pcibios_setup
[1bc2d3e38e5bf90af4e9d64e1696f2d39757355a]
mtd: maps: rbtx4939-flash: delete an unused variable in rbtx4939_flash_remove
[e4c4c9c15ebe8ec03b7f5bf36e079052cc88217c]
Banajit Goswami (1):
ASoC: do not close shared backend dailink
[b1cd2e34c69a2f3988786af451b6e17967c293a0]
Bart Van Assche (2):
IB/cma: Fix a race condition in iboe_addr_get_sgid()
[fba332b079029c2f4f7e84c1c1cd8e3867310c90]
dm: fix printk() rate limiting code
[604407890ecf624c2fb41013c82b22aade59b455]
Ben Hutchings (3):
ALSA: seq: Enable 'use' locking in all configurations
[8009d506a1dd00cf436b0c4cca0dcec130580a21]
alpha: uapi: Add support for __SANE_USERSPACE_TYPES__
[cec80d82142ab25c71eee24b529cfeaf17c43062]
dst: Increase alignment of metrics to allow extra flag on pointers
[not upstream; only needed in older branches]
Bjorn Andersson (1):
spmi: Include OF based modalias in device uevent
[d50daa2af2618dab6d21634e65a5fbcf4ae437d6]
Bodo Stroesser (1):
scsi: st: fix blk_get_queue usage
[180efde0a3f43dbe533e4be203c2918793482d4e]
Charles Milette (1):
staging: rtl8188eu: add RNX-N150NUB support
[f299aec6ebd747298e35934cff7709c6b119ca52]
Chen Yu (1):
PM/hibernate: touch NMI watchdog when creating snapshot
[556b969a1cfe2686aae149137fa1dfcac0eefe54]
Chris Gorman (1):
i2c: mux: pinctrl: mention correct module name in Kconfig help text
[d1510a2e5ab6cb3a67f1c55ca5e7a6d2c6dec340]
Chris Wilson (1):
drm: Release driver tracking before making the object available again
[fe4600a548f2763dec91b3b27a1245c370ceee2a]
Chuck Lever (1):
nfsd: Limit end of page list when decoding NFSv4 WRITE
[fc788f64f1f3eb31e87d4f53bcf1ab76590d5838]
Chunyu Hu (1):
tracing: Fix kmemleak in instance_rmdir
[db9108e054700c96322b0f0028546aa4e643cf0b]
Colin Ian King (3):
Staging: iio: adc: fix indent on break statement
[b6acb0cfc21293a1bfc283e9217f58f7474ef728]
netxen: fix incorrect loop counter decrement
[a120d9ab65354727559b9db75ded8071b7ef19e2]
usb: storage: return on error to avoid a null pointer dereference
[446230f52a5bef593554510302465eabab45a372]
Cong Wang (1):
wl1251: add a missing spin_lock_init()
[f581a0dd744fe32b0a8805e279c59ec1ac676d60]
Dan Carpenter (11):
IB/cxgb3: Fix error codes in iwch_alloc_mr()
[9064d6055c14f700aa13f7c72fd3e63d12bee643]
RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd()
[dd75cfa6d3216c79c695f5af13e52208afe374ad]
RDMA/ocrdma: Fix error codes in ocrdma_create_srq()
[f0c6e88288d65c93bbc7da4fb6f7d51b2733228a]
Staging: lustre: missing curly braces in ll_setattr_raw()
[53bd4a004ee5ff0f71a858de78faac98924b4a87]
cxgb4: Fix error codes in c4iw_create_cq()
[6ebedacbb44602d4dec3348dee5ec31dd9b09521]
drm/i915: cleanup some indenting
[ba0635ffb7665d76715b43ae8144e014a90c1e63]
drm/msm: fix an integer overflow test
[65e93108891e571f177c202add9288eda9ac4100]
libata: array underflow in ata_find_dev()
[59a5e266c3f5c1567508888dd61a45b86daed0fa]
libceph: potential NULL dereference in ceph_msg_data_create()
[7c40b22f6f84c98a1d36e6d0a4346e58f05e45d8]
paride: fix the "verbose" module param
[946e87981942552e526aca9cb6204f02a6c847cb]
x86/ldt: Fix off by one in get_segment_base()
[eaa2f87c6b840b83827c40db6eb8481689570259]
Dave Martin (1):
arm64: fpsimd: Prevent registers leaking across exec
[096622104e14d8a1db4860bd557717067a0515d2]
David Howells (2):
KEYS: don't let add_key() update an uninstantiated key
[60ff5b2f547af3828aebafd54daded44cfb0807a]
assoc_array: Fix a buggy node-splitting case
[ea6789980fdaa610d7eb63602c746bf6ec70cd2b]
David Malcolm (1):
drivers/net/ethernet/dec/tulip/uli526x.c: fix misleading indentation in uli526x_timer
[e1395a321eab1a7833d82e952eb8255e0a1f03cb]
David Miller (1):
netfilter: Fix switch statement warnings with recent gcc.
[c1f866767777d1c6abae0ec57effffcb72017c00]
David S. Miller (1):
netfilter; Add some missing default cases to switch statements in nft_reject.
[129d23a56623eea0947a05288158d76dc7f2f0ac]
Doug Berger (2):
net: bcmgenet: Fix unmapping of fragments in bcmgenet_xmit()
[876dbadd53a7102e2a84afc84ea2bd3ee6dc5636]
net: bcmgenet: Free skb after last Tx frag
[f48bed16a756f5bc0244acd581f61968f7d7c2a4]
Dragos Bogdan (1):
iio: imu: adis16480: Fix acceleration scale factor for adis16480
[fdd0d32eb95f135041236a6885d9006315aa9a1d]
Emmanuel Grumbach (1):
iwlwifi: dvm: prevent an out of bounds access
[0b0f934e92a8eaed2e6c48a50eae6f84661f74f3]
Eric Biggers (1):
KEYS: prevent KEYCTL_READ on negative key
[37863c43b2c6464f252862bf2e9768264e961678]
Eric Dumazet (6):
af_key: do not use GFP_KERNEL in atomic contexts
[36f41f8fc6d8aa9f8c9072d66ff7cf9055f5e69b]
ipv4: add reference counting to metrics
[3fb07daff8e99243366a081e5129560734de4ada]
ipv4: fix NULL dereference in free_fib_info_rcu()
[187e5b3ac84d3421d2de3aca949b2791fbcad554]
net: reduce skb_warn_bad_offload() noise
[b2504a5dbef3305ef41988ad270b0e8ec289331c]
net: skb_needs_check() accepts CHECKSUM_NONE for tx
[6e7bc478c9a006c701c14476ec9d389a484b4864]
net_sched: fix error recovery at qdisc creation
[87b60cfacf9f17cf71933c6e33b66e68160af71d]
Feras Daoud (1):
IB/ipoib: Set IPOIB_NEIGH_TBL_FLUSH after flushed completion initialization
[d2e46fccc3e3d73a741efe433f00960331280696]
Florian Fainelli (12):
b44: Initialize 64-bit stats seqcount
[e43c9f23efadade684773a855675c99da278c862]
i40e: Initialize 64-bit statistics TX ring seqcount
[7d6d067790289e4f61f59fa60550ca5918aa25bd]
irqchip: brcmstb-l2: Define an irq_pm_shutdown function
[c017d21147848fe017772764a77a7f32c5b017f9]
ixgbe: Initialize 64-bit stats seqcounts
[7c3a4626eb65e78ebe208f48ffa21a5002f7f38e]
net: bcmgenet: Be drop monitor friendly
[d4fec855905fa8bd5fb1c59f73ad2d74a944876a]
net: bcmgenet: check harder for out of memory conditions
[b629be5c8399d7c423b92135eb43a86c924d1cbc]
net: bcmgenet: fix off-by-one in incrementing read pointer
[cf377d886f7944a5ccdbd164b89949e13617b096]
net: bcmgenet: update ring producer index and buffer count in xmit
[ae67bf0188cbb9d1786bdfcca9e1976cb36ee327]
net: systemport: Be drop monitor friendly
[c45182eb967af11e9482168be5be41aa22e5d321]
net: systemport: Free DMA coherent descriptors on errors
[c2062ee3d9615828109ffe8089fbf69bed394d05]
r8169: Be drop monitor friendly
[7a4b813cb739ce598ffbad2e84d19d13fa23e25d]
r8169: Do not increment tx_dropped in TX ring cleaning
[1089650d8837095f63e001bbf14d7b48043d67ad]
FrançOis Romieu (1):
net: remove open-coded skb_cow_head.
[a40e0a664bce465a3b8ad1d792153cef8ded9f7d]
Geert Uytterhoeven (2):
Input: gscps2 - fix MODULE_DEVICE_TABLE invocation
[6c8afa88adce613c23f27e719f805cc2a6441b07]
spi: rspi: Remove unused variable in rspi_rz_transfer_one()
[95029a00886f0c8d79e700cb8983b881c75af0f1]
Gerald Schaefer (1):
mm/hugetlb: improve locking in dissolve_free_huge_pages()
[eb03aa008561004257900983193d024e57abdd96]
Greg Kroah-Hartman (1):
USB: fix out-of-bounds in usb_set_configuration
[bd7a3fe770ebd8391d1c7d072ff88e9e76d063eb]
Guillaume Nault (8):
l2tp: define parameters of l2tp_session_get*() as "const"
[9aaef50c44f132e040dcd7686c8e78a3390037c5]
l2tp: hold tunnel used while creating sessions with netlink
[e702c1204eb57788ef189c839c8c779368267d70]
l2tp: hold tunnel while handling genl TUNNEL_GET commands
[4e4b21da3acc68a7ea55f850cacc13706b7480e9]
l2tp: hold tunnel while handling genl tunnel updates
[8c0e421525c9eb50d68e8f633f703ca31680b746]
l2tp: hold tunnel while looking up sessions in l2tp_netlink
[54652eb12c1b72e9602d09cb2821d5760939190f]
l2tp: hold tunnel while processing genl delete command
[bb0a32ce4389e17e47e198d2cddaf141561581ad]
l2tp: initialise session's refcount before making it reachable
[9ee369a405c57613d7c83a3967780c3e30c52ecc]
l2tp: remove useless duplicate session detection in l2tp_netlink
[af87ae465abdc070de0dc35d6c6a9e7a8cd82987]
Hannes Reinecke (1):
aic94xx: Skip reading user settings if flash is not found
[36dd5acd196574d41de3e81d8264df475bbb7123]
Hector Martin (1):
USB: serial: option: add D-Link DWM-222 device ID
[fd1b8668af59a11bb754a6c9b0051c6c5ce73b74]
Icenowy Zheng (1):
pinctrl: sunxi: add a missing function of A10/A20 pinctrl driver
[d81ece747d8727bb8b1cfc9a20dbe62f09a4e35a]
Inbar Karmy (1):
net/mlx4_en: Fix wrong indication of Wake-on-LAN (WoL) support
[c994f778bb1cca8ebe7a4e528cefec233e93b5cc]
Ingo Molnar (1):
x86/boot: Add CONFIG_PARAVIRT_SPINLOCKS quirk to arch/x86/boot/compressed/misc.h
[927392d73a97d8d235bb65400e2e3c7f0bec2b6f]
Iván Briano (1):
net/packet: Fix Tx queue selection for AF_PACKET
[ccd4eb49f3392ebf989d58bd013a7bf44cdca4d6]
Jaejoong Kim (1):
HID: usbhid: fix out-of-bounds bug
[f043bfc98c193c284e2cd768fefabe18ac2fed9b]
James Bottomley (1):
ips: remove pointless #warning
[e03c2da6574223081b786960e39c1e5ecf5d492d]
Jan Kara (3):
audit: Fix use after free in audit_remove_watch_rule()
[d76036ab47eafa6ce52b69482e91ca3ba337d6d6]
ext4: fix SEEK_HOLE/SEEK_DATA for blocksize < pagesize
[fcf5ea10992fbac3c7473a1db33d56a139333cd1]
ocfs2: don't clear SGID when inheriting ACLs
[19ec8e48582670c021e998b9deb88e39a842ff45]
Jeff Kirsher (2):
am2150: Update nmclan_cs.c to use update PCMCIA API
[5f5316fcd08ef74b282adf6774956431fac62663]
e1000e: fix call to do_div() to use u64 arg
[30544af5483755b11bb5924736e9e0b45ef0644a]
Jerry Lee (1):
ext4: fix overflow caused by missing cast in ext4_resize_fs()
[aec51758ce10a9c847a62a48a168f8c804c6e053]
Jiahau Chang (1):
xhci: Bad Ethernet performance plugged in ASM1042A host
[9da5a1092b13468839b1a864b126cacfb72ad016]
Jin Yao (1):
perf annotate: Fix broken arrow at row 0 connecting jmp instruction to its target
[80f62589fa52f530cffc50e78c0b5a2ae572d61e]
Jiri Olsa (1):
perf/core: Fix locking for children siblings group read
[2aeb1883547626d82c597cce2c99f0b9c62e2425]
Joe Perches (2):
dm: convert DM printk macros to pr_<level> macros
[d2c3c8dcb5987b8352e82089c79a41b6e17e28d2]
i40e: Reduce stack in i40e_dbg_dump_desc
[e6c97234d1b18d4751671df15d52e29daa8a7ba8]
Joerg Roedel (1):
iommu/amd: Fix schedule-while-atomic BUG in initialization code
[74ddda71f44c84af62f736a77fb9fcebe5bb436a]
Johan Hovold (1):
USB: cdc-acm: add device-id for quirky printer
[fe855789d605590e57f9cd968d85ecce46f5c3fd]
Johannes Berg (1):
mac80211: accept key reinstall without changing anything
[fdf7cb4185b60c68e1a75e61691c4afdc15dea0e]
Juergen Gross (1):
x86/xen: fix upper bound of pmd loop in xen_cleanhighmap()
[1cf38741308c64d08553602b3374fb39224eeb5a]
Julian Wiedmann (1):
s390/qeth: fix L3 next-hop in xmit qeth hdr
[ec2c6726322f0d270bab477e4904bf9496f70ee5]
Kai-Heng Feng (1):
usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter
[7496cfe5431f21da5d27a8388c326397e3f0a5db]
Kasin Li (1):
drm/msm: Fix potential buffer overflow issue
[4a630fadbb29d9efaedb525f1a8f7449ad107641]
Kevin Cernekee (1):
MIPS: BMIPS: Fix ".previous without corresponding .section" warnings
[4ec8f9e9b08451303253249e4e302f10ee23d565]
Konrad Zapalowicz (1):
staging: dgnc: Fix frame size is larger than 1024B
[ea6e9dea2e72a7abd146a2c5bab726b27f34b36c]
Konstantin Khlebnikov (2):
net_sched/sfq: update hierarchical backlog when drop packet
[325d5dc3f7e7c2840b65e4a2988c082c2c0025c5]
net_sched: fix order of queue length updates in qdisc_replace()
[68a66d149a8c78ec6720f268597302883e48e9fa]
Lars Ellenberg (1):
drbd: avoid redefinition of BITS_PER_PAGE
[2630628b2dbc3fc320aafaf84836119e4e3d62f1]
Laurent Vivier (1):
powerpc/pseries: Fix of_node_put() underflow during reconfig remove
[4fd1bd443e80b12f0a01a45fb9a793206b41cb72]
Lee Jones (1):
mfd: arizona: Rid data size incompatibility warn when building for 64bit
[942786e6e647cef94cf96dcd836d343be55fc452]
Leon Romanovsky (2):
IB/ipoib: Remove double pointer assigning
[1b355094b308f3377c8f574ce86135ee159c6285]
RDMA/uverbs: Prevent leak of reserved field
[f7a6cb7b38c6845b26aaa8bbdf519ff6e3090831]
Linus Lüssing (1):
batman-adv: fix TT sync flag inconsistencies
[54e22f265e872ae140755b3318521d400a094605]
Linus Torvalds (1):
Clarify (and fix) MAX_LFS_FILESIZE macros
[0cc3b0ec23ce4c69e1e890ed2b8d2fa932b14aad]
Linus Walleij (1):
gpio: drop retval check enforcing from gpiochip_remove()
[14c8a620ba436511b1347c592633befa49535176]
Luis de Bethencourt (2):
mvsas: fix misleading indentation
[7789cd39274c51bf475411fe22a8ee7255082809]
staging: rtl8723au: core: rtw_wlan_util: fix misleading indentation
[8c182ae20791d638c07ff499709c4a1d4697bd7c]
Maciej W. Rozycki (1):
MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression
[68fe55680d0f3342969f49412fceabb90bdfadba]
Mahesh Bandewar (1):
ipv4: initialize fib_trie prior to register_netdev_notifier call.
[8799a221f5944a7d74516ecf46d58c28ec1d1f75]
Manuel Schölling (1):
xilinx: Fix compiler warning
[9f8b93cb32e088d3377c86fabb666b884bac0f12]
Mark Brown (7):
ASoC: adau1977: Fix truncation warning on 64 bit architectures
[d8df26bb57d2a86365de46a5421b97417401e39a]
ASoC: imx-audmux: Use uintptr_t for port numbers
[e5f89768e9bc1f441d18e2299518a2907e5017c9]
Input: joystick - use get_cycles on ARMv8
[a6b48699ae50ccce700506ced863ba1f5ce2af11]
dma: pl08x: Use correct specifier for size_t values
[6fc8ae787c589245ee3395630d2c428a1afab26c]
power/reset: xgene-reset: Fix prototype of xgene_restart()
[d3ed534cca703b2aaeee9277a5b8063ae6eab1d1]
spi/atmel: Fix pointer to int conversion warnings on 64 bit builds
[67f08d690aa90e47a0e793fc63e2ecbe95d29839]
spi/pl022: Explicitly truncate large bitmask
[d555ea05f9d8ebf567eaa6b4e4cb5776aacf2940]
Mark Rutland (2):
arm64: mm: abort uaccess retries upon fatal signal
[289d07a2dc6c6b6f3e4b8a62669320d99dbe6c3d]
perf/core: Fix group {cpu,task} validation
[64aee2a965cf2954a038b5522f11d2cd2f0f8f3e]
Martin KaFai Lau (1):
ipv6: Add rt6_get_cookie() function
[b197df4f0f3782782e9ea8996e91b65ae33e8dd9]
Masami Hiramatsu (1):
kprobes/x86: Release insn_slot in failure path
[38115f2f8cec8087d558c062e779c443a01f87d6]
Mateusz Jurczyk (1):
fuse: initialize the flock flag in fuse_file on allocation
[68227c03cba84a24faf8a7277d2b1a03c8959c2c]
Mathias Krause (2):
xfrm_user: fix info leak in build_aevent()
[931e79d7a7ddee4709c56b39de169a36804589a1]
xfrm_user: fix info leak in xfrm_notify_sa()
[50329c8a340c9dea60d837645fcf13fc36bfb84d]
Mathias Nyman (2):
xhci: Fix NULL pointer dereference when cleaning up streams for removed host
[4b895868bb2da60a386a17cde3bf9ecbc70c79f4]
xhci: fix 20000ms port resume timeout
[a54408d0a004757789863d74e29c2297edae0b4d]
Max Filippov (3):
xtensa: don't limit csum_partial export by CONFIG_NET
[7f81e55c737a8fa82c71f290945d729a4902f8d2]
xtensa: fix cache aliasing handling code for WT cache
[6d0f581d1768d3eaba15776e7dd1fdfec10cfe36]
xtensa: mm/cache: add missing EXPORT_SYMBOLs
[bc652eb6a0d5cffaea7dc8e8ad488aab2a1bf1ed]
[email protected] (1):
crypto: x86/sha1 - Fix reads beyond the number of blocks passed
[8861249c740fc4af9ddc5aee321eafefb960d7c6]
Michael Ellerman (1):
powerpc/boot: Fix 64-bit boot wrapper build with non-biarch compiler
[65c5ec11c25eff6ba6e9b1cbfff014875fddd1e0]
Michael Gugino (1):
staging: rtl8188eu: add TL-WN722N v2 support
[5a1d4c5dd4eb2f1f8a9b30e61762f3b3b564df70]
Michal Kalderon (1):
IB/cma: Fix reference count leak when no ipv4 addresses are set
[963916fdb3e5ad4af57ac959b5a03bf23f7568ca]
Michał Mirosław (1):
gpio: tegra: fix unbalanced chained_irq_enter/exit
[9e9509e38fbe034782339eb09c915f0b5765ff69]
Moshe Shemesh (1):
net/mlx5: Fix command bad flow on command entry allocation failure
[219c81f7d1d5a89656cb3b53d3b4e11e93608d80]
Mustafa Ismail (2):
RDMA/core: Initialize port_num in qp_attr
[a62ab66b13a0f9bcb17b7b761f6670941ed5cd62]
RDMA/uverbs: Fix the check for port number
[5a7a88f1b488e4ee49eb3d5b82612d4d9ffdf2c3]
Nadav Amit (1):
mm: migrate: prevent racy access to tlb_flush_pending
[16af97dc5a8975371a83d9e30a64038b48f40a2d]
Naftali Goldstein (1):
iwlwifi: mvm: set the RTS_MIMO_PROT bit in flag mask when sending sta to fw
[8addabf8e6e299f790038fdc92ddceaaf76adab8]
Nicholas Bellinger (1):
iscsi-target: Fix iscsi_np reset hung task during parallel delete
[978d13d60c34818a41fc35962602bdfa5c03f214]
Nicolin Chen (1):
ASoC: fsl_sai: Set SYNC bit of TCR2 to Asynchronous Mode
[855675f6e6a65688a7f4cf45b9b5a98cf6c6f5c3]
Nikolay Aleksandrov (9):
net: bridge: fix dest lookup when vlan proto doesn't match
[31a4562d7408493c6377933ff2f7d7302dbdea80]
sch_cbq: fix null pointer dereferences on init failure
[3501d059921246ff617b43e86250a719c140bd97]
sch_fq_codel: avoid double free on init failure
[30c31d746d0eb458ae327f522bc8e4c44cbea0f0]
sch_hfsc: fix null pointer deref and double free on init failure
[3bdac362a2f89ed3e148fa6f38c5f5d858f50b1a]
sch_hhf: fix null pointer dereference on init failure
[32db864d33c21fd70a217ba53cb7224889354ffb]
sch_htb: fix crash on init failure
[88c2ace69dbef696edba77712882af03879abc9c]
sch_multiq: fix double free on init failure
[e89d469e3be3ed3d7124a803211a463ff83d0964]
sch_netem: avoid null pointer deref on init failure
[634576a1844dba15bc5e6fc61d72f37e13a21615]
sch_tbf: fix two null pointer dereferences on init failure
[c2d6511e6a4f1f3673d711569c00c3849549e9b0]
Nikolay Borisov (1):
ARM: kexec: Make .text R/W in machine_kexec
[42d720d1731a9d7035c2812437c35e271ec4dd78]
Ofer Heifetz (1):
md/raid5: add thread_group worker async_tx_issue_pending_all
[7e96d559634b73a8158ee99a7abece2eacec2668]
Oleg Nesterov (1):
epoll: fix race between ep_poll_callback(POLLFREE) and ep_free()/ep_remove()
[138e4ad67afd5c6c318b056b4d17c17f2c0ca5c0]
Oliver O'Halloran (1):
mm/init: fix zone boundary creation
[90cae1fe1c3540f791d5b8e025985fa5e699b2bb]
Omar Sandoval (1):
xfs: fix inobt inode allocation search optimization
[c44245b3d5435f533ca8346ece65918f84c057f9]
Paul Burton (1):
net: ti: cpmac: Fix compiler warning due to type confusion
[2f5281ba2a8feaf6f0aee93356f350855bb530fc]
Paul Gortmaker (2):
modpost: don't emit section mismatch warnings for compiler optimizations
[4a3893d069b788f3570c19c12d9e986e8e15870f]
modpost: expand pattern matching to support substring matches
[09c20c032b0f753969ae778d9783d946f054d7fe]
Paul Mackerras (1):
KVM: PPC: Book3S HV: Enable TM before accessing TM registers
[e47057151422a67ce08747176fa21cb3b526a2c9]
Pavel Shilovsky (1):
CIFS: Fix maximum SMB2 header size
[9e37b1784f2be9397a903307574ee565bbadfd75]
Peter Zijlstra (2):
perf/core: Invert perf_read_group() loops
[fa8c269353d560b7c28119ad7617029f92e40b15]
perf: Avoid horrible stack usage
[86038c5ea81b519a8a1fcfcd5e4599aab0cdd119]
Petri Gynther (4):
net: bcmgenet: cleanup for bcmgenet_xmit_frag()
[824ba603573d910e32df75fe6a5e7d7ec2a0a6a7]
net: bcmgenet: fix dev->stats.tx_bytes accounting
[55868120a3e5420bf5aa26a816c07d691579c9e6]
net: bcmgenet: rewrite bcmgenet_rx_refill()
[d6707bec598649450ee0887bf11896e525777874]
net: bcmgenet: simplify __bcmgenet_tx_reclaim()
[66d06757d9eb74a29775737b8c770e3b57e536d9]Prabhakar Lad (1):
media: platform: davinci: return -EINVAL for VPFE_CMD_S_CCDC_RAW_PARAMS ioctl
[da05d52d2f0f6bd61094a0cd045fed94bf7d673a]
Rafael J. Wysocki (1):
USB: hcd: Mark secondary HCD as dead if the primary one died
[cd5a6a4fdaba150089af2afc220eae0fef74878a]
Ralf Baechle (3):
MIPS: DEC: Avoid la pseudo-instruction in delay slots
[3021773c7c3e75e20b693931a19362681e744ea9]
MIPS: elf2ecoff: Fix warning due to dead code.
[2d76e9633b572ae5a64150b638eed77f4afc12db]
MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers.
[26f7c4bd05cf34e63a4a794150ab66a40a5a84a9]
Ronnie Sahlberg (2):
cifs: check MaxPathNameComponentLength != 0 before using it
[f74bc7c6679200a4a83156bb89cbf6c229fe8ec0]
cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
[d3edede29f74d335f81d95a4588f5f136a9f7dcf]Russell King (1):
ARM: kexec: fix failure to boot crash kernel
[0d70262a2d60886da6fe5b1fc8bbcd76cbbc306d]
Rusty Russell (1):
cpumask_set_cpu_local_first => cpumask_local_spread, lament
[f36963c9d3f6f415732710da3acdd8608a9fa0e]
Ryusuke Konishi (1):
nilfs2: fix gcc uninitialized-variable warnings in powerpc build
[4f05028f8d1af782cfd03d09e0a052e9745dc5ad]
Sabrina Dubroca (1):
netfilter: ipt_CLUSTERIP: fix use-after-free of proc entry
[3840538ad384fb7891adeeaf36624f870c51fc0e]
Sachin Prabhu (1):
cifs: Fix df output for users with quota limits
[42bec214d8bd432be6d32a1acb0a9079ecd4d142]
Sandeep Singh (1):
usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume
[e788787ef4f9c24aafefc480a8da5f92b914e5e6]
Sean Young (1):
media: lirc: LIRC_GET_REC_RESOLUTION should return microseconds
[9f5039ba440e499d85c29b1ddbc3cbc9dc90e44b]
Sergei A. Trusov (1):
ALSA: hda - Fix speaker output from VAIO VPCL14M1R
[3f3c371421e601fa93b6cb7fb52da9ad59ec90b4]
Sergey Ryazanov (1):
MIPS: MSP71xx: remove odd locking in PCI config space access code
[c4a305374bbf36414515d2ae00d588c67051e67d]
Seunghun Han (1):
x86/acpi: Prevent out of bound access caused by broken ACPI tables
[dad5ab0db8deac535d03e3fe3d8f2892173fa6a4]
Shu Wang (1):
xhci: fix memleak in xhci_run()
[d6f5f071f1e13cadecf8aef1faa7e5d6fbc9f33b]
Sinclair Yeh (1):
drm/vmwgfx: Fix gcc-7.1.1 warning
[fcfffdd8f98ac305285dca568b5065ef86be6458]
Stefan Triller (1):
USB: serial: cp210x: add support for Qivicon USB ZigBee dongle
[9585e340db9f6cc1c0928d82c3a23cc4460f0a3f]Stefan-Gabriel Mirea (1):
iio: adc: vf610_adc: Fix VALT selection value for REFSEL bits
[d466d3c1217406b14b834335b5b4b33c0d45bd09]
Stefano Brivio (1):
ipv6: accept 64k - 1 packet length in ip6_find_1stfragopt()
[3de33e1ba0506723ab25734e098cf280ecc34756]
Steffen Klassert (1):
ipv6: Fix may be used uninitialized warning in rt6_check
[3614364527daa870264f6dde77f02853cdecd02c]
Stephen Boyd (1):
of: device: Export of_device_{get_modalias, uvent_modalias} to modules
[7a3b7cd332db08546f3cdd984f11773e0d1999e7]
Stephen Douthit (2):
i2c: ismt: Don't duplicate the receive length for block reads
[b6c159a9cb69c2cf0bf59d4e12c3a2da77e4d994]
i2c: ismt: Return EMSGSIZE for block reads with bogus length
[ba201c4f5ebe13d7819081756378777d8153f23e]
Stephen Hemminger (1):
netvsc: fix deadlock betwen link status and removal
[9b4e946ce14e20d7addbfb7d9139e604f9fda107]
Steve Dickson (1):
mount: copy the port field into the cloned nfs_server structure.
[89a6814d9b665b196aa3a102f96b6dc7e8cb669e]
Steve French (1):
CIFS: remove endian related sparse warning
[6e3c1529c39e92ed64ca41d53abadabbaa1d5393]
Steven Rostedt (1):
tracing: Fix freeing of filter in create_filter() when set_str is false
[8b0db1a5bdfcee0dbfa89607672598ae203c9045]
Takashi Iwai (6):
ALSA: core: Fix unexpected error at replacing user TLV
[88c54cdf61f508ebcf8da2d819f5dfc03e954d1d]
ALSA: hda - Add stereo mic quirk for Lenovo G50-70 (17aa:3978)
[bbba6f9d3da357bbabc6fda81e99ff5584500e76]
ALSA: seq: Fix use-after-free at creating a port
[71105998845fb012937332fe2e806d443c09e026]
ALSA: usb-audio: Add mute TLV for playback volumes on C-Media devices
[0f174b3525a43bd51f9397394763925e0ebe7bc7]
ALSA: usb-audio: Check out-of-bounds access by corrupted buffer descriptor
[bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991]
ALSA: usb-audio: Kill stray URB at exiting
[124751d5e63c823092060074bd0abaae61aaa9c4]Tejun Heo (3):
cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs
[b339752d054fb32863418452dff350a1086885b1]
workqueue: implicit ordered attribute should be overridable
[0a94efb5acbb6980d7c9ab604372d93cd507e4d8]
workqueue: restore WQ_UNBOUND/max_active==1 to be ordered
[5c0338c68706be53b3dc472e4308961c36e4ece1]Thomas Bogendoerfer (1):
parisc: pci memory bar assignment fails with 64bit kernels on dino/cujo
[4098116039911e8870d84c975e2ec22dab65a909]
Tim Gardner (1):
be2iscsi: Fix bogus WARN_ON length check
[dd29dae00d39186890a5eaa2fe4ad8768bfd41a9]
Timur Tabi (1):
ASoC: fsl-ssi: fix do_div build warning in fsl_ssi_set_bclk()
[acf2c60a60b3d6d7080854b9483f37d99ded9b23]
Tony Lindgren (1):
ARM: OMAP: Fix Kconfig warning for omap1
[52aaac5ae52ad9a7016410ffeedbaf24b722f3a2]
Uwe Kleine-König (3):
ARM: 8160/1: drop warning about return_address not using unwind tables
[e16343c47e4276f5ebc77ca16feb5e50ca1918f9]
clk/efm32gg: fix dt init prototype
[8ce8ebeb572d70e672a8d158e93ffaac80ea7576]
mtd: nandsim: remove debugfs entries in error path
[b974696da1cfc5aa0c29ed97dc8f6c239899e64b]
Varka Bhadram (1):
ethernet: amd: fix pci device ids
[ba69a3d78e4f51e65933a86b8b107c86709bb2f5]
Vitaly Mayatskikh (1):
fix unbalanced page refcounting in bio_map_user_iov
[95d78c28b5a85bacbc29b8dba7c04babb9b0d467]
Wanpeng Li (1):
KVM: async_pf: make rcu irq exit if not triggered from idle task
[337c017ccdf2653d0040099433fc1a2b1beb5926]
Wei Wang (3):
ipv6: add rcu grace period before freeing fib6_node
[c5cff8561d2d0006e972bd114afd51f082fee77c]
ipv6: fix sparse warning on rt6i_node
[4e587ea71bf924f7dac621f1351653bd41e446cb]
ipv6: reset fn->rr_ptr when replacing route
[383143f31d7d3525a1dbff733d52fff917f82f15]Willem de Bruijn (3):
net: avoid skb_warn_bad_offload false positives on UFO
[8d63bee643f1fb53e472f0e135cae4eb99d62d19]
packet: hold bind lock when rebinding to fanout hook
[008ba2a13f2d04c947adc536d19debb8fe66f110]
packet: in packet_do_bind, test fanout with bind_lock held
[4971613c1639d8e5f102c4e797c3bf8f83a5a69e]
Xiao Ni (1):
Raid5 should update rdev->sectors after reshape
[b5d27718f38843a74552e9a93d32e2391fd3999f]Xin Long (2):
ipv6: set rt6i_protocol properly in the route when it is installed
[b91d532928dff2141ea9c107c3e73104d9843767]
sctp: fix the check for _sctp_walk_params and _sctp_walk_errors
[6b84202c946cd3da3a8daa92c682510e9ed80321]
Yishai Hadas (1):
IB/uverbs: Fix device cleanup
[efdd6f53b10aead0f5cf19a93dd3eb268ac0d991]
Yoshihiro Shimoda (4):
usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
[59a0879a0e17b2e43ecdc5e3299da85b8410d7ce]
usb: renesas_usbhs: gadget: Fix NULL pointer dereference in usbhsg_ep_dequeue()
[c9eb29503e9655e70448bbbf3697d08a56d24854]
usb: renesas_usbhs: gadget: disable all eps when the driver stops
[b8b9c974afee685789fcbb191b52d1790be3608c]
usb: renesas_usbhs: gadget: fix re-enabling pipe without re-connecting
[dfb87b8bfe09f933abaf387693992089f6f9053e]
Zhong Jiang (1):
mm/mempolicy: fix use after free when calling get_mempolicy
[73223e4e2e3867ebf033a5a8eb2e5df0158ccc99]
Zubair Lutfullah Kakakhel (1):
MIPS: Fix a warning for virt_to_page
[4d5b3bdc0ecb0cf5b1e1598eeaaac4b5cb33868d]
Documentation/video4linux/v4l2-pci-skeleton.c | 2 +- Makefile | 5 +- arch/alpha/include/asm/types.h | 1 - arch/alpha/include/uapi/asm/types.h | 12 +- arch/arm/include/asm/kexec.h | 5 + arch/arm/kernel/iwmmxt.S | 13 + arch/arm/kernel/machine_kexec.c | 11 +- arch/arm/kernel/pj4-cp0.c | 4 + arch/arm/kernel/return_address.c | 4 - arch/arm/mach-cns3xxx/Makefile | 1 + arch/arm/mach-omap2/Kconfig | 3 - arch/arm/mach-pxa/Kconfig | 1 + arch/arm/mm/cache-l2x0.c | 111 ++--- arch/arm/plat-omap/Kconfig | 3 + arch/arm64/kernel/fpsimd.c | 2 + arch/arm64/mm/fault.c | 5 +- arch/mips/boot/elf2ecoff.c | 10 +- arch/mips/dec/int-handler.S | 18 +- arch/mips/include/asm/page.h | 3 +- arch/mips/jz4740/board-qi_lb60.c | 1 + arch/mips/jz4740/gpio.c | 1 + arch/mips/jz4740/irq.h | 2 + arch/mips/kernel/bmips_vec.S | 3 - arch/mips/pci/ops-pmcmsp.c | 12 - arch/mips/pci/ops-tx4927.c | 2 - arch/mips/sgi-ip22/Platform | 2 +- arch/powerpc/boot/Makefile | 16 +- arch/powerpc/kvm/book3s_hv.c | 2 + arch/powerpc/mm/subpage-prot.c | 2 +- arch/powerpc/platforms/pseries/reconfig.c | 1 - arch/x86/boot/compressed/misc.h | 11 +- arch/x86/crypto/sha1_avx2_x86_64_asm.S | 67 +-- arch/x86/crypto/sha1_ssse3_glue.c | 2 +- arch/x86/kernel/acpi/boot.c | 8 + arch/x86/kernel/cpu/perf_event.c | 7 +- arch/x86/kernel/entry_64.S | 2 + arch/x86/kernel/kprobes/core.c | 10 +- arch/x86/kernel/kvm.c | 6 +- arch/x86/xen/mmu.c | 2 +- arch/xtensa/kernel/xtensa_ksyms.c | 2 - arch/xtensa/mm/cache.c | 12 +- block/bio.c | 8 + drivers/ata/libata-scsi.c | 6 +- drivers/ata/pata_hpt366.c | 4 +- drivers/block/drbd/drbd_bitmap.c | 6 + drivers/block/paride/pg.c | 4 +- drivers/clk/clk-efm32gg.c | 6 +- drivers/dma/amba-pl08x.c | 4 +- drivers/gpio/gpio-tegra.c | 6 +- drivers/gpu/drm/drm_gem.c | 6 +- drivers/gpu/drm/i915/i915_debugfs.c | 5 +- drivers/gpu/drm/msm/msm_gem_submit.c | 7 +- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +- drivers/hid/usbhid/hid-core.c | 12 +- drivers/i2c/busses/i2c-ismt.c | 6 +- drivers/i2c/muxes/Kconfig | 2 +- drivers/iio/adc/exynos_adc.c | 2 +- drivers/iio/adc/vf610_adc.c | 2 +- drivers/iio/imu/adis16480.c | 2 +- drivers/iio/light/tsl2563.c | 2 +- drivers/infiniband/core/cma.c | 2 + drivers/infiniband/core/uverbs_cmd.c | 5 +- drivers/infiniband/core/uverbs_main.c | 3 +- drivers/infiniband/hw/cxgb3/iwch_provider.c | 5 +- drivers/infiniband/hw/cxgb4/cq.c | 1 + drivers/infiniband/hw/mlx5/mem.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 +- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 1 - drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +- drivers/input/joystick/analog.c | 2 +- drivers/input/mouse/trackpoint.c | 3 +- drivers/input/mouse/trackpoint.h | 3 +- drivers/input/serio/gscps2.c | 2 +- drivers/iommu/amd_iommu_init.c | 2 +- drivers/irqchip/irq-brcmstb-l2.c | 1 + drivers/isdn/hardware/mISDN/mISDNipac.c | 12 +- drivers/isdn/hardware/mISDN/w6692.c | 6 +- drivers/md/dm-bufio.c | 1 + drivers/md/dm.c | 10 - drivers/md/raid5.c | 6 +- drivers/media/platform/davinci/vpfe_capture.c | 22 +- drivers/media/rc/ir-lirc-codec.c | 2 +- drivers/message/i2o/i2o_config.c | 4 +- drivers/mfd/arizona-core.c | 4 +- drivers/mfd/arizona-i2c.c | 5 +- drivers/mfd/arizona-spi.c | 3 +- drivers/mfd/arizona.h | 4 +- drivers/mtd/maps/pmcmsp-flash.c | 4 +- drivers/mtd/maps/rbtx4939-flash.c | 2 - drivers/mtd/nand/nandsim.c | 1 + drivers/net/Kconfig | 3 + drivers/net/ethernet/amd/amd8111e.c | 19 +- drivers/net/ethernet/amd/nmclan_cs.c | 4 +- drivers/net/ethernet/broadcom/b44.c | 1 + drivers/net/ethernet/broadcom/bcmsysport.c | 4 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 456 ++++++++++----------- drivers/net/ethernet/broadcom/genet/bcmgenet.h | 9 + drivers/net/ethernet/dec/tulip/tulip_core.c | 9 +- drivers/net/ethernet/dec/tulip/uli526x.c | 2 +- drivers/net/ethernet/dec/tulip/winbond-840.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 1 - drivers/net/ethernet/intel/e1000e/ich8lan.c | 13 +- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 30 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 + drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 + drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 15 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 10 +- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 6 +- drivers/net/ethernet/mellanox/mlx4/fw.c | 4 + drivers/net/ethernet/mellanox/mlx4/fw.h | 1 + drivers/net/ethernet/mellanox/mlx4/main.c | 2 + drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 19 +- drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 6 +- drivers/net/ethernet/neterion/vxge/vxge-main.c | 31 +- drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c | 2 +- drivers/net/ethernet/qlogic/qlge/qlge_dbg.c | 2 +- drivers/net/ethernet/realtek/r8169.c | 5 +- drivers/net/ethernet/ti/cpmac.c | 7 +- drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +- drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 2 +- drivers/net/ethernet/xilinx/xilinx_emaclite.c | 2 +- drivers/net/hyperv/netvsc_drv.c | 9 +- drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 2 +- .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 18 +- drivers/net/wireless/hostap/hostap_hw.c | 15 +- drivers/net/wireless/iwlegacy/3945.c | 3 +- drivers/net/wireless/iwlwifi/dvm/tx.c | 2 +- drivers/net/wireless/iwlwifi/mvm/sta.c | 3 +- drivers/net/wireless/ti/wl1251/main.c | 1 + drivers/of/device.c | 2 + drivers/parisc/dino.c | 2 +- drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 + drivers/platform/x86/samsung-laptop.c | 2 +- drivers/power/reset/xgene-reboot.c | 2 +- drivers/s390/net/qeth_l3_main.c | 4 +- drivers/scsi/advansys.c | 3 +- drivers/scsi/aic94xx/aic94xx_sds.c | 5 +- drivers/scsi/be2iscsi/be_main.c | 3 +- drivers/scsi/bfa/bfa_ioc.c | 22 +- drivers/scsi/ips.c | 9 +- drivers/scsi/mvsas/mv_sas.c | 4 +- drivers/scsi/scsi_tgt_if.c | 2 +- drivers/scsi/st.c | 4 +- drivers/spi/spi-atmel.c | 4 +- drivers/spi/spi-pl022.c | 2 +- drivers/spi/spi-rspi.c | 1 - drivers/spmi/spmi.c | 12 + drivers/staging/bcm/Kconfig | 1 + drivers/staging/dgnc/dgnc_tty.c | 16 +- drivers/staging/iio/adc/ad7192.c | 2 +- drivers/staging/iio/resolver/ad2s1210.c | 2 +- drivers/staging/imx-drm/imx-hdmi.c | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 +- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 2 + drivers/staging/rtl8192ee/pci.c | 4 +- drivers/staging/rtl8723au/core/rtw_wlan_util.c | 2 +- drivers/staging/vt6655/device_main.c | 10 +- drivers/staging/wlan-ng/prism2fw.c | 33 +- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_core.h | 1 + drivers/target/iscsi/iscsi_target_login.c | 7 +- drivers/tty/isicom.c | 2 +- drivers/tty/nozomi.c | 2 +- drivers/usb/class/cdc-acm.c | 3 + drivers/usb/core/config.c | 20 +- drivers/usb/core/hcd.c | 2 + drivers/usb/core/hub.c | 10 +- drivers/usb/core/quirks.c | 4 + drivers/usb/host/pci-quirks.c | 71 +++- drivers/usb/host/pci-quirks.h | 2 + drivers/usb/host/xhci-hub.c | 3 + drivers/usb/host/xhci-pci.c | 6 + drivers/usb/host/xhci-ring.c | 11 +- drivers/usb/host/xhci.c | 10 +- drivers/usb/host/xhci.h | 1 + drivers/usb/misc/usbtest.c | 5 +- drivers/usb/renesas_usbhs/common.c | 4 +- drivers/usb/renesas_usbhs/mod_gadget.c | 42 +- drivers/usb/renesas_usbhs/pipe.c | 10 + drivers/usb/renesas_usbhs/pipe.h | 1 + drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/option.c | 2 + drivers/usb/storage/isd200.c | 5 +- drivers/usb/storage/uas-detect.h | 15 +- drivers/usb/storage/uas.c | 10 +- drivers/usb/storage/unusual_uas.h | 4 +- drivers/video/fbdev/Kconfig | 3 +- fs/cifs/dir.c | 19 +- fs/cifs/smb2pdu.c | 4 +- fs/cifs/smb2pdu.h | 4 +- fs/eventpoll.c | 36 +- fs/ext4/file.c | 3 + fs/ext4/resize.c | 3 +- fs/fuse/file.c | 2 +- fs/gfs2/dir.c | 11 +- fs/nfs/client.c | 1 + fs/nfsd/nfs4xdr.c | 6 +- fs/nilfs2/btree.c | 2 +- fs/nilfs2/recovery.c | 4 +- fs/nilfs2/super.c | 5 +- fs/ocfs2/acl.c | 27 +- fs/xfs/xfs_ialloc.c | 2 +- include/asm-generic/topology.h | 6 +- include/linux/cpumask.h | 6 +- include/linux/device-mapper.h | 70 ++-- include/linux/fs.h | 4 +- include/linux/ftrace_event.h | 2 +- include/linux/gpio/driver.h | 2 +- include/linux/mlx4/device.h | 1 + include/linux/mm_types.h | 31 +- include/linux/module.h | 2 +- include/linux/mtd/map.h | 12 +- include/linux/perf_event.h | 28 +- include/linux/workqueue.h | 4 +- include/net/dst.h | 13 +- include/net/ip6_fib.h | 35 +- include/net/ip6_route.h | 2 +- include/net/ip_fib.h | 10 +- include/net/sch_generic.h | 5 +- include/net/sctp/sctp.h | 4 + include/rdma/ib_addr.h | 6 +- include/trace/ftrace.h | 7 +- include/uapi/linux/usb/ch9.h | 1 + kernel/audit_watch.c | 12 +- kernel/events/core.c | 135 +++--- kernel/fork.c | 2 +- kernel/sched/core.c | 2 +- kernel/trace/trace.c | 1 + kernel/trace/trace_event_perf.c | 4 +- kernel/trace/trace_events_filter.c | 4 + kernel/trace/trace_kprobe.c | 4 +- kernel/trace/trace_syscalls.c | 4 +- kernel/trace/trace_uprobe.c | 2 +- kernel/workqueue.c | 23 +- lib/assoc_array.c | 51 +-- lib/cpumask.c | 74 ++-- mm/hugetlb.c | 12 +- mm/mempolicy.c | 5 - mm/mprotect.c | 4 +- mm/page_alloc.c | 37 +- net/batman-adv/translation-table.c | 57 ++- net/batman-adv/types.h | 2 + net/bridge/br_device.c | 3 +- net/bridge/br_input.c | 3 +- net/bridge/br_netfilter.c | 2 +- net/caif/cfpkt_skbuff.c | 2 +- net/ceph/messenger.c | 6 +- net/core/dev.c | 23 +- net/core/dst.c | 45 +- net/core/pktgen.c | 2 +- net/ipv4/fib_frontend.c | 9 +- net/ipv4/fib_semantics.c | 27 +- net/ipv4/netfilter/ipt_CLUSTERIP.c | 4 +- net/ipv4/netfilter/nft_reject_ipv4.c | 2 + net/ipv4/route.c | 10 +- net/ipv4/udp_offload.c | 2 +- net/ipv6/addrconf.c | 2 +- net/ipv6/ip6_fib.c | 37 +- net/ipv6/ip6_tunnel.c | 2 +- net/ipv6/netfilter/nft_reject_ipv6.c | 2 + net/ipv6/output_core.c | 6 +- net/ipv6/route.c | 26 +- net/ipv6/tcp_ipv6.c | 3 +- net/ipv6/udp_offload.c | 2 +- net/ipv6/xfrm6_policy.c | 6 +- net/key/af_key.c | 48 ++- net/l2tp/l2tp_core.c | 79 ++-- net/l2tp/l2tp_core.h | 18 +- net/l2tp/l2tp_netlink.c | 72 ++-- net/mac80211/key.c | 20 +- net/netfilter/ipvs/ip_vs_xmit.c | 2 +- net/netfilter/nft_compat.c | 6 +- net/netfilter/nft_ct.c | 8 + net/netfilter/nft_reject.c | 2 + net/packet/af_packet.c | 30 +- net/sched/sch_api.c | 2 + net/sched/sch_cbq.c | 10 +- net/sched/sch_fq_codel.c | 4 +- net/sched/sch_hfsc.c | 4 +- net/sched/sch_hhf.c | 11 +- net/sched/sch_htb.c | 5 +- net/sched/sch_mq.c | 10 +- net/sched/sch_mqprio.c | 19 +- net/sched/sch_multiq.c | 9 +- net/sched/sch_netem.c | 4 +- net/sched/sch_sfq.c | 8 +- net/sched/sch_tbf.c | 5 +- net/sctp/ipv6.c | 2 +- net/xfrm/xfrm_user.c | 2 + scripts/mod/modpost.c | 34 +- security/keys/key.c | 10 + security/keys/keyctl.c | 5 + sound/core/control.c | 2 +- sound/core/seq/seq_clientmgr.c | 6 +- sound/core/seq/seq_lock.c | 4 - sound/core/seq/seq_lock.h | 12 - sound/core/seq/seq_ports.c | 7 +- sound/pci/hda/patch_conexant.c | 1 + sound/pci/hda/patch_realtek.c | 1 + sound/soc/codecs/adau1977.c | 2 +- sound/soc/fsl/fsl_sai.c | 3 +- sound/soc/fsl/fsl_ssi.c | 4 +- sound/soc/fsl/imx-audmux.c | 8 +- sound/soc/soc-pcm.c | 4 + sound/usb/card.c | 20 + sound/usb/mixer.c | 14 +- sound/usb/mixer.h | 3 + sound/usb/mixer_quirks.c | 6 + tools/perf/ui/browser.c | 2 +- 309 files changed, 1999 insertions(+), 1321 deletions(-)
Signature · 2 lines
Ben Hutchings It is a miracle that curiosity survives formal education. - Albert Einstein
PATCH 1/294 fuse: initialize the flock flag in fuse_file on allocation
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Jurczyk <[email protected]>
commit 68227c03cba84a24faf8a7277d2b1a03c8959c2c upstream.
Before the patch, the flock flag could remain uninitialized for the lifespan of the fuse_file allocation. Unless set to true in fuse_file_flock(), it would remain in an indeterminate state until read in an if statement in fuse_release_common(). This could consequently lead to taking an unexpected branch in the code.
The bug was discovered by a runtime instrumentation designed to detect use of uninitialized memory in the kernel.
--- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +1 -1
@@ -54,7 +54,7 @@ struct fuse_file *fuse_file_alloc(struct {struct fuse_file *ff; - ff =kmalloc (sizeof (struct fuse_file ),GFP_KERNEL ); + ff =kzalloc (sizeof (struct fuse_file ),GFP_KERNEL );if (unlikely (!ff))return NULL ;
PATCH 2/294 iio: light: tsl2563: use correct event code
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Akinobu Mita <[email protected]>
commit a3507e48d3f99a93a3056a34a5365f310434570f upstream.
The TSL2563 driver provides three iio channels, two of which are raw ADC channels (channel 0 and channel 1) in the device and the remaining one is calculated by the two. The ADC channel 0 only supports programmable interrupt with threshold settings and this driver supports the event but the generated event code does not contain the corresponding iio channel type.
This is going to change userspace ABI. Hopefully fixing this to be what it should always have been won't break any userspace code.
--- drivers/iio/light/tsl2563.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/tsl2563.c +1 -1
@@ -626,7 +626,7 @@ static irqreturn_t tsl2563_event_handlerstruct tsl2563_chip *chip =iio_priv (dev_info); iio_push_event(dev_info, - IIO_UNMOD_EVENT_CODE(IIO_LIGHT, + IIO_UNMOD_EVENT_CODE(IIO_INTENSITY, 0, IIO_EV_TYPE_THRESH, IIO_EV_DIR_EITHER),
PATCH 3/294 iio: adc: vf610_adc: Fix VALT selection value for REFSEL bits
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan-Gabriel Mirea <[email protected]>
commit d466d3c1217406b14b834335b5b4b33c0d45bd09 upstream.
In order to select the alternate voltage reference pair (VALTH/VALTL), the right value for the REFSEL field in the ADCx_CFG register is "01", leading to 0x800 as register mask. See section 8.2.6.4 in the reference manual[1].
[1] http://www.nxp.com/docs/en/reference-manual/VFXXXRM.pdf
--- drivers/iio/adc/vf610_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/vf610_adc.c +1 -1
@@ -71,7 +71,7 @@#define VF610_ADC_ADSTS_MASK 0x300#define VF610_ADC_ADLPC_EN 0x80#define VF610_ADC_ADHSC_EN 0x400 -#define VF610_ADC_REFSEL_VALT 0x100 +#define VF610_ADC_REFSEL_VALT 0x800#define VF610_ADC_REFSEL_VBG 0x1000#define VF610_ADC_ADTRG_HARD 0x2000#define VF610_ADC_AVGS_8 0x4000
PATCH 4/294 Raid5 should update rdev->sectors after reshape
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
commit b5d27718f38843a74552e9a93d32e2391fd3999f upstream.
The raid5 md device is created by the disks which we don't use the total size. For example, the size of the device is 5G and it just uses 3G of the devices to create one raid5 device. Then change the chunksize and wait reshape to finish. After reshape finishing stop the raid and assemble it again. It fails.
mdadm -CR /dev/md0 -l5 -n3 /dev/loop[0-2] --size=3G --chunk=32 --assume-clean mdadm /dev/md0 --grow --chunk=64
wait reshape to finish
mdadm -S /dev/md0
mdadm -As
The error messages:
[197519.814302] md: loop1 does not have a valid v1.2 superblock, not importing! [197519.821686] md: md_import_device returned -22
After reshape the data offset is changed. It selects backwards direction in this condition. In function super_1_load it compares the available space of the underlying device with sb->data_size. The new data offset gets bigger after reshape. So super_1_load returns -EINVAL. rdev->sectors is updated in md_finish_reshape. Then sb->data_size is set in super_1_sync based on rdev->sectors. So add md_finish_reshape in end_reshape.
--- drivers/md/raid5.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/md/raid5.c +1 -3
@@ -6741,12 +6741,10 @@ static void end_reshape(struct r5conf *c {if (!test_bit (MD_RECOVERY_INTR , &conf->mddev->recovery)) { -struct md_rdev *rdev;spin_lock_irq (&conf->device_lock); conf->previous_raid_disks = conf->raid_disks; -rdev_for_each (rdev, conf->mddev) - rdev->data_offset = rdev->new_data_offset; +md_finish_reshape (conf->mddev);smp_wmb (); conf->reshape_progress = MaxSector;spin_unlock_irq (&conf->device_lock);
PATCH 5/294 perf annotate: Fix broken arrow at row 0 connecting jmp instruction to its target
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jin Yao <[email protected]>
commit 80f62589fa52f530cffc50e78c0b5a2ae572d61e upstream.
When the jump instruction is displayed at the row 0 in annotate view, the arrow is broken. An example:
16.86 │ ┌──je 82
0.01 │ movsd (%rsp),%xmm0
│ movsd 0x8(%rsp),%xmm4
│ movsd 0x8(%rsp),%xmm1
│ movsd (%rsp),%xmm3
│ divsd %xmm4,%xmm0
│ divsd %xmm3,%xmm1
│ movsd (%rsp),%xmm2
│ addsd %xmm1,%xmm0
│ addsd %xmm2,%xmm0
│ movsd %xmm0,(%rsp)
│82: sub $0x1,%ebx
83.03 │ ↑ jne 38
│ add $0x10,%rsp
│ xor %eax,%eax
│ pop %rbx
│ ← retqThe patch increments the row number before checking with 0.
--- tools/perf/ui/browser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browser.c +1 -1
@@ -670,7 +670,7 @@ static void __ui_browser__line_arrow_dowui_browser__gotorc (browser, row, column +1 );SLsmg_draw_hline (2 ); -if (row++ ==0 ) +if (++row ==0 ) goto out; }else row =0 ;
PATCH 6/294 net: bridge: fix dest lookup when vlan proto doesn't match
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 31a4562d7408493c6377933ff2f7d7302dbdea80 upstream.
With 802.1ad support the vlan_ingress code started checking for vlan protocol mismatch which causes the current tag to be inserted and the bridge vlan protocol & pvid to be set. The vlan tag insertion changes the skb mac_header and thus the lookup mac dest pointer which was loaded prior to calling br_allowed_ingress in br_handle_frame_finish is VLAN_HLEN bytes off now, pointing to the last two bytes of the destination mac and the first four of the source mac causing lookups to always fail and broadcasting all such packets to all ports. Same thing happens for locally originated packets when passing via br_dev_xmit. So load the dest pointer after the vlan checks and possible skb change.
--- net/bridge/br_device.c | 3 ++- net/bridge/br_input.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
net/bridge/br_device.c +2 -1
@@ -31,10 +31,10 @@ static struct lock_class_key bridge_netdnetdev_tx_t br_dev_xmit (struct sk_buff *skb,struct net_device *dev) {struct net_bridge *br =netdev_priv (dev); -const unsigned char *dest = skb->data;struct net_bridge_fdb_entry *dst;struct net_bridge_mdb_entry *mdst;struct pcpu_sw_netstats *brstats =this_cpu_ptr (br->stats); +const unsigned char *dest;u16 vid =0 ;rcu_read_lock ();
@@ -59,6 +59,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *if (!br_allowed_ingress (br,br_get_vlan_info (br), skb, &vid)) goto out; + dest =eth_hdr (skb)->h_dest;if (is_broadcast_ether_addr (dest))br_flood_deliver (br, skb, false);else if (is_multicast_ether_addr (dest)) {
net/bridge/br_input.c +2 -1
@@ -60,11 +60,11 @@ static int br_pass_frame_up(struct sk_bu/* note: already called with rcu_read_lock */ int br_handle_frame_finish (struct sk_buff *skb) { -const unsigned char *dest =eth_hdr (skb)->h_dest;struct net_bridge_port *p =br_port_get_rcu (skb->dev);struct net_bridge *br;struct net_bridge_fdb_entry *dst;struct net_bridge_mdb_entry *mdst; +const unsigned char *dest;struct sk_buff *skb2;bool unicast = true;u16 vid =0 ;
@@ -80,6 +80,7 @@ int br_handle_frame_finish(struct sk_bufif (p->flags &BR_LEARNING )br_fdb_update (br, p,eth_hdr (skb)->h_source, vid, false); + dest =eth_hdr (skb)->h_dest;if (!is_broadcast_ether_addr (dest) &&is_multicast_ether_addr (dest) &&br_multicast_rcv (br, p, skb, vid)) goto drop;
PATCH 7/294 net/packet: Fix Tx queue selection for AF_PACKET
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Iván Briano <[email protected]>
commit ccd4eb49f3392ebf989d58bd013a7bf44cdca4d6 upstream.
When PACKET_QDISC_BYPASS is not used, Tx queue selection will be done before the packet is enqueued, taking into account any mappings set by a queuing discipline such as mqprio without hardware offloading. This selection may be affected by a previously saved queue_mapping, either on the Rx path, or done before the packet reaches the device, as it's currently the case for AF_PACKET.
In order for queue selection to work as expected when using traffic control, there can't be another selection done before that point is reached, so move the call to packet_pick_tx_queue to packet_direct_xmit, leaving the default xmit path as it was before PACKET_QDISC_BYPASS was introduced.
A forward declaration of packet_pick_tx_queue() is introduced to avoid the need to reorder the functions within the file.
--- net/packet/af_packet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/packet/af_packet.c +2 -4
@@ -214,6 +214,7 @@ static void prb_clear_rxhash(struct tpacstatic void prb_fill_vlan_info (struct tpacket_kbdq_core *,struct tpacket3_hdr *);static void packet_flush_mclist (struct sock *sk); +static void packet_pick_tx_queue (struct net_device *dev,struct sk_buff *skb);struct packet_skb_cb {unsigned int origlen;
@@ -266,6 +267,7 @@ static int packet_direct_xmit(struct sk_ goto drop; } +packet_pick_tx_queue (dev, skb); queue_map =skb_get_queue_mapping (skb); txq =netdev_get_tx_queue (dev, queue_map);
@@ -2343,8 +2345,6 @@ static int tpacket_snd(struct packet_soc } } -packet_pick_tx_queue (dev, skb); - skb->destructor = tpacket_destruct_skb;__packet_set_status (po, ph,TP_STATUS_SENDING );packet_inc_pending (&po->tx_ring);
@@ -2551,8 +2551,6 @@ static int packet_snd(struct socket *soc skb->priority = sk->sk_priority; skb->mark = sk->sk_mark; -packet_pick_tx_queue (dev, skb); - if (po->has_vnet_hdr) { if (vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (!skb_partial_csum_set(skb, vnet_hdr.csum_start,
PATCH 8/294 staging:iio:resolver:ad2s1210 fix negative IIO_ANGL_VEL read
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 105967ad68d2eb1a041bc041f9cf96af2a653b65 upstream.
gcc-7 points out an older regression:
drivers/staging/iio/resolver/ad2s1210.c: In function 'ad2s1210_read_raw':drivers/staging/iio/resolver/ad2s1210.c:515:42: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
The original code had 'unsigned short' here, but incorrectly got converted to 'bool'. This reverts the regression and uses a normal type instead.
--- drivers/staging/iio/resolver/ad2s1210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/resolver/ad2s1210.c +1 -1
@@ -462,7 +462,7 @@ static int ad2s1210_read_raw(struct iio_ long m) {struct ad2s1210_state *st =iio_priv (indio_dev); -bool negative; +u16 negative;int ret =0 ;u16 pos;s16 vel;
PATCH 9/294 net: bcmgenet: check harder for out of memory conditions
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit b629be5c8399d7c423b92135eb43a86c924d1cbc upstream.
There is a potential case where we might be failing to refill a control block, leaving it with both a NULL skb pointer *and* a NULL dma_unmap_addr.
The way we process incoming packets, by first calling dma_unmap_single(), and then only checking for a potential NULL skb can lead to situations where do pass a NULL dma_unmap_addr() to dma_unmap_single(), resulting in an oops.
Fix this my moving the NULL skb check earlier, since no backing skb also means no corresponding DMA mapping for this packet.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 33 +++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +19 -14
@@ -1351,12 +1351,29 @@ static unsigned int bcmgenet_desc_rx(strwhile ((rxpktprocessed < rxpkttoprocess) && (rxpktprocessed < budget)) { + cb = &priv->rx_cbs[priv->rx_read_ptr]; + skb = cb->skb; + + rxpktprocessed++; + + priv->rx_read_ptr++; + priv->rx_read_ptr &= (priv->num_rx_bds -1 ); + +/* We do not have a backing SKB, so we do not have a +* corresponding DMA mapping for this incoming packet since +* bcmgenet_rx_refill always either has both skb and mapping or +* none. +*/ +if (unlikely (!skb)) { + dev->stats.rx_dropped++; + dev->stats.rx_errors++; + goto refill; + } +/* Unmap the packet contents such that we can use the * RSV from the 64 bytes descriptor when enabled and save * a 32-bits register read */ - cb = &priv->rx_cbs[priv->rx_read_ptr]; - skb = cb->skb;dma_unmap_single (kdev,dma_unmap_addr (cb, dma_addr), priv->rx_buf_len,DMA_FROM_DEVICE );
@@ -1382,18 +1399,6 @@ static unsigned int bcmgenet_desc_rx(str __func__, p_index, priv->rx_c_index, priv->rx_read_ptr, dma_length_status); - rxpktprocessed++; - - priv->rx_read_ptr++; - priv->rx_read_ptr &= (priv->num_rx_bds -1 ); - -/* out of memory, just drop packets at the hardware level */ -if (unlikely (!skb)) { - dev->stats.rx_dropped++; - dev->stats.rx_errors++; - goto refill; - } -if (unlikely (!(dma_flag &DMA_EOP ) || !(dma_flag &DMA_SOP ))) {netif_err (priv, rx_status, dev,"Droping fragmented packet!\n" );
PATCH 10/294 net: bcmgenet: fix off-by-one in incrementing read pointer
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit cf377d886f7944a5ccdbd164b89949e13617b096 upstream.
Commit b629be5c8399d7c423b92135eb43a86c924d1cbc ("net: bcmgenet: check harder for out of memory conditions") moved the increment of the local read pointer *before* reading from the hardware descriptor using dmadesc_get_length_status(), which creates an off-by-one situation.
Fix this by moving again the read_ptr increment after we have read the hardware descriptor to get both the control block and the read pointer back in sync.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +4 -5
@@ -1354,11 +1354,6 @@ static unsigned int bcmgenet_desc_rx(str cb = &priv->rx_cbs[priv->rx_read_ptr]; skb = cb->skb; - rxpktprocessed++; - - priv->rx_read_ptr++; - priv->rx_read_ptr &= (priv->num_rx_bds -1 ); -/* We do not have a backing SKB, so we do not have a * corresponding DMA mapping for this incoming packet since * bcmgenet_rx_refill always either has both skb and mapping or
@@ -1471,6 +1466,10 @@ refill: err =bcmgenet_rx_refill (priv, cb);if (err)netif_err (priv, rx_err, dev,"Rx refill failed\n" ); + + rxpktprocessed++; + priv->rx_read_ptr++; + priv->rx_read_ptr &= (priv->num_rx_bds -1 ); }return rxpktprocessed;
PATCH 11/294 net: bcmgenet: simplify __bcmgenet_tx_reclaim()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Petri Gynther <[email protected]>
commit 66d06757d9eb74a29775737b8c770e3b57e536d9 upstream.
1. Use c_index and ring->c_index to determine how many TxCBs/TxBDs are ready for cleanup
- c_index = the current value of TDMA_CONS_INDEX
- TDMA_CONS_INDEX is HW-incremented and auto-wraparound (0x0-0xFFFF)
- ring->c_index = __bcmgenet_tx_reclaim() cleaned up to this point on the previous invocation
2. Add bcmgenet_tx_ring->clean_ptr
- index of the next TxCB to be cleaned
- incremented as TxCBs/TxBDs are processed
- value always in range [ring->cb_ptr, ring->end_ptr]
3. Fix incrementing of dev->stats.tx_packets
- should be incremented only when tx_cb_ptr->skb != NULL
These changes simplify __bcmgenet_tx_reclaim(). Furthermore, Tx ring size can now be any value.
With the old code, Tx ring size had to be a power-of-2:
num_tx_bds = ring->size;
c_index &= (num_tx_bds - 1);
last_c_index &= (num_tx_bds - 1);
[bwh: Backported to 3.16:
- __bcmgenet_tx_reclaim() did not count completions
- In bcmgenet_init_tx_ring(), use write_ptr not start_ptr
- Adjust context]
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c +21 -21
@@ -946,34 +946,30 @@ static void __bcmgenet_tx_reclaim(struct {struct bcmgenet_priv *priv =netdev_priv (dev);struct device *kdev = &priv->pdev->dev; -int last_tx_cn, last_c_index, num_tx_bds;struct enet_cb *tx_cb_ptr;struct netdev_queue *txq;unsigned int c_index; +unsigned int txbds_ready; +unsigned int txbds_processed =0 ;/* Compute how many buffers are transmited since last xmit call */ c_index =bcmgenet_tdma_ring_readl (priv, ring->index,TDMA_CONS_INDEX ); - txq =netdev_get_tx_queue (dev, ring->queue); - - last_c_index = ring->c_index; - num_tx_bds = ring->size; + c_index &=DMA_C_INDEX_MASK ; - c_index &= (num_tx_bds -1 ); - -if (c_index >= last_c_index) - last_tx_cn = c_index - last_c_index; +if (likely (c_index >= ring->c_index)) + txbds_ready = c_index - ring->c_index;else - last_tx_cn = num_tx_bds - last_c_index + c_index; + txbds_ready = (DMA_C_INDEX_MASK +1 ) - ring->c_index + c_index;netif_dbg (priv, tx_done, dev, -"%s ring=%d index=%d last_tx_cn=%d last_index=%d\n" , - __func__, ring->index, - c_index, last_tx_cn, last_c_index); +"%s ring=%d old_c_index=%u c_index=%u txbds_ready=%u\n" , + __func__, ring->index, ring->c_index, c_index, txbds_ready);/* Reclaim transmitted buffers */ -while (last_tx_cn-- >0 ) { - tx_cb_ptr = ring->cbs + last_c_index; +while (txbds_processed < txbds_ready) { + tx_cb_ptr = &priv->tx_cbs[ring->clean_ptr];if (tx_cb_ptr->skb) { + dev->stats.tx_packets++; dev->stats.tx_bytes += tx_cb_ptr->skb->len; dma_unmap_single(kdev, dma_unmap_addr(tx_cb_ptr, dma_addr),
@@ -989,20 +985,23 @@ static void __bcmgenet_tx_reclaim(struct DMA_TO_DEVICE);dma_unmap_addr_set (tx_cb_ptr, dma_addr,0 ); } - dev->stats.tx_packets++; - ring->free_bds +=1 ; - last_c_index++; - last_c_index &= (num_tx_bds -1 ); + txbds_processed++; +if (likely (ring->clean_ptr < ring->end_ptr)) + ring->clean_ptr++; +else + ring->clean_ptr = ring->cb_ptr; } + ring->free_bds += txbds_processed; + ring->c_index = (ring->c_index + txbds_processed) &DMA_C_INDEX_MASK ; +if (ring->free_bds > (MAX_SKB_FRAGS +1 )) ring->int_disable (priv, ring); + txq =netdev_get_tx_queue (dev, ring->queue);if (netif_tx_queue_stopped (txq))netif_tx_wake_queue (txq); - - ring->c_index = c_index; } static void bcmgenet_tx_reclaim(struct net_device *dev,
@@ -1644,6 +1643,7 @@ static void bcmgenet_init_tx_ring(struct } ring->cbs = priv->tx_cbs + write_ptr; ring->size = size; + ring->clean_ptr = write_ptr; ring->c_index =0 ; ring->free_bds = size; ring->write_ptr = write_ptr;
drivers/net/ethernet/broadcom/genet/bcmgenet.h +1 -0
@@ -510,6 +510,7 @@ struct bcmgenet_tx_ring {unsigned int queue;/* queue index */ struct enet_cb *cbs;/* tx ring buffer control block*/ unsigned int size;/* size of each tx ring */ +unsigned int clean_ptr;/* Tx ring clean pointer */ unsigned int c_index;/* last consumer index of each ring*/ unsigned int free_bds;/* # of free bds for each ring */ unsigned int write_ptr;/* Tx ring write pointer SW copy */
PATCH 12/294 net: bcmgenet: rewrite bcmgenet_rx_refill()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Petri Gynther <[email protected]>
commit d6707bec598649450ee0887bf11896e525777874 upstream.
Currently, bcmgenet_desc_rx() calls bcmgenet_rx_refill() at the end of Rx packet processing loop, after the current Rx packet has already been passed to napi_gro_receive(). However, bcmgenet_rx_refill() might fail to allocate a new Rx skb, thus leaving a hole on the Rx queue where no valid Rx buffer exists.
To eliminate this situation:
1. Rewrite bcmgenet_rx_refill() to retain the current Rx skb on the Rx queue if a new replacement Rx skb can't be allocated and DMA-mapped. In this case, the data on the current Rx skb is effectively dropped.
2. Modify bcmgenet_desc_rx() to call bcmgenet_rx_refill() at the top of Rx packet processing loop, so that the new replacement Rx skb is already in place before the current Rx skb is processed.
[bwh: Backported to 3.16:
- There's no alloc_rx_buff_failed statistic
- Adjust context]
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c +42 -56
@@ -1275,33 +1275,41 @@ out:return ret; } - -static int bcmgenet_rx_refill (struct bcmgenet_priv *priv, -struct enet_cb *cb) +static struct sk_buff *bcmgenet_rx_refill (struct bcmgenet_priv *priv, +struct enet_cb *cb) {struct device *kdev = &priv->pdev->dev;struct sk_buff *skb; +struct sk_buff *rx_skb;dma_addr_t mapping; -int ret; +/* Allocate a new Rx skb */ skb =netdev_alloc_skb (priv->dev, priv->rx_buf_len +SKB_ALIGNMENT ); -if (!skb) -return -ENOMEM ; +if (!skb) { +netif_err (priv, rx_err, priv->dev, +"%s: Rx skb allocation failed\n" , __func__); +return NULL ; + } -/* a caller did not release this control block */ -WARN_ON (cb->skb !=NULL ); - cb->skb = skb; - mapping =dma_map_single (kdev, skb->data, - priv->rx_buf_len,DMA_FROM_DEVICE ); - ret =dma_mapping_error (kdev, mapping); -if (ret) { -bcmgenet_free_cb (cb); +/* DMA-map the new Rx skb */ + mapping =dma_map_single (kdev, skb->data, priv->rx_buf_len, +DMA_FROM_DEVICE ); +if (dma_mapping_error (kdev, mapping)) { +dev_kfree_skb_any (skb);netif_err (priv, rx_err, priv->dev, -"%s DMA map failed\n" , __func__); -return ret; +"%s: Rx skb DMA mapping failed\n" , __func__); +return NULL ; } +/* Grab the current Rx skb from the ring and DMA-unmap it */ + rx_skb = cb->skb; +if (likely (rx_skb)) +dma_unmap_single (kdev,dma_unmap_addr (cb, dma_addr), + priv->rx_buf_len,DMA_FROM_DEVICE ); + +/* Put the new Rx skb on the ring */ + cb->skb = skb;dma_unmap_addr_set (cb, dma_addr, mapping);/* assign packet, prepare descriptor, and advance pointer */
@@ -1314,7 +1322,8 @@ static int bcmgenet_rx_refill(struct bcm priv->rx_bd_assign_ptr = priv->rx_bds + (priv->rx_bd_assign_index *DMA_DESC_SIZE ); -return 0 ; +/* Return the current Rx skb to caller */ +return rx_skb; }/* bcmgenet_desc_rx - descriptor based rx process.
@@ -1329,7 +1338,7 @@ static unsigned int bcmgenet_desc_rx(strstruct sk_buff *skb;u32 dma_length_status;unsigned long dma_flag; -int len, err; +int len;unsigned int rxpktprocessed =0 , rxpkttoprocess;unsigned int p_index;unsigned int chksum_ok =0 ;
@@ -1351,26 +1360,14 @@ static unsigned int bcmgenet_desc_rx(str (rxpktprocessed < budget)) { cb = &priv->rx_cbs[priv->rx_read_ptr]; - skb = cb->skb; + skb =bcmgenet_rx_refill (priv, cb); -/* We do not have a backing SKB, so we do not have a -* corresponding DMA mapping for this incoming packet since -* bcmgenet_rx_refill always either has both skb and mapping or -* none. -*/ if (unlikely (!skb)) { dev->stats.rx_dropped++; dev->stats.rx_errors++; - goto refill; + goto next; } -/* Unmap the packet contents such that we can use the -* RSV from the 64 bytes descriptor when enabled and save -* a 32-bits register read -*/ -dma_unmap_single (kdev,dma_unmap_addr (cb, dma_addr), - priv->rx_buf_len,DMA_FROM_DEVICE ); -if (!priv->desc_64b_en) { dma_length_status = dmadesc_get_length_status(priv, priv->rx_bds +
@@ -1398,10 +1395,10 @@ static unsigned int bcmgenet_desc_rx(str "Droping fragmented packet!\n"); dev->stats.rx_dropped++; dev->stats.rx_errors++; -dev_kfree_skb_any (cb->skb); - cb->skb =NULL ; - goto refill; +dev_kfree_skb_any (skb); + goto next; } +/* report errors */ if (unlikely(dma_flag & (DMA_RX_CRC_ERROR | DMA_RX_OV |
@@ -1420,11 +1417,8 @@ static unsigned int bcmgenet_desc_rx(str dev->stats.rx_length_errors++; dev->stats.rx_dropped++; dev->stats.rx_errors++; - -/* discard the packet and advance consumer index.*/ -dev_kfree_skb_any (cb->skb); - cb->skb =NULL ; - goto refill; +dev_kfree_skb_any (skb); + goto next; }/* error packet */ chksum_ok = (dma_flag & priv->dma_rx_chk_bit) &&
@@ -1457,15 +1451,9 @@ static unsigned int bcmgenet_desc_rx(str/* Notify kernel */ napi_gro_receive (&priv->napi, skb); - cb->skb =NULL ;netif_dbg (priv, rx_status, dev,"pushed up to kernel\n" ); -/* refill RX path on the current control block */ -refill: - err =bcmgenet_rx_refill (priv, cb); -if (err) -netif_err (priv, rx_err, dev,"Rx refill failed\n" ); - +next: rxpktprocessed++; priv->rx_read_ptr++; priv->rx_read_ptr &= (priv->num_rx_bds -1 );
@@ -1478,7 +1466,7 @@ refill:static int bcmgenet_alloc_rx_buffers (struct bcmgenet_priv *priv) {struct enet_cb *cb; -int ret =0 ; +struct sk_buff *skb;int i;netif_dbg (priv, hw, priv->dev,"%s:\n" , __func__);
@@ -1486,16 +1474,14 @@ static int bcmgenet_alloc_rx_buffers(str/* loop here for each buffer needing assign */ for (i =0 ; i < priv->num_rx_bds; i++) { cb = &priv->rx_cbs[priv->rx_bd_assign_index]; -if (cb->skb) -continue ; - - ret =bcmgenet_rx_refill (priv, cb); -if (ret) -break ; - + skb =bcmgenet_rx_refill (priv, cb); +if (skb) +dev_kfree_skb_any (skb); +if (!cb->skb) +return -ENOMEM ; } -return ret; +return 0 ; }static void bcmgenet_free_rx_buffers (struct bcmgenet_priv *priv)
PATCH 13/294 net: bcmgenet: update ring producer index and buffer count in xmit
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit ae67bf0188cbb9d1786bdfcca9e1976cb36ee327 upstream.
There is no need to have both bcmgenet_xmit_single() and bcmgenet_xmit_frag() perform a free_bds decrement and a prod_index increment by one. In case one of these functions fails to map a SKB or fragment for transmit, we will return and exit bcmgenet_xmit() with an error.
We can therefore safely use our local copy of nr_frags to know by how much we should decrement the number of free buffers available, and by how much the producer count must be incremented and do this in the tail of bcmgenet_xmit().
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +5 -13
@@ -1071,11 +1071,6 @@ static int bcmgenet_xmit_single(struct ndmadesc_set (priv, tx_cb_ptr->bd_addr, mapping, length_status); -/* Decrement total BD count and advance our write pointer */ - ring->free_bds -=1 ; - ring->prod_index +=1 ; - ring->prod_index &=DMA_P_INDEX_MASK ; -return 0 ; }
@@ -1113,11 +1108,6 @@ static int bcmgenet_xmit_frag(struct net (frag->size <<DMA_BUFLENGTH_SHIFT ) | dma_desc_flags | (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT)); - - ring->free_bds -=1 ; - ring->prod_index +=1 ; - ring->prod_index &=DMA_P_INDEX_MASK ; -return 0 ; }
@@ -1258,9 +1248,11 @@ static netdev_tx_t bcmgenet_xmit(structskb_tx_timestamp (skb); -/* we kept a software copy of how much we should advance the TDMA -* producer index, now write it down to the hardware -*/ +/* Decrement total BD count and advance our write pointer */ + ring->free_bds -= nr_frags +1 ; + ring->prod_index += nr_frags +1 ; + ring->prod_index &=DMA_P_INDEX_MASK ; +bcmgenet_tdma_ring_writel (priv, ring->index, ring->prod_index,TDMA_PROD_INDEX );
PATCH 14/294 net: bcmgenet: fix dev->stats.tx_bytes accounting
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Petri Gynther <[email protected]>
commit 55868120a3e5420bf5aa26a816c07d691579c9e6 upstream.
1. Add bytes_compl local variable to __bcmgenet_tx_reclaim() to collect transmitted bytes. dev->stats updates can then be moved outside the while-loop. bytes_compl is also needed for future BQL support.
2. When bcmgenet device uses Tx checksum offload, each transmitted skb gets an extra 64-byte header prepended to it. Before this header is prepended to the skb, we need to save the skb "wire" length in GENET_CB(skb)->bytes_sent, so that proper Tx bytes accounting can be done in __bcmgenet_tx_reclaim().
3. skb->len covers the entire length of skb, whether it is linear or fragmented. Thus, when we clean the fragments, do not increase transmitted bytes.
[bwh: Backported to 3.16:
- Also update tx_packets accounting, as done in upstream commit 4092e6acf5cb "net: bcmgenet: fix throughtput regression"
- Adjust context]
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c +12 -4
@@ -948,6 +948,8 @@ static void __bcmgenet_tx_reclaim(structstruct device *kdev = &priv->pdev->dev;struct enet_cb *tx_cb_ptr;struct netdev_queue *txq; +unsigned int pkts_compl =0 ; +unsigned int bytes_compl =0 ;unsigned int c_index;unsigned int txbds_ready;unsigned int txbds_processed =0 ;
@@ -969,16 +971,14 @@ static void __bcmgenet_tx_reclaim(structwhile (txbds_processed < txbds_ready) { tx_cb_ptr = &priv->tx_cbs[ring->clean_ptr];if (tx_cb_ptr->skb) { - dev->stats.tx_packets++; - dev->stats.tx_bytes += tx_cb_ptr->skb->len; + pkts_compl++; + bytes_compl +=GENET_CB (tx_cb_ptr->skb)->bytes_sent;dma_unmap_single (kdev,dma_unmap_addr (tx_cb_ptr, dma_addr),dma_unmap_len (tx_cb_ptr, dma_len),DMA_TO_DEVICE );bcmgenet_free_cb (tx_cb_ptr); }else if (dma_unmap_addr (tx_cb_ptr, dma_addr)) { - dev->stats.tx_bytes += -dma_unmap_len (tx_cb_ptr, dma_len); dma_unmap_page(kdev, dma_unmap_addr(tx_cb_ptr, dma_addr), dma_unmap_len(tx_cb_ptr, dma_len),
@@ -996,6 +996,9 @@ static void __bcmgenet_tx_reclaim(struct ring->free_bds += txbds_processed; ring->c_index = (ring->c_index + txbds_processed) &DMA_C_INDEX_MASK ; + dev->stats.tx_packets += pkts_compl; + dev->stats.tx_bytes += bytes_compl; +if (ring->free_bds > (MAX_SKB_FRAGS +1 )) ring->int_disable (priv, ring);
@@ -1215,6 +1218,11 @@ static netdev_tx_t bcmgenet_xmit(struct goto out; } +/* Retain how many bytes will be sent on the wire, without TSB inserted +* by transmit checksum offload +*/ +GENET_CB (skb)->bytes_sent = skb->len; +/* set the SKB transmit checksum */ if (priv->desc_64b_en) { ret =bcmgenet_put_tx_csum (dev, skb);
drivers/net/ethernet/broadcom/genet/bcmgenet.h +6 -0
@@ -504,6 +504,12 @@ struct bcmgenet_hw_params {u32 flags; }; +struct bcmgenet_skb_cb { +unsigned int bytes_sent;/* bytes on the wire (no TSB) */ +}; + +#define GENET_CB (skb) ((struct bcmgenet_skb_cb *)((skb)->cb)) +struct bcmgenet_tx_ring {spinlock_t lock;/* ring lock */ unsigned int index;/* ring index */
PATCH 15/294 net: bcmgenet: cleanup for bcmgenet_xmit_frag()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Petri Gynther <[email protected]>
commit 824ba603573d910e32df75fe6a5e7d7ec2a0a6a7 upstream.
Add frag_size = skb_frag_size(frag) and use it when needed.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +7 -4
@@ -1086,6 +1086,7 @@ static int bcmgenet_xmit_frag(struct netstruct bcmgenet_priv *priv =netdev_priv (dev);struct device *kdev = &priv->pdev->dev;struct enet_cb *tx_cb_ptr; +unsigned int frag_size;dma_addr_t mapping;int ret;
@@ -1093,10 +1094,12 @@ static int bcmgenet_xmit_frag(struct netif (unlikely (!tx_cb_ptr))BUG (); + tx_cb_ptr->skb =NULL ; - mapping =skb_frag_dma_map (kdev, frag,0 , -skb_frag_size (frag),DMA_TO_DEVICE ); + frag_size =skb_frag_size (frag); + + mapping =skb_frag_dma_map (kdev, frag,0 , frag_size,DMA_TO_DEVICE ); ret =dma_mapping_error (kdev, mapping);if (ret) { netif_err(priv, tx_err, dev, "%s: Tx DMA map failed\n",
@@ -1105,10 +1108,10 @@ static int bcmgenet_xmit_frag(struct net }dma_unmap_addr_set (tx_cb_ptr, dma_addr, mapping); -dma_unmap_len_set (tx_cb_ptr, dma_len, frag->size); +dma_unmap_len_set (tx_cb_ptr, dma_len, frag_size);dmadesc_set (priv, tx_cb_ptr->bd_addr, mapping, - (frag->size <<DMA_BUFLENGTH_SHIFT ) | dma_desc_flags | + (frag_size <<DMA_BUFLENGTH_SHIFT ) | dma_desc_flags | (priv->hw_params->qtag_mask <<DMA_TX_QTAG_SHIFT ));return 0 ;
PATCH 16/294 net: bcmgenet: Fix unmapping of fragments in bcmgenet_xmit()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Doug Berger <[email protected]>
commit 876dbadd53a7102e2a84afc84ea2bd3ee6dc5636 upstream.
In case we fail to map a single fragment, we would be leaving the transmit ring populated with stale entries.
This commit introduces the helper function bcmgenet_put_txcb() which takes care of rewinding the per-ring write pointer back to where we left.
It also consolidates the functionality of bcmgenet_xmit_single() and bcmgenet_xmit_frag() into the bcmgenet_xmit() function to make the unmapping of control blocks cleaner.
[bwh: Backported to 3.16:
- There's no tx_dma_failed statistic
- Adjust context]
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 191 +++++++++++-------------- 1 file changed, 85 insertions(+), 106 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +85 -104
@@ -900,6 +900,23 @@ static struct enet_cb *bcmgenet_get_txcbreturn tx_cb_ptr; } +static struct enet_cb *bcmgenet_put_txcb (struct bcmgenet_priv *priv, +struct bcmgenet_tx_ring *ring) +{ +struct enet_cb *tx_cb_ptr; + + tx_cb_ptr = ring->cbs; + tx_cb_ptr += ring->write_ptr - ring->cb_ptr; + +/* Rewinding local write pointer */ +if (ring->write_ptr == ring->cb_ptr) + ring->write_ptr = ring->end_ptr; +else + ring->write_ptr--; + +return tx_cb_ptr; +} +/* Simple helper to free a control block's resources */ static void bcmgenet_free_cb (struct enet_cb *cb) {
@@ -1030,93 +1047,6 @@ static void bcmgenet_tx_reclaim_all(strubcmgenet_tx_reclaim (dev, &priv->tx_rings[DESC_INDEX ]); } -/* Transmits a single SKB (either head of a fragment or a single SKB) -* caller must hold priv->lock -*/ -static int bcmgenet_xmit_single (struct net_device *dev, -struct sk_buff *skb, -u16 dma_desc_flags, -struct bcmgenet_tx_ring *ring) -{ -struct bcmgenet_priv *priv =netdev_priv (dev); -struct device *kdev = &priv->pdev->dev; -struct enet_cb *tx_cb_ptr; -unsigned int skb_len; -dma_addr_t mapping; -u32 length_status; -int ret; - - tx_cb_ptr =bcmgenet_get_txcb (priv, ring); - -if (unlikely (!tx_cb_ptr)) -BUG (); - - tx_cb_ptr->skb = skb; - - skb_len =skb_headlen (skb); - - mapping =dma_map_single (kdev, skb->data, skb_len,DMA_TO_DEVICE ); - ret =dma_mapping_error (kdev, mapping); -if (ret) { -netif_err (priv, tx_err, dev,"Tx DMA map failed\n" ); -dev_kfree_skb (skb); -return ret; - } - -dma_unmap_addr_set (tx_cb_ptr, dma_addr, mapping); -dma_unmap_len_set (tx_cb_ptr, dma_len, skb_len); - length_status = (skb_len <<DMA_BUFLENGTH_SHIFT ) | dma_desc_flags | - (priv->hw_params->qtag_mask <<DMA_TX_QTAG_SHIFT ) | -DMA_TX_APPEND_CRC ; - -if (skb->ip_summed ==CHECKSUM_PARTIAL ) - length_status |=DMA_TX_DO_CSUM ; - -dmadesc_set (priv, tx_cb_ptr->bd_addr, mapping, length_status); - -return 0 ; -} - -/* Transmit a SKB fragement */ -static int bcmgenet_xmit_frag (struct net_device *dev, -skb_frag_t *frag, -u16 dma_desc_flags, -struct bcmgenet_tx_ring *ring) -{ -struct bcmgenet_priv *priv =netdev_priv (dev); -struct device *kdev = &priv->pdev->dev; -struct enet_cb *tx_cb_ptr; -unsigned int frag_size; -dma_addr_t mapping; -int ret; - - tx_cb_ptr =bcmgenet_get_txcb (priv, ring); - -if (unlikely (!tx_cb_ptr)) -BUG (); - - tx_cb_ptr->skb =NULL ; - - frag_size =skb_frag_size (frag); - - mapping =skb_frag_dma_map (kdev, frag,0 , frag_size,DMA_TO_DEVICE ); - ret =dma_mapping_error (kdev, mapping); -if (ret) { -netif_err (priv, tx_err, dev,"%s: Tx DMA map failed\n" , - __func__); -return ret; - } - -dma_unmap_addr_set (tx_cb_ptr, dma_addr, mapping); -dma_unmap_len_set (tx_cb_ptr, dma_len, frag_size); - -dmadesc_set (priv, tx_cb_ptr->bd_addr, mapping, - (frag_size <<DMA_BUFLENGTH_SHIFT ) | dma_desc_flags | - (priv->hw_params->qtag_mask <<DMA_TX_QTAG_SHIFT )); - -return 0 ; -} -/* Reallocate the SKB to put enough headroom in front of it and insert * the transmit checksum offsets in the descriptors */
@@ -1182,11 +1112,16 @@ static int bcmgenet_put_tx_csum(struct nstatic netdev_tx_t bcmgenet_xmit (struct sk_buff *skb,struct net_device *dev) {struct bcmgenet_priv *priv =netdev_priv (dev); +struct device *kdev = &priv->pdev->dev;struct bcmgenet_tx_ring *ring =NULL ; +struct enet_cb *tx_cb_ptr;struct netdev_queue *txq;unsigned long flags =0 ;int nr_frags, index; -u16 dma_desc_flags; +dma_addr_t mapping; +unsigned int size; +skb_frag_t *frag; +u32 len_stat;int ret;int i;
@@ -1235,26 +1170,48 @@ static netdev_tx_t bcmgenet_xmit(struct } } - dma_desc_flags =DMA_SOP ; -if (nr_frags ==0 ) - dma_desc_flags |=DMA_EOP ; - -/* Transmit single SKB or head of fragment list */ - ret =bcmgenet_xmit_single (dev, skb, dma_desc_flags, ring); -if (ret) { - ret =NETDEV_TX_OK ; - goto out; - } +for (i =0 ; i <= nr_frags; i++) { + tx_cb_ptr =bcmgenet_get_txcb (priv, ring); -/* xmit fragment */ -for (i =0 ; i < nr_frags; i++) { - ret =bcmgenet_xmit_frag (dev, - &skb_shinfo (skb)->frags[i], - (i == nr_frags -1 ) ?DMA_EOP :0 , ring); +if (unlikely (!tx_cb_ptr)) +BUG (); + +if (!i) { +/* Transmit single SKB or head of fragment list */ + tx_cb_ptr->skb = skb; + size =skb_headlen (skb); + mapping =dma_map_single (kdev, skb->data, size, +DMA_TO_DEVICE ); + }else { +/* xmit fragment */ + tx_cb_ptr->skb =NULL ; + frag = &skb_shinfo (skb)->frags[i -1 ]; + size =skb_frag_size (frag); + mapping =skb_frag_dma_map (kdev, frag,0 , size, +DMA_TO_DEVICE ); + } + + ret =dma_mapping_error (kdev, mapping);if (ret) { +netif_err (priv, tx_err, dev,"Tx DMA map failed\n" ); ret =NETDEV_TX_OK ; - goto out; + goto out_unmap_frags; } +dma_unmap_addr_set (tx_cb_ptr, dma_addr, mapping); +dma_unmap_len_set (tx_cb_ptr, dma_len, size); + + len_stat = (size <<DMA_BUFLENGTH_SHIFT ) | + (priv->hw_params->qtag_mask <<DMA_TX_QTAG_SHIFT ); + +if (!i) { + len_stat |=DMA_TX_APPEND_CRC |DMA_SOP ; +if (skb->ip_summed ==CHECKSUM_PARTIAL ) + len_stat |=DMA_TX_DO_CSUM ; + } +if (i == nr_frags) + len_stat |=DMA_EOP ; + +dmadesc_set (priv, tx_cb_ptr->bd_addr, mapping, len_stat); }skb_tx_timestamp (skb);
@@ -1276,6 +1233,30 @@ out:spin_unlock_irqrestore (&ring->lock, flags);return ret; + +out_unmap_frags: +/* Back up for failed control block mapping */ +bcmgenet_put_txcb (priv, ring); + +/* Unmap successfully mapped control blocks */ +while (i-- >0 ) { + tx_cb_ptr =bcmgenet_put_txcb (priv, ring); +if (tx_cb_ptr->skb) +dma_unmap_single (kdev, +dma_unmap_addr (tx_cb_ptr, dma_addr), +dma_unmap_len (tx_cb_ptr, dma_len), +DMA_TO_DEVICE ); +else +dma_unmap_page (kdev, +dma_unmap_addr (tx_cb_ptr, dma_addr), +dma_unmap_len (tx_cb_ptr, dma_len), +DMA_TO_DEVICE ); +dma_unmap_addr_set (tx_cb_ptr, dma_addr,0 ); + tx_cb_ptr->skb =NULL ; + } + +dev_kfree_skb (skb); + goto out; } static struct sk_buff *bcmgenet_rx_refill(struct bcmgenet_priv *priv,
PATCH 17/294 net: bcmgenet: Free skb after last Tx frag
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Doug Berger <[email protected]>
commit f48bed16a756f5bc0244acd581f61968f7d7c2a4 upstream.
Since the skb is attached to the first control block of a fragmented skb it is possible that the skb could be freed when reclaiming that control block before all fragments of the skb have been consumed by the hardware and unmapped.
This commit introduces first_cb and last_cb pointers to the skb control block used by the driver to keep track of which transmit control blocks within a transmit ring are the first and last ones associated with the skb.
It then splits the bcmgenet_free_cb() function into transmit (bcmgenet_free_tx_cb) and receive (bcmgenet_free_rx_cb) versions that can handle the unmapping of dma mapped memory and cleaning up the corresponding control block structure so that the skb is only freed after the last associated transmit control block is reclaimed.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 142 ++++++++++++++----------- drivers/net/ethernet/broadcom/genet/bcmgenet.h | 2 + 2 files changed, 84 insertions(+), 60 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +81 -59
@@ -917,14 +917,6 @@ static struct enet_cb *bcmgenet_put_txcbreturn tx_cb_ptr; } -/* Simple helper to free a control block's resources */ -static void bcmgenet_free_cb (struct enet_cb *cb) -{ -dev_kfree_skb_any (cb->skb); - cb->skb =NULL ; -dma_unmap_addr_set (cb, dma_addr,0 ); -} -static inline void bcmgenet_tx_ring16_int_disable (struct bcmgenet_priv *priv,struct bcmgenet_tx_ring *ring) {
@@ -957,19 +949,73 @@ static inline void bcmgenet_tx_ring_int_ priv->int1_mask |= (1 << ring->index); } +/* Simple helper to free a transmit control block's resources +* Returns an skb when the last transmit control block associated with the +* skb is freed. The skb should be freed by the caller if necessary. +*/ +static struct sk_buff *bcmgenet_free_tx_cb (struct device *dev, +struct enet_cb *cb) +{ +struct sk_buff *skb; + + skb = cb->skb; + +if (skb) { + cb->skb =NULL ; +if (cb ==GENET_CB (skb)->first_cb) +dma_unmap_single (dev,dma_unmap_addr (cb, dma_addr), +dma_unmap_len (cb, dma_len), +DMA_TO_DEVICE ); +else +dma_unmap_page (dev,dma_unmap_addr (cb, dma_addr), +dma_unmap_len (cb, dma_len), +DMA_TO_DEVICE ); +dma_unmap_addr_set (cb, dma_addr,0 ); + +if (cb ==GENET_CB (skb)->last_cb) +return skb; + + }else if (dma_unmap_addr (cb, dma_addr)) { +dma_unmap_page (dev, +dma_unmap_addr (cb, dma_addr), +dma_unmap_len (cb, dma_len), +DMA_TO_DEVICE ); +dma_unmap_addr_set (cb, dma_addr,0 ); + } + +return 0 ; +} + +/* Simple helper to free a receive control block's resources */ +static struct sk_buff *bcmgenet_free_rx_cb (struct device *dev, +struct enet_cb *cb) +{ +struct sk_buff *skb; + + skb = cb->skb; + cb->skb =NULL ; + +if (dma_unmap_addr (cb, dma_addr)) { +dma_unmap_single (dev,dma_unmap_addr (cb, dma_addr), +dma_unmap_len (cb, dma_len),DMA_FROM_DEVICE ); +dma_unmap_addr_set (cb, dma_addr,0 ); + } + +return skb; +} +/* Unlocked version of the reclaim routine */ static void __bcmgenet_tx_reclaim (struct net_device *dev,struct bcmgenet_tx_ring *ring) {struct bcmgenet_priv *priv =netdev_priv (dev); -struct device *kdev = &priv->pdev->dev; -struct enet_cb *tx_cb_ptr;struct netdev_queue *txq; -unsigned int pkts_compl =0 ; +unsigned int txbds_processed =0 ;unsigned int bytes_compl =0 ; -unsigned int c_index; +unsigned int pkts_compl =0 ;unsigned int txbds_ready; -unsigned int txbds_processed =0 ; +unsigned int c_index; +struct sk_buff *skb;/* Compute how many buffers are transmited since last xmit call */ c_index =bcmgenet_tdma_ring_readl (priv, ring->index,TDMA_CONS_INDEX );
@@ -986,21 +1032,12 @@ static void __bcmgenet_tx_reclaim(struct/* Reclaim transmitted buffers */ while (txbds_processed < txbds_ready) { - tx_cb_ptr = &priv->tx_cbs[ring->clean_ptr]; -if (tx_cb_ptr->skb) { + skb =bcmgenet_free_tx_cb (&priv->pdev->dev, + &priv->tx_cbs[ring->clean_ptr]); +if (skb) { pkts_compl++; - bytes_compl +=GENET_CB (tx_cb_ptr->skb)->bytes_sent; -dma_unmap_single (kdev, -dma_unmap_addr (tx_cb_ptr, dma_addr), -dma_unmap_len (tx_cb_ptr, dma_len), -DMA_TO_DEVICE ); -bcmgenet_free_cb (tx_cb_ptr); - }else if (dma_unmap_addr (tx_cb_ptr, dma_addr)) { -dma_unmap_page (kdev, -dma_unmap_addr (tx_cb_ptr, dma_addr), -dma_unmap_len (tx_cb_ptr, dma_len), -DMA_TO_DEVICE ); -dma_unmap_addr_set (tx_cb_ptr, dma_addr,0 ); + bytes_compl +=GENET_CB (skb)->bytes_sent; +dev_kfree_skb_any (skb); } txbds_processed++;
@@ -1178,13 +1215,12 @@ static netdev_tx_t bcmgenet_xmit(structif (!i) {/* Transmit single SKB or head of fragment list */ - tx_cb_ptr->skb = skb; +GENET_CB (skb)->first_cb = tx_cb_ptr; size =skb_headlen (skb); mapping =dma_map_single (kdev, skb->data, size,DMA_TO_DEVICE ); }else {/* xmit fragment */ - tx_cb_ptr->skb =NULL ; frag = &skb_shinfo (skb)->frags[i -1 ]; size =skb_frag_size (frag); mapping = skb_frag_dma_map(kdev, frag, 0, size,
@@ -1200,6 +1236,8 @@ static netdev_tx_t bcmgenet_xmit(structdma_unmap_addr_set (tx_cb_ptr, dma_addr, mapping);dma_unmap_len_set (tx_cb_ptr, dma_len, size); + tx_cb_ptr->skb = skb; + len_stat = (size <<DMA_BUFLENGTH_SHIFT ) | (priv->hw_params->qtag_mask <<DMA_TX_QTAG_SHIFT );
@@ -1214,6 +1252,7 @@ static netdev_tx_t bcmgenet_xmit(structdmadesc_set (priv, tx_cb_ptr->bd_addr, mapping, len_stat); } +GENET_CB (skb)->last_cb = tx_cb_ptr;skb_tx_timestamp (skb);/* Decrement total BD count and advance our write pointer */
@@ -1241,18 +1280,7 @@ out_unmap_frags:/* Unmap successfully mapped control blocks */ while (i-- >0 ) { tx_cb_ptr =bcmgenet_put_txcb (priv, ring); -if (tx_cb_ptr->skb) -dma_unmap_single (kdev, -dma_unmap_addr (tx_cb_ptr, dma_addr), -dma_unmap_len (tx_cb_ptr, dma_len), -DMA_TO_DEVICE ); -else -dma_unmap_page (kdev, -dma_unmap_addr (tx_cb_ptr, dma_addr), -dma_unmap_len (tx_cb_ptr, dma_len), -DMA_TO_DEVICE ); -dma_unmap_addr_set (tx_cb_ptr, dma_addr,0 ); - tx_cb_ptr->skb =NULL ; +bcmgenet_free_tx_cb (kdev, tx_cb_ptr); }dev_kfree_skb (skb);
@@ -1287,14 +1315,12 @@ static struct sk_buff *bcmgenet_rx_refil }/* Grab the current Rx skb from the ring and DMA-unmap it */ - rx_skb = cb->skb; -if (likely (rx_skb)) -dma_unmap_single (kdev,dma_unmap_addr (cb, dma_addr), - priv->rx_buf_len,DMA_FROM_DEVICE ); + rx_skb =bcmgenet_free_rx_cb (kdev, cb);/* Put the new Rx skb on the ring */ cb->skb = skb;dma_unmap_addr_set (cb, dma_addr, mapping); +dma_unmap_len_set (cb, dma_len, priv->rx_buf_len);/* assign packet, prepare descriptor, and advance pointer */ dmadesc_set_addr (priv, priv->rx_bd_assign_ptr, mapping);
@@ -1470,22 +1496,16 @@ static int bcmgenet_alloc_rx_buffers(strstatic void bcmgenet_free_rx_buffers (struct bcmgenet_priv *priv) { -struct device *kdev = &priv->pdev->dev; +struct sk_buff *skb;struct enet_cb *cb;int i;for (i =0 ; i < priv->num_rx_bds; i++) { cb = &priv->rx_cbs[i]; -if (dma_unmap_addr (cb, dma_addr)) { -dma_unmap_single (kdev, -dma_unmap_addr (cb, dma_addr), - priv->rx_buf_len,DMA_FROM_DEVICE ); -dma_unmap_addr_set (cb, dma_addr,0 ); - } - -if (cb->skb) -bcmgenet_free_cb (cb); + skb =bcmgenet_free_rx_cb (&priv->pdev->dev, cb); +if (skb) +dev_kfree_skb_any (skb); } }
@@ -1762,6 +1782,8 @@ static void bcmgenet_init_multiq(structstatic void bcmgenet_fini_dma (struct bcmgenet_priv *priv) { +struct sk_buff *skb; +struct enet_cb *cb;int i;/* disable DMA */
@@ -1769,10 +1791,10 @@ static void bcmgenet_fini_dma(struct bcmbcmgenet_tdma_writel (priv,0 ,DMA_CTRL );for (i =0 ; i < priv->num_tx_bds; i++) { -if (priv->tx_cbs[i].skb !=NULL ) { -dev_kfree_skb (priv->tx_cbs[i].skb); - priv->tx_cbs[i].skb =NULL ; - } + cb = priv->tx_cbs + i; + skb =bcmgenet_free_tx_cb (&priv->pdev->dev, cb); +if (skb) +dev_kfree_skb (skb); }bcmgenet_free_rx_buffers (priv);
drivers/net/ethernet/broadcom/genet/bcmgenet.h +2 -0
@@ -505,6 +505,8 @@ struct bcmgenet_hw_params { };struct bcmgenet_skb_cb { +struct enet_cb *first_cb;/* First control block of SKB */ +struct enet_cb *last_cb;/* Last control block of SKB */ unsigned int bytes_sent;/* bytes on the wire (no TSB) */ };
PATCH 18/294 i2c: mux: pinctrl: mention correct module name in Kconfig help text
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chris Gorman <[email protected]>
commit d1510a2e5ab6cb3a67f1c55ca5e7a6d2c6dec340 upstream.
Kconfig says the resulting module is pinctrl-i2cmux, but the module when built is i2c-mux-pinctrl.
--- drivers/i2c/muxes/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/Kconfig +1 -1
@@ -58,6 +58,6 @@ config I2C_MUX_PINCTRL different sets of pins at run-time. This driver can also be built as a module. If so, the module will be - called pinctrl-i2cmux. + called i2c-mux-pinctrl. endmenu
PATCH 19/294 USB: serial: cp210x: add support for Qivicon USB ZigBee dongle
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Triller <[email protected]>
commit 9585e340db9f6cc1c0928d82c3a23cc4460f0a3f upstream.
The German Telekom offers a ZigBee USB Stick under the brand name Qivicon for their SmartHome Home Base in its 1. Generation. The productId is not known by the according kernel module, this patch adds support for it.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -135,6 +135,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ { USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */ + { USB_DEVICE(0x10C4, 0x8B34) }, /* Qivicon ZigBee USB Radio Stick */ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
PATCH 20/294 USB: cdc-acm: add device-id for quirky printer
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit fe855789d605590e57f9cd968d85ecce46f5c3fd upstream.
Add device-id entry for DATECS FP-2000 fiscal printer needing the NO_UNION_NORMAL quirk.
--- drivers/usb/class/cdc-acm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/class/cdc-acm.c +3 -0
@@ -1772,6 +1772,9 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */ .driver_info =NO_UNION_NORMAL ,/* reports zero length descriptor */ }, + { USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */ + .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ + }, { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ .driver_info = CLEAR_HALT_CONDITIONS,
PATCH 21/294 usb: storage: return on error to avoid a null pointer dereference
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 446230f52a5bef593554510302465eabab45a372 upstream.
When us->extra is null the driver is not initialized, however, a later call to osd200_scsi_to_ata is made that dereferences us->extra, causing a null pointer dereference. The code currently detects and reports that the driver is not initialized; add a return to avoid the subsequent dereference issue in this check.
Thanks to Alan Stern for pointing out that srb->result needs setting to DID_ERROR << 16
Detected by CoverityScan, CID#100308 ("Dereference after null check")
--- drivers/usb/storage/isd200.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/storage/isd200.c +4 -1
@@ -1522,8 +1522,11 @@ static void isd200_ata_command(struct sc/* Make sure driver was initialized */ -if (us->extra ==NULL ) +if (us->extra ==NULL ) {usb_stor_dbg (us,"ERROR Driver not initialized\n" ); + srb->result =DID_ERROR <<16 ; +return ; + }scsi_set_resid (srb,0 );/* scsi_bufflen might change in protocol translation to ata */
PATCH 22/294 libceph: potential NULL dereference in ceph_msg_data_create()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 7c40b22f6f84c98a1d36e6d0a4346e58f05e45d8 upstream.
If kmem_cache_zalloc() returns NULL then the INIT_LIST_HEAD(&data->links); will Oops. The callers aren't really prepared for NULL returns so it doesn't make a lot of difference in real life.
--- net/ceph/messenger.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ceph/messenger.c +4 -2
@@ -3075,8 +3075,10 @@ static struct ceph_msg_data *ceph_msg_dareturn NULL ; data =kmem_cache_zalloc (ceph_msg_data_cache,GFP_NOFS ); -if (data) - data->type = type; +if (!data) +return NULL ; + + data->type = type;INIT_LIST_HEAD (&data->links);return data;
PATCH 23/294 of: device: Export of_device_{get_modalias, uvent_modalias} to modules
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
commit 7a3b7cd332db08546f3cdd984f11773e0d1999e7 upstream.
The ULPI bus can be built as a module, and it will soon be calling these functions when it supports probing devices from DT. Export them so they can be used by the ULPI module.
--- drivers/of/device.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/of/device.c +2 -0
@@ -128,6 +128,7 @@ ssize_t of_device_get_modalias(struct dereturn tsize; } +EXPORT_SYMBOL_GPL (of_device_get_modalias);/** * of_device_uevent - Display OF related uevent information
@@ -190,3 +191,4 @@ int of_device_uevent_modalias(struct devreturn 0 ; } +EXPORT_SYMBOL_GPL (of_device_uevent_modalias);
PATCH 24/294 spmi: Include OF based modalias in device uevent
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
commit d50daa2af2618dab6d21634e65a5fbcf4ae437d6 upstream.
Include the OF-based modalias in the uevent sent when registering SPMI devices, so that user space has a chance to autoload the kernel module for the device.
--- drivers/spmi/spmi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/spmi/spmi.c +12 -0
@@ -354,11 +354,23 @@ static int spmi_drv_remove(struct devicereturn 0 ; } +static int spmi_drv_uevent (struct device *dev,struct kobj_uevent_env *env) +{ +int ret; + + ret =of_device_uevent_modalias (dev, env); +if (ret != -ENODEV ) +return ret; + +return 0 ; +} +static struct bus_type spmi_bus_type = { .name ="spmi" , .match = spmi_device_match, .probe = spmi_drv_probe, .remove = spmi_drv_remove, + .uevent = spmi_drv_uevent, };/**
PATCH 25/294 ASoC: do not close shared backend dailink
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Banajit Goswami <[email protected]>
commit b1cd2e34c69a2f3988786af451b6e17967c293a0 upstream.
Multiple frontend dailinks may be connected to a backend dailink at the same time. When one of frontend dailinks is closed, the associated backend dailink should not be closed if it is connected to other active frontend dailinks. Change ensures that backend dailink is closed only after all connected frontend dailinks are closed.
--- sound/soc/soc-pcm.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/soc-pcm.c +4 -0
@@ -150,6 +150,10 @@ int dpcm_dapm_stream_event(struct snd_sodev_dbg (be->dev,"ASoC: BE %s event %d dir %d\n" , be->dai_link->name, event, dir); +if ((event ==SND_SOC_DAPM_STREAM_STOP ) && + (be->dpcm[dir].users >=1 )) +continue ; +snd_soc_dapm_stream_event (be, dir, event); }
PATCH 26/294 drm/vmwgfx: Fix gcc-7.1.1 warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sinclair Yeh <[email protected]>
commit fcfffdd8f98ac305285dca568b5065ef86be6458 upstream.
The current code does not look correct, and the reason for it is probably lost. Since this now generates a compiler warning, fix it to what makes sense.
--- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +1 -1
@@ -285,7 +285,7 @@ static int vmw_cmd_invalid(struct vmw_prstruct vmw_sw_context *sw_context, SVGA3dCmdHeader *header) { - return capable(CAP_SYS_ADMIN) ? : -EINVAL; + return -EINVAL; } static int vmw_cmd_ok(struct vmw_private *dev_priv,
PATCH 27/294 staging: rtl8188eu: add TL-WN722N v2 support
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Gugino <[email protected]>
commit 5a1d4c5dd4eb2f1f8a9b30e61762f3b3b564df70 upstream.
Add support for USB Device TP-Link TL-WN722N v2.
VendorID: 0x2357, ProductID: 0x010c
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -0
@@ -59,6 +59,7 @@ static struct usb_device_id rtw_usb_id_t {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ + {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ {} /* Terminating entry */ };
PATCH 28/294 usb: renesas_usbhs: gadget: fix re-enabling pipe without re-connecting
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
commit dfb87b8bfe09f933abaf387693992089f6f9053e upstream.
This patch fixes an issue that the renesas_usbhs driver in gadget mode cannot work correctly even if I disabled DMAC of the driver when I used the g_zero driver and the testusb tool.
When a usb cable is re-connected, the renesas_usbhs driver calls the usbhsp_flags_init() (via usbhs_hotplug() --> usbhs_mod_call(start) --> usbhsg_try_start() --> usbhs_pipe_init()). However, the driver doesn't call the usbhsp_flags_init() when usbhsg_ep_disable() is called. So, if a gadget driver calls usb_ep_enable() and usb_ep_disable() again and again, the renesas_usbhs driver will output the following log:
renesas_usbhs renesas_usbhs: can't get pipe (BULK) renesas_usbhs renesas_usbhs: wrong recip request
--- drivers/usb/renesas_usbhs/mod_gadget.c | 2 ++ drivers/usb/renesas_usbhs/pipe.c | 10 ++++++++++ drivers/usb/renesas_usbhs/pipe.h | 1 + 3 files changed, 13 insertions(+)
drivers/usb/renesas_usbhs/mod_gadget.c +3 -1
@@ -607,11 +607,13 @@ usbhsg_ep_enable_end:static int usbhsg_ep_disable (struct usb_ep *ep) {struct usbhsg_uep *uep =usbhsg_ep_to_uep (ep); +struct usbhs_pipe *pipe =usbhsg_uep_to_pipe (uep); -if (!uep->pipe) +if (!pipe)return -EINVAL ;usbhsg_pipe_disable (uep); +usbhs_pipe_free (pipe); uep->pipe->mod_private =NULL ; uep->pipe =NULL ;
drivers/usb/renesas_usbhs/pipe.c +10 -0
@@ -640,6 +640,11 @@ static struct usbhs_pipe *usbhsp_get_pipreturn pipe; } +static void usbhsp_put_pipe (struct usbhs_pipe *pipe) +{ +usbhsp_flags_init (pipe); +} +void usbhs_pipe_init (struct usbhs_priv *priv,int (*dma_map_ctrl)(struct usbhs_pkt *pkt,int map)) {
@@ -726,6 +731,11 @@ struct usbhs_pipe *usbhs_pipe_malloc(strreturn pipe; } +void usbhs_pipe_free (struct usbhs_pipe *pipe) +{ +usbhsp_put_pipe (pipe); +} +void usbhs_pipe_select_fifo (struct usbhs_pipe *pipe,struct usbhs_fifo *fifo) {if (pipe->fifo)
drivers/usb/renesas_usbhs/pipe.h +1 -0
@@ -75,6 +75,7 @@ struct usbhs_pipe_info {char *usbhs_pipe_name (struct usbhs_pipe *pipe);struct usbhs_pipe *usbhs_pipe_malloc (struct usbhs_priv *priv,int endpoint_type,int dir_in); +void usbhs_pipe_free (struct usbhs_pipe *pipe);int usbhs_pipe_probe (struct usbhs_priv *priv);void usbhs_pipe_remove (struct usbhs_priv *priv);int usbhs_pipe_is_dir_in (struct usbhs_pipe *pipe);
PATCH 29/294 usb: renesas_usbhs: gadget: Fix NULL pointer dereference in usbhsg_ep_dequeue()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
commit c9eb29503e9655e70448bbbf3697d08a56d24854 upstream.
This patch fixes an issue that NULL pointer dereference happens when a gadget driver calls usb_ep_dequeue() for ep0 after disconnected a usb cable. This is because that usbhsg_try_stop() will call usbhsg_ep_disable(&dcp->ep) when a usb cable is disconnected and the pipe of dcp (ep0) is set to NULL.
--- drivers/usb/renesas_usbhs/mod_gadget.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/usb/renesas_usbhs/mod_gadget.c +9 -2
@@ -126,7 +126,8 @@ static void usbhsg_queue_pop(struct usbhstruct usbhs_pipe *pipe =usbhsg_uep_to_pipe (uep);struct device *dev =usbhsg_gpriv_to_dev (gpriv); -dev_dbg (dev,"pipe %d : queue pop\n" ,usbhs_pipe_number (pipe)); +if (pipe) +dev_dbg (dev,"pipe %d : queue pop\n" ,usbhs_pipe_number (pipe)); ureq->req.status = status; ureq->req.complete (&uep->ep, &ureq->req);
@@ -669,7 +670,13 @@ static int usbhsg_ep_dequeue(struct usb_struct usbhsg_request *ureq =usbhsg_req_to_ureq (req);struct usbhs_pipe *pipe =usbhsg_uep_to_pipe (uep); -usbhs_pkt_pop (pipe,usbhsg_ureq_to_pkt (ureq)); +if (pipe) +usbhs_pkt_pop (pipe,usbhsg_ureq_to_pkt (ureq)); + +/* +* To dequeue a request, this driver should call the usbhsg_queue_pop() +* even if the pipe is NULL. +*/ usbhsg_queue_pop (uep, ureq, -ECONNRESET );return 0 ;
PATCH 30/294 usb: renesas_usbhs: fix usbhsc_resume() for !USBHSF_RUNTIME_PWCTRL
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
commit 59a0879a0e17b2e43ecdc5e3299da85b8410d7ce upstream.
This patch fixes an issue that some registers may be not initialized after resume if the USBHSF_RUNTIME_PWCTRL is not set. Otherwise, if a cable is not connected, the driver will not enable INTENB0.VBSE after resume. And then, the driver cannot detect the VBUS.
--- drivers/usb/renesas_usbhs/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/renesas_usbhs/common.c +3 -1
@@ -600,8 +600,10 @@ static int usbhsc_resume(struct device *struct usbhs_priv *priv =dev_get_drvdata (dev);struct platform_device *pdev =usbhs_priv_to_pdev (priv); -if (!usbhsc_flags_has (priv,USBHSF_RUNTIME_PWCTRL )) +if (!usbhsc_flags_has (priv,USBHSF_RUNTIME_PWCTRL )) {usbhsc_power_ctrl (priv,1 ); +usbhs_mod_autonomy_mode (priv); + }usbhs_platform_call (priv, phy_reset, pdev);
PATCH 31/294 usb: renesas_usbhs: gadget: disable all eps when the driver stops
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
commit b8b9c974afee685789fcbb191b52d1790be3608c upstream.
A gadget driver will not disable eps immediately when ->disconnect() is called. But, since this driver assumes all eps stop after the ->disconnect(), unexpected behavior happens (especially in system suspend).
So, this patch disables all eps in usbhsg_try_stop(). After disabling eps by renesas_usbhs driver, since some functions will be called by both a gadget and renesas_usbhs driver, renesas_usbhs driver should protect uep->pipe. To protect uep->pipe easily, this patch adds a new lock in struct usbhsg_uep.
--- drivers/usb/renesas_usbhs/mod_gadget.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/usb/renesas_usbhs/mod_gadget.c +24 -7
@@ -36,6 +36,7 @@ struct usbhsg_gpriv;struct usbhsg_uep {struct usb_ep ep;struct usbhs_pipe *pipe; +spinlock_t lock;/* protect the pipe */ char ep_name[EP_NAME_SIZE ];
@@ -608,10 +609,16 @@ usbhsg_ep_enable_end:static int usbhsg_ep_disable (struct usb_ep *ep) {struct usbhsg_uep *uep =usbhsg_ep_to_uep (ep); -struct usbhs_pipe *pipe =usbhsg_uep_to_pipe (uep); +struct usbhs_pipe *pipe; +unsigned long flags; +int ret =0 ; -if (!pipe) -return -EINVAL ; +spin_lock_irqsave (&uep->lock, flags); + pipe =usbhsg_uep_to_pipe (uep); +if (!pipe) { + ret = -EINVAL ; + goto out; + }usbhsg_pipe_disable (uep);usbhs_pipe_free (pipe);
@@ -619,6 +626,9 @@ static int usbhsg_ep_disable(struct usb_ uep->pipe->mod_private =NULL ; uep->pipe =NULL ; +out: +spin_unlock_irqrestore (&uep->lock, flags); +return 0 ; }
@@ -668,8 +678,11 @@ static int usbhsg_ep_dequeue(struct usb_ {struct usbhsg_uep *uep =usbhsg_ep_to_uep (ep);struct usbhsg_request *ureq =usbhsg_req_to_ureq (req); -struct usbhs_pipe *pipe =usbhsg_uep_to_pipe (uep); +struct usbhs_pipe *pipe; +unsigned long flags; +spin_lock_irqsave (&uep->lock, flags); + pipe =usbhsg_uep_to_pipe (uep);if (pipe)usbhs_pkt_pop (pipe,usbhsg_ureq_to_pkt (ureq));
@@ -678,6 +691,7 @@ static int usbhsg_ep_dequeue(struct usb_* even if the pipe is NULL. */ usbhsg_queue_pop (uep, ureq, -ECONNRESET ); +spin_unlock_irqrestore (&uep->lock, flags);return 0 ; }
@@ -804,10 +818,10 @@ static int usbhsg_try_stop(struct usbhs_ {struct usbhsg_gpriv *gpriv =usbhsg_priv_to_gpriv (priv);struct usbhs_mod *mod =usbhs_mod_get_current (priv); -struct usbhsg_uep *dcp =usbhsg_gpriv_to_dcp (gpriv); +struct usbhsg_uep *uep;struct device *dev =usbhs_priv_to_dev (priv);unsigned long flags; -int ret =0 ; +int ret =0 , i;/******************** spin lock ********************/ usbhs_lock (priv, flags);
@@ -839,7 +853,9 @@ static int usbhsg_try_stop(struct usbhs_usbhs_sys_set_test_mode (priv,0 );usbhs_sys_function_ctrl (priv,0 ); -usbhsg_ep_disable (&dcp->ep); +/* disable all eps */ +usbhsg_for_each_uep_with_dcp (uep, gpriv, i) +usbhsg_ep_disable (&uep->ep);dev_dbg (dev,"stop gadget\n" );
@@ -959,6 +975,7 @@ int usbhs_mod_gadget_probe(struct usbhs_ ret = -ENOMEM ; goto usbhs_mod_gadget_probe_err_gpriv; } +spin_lock_init (&uep->lock);/* * CAUTION
PATCH 32/294 netfilter: ipt_CLUSTERIP: fix use-after-free of proc entry
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
commit 3840538ad384fb7891adeeaf36624f870c51fc0e upstream.
When we delete a netns with a CLUSTERIP rule, clusterip_net_exit() is called first, removing /proc/net/ipt_CLUSTERIP.
Then clusterip_config_entry_put() is called from clusterip_tg_destroy(), and tries to remove its entry under /proc/net/ipt_CLUSTERIP/.
Fix this by checking that the parent directory of the entry to remove hasn't already been deleted.
The following triggers a KASAN splat (stealing the reproducer from 202f59afd441, thanks to Jianlin Shi and Xin Long):
ip netns add test
ip link add veth0_in type veth peer name veth0_out
ip link set veth0_in netns test
ip netns exec test ip link set lo up
ip netns exec test ip link set veth0_in up
ip netns exec test iptables -I INPUT -d 1.2.3.4 -i veth0_in -j \
CLUSTERIP --new --clustermac 89:d4:47:eb:9a:fa --total-nodes 3 \
--local-node 1 --hashmode sourceip-sourceport
ip netns del test
--- net/ipv4/netfilter/ipt_CLUSTERIP.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/netfilter/ipt_CLUSTERIP.c +3 -1
@@ -115,7 +115,8 @@ clusterip_config_entry_put(struct cluste* functions are also incrementing the refcount on their own, * so it's safe to remove the entry even if it's in use. */ #ifdef CONFIG_PROC_FS -proc_remove (c->pde); +if (cn->procdir) +proc_remove (c->pde);#endif return ; }
@@ -735,6 +736,7 @@ static void clusterip_net_exit(struct ne#ifdef CONFIG_PROC_FS struct clusterip_net *cn =net_generic (net, clusterip_net_id);proc_remove (cn->procdir); + cn->procdir =NULL ;#endif }
PATCH 33/294 libata: array underflow in ata_find_dev()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 59a5e266c3f5c1567508888dd61a45b86daed0fa upstream.
My static checker complains that "devno" can be negative, meaning that we read before the start of the loop. I've looked at the code, and I think the warning is right. This come from /proc so it's root only or it would be quite a quite a serious bug. The call tree looks like this:
proc_scsi_write() <- gets id and channel from simple_strtoul() -> scsi_add_single_device() <- calls shost->transportt->user_scan()
-> ata_scsi_user_scan()
-> ata_find_dev()
--- drivers/ata/libata-scsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ata/libata-scsi.c +4 -2
@@ -2796,10 +2796,12 @@ static unsigned int atapi_xlat(struct atstatic struct ata_device *ata_find_dev (struct ata_port *ap,int devno) {if (!sata_pmp_attached (ap)) { -if (likely (devno <ata_link_max_devices (&ap->link))) +if (likely (devno >=0 && + devno <ata_link_max_devices (&ap->link)))return &ap->link.device[devno]; }else { -if (likely (devno < ap->nr_pmp_links)) +if (likely (devno >=0 && + devno < ap->nr_pmp_links))return &ap->pmp_link[devno].device[0 ]; }
PATCH 34/294 workqueue: restore WQ_UNBOUND/max_active==1 to be ordered
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 5c0338c68706be53b3dc472e4308961c36e4ece1 upstream.
The combination of WQ_UNBOUND and max_active == 1 used to imply ordered execution. After NUMA affinity 4c16bd327c74 ("workqueue:
implement NUMA affinity for unbound workqueues"), this is no longer true due to per-node worker pools.
While the right way to create an ordered workqueue is alloc_ordered_workqueue(), the documentation has been misleading for a long time and people do use WQ_UNBOUND and max_active == 1 for ordered workqueues which can lead to subtle bugs which are very difficult to trigger.
It's unlikely that we'd see noticeable performance impact by enforcing ordering on WQ_UNBOUND / max_active == 1 workqueues. Let's automatically set __WQ_ORDERED for those workqueues.
--- kernel/workqueue.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
kernel/workqueue.c +10 -0
@@ -4152,6 +4152,16 @@ struct workqueue_struct *__alloc_workquestruct workqueue_struct *wq;struct pool_workqueue *pwq; +/* +* Unbound && max_active == 1 used to imply ordered, which is no +* longer the case on NUMA machines due to per-node pools. While +* alloc_ordered_workqueue() is the right way to create an ordered +* workqueue, keep the previous behavior to avoid subtle breakages +* on NUMA. +*/ +if ((flags &WQ_UNBOUND ) && max_active ==1 ) + flags |= __WQ_ORDERED; +/* see the comment above the definition of WQ_POWER_EFFICIENT */ if ((flags &WQ_POWER_EFFICIENT ) && wq_power_efficient) flags |=WQ_UNBOUND ;
PATCH 35/294 mount: copy the port field into the cloned nfs_server structure.
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve Dickson <[email protected]>
commit 89a6814d9b665b196aa3a102f96b6dc7e8cb669e upstream.
Doing this copy eliminates the "port=0" entry in
the /proc/mounts entries
--- fs/nfs/client.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/client.c +1 -0
@@ -931,6 +931,7 @@ void nfs_server_copy_userdata(struct nfs target->caps = source->caps; target->options = source->options; target->auth_info = source->auth_info; + target->port = source->port; }EXPORT_SYMBOL_GPL (nfs_server_copy_userdata);
PATCH 36/294 x86/acpi: Prevent out of bound access caused by broken ACPI tables
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Seunghun Han <[email protected]>
commit dad5ab0db8deac535d03e3fe3d8f2892173fa6a4 upstream.
The bus_irq argument of mp_override_legacy_irq() is used as the index into the isa_irq_to_gsi[] array. The bus_irq argument originates from ACPI_MADT_TYPE_IO_APIC and ACPI_MADT_TYPE_INTERRUPT items in the ACPI tables, but is nowhere sanity checked.
That allows broken or malicious ACPI tables to overwrite memory, which might cause malfunction, panic or arbitrary code execution.
Add a sanity check and emit a warning when that triggers.
[ tglx: Added warning and rewrote changelog ]
--- arch/x86/kernel/acpi/boot.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/x86/kernel/acpi/boot.c +8 -0
@@ -910,6 +910,14 @@ void __init mp_override_legacy_irq(u8 bustruct mpc_intsrc mp_irq;/* +* Check bus_irq boundary. +*/ +if (bus_irq >=NR_IRQS_LEGACY ) { +pr_warn ("Invalid bus_irq %u for legacy override\n" , bus_irq); +return ; + } + +/* * Convert 'gsi' to 'ioapic.pin'. */ ioapic =mp_find_ioapic (gsi);
PATCH 37/294 ARM: kexec: Make .text R/W in machine_kexec
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit 42d720d1731a9d7035c2812437c35e271ec4dd78 upstream.
With the introduction of Kees Cook's patch to make the kernel .text read-only the existing method by which kexec works got broken since it directly pokes some values in the template code, which resides in the .text section.
The current patch changes the way those values are inserted so that poking .text section occurs only in machine_kexec (e.g when we are about to nuke the old kernel and are beyond the point of return). This allows to use set_kernel_text_rw() to directly patch the values in the .text section.
I had already sent a patch which achieved this but it was significantly more complicated, so this is a cleaner/straight-forward approach.
--- arch/arm/kernel/machine_kexec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/kernel/machine_kexec.c +4 -4
@@ -29,6 +29,7 @@ extern unsigned long kexec_boot_atags;static atomic_t waiting_for_crash_ipi; +static unsigned long dt_mem;/* * Provide a dummy crash_notes definition while crash dump arrives to arm. * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
@@ -64,7 +65,7 @@ int machine_kexec_prepare(struct kimagereturn err;if (be32_to_cpu (header) ==OF_DT_HEADER ) - kexec_boot_atags = current_segment->mem; + dt_mem = current_segment->mem; }return 0 ; }
@@ -166,9 +167,8 @@ void machine_kexec(struct kimage *image) kexec_start_address = image->start; kexec_indirection_page = page_list; kexec_mach_type = machine_arch_type; -if (!kexec_boot_atags) - kexec_boot_atags = image->start -KEXEC_ARM_ZIMAGE_OFFSET +KEXEC_ARM_ATAGS_OFFSET ; - + kexec_boot_atags = dt_mem ?: image->start -KEXEC_ARM_ZIMAGE_OFFSET + +KEXEC_ARM_ATAGS_OFFSET ;/* copy our kernel relocation code to the control code page */ reboot_entry = fncpy(reboot_code_buffer,
PATCH 38/294 ARM: kexec: fix failure to boot crash kernel
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 0d70262a2d60886da6fe5b1fc8bbcd76cbbc306d upstream.
When kexec was converted to DTB, the dtb address was passed between machine_kexec_prepare() and machine_kexec() using a static variable. This is bad news if you load a crash kernel followed by a normal kernel or vice versa - the last loaded kernel overwrites the dtb address.
This can result in kexec failures, as (eg) we try to boot the crash kernel with the last loaded dtb. For example, with:
the crash kernel fails to find the dtb.
Avoid this by defining a kimage architecture structure, and store the address to be passed in r2 there, which will either be the ATAGs or the dtb blob.
--- arch/arm/include/asm/kexec.h | 5 +++++ arch/arm/kernel/machine_kexec.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-)
arch/arm/include/asm/kexec.h +5 -0
@@ -19,6 +19,11 @@#ifndef __ASSEMBLY__ +#define ARCH_HAS_KIMAGE_ARCH +struct kimage_arch { +u32 kernel_r2; +}; +/** * crash_setup_regs() - save registers for the panic kernel * @newregs: registers are saved here
arch/arm/kernel/machine_kexec.c +6 -5
@@ -29,7 +29,6 @@ extern unsigned long kexec_boot_atags;static atomic_t waiting_for_crash_ipi; -static unsigned long dt_mem;/* * Provide a dummy crash_notes definition while crash dump arrives to arm. * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
@@ -41,6 +40,9 @@ int machine_kexec_prepare(struct kimage__be32 header;int i, err; + image->arch.kernel_r2 = image->start -KEXEC_ARM_ZIMAGE_OFFSET + +KEXEC_ARM_ATAGS_OFFSET ; +/* * Validate that if the current HW supports SMP, then the SW supports * and implements CPU hotplug for the current HW. If not, we won't be
@@ -64,8 +66,8 @@ int machine_kexec_prepare(struct kimageif (err)return err; -if (be32_to_cpu (header) ==OF_DT_HEADER ) - dt_mem = current_segment->mem; +if (header ==cpu_to_be32 (OF_DT_HEADER )) + image->arch.kernel_r2 = current_segment->mem; }return 0 ; }
@@ -167,8 +169,7 @@ void machine_kexec(struct kimage *image) kexec_start_address = image->start; kexec_indirection_page = page_list; kexec_mach_type = machine_arch_type; - kexec_boot_atags = dt_mem ?: image->start -KEXEC_ARM_ZIMAGE_OFFSET - +KEXEC_ARM_ATAGS_OFFSET ; + kexec_boot_atags = image->arch.kernel_r2;/* copy our kernel relocation code to the control code page */ reboot_entry = fncpy(reboot_code_buffer,
PATCH 39/294 xhci: Fix NULL pointer dereference when cleaning up streams for removed host
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 4b895868bb2da60a386a17cde3bf9ecbc70c79f4 upstream.
This off by one in stream_id indexing caused NULL pointer dereference and soft lockup on machines with USB attached SCSI devices connected to a hotpluggable xhci controller.
The code that cleans up pending URBs for dead hosts tried to dereference a stream ring at the invalid stream_id 0. ep->stream_info->stream_rings[0] doesn't point to a ring.
Start looping stream_id from 1 like in all the other places in the driver, and check that the ring exists before trying to kill URBs on it.
--- drivers/usb/host/xhci-ring.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-ring.c +7 -4
@@ -821,13 +821,16 @@ static void xhci_kill_endpoint_urbs(stru (ep->ep_state & EP_GETTING_NO_STREAMS)) {int stream_id; -for (stream_id =0 ; stream_id < ep->stream_info->num_streams; +for (stream_id =1 ; stream_id < ep->stream_info->num_streams; stream_id++) { + ring = ep->stream_info->stream_rings[stream_id]; +if (!ring) +continue ; +xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb,"Killing URBs for slot ID %u, ep index %u, stream %u" , - slot_id, ep_index, stream_id +1 ); -xhci_kill_ring_urbs (xhci, - ep->stream_info->stream_rings[stream_id]); + slot_id, ep_index, stream_id); +xhci_kill_ring_urbs (xhci, ring); } } else { ring = ep->ring;
PATCH 40/294 xhci: Bad Ethernet performance plugged in ASM1042A host
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiahau Chang <[email protected]>
commit 9da5a1092b13468839b1a864b126cacfb72ad016 upstream.
When USB Ethernet is plugged in ASMEDIA ASM1042A xHCI host, bad performance was manifesting in Web browser use (like download large file such as ISO image). It is known limitation of ASM1042A that is not compatible with driver scheduling, As a workaround we can modify flow control handling of ASM1042A. The register we modify is changes the behavior
--- drivers/usb/host/pci-quirks.c | 54 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ drivers/usb/host/xhci-pci.c | 6 +++++ drivers/usb/host/xhci.c | 6 +++++ drivers/usb/host/xhci.h | 1 + 5 files changed, 69 insertions(+)
drivers/usb/host/pci-quirks.c +54 -0
@@ -78,6 +78,16 @@#define USB_INTEL_USB3_PSSEN 0xD8#define USB_INTEL_USB3PRM 0xDC +/* ASMEDIA quirk use */ +#define ASMT_DATA_WRITE0_REG 0xF8 +#define ASMT_DATA_WRITE1_REG 0xFC +#define ASMT_CONTROL_REG 0xE0 +#define ASMT_CONTROL_WRITE_BIT 0x02 +#define ASMT_WRITEREG_CMD 0x10423 +#define ASMT_FLOWCTL_ADDR 0xFA30 +#define ASMT_FLOWCTL_DATA 0xBA +#define ASMT_PSEUDO_DATA 0 +/* * amd_chipset_gen values represent AMD different chipset generations */
@@ -415,6 +425,50 @@ void usb_amd_quirk_pll_disable(void) }EXPORT_SYMBOL_GPL (usb_amd_quirk_pll_disable); +static int usb_asmedia_wait_write (struct pci_dev *pdev) +{ +unsigned long retry_count; +unsigned char value; + +for (retry_count =1000 ; retry_count >0 ; --retry_count) { + +pci_read_config_byte (pdev,ASMT_CONTROL_REG , &value); + +if (value ==0xff ) { +dev_err (&pdev->dev,"%s: check_ready ERROR" , __func__); +return -EIO ; + } + +if ((value &ASMT_CONTROL_WRITE_BIT ) ==0 ) +return 0 ; + +usleep_range (40 ,60 ); + } + +dev_warn (&pdev->dev,"%s: check_write_ready timeout" , __func__); +return -ETIMEDOUT ; +} + +void usb_asmedia_modifyflowcontrol (struct pci_dev *pdev) +{ +if (usb_asmedia_wait_write (pdev) !=0 ) +return ; + +/* send command and address to device */ +pci_write_config_dword (pdev,ASMT_DATA_WRITE0_REG ,ASMT_WRITEREG_CMD ); +pci_write_config_dword (pdev,ASMT_DATA_WRITE1_REG ,ASMT_FLOWCTL_ADDR ); +pci_write_config_byte (pdev,ASMT_CONTROL_REG ,ASMT_CONTROL_WRITE_BIT ); + +if (usb_asmedia_wait_write (pdev) !=0 ) +return ; + +/* send data to device */ +pci_write_config_dword (pdev,ASMT_DATA_WRITE0_REG ,ASMT_FLOWCTL_DATA ); +pci_write_config_dword (pdev,ASMT_DATA_WRITE1_REG ,ASMT_PSEUDO_DATA ); +pci_write_config_byte (pdev,ASMT_CONTROL_REG ,ASMT_CONTROL_WRITE_BIT ); +} +EXPORT_SYMBOL_GPL (usb_asmedia_modifyflowcontrol); +void usb_amd_quirk_pll_enable (void ) {usb_amd_quirk_pll (0 );
drivers/usb/host/pci-quirks.h +2 -0
@@ -11,6 +11,7 @@ bool usb_amd_prefetch_quirk(void);void usb_amd_dev_put (void );void usb_amd_quirk_pll_disable (void );void usb_amd_quirk_pll_enable (void ); +void usb_asmedia_modifyflowcontrol (struct pci_dev *pdev);void usb_enable_intel_xhci_ports (struct pci_dev *xhci_pdev);void usb_disable_xhci_ports (struct pci_dev *xhci_pdev);void sb800_prefetch (struct device *dev,int on);
@@ -18,6 +19,7 @@ void sb800_prefetch(struct device *dev,struct pci_dev ;static inline void usb_amd_quirk_pll_disable (void ) {}static inline void usb_amd_quirk_pll_enable (void ) {} +static inline void usb_asmedia_modifyflowcontrol (struct pci_dev *pdev) {}static inline void usb_amd_dev_put (void ) {}static inline void usb_disable_xhci_ports (struct pci_dev *xhci_pdev) {}static inline void sb800_prefetch (struct device *dev,int on) {}
drivers/usb/host/xhci-pci.c +6 -0
@@ -52,6 +52,8 @@#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc +#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 +static const char hcd_name[] ="xhci_hcd" ;/* called after powerup, by probe or system-pm "wakeup" */
@@ -198,6 +200,10 @@ static void xhci_pci_quirks(struct devic pdev->device == 0x1142) xhci->quirks |=XHCI_TRUST_TX_LENGTH ; +if (pdev->vendor ==PCI_VENDOR_ID_ASMEDIA && + pdev->device ==PCI_DEVICE_ID_ASMEDIA_1042A_XHCI ) + xhci->quirks |=XHCI_ASMEDIA_MODIFY_FLOWCONTROL ; +if (xhci->quirks &XHCI_RESET_ON_RESUME )xhci_dbg_trace (xhci, trace_xhci_dbg_quirks,"QUIRK: Resetting on resume" );
drivers/usb/host/xhci.c +6 -0
@@ -191,6 +191,9 @@ int xhci_reset(struct xhci_hcd *xhci)if (ret)return ret; +if (xhci->quirks &XHCI_ASMEDIA_MODIFY_FLOWCONTROL ) +usb_asmedia_modifyflowcontrol (to_pci_dev (xhci_to_hcd (xhci)->self.controller)); +xhci_dbg_trace (xhci, trace_xhci_dbg_init,"Wait for controller to be ready for doorbell rings" );/*
@@ -1116,6 +1119,9 @@ int xhci_resume(struct xhci_hcd *xhci, bif ((xhci->quirks &XHCI_COMP_MODE_QUIRK ) && !comp_timer_running)compliance_mode_recovery_timer_init (xhci); +if (xhci->quirks &XHCI_ASMEDIA_MODIFY_FLOWCONTROL ) +usb_asmedia_modifyflowcontrol (to_pci_dev (hcd->self.controller)); +/* Re-enable port polling. */ xhci_dbg (xhci,"%s: starting port polling.\n" , __func__);set_bit (HCD_FLAG_POLL_RH , &hcd->flags);
drivers/usb/host/xhci.h +1 -0
@@ -1570,6 +1570,7 @@ struct xhci_hcd {#define XHCI_PME_STUCK_QUIRK (1 << 20)#define XHCI_MISSING_CAS (1 << 24)#define XHCI_U2_DISABLE_WAKE (1 << 27) +#define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28)unsigned int num_active_eps;unsigned int limit_active_eps;/* There are two roothubs to keep track of bus suspend info for */
PATCH 41/294 xhci: fix 20000ms port resume timeout
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit a54408d0a004757789863d74e29c2297edae0b4d upstream.
A uncleared PLC (port link change) bit will prevent furuther port event interrupts for that port. Leaving it uncleared caused get_port_status() to timeout after 20000ms while waiting to get the final port event interrupt for resume -> U0 state change.
This is a targeted fix for a specific case where we get a port resume event racing with xhci resume. The port event interrupt handler notices xHC is not yet running and bails out early, leaving PLC uncleared.
The whole xhci port resuming needs more attention, but while working on it it anyways makes sense to always ensure PLC is cleared in get_port_status before setting a new link state and waiting for its completion.
--- drivers/usb/host/xhci-hub.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/host/xhci-hub.c +3 -0
@@ -644,6 +644,9 @@ static u32 xhci_get_port_status(struct uclear_bit (wIndex, &bus_state->resuming_ports);set_bit (wIndex, &bus_state->rexit_ports); + +xhci_test_and_clear_bit (xhci, port_array, wIndex, +PORT_PLC );xhci_set_link_state (xhci, port_array, wIndex,XDEV_U0 );
PATCH 42/294 xhci: fix memleak in xhci_run()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Shu Wang <[email protected]>
commit d6f5f071f1e13cadecf8aef1faa7e5d6fbc9f33b upstream.
Found this issue by kmemleak.xhci_run() did not check return val and free command for xhci_queue_vendor_command()
unreferenced object 0xffff88011c0be500 (size 64):
comm "kworker/0:1", pid 58, jiffies 4294670908 (age 50.420s) hex dump (first 32 bytes):
backtrace:
[<ffffffff8176166a>] kmemleak_alloc+0x4a/0xa0
[<ffffffff8121801a>] kmem_cache_alloc_trace+0xca/0x1d0
[<ffffffff81576bf4>] xhci_alloc_command+0x44/0x130
[<ffffffff8156f1cc>] xhci_run+0x4cc/0x630
[<ffffffff8153b84b>] usb_add_hcd+0x3bb/0x950
[<ffffffff8154eac8>] usb_hcd_pci_probe+0x188/0x500
[<ffffffff815851ac>] xhci_pci_probe+0x2c/0x220
[<ffffffff813d2ca5>] local_pci_probe+0x45/0xa0
[<ffffffff810a54e4>] work_for_cpu_fn+0x14/0x20
[<ffffffff810a8409>] process_one_work+0x149/0x360
[<ffffffff810a8d08>] worker_thread+0x1d8/0x3c0
[<ffffffff810ae7d9>] kthread+0x109/0x140
[<ffffffff8176d585>] ret_from_fork+0x25/0x30
[<ffffffffffffffff>] 0xffffffffffffffff--- drivers/usb/host/xhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +3 -1
@@ -662,8 +662,10 @@ int xhci_run(struct usb_hcd *hcd) command =xhci_alloc_command (xhci, false, false,GFP_KERNEL );if (!command)return -ENOMEM ; -xhci_queue_vendor_command (xhci, command,0 ,0 ,0 , + ret =xhci_queue_vendor_command (xhci, command,0 ,0 ,0 ,TRB_TYPE (TRB_NEC_GET_FW )); +if (ret) +xhci_free_command (xhci, command); }xhci_dbg_trace (xhci, trace_xhci_dbg_init,"Finished xhci_run for USB2 roothub" );
PATCH 43/294 tracing: Fix kmemleak in instance_rmdir
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chunyu Hu <[email protected]>
commit db9108e054700c96322b0f0028546aa4e643cf0b upstream.
Hit the kmemleak when executing instance_rmdir, it forgot releasing mem of tracing_cpumask. With this fix, the warn does not appear any more.
unreferenced object 0xffff93a8dfaa7c18 (size 8):
comm "mkdir", pid 1436, jiffies 4294763622 (age 9134.308s) hex dump (first 8 bytes):
ff ff ff ff ff ff ff ff ........
backtrace:
[<ffffffff88b6567a>] kmemleak_alloc+0x4a/0xa0
[<ffffffff8861ea41>] __kmalloc_node+0xf1/0x280
[<ffffffff88b505d3>] alloc_cpumask_var_node+0x23/0x30
[<ffffffff88b5060e>] alloc_cpumask_var+0xe/0x10
[<ffffffff88571ab0>] instance_mkdir+0x90/0x240
[<ffffffff886e5100>] tracefs_syscall_mkdir+0x40/0x70
[<ffffffff886565c9>] vfs_mkdir+0x109/0x1b0
[<ffffffff8865b1d0>] SyS_mkdir+0xd0/0x100
[<ffffffff88403857>] do_syscall_64+0x67/0x150
[<ffffffff88b710e7>] return_from_SYSCALL_64+0x0/0x6a
[<ffffffffffffffff>] 0xffffffffffffffff--- kernel/trace/trace.c | 1 + 1 file changed, 1 insertion(+)
kernel/trace/trace.c +1 -0
@@ -6373,6 +6373,7 @@ static int instance_delete(const char *ndebugfs_remove_recursive (tr->dir);free_trace_buffers (tr); +free_cpumask_var (tr->tracing_cpumask);kfree (tr->name);kfree (tr);
PATCH 44/294 cxgb4: Fix error codes in c4iw_create_cq()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 6ebedacbb44602d4dec3348dee5ec31dd9b09521 upstream.
If one of these kmalloc() calls fails then we return ERR_PTR(0) which is NULL. It results in a NULL dereference in the callers.
--- drivers/infiniband/hw/cxgb4/cq.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/cq.c +1 -0
@@ -938,6 +938,7 @@ struct ib_cq *c4iw_create_cq(struct ib_d goto err2;if (ucontext) { + ret = -ENOMEM ; mm =kmalloc (sizeof *mm,GFP_KERNEL );if (!mm) goto err3;
PATCH 45/294 IB/cxgb3: Fix error codes in iwch_alloc_mr()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 9064d6055c14f700aa13f7c72fd3e63d12bee643 upstream.
We accidentally don't set the error code on some error paths. It means return ERR_PTR(0) which is NULL and results in a NULL dereference in the caller.
---
drivers/infiniband/hw/cxgb3/iwch_provider.c +3 -2
@@ -794,7 +794,7 @@ static struct ib_mr *iwch_alloc_fast_regstruct iwch_mr *mhp;u32 mmid;u32 stag =0 ; -int ret =0 ; +int ret = -ENOMEM ; php =to_iwch_pd (pd); rhp = php->rhp;
@@ -817,7 +817,8 @@ static struct ib_mr *iwch_alloc_fast_reg mhp->attr.state =1 ; mmid = (stag) >>8 ; mhp->ibmr.rkey = mhp->ibmr.lkey = stag; -if (insert_handle (rhp, &rhp->mmidr, mhp, mmid)) + ret =insert_handle (rhp, &rhp->mmidr, mhp, mmid); +if (ret) goto err3;PDBG ("%s mmid 0x%x mhp %p stag 0x%x\n" , __func__, mmid, mhp, stag);
PATCH 46/294 RDMA/ocrdma: Fix an error code in ocrdma_alloc_pd()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit dd75cfa6d3216c79c695f5af13e52208afe374ad upstream.
We should preserve the original "status" error code instead of resetting it to zero. Returning ERR_PTR(0) is the same as NULL and results in a NULL dereference in the callers. I added a printk() on error instead.
--- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +2 -1
@@ -565,7 +565,8 @@ err:if (is_uctx_pd) {ocrdma_release_ucontext_pd (uctx); }else { - status =ocrdma_mbx_dealloc_pd (dev, pd); +if (ocrdma_mbx_dealloc_pd (dev, pd)) +pr_err ("%s: ocrdma_mbx_dealloc_pd() failed\n" , __func__);kfree (pd); } exit:
PATCH 47/294 RDMA/ocrdma: Fix error codes in ocrdma_create_srq()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit f0c6e88288d65c93bbc7da4fb6f7d51b2733228a upstream.
If either of these allocations fail then we return ERR_PTR(0). That's equivalent to NULL and results in a NULL pointer dereference in the caller.
--- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +1 -0
@@ -1720,6 +1720,7 @@ struct ib_srq *ocrdma_create_srq(struct goto err;if (udata ==NULL ) { + status = -ENOMEM ; srq->rqe_wr_id_tbl =kzalloc (sizeof (u64) * srq->rq.max_cnt,GFP_KERNEL );if (srq->rqe_wr_id_tbl ==NULL )
PATCH 48/294 IB/cma: Fix a race condition in iboe_addr_get_sgid()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit fba332b079029c2f4f7e84c1c1cd8e3867310c90 upstream.
Code that dereferences the struct net_device ip_ptr member must be protected with an in_dev_get() / in_dev_put() pair. Hence insert calls to these functions.
--- include/rdma/ib_addr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/rdma/ib_addr.h +4 -2
@@ -184,10 +184,12 @@ static inline void iboe_addr_get_sgid(st dev =dev_get_by_index (&init_net, dev_addr->bound_dev_if);if (dev) { - ip4 = (struct in_device *)dev->ip_ptr; -if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) + ip4 =in_dev_get (dev); +if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) {ipv6_addr_set_v4mapped (ip4->ifa_list->ifa_address, (struct in6_addr *)gid); +in_dev_put (ip4); + }dev_put (dev); } }
PATCH 49/294 IB/cma: Fix reference count leak when no ipv4 addresses are set
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Kalderon, Michal" <[email protected]>
commit 963916fdb3e5ad4af57ac959b5a03bf23f7568ca upstream.
Once in_dev_get is called to receive in_device pointer, the in_device reference counter is increased, but if there are no ipv4 addresses configured on the net-device the ifa_list will be null, resulting in a flow that doesn't call in_dev_put to decrease the ref_cnt.
This was exposed when running RoCE over ipv6 without any ipv4 addresses configured
--- include/rdma/ib_addr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/rdma/ib_addr.h +4 -2
@@ -185,11 +185,13 @@ static inline void iboe_addr_get_sgid(st dev =dev_get_by_index (&init_net, dev_addr->bound_dev_if);if (dev) { ip4 =in_dev_get (dev); -if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) { +if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address)ipv6_addr_set_v4mapped (ip4->ifa_list->ifa_address, (struct in6_addr *)gid); + +if (ip4)in_dev_put (ip4); - } +dev_put (dev); } }
PATCH 50/294 RDMA/uverbs: Fix the check for port number
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Ismail, Mustafa" <[email protected]>
commit 5a7a88f1b488e4ee49eb3d5b82612d4d9ffdf2c3 upstream.
The port number is only valid if IB_QP_PORT is set in the mask. So only check port number if it is valid to prevent modify_qp from failing due to an invalid port number.
--- drivers/infiniband/core/uverbs_cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +2 -1
@@ -1915,7 +1915,8 @@ ssize_t ib_uverbs_modify_qp(struct ib_uv goto out; } -if (!rdma_is_port_valid (qp->device, cmd.port_num)) { +if ((cmd.attr_mask &IB_QP_PORT ) && + !rdma_is_port_valid (qp->device, cmd.port_num)) { ret = -EINVAL ; goto release_qp; }
PATCH 51/294 RDMA/core: Initialize port_num in qp_attr
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Ismail, Mustafa" <[email protected]>
commit a62ab66b13a0f9bcb17b7b761f6670941ed5cd62 upstream.
Initialize the port_num for iWARP in rdma_init_qp_attr.
--- drivers/infiniband/core/cma.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/cma.c +2 -0
@@ -753,6 +753,8 @@ int rdma_init_qp_attr(struct rdma_cm_id }else ret =iw_cm_init_qp_attr (id_priv->cm_id.iw, qp_attr, qp_attr_mask); + qp_attr->port_num = id_priv->id.port_num; + *qp_attr_mask |=IB_QP_PORT ;break ;default : ret = -ENOSYS ;
PATCH 52/294 ipv4: initialize fib_trie prior to register_netdev_notifier call.
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mahesh Bandewar <[email protected]>
commit 8799a221f5944a7d74516ecf46d58c28ec1d1f75 upstream.
Net stack initialization currently initializes fib-trie after the first call to netdevice_notifier() call. In fact fib_trie initialization needs to happen before first rtnl_register(). It does not cause any problem since there are no devices UP at this moment, but trying to bring 'lo' UP at initialization would make this assumption wrong and exposes the issue.
Fixes following crash
Call Trace: ? alternate_node_alloc+0x76/0xa0 fib_table_insert+0x1b7/0x4b0 fib_magic.isra.17+0xea/0x120 fib_add_ifaddr+0x7b/0x190 fib_netdev_event+0xc0/0x130 register_netdevice_notifier+0x1c1/0x1d0 ip_fib_init+0x72/0x85 ip_rt_init+0x187/0x1e9 ip_init+0xe/0x1a inet_init+0x171/0x26c ? ipv4_offload_init+0x66/0x66 do_one_initcall+0x43/0x160 kernel_init_freeable+0x191/0x219 ? rest_init+0x80/0x80 kernel_init+0xe/0x150 ret_from_fork+0x22/0x30 Code: f6 46 23 04 74 86 4c 89 f7 e8 ae 45 01 00 49 89 c7 4d 85 ff 0f 85 7b ff ff ff 31 db eb 08 4c 89 ff e8 16 47 01 00 48 8b 44 24 38 <45> 8b 6e 14 4d 63 76 74 48 89 04 24 0f 1f 44 00 00 48 83 c4 08 RIP: kmem_cache_alloc+0xcf/0x1c0 RSP: ffff9b1500017c28 CR2: 0000000000000014
--- net/ipv4/fib_frontend.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/ipv4/fib_frontend.c +5 -4
@@ -1175,13 +1175,14 @@ static struct pernet_operations fib_net_void __init ip_fib_init (void ) { -rtnl_register (PF_INET ,RTM_NEWROUTE , inet_rtm_newroute,NULL ,NULL ); -rtnl_register (PF_INET ,RTM_DELROUTE , inet_rtm_delroute,NULL ,NULL ); -rtnl_register (PF_INET ,RTM_GETROUTE ,NULL , inet_dump_fib,NULL ); +fib_trie_init ();register_pernet_subsys (&fib_net_ops); +register_netdevice_notifier (&fib_netdev_notifier);register_inetaddr_notifier (&fib_inetaddr_notifier); -fib_trie_init (); +rtnl_register (PF_INET ,RTM_NEWROUTE , inet_rtm_newroute,NULL ,NULL ); +rtnl_register (PF_INET ,RTM_DELROUTE , inet_rtm_delroute,NULL ,NULL ); +rtnl_register (PF_INET ,RTM_GETROUTE ,NULL , inet_dump_fib,NULL ); }
PATCH 53/294 perf/core: Invert perf_read_group() loops
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit fa8c269353d560b7c28119ad7617029f92e40b15 upstream.
In order to enable the use of perf_event_read(.group = true), we need to invert the sibling-child loop nesting of perf_read_group().
Currently we iterate the child list for each sibling, this precludes using group reads. Flip things around so we iterate each group for each child.
[bwh: Backported to 3.16 as a dependency of commit 2aeb18835476 ("perf/core: Fix
locking for children siblings group read"):
- Keep the function name perf_event_read_group()
- Keep using perf_event_read_value()]
---
kernel/events/core.c +46 -25
@@ -3565,50 +3565,71 @@ u64 perf_event_read_value(struct perf_ev }EXPORT_SYMBOL_GPL (perf_event_read_value); -static int perf_event_read_group (struct perf_event *event, -u64 read_format,char __user *buf) +static void __perf_read_group_add (struct perf_event *leader, +u64 read_format,u64 *values) { -struct perf_event *leader = event->group_leader, *sub; -struct perf_event_context *ctx = leader->ctx; -int n =0 , size =0 , ret; +struct perf_event *sub; +int n =1 ;/* skip @nr */ u64 count, enabled, running; -u64 values[5 ]; - -lockdep_assert_held (&ctx->mutex); count =perf_event_read_value (leader, &enabled, &running); - values[n++] =1 + leader->nr_siblings; +/* +* Since we co-schedule groups, {enabled,running} times of siblings +* will be identical to those of the leader, so we only publish one +* set. +*/ if (read_format &PERF_FORMAT_TOTAL_TIME_ENABLED ) values[n++] = enabled;if (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) values[n++] = running; - values[n++] = count; + +/* +* Write {count,id} tuples for every sibling. +*/ + values[n++] += count;if (read_format &PERF_FORMAT_ID ) values[n++] =primary_event_id (leader); - size = n *sizeof (u64); - -if (copy_to_user (buf, values, size)) -return -EFAULT ; - - ret = size; -list_for_each_entry (sub, &leader->sibling_list, group_entry) { - n =0 ; - values[n++] =perf_event_read_value (sub, &enabled, &running);if (read_format &PERF_FORMAT_ID ) values[n++] =primary_event_id (sub); + } +} - size = n *sizeof (u64); +static int perf_event_read_group (struct perf_event *event, +u64 read_format,char __user *buf) +{ +struct perf_event *leader = event->group_leader, *child; +struct perf_event_context *ctx = leader->ctx; +int ret = event->read_size; +u64 *values; -if (copy_to_user (buf + ret, values, size)) { -return -EFAULT ; - } +lockdep_assert_held (&ctx->mutex); - ret += size; - } + values =kzalloc (event->read_size,GFP_KERNEL ); +if (!values) +return -ENOMEM ; + + values[0 ] =1 + leader->nr_siblings; + +/* +* By locking the child_mutex of the leader we effectively +* lock the child list of all siblings.. XXX explain how. +*/ +mutex_lock (&leader->child_mutex); + +__perf_read_group_add (leader, read_format, values); +list_for_each_entry (child, &leader->child_list, child_list) +__perf_read_group_add (child, read_format, values); + +mutex_unlock (&leader->child_mutex); + +if (copy_to_user (buf, values, event->read_size)) + ret = -EFAULT ; + +kfree (values);return ret; }
PATCH 54/294 perf/core: Fix locking for children siblings group read
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 2aeb1883547626d82c597cce2c99f0b9c62e2425 upstream.
We're missing ctx lock when iterating children siblings within the perf_read path for group reading. Following race and crash can happen:
User space doing read syscall on event group leader:
T1:
perf_read
lock event->ctx->mutex
perf_read_group
lock leader->child_mutex
__perf_read_group_add(child)
list_for_each_entry(sub, &leader->sibling_list, group_entry)----> sub might be invalid at this point, because it could
get removed via perf_event_exit_task_context in T2
Child exiting and cleaning up its events:
T2:
perf_event_exit_task_context
lock ctx->mutex
list_for_each_entry_safe(child_event, next, &child_ctx->event_list,...
perf_event_exit_event(child)
lock ctx->lock
perf_group_detach(child)
unlock ctx->lock----> child is removed from sibling_list without any sync
with T1 path above
...
free_event(child)
Before the child is removed from the leader's child_list, (and thus is omitted from perf_read_group processing), we need to ensure that perf_read_group touches child's siblings under its ctx->lock.
Peter further notes:
| One additional note; this bug got exposed by commit:
|
| ba5213ae6b88 ("perf/core: Correct event creation with PERF_FORMAT_GROUP")
|
| which made it possible to actually trigger this code-path.---
kernel/events/core.c +6 -0
@@ -3568,7 +3568,9 @@ EXPORT_SYMBOL_GPL(perf_event_read_value)static void __perf_read_group_add (struct perf_event *leader,u64 read_format,u64 *values) { +struct perf_event_context *ctx = leader->ctx;struct perf_event *sub; +unsigned long flags;int n =1 ;/* skip @nr */ u64 count, enabled, running;
@@ -3591,11 +3593,15 @@ static void __perf_read_group_add(structif (read_format &PERF_FORMAT_ID ) values[n++] =primary_event_id (leader); +raw_spin_lock_irqsave (&ctx->lock, flags); +list_for_each_entry (sub, &leader->sibling_list, group_entry) { values[n++] =perf_event_read_value (sub, &enabled, &running);if (read_format &PERF_FORMAT_ID ) values[n++] =primary_event_id (sub); } + +raw_spin_unlock_irqrestore (&ctx->lock, flags); } static int perf_event_read_group(struct perf_event *event,
PATCH 55/294 iwlwifi: dvm: prevent an out of bounds access
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 0b0f934e92a8eaed2e6c48a50eae6f84661f74f3 upstream.
iwlagn_check_ratid_empty takes the tid as a parameter, but it doesn't check that it is not IWL_TID_NON_QOS. Since IWL_TID_NON_QOS = 8 and iwl_priv::tid_data is an array with 8 entries, accessing iwl_priv::tid_data[IWL_TID_NON_QOS] is a bad idea.
This happened in iwlagn_rx_reply_tx. Since iwlagn_check_ratid_empty is relevant only to check whether we can open A-MPDU, this flow is irrelevant if tid is IWL_TID_NON_QOS. Call iwlagn_check_ratid_empty only inside the
if (tid != IWL_TID_NON_QOS)
a few lines earlier in the function.
--- drivers/net/wireless/iwlwifi/dvm/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/dvm/tx.c +1 -1
@@ -1190,11 +1190,11 @@ int iwlagn_rx_reply_tx(struct iwl_priv * next_reclaimed;IWL_DEBUG_TX_REPLY (priv,"Next reclaimed packet:%d\n" , next_reclaimed); +iwlagn_check_ratid_empty (priv, sta_id, tid); }iwl_trans_reclaim (priv->trans, txq_id, ssn, &skbs); -iwlagn_check_ratid_empty (priv, sta_id, tid); freed =0 ;/* process frames */
PATCH 56/294 IB/ipoib: Prevent setting negative values to max_nonsrq_conn_qp
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Vesker <[email protected]>
commit 11f74b40359b19f760964e71d04882a6caf530cc upstream.
Don't allow negative values to max_nonsrq_conn_qp. There is no functional impact on a negative value but it is logicically incorrect.
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -0
@@ -1768,6 +1768,7 @@ static int __init ipoib_init_module(void ipoib_sendq_size =max3 (ipoib_sendq_size,2 *MAX_SEND_CQE ,IPOIB_MIN_QUEUE_SIZE );#ifdef CONFIG_INFINIBAND_IPOIB_CM ipoib_max_conn_qp =min (ipoib_max_conn_qp,IPOIB_CM_MAX_CONN_QP ); + ipoib_max_conn_qp =max (ipoib_max_conn_qp,0 );#endif /*
PATCH 57/294 IB/ipoib: Set IPOIB_NEIGH_TBL_FLUSH after flushed completion initialization
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Feras Daoud <[email protected]>
commit d2e46fccc3e3d73a741efe433f00960331280696 upstream.
Set IPOIB_NEIGH_TBL_FLUSH bit after initializing the neighbor flushed completion, otherwise the garbage collector may signal a completion while it is not initialized yet.
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -1
@@ -1235,6 +1235,7 @@ static void ipoib_flush_neighs(struct ipint i, wait_flushed =0 ;init_completion (&priv->ntbl.flushed); +set_bit (IPOIB_NEIGH_TBL_FLUSH , &priv->flags);spin_lock_irqsave (&priv->lock, flags);
@@ -1279,7 +1280,6 @@ static void ipoib_neigh_hash_uninit(struipoib_dbg (priv,"ipoib_neigh_hash_uninit\n" );init_completion (&priv->ntbl.deleted); -set_bit (IPOIB_NEIGH_TBL_FLUSH , &priv->flags);/* Stop GC if called at init fail need to cancel work */ stopped =test_and_set_bit (IPOIB_STOP_NEIGH_GC , &priv->flags);
PATCH 58/294 IB/ipoib: Remove double pointer assigning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit 1b355094b308f3377c8f574ce86135ee159c6285 upstream.
There is no need to assign "p" pointer twice.
This patch fixes the following smatch warning:drivers/infiniband/ulp/ipoib/ipoib_cm.c:517 ipoib_cm_rx_handler() warn:
missing break? reassigning 'p->id'
--- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/ulp/ipoib/ipoib_cm.c +0 -1
@@ -508,7 +508,6 @@ static int ipoib_cm_rx_handler(struct ibcase IB_CM_REQ_RECEIVED :return ipoib_cm_req_handler (cm_id, event);case IB_CM_DREQ_RECEIVED : - p = cm_id->context;ib_send_cm_drep (cm_id,NULL ,0 );/* Fall through */ case IB_CM_REJ_RECEIVED :
PATCH 59/294 KVM: PPC: Book3S HV: Enable TM before accessing TM registers
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit e47057151422a67ce08747176fa21cb3b526a2c9 upstream.
Commit 46a704f8409f ("KVM: PPC: Book3S HV: Preserve userspace HTM state properly", 2017-06-15) added code to read transactional memory (TM) registers but forgot to enable TM before doing so. The result is that if userspace does have live values in the TM registers, a KVM_RUN ioctl will cause a host kernel crash like this:
[ 181.328511] Unrecoverable TM Unavailable Exception f60 at d00000001e7d9980 [ 181.328605] Oops: Unrecoverable TM Unavailable Exception, sig: 6 [#1] [ 181.328613] SMP NR_CPUS=2048 [ 181.328613] NUMA [ 181.328618] PowerNV [ 181.328646] Modules linked in: vhost_net vhost tap nfs_layout_nfsv41_files rpcsec_gss_krb5 nfsv4 dns_resolver nfs
+fscache 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 ipt_REJECT nf_reject_ipv4 tun ebtable_filter ebtables +ip6table_filter ip6_tables iptable_filter bridge stp llc kvm_hv kvm nfsd ses enclosure scsi_transport_sas ghash_generic +auth_rpcgss gf128mul xts sg ctr nfs_acl lockd vmx_crypto shpchp ipmi_powernv i2c_opal grace ipmi_devintf i2c_core +powernv_rng sunrpc ipmi_msghandler ibmpowernv uio_pdrv_genirq uio leds_powernv powernv_op_panel ip_tables xfs sd_mod +lpfc ipr bnx2x libata mdio ptp pps_core scsi_transport_fc libcrc32c dm_mirror dm_region_hash dm_log dm_mod
[ 181.329278] CPU: 40 PID: 9926 Comm: CPU 0/KVM Not tainted 4.12.0+ #1 [ 181.329337] task: c000003fc6980000 task.stack: c000003fe4d80000 [ 181.329396] NIP: d00000001e7d9980 LR: d00000001e77381c CTR: d00000001e7d98f0 [ 181.329465] REGS: c000003fe4d837e0 TRAP: 0f60 Not tainted (4.12.0+) [ 181.329523] MSR: 9000000000009033 <SF,HV,EE,ME,IR,DR,RI,LE> [ 181.329527] CR: 24022448 XER: 00000000 [ 181.329608] CFAR: d00000001e773818 SOFTE: 1 [ 181.329608] GPR00: d00000001e77381c c000003fe4d83a60 d00000001e7ef410 c000003fdcfe0000 [ 181.329608] GPR04: c000003fe4f00000 0000000000000000 0000000000000000 c000003fd7954800 [ 181.329608] GPR08: 0000000000000001 c000003fc6980000 0000000000000000 d00000001e7e2880 [ 181.329608] GPR12: d00000001e7d98f0 c000000007b19000 00000001295220e0 00007fffc0ce2090 [ 181.329608] GPR16: 0000010011886608 00007fff8c89f260 0000000000000001 00007fff8c080028 [ 181.329608] GPR20: 0000000000000000 00000100118500a6 0000010011850000 0000010011850000 [ 181.329608] GPR24: 00007fffc0ce1b48 0000010011850000 00000000d673b901 0000000000000000 [ 181.329608] GPR28: 0000000000000000 c000003fdcfe0000 c000003fdcfe0000 c000003fe4f00000 [ 181.330199] NIP [d00000001e7d9980] kvmppc_vcpu_run_hv+0x90/0x6b0 [kvm_hv] [ 181.330264] LR [d00000001e77381c] kvmppc_vcpu_run+0x2c/0x40 [kvm] [ 181.330322] Call Trace: [ 181.330351] [c000003fe4d83a60] [d00000001e773478] kvmppc_set_one_reg+0x48/0x340 [kvm] (unreliable) [ 181.330437] [c000003fe4d83b30] [d00000001e77381c] kvmppc_vcpu_run+0x2c/0x40 [kvm] [ 181.330513] [c000003fe4d83b50] [d00000001e7700b4] kvm_arch_vcpu_ioctl_run+0x114/0x2a0 [kvm] [ 181.330586] [c000003fe4d83bd0] [d00000001e7642f8] kvm_vcpu_ioctl+0x598/0x7a0 [kvm] [ 181.330658] [c000003fe4d83d40] [c0000000003451b8] do_vfs_ioctl+0xc8/0x8b0 [ 181.330717] [c000003fe4d83de0] [c000000000345a64] SyS_ioctl+0xc4/0x120 [ 181.330776] [c000003fe4d83e30] [c00000000000b004] system_call+0x58/0x6c [ 181.330833] Instruction dump: [ 181.330869] e92d0260 e9290b50 e9290108 792807e3 41820058 e92d0260 e9290b50 e9290108 [ 181.330941] 792ae8a4 794a1f87 408204f4 e92d0260 <7d4022a6> f9490ff0 e92d0260 7d4122a6 [ 181.331013] ---[ end trace 6f6ddeb4bfe92a92 ]---
The fix is just to turn on the TM bit in the MSR before accessing the registers.
--- arch/powerpc/kvm/book3s_hv.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kvm/book3s_hv.c +2 -0
@@ -1816,6 +1816,8 @@ static int kvmppc_vcpu_run_hv(struct kvm run->fail_entry.hardware_entry_failure_reason =0 ;return -EINVAL ; } +/* Enable TM so we can read the TM SPRs */ +mtmsr (mfmsr () |MSR_TM ); current->thread.tm_tfhar =mfspr (SPRN_TFHAR ); current->thread.tm_tfiar =mfspr (SPRN_TFIAR ); current->thread.tm_texasr =mfspr (SPRN_TEXASR );
PATCH 60/294 kprobes/x86: Release insn_slot in failure path
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
commit 38115f2f8cec8087d558c062e779c443a01f87d6 upstream.
The following commit:
003002e04ed3 ("kprobes: Fix arch_prepare_kprobe to handle copy insn failures")
returns an error if the copying of the instruction, but does not release the allocated insn_slot.
Clean up correctly.
--- arch/x86/kernel/kprobes/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/x86/kernel/kprobes/core.c +9 -1
@@ -401,6 +401,8 @@ static int arch_copy_kprobe(struct kprobint arch_prepare_kprobe (struct kprobe *p) { +int ret; +if (alternatives_text_reserved (p->addr, p->addr))return -EINVAL ;
@@ -411,7 +413,13 @@ int arch_prepare_kprobe(struct kprobe *pif (!p->ainsn.insn)return -ENOMEM ; -return arch_copy_kprobe (p); + ret =arch_copy_kprobe (p); +if (ret) { +free_insn_slot (p->ainsn.insn,0 ); + p->ainsn.insn =NULL ; + } + +return ret; }void arch_arm_kprobe (struct kprobe *p)
PATCH 61/294 md/raid5: add thread_group worker async_tx_issue_pending_all
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ofer Heifetz <[email protected]>
commit 7e96d559634b73a8158ee99a7abece2eacec2668 upstream.
Since thread_group worker and raid5d kthread are not in sync, if worker writes stripe before raid5d then requests will be waiting for issue_pendig.
Issue observed when building raid5 with ext4, in some build runs jbd2 would get hung and requests were waiting in the HW engine waiting to be issued.
Fix this by adding a call to async_tx_issue_pending_all in the raid5_do_work.
--- drivers/md/raid5.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/raid5.c +2 -0
@@ -5240,6 +5240,8 @@ static void raid5_do_work(struct work_stpr_debug ("%d stripes handled\n" , handled);spin_unlock_irq (&conf->device_lock); + +async_tx_issue_pending_all ();blk_finish_plug (&plug);pr_debug ("--- raid5worker inactive\n" );
PATCH 62/294 workqueue: implicit ordered attribute should be overridable
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 0a94efb5acbb6980d7c9ab604372d93cd507e4d8 upstream.
5c0338c68706 ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered") automatically enabled ordered attribute for unbound workqueues w/ max_active == 1. Because ordered workqueues reject max_active and some attribute changes, this implicit ordered mode broke cases where the user creates an unbound workqueue w/ max_active == 1 and later explicitly changes the related attributes.
This patch distinguishes explicit and implicit ordered setting and overrides from attribute changes if implict.
--- include/linux/workqueue.h | 4 +++- kernel/workqueue.c | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-)
include/linux/workqueue.h +3 -1
@@ -315,6 +315,7 @@ enum { __WQ_DRAINING =1 <<16 ,/* internal: workqueue is draining */ __WQ_ORDERED =1 <<17 ,/* internal: workqueue is ordered */ + __WQ_ORDERED_EXPLICIT =1 <<18 ,/* internal: alloc_ordered_workqueue() */ WQ_MAX_ACTIVE =512 ,/* I like 512, better ideas? */ WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */
@@ -412,7 +413,8 @@ __alloc_workqueue_key(const char *fmt, u* Pointer to the allocated workqueue on success, %NULL on failure. */ #define alloc_ordered_workqueue(fmt, flags, args...) \ - alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) + alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | \ + __WQ_ORDERED_EXPLICIT | (flags), 1, ##args)#define create_workqueue (name) \ alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, (name))
kernel/workqueue.c +9 -4
@@ -3324,7 +3324,7 @@ int workqueue_sysfs_register(struct work* attributes breaks ordering guarantee. Disallow exposing ordered * workqueues. */ -if (WARN_ON (wq->flags & __WQ_ORDERED)) +if (WARN_ON (wq->flags & __WQ_ORDERED_EXPLICIT))return -EINVAL ; wq->wq_dev = wq_dev =kzalloc (sizeof (*wq_dev),GFP_KERNEL );
@@ -3907,8 +3907,12 @@ int apply_workqueue_attrs(struct workquereturn -EINVAL ;/* creating multiple pwqs breaks ordering guarantee */ -if (WARN_ON ((wq->flags & __WQ_ORDERED) && !list_empty (&wq->pwqs))) -return -EINVAL ; +if (!list_empty (&wq->pwqs)) { +if (WARN_ON (wq->flags & __WQ_ORDERED_EXPLICIT)) +return -EINVAL ; + + wq->flags &= ~__WQ_ORDERED; + } pwq_tbl =kzalloc (wq_numa_tbl_len *sizeof (pwq_tbl[0 ]),GFP_KERNEL ); new_attrs =alloc_workqueue_attrs (GFP_KERNEL );
@@ -4354,13 +4358,14 @@ void workqueue_set_max_active(struct worstruct pool_workqueue *pwq;/* disallow meddling with max_active for ordered workqueues */ -if (WARN_ON (wq->flags & __WQ_ORDERED)) +if (WARN_ON (wq->flags & __WQ_ORDERED_EXPLICIT))return ; max_active =wq_clamp_max_active (max_active, wq->flags, wq->name);mutex_lock (&wq->mutex); + wq->flags &= ~__WQ_ORDERED; wq->saved_max_active = max_active;for_each_pwq (pwq, wq)
PATCH 63/294 powerpc/pseries: Fix of_node_put() underflow during reconfig remove
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Vivier <[email protected]>
commit 4fd1bd443e80b12f0a01a45fb9a793206b41cb72 upstream.
As for commit 68baf692c435 ("powerpc/pseries: Fix of_node_put() underflow during DLPAR remove"), the call to of_node_put() must be removed from pSeries_reconfig_remove_node().
dlpar_detach_node() and pSeries_reconfig_remove_node() both call of_detach_node(), and thus the node should not be released in both cases.
--- arch/powerpc/platforms/pseries/reconfig.c | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/platforms/pseries/reconfig.c +0 -1
@@ -112,7 +112,6 @@ static int pSeries_reconfig_remove_node(of_detach_node (np);of_node_put (parent); -of_node_put (np);/* Must decrement the refcount */ return 0 ; }
PATCH 64/294 media: lirc: LIRC_GET_REC_RESOLUTION should return microseconds
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sean Young <[email protected]>
commit 9f5039ba440e499d85c29b1ddbc3cbc9dc90e44b upstream.
Since commit e8f4818895b3 ("[media] lirc: advertise LIRC_CAN_GET_REC_RESOLUTION and improve") lircd uses the ioctl LIRC_GET_REC_RESOLUTION to determine the shortest pulse or space that the hardware can detect. This breaks decoding in lirc because lircd expects the answer in microseconds, but nanoseconds is returned.
--- drivers/media/rc/ir-lirc-codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir-lirc-codec.c +1 -1
@@ -257,7 +257,7 @@ static long ir_lirc_ioctl(struct file *freturn 0 ;case LIRC_GET_REC_RESOLUTION : - val = dev->rx_resolution; + val = dev->rx_resolution /1000 ;break ;case LIRC_SET_WIDEBAND_RECEIVER :
PATCH 65/294 media: platform: davinci: return -EINVAL for VPFE_CMD_S_CCDC_RAW_PARAMS ioctl
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Prabhakar Lad <[email protected]>
commit da05d52d2f0f6bd61094a0cd045fed94bf7d673a upstream.
this patch makes sure VPFE_CMD_S_CCDC_RAW_PARAMS ioctl no longer works for vpfe_capture driver with a minimal patch suitable for backporting.
- This ioctl was never in public api and was only defined in kernel header.
- The function set_params constantly mixes up pointers and phys_addr_t numbers.
- This is part of a 'VPFE_CMD_S_CCDC_RAW_PARAMS' ioctl command that is described as an 'experimental ioctl that will change in future kernels'.
- The code to allocate the table never gets called after we copy_from_user the user input over the kernel settings, and then compare them for inequality.
- We then go on to use an address provided by user space as both the __user pointer for input and pass it through phys_to_virt to come up with a kernel pointer to copy the data to. This looks like a trivially exploitable root hole.
Due to these reasons we make sure this ioctl now returns -EINVAL and backport this patch as far as possible.
--- drivers/media/platform/davinci/vpfe_capture.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
drivers/media/platform/davinci/vpfe_capture.c +2 -20
@@ -1708,27 +1708,9 @@ static long vpfe_param_handler(struct fiswitch (cmd) {case VPFE_CMD_S_CCDC_RAW_PARAMS : + ret = -EINVAL ;v4l2_warn (&vpfe_dev->v4l2_dev, -"VPFE_CMD_S_CCDC_RAW_PARAMS: experimental ioctl\n" ); -if (ccdc_dev->hw_ops.set_params) { - ret = ccdc_dev->hw_ops.set_params (param); -if (ret) { -v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev, -"Error setting parameters in CCDC\n" ); - goto unlock_out; - } - ret =vpfe_get_ccdc_image_format (vpfe_dev, - &vpfe_dev->fmt); -if (ret <0 ) { -v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev, -"Invalid image format at CCDC\n" ); - goto unlock_out; - } - }else { - ret = -EINVAL ; -v4l2_dbg (1 , debug, &vpfe_dev->v4l2_dev, -"VPFE_CMD_S_CCDC_RAW_PARAMS not supported\n" ); - } +"VPFE_CMD_S_CCDC_RAW_PARAMS not supported\n" );break ;default : ret = -ENOTTY ;
PATCH 66/294 iommu/amd: Fix schedule-while-atomic BUG in initialization code
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <[email protected]>
commit 74ddda71f44c84af62f736a77fb9fcebe5bb436a upstream.
The register_syscore_ops() function takes a mutex and might sleep. In the IOMMU initialization code it is invoked during irq-remapping setup already, where irqs are disabled.
This causes a schedule-while-atomic bug:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747 in_atomic(): 0, irqs_disabled(): 1, pid: 1, name: swapper/0 no locks held by swapper/0/1. irq event stamp: 304 hardirqs last enabled at (303): [<ffffffff818a87b6>] _raw_spin_unlock_irqrestore+0x36/0x60 hardirqs last disabled at (304): [<ffffffff8235d440>] enable_IR_x2apic+0x79/0x196 softirqs last enabled at (36): [<ffffffff818ae75f>] __do_softirq+0x35f/0x4ec softirqs last disabled at (31): [<ffffffff810c1955>] irq_exit+0x105/0x120 CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.13.0-rc2.1.el7a.test.x86_64.debug #1 Hardware name: PowerEdge C6145 /040N24, BIOS 3.5.0 10/28/2014 Call Trace: dump_stack+0x85/0xca ___might_sleep+0x22a/0x260 __might_sleep+0x4a/0x80 __mutex_lock+0x58/0x960 ? iommu_completion_wait.part.17+0xb5/0x160 ? register_syscore_ops+0x1d/0x70 ? iommu_flush_all_caches+0x120/0x150 mutex_lock_nested+0x1b/0x20 register_syscore_ops+0x1d/0x70 state_next+0x119/0x910 iommu_go_to_state+0x29/0x30 amd_iommu_enable+0x13/0x23
Fix it by moving the register_syscore_ops() call to the next initialization step, which runs with irqs enabled.
--- drivers/iommu/amd_iommu_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd_iommu_init.c +1 -1
@@ -2027,11 +2027,11 @@ static int __init state_next(void)break ;case IOMMU_ACPI_FINISHED :early_enable_iommus (); -register_syscore_ops (&amd_iommu_syscore_ops); x86_platform.iommu_shutdown = disable_iommus; init_state =IOMMU_ENABLED ;break ;case IOMMU_ENABLED : +register_syscore_ops (&amd_iommu_syscore_ops); ret =amd_iommu_init_pci (); init_state = ret ?IOMMU_INIT_ERROR :IOMMU_PCI_INIT ;enable_iommus_v2 ();
PATCH 67/294 powerpc/mm/hash: Free the subpage_prot_table correctly
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Aneesh Kumar K.V" <[email protected]>
commit 0da12a7a81f1e2255e89dc783c565e84801475a2 upstream.
--- arch/powerpc/mm/subpage-prot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/subpage-prot.c +1 -1
@@ -36,7 +36,7 @@ void subpage_prot_free(struct mm_struct } } addr =0 ; -for (i =0 ; i <2 ; ++i) { +for (i =0 ; i < (TASK_SIZE_USER64 >>43 ); ++i) { p = spt->protptrs[i];if (!p)continue ;
PATCH 68/294 sctp: don't dereference ptr before leaving _sctp_walk_{params, errors}()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Potapenko <[email protected]>
commit b1f5bfc27a19f214006b9b4db7b9126df2dfdf5a upstream.
If the length field of the iterator (|pos.p| or |err|) is past the end of the chunk, we shouldn't access it.
This bug has been detected by KMSAN. For the following pair of system calls:
socket(PF_INET6, SOCK_STREAM, 0x84 /* IPPROTO_??? */) = 3 sendto(3, "A", 1, MSG_OOB, {sa_family=AF_INET6, sin6_port=htons(0),
inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0,
sin6_scope_id=0}, 28) = 1the tool has reported a use of uninitialized memory:
==================================================================
BUG: KMSAN: use of uninitialized memory in sctp_rcv+0x17b8/0x43b0 CPU: 1 PID: 2940 Comm: probe Not tainted 4.11.0-rc5+ #2926 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:16 dump_stack+0x172/0x1c0 lib/dump_stack.c:52 kmsan_report+0x12a/0x180 mm/kmsan/kmsan.c:927 __msan_warning_32+0x61/0xb0 mm/kmsan/kmsan_instr.c:469 __sctp_rcv_init_lookup net/sctp/input.c:1074 __sctp_rcv_lookup_harder net/sctp/input.c:1233 __sctp_rcv_lookup net/sctp/input.c:1255 sctp_rcv+0x17b8/0x43b0 net/sctp/input.c:170 sctp6_rcv+0x32/0x70 net/sctp/ipv6.c:984 ip6_input_finish+0x82f/0x1ee0 net/ipv6/ip6_input.c:279 NF_HOOK ./include/linux/netfilter.h:257 ip6_input+0x239/0x290 net/ipv6/ip6_input.c:322 dst_input ./include/net/dst.h:492 ip6_rcv_finish net/ipv6/ip6_input.c:69 NF_HOOK ./include/linux/netfilter.h:257 ipv6_rcv+0x1dbd/0x22e0 net/ipv6/ip6_input.c:203 __netif_receive_skb_core+0x2f6f/0x3a20 net/core/dev.c:4208 __netif_receive_skb net/core/dev.c:4246 process_backlog+0x667/0xba0 net/core/dev.c:4866 napi_poll net/core/dev.c:5268 net_rx_action+0xc95/0x1590 net/core/dev.c:5333 __do_softirq+0x485/0x942 kernel/softirq.c:284 do_softirq_own_stack+0x1c/0x30 arch/x86/entry/entry_64.S:902 </IRQ> do_softirq kernel/softirq.c:328 __local_bh_enable_ip+0x25b/0x290 kernel/softirq.c:181 local_bh_enable+0x37/0x40 ./include/linux/bottom_half.h:31 rcu_read_unlock_bh ./include/linux/rcupdate.h:931 ip6_finish_output2+0x19b2/0x1cf0 net/ipv6/ip6_output.c:124 ip6_finish_output+0x764/0x970 net/ipv6/ip6_output.c:149 NF_HOOK_COND ./include/linux/netfilter.h:246 ip6_output+0x456/0x520 net/ipv6/ip6_output.c:163 dst_output ./include/net/dst.h:486 NF_HOOK ./include/linux/netfilter.h:257 ip6_xmit+0x1841/0x1c00 net/ipv6/ip6_output.c:261 sctp_v6_xmit+0x3b7/0x470 net/sctp/ipv6.c:225 sctp_packet_transmit+0x38cb/0x3a20 net/sctp/output.c:632 sctp_outq_flush+0xeb3/0x46e0 net/sctp/outqueue.c:885 sctp_outq_uncork+0xb2/0xd0 net/sctp/outqueue.c:750 sctp_side_effects net/sctp/sm_sideeffect.c:1773 sctp_do_sm+0x6962/0x6ec0 net/sctp/sm_sideeffect.c:1147 sctp_primitive_ASSOCIATE+0x12c/0x160 net/sctp/primitive.c:88 sctp_sendmsg+0x43e5/0x4f90 net/sctp/socket.c:1954 inet_sendmsg+0x498/0x670 net/ipv4/af_inet.c:762 sock_sendmsg_nosec net/socket.c:633 sock_sendmsg net/socket.c:643 SYSC_sendto+0x608/0x710 net/socket.c:1696 SyS_sendto+0x8a/0xb0 net/socket.c:1664 do_syscall_64+0xe6/0x130 arch/x86/entry/common.c:285 entry_SYSCALL64_slow_path+0x25/0x25 arch/x86/entry/entry_64.S:246 RIP: 0033:0x401133 RSP: 002b:00007fff6d99cd38 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00000000004002b0 RCX: 0000000000401133 RDX: 0000000000000001 RSI: 0000000000494088 RDI: 0000000000000003 RBP: 00007fff6d99cd90 R08: 00007fff6d99cd50 R09: 000000000000001c R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000000 R13: 00000000004063d0 R14: 0000000000406460 R15: 0000000000000000 origin: save_stack_trace+0x37/0x40 arch/x86/kernel/stacktrace.c:59 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:302 kmsan_internal_poison_shadow+0xb1/0x1a0 mm/kmsan/kmsan.c:198 kmsan_poison_shadow+0x6d/0xc0 mm/kmsan/kmsan.c:211 slab_alloc_node mm/slub.c:2743 __kmalloc_node_track_caller+0x200/0x360 mm/slub.c:4351 __kmalloc_reserve net/core/skbuff.c:138 __alloc_skb+0x26b/0x840 net/core/skbuff.c:231 alloc_skb ./include/linux/skbuff.h:933 sctp_packet_transmit+0x31e/0x3a20 net/sctp/output.c:570 sctp_outq_flush+0xeb3/0x46e0 net/sctp/outqueue.c:885 sctp_outq_uncork+0xb2/0xd0 net/sctp/outqueue.c:750 sctp_side_effects net/sctp/sm_sideeffect.c:1773 sctp_do_sm+0x6962/0x6ec0 net/sctp/sm_sideeffect.c:1147 sctp_primitive_ASSOCIATE+0x12c/0x160 net/sctp/primitive.c:88 sctp_sendmsg+0x43e5/0x4f90 net/sctp/socket.c:1954 inet_sendmsg+0x498/0x670 net/ipv4/af_inet.c:762 sock_sendmsg_nosec net/socket.c:633 sock_sendmsg net/socket.c:643 SYSC_sendto+0x608/0x710 net/socket.c:1696 SyS_sendto+0x8a/0xb0 net/socket.c:1664 do_syscall_64+0xe6/0x130 arch/x86/entry/common.c:285 return_from_SYSCALL_64+0x0/0x6a arch/x86/entry/entry_64.S:246 ==================================================================
--- include/net/sctp/sctp.h | 4 ++++ 1 file changed, 4 insertions(+)
include/net/sctp/sctp.h +4 -0
@@ -448,6 +448,8 @@ _sctp_walk_params((pos), (chunk), ntohs(#define _sctp_walk_params (pos, chunk, end, member)\ for (pos.v = chunk->member;\ + (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <\ + (void *)chunk + end) &&\ pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ pos.v += WORD_ROUND(ntohs(pos.p->length)))
@@ -458,6 +460,8 @@ _sctp_walk_errors((err), (chunk_hdr), nt#define _sctp_walk_errors (err, chunk_hdr, end)\ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ sizeof(sctp_chunkhdr_t));\ + ((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <\ + (void *)chunk_hdr + end) &&\ (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ ntohs(err->length) >= sizeof(sctp_errhdr_t); \ err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length))))
PATCH 69/294 sctp: fix the check for _sctp_walk_params and _sctp_walk_errors
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
commit 6b84202c946cd3da3a8daa92c682510e9ed80321 upstream.
Commit b1f5bfc27a19 ("sctp: don't dereference ptr before leaving _sctp_walk_{params, errors}()") tried to fix the issue that it may overstep the chunk end for _sctp_walk_{params, errors} with 'chunk_end > offset(length) + sizeof(length)'.
But it introduced a side effect: When processing INIT, it verifies the chunks with 'param.v == chunk_end' after iterating all params by sctp_walk_params(). With the check 'chunk_end > offset(length)
+ sizeof(length)', it would return when the last param is not yet accessed. Because the last param usually is fwdtsn supported param whose size is 4 and 'chunk_end == offset(length) + sizeof(length)'
This is a badly issue even causing sctp couldn't process 4-shakes. Client would always get abort when connecting to server, due to the failure of INIT chunk verification on server.
The patch is to use 'chunk_end <= offset(length) + sizeof(length)' instead of 'chunk_end < offset(length) + sizeof(length)' for both _sctp_walk_params and _sctp_walk_errors.
--- include/net/sctp/sctp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/sctp/sctp.h +2 -2
@@ -448,7 +448,7 @@ _sctp_walk_params((pos), (chunk), ntohs(#define _sctp_walk_params (pos, chunk, end, member)\ for (pos.v = chunk->member;\ - (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <\ + (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <=\ (void *)chunk + end) &&\ pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\
@@ -460,7 +460,7 @@ _sctp_walk_errors((err), (chunk_hdr), nt#define _sctp_walk_errors (err, chunk_hdr, end)\ for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ sizeof(sctp_chunkhdr_t));\ - ((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <\ + ((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <=\ (void *)chunk_hdr + end) &&\ (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ ntohs(err->length) >= sizeof(sctp_errhdr_t); \
PATCH 70/294 net/mlx5: Fix command bad flow on command entry allocation failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Moshe Shemesh <[email protected]>
commit 219c81f7d1d5a89656cb3b53d3b4e11e93608d80 upstream.
When driver fail to allocate an entry to send command to FW, it must notify the calling function and release the memory allocated for this command.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +17 -2
@@ -547,6 +547,10 @@ static void cb_timeout_handler(struct womlx5_cmd_comp_handler (dev,1UL << ent->idx); } +static void free_msg (struct mlx5_core_dev *dev,struct mlx5_cmd_msg *msg); +static void mlx5_free_cmd_msg (struct mlx5_core_dev *dev, +struct mlx5_cmd_msg *msg); +static void cmd_work_handler (struct work_struct *work) { struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work);
@@ -555,16 +559,27 @@ static void cmd_work_handler(struct workunsigned long cb_timeout =msecs_to_jiffies (MLX5_CMD_TIMEOUT_MSEC );struct mlx5_cmd_layout *lay;struct semaphore *sem; +int alloc_ret; sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;down (sem);if (!ent->page_queue) { - ent->idx =alloc_ent (cmd); -if (ent->idx <0 ) { + alloc_ret =alloc_ent (cmd); +if (alloc_ret <0 ) {mlx5_core_err (dev,"failed to allocate command entry\n" ); +if (ent->callback) { + ent->callback (-EAGAIN , ent->context); +mlx5_free_cmd_msg (dev, ent->out); +free_msg (dev, ent->in); +free_cmd (ent); + }else { + ent->ret = -EAGAIN ; +complete (&ent->done); + }up (sem);return ; } + ent->idx = alloc_ret; }else { ent->idx = cmd->max_reg_cmds; }
PATCH 71/294 ARM: pxa: select both FB and FB_W100 for eseries
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 1d20d8a9fce8f1e2ef00a0f3d068fa18d59ddf8f upstream.
We get a link error trying to access the w100fb_gpio_read/write functions from the platform when the driver is a loadable module or not built-in, so the platform already uses 'select' to hard-enable the driver.
However, that fails if the framebuffer subsystem is disabled altogether.
I've considered various ways to fix this properly, but they all seem like too much work or too risky, so this simply adds another 'select' to force the subsystem on as well.
--- arch/arm/mach-pxa/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-pxa/Kconfig +1 -0
@@ -546,6 +546,7 @@ config MACH_ICONTROL config ARCH_PXA_ESERIES bool "PXA based Toshiba e-series PDAs" select FB_W100 + select FB select PXA25x config MACH_E330
PATCH 72/294 powerpc/boot: Fix 64-bit boot wrapper build with non-biarch compiler
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 65c5ec11c25eff6ba6e9b1cbfff014875fddd1e0 upstream.
Historically the boot wrapper was always built 32-bit big endian, even for 64-bit kernels. That was because old firmwares didn't necessarily support booting a 64-bit image. Because of that arch/powerpc/boot/Makefile uses CROSS32CC for compilation.
However when we added 64-bit little endian support, we also added support for building the boot wrapper 64-bit. However we kept using CROSS32CC, because in most cases it is just CC and everything works.
However if the user doesn't specify CROSS32_COMPILE (which no one ever does AFAIK), and CC is *not* biarch (32/64-bit capable), then CROSS32CC becomes just "gcc". On native systems that is probably OK, but if we're cross building it definitely isn't, leading to eg:
gcc ... -m64 -mlittle-endian -mabi=elfv2 ... arch/powerpc/boot/cpm-serial.c
gcc: error: unrecognized argument in option ‘-mabi=elfv2’
gcc: error: unrecognized command line option ‘-mlittle-endian’
make: *** [zImage] Error 2
To fix it, stop using CROSS32CC, because we may or may not be building 32-bit. Instead setup a BOOTCC, which defaults to CC, and only use CROSS32_COMPILE if it's set and we're building for 32-bit.
---
arch/powerpc/boot/Makefile +12 -4
@@ -21,11 +21,19 @@ all: $(obj)/zImage BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -Os -msoft-float -pipe \ - -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ - -isystem $(shell $(CROSS32CC) -print-file-name=include) + -fomit-frame-pointer -fno-builtin -fPIC -nostdinc +BOOTCC := $(CC) ifdef CONFIG_PPC64_BOOT_WRAPPER BOOTCFLAGS += -m64 +else +BOOTCFLAGS += -m32 +ifdef CROSS32_COMPILE + BOOTCC := $(CROSS32_COMPILE)gcc +endif endif + +BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) + ifdef CONFIG_CPU_BIG_ENDIAN BOOTCFLAGS += -mbig-endian else
@@ -165,10 +173,10 @@ clean-files := $(zlib) $(zlibheader) $(z empty.c zImage.coff.lds zImage.ps3.lds zImage.lds quiet_cmd_bootcc = BOOTCC $@ - cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< + cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< quiet_cmd_bootas = BOOTAS $@ - cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< + cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< quiet_cmd_bootar = BOOTAR $@ cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
PATCH 73/294 xtensa: fix cache aliasing handling code for WT cache
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 6d0f581d1768d3eaba15776e7dd1fdfec10cfe36 upstream.
Currently building kernel for xtensa core with aliasing WT cache fails with the following messages:
mm/memory.c:2152: undefined reference to flush_dcache_page' mm/memory.c:2332: undefined reference to local_flush_cache_page' mm/memory.c:1919: undefined reference to local_flush_cache_range' mm/memory.c:4179: undefined reference to copy_to_user_page' mm/memory.c:4183: undefined reference to `copy_from_user_page'
This happens because implementation of these functions is only compiled when data cache is WB, which looks wrong: even when data cache doesn't need flushing it still needs invalidation. The functions like __flush_[invalidate_]dcache_* are correctly defined for both WB and WT caches (and even if they weren't that'd still be ok, just slower).
Fix this by providing the same implementation of the above functions for both WB and WT cache.
---
arch/xtensa/mm/cache.c +4 -4
@@ -63,7 +63,7 @@#error "HIGHMEM is not supported on cores with aliasing cache."#endif -#if (DCACHE_WAY_SIZE >PAGE_SIZE ) &&XCHAL_DCACHE_IS_WRITEBACK +#if (DCACHE_WAY_SIZE >PAGE_SIZE )/* * Any time the kernel writes to a user page cache page, or it is about to
@@ -148,7 +148,7 @@ void local_flush_cache_page(struct vm_ar __invalidate_icache_page_alias(virt, phys); } -#endif +#endif /* DCACHE_WAY_SIZE > PAGE_SIZE */ void update_mmu_cache (struct vm_area_struct * vma,unsigned long addr,pte_t *ptep)
@@ -165,7 +165,7 @@ update_mmu_cache(struct vm_area_struct *flush_tlb_page (vma, addr); -#if (DCACHE_WAY_SIZE >PAGE_SIZE ) &&XCHAL_DCACHE_IS_WRITEBACK +#if (DCACHE_WAY_SIZE >PAGE_SIZE )if (!PageReserved (page) &&test_bit (PG_arch_1, &page->flags)) {
@@ -197,7 +197,7 @@ update_mmu_cache(struct vm_area_struct ** flush_dcache_page() on the page. */ -#if (DCACHE_WAY_SIZE >PAGE_SIZE ) &&XCHAL_DCACHE_IS_WRITEBACK +#if (DCACHE_WAY_SIZE >PAGE_SIZE ) void copy_to_user_page(struct vm_area_struct *vma, struct page *page, unsigned long vaddr, void *dst, const void *src,
PATCH 74/294 USB: hcd: Mark secondary HCD as dead if the primary one died
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit cd5a6a4fdaba150089af2afc220eae0fef74878a upstream.
Make usb_hc_died() clear the HCD_FLAG_RH_RUNNING flag for the shared HCD and set HCD_FLAG_DEAD for it, in analogy with what is done for the primary one.
Among other thigs, this prevents check_root_hub_suspended() from returning -EBUSY for dead HCDs which helps to work around system suspend issues in some situations.
This actually fixes occasional suspend failures on one of my test machines.
--- drivers/usb/core/hcd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/core/hcd.c +2 -0
@@ -2402,6 +2402,8 @@ void usb_hc_died (struct usb_hcd *hcd) }if (usb_hcd_is_primary_hcd (hcd) && hcd->shared_hcd) { hcd = hcd->shared_hcd; +clear_bit (HCD_FLAG_RH_RUNNING , &hcd->flags); +set_bit (HCD_FLAG_DEAD , &hcd->flags);if (hcd->rh_registered) {clear_bit (HCD_FLAG_POLL_RH , &hcd->flags);
PATCH 75/294 uas: Add US_FL_IGNORE_RESIDUE for Initio Corporation INIC-3069
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Swanson <[email protected]>
commit 89f23d51defcb94a5026d4b5da13faf4e1150a6f upstream.
Similar to commit d595259fbb7a ("usb-storage: Add ignore-residue quirk for Initio INIC-3619") for INIC-3169 in unusual_devs.h but INIC-3069 already present in unusual_uas.h. Both in same controller IC family.
Issue is that MakeMKV fails during key exchange with installed bluray drive with following error:
002004:0000 Error 'Scsi error - ILLEGAL REQUEST:COPY PROTECTION KEY EXCHANGE FAILURE - KEY NOT ESTABLISHED' occurred while issuing SCSI command AD010..080002400 to device 'SG:dev_11:0'
--- drivers/usb/storage/unusual_uas.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/storage/unusual_uas.h +2 -2
@@ -113,9 +113,9 @@ UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x99/* Reported-by: Benjamin Tissoires <[email protected]> */ UNUSUAL_DEV (0x13fd ,0x3940 ,0x0000 ,0x9999 ,"Initio Corporation" , -"" , +"INIC-3069" ,USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , -US_FL_NO_ATA_1X ), +US_FL_NO_ATA_1X |US_FL_IGNORE_RESIDUE ),/* Reported-by: Tom Arild Naess <[email protected]> */ UNUSUAL_DEV(0x152d, 0x0539, 0x0000, 0x9999,
PATCH 76/294 batman-adv: fix TT sync flag inconsistencies
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Lüssing <[email protected]>
commit 54e22f265e872ae140755b3318521d400a094605 upstream.
This patch fixes an issue in the translation table code potentially leading to a TT Request + Response storm. The issue may occur for nodes involving BLA and an inconsistent configuration of the batman-adv AP isolation feature. However, since the new multicast optimizations, a single, malformed packet may lead to a mesh-wide, persistent Denial-of-Service, too.
The issue occurs because nodes are currently OR-ing the TT sync flags of all originators announcing a specific MAC address via the translation table. When an intermediate node now receives a TT Request and wants to answer this on behalf of the destination node, then this intermediate node now responds with an altered flag field and broken CRC. The next OGM of the real destination will lead to a CRC mismatch and triggering a TT Request and Response again.
Furthermore, the OR-ing is currently never undone as long as at least one originator announcing the according MAC address remains, leading to the potential persistency of this issue.
This patch fixes this issue by storing the flags used in the CRC calculation on a a per TT orig entry basis to be able to respond with the correct, original flags in an intermediate TT Response for one thing. And to be able to correctly unset sync flags once all nodes announcing a sync flag vanish for another.
[bwh: Backported to 3.16:
- Drop changes to batadv_tt_global_dump_subentry()
- Use batadv_tt_orig_list_entry_free_ref() instead of batadv_tt_orig_list_entry_put()
- Adjust context]
--- net/batman-adv/translation-table.c | 60 ++++++++++++++++++++++++++++++++------ net/batman-adv/types.h | 2 ++ 2 files changed, 53 insertions(+), 9 deletions(-)
net/batman-adv/translation-table.c +49 -8
@@ -1233,9 +1233,41 @@ batadv_tt_global_entry_has_orig(const streturn found; } +/** +* batadv_tt_global_sync_flags - update TT sync flags +* @tt_global: the TT global entry to update sync flags in +* +* Updates the sync flag bits in the tt_global flag attribute with a logical +* OR of all sync flags from any of its TT orig entries. +*/ +static void +batadv_tt_global_sync_flags (struct batadv_tt_global_entry *tt_global) +{ +struct batadv_tt_orig_list_entry *orig_entry; +const struct hlist_head *head; +u16 flags =BATADV_NO_FLAGS ; + +rcu_read_lock (); + head = &tt_global->orig_list; +hlist_for_each_entry_rcu (orig_entry, head, list) + flags |= orig_entry->flags; +rcu_read_unlock (); + + flags |= tt_global->common.flags & (~BATADV_TT_SYNC_MASK ); + tt_global->common.flags = flags; +} + +/** +* batadv_tt_global_orig_entry_add - add or update a TT orig entry +* @tt_global: the TT global entry to add an orig entry in +* @orig_node: the originator to add an orig entry for +* @ttvn: translation table version number of this changeset +* @flags: TT sync flags +*/ static void batadv_tt_global_orig_entry_add (struct batadv_tt_global_entry *tt_global, -struct batadv_orig_node *orig_node,int ttvn) +struct batadv_orig_node *orig_node,int ttvn, +u8 flags) {struct batadv_tt_orig_list_entry *orig_entry;
@@ -1245,7 +1277,8 @@ batadv_tt_global_orig_entry_add(struct b* was added during a "temporary client detection" */ orig_entry->ttvn = ttvn; - goto out; + orig_entry->flags = flags; + goto sync_flags; } orig_entry =kzalloc (sizeof (*orig_entry),GFP_ATOMIC );
@@ -1257,6 +1290,7 @@ batadv_tt_global_orig_entry_add(struct bbatadv_tt_global_size_inc (orig_node, tt_global->common.vid); orig_entry->orig_node = orig_node; orig_entry->ttvn = ttvn; + orig_entry->flags = flags;atomic_set (&orig_entry->refcount,2 );spin_lock_bh (&tt_global->list_lock);
@@ -1265,6 +1299,8 @@ batadv_tt_global_orig_entry_add(struct bspin_unlock_bh (&tt_global->list_lock);atomic_inc (&tt_global->orig_list_count); +sync_flags: +batadv_tt_global_sync_flags (tt_global); out:if (orig_entry)batadv_tt_orig_list_entry_free_ref (orig_entry);
@@ -1379,10 +1415,10 @@ static bool batadv_tt_global_add(struct common->flags &= ~BATADV_TT_CLIENT_TEMP ;/* the change can carry possible "attribute" flags like the -* TT_CLIENT_WIFI, therefore they have to be copied in the +* TT_CLIENT_TEMP, therefore they have to be copied in the * client entry */ - tt_global_entry->common.flags |= flags; + tt_global_entry->common.flags |= flags & (~BATADV_TT_SYNC_MASK );/* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only * one originator left in the list and we previously received a
@@ -1399,7 +1435,8 @@ static bool batadv_tt_global_add(struct } add_orig_entry:/* add the new orig_entry (if needed) or update it */ -batadv_tt_global_orig_entry_add (tt_global_entry, orig_node, ttvn); +batadv_tt_global_orig_entry_add (tt_global_entry, orig_node, ttvn, + flags &BATADV_TT_SYNC_MASK ); batadv_dbg(BATADV_DBG_TT, bat_priv, "Creating new global tt entry: %pM (vid: %d, via %pM)\n",
@@ -2045,6 +2082,7 @@ static uint32_t batadv_tt_global_crc(str unsigned short vid) {struct batadv_hashtable *hash = bat_priv->tt.global_hash; +struct batadv_tt_orig_list_entry *tt_orig;struct batadv_tt_common_entry *tt_common;struct batadv_tt_global_entry *tt_global;struct hlist_head *head;
@@ -2083,8 +2121,9 @@ static uint32_t batadv_tt_global_crc(str/* find out if this global entry is announced by this * originator */ -if (!batadv_tt_global_entry_has_orig (tt_global, - orig_node)) + tt_orig =batadv_tt_global_orig_entry_find (tt_global, + orig_node); +if (!tt_orig)continue ;/* use network order to read the VID: this ensures that
@@ -2096,10 +2135,12 @@ static uint32_t batadv_tt_global_crc(str/* compute the CRC on flags that have to be kept in sync * among nodes */ - flags = tt_common->flags &BATADV_TT_SYNC_MASK ; + flags = tt_orig->flags; crc_tmp =crc32c (crc_tmp, &flags,sizeof (flags)); crc ^=crc32c (crc_tmp, tt_common->addr,ETH_ALEN ); + +batadv_tt_orig_list_entry_free_ref (tt_orig); }rcu_read_unlock (); }
net/batman-adv/types.h +2 -0
@@ -968,6 +968,7 @@ struct batadv_tt_global_entry {* struct batadv_tt_orig_list_entry - orig node announcing a non-mesh client * @orig_node: pointer to orig node announcing this non-mesh client * @ttvn: translation table version number which added the non-mesh client +* @flags: per orig entry TT sync flags * @list: list node for batadv_tt_global_entry::orig_list * @refcount: number of contexts the object is used * @rcu: struct used for freeing in an RCU-safe manner
@@ -975,6 +976,7 @@ struct batadv_tt_global_entry {struct batadv_tt_orig_list_entry {struct batadv_orig_node *orig_node;uint8_t ttvn; +u8 flags;struct hlist_node list;atomic_t refcount;struct rcu_head rcu;
Re: [PATCH 3.16 076/294] batman-adv: fix TT sync flag inconsistencies
Hi Ben!
Quoted 7 lines · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Lüssing <[email protected]>
commit
54e22f265e872ae140755b3318521d400a094605upstream.
[...]
Quoted 2 lines
[bwh: Backported to 3.16:
- Drop changes tobatadv_tt_global_dump_subentry()
May I ask, were there specific concerns for stable 3.16 kernel releases with this change?
It's not bothering me, but I'm currently wondering whether this could cause some confusion to users.
Regards, Linus
Re: [PATCH 3.16 076/294] batman-adv: fix TT sync flag inconsistencies
Quoted 13 lines · Linus Lüssing
Hi Ben!
Quoted 8 lines · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Lüssing <[email protected]>
commit
54e22f265e872ae140755b3318521d400a094605upstream.[...]
Quoted 8 lines
Quoted 2 lines
[bwh: Backported to 3.16:
- Drop changes tobatadv_tt_global_dump_subentry()May I ask, were there specific concerns for stable 3.16 kernel releases with this change?
It's not bothering me, but I'm currently wondering whether this could cause some confusion to users.
That function didn't exist in 3.16 (at least not under that name).
Ben.
Signature · 3 lines
Ben Hutchings It is impossible to make anything foolproof because fools are so ingenious.
Re: [PATCH 3.16 076/294] batman-adv: fix TT sync flag inconsistencies
Hi Ben,
Quoted 1 line · Ben Hutchings
That function didn't exist in 3.16 (at least not under that name).
Ah, you're right, back then the netlink interface did not exist in batman-adv yet, only the debugfs one. batadv_tt_global_print_entry would be the equivalent function for debugfs. But not worth the effort now, in my opinion.
I'm fine with this proposed patch for 3.16 now. Thanks for the clarification! And I'm happy to see this patch backported.
Regards, Linus
PATCH 77/294 pinctrl: sunxi: add a missing function of A10/A20 pinctrl driver
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
commit d81ece747d8727bb8b1cfc9a20dbe62f09a4e35a upstream.
The PH16 pin has a function with mux id 0x5, which is the DET pin of the "sim" (smart card reader) IP block.
This function is missing in old versions of A10/A20 SoCs' datasheets and user manuals, so it's also missing in the old drivers. The newest A10 Datasheet V1.70 and A20 Datasheet V1.41 contain this pin function, and it's discovered during implementing R40 pinctrl driver.
Add it to the driver. As we now merged A20 pinctrl driver to the A10 one, we need to only fix the A10 driver now.
driver to a driver of its own")
--- drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c +1 -0
@@ -800,6 +800,7 @@ static const struct sunxi_desc_pin sun4i SUNXI_FUNCTION(0x2, "lcd1"), /* D16 */ SUNXI_FUNCTION(0x3, "pata"), /* ATAD12 */ SUNXI_FUNCTION(0x4, "keypad"), /* IN6 */ + SUNXI_FUNCTION(0x5, "sim"), /* DET */ SUNXI_FUNCTION_IRQ(0x6, 16), /* EINT16 */ SUNXI_FUNCTION(0x7, "csi1")), /* D16 */ SUNXI_PIN(SUNXI_PINCTRL_PIN(H, 17),
PATCH 78/294 iwlwifi: mvm: set the RTS_MIMO_PROT bit in flag mask when sending sta to fw
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Naftali Goldstein <[email protected]>
commit 8addabf8e6e299f790038fdc92ddceaaf76adab8 upstream.
Set the STA_FLG_RTS_MIMO_PROT bit in station_flags_msk of the add sta command, so that when smps mode changes, the FW will know about it.
In particular, in AP mode, clients are added upon receival of an auth request, at which point there's no knowledge of the client's smps mode. When the assoc request arrives, the add_sta command is resent to modify the station parameters. At this point the driver knows the smps mode, but since the corresponding bit in the mask is not set, the fw doesn't update this field so there's no rts protection for mimo.
--- drivers/net/wireless/iwlwifi/mvm/sta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/mvm/sta.c +2 -1
@@ -114,7 +114,8 @@ int iwl_mvm_sta_send_to_fw(struct iwl_mv add_sta_cmd.add_modify = update ?1 :0 ; add_sta_cmd.station_flags_msk |=cpu_to_le32 (STA_FLG_FAT_EN_MSK | -STA_FLG_MIMO_EN_MSK ); +STA_FLG_MIMO_EN_MSK | +STA_FLG_RTS_MIMO_PROT );switch (sta->bandwidth) {case IEEE80211_STA_RX_BW_160 :
PATCH 79/294 xtensa: don't limit csum_partial export by CONFIG_NET
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 7f81e55c737a8fa82c71f290945d729a4902f8d2 upstream.
csum_partial and csum_partial_copy_generic are defined unconditionally and are available even when CONFIG_NET is disabled. They are used not only by the network drivers, but also by scsi and media. Don't limit these functions export by CONFIG_NET.
--- arch/xtensa/kernel/xtensa_ksyms.c | 2 -- 1 file changed, 2 deletions(-)
arch/xtensa/kernel/xtensa_ksyms.c +0 -2
@@ -94,13 +94,11 @@ unsigned long __sync_fetch_and_or_4(unsi }EXPORT_SYMBOL (__sync_fetch_and_or_4); -#ifdef CONFIG_NET /* * Networking support */ EXPORT_SYMBOL (csum_partial);EXPORT_SYMBOL (csum_partial_copy_generic); -#endif /* CONFIG_NET */ /* * Architecture-specific symbols
PATCH 80/294 xtensa: mm/cache: add missing EXPORT_SYMBOLs
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit bc652eb6a0d5cffaea7dc8e8ad488aab2a1bf1ed upstream.
Functions clear_user_highpage, copy_user_highpage, flush_dcache_page, local_flush_cache_range and local_flush_cache_page may be used from modules. Export them.
---
arch/xtensa/mm/cache.c +3 -1
@@ -116,7 +116,7 @@ void flush_dcache_page(struct page *page/* There shouldn't be an entry in the cache for this page anymore. */ } - +EXPORT_SYMBOL (flush_dcache_page);/* * For now, flush the whole cache. FIXME??
@@ -128,6 +128,7 @@ void local_flush_cache_range(struct vm_a__flush_invalidate_dcache_all ();__invalidate_icache_all (); } +EXPORT_SYMBOL (local_flush_cache_range);/* * Remove any entry in the cache for this page.
@@ -147,6 +148,7 @@ void local_flush_cache_page(struct vm_ar__flush_invalidate_dcache_page_alias (virt, phys); __invalidate_icache_page_alias(virt, phys); } +EXPORT_SYMBOL (local_flush_cache_page);#endif /* DCACHE_WAY_SIZE > PAGE_SIZE */
PATCH 81/294 USB: serial: option: add D-Link DWM-222 device ID
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hector Martin <[email protected]>
commit fd1b8668af59a11bb754a6c9b0051c6c5ce73b74 upstream.
Add device id for D-Link DWM-222.
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -2036,6 +2036,8 @@ static const struct usb_device_id option { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7d04, 0xff) }, /* D-Link DWM-158 */ { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e19, 0xff), /* D-Link DWM-221 B1 */ .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e35, 0xff), /* D-Link DWM-222 */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */
PATCH 82/294 drm/msm: Fix potential buffer overflow issue
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kasin Li <[email protected]>
commit 4a630fadbb29d9efaedb525f1a8f7449ad107641 upstream.
In function submit_create, if nr_cmds or nr_bos is assigned with negative value, the allocated buffer may be small than intended. Using this buffer will lead to buffer overflow issue.
---
drivers/gpu/drm/msm/msm_gem_submit.c +5 -2
@@ -34,10 +34,13 @@ static inline void __user *to_user_ptr(u }static struct msm_gem_submit *submit_create (struct drm_device *dev, -struct msm_gpu *gpu,int nr) +struct msm_gpu *gpu,uint32_t nr) {struct msm_gem_submit *submit; -int sz =sizeof (*submit) + (nr *sizeof (submit->bos[0 ])); +uint64_t sz =sizeof (*submit) + (nr *sizeof (submit->bos[0 ])); + +if (sz >SIZE_MAX ) +return NULL ; submit =kmalloc (sz,GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY);if (submit) {
PATCH 83/294 drm/msm: fix an integer overflow test
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 65e93108891e571f177c202add9288eda9ac4100 upstream.
We recently added an integer overflow check but it needs an additional tweak to work properly on 32 bit systems.
The problem is that we're doing the right hand side of the assignment as type unsigned long so the max it will have an integer overflow instead of being larger than SIZE_MAX. That means the "sz > SIZE_MAX" condition is never true even on 32 bit systems. We need to first cast it to u64 and then do the math.
---
drivers/gpu/drm/msm/msm_gem_submit.c +1 -1
@@ -37,7 +37,7 @@ static struct msm_gem_submit *submit_cre struct msm_gpu *gpu, uint32_t nr) {struct msm_gem_submit *submit; -uint64_t sz =sizeof (*submit) + (nr *sizeof (submit->bos[0 ])); +uint64_t sz =sizeof (*submit) + ((u64 )nr *sizeof (submit->bos[0 ]));if (sz >SIZE_MAX )return NULL ;
PATCH 84/294 KVM: async_pf: make rcu irq exit if not triggered from idle task
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
commit 337c017ccdf2653d0040099433fc1a2b1beb5926 upstream.
WARNING: CPU: 5 PID: 1242 at kernel/rcu/tree_plugin.h:323 rcu_note_context_switch+0x207/0x6b0 CPU: 5 PID: 1242 Comm: unity-settings- Not tainted 4.13.0-rc2+ #1 RIP: 0010:rcu_note_context_switch+0x207/0x6b0 Call Trace: __schedule+0xda/0xba0 ? kvm_async_pf_task_wait+0x1b2/0x270 schedule+0x40/0x90 kvm_async_pf_task_wait+0x1cc/0x270 ? prepare_to_swait+0x22/0x70 do_async_page_fault+0x77/0xb0 ? do_async_page_fault+0x77/0xb0 async_page_fault+0x28/0x30 RIP: 0010:__d_lookup_rcu+0x90/0x1e0
I encounter this when trying to stress the async page fault in L1 guest w/ L2 guests running.
Commit 9b132fbe5419 (Add rcu user eqs exception hooks for async page fault) adds rcu_irq_enter/exit() to kvm_async_pf_task_wait() to exit cpu idle eqs when needed, to protect the code that needs use rcu. However, we need to call the pair even if the function calls schedule(), as seen from the above backtrace.
This patch fixes it by informing the RCU subsystem exit/enter the irq towards/away from idle for both n.halted and !n.halted.
--- arch/x86/kernel/kvm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/kernel/kvm.c +4 -2
@@ -150,6 +150,8 @@ void kvm_async_pf_task_wait(u32 token)if (hlist_unhashed (&n.link))break ; +rcu_irq_exit (); +if (!n.halted) {local_irq_enable ();schedule ();
@@ -158,11 +160,11 @@ void kvm_async_pf_task_wait(u32 token)/* * We cannot reschedule. So halt. */ -rcu_irq_exit ();native_safe_halt ();local_irq_disable (); -rcu_irq_enter (); } + +rcu_irq_enter (); }if (!n.halted)finish_wait (&n.wq, &wait);
Re: [PATCH 3.16 084/294] KVM: async_pf: make rcu irq exit if not triggered from idle task
Quoted 61 lines · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
commit
337c017ccdf2653d0040099433fc1a2b1beb5926upstream.WARNING: CPU: 5 PID: 1242 at kernel/rcu/tree_plugin.h:323 rcu_note_context_switch+0x207/0x6b0 CPU: 5 PID: 1242 Comm: unity-settings- Not tainted 4.13.0-rc2+ #1 RIP: 0010:rcu_note_context_switch+0x207/0x6b0 Call Trace: __schedule+0xda/0xba0 ? kvm_async_pf_task_wait+0x1b2/0x270 schedule+0x40/0x90 kvm_async_pf_task_wait+0x1cc/0x270 ? prepare_to_swait+0x22/0x70 do_async_page_fault+0x77/0xb0 ? do_async_page_fault+0x77/0xb0 async_page_fault+0x28/0x30 RIP: 0010:__d_lookup_rcu+0x90/0x1e0I encounter this when trying to stress the async page fault in L1 guest w/ L2 guests running.
Commit
9b132fbe5419(Add rcu user eqs exception hooks for async page fault) adds rcu_irq_enter/exit() tokvm_async_pf_task_wait()to exit cpu idle eqs when needed, to protect the code that needs use rcu. However, we need to call the pair even if the function callsschedule(), as seen from the above backtrace.This patch fixes it by informing the RCU subsystem exit/enter the irq towards/away from idle for both n.halted and !n.halted.
Cc Paolo Bonzini <[email protected]>Cc Radim Krčmář <[email protected]>Cc Paul E. McKenney <[email protected]>Signed-off-by Wanpeng Li <[email protected]>Reviewed-by Paolo Bonzini <[email protected]>Signed-off-by Radim Krčmář <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- arch/x86/kernel/kvm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)arch/x86/kernel/kvm.c +2
-0@@ -150,6 +150,8 @@ void kvm_async_pf_task_wait(u32 token)if (hlist_unhashed (&n.link))break ; +rcu_irq_exit (); +if (!n.halted) {local_irq_enable ();schedule ();@@ -158,11 +160,11 @@ void kvm_async_pf_task_wait(u32 token)/* * We cannot reschedule. So halt. */
arch/x86/kernel/kvm.c void kvm_async_pf_task_wait(u32 token) · line 170
Quoted 10 lines
arch/x86/kernel/kvm.c +2
-2-rcu_irq_exit ();native_safe_halt ();local_irq_disable (); -rcu_irq_enter (); } + +rcu_irq_enter (); }if (!n.halted)finish_wait (&n.wq, &wait);
Looks good, please backport
b862789aa5186d5ea3a024b7cfe0f80c3a38b980 anda2b7861bb33b2538420bb5d8554153484d3f961f
as well.
Thanks,
Paolo
Re: [PATCH 3.16 084/294] KVM: async_pf: make rcu irq exit if not triggered from idle task
Quoted 8 lines · Paolo Bonzini
Quoted 7 lines · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
commit
337c017ccdf2653d0040099433fc1a2b1beb5926upstream.
[...]
Quoted 6 lines
Looks good, please backport
b862789aa5186d5ea3a024b7cfe0f80c3a38b980anda2b7861bb33b2538420bb5d8554153484d3f961fas well.
Do they fix regressions related to this commit? If so, I'll add them
to this update. Otherwise I'll get to them later - I have not yet scanned through changes after 4.13.
Ben.
Signature · 3 lines
Ben Hutchings It is impossible to make anything foolproof because fools are so ingenious.
Re: [PATCH 3.16 084/294] KVM: async_pf: make rcu irq exit if not triggered from idle task
Quoted 12 lines · Ben Hutchings
Quoted 8 lines · Paolo Bonzini
Quoted 7 lines · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
commit
337c017ccdf2653d0040099433fc1a2b1beb5926upstream.[...]
Quoted 2 lines
Looks good, please backport
Quoted 7 lines
Quoted 4 lines
b862789aa5186d5ea3a024b7cfe0f80c3a38b980anda2b7861bb33b2538420bb5d8554153484d3f961fas well.
Do they fix regressions related to this commit? If so, I'll add them
to this update. Otherwise I'll get to them later - I have not yet scanned through changes after 4.13.
No, they fix other instances of the same bug.
Thanks,
Paolo
Re: [PATCH 3.16 084/294] KVM: async_pf: make rcu irq exit if not triggered from idle task
Quoted 18 lines · Paolo Bonzini
Quoted 17 lines · Ben Hutchings
Quoted 9 lines · Paolo Bonzini
Quoted 8 lines · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
commit
337c017ccdf2653d0040099433fc1a2b1beb5926upstream.[...]
Quoted 5 lines
Looks good, please backport
b862789aa5186d5ea3a024b7cfe0f80c3a38b980anda2b7861bb33b2538420bb5d8554153484d3f961f
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
as well.
Do they fix regressions related to this commit? If so, I'll add them
to this update. Otherwise I'll get to them later - I have not yet scanned through changes after 4.13.No, they fix other instances of the same bug.
Then I'll probably get to them in 3.16.52. Thanks.
Ben.
Signature · 3 lines
Ben Hutchings It is impossible to make anything foolproof because fools are so ingenious.
Re: [PATCH 3.16 084/294] KVM: async_pf: make rcu irq exit if not triggered from idle task
In reply to Paolo BonziniOn Tue, 2017-11-07 at 11:37 +0100, Paolo Bonzini wrote:
[...]
Quoted 6 lines
Looks good, please backport
b862789aa5186d5ea3a024b7cfe0f80c3a38b980anda2b7861bb33b2538420bb5d8554153484d3f961fas well.
OK, I've queued these up.
Ben.
Signature · 2 lines
Ben Hutchings If you seem to know what you are doing, you'll be given more to do.
PATCH 85/294 b44: Initialize 64-bit stats seqcount
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit e43c9f23efadade684773a855675c99da278c862 upstream.
On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.
--- drivers/net/ethernet/broadcom/b44.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/b44.c +1 -0
@@ -2372,6 +2372,7 @@ static int b44_init_one(struct ssb_devic bp->msg_enable =netif_msg_init (b44_debug,B44_DEF_MSG_ENABLE );spin_lock_init (&bp->lock); +u64_stats_init (&bp->hw_stats.syncp); bp->rx_pending =B44_DEF_RX_RING_PENDING ; bp->tx_pending =B44_DEF_TX_RING_PENDING ;
PATCH 86/294 i40e: Initialize 64-bit statistics TX ring seqcount
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 7d6d067790289e4f61f59fa60550ca5918aa25bd upstream.
On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -0
@@ -914,6 +914,8 @@ int i40e_setup_tx_descriptors(struct i40if (!tx_ring->tx_bi) goto err; +u64_stats_init (&tx_ring->syncp); +/* round up to nearest 4K */ tx_ring->size = tx_ring->count *sizeof (struct i40e_tx_desc );/* add u32 for head writeback, align after this takes care of
PATCH 87/294 ixgbe: Initialize 64-bit stats seqcounts
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 7c3a4626eb65e78ebe208f48ffa21a5002f7f38e upstream.
On 32-bit hosts and with CONFIG_DEBUG_LOCK_ALLOC we should be seeing a lockdep splat indicating this seqcount is not correctly initialized, fix that.
--- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +4 -0
@@ -2535,6 +2535,8 @@ int ixgbevf_setup_tx_resources(struct ixif (!tx_ring->tx_buffer_info) goto err; +u64_stats_init (&tx_ring->syncp); +/* round up to nearest 4K */ tx_ring->size = tx_ring->count *sizeof (union ixgbe_adv_tx_desc ); tx_ring->size =ALIGN (tx_ring->size,4096 );
@@ -2595,6 +2597,8 @@ int ixgbevf_setup_rx_resources(struct ixif (!rx_ring->rx_buffer_info) goto err; +u64_stats_init (&rx_ring->syncp); +/* Round up to nearest 4K */ rx_ring->size = rx_ring->count *sizeof (union ixgbe_adv_rx_desc ); rx_ring->size =ALIGN (rx_ring->size,4096 );
PATCH 88/294 gpio: tegra: fix unbalanced chained_irq_enter/exit
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michał Mirosław <[email protected]>
commit 9e9509e38fbe034782339eb09c915f0b5765ff69 upstream.
When more than one GPIO IRQs are triggered simultaneously, tegra_gpio_irq_handler() called chained_irq_exit() multiple times for one chained_irq_enter().
--- drivers/gpio/gpio-tegra.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-tegra.c +3 -3
@@ -271,7 +271,7 @@ static void tegra_gpio_irq_handler(unsigstruct tegra_gpio_bank *bank;int port;int pin; -int unmasked =0 ; +bool unmasked = false;struct irq_chip *chip =irq_desc_get_chip (desc);chained_irq_enter (chip, desc);
@@ -291,8 +291,8 @@ static void tegra_gpio_irq_handler(unsig* before executing the hander so that we don't * miss edges */ -if (lvl & (0x100 << pin)) { - unmasked =1 ; +if (!unmasked && lvl & (0x100 << pin)) { + unmasked = true;chained_irq_exit (chip, desc); }
PATCH 89/294 ALSA: hda - Fix speaker output from VAIO VPCL14M1R
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Sergei A. Trusov" <[email protected]>
commit 3f3c371421e601fa93b6cb7fb52da9ad59ec90b4 upstream.
Sony VAIO VPCL14M1R needs the quirk to make the speaker working properly.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -2285,6 +2285,7 @@ static const struct snd_pci_quirk alc882SND_PCI_QUIRK (0x1043 ,0x8691 ,"ASUS ROG Ranger VIII" ,ALC882_FIXUP_GPIO3 ),SND_PCI_QUIRK (0x104d ,0x9047 ,"Sony Vaio TT" ,ALC889_FIXUP_VAIO_TT ),SND_PCI_QUIRK (0x104d ,0x905a ,"Sony Vaio Z" ,ALC882_FIXUP_NO_PRIMARY_HP ), +SND_PCI_QUIRK (0x104d ,0x9060 ,"Sony Vaio VPCL14M1R" ,ALC882_FIXUP_NO_PRIMARY_HP ),SND_PCI_QUIRK (0x104d ,0x9043 ,"Sony Vaio VGC-LN51JGB" ,ALC882_FIXUP_NO_PRIMARY_HP ), SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
PATCH 90/294 net/mlx4_en: Fix wrong indication of Wake-on-LAN (WoL) support
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Inbar Karmy <[email protected]>
commit c994f778bb1cca8ebe7a4e528cefec233e93b5cc upstream.
Currently when WoL is supported but disabled, ethtool reports:
"Supports Wake-on: d".
Fix the indication of Wol support, so that the indication remains "g" all the time if the NIC supports WoL.
Tested:
As accepted, when NIC supports WoL- ethtool reports:
Supports Wake-on: g
Wake-on: d
when NIC doesn't support WoL- ethtool reports:
Supports Wake-on: d
Wake-on: d
--- drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 15 ++++++++------- drivers/net/ethernet/mellanox/mlx4/fw.c | 4 ++++ drivers/net/ethernet/mellanox/mlx4/fw.h | 1 + drivers/net/ethernet/mellanox/mlx4/main.c | 2 ++ include/linux/mlx4/device.h | 1 + 5 files changed, 16 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +8 -7
@@ -142,6 +142,7 @@ static void mlx4_en_get_wol(struct net_d struct ethtool_wolinfo *wol) {struct mlx4_en_priv *priv =netdev_priv (netdev); +struct mlx4_caps *caps = &priv->mdev->dev->caps;int err =0 ;u64 config =0 ;u64 mask;
@@ -154,24 +155,24 @@ static void mlx4_en_get_wol(struct net_d mask = (priv->port ==1 ) ?MLX4_DEV_CAP_FLAG_WOL_PORT1 :MLX4_DEV_CAP_FLAG_WOL_PORT2 ; -if (!(priv->mdev->dev->caps.flags & mask)) { +if (!(caps->flags & mask)) { wol->supported =0 ; wol->wolopts =0 ;return ; } +if (caps->wol_port[priv->port]) + wol->supported =WAKE_MAGIC ; +else + wol->supported =0 ; + err =mlx4_wol_read (priv->mdev->dev, &config, priv->port);if (err) {en_err (priv,"Failed to get WoL information\n" );return ; } -if (config &MLX4_EN_WOL_MAGIC ) - wol->supported =WAKE_MAGIC ; -else - wol->supported =0 ; - -if (config &MLX4_EN_WOL_ENABLED ) +if ((config &MLX4_EN_WOL_ENABLED ) && (config &MLX4_EN_WOL_MAGIC )) wol->wolopts =WAKE_MAGIC ;else wol->wolopts =0 ;
drivers/net/ethernet/mellanox/mlx4/fw.c +4 -0
@@ -532,6 +532,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *#define QUERY_DEV_CAP_CQ_TS_SUPPORT_OFFSET 0x3e#define QUERY_DEV_CAP_MAX_PKEY_OFFSET 0x3f#define QUERY_DEV_CAP_EXT_FLAGS_OFFSET 0x40 +#define QUERY_DEV_CAP_WOL_OFFSET 0x43#define QUERY_DEV_CAP_FLAGS_OFFSET 0x44#define QUERY_DEV_CAP_RSVD_UAR_OFFSET 0x48#define QUERY_DEV_CAP_UAR_SZ_OFFSET 0x49
@@ -658,6 +659,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *MLX4_GET (ext_flags, outbox,QUERY_DEV_CAP_EXT_FLAGS_OFFSET );MLX4_GET (flags, outbox,QUERY_DEV_CAP_FLAGS_OFFSET ); dev_cap->flags = flags | (u64 )ext_flags <<32 ; +MLX4_GET (field, outbox,QUERY_DEV_CAP_WOL_OFFSET ); + dev_cap->wol_port[1 ] = !!(field &0x20 ); + dev_cap->wol_port[2 ] = !!(field &0x40 );MLX4_GET (field, outbox,QUERY_DEV_CAP_RSVD_UAR_OFFSET ); dev_cap->reserved_uars = field >>4 ;MLX4_GET (field, outbox,QUERY_DEV_CAP_UAR_SZ_OFFSET );
drivers/net/ethernet/mellanox/mlx4/fw.h +1 -0
@@ -120,6 +120,7 @@ struct mlx4_dev_cap {u8 log_max_macs[MLX4_MAX_PORTS +1 ];u8 log_max_vlans[MLX4_MAX_PORTS +1 ];u32 max_counters; +bool wol_port[MLX4_MAX_PORTS +1 ]; };struct mlx4_func_cap {
drivers/net/ethernet/mellanox/mlx4/main.c +2 -0
@@ -279,6 +279,8 @@ static int mlx4_dev_cap(struct mlx4_dev dev->caps.stat_rate_support = dev_cap->stat_rate_support; dev->caps.max_gso_sz = dev_cap->max_gso_sz; dev->caps.max_rss_tbl_sz = dev_cap->max_rss_tbl_sz; + dev->caps.wol_port[1 ] = dev_cap->wol_port[1 ]; + dev->caps.wol_port[2 ] = dev_cap->wol_port[2 ];/* Sense port always allowed on supported devices for ConnectX-1 and -2 */ if (mlx4_priv (dev)->pci_dev_data &MLX4_PCI_DEV_FORCE_SENSE_PORT )
include/linux/mlx4/device.h +1 -0
@@ -467,6 +467,7 @@ struct mlx4_caps {u16 hca_core_clock;u64 phys_port_id[MLX4_MAX_PORTS +1 ];int tunnel_offload_mode; +bool wol_port[MLX4_MAX_PORTS +1 ]; };struct mlx4_buf_list {
PATCH 91/294 ocfs2: don't clear SGID when inheriting ACLs
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 19ec8e48582670c021e998b9deb88e39a842ff45 upstream.
When new directory 'DIR1' is created in a directory 'DIR0' with SGID bit set, DIR1 is expected to have SGID bit set (and owning group equal to the owning group of 'DIR0'). However when 'DIR0' also has some default ACLs that 'DIR1' inherits, setting these ACLs will result in SGID bit on 'DIR1' to get cleared if user is not member of the owning group.
Fix the problem by moving posix_acl_update_mode() out of ocfs2_set_acl() into ocfs2_iop_set_acl(). That way the function will not be called when inheriting ACLs which is what we want as it prevents SGID bit clearing and the mode has been properly set by posix_acl_create() anyway. Also posix_acl_chmod() that is calling ocfs2_set_acl() takes care of updating mode itself.
[bwh: Backported to 3.16:
- ocfs2_iop_set_acl() doesn't take a lock, so simply return on error
- Add the status variable in ocfs2_iop_set_acl()
- Pass NULL as the bh argument to ocfs2_acl_set_mode()
- Adjust context]
---
fs/ocfs2/acl.c +14 -13
@@ -240,19 +240,6 @@ int ocfs2_set_acl(handle_t *handle,switch (type) {case ACL_TYPE_ACCESS : name_index =OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS ; -if (acl) { -umode_t mode; - ret =posix_acl_update_mode (inode, &mode, &acl); -if (ret) -return ret; -else { - ret =ocfs2_acl_set_mode (inode, di_bh, - handle, mode); -if (ret) -return ret; - - } - }break ;case ACL_TYPE_DEFAULT : name_index =OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT ;
@@ -283,6 +270,20 @@ int ocfs2_set_acl(handle_t *handle,int ocfs2_iop_set_acl (struct inode *inode,struct posix_acl *acl,int type) { +int status; + +if (type ==ACL_TYPE_ACCESS && acl) { +umode_t mode; + + status =posix_acl_update_mode (inode, &mode, &acl); +if (status) +return status; + + status =ocfs2_acl_set_mode (inode,NULL ,NULL , mode); +if (status) +return status; + } +return ocfs2_set_acl (NULL , inode,NULL , type, acl,NULL ,NULL ); }
PATCH 92/294 ipv6: set rt6i_protocol properly in the route when it is installed
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
commit b91d532928dff2141ea9c107c3e73104d9843767 upstream.
After commit c2ed1880fd61 ("net: ipv6: check route protocol when deleting routes"), ipv6 route checks rt protocol when trying to remove a rt entry.
It introduced a side effect causing 'ip -6 route flush cache' not to work well. When flushing caches with iproute, all route caches get dumped from kernel then removed one by one by sending DELROUTE requests to kernel for each cache.
The thing is iproute sends the request with the cache whose proto is set with RTPROT_REDIRECT by rt6_fill_node() when kernel dumps it. But in kernel the rt_cache protocol is still 0, which causes the cache not to be matched and removed.
So the real reason is rt6i_protocol in the route is not set when it is allocated. As David Ahern's suggestion, this patch is to set rt6i_protocol properly in the route when it is installed and remove the codes setting rtm_protocol according to rt6i_flags in rt6_fill_node.
This is also an improvement to keep rt6i_protocol consistent with rtm_protocol.
--- net/ipv6/route.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
net/ipv6/route.c +3 -8
@@ -1843,6 +1843,7 @@ static void rt6_do_redirect(struct dst_eif (on_link) nrt->rt6i_flags &= ~RTF_GATEWAY ; + nrt->rt6i_protocol =RTPROT_REDIRECT ; nrt->rt6i_gateway = *(struct in6_addr *)neigh->primary_key;if (ip6_ins_rt (nrt))
@@ -1950,6 +1951,7 @@ static struct rt6_info *rt6_add_route_in .fc_dst_len = prefixlen, .fc_flags =RTF_GATEWAY |RTF_ADDRCONF |RTF_ROUTEINFO | RTF_UP | RTF_PREF(pref), + .fc_protocol = RTPROT_RA, .fc_nlinfo.portid = 0, .fc_nlinfo.nlh = NULL, .fc_nlinfo.nl_net = net,
@@ -2000,6 +2002,7 @@ struct rt6_info *rt6_add_dflt_router(con .fc_ifindex = dev->ifindex, .fc_flags =RTF_GATEWAY |RTF_ADDRCONF |RTF_DEFAULT | RTF_UP | RTF_EXPIRES | RTF_PREF(pref), + .fc_protocol = RTPROT_RA, .fc_nlinfo.portid = 0, .fc_nlinfo.nlh = NULL, .fc_nlinfo.nl_net = dev_net(dev),
@@ -2591,14 +2594,6 @@ static int rt6_fill_node(struct net *net rtm->rtm_flags =0 ; rtm->rtm_scope =RT_SCOPE_UNIVERSE ; rtm->rtm_protocol = rt->rt6i_protocol; -if (rt->rt6i_flags &RTF_DYNAMIC ) - rtm->rtm_protocol =RTPROT_REDIRECT ; -else if (rt->rt6i_flags &RTF_ADDRCONF ) { -if (rt->rt6i_flags & (RTF_DEFAULT |RTF_ROUTEINFO )) - rtm->rtm_protocol =RTPROT_RA ; -else - rtm->rtm_protocol =RTPROT_KERNEL ; - }if (rt->rt6i_flags &RTF_CACHE ) rtm->rtm_flags |=RTM_F_CLONED ;
PATCH 93/294 RDMA/uverbs: Prevent leak of reserved field
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit f7a6cb7b38c6845b26aaa8bbdf519ff6e3090831 upstream.
initialize to zero the response structure to prevent the leakage of "resp.reserved" field.
drivers/infiniband/core/uverbs_cmd.c:1178 ib_uverbs_resize_cq() warn:
check that 'resp.reserved' doesn't leak information
--- drivers/infiniband/core/uverbs_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +1 -1
@@ -1303,7 +1303,7 @@ ssize_t ib_uverbs_resize_cq(struct ib_uv int out_len) {struct ib_uverbs_resize_cq cmd; -struct ib_uverbs_resize_cq_resp resp; +struct ib_uverbs_resize_cq_resp resp = {};struct ib_udata udata;struct ib_cq *cq;int ret = -EINVAL ;
PATCH 94/294 IB/uverbs: Fix device cleanup
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yishai Hadas <[email protected]>
commit efdd6f53b10aead0f5cf19a93dd3eb268ac0d991 upstream.
Uverbs device should be cleaned up only when there is no potential usage of.
As part of ib_uverbs_remove_one which might be triggered upon reset flow the device reference count is decreased as expected and leave the final cleanup to the FDs that were opened.
Current code increases reference count upon opening a new command FD and decreases it upon closing the file. The event FD is opened internally and rely on the command FD by taking on it a reference count.
In case that the command FD was closed and just later the event FD we may ensure that the device resources as of srcu are still alive as they are still in use.
Fixing the above by moving the reference count decreasing to the place where the command FD is really freed instead of doing that when it was just closed.
--- drivers/infiniband/core/uverbs_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/core/uverbs_main.c +1 -2
@@ -315,6 +315,7 @@ static void ib_uverbs_release_file(strucif (atomic_dec_and_test (&file->device->refcount))ib_uverbs_comp_dev (file->device); +kobject_put (&file->device->kobj);kfree (file); }
@@ -784,7 +785,6 @@ err:static int ib_uverbs_close (struct inode *inode,struct file *filp) {struct ib_uverbs_file *file = filp->private_data; -struct ib_uverbs_device *dev = file->device;ib_uverbs_cleanup_ucontext (file, file->ucontext);
@@ -792,7 +792,6 @@ static int ib_uverbs_close(struct inodekref_put (&file->async_file->ref, ib_uverbs_release_event_file);kref_put (&file->ref, ib_uverbs_release_file); -kobject_put (&dev->kobj);return 0 ; }
PATCH 95/294 ext4: fix SEEK_HOLE/SEEK_DATA for blocksize < pagesize
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit fcf5ea10992fbac3c7473a1db33d56a139333cd1 upstream.
ext4_find_unwritten_pgoff() does not properly handle a situation when starting index is in the middle of a page and blocksize < pagesize. The following command shows the bug on filesystem with 1k blocksize:
xfs_io -f -c "falloc 0 4k" \
-c "pwrite 1k 1k" \
-c "pwrite 3k 1k" \
-c "seek -a -r 0" fooIn this example, neither lseek(fd, 1024, SEEK_HOLE) nor lseek(fd, 2048, SEEK_DATA) will return the correct result.
Fix the problem by neglecting buffers in a page before starting offset.
--- fs/ext4/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/file.c +3 -0
@@ -344,6 +344,8 @@ static int ext4_find_unwritten_pgoff(str lastoff =page_offset (page); bh = head =page_buffers (page); do { + if (lastoff + bh->b_size <= startoff) + goto next; if (buffer_uptodate(bh) || buffer_unwritten(bh)) { if (whence == SEEK_DATA)
@@ -358,6 +360,7 @@ static int ext4_find_unwritten_pgoff(strunlock_page (page); goto out; } +next: lastoff += bh->b_size; bh = bh->b_this_page; }while (bh != head);
PATCH 96/294 ext4: fix overflow caused by missing cast in ext4_resize_fs()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jerry Lee <[email protected]>
commit aec51758ce10a9c847a62a48a168f8c804c6e053 upstream.
On a 32-bit platform, the value of n_blcoks_count may be wrong during the file system is resized to size larger than 2^32 blocks. This may caused the superblock being corrupted with zero blocks count.
--- fs/ext4/resize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/resize.c +2 -1
@@ -1929,7 +1929,8 @@ retry: n_desc_blocks = o_desc_blocks +le16_to_cpu (es->s_reserved_gdt_blocks); n_group = n_desc_blocks *EXT4_DESC_PER_BLOCK (sb); - n_blocks_count = n_group *EXT4_BLOCKS_PER_GROUP (sb); + n_blocks_count = (ext4_fsblk_t )n_group * +EXT4_BLOCKS_PER_GROUP (sb); n_group--;/* set to last group number */ }
PATCH 97/294 iscsi-target: Fix iscsi_np reset hung task during parallel delete
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 978d13d60c34818a41fc35962602bdfa5c03f214 upstream.
This patch fixes a bug associated with iscsit_reset_np_thread() that can occur during parallel configfs rmdir of a single iscsi_np used across multiple iscsi-target instances, that would result in hung task(s) similar to below where configfs rmdir process context was blocked indefinately waiting for iscsi_np->np_restart_comp to finish:
[ 6726.112076] INFO: task dcp_proxy_node_:15550 blocked for more than 120 seconds. [ 6726.119440] Tainted: G W O 4.1.26-3321 #2 [ 6726.125045] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 6726.132927] dcp_proxy_node_ D ffff8803f202bc88 0 15550 1 0x00000000 [ 6726.140058] ffff8803f202bc88 ffff88085c64d960 ffff88083b3b1ad0 ffff88087fffeb08 [ 6726.147593] ffff8803f202c000 7fffffffffffffff ffff88083f459c28 ffff88083b3b1ad0 [ 6726.155132] ffff88035373c100 ffff8803f202bca8 ffffffff8168ced2 ffff8803f202bcb8 [ 6726.162667] Call Trace: [ 6726.165150] [<ffffffff8168ced2>] schedule+0x32/0x80 [ 6726.170156] [<ffffffff8168f5b4>] schedule_timeout+0x214/0x290 [ 6726.176030] [<ffffffff810caef2>] ? __send_signal+0x52/0x4a0 [ 6726.181728] [<ffffffff8168d7d6>] wait_for_completion+0x96/0x100 [ 6726.187774] [<ffffffff810e7c80>] ? wake_up_state+0x10/0x10 [ 6726.193395] [<ffffffffa035d6e2>] iscsit_reset_np_thread+0x62/0xe0 [iscsi_target_mod] [ 6726.201278] [<ffffffffa0355d86>] iscsit_tpg_disable_portal_group+0x96/0x190 [iscsi_target_mod] [ 6726.210033] [<ffffffffa0363f7f>] lio_target_tpg_store_enable+0x4f/0xc0 [iscsi_target_mod] [ 6726.218351] [<ffffffff81260c5a>] configfs_write_file+0xaa/0x110 [ 6726.224392] [<ffffffff811ea364>] vfs_write+0xa4/0x1b0 [ 6726.229576] [<ffffffff811eb111>] SyS_write+0x41/0xb0 [ 6726.234659] [<ffffffff8169042e>] system_call_fastpath+0x12/0x71
It would happen because each iscsit_reset_np_thread() sets state to ISCSI_NP_THREAD_RESET, sends SIGINT, and then blocks waiting for completion on iscsi_np->np_restart_comp.
However, if iscsi_np was active processing a login request and more than a single iscsit_reset_np_thread() caller to the same iscsi_np was blocked on iscsi_np->np_restart_comp, iscsi_np kthread process context in __iscsi_target_login_thread() would flush pending signals and only perform a single completion of np->np_restart_comp before going back to sleep within transport specific iscsit_transport->iscsi_accept_np code.
To address this bug, add a iscsi_np->np_reset_count and update __iscsi_target_login_thread() to keep completing np->np_restart_comp until ->np_reset_count has reached zero.
--- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_core.h | 1 + drivers/target/iscsi/iscsi_target_login.c | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-)
drivers/target/iscsi/iscsi_target.c +1 -0
@@ -431,6 +431,7 @@ int iscsit_reset_np_thread(return 0 ; } np->np_thread_state =ISCSI_NP_THREAD_RESET ; +atomic_inc (&np->np_reset_count);if (np->np_thread) {spin_unlock_bh (&np->np_thread_lock);
drivers/target/iscsi/iscsi_target_core.h +1 -0
@@ -792,6 +792,7 @@ struct iscsi_np {int np_sock_type;enum np_thread_state_table np_thread_state;bool enabled; +atomic_t np_reset_count;enum iscsi_timer_flags_table np_login_timer_flags;u32 np_exports;enum np_flags_table np_flags;
drivers/target/iscsi/iscsi_target_login.c +5 -2
@@ -1277,9 +1277,11 @@ static int __iscsi_target_login_thread(sflush_signals (current);spin_lock_bh (&np->np_thread_lock); -if (np->np_thread_state ==ISCSI_NP_THREAD_RESET ) { +if (atomic_dec_if_positive (&np->np_reset_count) >=0 ) { np->np_thread_state =ISCSI_NP_THREAD_ACTIVE ; +spin_unlock_bh (&np->np_thread_lock);complete (&np->np_restart_comp); +return 1 ; }else if (np->np_thread_state ==ISCSI_NP_THREAD_SHUTDOWN ) {spin_unlock_bh (&np->np_thread_lock); goto exit;
@@ -1312,7 +1314,8 @@ static int __iscsi_target_login_thread(s goto exit; }else if (rc <0 ) {spin_lock_bh (&np->np_thread_lock); -if (np->np_thread_state ==ISCSI_NP_THREAD_RESET ) { +if (atomic_dec_if_positive (&np->np_reset_count) >=0 ) { + np->np_thread_state =ISCSI_NP_THREAD_ACTIVE ;spin_unlock_bh (&np->np_thread_lock);complete (&np->np_restart_comp);iscsit_put_transport (conn->conn_transport);
PATCH 98/294 irqchip: brcmstb-l2: Define an irq_pm_shutdown function
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit c017d21147848fe017772764a77a7f32c5b017f9 upstream.
The Broadcom STB platforms support S5 and we allow specific hardware wake-up events to take us out of this state. Because we were not defining an irq_pm_shutdown() function pointer, we would not be correctly masking non-wakeup events, which would result in spurious wake-ups from sources that were not explicitly configured for wake-up.
--- drivers/irqchip/irq-brcmstb-l2.c | 1 + 1 file changed, 1 insertion(+)
drivers/irqchip/irq-brcmstb-l2.c +1 -0
@@ -176,6 +176,7 @@ int __init brcmstb_l2_intc_of_init(struc ct->chip.irq_suspend = brcmstb_l2_intc_suspend; ct->chip.irq_resume = brcmstb_l2_intc_resume; + ct->chip.irq_pm_shutdown = brcmstb_l2_intc_suspend;if (of_property_read_bool (np,"brcm,irq-can-wake" )) { data->can_wake = true;
PATCH 99/294 s390/qeth: fix L3 next-hop in xmit qeth hdr
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Wiedmann <[email protected]>
commit ec2c6726322f0d270bab477e4904bf9496f70ee5 upstream.
On L3, the qeth_hdr struct needs to be filled with the next-hop IP address.
The current code accesses rtable->rt_gateway without checking that rtable is a valid address. The accidental access to a lowcore area results in a random next-hop address in the qeth_hdr. rtable (or more precisely, skb_dst(skb)) can be NULL in rare cases (for instance together with AF_PACKET sockets).
This patch adds the missing NULL-ptr checks.
--- drivers/s390/net/qeth_l3_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/net/qeth_l3_main.c +2 -2
@@ -2816,7 +2816,7 @@ static void qeth_l3_fill_header(struct qstruct rtable *rt = (struct rtable *) dst;__be32 *pkey = &ip_hdr (skb)->daddr; -if (rt->rt_gateway) +if (rt && rt->rt_gateway) pkey = &rt->rt_gateway;/* IPv4 */
@@ -2827,7 +2827,7 @@ static void qeth_l3_fill_header(struct qstruct rt6_info *rt = (struct rt6_info *) dst;struct in6_addr *pkey = &ipv6_hdr (skb)->daddr; -if (!ipv6_addr_any (&rt->rt6i_gateway)) +if (rt && !ipv6_addr_any (&rt->rt6i_gateway)) pkey = &rt->rt6i_gateway;/* IPv6 */
PATCH 100/294 scsi: st: fix blk_get_queue usage
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bodo Stroesser <[email protected]>
commit 180efde0a3f43dbe533e4be203c2918793482d4e upstream.
If blk_queue_get() in st_probe fails, disk->queue must not be set to SDp->request_queue, as that would result in put_disk() dropping a not taken reference.
Thus, disk->queue should be set only after a successful blk_queue_get().
--- drivers/scsi/st.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/st.c +2 -2
@@ -4115,11 +4115,11 @@ static int st_probe(struct device *dev)kref_init (&tpnt->kref); tpnt->disk = disk; disk->private_data = &tpnt->driver; - disk->queue = SDp->request_queue;/* SCSI tape doesn't register this gendisk via add_disk(). Manually * take queue reference that release_disk() expects. */ -if (!blk_get_queue (disk->queue)) +if (!blk_get_queue (SDp->request_queue)) goto out_put_disk; + disk->queue = SDp->request_queue; tpnt->driver = &st_template; tpnt->device = SDp;
PATCH 101/294 net: remove open-coded skb_cow_head.
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: françois romieu <[email protected]>
commit a40e0a664bce465a3b8ad1d792153cef8ded9f7d upstream.
--- net/core/dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/dev.c +2 -2
@@ -2437,8 +2437,8 @@ struct sk_buff *__skb_gso_segment(structskb_warn_bad_offload (skb); -if (skb_header_cloned (skb) && - (err =pskb_expand_head (skb,0 ,0 ,GFP_ATOMIC ))) + err =skb_cow_head (skb,0 ); +if (err <0 )return ERR_PTR (err); }
PATCH 102/294 net: reduce skb_warn_bad_offload() noise
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit b2504a5dbef3305ef41988ad270b0e8ec289331c upstream.
Dmitry reported warnings occurring in __skb_gso_segment() [1]
All SKB_GSO_DODGY producers can allow user space to feed packets that trigger the current check.
We could prevent them from doing so, rejecting packets, but this might add regressions to existing programs.
It turns out our SKB_GSO_DODGY handlers properly set up checksum information that is needed anyway when packets needs to be segmented.
By checking again skb_needs_check() after skb_mac_gso_segment(), we should remove these pesky warnings, at a very minor cost.
With help from Willem de Bruijn
[1]
WARNING: CPU: 1 PID: 6768 at net/core/dev.c:2439 skb_warn_bad_offload+0x2af/0x390 net/core/dev.c:2434 lo: caps=(0x000000a2803b7c69, 0x0000000000000000) len=138 data_len=0 gso_size=15883 gso_type=4 ip_summed=0 Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 6768 Comm: syz-executor1 Not tainted 4.9.0 #5 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 ffff8801c063ecd8 ffffffff82346bdf ffffffff00000001 1ffff100380c7d2e ffffed00380c7d26 0000000041b58ab3 ffffffff84b37e38 ffffffff823468f1 ffffffff84820740 ffffffff84f289c0 dffffc0000000000 ffff8801c063ee20 Call Trace: [<ffffffff82346bdf>] __dump_stack lib/dump_stack.c:15 [inline] [<ffffffff82346bdf>] dump_stack+0x2ee/0x3ef lib/dump_stack.c:51 [<ffffffff81827e34>] panic+0x1fb/0x412 kernel/panic.c:179 [<ffffffff8141f704>] __warn+0x1c4/0x1e0 kernel/panic.c:542 [<ffffffff8141f7e5>] warn_slowpath_fmt+0xc5/0x100 kernel/panic.c:565 [<ffffffff8356cbaf>] skb_warn_bad_offload+0x2af/0x390 net/core/dev.c:2434 [<ffffffff83585cd2>] __skb_gso_segment+0x482/0x780 net/core/dev.c:2706 [<ffffffff83586f19>] skb_gso_segment include/linux/netdevice.h:3985 [inline] [<ffffffff83586f19>] validate_xmit_skb+0x5c9/0xc20 net/core/dev.c:2969 [<ffffffff835892bb>] __dev_queue_xmit+0xe6b/0x1e70 net/core/dev.c:3383 [<ffffffff8358a2d7>] dev_queue_xmit+0x17/0x20 net/core/dev.c:3424 [<ffffffff83ad161d>] packet_snd net/packet/af_packet.c:2930 [inline] [<ffffffff83ad161d>] packet_sendmsg+0x32ed/0x4d30 net/packet/af_packet.c:2955 [<ffffffff834f0aaa>] sock_sendmsg_nosec net/socket.c:621 [inline] [<ffffffff834f0aaa>] sock_sendmsg+0xca/0x110 net/socket.c:631 [<ffffffff834f329a>] ___sys_sendmsg+0x8fa/0x9f0 net/socket.c:1954 [<ffffffff834f5e58>] __sys_sendmsg+0x138/0x300 net/socket.c:1988 [<ffffffff834f604d>] SYSC_sendmsg net/socket.c:1999 [inline] [<ffffffff834f604d>] SyS_sendmsg+0x2d/0x50 net/socket.c:1995 [<ffffffff84371941>] entry_SYSCALL_64_fastpath+0x1f/0xc2
--- net/core/dev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/core/dev.c +9 -3
@@ -2432,11 +2432,12 @@ static inline bool skb_needs_check(strucstruct sk_buff *__skb_gso_segment (struct sk_buff *skb,netdev_features_t features,bool tx_path) { +struct sk_buff *segs; +if (unlikely (skb_needs_check (skb, tx_path))) {int err; -skb_warn_bad_offload (skb); - +/* We're going to init ->check field in TCP or UDP header */ err =skb_cow_head (skb,0 );if (err <0 )return ERR_PTR (err);
@@ -2448,7 +2449,12 @@ struct sk_buff *__skb_gso_segment(structskb_reset_mac_header (skb);skb_reset_mac_len (skb); -return skb_mac_gso_segment (skb, features); + segs =skb_mac_gso_segment (skb, features); + +if (unlikely (skb_needs_check (skb, tx_path))) +skb_warn_bad_offload (skb); + +return segs; }EXPORT_SYMBOL (__skb_gso_segment);
PATCH 103/294 net: skb_needs_check() accepts CHECKSUM_NONE for tx
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 6e7bc478c9a006c701c14476ec9d389a484b4864 upstream.
My recent change missed fact that UFO would perform a complete UDP checksum before segmenting in frags.
In this case skb->ip_summed is set to CHECKSUM_NONE.
We need to add this valid case to skb_needs_check()
--- net/core/dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/core/dev.c +4 -3
@@ -2413,9 +2413,10 @@ EXPORT_SYMBOL(skb_mac_gso_segment);static inline bool skb_needs_check (struct sk_buff *skb,bool tx_path) {if (tx_path) -return skb->ip_summed !=CHECKSUM_PARTIAL ; -else -return skb->ip_summed ==CHECKSUM_NONE ; +return skb->ip_summed !=CHECKSUM_PARTIAL && + skb->ip_summed !=CHECKSUM_NONE ; + +return skb->ip_summed ==CHECKSUM_NONE ; }/**
PATCH 104/294 net: avoid skb_warn_bad_offload false positives on UFO
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
commit 8d63bee643f1fb53e472f0e135cae4eb99d62d19 upstream.
skb_warn_bad_offload triggers a warning when an skb enters the GSO stack at __skb_gso_segment that does not have CHECKSUM_PARTIAL checksum offload set.
Commit b2504a5dbef3 ("net: reduce skb_warn_bad_offload() noise") observed that SKB_GSO_DODGY producers can trigger the check and that passing those packets through the GSO handlers will fix it up. But, the software UFO handler will set ip_summed to CHECKSUM_NONE.
When __skb_gso_segment is called from the receive path, this triggers the warning again.
Make UFO set CHECKSUM_UNNECESSARY instead of CHECKSUM_NONE. On Tx these two are equivalent. On Rx, this better matches the skb state (checksum computed), as CHECKSUM_NONE here means no checksum computed.
See also this thread for context:
http://patchwork.ozlabs.org/patch/799015/
--- net/core/dev.c | 2 +- net/ipv4/udp_offload.c | 2 +- net/ipv6/udp_offload.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
net/core/dev.c +1 -1
@@ -2414,7 +2414,7 @@ static inline bool skb_needs_check(struc {if (tx_path)return skb->ip_summed !=CHECKSUM_PARTIAL && - skb->ip_summed !=CHECKSUM_NONE ; + skb->ip_summed !=CHECKSUM_UNNECESSARY ;return skb->ip_summed ==CHECKSUM_NONE ; }
net/ipv4/udp_offload.c +1 -1
@@ -93,7 +93,7 @@ static struct sk_buff *udp4_ufo_fragment csum =skb_checksum (skb, offset, skb->len - offset,0 ); offset += skb->csum_offset; *(__sum16 *)(skb->data + offset) =csum_fold (csum); - skb->ip_summed =CHECKSUM_NONE ; + skb->ip_summed =CHECKSUM_UNNECESSARY ;/* Fragment the skb. IP headers of the fragments are updated in * inet_gso_segment()
net/ipv6/udp_offload.c +1 -1
@@ -90,7 +90,7 @@ static struct sk_buff *udp6_ufo_fragment csum =skb_checksum (skb, offset, skb->len - offset,0 ); offset += skb->csum_offset; *(__sum16 *)(skb->data + offset) =csum_fold (csum); - skb->ip_summed =CHECKSUM_NONE ; + skb->ip_summed =CHECKSUM_UNNECESSARY ;/* Check if there is enough headroom to insert fragment header. */ tnl_hlen =skb_tnl_header_len (skb);
PATCH 105/294 crypto: x86/sha1 - Fix reads beyond the number of blocks passed
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 8861249c740fc4af9ddc5aee321eafefb960d7c6 upstream.
It was reported that the sha1 AVX2 function(sha1_transform_avx2) is reading ahead beyond its intended data, and causing a crash if the next block is beyond page boundary:
http://marc.info/?l=linux-crypto-vger&m=149373371023377
This patch makes sure that there is no overflow for any buffer length.
It passes the tests written by Jan Stancek that revealed this problem:
https://github.com/jstancek/sha1-avx2-crash
I have re-enabled sha1-avx2 by reverting commitb82ce24426a4071da9529d726057e4e642948667
--- arch/x86/crypto/sha1_avx2_x86_64_asm.S | 67 ++++++++++++++++++---------------- arch/x86/crypto/sha1_ssse3_glue.c | 2 +- 2 files changed, 37 insertions(+), 32 deletions(-)
arch/x86/crypto/sha1_avx2_x86_64_asm.S +36 -31
@@ -117,11 +117,10 @@ .set T1, REG_T1 .endm -#define K_BASE %r8 #define HASH_PTR %r9 +#define BLOCKS_CTR %r8 #define BUFFER_PTR %r10 #define BUFFER_PTR2 %r13 -#define BUFFER_END %r11 #define PRECALC_BUF %r14 #define WK_BUF %r15
@@ -205,14 +204,14 @@ * blended AVX2 and ALU instruction scheduling * 1 vector iteration per 8 rounds */ - vmovdqu ((i * 2) + PRECALC_OFFSET)(BUFFER_PTR), W_TMP + vmovdqu (i * 2)(BUFFER_PTR), W_TMP .elseif ((i & 7) == 1) - vinsertf128 $1, (((i-1) * 2)+PRECALC_OFFSET)(BUFFER_PTR2),\ + vinsertf128 $1, ((i-1) * 2)(BUFFER_PTR2),\ WY_TMP, WY_TMP .elseif ((i & 7) == 2) vpshufb YMM_SHUFB_BSWAP, WY_TMP, WY .elseif ((i & 7) == 4) - vpaddd K_XMM(K_BASE), WY, WY_TMP + vpaddd K_XMM + K_XMM_AR(%rip), WY, WY_TMP .elseif ((i & 7) == 7) vmovdqu WY_TMP, PRECALC_WK(i&~7)
@@ -255,7 +254,7 @@ vpxor WY, WY_TMP, WY_TMP .elseif ((i & 7) == 7) vpxor WY_TMP2, WY_TMP, WY - vpaddd K_XMM(K_BASE), WY, WY_TMP + vpaddd K_XMM + K_XMM_AR(%rip), WY, WY_TMP vmovdqu WY_TMP, PRECALC_WK(i&~7) PRECALC_ROTATE_WY
@@ -291,7 +290,7 @@ vpsrld $30, WY, WY vpor WY, WY_TMP, WY .elseif ((i & 7) == 7) - vpaddd K_XMM(K_BASE), WY, WY_TMP + vpaddd K_XMM + K_XMM_AR(%rip), WY, WY_TMP vmovdqu WY_TMP, PRECALC_WK(i&~7) PRECALC_ROTATE_WY
@@ -446,6 +445,16 @@ .endm +/* Add constant only if (%2 > %3) condition met (uses RTA as temp) + * %1 + %2 >= %3 ? %4 : 0 + */ +.macro ADD_IF_GE a, b, c, d + mov \a, RTA + add $\d, RTA + cmp $\c, \b + cmovge RTA, \a +.endm + /* * macro implements 80 rounds of SHA-1, for multiple blocks with s/w pipelining */
@@ -463,13 +472,16 @@ lea (2*4*80+32)(%rsp), WK_BUF # Precalc WK for first 2 blocks - PRECALC_OFFSET = 0 + ADD_IF_GE BUFFER_PTR2, BLOCKS_CTR, 2, 64 .set i, 0 .rept 160 PRECALC i .set i, i + 1 .endr - PRECALC_OFFSET = 128 + + /* Go to next block if needed */ + ADD_IF_GE BUFFER_PTR, BLOCKS_CTR, 3, 128 + ADD_IF_GE BUFFER_PTR2, BLOCKS_CTR, 4, 128 xchg WK_BUF, PRECALC_BUF .align 32
@@ -479,8 +491,8 @@ _loop: * we use K_BASE value as a signal of a last block, * it is set below by: cmovae BUFFER_PTR, K_BASE */ - cmp K_BASE, BUFFER_PTR - jne _begin + test BLOCKS_CTR, BLOCKS_CTR + jnz _begin .align 32 jmp _end .align 32
@@ -512,10 +524,10 @@ _loop0: .set j, j+2 .endr - add $(2*64), BUFFER_PTR /* move to next odd-64-byte block */ - cmp BUFFER_END, BUFFER_PTR /* is current block the last one? */ - cmovae K_BASE, BUFFER_PTR /* signal the last iteration smartly */ - + /* Update Counter */ + sub $1, BLOCKS_CTR + /* Move to the next block only if needed*/ + ADD_IF_GE BUFFER_PTR, BLOCKS_CTR, 4, 128 /* * rounds * 60,62,64,66,68
@@ -532,8 +544,8 @@ _loop0: UPDATE_HASH 12(HASH_PTR), D UPDATE_HASH 16(HASH_PTR), E - cmp K_BASE, BUFFER_PTR /* is current block the last one? */ - je _loop + test BLOCKS_CTR, BLOCKS_CTR + jz _loop mov TB, B
@@ -575,10 +587,10 @@ _loop2: .set j, j+2 .endr - add $(2*64), BUFFER_PTR2 /* move to next even-64-byte block */ - - cmp BUFFER_END, BUFFER_PTR2 /* is current block the last one */ - cmovae K_BASE, BUFFER_PTR /* signal the last iteration smartly */ + /* update counter */ + sub $1, BLOCKS_CTR + /* Move to the next block only if needed*/ + ADD_IF_GE BUFFER_PTR2, BLOCKS_CTR, 4, 128 jmp _loop3 _loop3:
@@ -641,19 +653,12 @@ _loop3: avx2_zeroupper - lea K_XMM_AR(%rip), K_BASE - + /* Setup initial values */ mov CTX, HASH_PTR mov BUF, BUFFER_PTR - lea 64(BUF), BUFFER_PTR2 - - shl $6, CNT /* mul by 64 */ - add BUF, CNT - add $64, CNT - mov CNT, BUFFER_END - cmp BUFFER_END, BUFFER_PTR2 - cmovae K_BASE, BUFFER_PTR2 + mov BUF, BUFFER_PTR2 + mov CNT, BLOCKS_CTR xmm_mov BSWAP_SHUFB_CTL(%rip), YMM_SHUFB_BSWAP
arch/x86/crypto/sha1_ssse3_glue.c +1 -1
@@ -224,7 +224,7 @@ static bool __init avx_usable(void)#ifdef CONFIG_AS_AVX2 static bool __init avx2_usable (void ) { -if (false &&avx_usable () && cpu_has_avx2 && +if (avx_usable () && cpu_has_avx2 &&boot_cpu_has (X86_FEATURE_BMI1 ) &&boot_cpu_has (X86_FEATURE_BMI2 ))return true;
PATCH 106/294 x86/asm/64: Clear AC on NMI entries
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit e93c17301ac55321fc18e0f8316e924e58a83c8c upstream.
This closes a hole in our SMAP implementation.
This patch comes from grsecurity. Good catch!
--- arch/x86/kernel/entry_64.S | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/entry_64.S +2 -0
@@ -1476,6 +1476,8 @@ ENTRY(nmi) * other IST entries. */ + ASM_CLAC + /* Use %rdx as out temp variable throughout */ pushq_cfi %rdx CFI_REL_OFFSET rdx, 0
PATCH 107/294 usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sandeep Singh <[email protected]>
commit e788787ef4f9c24aafefc480a8da5f92b914e5e6 upstream.
Certain HP keyboards would keep inputting a character automatically which is the wake-up key after S3 resume
On some AMD platforms USB host fails to respond (by holding resume-K) to USB device (an HP keyboard) resume request within 1ms (TURSM) and ensures that resume is signaled for at least 20 ms (TDRSMDN), which is defined in USB 2.0 spec. The result is that the keyboard is out of function.
In SNPS USB design, the host responds to the resume request only after system gets back to S0 and the host gets to functional after the internal HW restore operation that is more than 1 second after the initial resume request from the USB device.
As a workaround for specific keyboard ID(HP Keyboards), applying port reset after resume when the keyboard is plugged in.
--- drivers/usb/core/quirks.c | 1 + drivers/usb/host/pci-quirks.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-)
drivers/usb/core/quirks.c +1 -0
@@ -246,6 +246,7 @@ static const struct usb_device_id usb_am { USB_DEVICE(0x093a, 0x2500), .driver_info = USB_QUIRK_RESET_RESUME }, { USB_DEVICE(0x093a, 0x2510), .driver_info = USB_QUIRK_RESET_RESUME }, { USB_DEVICE(0x093a, 0x2521), .driver_info = USB_QUIRK_RESET_RESUME }, + { USB_DEVICE(0x03f0, 0x2b4a), .driver_info = USB_QUIRK_RESET_RESUME }, /* Logitech Optical Mouse M90/M100 */ { USB_DEVICE(0x046d, 0xc05a), .driver_info = USB_QUIRK_RESET_RESUME },
drivers/usb/host/pci-quirks.c +12 -5
@@ -99,6 +99,7 @@ enum amd_chipset_gen {AMD_CHIPSET_HUDSON2 ,AMD_CHIPSET_BOLTON ,AMD_CHIPSET_YANGTZE , +AMD_CHIPSET_TAISHAN , AMD_CHIPSET_UNKNOWN, };
@@ -142,6 +143,11 @@ static int amd_chipset_sb_type_init(stru pinfo->sb_type.gen =AMD_CHIPSET_SB700 ; else if (rev >= 0x40 && rev <= 0x4f) pinfo->sb_type.gen =AMD_CHIPSET_SB800 ; + } + pinfo->smbus_dev =pci_get_device (PCI_VENDOR_ID_AMD , +0x145c ,NULL ); +if (pinfo->smbus_dev) { + pinfo->sb_type.gen =AMD_CHIPSET_TAISHAN ; }else { pinfo->smbus_dev =pci_get_device (PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_HUDSON2_SMBUS ,NULL );
@@ -263,11 +269,12 @@ int usb_hcd_amd_remote_wakeup_quirk(stru {/* Make sure amd chipset type has already been initialized */ usb_amd_find_chipset_info (); -if (amd_chipset.sb_type.gen !=AMD_CHIPSET_YANGTZE ) -return 0 ; - -dev_dbg (&pdev->dev,"QUIRK: Enable AMD remote wakeup fix\n" ); -return 1 ; +if (amd_chipset.sb_type.gen ==AMD_CHIPSET_YANGTZE || + amd_chipset.sb_type.gen ==AMD_CHIPSET_TAISHAN ) { +dev_dbg (&pdev->dev,"QUIRK: Enable AMD remote wakeup fix\n" ); +return 1 ; + } +return 0 ; }EXPORT_SYMBOL_GPL (usb_hcd_amd_remote_wakeup_quirk);
PATCH 108/294 USB: Check for dropped connection before switching to full speed
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 94c43b9897abf4ea366ed4dba027494e080c7050 upstream.
Some buggy USB disk adapters disconnect and reconnect multiple times during the enumeration procedure. This may lead to a device connecting at full speed instead of high speed, because when the USB stack sees that a device isn't able to enumerate at high speed, it tries to hand the connection over to a full-speed companion controller.
The logic for doing this is careful to check that the device is still connected. But this check is inadequate if the device disconnects and reconnects before the check is done. The symptom is that a device works, but much more slowly than it is capable of operating.
The situation was made worse recently by commit 22547c4cc4fe ("usb:
hub: Wait for connection to be reestablished after port reset"), which increases the delay following a reset before a disconnect is recognized, thus giving the device more time to reconnect.
This patch makes the check more robust. If the device was disconnected at any time during enumeration, we will now skip the full-speed handover.
--- drivers/usb/core/hub.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/usb/core/hub.c +6 -4
@@ -4602,7 +4602,8 @@ hub_power_remaining (struct usb_hub *hubstatic void hub_port_connect (struct usb_hub *hub,int port1,u16 portstatus,u16 portchange) { -int status, i; +int status = -ENODEV ; +int i;unsigned unit_load;struct usb_device *hdev = hub->hdev;struct usb_hcd *hcd =bus_to_hcd (hdev->bus);
@@ -4799,9 +4800,10 @@ loop: done:hub_port_disable (hub, port1,1 ); -if (hcd->driver->relinquish_port && !hub->hdev->parent) - hcd->driver->relinquish_port (hcd, port1); - +if (hcd->driver->relinquish_port && !hub->hdev->parent) { +if (status != -ENOTCONN && status != -ENODEV ) + hcd->driver->relinquish_port (hcd, port1); + } }/* Handle physical or logical connection change events.
PATCH 109/294 usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit 7496cfe5431f21da5d27a8388c326397e3f0a5db upstream.
Moshi USB to Ethernet Adapter internally uses a Genesys Logic hub to connect to Realtek r8153.
The Realtek r8153 ethernet does not work on the internal hub, no-lpm quirk can make it work.
Since another r8153 dongle at my hand does not have the issue, so add the quirk to the Genesys Logic hub instead.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -147,6 +147,9 @@ static const struct usb_device_id usb_qu/* appletouch */ { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Genesys Logic hub, internally used by Moshi USB to Ethernet Adapter */ + { USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM }, + /* Avision AV600U */ { USB_DEVICE(0x0638, 0x0a13), .driver_info = USB_QUIRK_STRING_FETCH_255 },
PATCH 110/294 mm: migrate: prevent racy access to tlb_flush_pending
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nadav Amit <[email protected]>
commit 16af97dc5a8975371a83d9e30a64038b48f40a2d upstream.
Patch series "fixes of TLB batching races", v6.
It turns out that Linux TLB batching mechanism suffers from various races. Races that are caused due to batching during reclamation were recently handled by Mel and this patch-set deals with others. The more fundamental issue is that concurrent updates of the page-tables allow for TLB flushes to be batched on one core, while another core changes the page-tables. This other core may assume a PTE change does not require a flush based on the updated PTE value, while it is unaware that TLB flushes are still pending.
This behavior affects KSM (which may result in memory corruption) and MADV_FREE and MADV_DONTNEED (which may result in incorrect behavior). A proof-of-concept can easily produce the wrong behavior of MADV_DONTNEED. Memory corruption in KSM is harder to produce in practice, but was observed by hacking the kernel and adding a delay before flushing and replacing the KSM page.
Finally, there is also one memory barrier missing, which may affect architectures with weak memory model.
This patch (of 7):
Setting and clearing mm->tlb_flush_pending can be performed by multiple threads, since mmap_sem may only be acquired for read in task_numa_work(). If this happens, tlb_flush_pending might be cleared while one of the threads still changes PTEs and batches TLB flushes.
This can lead to the same race between migration and change_protection_range() that led to the introduction of tlb_flush_pending. The result of this race was data corruption, which means that this patch also addresses a theoretically possible data corruption.
An actual data corruption was not observed, yet the race was was confirmed by adding assertion to check tlb_flush_pending is not set by two threads, adding artificial latency in change_protection_range() and using sysctl to reduce kernel.numa_balancing_scan_delay_ms.
change_protection_range")
[bwh: Backported to 3.16:
- Drop change to dump_mm()
- Adjust context]
---
include/linux/mm_types.h +22 -9
@@ -451,7 +451,7 @@ struct mm_struct {* can move process memory needs to flush the TLB when moving a * PROT_NONE or PROT_NUMA mapped page. */ -bool tlb_flush_pending; +atomic_t tlb_flush_pending;#endif struct uprobes_state uprobes_state; };
@@ -479,33 +479,46 @@ static inline cpumask_t *mm_cpumask(strustatic inline bool mm_tlb_flush_pending (struct mm_struct *mm) {barrier (); -return mm->tlb_flush_pending; +return atomic_read (&mm->tlb_flush_pending) >0 ; } -static inline void set_tlb_flush_pending (struct mm_struct *mm) + +static inline void init_tlb_flush_pending (struct mm_struct *mm) { - mm->tlb_flush_pending = true; +atomic_set (&mm->tlb_flush_pending,0 ); +} + +static inline void inc_tlb_flush_pending (struct mm_struct *mm) +{ +atomic_inc (&mm->tlb_flush_pending);/* -* Guarantee that the tlb_flush_pending store does not leak into the +* Guarantee that the tlb_flush_pending increase does not leak into the * critical section updating the page tables */ smp_mb__before_spinlock (); } +/* Clearing is done after a TLB flush, which also provides a barrier. */ -static inline void clear_tlb_flush_pending (struct mm_struct *mm) +static inline void dec_tlb_flush_pending (struct mm_struct *mm) {barrier (); - mm->tlb_flush_pending = false; +atomic_dec (&mm->tlb_flush_pending); }#else static inline bool mm_tlb_flush_pending (struct mm_struct *mm) {return false; } -static inline void set_tlb_flush_pending (struct mm_struct *mm) + +static inline void init_tlb_flush_pending (struct mm_struct *mm) { } -static inline void clear_tlb_flush_pending (struct mm_struct *mm) + +static inline void inc_tlb_flush_pending (struct mm_struct *mm) +{ +} + +static inline void dec_tlb_flush_pending (struct mm_struct *mm) { }#endif
kernel/fork.c +1 -1
@@ -539,7 +539,7 @@ static struct mm_struct *mm_init(structspin_lock_init (&mm->page_table_lock);mm_init_aio (mm);mm_init_owner (mm, p); -clear_tlb_flush_pending (mm); +init_tlb_flush_pending (mm);if (current->mm) { mm->flags = current->mm->flags &MMF_INIT_MASK ;
mm/mprotect.c +2 -2
@@ -225,7 +225,7 @@ static unsigned long change_protection_rBUG_ON (addr >= end); pgd =pgd_offset (mm, addr);flush_cache_range (vma, addr, end); -set_tlb_flush_pending (mm); +inc_tlb_flush_pending (mm); do { next = pgd_addr_end(addr, end); if (pgd_none_or_clear_bad(pgd))
@@ -237,7 +237,7 @@ static unsigned long change_protection_r/* Only flush the TLB if we actually modified any entries: */ if (pages)flush_tlb_range (vma, start, end); -clear_tlb_flush_pending (mm); +dec_tlb_flush_pending (mm);return pages; }
PATCH 111/294 xfs: fix inobt inode allocation search optimization
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit c44245b3d5435f533ca8346ece65918f84c057f9 upstream.
When we try to allocate a free inode by searching the inobt, we try to find the inode nearest the parent inode by searching chunks both left and right of the chunk containing the parent. As an optimization, we cache the leftmost and rightmost records that we previously searched; if we do another allocation with the same parent inode, we'll pick up the search where it last left off.
There's a bug in the case where we found a free inode to the left of the parent's chunk: we need to update the cached left and right records, but because we already reassigned the right record to point to the left, we end up assigning the left record to both the cached left and right records.
This isn't a correctness problem strictly, but it can result in the next allocation rechecking chunks unnecessarily or allocating inodes further away from the parent than it needs to. Fix it by swapping the record pointer after we update the cached left and right records.
--- fs/xfs/xfs_ialloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_ialloc.c +1 -1
@@ -854,13 +854,13 @@ xfs_dialloc_ag_inobt(/* free inodes to the left? */ if (useleft && trec.ir_freecount) { - rec = trec;xfs_btree_del_cursor (cur,XFS_BTREE_NOERROR ); cur = tcur; pag->pagl_leftrec = trec.ir_startino; pag->pagl_rightrec = rec.ir_startino; pag->pagl_pagino = pagino; + rec = trec; goto alloc_inode; }
PATCH 112/294 af_key: do not use GFP_KERNEL in atomic contexts
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 36f41f8fc6d8aa9f8c9072d66ff7cf9055f5e69b upstream.
pfkey_broadcast() might be called from non process contexts, we can not use GFP_KERNEL in these cases [1].
This patch partially reverts commit ba51b6be38c1 ("net: Fix RCU splat in af_key"), only keeping the GFP_ATOMIC forcing under rcu_read_lock() section.
[1] : syzkaller reported :
in_atomic(): 1, irqs_disabled(): 0, pid: 2932, name: syzkaller183439 3 locks held by syzkaller183439/2932:
#0: (&net->xfrm.xfrm_cfg_mutex){+.+.+.}, at: [<ffffffff83b43888>] pfkey_sendmsg+0x4c8/0x9f0 net/key/af_key.c:3649
#1: (&pfk->dump_lock){+.+.+.}, at: [<ffffffff83b467f6>] pfkey_do_dump+0x76/0x3f0 net/key/af_key.c:293
#2: (&(&net->xfrm.xfrm_policy_lock)->rlock){+...+.}, at: [<ffffffff83957632>] spin_lock_bh include/linux/spinlock.h:304 [inline]
#2: (&(&net->xfrm.xfrm_policy_lock)->rlock){+...+.}, at: [<ffffffff83957632>] xfrm_policy_walk+0x192/0xa30 net/xfrm/xfrm_policy.c:1028
CPU: 0 PID: 2932 Comm: syzkaller183439 Not tainted 4.13.0-rc4+ #24
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
___might_sleep+0x2b2/0x470 kernel/sched/core.c:5994
__might_sleep+0x95/0x190 kernel/sched/core.c:5947
slab_pre_alloc_hook mm/slab.h:416 [inline]
slab_alloc mm/slab.c:3383 [inline]
kmem_cache_alloc+0x24b/0x6e0 mm/slab.c:3559
skb_clone+0x1a0/0x400 net/core/skbuff.c:1037
pfkey_broadcast_one+0x4b2/0x6f0 net/key/af_key.c:207
pfkey_broadcast+0x4ba/0x770 net/key/af_key.c:281
dump_sp+0x3d6/0x500 net/key/af_key.c:2685
xfrm_policy_walk+0x2f1/0xa30 net/xfrm/xfrm_policy.c:1042
pfkey_dump_sp+0x42/0x50 net/key/af_key.c:2695
pfkey_do_dump+0xaa/0x3f0 net/key/af_key.c:299
pfkey_spddump+0x1a0/0x210 net/key/af_key.c:2722
pfkey_process+0x606/0x710 net/key/af_key.c:2814
pfkey_sendmsg+0x4d6/0x9f0 net/key/af_key.c:3650
sock_sendmsg_nosec net/socket.c:633 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:643
___sys_sendmsg+0x755/0x890 net/socket.c:2035
__sys_sendmsg+0xe5/0x210 net/socket.c:2069
SYSC_sendmsg net/socket.c:2080 [inline]
SyS_sendmsg+0x2d/0x50 net/socket.c:2076
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x445d79
RSP: 002b:00007f32447c1dc8 EFLAGS: 00000202 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000445d79
RDX: 0000000000000000 RSI: 000000002023dfc8 RDI: 0000000000000008
RBP: 0000000000000086 R08: 00007f32447c2700 R09: 00007f32447c2700
R10: 00007f32447c2700 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffe33edec4f R14: 00007f32447c29c0 R15: 0000000000000000--- net/key/af_key.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
net/key/af_key.c +26 -22
@@ -224,7 +224,7 @@ static int pfkey_broadcast_one(struct sk#define BROADCAST_ONE 1#define BROADCAST_REGISTERED 2#define BROADCAST_PROMISC_ONLY 4 -static int pfkey_broadcast (struct sk_buff *skb, +static int pfkey_broadcast (struct sk_buff *skb,gfp_t allocation,int broadcast_flags,struct sock *one_sk,struct net *net) {
@@ -274,7 +274,7 @@ static int pfkey_broadcast(struct sk_bufrcu_read_unlock ();if (one_sk !=NULL ) - err =pfkey_broadcast_one (skb, &skb2,GFP_KERNEL , one_sk); + err =pfkey_broadcast_one (skb, &skb2, allocation, one_sk);kfree_skb (skb2);kfree_skb (skb);
@@ -307,7 +307,7 @@ static int pfkey_do_dump(struct pfkey_so hdr = (struct sadb_msg *) pfk->dump.skb->data; hdr->sadb_msg_seq =0 ; hdr->sadb_msg_errno = rc; -pfkey_broadcast (pfk->dump.skb,BROADCAST_ONE , +pfkey_broadcast (pfk->dump.skb,GFP_ATOMIC ,BROADCAST_ONE , &pfk->sk,sock_net (&pfk->sk)); pfk->dump.skb =NULL ; }
@@ -351,7 +351,7 @@ static int pfkey_error(const struct sadb hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); -pfkey_broadcast (skb,BROADCAST_ONE , sk,sock_net (sk)); +pfkey_broadcast (skb,GFP_KERNEL ,BROADCAST_ONE , sk,sock_net (sk));return 0 ; }
@@ -1394,7 +1394,7 @@ static int pfkey_getspi(struct sock *sk,xfrm_state_put (x); -pfkey_broadcast (resp_skb,BROADCAST_ONE , sk, net); +pfkey_broadcast (resp_skb,GFP_KERNEL ,BROADCAST_ONE , sk, net);return 0 ; }
@@ -1481,7 +1481,7 @@ static int key_notify_sa(struct xfrm_sta hdr->sadb_msg_seq = c->seq; hdr->sadb_msg_pid = c->portid; -pfkey_broadcast (skb,BROADCAST_ALL ,NULL ,xs_net (x)); +pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL ,xs_net (x));return 0 ; }
@@ -1594,7 +1594,7 @@ static int pfkey_get(struct sock *sk, st out_hdr->sadb_msg_reserved =0 ; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; -pfkey_broadcast (out_skb,BROADCAST_ONE , sk,sock_net (sk)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ONE , sk,sock_net (sk));return 0 ; }
@@ -1699,8 +1699,8 @@ static int pfkey_register(struct sock *sreturn -ENOBUFS ; } -pfkey_broadcast (supp_skb,BROADCAST_REGISTERED , sk,sock_net (sk)); - +pfkey_broadcast (supp_skb,GFP_KERNEL ,BROADCAST_REGISTERED , sk, +sock_net (sk));return 0 ; }
@@ -1718,7 +1718,8 @@ static int unicast_flush_resp(struct soc hdr->sadb_msg_errno = (uint8_t )0 ; hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); -return pfkey_broadcast (skb,BROADCAST_ONE , sk,sock_net (sk)); +return pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ONE , sk, +sock_net (sk)); }static int key_notify_sa_flush (const struct km_event *c)
@@ -1739,7 +1740,7 @@ static int key_notify_sa_flush(const str hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); hdr->sadb_msg_reserved =0 ; -pfkey_broadcast (skb,BROADCAST_ALL ,NULL , c->net); +pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL , c->net);return 0 ; }
@@ -1796,7 +1797,7 @@ static int dump_sa(struct xfrm_state *x, out_hdr->sadb_msg_pid = pfk->dump.msg_portid;if (pfk->dump.skb) -pfkey_broadcast (pfk->dump.skb,BROADCAST_ONE , +pfkey_broadcast (pfk->dump.skb,GFP_ATOMIC ,BROADCAST_ONE , &pfk->sk,sock_net (&pfk->sk)); pfk->dump.skb = out_skb;
@@ -1884,7 +1885,7 @@ static int pfkey_promisc(struct sock *sk new_hdr->sadb_msg_errno =0 ; } -pfkey_broadcast (skb,BROADCAST_ALL ,NULL ,sock_net (sk)); +pfkey_broadcast (skb,GFP_KERNEL ,BROADCAST_ALL ,NULL ,sock_net (sk));return 0 ; }
@@ -2218,7 +2219,7 @@ static int key_notify_policy(struct xfrm out_hdr->sadb_msg_errno =0 ; out_hdr->sadb_msg_seq = c->seq; out_hdr->sadb_msg_pid = c->portid; -pfkey_broadcast (out_skb,BROADCAST_ALL ,NULL ,xp_net (xp)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL ,xp_net (xp));return 0 ; }
@@ -2438,7 +2439,7 @@ static int key_pol_get_resp(struct sock out_hdr->sadb_msg_errno =0 ; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; -pfkey_broadcast (out_skb,BROADCAST_ONE , sk,xp_net (xp)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ONE , sk,xp_net (xp)); err =0 ; out:
@@ -2692,7 +2693,7 @@ static int dump_sp(struct xfrm_policy *x out_hdr->sadb_msg_pid = pfk->dump.msg_portid;if (pfk->dump.skb) -pfkey_broadcast (pfk->dump.skb,BROADCAST_ONE , +pfkey_broadcast (pfk->dump.skb,GFP_ATOMIC ,BROADCAST_ONE , &pfk->sk,sock_net (&pfk->sk)); pfk->dump.skb = out_skb;
@@ -2749,7 +2750,7 @@ static int key_notify_policy_flush(const hdr->sadb_msg_satype =SADB_SATYPE_UNSPEC ; hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); hdr->sadb_msg_reserved =0 ; -pfkey_broadcast (skb_out,BROADCAST_ALL ,NULL , c->net); +pfkey_broadcast (skb_out,GFP_ATOMIC ,BROADCAST_ALL ,NULL , c->net);return 0 ; }
@@ -2811,7 +2812,7 @@ static int pfkey_process(struct sock *skvoid *ext_hdrs[SADB_EXT_MAX ];int err; -pfkey_broadcast (skb_clone (skb,GFP_KERNEL ), +pfkey_broadcast (skb_clone (skb,GFP_KERNEL ),GFP_KERNEL ,BROADCAST_PROMISC_ONLY ,NULL ,sock_net (sk));memset (ext_hdrs,0 ,sizeof (ext_hdrs));
@@ -3033,7 +3034,8 @@ static int key_notify_sa_expire(struct x out_hdr->sadb_msg_seq =0 ; out_hdr->sadb_msg_pid =0 ; -pfkey_broadcast (out_skb,BROADCAST_REGISTERED ,NULL ,xs_net (x)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_REGISTERED ,NULL , +xs_net (x));return 0 ; }
@@ -3223,7 +3225,8 @@ static int pfkey_send_acquire(struct xfr xfrm_ctx->ctx_len); } -return pfkey_broadcast (skb,BROADCAST_REGISTERED ,NULL ,xs_net (x)); +return pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_REGISTERED ,NULL , +xs_net (x)); } static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
@@ -3421,7 +3424,8 @@ static int pfkey_send_new_mapping(struct n_port->sadb_x_nat_t_port_port = sport; n_port->sadb_x_nat_t_port_reserved =0 ; -return pfkey_broadcast (skb,BROADCAST_REGISTERED ,NULL ,xs_net (x)); +return pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_REGISTERED ,NULL , +xs_net (x)); }#ifdef CONFIG_NET_KEY_MIGRATE
@@ -3613,7 +3617,7 @@ static int pfkey_send_migrate(const stru }/* broadcast migrate message to sockets */ -pfkey_broadcast (skb,BROADCAST_ALL ,NULL , &init_net); +pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL , &init_net);return 0 ;
PATCH 113/294 audit: Fix use after free in audit_remove_watch_rule()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit d76036ab47eafa6ce52b69482e91ca3ba337d6d6 upstream.
audit_remove_watch_rule() drops watch's reference to parent but then continues to work with it. That is not safe as parent can get freed once we drop our reference. The following is a trivial reproducer:
mount -o loop image /mnt
touch /mnt/file
auditctl -w /mnt/file -p wax
umount /mnt
auditctl -D
<crash in fsnotify_destroy_mark()>
Grab our own reference in audit_remove_watch_rule() earlier to make sure mark does not get freed under us.
--- kernel/audit_watch.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
kernel/audit_watch.c +7 -5
@@ -455,13 +455,15 @@ void audit_remove_watch_rule(struct audilist_del (&krule->rlist);if (list_empty (&watch->rules)) { +/* +* audit_remove_watch() drops our reference to 'parent' which +* can get freed. Grab our own reference to be safe. +*/ +audit_get_parent (parent);audit_remove_watch (watch); - -if (list_empty (&parent->watches)) { -audit_get_parent (parent); +if (list_empty (&parent->watches))fsnotify_destroy_mark (&parent->mark, audit_watch_group); -audit_put_parent (parent); - } +audit_put_parent (parent); } }
PATCH 114/294 dst: Increase alignment of metrics to allow extra flag on pointers
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
For the backport of "ipv4: add reference counting to metrics", we will need a third flag on metrics pointers. This was not needed upstream as the DST_METRICS_FORCE_OVERWRITE flag has been eliminated there. In order to use three flag bits we need to increase the alignment of metrics from 4 to 8 bytes.
---
include/net/dst.h +4 -1
@@ -105,12 +105,15 @@ struct dst_entry { }; }; +void *dst_alloc_metrics (gfp_t flags); +void dst_free_metrics (void *metrics);u32 *dst_cow_metrics_generic (struct dst_entry *dst,unsigned long old);extern const u32 dst_default_metrics[];#define DST_METRICS_READ_ONLY 0x1UL#define DST_METRICS_FORCE_OVERWRITE 0x2UL -#define DST_METRICS_FLAGS 0x3UL +#define DST_METRICS_FLAGS 0x7UL +#define DST_METRICS_ALIGNMENT 0x8UL#define __DST_METRICS_PTR (Y ) \ ((u32 *)((Y) & ~DST_METRICS_FLAGS))#define DST_METRICS_PTR (X ) __DST_METRICS_PTR((X)->_metrics)
net/bridge/br_netfilter.c +1 -1
@@ -155,7 +155,7 @@ static struct dst_ops fake_dst_ops = {* ipt_REJECT needs it. Future netfilter modules might * require us to fill additional fields. */ -static const u32 br_dst_default_metrics[RTAX_MAX ] = { +static const u32 br_dst_default_metrics[RTAX_MAX ]__aligned(DST_METRICS_ALIGNMENT) = { [RTAX_MTU -1 ] =1500 , };
net/core/dst.c +22 -4
@@ -149,7 +149,7 @@ int dst_discard_sk(struct sock *sk, stru }EXPORT_SYMBOL (dst_discard_sk); -const u32 dst_default_metrics[RTAX_MAX +1 ] = { +const u32 dst_default_metrics[RTAX_MAX +1 ]__aligned(DST_METRICS_ALIGNMENT) = {/* This initializer is needed to force linker to place this variable * into const section. Otherwise it might end into bss section. * We really want to avoid false sharing on this variable, and catch
@@ -292,9 +292,23 @@ void dst_release(struct dst_entry *dst) }EXPORT_SYMBOL (dst_release); +static struct kmem_cache *metrics_cache; + +void *dst_alloc_metrics (gfp_t flags) +{ +return kmem_cache_alloc (metrics_cache, flags); +} +EXPORT_SYMBOL (dst_alloc_metrics); + +void dst_free_metrics (void *metrics) +{ +kmem_cache_free (metrics_cache, metrics); +} +EXPORT_SYMBOL (dst_free_metrics); +u32 *dst_cow_metrics_generic (struct dst_entry *dst,unsigned long old) { -u32 *p =kmalloc (sizeof (u32) *RTAX_MAX ,GFP_ATOMIC ); +u32 *p =dst_alloc_metrics (GFP_ATOMIC );if (p) {u32 *old_p =__DST_METRICS_PTR (old);
@@ -306,7 +320,7 @@ u32 *dst_cow_metrics_generic(struct dst_ prev =cmpxchg (&dst->_metrics, old, new);if (prev != old) { -kfree (p); +dst_free_metrics (p); p =__DST_METRICS_PTR (prev);if (prev &DST_METRICS_READ_ONLY ) p =NULL ;
@@ -324,7 +338,7 @@ void __dst_destroy_metrics_generic(struc new = ((unsigned long ) dst_default_metrics) |DST_METRICS_READ_ONLY ; prev =cmpxchg (&dst->_metrics, old, new);if (prev == old) -kfree (__DST_METRICS_PTR (old)); +dst_free_metrics (__DST_METRICS_PTR (old)); }EXPORT_SYMBOL (__dst_destroy_metrics_generic);
@@ -419,4 +433,8 @@ static struct notifier_block dst_dev_notvoid __init dst_init (void ) {register_netdevice_notifier (&dst_dev_notifier); + metrics_cache =kmem_cache_create ("dst_metrics" , +sizeof (u32) *RTAX_MAX , +DST_METRICS_ALIGNMENT , +SLAB_PANIC ,NULL ); }
net/core/pktgen.c +1 -1
@@ -2502,7 +2502,7 @@ static void mod_cur_headers(struct pktge#ifdef CONFIG_XFRM -static u32 pktgen_dst_metrics[RTAX_MAX +1 ] = { +static u32 pktgen_dst_metrics[RTAX_MAX +1 ]__aligned(DST_METRICS_ALIGNMENT) = { [RTAX_HOPLIMIT ] =0x5 ,/* Set a static hoplimit */ };
net/ipv4/fib_semantics.c +2 -2
@@ -213,7 +213,7 @@ static void free_fib_info_rcu(struct rcurelease_net (fi->fib_net);if (fi->fib_metrics != (u32 *) dst_default_metrics) -kfree (fi->fib_metrics); +dst_free_metrics (fi->fib_metrics);kfree (fi); }
@@ -823,7 +823,7 @@ struct fib_info *fib_create_info(struct goto failure; fib_info_cnt++;if (cfg->fc_mx) { - fi->fib_metrics =kzalloc (sizeof (u32) *RTAX_MAX ,GFP_KERNEL ); + fi->fib_metrics =dst_alloc_metrics (GFP_KERNEL | __GFP_ZERO);if (!fi->fib_metrics) goto failure; }else
net/ipv6/route.c +1 -1
@@ -247,7 +247,7 @@ static struct dst_ops ip6_dst_blackhole_ .neigh_lookup = ip6_neigh_lookup, }; -static const u32 ip6_template_metrics[RTAX_MAX ] = { +static const u32 ip6_template_metrics[RTAX_MAX ]__aligned(DST_METRICS_ALIGNMENT) = { [RTAX_HOPLIMIT -1 ] =0 , };
net/ipv6/ip6_fib.c +1 -1
@@ -643,7 +643,7 @@ static int fib6_commit_metrics(struct dsif (dst->flags &DST_HOST ) { mp =dst_metrics_write_ptr (dst); }else { - mp =kzalloc (sizeof (u32) *RTAX_MAX ,GFP_ATOMIC ); + mp =dst_alloc_metrics (GFP_ATOMIC | __GFP_ZERO);if (!mp)return -ENOMEM ;dst_init_metrics (dst, mp,0 );
PATCH 115/294 ipv4: add reference counting to metrics
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 3fb07daff8e99243366a081e5129560734de4ada upstream.
Andrey Konovalov reported crashes in ipv4_mtu()
I could reproduce the issue with KASAN kernels, between 10.246.7.151 and 10.246.7.152 :
1) 20 concurrent netperf -t TCP_RR -H 10.246.7.152 -l 1000 &
2) At the same time run following loop :
while :
do
ip ro add 10.246.7.152 dev eth0 src 10.246.7.151 mtu 1500 ip ro del 10.246.7.152 dev eth0 src 10.246.7.151 mtu 1500
done
Cong Wang attempted to add back rt->fi in commit 82486aa6f1b9 ("ipv4: restore rt->fi for reference counting") but this proved to add some issues that were complex to solve.
Instead, I suggested to add a refcount to the metrics themselves, being a standalone object (in particular, no reference to other objects)
I tried to make this patch as small as possible to ease its backport, instead of being super clean. Note that we believe that only ipv4 dst need to take care of the metric refcount. But if this is wrong, this patch adds the basic infrastructure to extend this to other families.
Many thanks to Julian Anastasov for reviewing this patch, and Cong Wang for his efforts on this problem.
[bwh: Backported to 3.16:
- Give DST_METRICS_REFCOUNTED a value of 4 and struct dst_metrics an alignment of 8
- Update dst_metrics cache size
- Adjust context]
---
include/net/dst.h +7 -1
@@ -108,16 +108,22 @@ struct dst_entry {void *dst_alloc_metrics (gfp_t flags);void dst_free_metrics (void *metrics);u32 *dst_cow_metrics_generic (struct dst_entry *dst,unsigned long old); -extern const u32 dst_default_metrics[];#define DST_METRICS_READ_ONLY 0x1UL#define DST_METRICS_FORCE_OVERWRITE 0x2UL +#define DST_METRICS_REFCOUNTED 0x4UL#define DST_METRICS_FLAGS 0x7UL#define DST_METRICS_ALIGNMENT 0x8UL#define __DST_METRICS_PTR (Y ) \ ((u32 *)((Y) & ~DST_METRICS_FLAGS))#define DST_METRICS_PTR (X ) __DST_METRICS_PTR((X)->_metrics) +struct dst_metrics { +u32 metrics[RTAX_MAX ]; +atomic_t refcnt; +}__aligned(DST_METRICS_ALIGNMENT) ; +extern const struct dst_metrics dst_default_metrics; +static inline bool dst_metrics_read_only (const struct dst_entry *dst) {return dst->_metrics &DST_METRICS_READ_ONLY ;
include/net/ip_fib.h +5 -5
@@ -108,11 +108,11 @@ struct fib_info {unsigned char fib_type;__be32 fib_prefsrc;u32 fib_priority; -u32 *fib_metrics; -#define fib_mtu fib_metrics[RTAX_MTU-1] -#define fib_window fib_metrics[RTAX_WINDOW-1] -#define fib_rtt fib_metrics[RTAX_RTT-1] -#define fib_advmss fib_metrics[RTAX_ADVMSS-1] +struct dst_metrics *fib_metrics; +#define fib_mtu fib_metrics->metrics[RTAX_MTU-1] +#define fib_window fib_metrics->metrics[RTAX_WINDOW-1] +#define fib_rtt fib_metrics->metrics[RTAX_RTT-1] +#define fib_advmss fib_metrics->metrics[RTAX_ADVMSS-1]int fib_nhs;#ifdef CONFIG_IP_ROUTE_MULTIPATH int fib_power;
net/core/dst.c +15 -10
@@ -149,13 +149,13 @@ int dst_discard_sk(struct sock *sk, stru }EXPORT_SYMBOL (dst_discard_sk); -const u32 dst_default_metrics[RTAX_MAX +1 ]__aligned(DST_METRICS_ALIGNMENT) = { +const struct dst_metrics dst_default_metrics = {/* This initializer is needed to force linker to place this variable * into const section. Otherwise it might end into bss section. * We really want to avoid false sharing on this variable, and catch * any writes on it. */ - [RTAX_MAX ] =0xdeadbeef , + .refcnt =ATOMIC_INIT (1 ), };
@@ -176,7 +176,7 @@ void *dst_alloc(struct dst_ops *ops, strif (dev)dev_hold (dev); dst->ops = ops; -dst_init_metrics (dst, dst_default_metrics, true); +dst_init_metrics (dst, dst_default_metrics.metrics, true); dst->expires =0UL ; dst->path = dst; dst->from =NULL ;
@@ -308,25 +308,30 @@ EXPORT_SYMBOL(dst_free_metrics);u32 *dst_cow_metrics_generic (struct dst_entry *dst,unsigned long old) { -u32 *p =dst_alloc_metrics (GFP_ATOMIC ); +struct dst_metrics *p =dst_alloc_metrics (GFP_ATOMIC );if (p) { -u32 *old_p =__DST_METRICS_PTR (old); +struct dst_metrics *old_p = (struct dst_metrics *)__DST_METRICS_PTR (old);unsigned long prev, new; -memcpy (p, old_p,sizeof (u32) *RTAX_MAX ); +atomic_set (&p->refcnt,1 ); +memcpy (p->metrics, old_p->metrics,sizeof (p->metrics)); new = (unsigned long ) p; prev =cmpxchg (&dst->_metrics, old, new);if (prev != old) {dst_free_metrics (p); - p =__DST_METRICS_PTR (prev); + p = (struct dst_metrics *)__DST_METRICS_PTR (prev);if (prev &DST_METRICS_READ_ONLY ) p =NULL ; + }else if (prev &DST_METRICS_REFCOUNTED ) { +if (atomic_dec_and_test (&old_p->refcnt)) +dst_free_metrics (old_p); } } -return p; +BUILD_BUG_ON (offsetof(struct dst_metrics , metrics) !=0 ); +return (u32 *)p; }EXPORT_SYMBOL (dst_cow_metrics_generic);
@@ -335,7 +340,7 @@ void __dst_destroy_metrics_generic(struc {unsigned long prev, new; - new = ((unsigned long ) dst_default_metrics) |DST_METRICS_READ_ONLY ; + new = ((unsigned long ) &dst_default_metrics) |DST_METRICS_READ_ONLY ; prev =cmpxchg (&dst->_metrics, old, new);if (prev == old)dst_free_metrics (__DST_METRICS_PTR (old));
@@ -434,7 +439,7 @@ void __init dst_init(void) {register_netdevice_notifier (&dst_dev_notifier); metrics_cache =kmem_cache_create ("dst_metrics" , -sizeof (u32) *RTAX_MAX , +sizeof (struct dst_metrics ),DST_METRICS_ALIGNMENT ,SLAB_PANIC ,NULL ); }
net/ipv4/fib_semantics.c +8 -5
@@ -201,6 +201,7 @@ static void rt_fibinfo_free_cpus(structstatic void free_fib_info_rcu (struct rcu_head *head) { struct fib_info *fi = container_of(head, struct fib_info, rcu); +struct dst_metrics *m;change_nexthops (fi) {if (nexthop_nh->nh_dev)
@@ -212,8 +213,9 @@ static void free_fib_info_rcu(struct rcu }endfor_nexthops (fi);release_net (fi->fib_net); -if (fi->fib_metrics != (u32 *) dst_default_metrics) -dst_free_metrics (fi->fib_metrics); + m = fi->fib_metrics; +if (m != &dst_default_metrics &&atomic_dec_and_test (&m->refcnt)) +dst_free_metrics (m);kfree (fi); }
@@ -826,8 +828,9 @@ struct fib_info *fib_create_info(struct fi->fib_metrics =dst_alloc_metrics (GFP_KERNEL | __GFP_ZERO);if (!fi->fib_metrics) goto failure; +atomic_set (&fi->fib_metrics->refcnt,1 ); }else - fi->fib_metrics = (u32 *) dst_default_metrics; + fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; fi->fib_net =hold_net (net); fi->fib_protocol = cfg->fc_protocol;
@@ -864,7 +867,7 @@ struct fib_info *fib_create_info(struct val =65535 -15 ;if (type ==RTAX_HOPLIMIT && val >255 ) val =255 ; - fi->fib_metrics[type -1 ] = val; + fi->fib_metrics->metrics[type -1 ] = val; } } }
@@ -1029,7 +1032,7 @@ int fib_dump_info(struct sk_buff *skb, uif (fi->fib_priority &&nla_put_u32 (skb,RTA_PRIORITY , fi->fib_priority)) goto nla_put_failure; -if (rtnetlink_put_metrics (skb, fi->fib_metrics) <0 ) +if (rtnetlink_put_metrics (skb, fi->fib_metrics->metrics) <0 ) goto nla_put_failure; if (fi->fib_prefsrc &&
net/ipv4/route.c +9 -1
@@ -1344,8 +1344,12 @@ static void rt_add_uncached_list(structstatic void ipv4_dst_destroy (struct dst_entry *dst) { +struct dst_metrics *p = (struct dst_metrics *)DST_METRICS_PTR (dst);struct rtable *rt = (struct rtable *) dst; +if (p != &dst_default_metrics &&atomic_dec_and_test (&p->refcnt)) +dst_free_metrics (p); +if (!list_empty (&rt->rt_uncached)) {spin_lock_bh (&rt_uncached_lock);list_del (&rt->rt_uncached);
@@ -1392,7 +1396,11 @@ static void rt_set_nexthop(struct rtable rt->rt_gateway = nh->nh_gw; rt->rt_uses_gateway =1 ; } -dst_init_metrics (&rt->dst, fi->fib_metrics, true); +dst_init_metrics (&rt->dst, fi->fib_metrics->metrics, true); +if (fi->fib_metrics != &dst_default_metrics) { + rt->dst._metrics |=DST_METRICS_REFCOUNTED ; +atomic_inc (&fi->fib_metrics->refcnt); + }#ifdef CONFIG_IP_ROUTE_CLASSID rt->dst.tclassid = nh->nh_tclassid;#endif
PATCH 116/294 ipv4: fix NULL dereference in free_fib_info_rcu()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 187e5b3ac84d3421d2de3aca949b2791fbcad554 upstream.
If fi->fib_metrics could not be allocated in fib_create_info() we attempt to dereference a NULL pointer in free_fib_info_rcu() :
m = fi->fib_metrics;
if (m != &dst_default_metrics && atomic_dec_and_test(&m->refcnt))
kfree(m);Before my recent patch, we used to call kfree(NULL) and nothing wrong happened.
Instead of using RCU to defer freeing while we are under memory stress, it seems better to take immediate action.
This was reported by syzkaller team.
--- net/ipv4/fib_semantics.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ipv4/fib_semantics.c +7 -5
@@ -823,15 +823,17 @@ struct fib_info *fib_create_info(struct fi =kzalloc (sizeof (*fi)+nhs*sizeof (struct fib_nh ),GFP_KERNEL );if (fi ==NULL ) goto failure; - fib_info_cnt++;if (cfg->fc_mx) { fi->fib_metrics =dst_alloc_metrics (GFP_KERNEL | __GFP_ZERO); -if (!fi->fib_metrics) - goto failure; +if (unlikely (!fi->fib_metrics)) { +kfree (fi); +return ERR_PTR (err); + }atomic_set (&fi->fib_metrics->refcnt,1 ); - }else + }else { fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; - + } + fib_info_cnt++; fi->fib_net =hold_net (net); fi->fib_protocol = cfg->fc_protocol; fi->fib_scope = cfg->fc_scope;
PATCH 117/294 net_sched/sfq: update hierarchical backlog when drop packet
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 325d5dc3f7e7c2840b65e4a2988c082c2c0025c5 upstream.
When sfq_enqueue() drops head packet or packet from another queue it have to update backlog at upper qdiscs too.
--- net/sched/sch_sfq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/sch_sfq.c +4 -1
@@ -460,6 +460,7 @@ congestion_drop:qdisc_drop (head, sch);slot_queue_add (slot, skb); +qdisc_tree_reduce_backlog (sch,0 , delta);return NET_XMIT_CN ; }
@@ -491,8 +492,10 @@ enqueue:/* Return Congestion Notification only if we dropped a packet * from this flow. */ -if (qlen != slot->qlen) +if (qlen != slot->qlen) { +qdisc_tree_reduce_backlog (sch,0 , dropped -qdisc_pkt_len (skb));return NET_XMIT_CN ; + }/* As we dropped a packet, better let upper stack know this */ qdisc_tree_reduce_backlog (sch,1 , dropped);
PATCH 118/294 parisc: pci memory bar assignment fails with 64bit kernels on dino/cujo
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Bogendoerfer <[email protected]>
commit 4098116039911e8870d84c975e2ec22dab65a909 upstream.
For 64bit kernels the lmmio_space_offset of the host bridge window isn't set correctly on systems with dino/cujo PCI host bridges. This leads to not assigned memory bars and failing drivers, which need to use these bars.
--- drivers/parisc/dino.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parisc/dino.c +1 -1
@@ -954,7 +954,7 @@ static int __init dino_probe(struct pari dino_dev->hba.dev = dev; dino_dev->hba.base_addr =ioremap_nocache (hpa,4096 ); - dino_dev->hba.lmmio_space_offset =0 ;/* CPU addrs == bus addrs */ + dino_dev->hba.lmmio_space_offset =PCI_F_EXTEND ;spin_lock_init (&dino_dev->dinosaur_pen); dino_dev->hba.iommu =ccio_get_iommu (dev);
PATCH 119/294 ALSA: usb-audio: Add mute TLV for playback volumes on C-Media devices
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 0f174b3525a43bd51f9397394763925e0ebe7bc7 upstream.
C-Media devices (at least some models) mute the playback stream when volumes are set to the minimum value. But this isn't informed via TLV and the user-space, typically PulseAudio, gets confused as if it's still played in a low volume.
This patch adds the new flag, min_mute, to struct usb_mixer_elem_info for indicating that the mixer element is with the minimum-mute volume. This flag is set for known C-Media devices in snd_usb_mixer_fu_apply_quirk() in turn.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196669
--- sound/usb/mixer.c | 2 ++ sound/usb/mixer.h | 1 + sound/usb/mixer_quirks.c | 6 ++++++ 3 files changed, 9 insertions(+)
sound/usb/mixer.c +2 -0
@@ -533,6 +533,8 @@ int snd_usb_mixer_vol_tlv(struct snd_kcoif (size <sizeof (scale))return -ENOMEM ; +if (cval->min_mute) + scale[0 ] =SNDRV_CTL_TLVT_DB_MINMAX_MUTE ; scale[2 ] = cval->dBmin; scale[3 ] = cval->dBmax;if (copy_to_user (_tlv, scale,sizeof (scale)))
sound/usb/mixer.h +1 -0
@@ -53,6 +53,7 @@ struct usb_mixer_elem_info {int cached;int cache_val[MAX_CHANNELS ];u8 initialized; +u8 min_mute; }; int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
sound/usb/mixer_quirks.c +6 -0
@@ -1759,6 +1759,12 @@ void snd_usb_mixer_fu_apply_quirk(structif (unitid ==7 && cval->control ==UAC_FU_VOLUME )snd_dragonfly_quirk_db_scale (mixer, cval, kctl);break ; +/* lowest playback value is muted on C-Media devices */ +case USB_ID (0x0d8c ,0x000c ): +case USB_ID (0x0d8c ,0x0014 ): +if (strstr (kctl->id.name,"Playback" )) + cval->min_mute =1 ; +break ; } }
PATCH 120/294 netxen: fix incorrect loop counter decrement
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit a120d9ab65354727559b9db75ded8071b7ef19e2 upstream.
The loop counter k is currently being decremented from zero which is incorrect. Fix this by incrementing k instead
Detected by CoverityScan, CID#401847 ("Infinite loop")
--- drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c +1 -1
@@ -2332,7 +2332,7 @@ netxen_md_rdqueue(struct netxen_adapter loop_cnt++) {NX_WR_DUMP_REG (select_addr, adapter->ahw.pci_base0, queue_id); read_addr = queueEntry->read_addr; -for (k =0 ; k < read_cnt; k--) { +for (k =0 ; k < read_cnt; k++) {NX_RD_DUMP_REG (read_addr, adapter->ahw.pci_base0, &read_value); *data_buff++ = read_value;
PATCH 121/294 mm/mempolicy: fix use after free when calling get_mempolicy
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: zhong jiang <[email protected]>
commit 73223e4e2e3867ebf033a5a8eb2e5df0158ccc99 upstream.
I hit a use after free issue when executing trinity and repoduced it with KASAN enabled. The related call trace is as follows.
BUG: KASan: use after free in SyS_get_mempolicy+0x3c8/0x960 at addr ffff8801f582d766 Read of size 2 by task syz-executor1/798
INFO: Allocated in mpol_new.part.2+0x74/0x160 age=3 cpu=1 pid=799
__slab_alloc+0x768/0x970
kmem_cache_alloc+0x2e7/0x450
mpol_new.part.2+0x74/0x160
mpol_new+0x66/0x80
SyS_mbind+0x267/0x9f0
system_call_fastpath+0x16/0x1b
INFO: Freed in __mpol_put+0x2b/0x40 age=4 cpu=1 pid=799
__slab_free+0x495/0x8e0
kmem_cache_free+0x2f3/0x4c0
__mpol_put+0x2b/0x40
SyS_mbind+0x383/0x9f0
system_call_fastpath+0x16/0x1b
INFO: Slab 0xffffea0009cb8dc0 objects=23 used=8 fp=0xffff8801f582de40 flags=0x200000000004080
INFO: Object 0xffff8801f582d760 @offset=5984 fp=0xffff8801f582d600 Bytes b4 ffff8801f582d750: ae 01 ff ff 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ Object ffff8801f582d760: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
Object ffff8801f582d770: 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkk.
Redzone ffff8801f582d778: bb bb bb bb bb bb bb bb ........
Padding ffff8801f582d8b8: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
Memory state around the buggy address: ffff8801f582d600: fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801f582d680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8801f582d700: fc fc fc fc fc fc fc fc fc fc fc fc fb fb fb fc
!shared memory policy is not protected against parallel removal by other thread which is normally protected by the mmap_sem. do_get_mempolicy, however, drops the lock midway while we can still access it later.
Early premature up_read is a historical artifact from times when put_user was called in this path see https://lwn.net/Articles/124754/
but that is gone since 8bccd85ffbaf ("[PATCH] Implement sys_* do_* layering in the memory policy layer."). but when we have the the current mempolicy ref count model. The issue was introduced accordingly.
Fix the issue by removing the premature release.
--- mm/mempolicy.c | 5 ----- 1 file changed, 5 deletions(-)
mm/mempolicy.c +0 -5
@@ -957,11 +957,6 @@ static long do_get_mempolicy(int *policy *policy |= (pol->flags &MPOL_MODE_FLAGS ); } -if (vma) { -up_read (¤t->mm->mmap_sem); - vma =NULL ; - } - err =0 ;if (nmask) {if (mpol_store_user_nodemask (pol)) {
PATCH 122/294 staging: rtl8188eu: add RNX-N150NUB support
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Charles Milette <[email protected]>
commit f299aec6ebd747298e35934cff7709c6b119ca52 upstream.
Add support for USB Device Rosewill RNX-N150NUB.
VendorID: 0x0bda, ProductID: 0xffef
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -0
@@ -61,6 +61,7 @@ static struct usb_device_id rtw_usb_id_t {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ {} /* Terminating entry */ };
PATCH 123/294 ipv6: reset fn->rr_ptr when replacing route
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
commit 383143f31d7d3525a1dbff733d52fff917f82f15 upstream.
syzcaller reported the following use-after-free issue in rt6_select():
BUG: KASAN: use-after-free in rt6_select net/ipv6/route.c:755 [inline] at addr ffff8800bc6994e8 BUG: KASAN: use-after-free in ip6_pol_route.isra.46+0x1429/0x1470 net/ipv6/route.c:1084 at addr ffff8800bc6994e8 Read of size 4 by task syz-executor1/439628 CPU: 0 PID: 439628 Comm: syz-executor1 Not tainted 4.3.5+ #8 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 0000000000000000 ffff88018fe435b0 ffffffff81ca384d ffff8801d3588c00 ffff8800bc699380 ffff8800bc699500 dffffc0000000000 ffff8801d40a47c0 ffff88018fe435d8 ffffffff81735751 ffff88018fe43660 ffff8800bc699380 Call Trace: [<ffffffff81ca384d>] __dump_stack lib/dump_stack.c:15 [inline] [<ffffffff81ca384d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51 sctp: [Deprecated]: syz-executor0 (pid 439615) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead [<ffffffff81735751>] kasan_object_err+0x21/0x70 mm/kasan/report.c:158 [<ffffffff817359c4>] print_address_description mm/kasan/report.c:196 [inline] [<ffffffff817359c4>] kasan_report_error+0x1b4/0x4a0 mm/kasan/report.c:285 [<ffffffff81735d93>] kasan_report mm/kasan/report.c:305 [inline] [<ffffffff81735d93>] __asan_report_load4_noabort+0x43/0x50 mm/kasan/report.c:325 [<ffffffff82a28e39>] rt6_select net/ipv6/route.c:755 [inline] [<ffffffff82a28e39>] ip6_pol_route.isra.46+0x1429/0x1470 net/ipv6/route.c:1084 [<ffffffff82a28fb1>] ip6_pol_route_output+0x81/0xb0 net/ipv6/route.c:1203 [<ffffffff82ab0a50>] fib6_rule_action+0x1f0/0x680 net/ipv6/fib6_rules.c:95 [<ffffffff8265cbb6>] fib_rules_lookup+0x2a6/0x7a0 net/core/fib_rules.c:223 [<ffffffff82ab1430>] fib6_rule_lookup+0xd0/0x250 net/ipv6/fib6_rules.c:41 [<ffffffff82a22006>] ip6_route_output+0x1d6/0x2c0 net/ipv6/route.c:1224 [<ffffffff829e83d2>] ip6_dst_lookup_tail+0x4d2/0x890 net/ipv6/ip6_output.c:943 [<ffffffff829e889a>] ip6_dst_lookup_flow+0x9a/0x250 net/ipv6/ip6_output.c:1079 [<ffffffff82a9f7d8>] ip6_datagram_dst_update+0x538/0xd40 net/ipv6/datagram.c:91 [<ffffffff82aa0978>] __ip6_datagram_connect net/ipv6/datagram.c:251 [inline] [<ffffffff82aa0978>] ip6_datagram_connect+0x518/0xe50 net/ipv6/datagram.c:272 [<ffffffff82aa1313>] ip6_datagram_connect_v6_only+0x63/0x90 net/ipv6/datagram.c:284 [<ffffffff8292f790>] inet_dgram_connect+0x170/0x1f0 net/ipv4/af_inet.c:564 [<ffffffff82565547>] SYSC_connect+0x1a7/0x2f0 net/socket.c:1582 [<ffffffff8256a649>] SyS_connect+0x29/0x30 net/socket.c:1563 [<ffffffff82c72032>] entry_SYSCALL_64_fastpath+0x12/0x17
Object at ffff8800bc699380, in cache ip6_dst_cache size: 384
The root cause of it is that in fib6_add_rt2node(), when it replaces an existing route with the new one, it does not update fn->rr_ptr. This commit resets fn->rr_ptr to NULL when it points to a route which is replaced in fib6_add_rt2node().
--- net/ipv6/ip6_fib.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv6/ip6_fib.c +4 -0
@@ -859,6 +859,8 @@ add: } nsiblings = iter->rt6i_nsiblings;fib6_purge_rt (iter, fn, info->nl_net); +if (fn->rr_ptr == iter) + fn->rr_ptr =NULL ;rt6_release (iter);if (nsiblings) {
@@ -871,6 +873,8 @@ add:if (rt6_qualify_for_ecmp (iter)) { *ins = iter->dst.rt6_next;fib6_purge_rt (iter, fn, info->nl_net); +if (fn->rr_ptr == iter) + fn->rr_ptr =NULL ;rt6_release (iter); nsiblings--; }else {
PATCH 124/294 Input: trackpoint - add new trackpoint firmware ID
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Ma <[email protected]>
commit ec667683c532c93fb41e100e5d61a518971060e2 upstream.
Synaptics add new TP firmware ID: 0x2 and 0x3, for now both lower 2 bits are indicated as TP. Change the constant to bitwise values.
This makes trackpoint to be recognized on Lenovo Carbon X1 Gen5 instead of it being identified as "PS/2 Generic Mouse".
--- drivers/input/mouse/trackpoint.c | 3 ++- drivers/input/mouse/trackpoint.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/input/mouse/trackpoint.c +2 -1
@@ -263,7 +263,8 @@ static int trackpoint_start_protocol(strif (ps2_command (&psmouse->ps2dev, param,MAKE_PS2_CMD (0 ,2 ,TP_READ_ID )))return -1 ; -if (param[0 ] !=TP_MAGIC_IDENT ) +/* add new TP ID. */ +if (!(param[0 ] &TP_MAGIC_IDENT ))return -1 ;if (firmware_id)
drivers/input/mouse/trackpoint.h +2 -1
@@ -21,8 +21,9 @@#define TP_COMMAND 0xE2/* Commands start with this */ #define TP_READ_ID 0xE1/* Sent for device identification */ -#define TP_MAGIC_IDENT 0x01/* Sent after a TP_READ_ID followed */ +#define TP_MAGIC_IDENT 0x03/* Sent after a TP_READ_ID followed */ /* by the firmware ID */ +/* Firmware ID includes 0x1, 0x2, 0x3 */ /*
PATCH 125/294 iio: imu: adis16480: Fix acceleration scale factor for adis16480
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dragos Bogdan <[email protected]>
commit fdd0d32eb95f135041236a6885d9006315aa9a1d upstream.
According to the datasheet, the range of the acceleration is [-10 g, + 10 g], so the scale factor should be 10 instead of 5.
--- drivers/iio/imu/adis16480.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/adis16480.c +1 -1
@@ -724,7 +724,7 @@ static const struct adis16480_chip_info .gyro_max_val = IIO_RAD_TO_DEGREE(22500), .gyro_max_scale = 450, .accel_max_val = IIO_M_S_2_TO_G(12500), - .accel_max_scale = 5, + .accel_max_scale = 10, }, [ADIS16485] = { .channels = adis16485_channels,
PATCH 126/294 net_sched: fix order of queue length updates in qdisc_replace()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 68a66d149a8c78ec6720f268597302883e48e9fa upstream.
This important to call qdisc_tree_reduce_backlog() after changing queue length. Parent qdisc should deactivate class in ->qlen_notify() called from qdisc_tree_reduce_backlog() but this happens only if qdisc->q.qlen in zero.
Missed class deactivations leads to crashes/warnings at picking packets from empty qdisc and corrupting state at reactivating this class in future.
--- include/net/sch_generic.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/net/sch_generic.h +4 -1
@@ -618,8 +618,11 @@ static inline struct Qdisc *qdisc_replac old = *pold; *pold = new;if (old !=NULL ) { -qdisc_tree_reduce_backlog (old, old->q.qlen, old->qstats.backlog); +unsigned int qlen = old->q.qlen; +unsigned int backlog = old->qstats.backlog; +qdisc_reset (old); +qdisc_tree_reduce_backlog (old, qlen, backlog); }sch_tree_unlock (sch);
PATCH 127/294 drm: Release driver tracking before making the object available again
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit fe4600a548f2763dec91b3b27a1245c370ceee2a upstream.
This is the same bug as we fixed in commit f6cd7daecff5 ("drm: Release driver references to handle before making it available again"), but now the exposure is via the PRIME lookup tables. If we remove the object/handle from the PRIME lut, then a new request for the same object/fd will generate a new handle, thus for a short window that object is known to userspace by two different handles. Fix this by releasing the driver tracking before PRIME.
imported buffer list (v2)")
--- drivers/gpu/drm/drm_gem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_gem.c +3 -3
@@ -698,13 +698,13 @@ drm_gem_object_release_handle(int id, vostruct drm_gem_object *obj = ptr;struct drm_device *dev = obj->dev; +if (dev->driver->gem_close_object) + dev->driver->gem_close_object (obj, file_priv); +if (drm_core_check_feature (dev,DRIVER_PRIME ))drm_gem_remove_prime_handles (obj, file_priv);drm_vma_node_revoke (&obj->vma_node, file_priv->filp); -if (dev->driver->gem_close_object) - dev->driver->gem_close_object (obj, file_priv); -drm_gem_object_handle_unreference_unlocked (obj);return 0 ;
PATCH 128/294 ALSA: core: Fix unexpected error at replacing user TLV
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 88c54cdf61f508ebcf8da2d819f5dfc03e954d1d upstream.
When user tries to replace the user-defined control TLV, the kernel checks the change of its content via memcmp(). The problem is that the kernel passes the return value from memcmp() as is. memcmp() gives a non-zero negative value depending on the comparison result, and this shall be recognized as an error code.
The patch covers that corner-case, return 1 properly for the changed TLV.
--- sound/core/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/control.c +1 -1
@@ -1087,7 +1087,7 @@ static int snd_ctl_elem_user_tlv(structmutex_lock (&ue->card->user_ctl_lock); change = ue->tlv_data_size != size;if (!change) - change =memcmp (ue->tlv_data, new_data, size); + change =memcmp (ue->tlv_data, new_data, size) !=0 ;kfree (ue->tlv_data); ue->tlv_data = new_data; ue->tlv_data_size = size;
PATCH 129/294 arm64: fpsimd: Prevent registers leaking across exec
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Martin <[email protected]>
commit 096622104e14d8a1db4860bd557717067a0515d2 upstream.
There are some tricky dependencies between the different stages of flushing the FPSIMD register state during exec, and these can race with context switch in ways that can cause the old task's regs to leak across. In particular, a context switch during the memset() can cause some of the task's old FPSIMD registers to reappear.
Disabling preemption for this small window would be no big deal for
performance: preemption is already disabled for similar scenarios like updating the FPSIMD registers in sigreturn.
So, instead of rearranging things in ways that might swap existing subtle bugs for new ones, this patch just disables preemption around the FPSIMD state flushing so that races of this type can't occur here. This brings fpsimd_flush_thread() into line with other code paths.
--- arch/arm64/kernel/fpsimd.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kernel/fpsimd.c +2 -0
@@ -156,9 +156,11 @@ void fpsimd_thread_switch(struct task_stvoid fpsimd_flush_thread (void ) { +preempt_disable ();memset (¤t->thread.fpsimd_state,0 ,sizeof (struct fpsimd_state ));fpsimd_flush_task_state (current);set_thread_flag (TIF_FOREIGN_FPSTATE ); +preempt_enable (); }/*
PATCH 130/294 arm64: mm: abort uaccess retries upon fatal signal
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 289d07a2dc6c6b6f3e4b8a62669320d99dbe6c3d upstream.
When there's a fatal signal pending, arm64's do_page_fault() implementation returns 0. The intent is that we'll return to the faulting userspace instruction, delivering the signal on the way.
However, if we take a fatal signal during fixing up a uaccess, this results in a return to the faulting kernel instruction, which will be instantly retried, resulting in the same fault being taken forever. As the task never reaches userspace, the signal is not delivered, and the task is left unkillable. While the task is stuck in this state, it can inhibit the forward progress of the system.
To avoid this, we must ensure that when a fatal signal is pending, we apply any necessary fixup for a faulting kernel instruction. Thus we will return to an error path, and it is up to that code to make forward progress towards delivering the fatal signal.
--- arch/arm64/mm/fault.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm64/mm/fault.c +4 -1
@@ -252,8 +252,11 @@ retry:* signal first. We do not need to release the mmap_sem because it * would already be released in __lock_page_or_retry in mm/filemap.c. */ -if ((fault &VM_FAULT_RETRY ) &&fatal_signal_pending (current)) +if ((fault &VM_FAULT_RETRY ) &&fatal_signal_pending (current)) { +if (!user_mode (regs)) + goto no_context;return 0 ; + }/* * Major/minor page fault accounting is only done on the initial
PATCH 131/294 ipv6: accept 64k - 1 packet length in ip6_find_1stfragopt()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Brivio <[email protected]>
commit 3de33e1ba0506723ab25734e098cf280ecc34756 upstream.
A packet length of exactly IPV6_MAXPLEN is allowed, we should refuse parsing options only if the size is 64KiB or more.
While at it, remove one extra variable and one assignment which were also introduced by the commit that introduced the size check. Checking the sum 'offset + len' and only later adding 'len' to 'offset' doesn't provide any advantage over directly summing to 'offset' and checking it.
--- net/ipv6/output_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/ipv6/output_core.c +2 -4
@@ -52,7 +52,6 @@ int ip6_find_1stfragopt(struct sk_buff *while (offset <= packet_len) {struct ipv6_opt_hdr *exthdr; -unsigned int len;switch (**nexthdr) {
@@ -78,10 +77,9 @@ int ip6_find_1stfragopt(struct sk_buff * exthdr = (struct ipv6_opt_hdr *)(skb_network_header (skb) + offset); - len =ipv6_optlen (exthdr); -if (len + offset >=IPV6_MAXPLEN ) + offset +=ipv6_optlen (exthdr); +if (offset >IPV6_MAXPLEN )return -EINVAL ; - offset += len; *nexthdr = &exthdr->nexthdr; }
PATCH 132/294 ALSA: hda - Add stereo mic quirk for Lenovo G50-70 (17aa:3978)
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit bbba6f9d3da357bbabc6fda81e99ff5584500e76 upstream.
Lenovo G50-70 (17aa:3978) with Conexant codec chip requires the similar workaround for the inverted stereo dmic like other Lenovo models.
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1020657
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -3438,6 +3438,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3975 ,"Lenovo U300s" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"Lenovo IdeaPad U310" ,CXT_FIXUP_STEREO_DMIC ), +SND_PCI_QUIRK (0x17aa ,0x3978 ,"Lenovo G50-70" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x397b ,"Lenovo S205" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK_VENDOR (0x17aa ,"Thinkpad" ,CXT_FIXUP_THINKPAD_ACPI ), SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
PATCH 133/294 cifs: Fix df output for users with quota limits
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Prabhu <[email protected]>
commit 42bec214d8bd432be6d32a1acb0a9079ecd4d142 upstream.
The df for a SMB2 share triggers a GetInfo call for FS_FULL_SIZE_INFORMATION. The values returned are used to populate struct statfs.
The problem is that none of the information returned by the call contains the total blocks available on the filesystem. Instead we use the blocks available to the user ie. quota limitation when filling out statfs.f_blocks. The information returned does contain Actual free units on the filesystem and is used to populate statfs.f_bfree. For users with quota enabled, it can lead to situations where the total free space reported is more than the total blocks on the system ending up with df reports like the following
# df -h /mnt/a Filesystem Size Used Avail Use% Mounted on //192.168.22.10/a 2.5G -2.3G 2.5G - /mnt/a
To fix this problem, we instead populate both statfs.f_bfree with the same value as statfs.f_bavail ie. CallerAvailableAllocationUnits. This is similar to what is done already in the code for cifs and df now reports the quota information for the user used to mount the share.
# df --si /mnt/a Filesystem Size Used Avail Use% Mounted on //192.168.22.10/a 2.7G 101M 2.6G 4% /mnt/a
--- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.c +2 -2
@@ -2486,8 +2486,8 @@ copy_fs_info_to_kstatfs(struct smb2_fs_f kst->f_bsize =le32_to_cpu (pfs_inf->BytesPerSector) *le32_to_cpu (pfs_inf->SectorsPerAllocationUnit); kst->f_blocks =le64_to_cpu (pfs_inf->TotalAllocationUnits); - kst->f_bfree =le64_to_cpu (pfs_inf->ActualAvailableAllocationUnits); - kst->f_bavail =le64_to_cpu (pfs_inf->CallerAvailableAllocationUnits); + kst->f_bfree = kst->f_bavail = +le64_to_cpu (pfs_inf->CallerAvailableAllocationUnits);return ; }
PATCH 134/294 cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ronnie Sahlberg <[email protected]>
commit d3edede29f74d335f81d95a4588f5f136a9f7dcf upstream.
Add checking for the path component length and verify it is <= the maximum that the server advertizes via FileFsAttributeInformation.
With this patch cifs.ko will now return ENAMETOOLONG instead of ENOENT when users to access an overlong path.
To test this, try to cd into a (non-existing) directory on a CIFS share that has a too long name:
cd /mnt/aaaaaaaaaaaaaaa...
and it now should show a good error message from the shell:
bash: cd: /mnt/aaaaaaaaaaaaaaaa...aaaaaa: File name too long
rh bz 1153996
--- fs/cifs/dir.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
fs/cifs/dir.c +12 -6
@@ -183,15 +183,20 @@ cifs_bp_rename_retry: }/* +* Don't allow path components longer than the server max. * Don't allow the separator character in a path component. * The VFS will not allow "/", but "\" is allowed by posix. */ static int -check_name (struct dentry *direntry) +check_name (struct dentry *direntry,struct cifs_tcon *tcon) {struct cifs_sb_info *cifs_sb =CIFS_SB (direntry->d_sb);int i; +if (unlikely (direntry->d_name.len > + tcon->fsAttrInfo.MaxPathNameComponentLength)) +return -ENAMETOOLONG ; +if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_POSIX_PATHS )) {for (i =0 ; i < direntry->d_name.len; i++) {if (direntry->d_name.name[i] =='\\' ) {
@@ -489,10 +494,6 @@ cifs_atomic_open(struct inode *inode, streturn finish_no_open (file, res); } - rc =check_name (direntry); -if (rc) -return rc; - xid =get_xid (); cifs_dbg(FYI, "parent inode = 0x%p name is: %s and dentry = 0x%p\n",
@@ -505,6 +506,11 @@ cifs_atomic_open(struct inode *inode, st } tcon =tlink_tcon (tlink); + + rc =check_name (direntry, tcon); +if (rc) + goto out_free_xid; + server = tcon->ses->server;if (server->ops->new_lease_key)
@@ -752,7 +758,7 @@ cifs_lookup(struct inode *parent_dir_ino } pTcon =tlink_tcon (tlink); - rc =check_name (direntry); + rc =check_name (direntry, pTcon);if (rc) goto lookup_out;
PATCH 135/294 tracing: Fix freeing of filter in create_filter() when set_str is false
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (VMware)" <[email protected]>
commit 8b0db1a5bdfcee0dbfa89607672598ae203c9045 upstream.
Performing the following task with kmemleak enabled:
# cd /sys/kernel/tracing/events/irq/irq_handler_entry/
# echo 'enable_event:kmem:kmalloc:3 if irq >' > trigger
# echo 'enable_event:kmem:kmalloc:3 if irq > 31' > trigger
# echo scan > /sys/kernel/debug/kmemleak
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff8800b9290308 (size 32):
comm "bash", pid 1114, jiffies 4294848451 (age 141.139s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81cef5aa>] kmemleak_alloc+0x4a/0xa0
[<ffffffff81357938>] kmem_cache_alloc_trace+0x158/0x290
[<ffffffff81261c09>] create_filter_start.constprop.28+0x99/0x940
[<ffffffff812639c9>] create_filter+0xa9/0x160
[<ffffffff81263bdc>] create_event_filter+0xc/0x10
[<ffffffff812655e5>] set_trigger_filter+0xe5/0x210
[<ffffffff812660c4>] event_enable_trigger_func+0x324/0x490
[<ffffffff812652e2>] event_trigger_write+0x1a2/0x260
[<ffffffff8138cf87>] __vfs_write+0xd7/0x380
[<ffffffff8138f421>] vfs_write+0x101/0x260
[<ffffffff8139187b>] SyS_write+0xab/0x130
[<ffffffff81cfd501>] entry_SYSCALL_64_fastpath+0x1f/0xbe
[<ffffffffffffffff>] 0xffffffffffffffffThe function create_filter() is passed a 'filterp' pointer that gets allocated, and if "set_str" is true, it is up to the caller to free it, even on error. The problem is that the pointer is not freed by create_filter() when set_str is false. This is a bug, and it is not up to the caller to free the filter on error if it doesn't care about the string.
--- kernel/trace/trace_events_filter.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/trace_events_filter.c +4 -0
@@ -1950,6 +1950,10 @@ static int create_filter(struct ftrace_eif (err && set_str)append_filter_err (ps, filter); } +if (err && !set_str) { +free_event_filter (filter); + filter =NULL ; + }create_filter_finish (ps); *filterp = filter;
PATCH 136/294 qlge: avoid memcpy buffer overflow
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit e58f95831e7468d25eb6e41f234842ecfe6f014f upstream.
gcc-8.0.0 (snapshot) points out that we copy a variable-length string into a fixed length field using memcpy() with the destination length, and that ends up copying whatever follows the string:
inlined from 'ql_core_dump' at drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:1106:2:drivers/net/ethernet/qlogic/qlge/qlge_dbg.c:708:2: error: 'memcpy' reading 15 bytes from a region of size 14 [-Werror=stringop-overflow=]
memcpy(seg_hdr->description, desc, (sizeof(seg_hdr->description)) - 1);
Changing it to use strncpy() will instead zero-pad the destination, which seems to be the right thing to do here.
The bug is probably harmless, but it seems like a good idea to address it in stable kernels as well, if only for the purpose of building with gcc-8 without warnings.
--- drivers/net/ethernet/qlogic/qlge/qlge_dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlge/qlge_dbg.c +1 -1
@@ -724,7 +724,7 @@ static void ql_build_coredump_seg_header seg_hdr->cookie =MPI_COREDUMP_COOKIE ; seg_hdr->segNum = seg_number; seg_hdr->segSize = seg_size; -memcpy (seg_hdr->description, desc, (sizeof (seg_hdr->description)) -1 ); +strncpy (seg_hdr->description, desc, (sizeof (seg_hdr->description)) -1 ); }/*
PATCH 137/294 nfsd: Limit end of page list when decoding NFSv4 WRITE
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit fc788f64f1f3eb31e87d4f53bcf1ab76590d5838 upstream.
When processing an NFSv4 WRITE operation, argp->end should never point past the end of the data in the final page of the page list. Otherwise, nfsd4_decode_compound can walk into uninitialized memory.
More critical, nfsd4_decode_write is failing to increment argp->pagelen when it increments argp->pagelist. This can cause later xdr decoders to assume more data is available than really is, which can cause server crashes on malformed requests.
--- fs/nfsd/nfs4xdr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4xdr.c +2 -4
@@ -134,7 +134,7 @@ static void next_decode_page(struct nfsd argp->p =page_address (argp->pagelist[0 ]); argp->pagelist++;if (argp->pagelen <PAGE_SIZE ) { - argp->end = argp->p + (argp->pagelen>>2 ); + argp->end = argp->p +XDR_QUADLEN (argp->pagelen); argp->pagelen =0 ; }else { argp->end = argp->p + (PAGE_SIZE >>2 );
@@ -1246,9 +1246,7 @@ nfsd4_decode_write(struct nfsd4_compound argp->pagelen -= pages *PAGE_SIZE ; len -= pages *PAGE_SIZE ; - argp->p = (__be32 *)page_address (argp->pagelist[0 ]); - argp->pagelist++; - argp->end = argp->p +XDR_QUADLEN (PAGE_SIZE ); +next_decode_page (argp); } argp->p +=XDR_QUADLEN (len);
PATCH 138/294 net: systemport: Be drop monitor friendly
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit c45182eb967af11e9482168be5be41aa22e5d321 upstream.
Utilize dev_consume_skb_any(cb->skb) in bcm_sysport_free_cb() which is used when a TX packet is completed, as well as when the RX ring is cleaned on shutdown. None of these two cases are packet drops, so be drop monitor friendly.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +1 -1
@@ -386,7 +386,7 @@ static void bcm_sysport_get_stats(structstatic void bcm_sysport_free_cb (struct bcm_sysport_cb *cb) { -dev_kfree_skb_any (cb->skb); +dev_consume_skb_any (cb->skb); cb->skb =NULL ;dma_unmap_addr_set (cb, dma_addr,0 ); }
PATCH 139/294 net: bcmgenet: Be drop monitor friendly
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit d4fec855905fa8bd5fb1c59f73ad2d74a944876a upstream.
There are 3 spots where we call dev_kfree_skb() but we are actually just doing a normal SKB consumption: __bcmgenet_tx_reclaim() for normal TX reclamation, bcmgenet_alloc_rx_buffers() during the initial RX ring setup and bcmgenet_free_rx_buffers() during RX ring cleanup.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +3 -3
@@ -1037,7 +1037,7 @@ static void __bcmgenet_tx_reclaim(structif (skb) { pkts_compl++; bytes_compl +=GENET_CB (skb)->bytes_sent; -dev_kfree_skb_any (skb); +dev_consume_skb_any (skb); } txbds_processed++;
@@ -1486,7 +1486,7 @@ static int bcmgenet_alloc_rx_buffers(str cb = &priv->rx_cbs[priv->rx_bd_assign_index]; skb =bcmgenet_rx_refill (priv, cb);if (skb) -dev_kfree_skb_any (skb); +dev_consume_skb_any (skb);if (!cb->skb)return -ENOMEM ; }
@@ -1505,7 +1505,7 @@ static void bcmgenet_free_rx_buffers(str skb =bcmgenet_free_rx_cb (&priv->pdev->dev, cb);if (skb) -dev_kfree_skb_any (skb); +dev_consume_skb_any (skb); } }
PATCH 140/294 net: systemport: Free DMA coherent descriptors on errors
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit c2062ee3d9615828109ffe8089fbf69bed394d05 upstream.
In case bcm_sysport_init_tx_ring() is not able to allocate ring->cbs, we would return with an error, and call bcm_sysport_fini_tx_ring() and it would see that ring->cbs is NULL and do nothing. This would leak the coherent DMA descriptor area, so we need to free it on error before returning.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bcmsysport.c +2 -0
@@ -1024,6 +1024,8 @@ static int bcm_sysport_init_tx_ring(stru ring->cbs =kzalloc (sizeof (struct bcm_sysport_cb ) * size,GFP_KERNEL );if (!ring->cbs) { +dma_free_coherent (kdev,sizeof (struct dma_desc ), + ring->desc_cpu, ring->desc_dma);netif_err (priv, hw, priv->netdev,"CB allocation failed\n" );return -ENOMEM ; }
PATCH 141/294 mtd: nandsim: remove debugfs entries in error path
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
commit b974696da1cfc5aa0c29ed97dc8f6c239899e64b upstream.
The debugfs entries must be removed before an error is returned in the probe function. Otherwise another try to load the module fails and when the debugfs files are accessed without the module loaded, the kernel still tries to call a function in that module.
--- drivers/mtd/nand/nandsim.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/nandsim.c +1 -0
@@ -2387,6 +2387,7 @@ static int __init ns_init_module(void)return 0 ; err_exit: +nandsim_debugfs_remove (nand);free_nandsim (nand);nand_release (nsmtd);for (i =0 ;i <ARRAY_SIZE (nand->partitions); ++i)
PATCH 142/294 netvsc: fix deadlock betwen link status and removal
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: stephen hemminger <[email protected]>
commit 9b4e946ce14e20d7addbfb7d9139e604f9fda107 upstream.
There is a deadlock possible when canceling the link status delayed work queue. The removal process is run with RTNL held, and the link status callback is acquring RTNL.
Resolve the issue by using trylock and rescheduling. If cancel is in process, that block it from happening.
[bwh: Backported to 3.16:
- Move assignment of ndev_ctx before this new use
- LINKCHANGE_INT is not defined; substitute its upstream definition]
---
drivers/net/hyperv/netvsc_drv.c +7 -2
@@ -777,9 +777,14 @@ static void netvsc_link_change(struct wostruct rndis_device *rdev;bool notify; -rtnl_lock (); - ndev_ctx = container_of(w, struct net_device_context, dwork.work); + +/* if changes are happening, comeback later */ +if (!rtnl_trylock ()) { +schedule_delayed_work (&ndev_ctx->dwork,2 *HZ ); +return ; + } + net_device =hv_get_drvdata (ndev_ctx->device_ctx); rdev = net_device->extension; net = net_device->ndev;
PATCH 143/294 perf/core: Fix group {cpu,task} validation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 64aee2a965cf2954a038b5522f11d2cd2f0f8f3e upstream.
Regardless of which events form a group, it does not make sense for the events to target different tasks and/or CPUs, as this leaves the group inconsistent and impossible to schedule. The core perf code assumes that these are consistent across (successfully intialised) groups.
Core perf code only verifies this when moving SW events into a HW context. Thus, we can violate this requirement for pure SW groups and pure HW groups, unless the relevant PMU driver happens to perform this verification itself. These mismatched groups subsequently wreak havoc elsewhere.
For example, we handle watchpoints as SW events, and reserve watchpoint HW on a per-CPU basis at pmu::event_init() time to ensure that any event that is initialised is guaranteed to have a slot at pmu::add() time. However, the core code only checks the group leader's cpu filter (via event_filter_match()), and can thus install follower events onto CPUs violating thier (mismatched) CPU filters, potentially installing them into a CPU without sufficient reserved slots.
This can be triggered with the below test case, resulting in warnings from arch backends.
#define _GNU_SOURCE #include <linux/hw_breakpoint.h> #include <linux/perf_event.h> #include <sched.h> #include <stdio.h> #include <sys/prctl.h> #include <sys/syscall.h> #include <unistd.h>
static int perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu,
int group_fd, unsigned long flags)
{
return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);}
char watched_char;
struct perf_event_attr wp_attr = {
.type = PERF_TYPE_BREAKPOINT,
.bp_type = HW_BREAKPOINT_RW,
.bp_addr = (unsigned long)&watched_char,
.bp_len = 1,
.size = sizeof(wp_attr),
};
int main(int argc, char *argv[])
{
int leader, ret;
cpu_set_t cpus;
/*
* Force use of CPU0 to ensure our CPU0-bound events get scheduled.
*/
CPU_ZERO(&cpus);
CPU_SET(0, &cpus);
ret = sched_setaffinity(0, sizeof(cpus), &cpus);
if (ret) {
printf("Unable to set cpu affinity\n");
return 1;
}
/* open leader event, bound to this task, CPU0 only */
leader = perf_event_open(&wp_attr, 0, 0, -1, 0);
if (leader < 0) {
printf("Couldn't open leader: %d\n", leader);
return 1;
}
/*
* Open a follower event that is bound to the same task, but a
* different CPU. This means that the group should never be possible to
* schedule.
*/
ret = perf_event_open(&wp_attr, 0, 1, leader, 0);
if (ret < 0) {
printf("Couldn't open mismatched follower: %d\n", ret);
return 1;
} else {
printf("Opened leader/follower with mismastched CPUs\n");
}
/*
* Open as many independent events as we can, all bound to the same
* task, CPU0 only.
*/
do {
ret = perf_event_open(&wp_attr, 0, 0, -1, 0);
} while (ret >= 0);
/*
* Force enable/disble all events to trigger the erronoeous
* installation of the follower event.
*/
printf("Opened all events. Toggling..\n");
for (;;) {
prctl(PR_TASK_PERF_EVENTS_DISABLE, 0, 0, 0, 0);
prctl(PR_TASK_PERF_EVENTS_ENABLE, 0, 0, 0, 0);
}
return 0;}
Fix this by validating this requirement regardless of whether we're moving events.
--- kernel/events/core.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-)
kernel/events/core.c +19 -20
@@ -7541,28 +7541,27 @@ SYSCALL_DEFINE5(perf_event_open,if (group_leader->group_leader != group_leader) goto err_context;/* -* Do not allow to attach to a group in a different -* task or CPU context: +* Make sure we're both events for the same CPU; +* grouping events for different CPUs is broken; since +* you can never concurrently schedule them anyhow. */ -if (move_group) { -/* -* Make sure we're both on the same task, or both -* per-cpu events. -*/ -if (group_leader->ctx->task != ctx->task) - goto err_context; +if (group_leader->cpu != event->cpu) + goto err_context; + +/* +* Make sure we're both on the same task, or both +* per-CPU events. +*/ +if (group_leader->ctx->task != ctx->task) + goto err_context; -/* -* Make sure we're both events for the same CPU; -* grouping events for different CPUs is broken; since -* you can never concurrently schedule them anyhow. -*/ -if (group_leader->cpu != event->cpu) - goto err_context; - }else { -if (group_leader->ctx != ctx) - goto err_context; - } +/* +* Do not allow to attach to a group in a different task +* or CPU context. If we're moving SW events, we'll fix +* this up later, so allow that. +*/ +if (!move_group && group_leader->ctx != ctx) + goto err_context;/* * Only a group leader can be exclusive or pinned
PATCH 144/294 PM/hibernate: touch NMI watchdog when creating snapshot
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
commit 556b969a1cfe2686aae149137fa1dfcac0eefe54 upstream.
There is a problem that when counting the pages for creating the hibernation snapshot will take significant amount of time, especially on system with large memory. Since the counting job is performed with irq disabled, this might lead to NMI lockup. The following warning were found on a system with 1.5TB DRAM:
Freezing user space processes ... (elapsed 0.002 seconds) done. OOM killer disabled.
PM: Preallocating image memory...
NMI watchdog: Watchdog detected hard LOCKUP on cpu 27
CPU: 27 PID: 3128 Comm: systemd-sleep Not tainted 4.13.0-0.rc2.git0.1.fc27.x86_64 #1 task: ffff9f01971ac000 task.stack: ffffb1a3f325c000 RIP: 0010:memory_bm_find_bit+0xf4/0x100 Call Trace: swsusp_set_page_free+0x2b/0x30 mark_free_pages+0x147/0x1c0 count_data_pages+0x41/0xa0 hibernate_preallocate_memory+0x80/0x450 hibernation_snapshot+0x58/0x410 hibernate+0x17c/0x310 state_store+0xdf/0xf0 kobj_attr_store+0xf/0x20 sysfs_kf_write+0x37/0x40 kernfs_fop_write+0x11c/0x1a0 __vfs_write+0x37/0x170 vfs_write+0xb1/0x1a0 SyS_write+0x55/0xc0 entry_SYSCALL_64_fastpath+0x1a/0xa5 ... done (allocated 6590003 pages) PM: Allocated 26360012 kbytes in 19.89 seconds (1325.28 MB/s)
It has taken nearly 20 seconds(2.10GHz CPU) thus the NMI lockup was triggered. In case the timeout of the NMI watch dog has been set to 1 second, a safe interval should be 6590003/20 = 320k pages in theory. However there might also be some platforms running at a lower frequency, so feed the watchdog every 100k pages.
--- mm/page_alloc.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
mm/page_alloc.c +18 -2
@@ -61,6 +61,7 @@#include <linux/page-debug-flags.h> #include <linux/hugetlb.h> #include <linux/sched/rt.h> +#include <linux/nmi.h> #include <asm/sections.h> #include <asm/tlbflush.h>
@@ -1354,9 +1355,14 @@ void drain_all_pages(void)#ifdef CONFIG_HIBERNATION +/* +* Touch the watchdog for every WD_PAGE_COUNT pages. +*/ +#define WD_PAGE_COUNT (128*1024) +void mark_free_pages (struct zone *zone) { -unsigned long pfn, max_zone_pfn; +unsigned long pfn, max_zone_pfn, page_count =WD_PAGE_COUNT ;unsigned long flags;unsigned int order, t;struct list_head *curr;
@@ -1371,6 +1377,11 @@ void mark_free_pages(struct zone *zone)if (pfn_valid (pfn)) {struct page *page =pfn_to_page (pfn); +if (!--page_count) { +touch_nmi_watchdog (); + page_count =WD_PAGE_COUNT ; + } +if (!swsusp_page_is_forbidden (page))swsusp_unset_page_free (page); }
@@ -1380,8 +1391,13 @@ void mark_free_pages(struct zone *zone)unsigned long i; pfn = page_to_pfn(list_entry(curr, struct page, lru)); -for (i =0 ; i < (1UL << order); i++) +for (i =0 ; i < (1UL << order); i++) { +if (!--page_count) { +touch_nmi_watchdog (); + page_count =WD_PAGE_COUNT ; + }swsusp_set_page_free (pfn_to_page (pfn + i)); + } } }spin_unlock_irqrestore (&zone->lock, flags);
PATCH 145/294 ipv6: Add rt6_get_cookie() function
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Martin KaFai Lau <[email protected]>
commit b197df4f0f3782782e9ea8996e91b65ae33e8dd9 upstream.
Instead of doing the rt6->rt6i_node check whenever we need to get the route's cookie. Refactor it into rt6_get_cookie(). It is a prep work to handle FLOWI_FLAG_KNOWN_NH and also percpu rt6_info later.
--- include/net/ip6_fib.h | 5 +++++ include/net/ip6_route.h | 2 +- net/ipv6/ip6_tunnel.c | 2 +- net/ipv6/tcp_ipv6.c | 3 +-- net/ipv6/xfrm6_policy.c | 6 ++---- net/netfilter/ipvs/ip_vs_xmit.c | 2 +- net/sctp/ipv6.c | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-)
include/net/ip6_fib.h +5 -0
@@ -193,6 +193,11 @@ static inline void rt6_set_from(struct r rt->dst.from = new; } +static inline u32 rt6_get_cookie (const struct rt6_info *rt) +{ +return rt->rt6i_node ? rt->rt6i_node->fn_sernum :0 ; +} +static inline void ip6_rt_put (struct rt6_info *rt) {/* dst_release() accepts a NULL parameter.
include/net/ip6_route.h +1 -1
@@ -146,7 +146,7 @@ static inline void __ip6_dst_store(struc#ifdef CONFIG_IPV6_SUBTREES np->saddr_cache = saddr;#endif - np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum :0 ; + np->dst_cookie =rt6_get_cookie (rt); } static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
net/ipv6/ip6_tunnel.c +1 -1
@@ -157,7 +157,7 @@ EXPORT_SYMBOL_GPL(ip6_tnl_dst_reset);void ip6_tnl_dst_store (struct ip6_tnl *t,struct dst_entry *dst) {struct rt6_info *rt = (struct rt6_info *) dst; - t->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum :0 ; + t->dst_cookie =rt6_get_cookie (rt);dst_release (t->dst_cache); t->dst_cache = dst; }
net/ipv6/tcp_ipv6.c +1 -2
@@ -98,8 +98,7 @@ static void inet6_sk_rx_dst_set(struct sdst_hold (dst); sk->sk_rx_dst = dst;inet_sk (sk)->rx_dst_ifindex = skb->skb_iif; -if (rt->rt6i_node) -inet6_sk (sk)->rx_dst_cookie = rt->rt6i_node->fn_sernum; +inet6_sk (sk)->rx_dst_cookie =rt6_get_cookie (rt); }static void tcp_v6_hash (struct sock *sk)
net/ipv6/xfrm6_policy.c +2 -4
@@ -85,8 +85,7 @@ static int xfrm6_init_path(struct xfrm_d {if (dst->ops->family ==AF_INET6 ) {struct rt6_info *rt = (struct rt6_info *)dst; -if (rt->rt6i_node) - path->path_cookie = rt->rt6i_node->fn_sernum; + path->path_cookie =rt6_get_cookie (rt); } path->u.rt6.rt6i_nfheader_len = nfheader_len;
@@ -116,8 +115,7 @@ static int xfrm6_fill_dst(struct xfrm_ds RTF_LOCAL); xdst->u.rt6.rt6i_metric = rt->rt6i_metric; xdst->u.rt6.rt6i_node = rt->rt6i_node; -if (rt->rt6i_node) - xdst->route_cookie = rt->rt6i_node->fn_sernum; + xdst->route_cookie =rt6_get_cookie (rt); xdst->u.rt6.rt6i_gateway = rt->rt6i_gateway; xdst->u.rt6.rt6i_dst = rt->rt6i_dst; xdst->u.rt6.rt6i_src = rt->rt6i_src;
net/netfilter/ipvs/ip_vs_xmit.c +1 -1
@@ -373,7 +373,7 @@ __ip_vs_get_out_rt_v6(struct sk_buff *sk goto err_unreach; } rt = (struct rt6_info *) dst; - cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum :0 ; + cookie =rt6_get_cookie (rt);__ip_vs_dst_set (dest, dest_dst, &rt->dst, cookie);spin_unlock_bh (&dest->dst_lock); IP_VS_DBG(10, "new dst %pI6, src %pI6, refcnt=%d\n",
net/sctp/ipv6.c +1 -1
@@ -331,7 +331,7 @@ out: rt = (struct rt6_info *)dst; t->dst = dst; - t->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum :0 ; + t->dst_cookie =rt6_get_cookie (rt);pr_debug ("rt6_dst:%pI6 rt6_src:%pI6\n" , &rt->rt6i_dst.addr, &fl6->saddr); }else {
PATCH 146/294 ipv6: add rcu grace period before freeing fib6_node
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
commit c5cff8561d2d0006e972bd114afd51f082fee77c upstream.
We currently keep rt->rt6i_node pointing to the fib6_node for the route. And some functions make use of this pointer to dereference the fib6_node from rt structure, e.g. rt6_check(). However, as there is neither refcount nor rcu taken when dereferencing rt->rt6i_node, it could potentially cause crashes as rt->rt6i_node could be set to NULL by other CPUs when doing a route deletion.
This patch introduces an rcu grace period before freeing fib6_node and makes sure the functions that dereference it takes rcu_read_lock().
Note: there is no "Fixes" tag because this bug was there in a very early stage.
--- include/net/ip6_fib.h | 30 +++++++++++++++++++++++++++++- net/ipv6/ip6_fib.c | 20 ++++++++++++++++---- net/ipv6/route.c | 14 +++++++++++--- 3 files changed, 56 insertions(+), 8 deletions(-)
include/net/ip6_fib.h +29 -1
@@ -66,6 +66,7 @@ struct fib6_node {__u16 fn_flags;__u32 fn_sernum;struct rt6_info *rr_ptr; +struct rcu_head rcu; };#ifndef CONFIG_IPV6_SUBTREES
@@ -193,9 +194,36 @@ static inline void rt6_set_from(struct r rt->dst.from = new; } +/* Function to safely get fn->sernum for passed in rt +* and store result in passed in cookie. +* Return true if we can get cookie safely +* Return false if not +*/ +static inline bool rt6_get_cookie_safe (const struct rt6_info *rt, +u32 *cookie) +{ +struct fib6_node *fn; +bool status = false; + +rcu_read_lock (); + fn =rcu_dereference (rt->rt6i_node); + +if (fn) { + *cookie = fn->fn_sernum; + status = true; + } + +rcu_read_unlock (); +return status; +} +static inline u32 rt6_get_cookie (const struct rt6_info *rt) { -return rt->rt6i_node ? rt->rt6i_node->fn_sernum :0 ; +u32 cookie =0 ; + +rt6_get_cookie_safe (rt, &cookie); + +return cookie; }static inline void ip6_rt_put (struct rt6_info *rt)
net/ipv6/ip6_fib.c +16 -4
@@ -151,11 +151,23 @@ static __inline__ struct fib6_node *nodereturn fn; } -static __inline__void node_free (struct fib6_node *fn) +static void node_free_immediate (struct fib6_node *fn) {kmem_cache_free (fib6_node_kmem, fn); } +static void node_free_rcu (struct rcu_head *head) +{ + struct fib6_node *fn = container_of(head, struct fib6_node, rcu); + +kmem_cache_free (fib6_node_kmem, fn); +} + +static void node_free (struct fib6_node *fn) +{ +call_rcu (&fn->rcu, node_free_rcu); +} +static __inline__void rt6_release (struct rt6_info *rt) {if (atomic_dec_and_test (&rt->rt6i_ref))
@@ -551,9 +563,9 @@ insert_above:if (!in || !ln) {if (in) -node_free (in); +node_free_immediate (in);if (ln) -node_free (ln); +node_free_immediate (ln);return ERR_PTR (-ENOMEM ); }
@@ -977,7 +989,7 @@ int fib6_add(struct fib6_node *root, strroot, and then (in st_failure) stale node in main tree. */ -node_free (sfn); +node_free_immediate (sfn); err =PTR_ERR (sn); goto st_failure; }
net/ipv6/route.c +10 -3
@@ -1090,6 +1090,7 @@ struct dst_entry *ip6_blackhole_route(ststatic struct dst_entry *ip6_dst_check (struct dst_entry *dst,u32 cookie) {struct rt6_info *rt; +u32 rt_cookie; rt = (struct rt6_info *) dst;
@@ -1097,7 +1098,7 @@ static struct dst_entry *ip6_dst_check(s* DST_OBSOLETE_FORCE_CHK which forces validation calls down * into this function always. */ -if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie)) +if (!rt6_get_cookie_safe (rt, &rt_cookie) || rt_cookie != cookie)return NULL ;if (rt6_check_expired (rt))
@@ -1136,8 +1137,14 @@ static void ip6_link_failure(struct sk_bdst_hold (&rt->dst);if (ip6_del_rt (rt))dst_free (&rt->dst); - }else if (rt->rt6i_node && (rt->rt6i_flags &RTF_DEFAULT )) { - rt->rt6i_node->fn_sernum =-1 ; + }else { +struct fib6_node *fn; + +rcu_read_lock (); + fn =rcu_dereference (rt->rt6i_node); +if (fn && (rt->rt6i_flags &RTF_DEFAULT )) + fn->fn_sernum =-1 ; +rcu_read_unlock (); } } }
PATCH 147/294 ipv6: Fix may be used uninitialized warning in rt6_check
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
commit 3614364527daa870264f6dde77f02853cdecd02c upstream.
rt_cookie might be used uninitialized, fix this by initializing it.
--- net/ipv6/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/route.c +1 -1
@@ -1090,7 +1090,7 @@ struct dst_entry *ip6_blackhole_route(ststatic struct dst_entry *ip6_dst_check (struct dst_entry *dst,u32 cookie) {struct rt6_info *rt; -u32 rt_cookie; +u32 rt_cookie =0 ; rt = (struct rt6_info *) dst;
PATCH 148/294 r8169: Do not increment tx_dropped in TX ring cleaning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 1089650d8837095f63e001bbf14d7b48043d67ad upstream.
rtl8169_tx_clear_range() is responsible for cleaning up the TX ring during interface shutdown, incrementing tx_dropped for every SKB that we left at the time in the ring is misleading.
--- drivers/net/ethernet/realtek/r8169.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/realtek/r8169.c +0 -1
@@ -5860,7 +5860,6 @@ static void rtl8169_tx_clear_range(strucrtl8169_unmap_tx_skb (&tp->pci_dev->dev, tx_skb, tp->TxDescArray + entry);if (skb) { - tp->dev->stats.tx_dropped++;dev_kfree_skb_any (skb); tx_skb->skb =NULL ; }
PATCH 149/294 r8169: Be drop monitor friendly
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 7a4b813cb739ce598ffbad2e84d19d13fa23e25d upstream.
rtl_tx() is the TX reclamation process whereas rtl8169_tx_clear_range() does the TX ring cleaning during shutdown, both of these functions should call dev_consume_skb_any() to be drop monitor friendly.
--- drivers/net/ethernet/realtek/r8169.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169.c +2 -2
@@ -5860,7 +5860,7 @@ static void rtl8169_tx_clear_range(strucrtl8169_unmap_tx_skb (&tp->pci_dev->dev, tx_skb, tp->TxDescArray + entry);if (skb) { -dev_kfree_skb_any (skb); +dev_consume_skb_any (skb); tx_skb->skb =NULL ; } }
@@ -6168,7 +6168,7 @@ static void rtl_tx(struct net_device *de tp->tx_stats.packets++; tp->tx_stats.bytes += tx_skb->skb->len;u64_stats_update_end (&tp->tx_stats.syncp); -dev_kfree_skb_any (tx_skb->skb); +dev_consume_skb_any (tx_skb->skb); tx_skb->skb =NULL ; } dirty_tx++;
PATCH 150/294 Clarify (and fix) MAX_LFS_FILESIZE macros
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 0cc3b0ec23ce4c69e1e890ed2b8d2fa932b14aad upstream.
We have a MAX_LFS_FILESIZE macro that is meant to be filled in by filesystems (and other IO targets) that know they are 64-bit clean and don't have any 32-bit limits in their IO path.
It turns out that our 32-bit value for that limit was bogus. On 32-bit, the VM layer is limited by the page cache to only 32-bit index values, but our logic for that was confusing and actually wrong. We used to define that value to
(((loff_t)PAGE_SIZE << (BITS_PER_LONG-1))-1)
which is actually odd in several ways: it limits the index to 31 bits, and then it limits files so that they can't have data in that last byte of a page that has the highest 31-bit index (ie page index 0x7fffffff).
Neither of those limitations make sense. The index is actually the full 32 bit unsigned value, and we can use that whole full page. So the maximum size of the file would logically be "PAGE_SIZE << BITS_PER_LONG".
However, we do wan tto avoid the maximum index, because we have code that iterates over the page indexes, and we don't want that code to overflow. So the maximum size of a file on a 32-bit host should actually be one page less than the full 32-bit index.
So the actual limit is ULONG_MAX << PAGE_SHIFT. That means that we will not actually be using the page of that last index (ULONG_MAX), but we can grow a file up to that limit.
The wrong value of MAX_LFS_FILESIZE actually caused problems for Doug Nazar, who was still using a 32-bit host, but with a 9.7TB 2 x RAID5 volume. It turns out that our old MAX_LFS_FILESIZE was 8TiB (well, one byte less), but the actual true VM limit is one page less than 16TiB.
This was invisible until commit c2a9737f45e2 ("vfs,mm: fix a dead loop in truncate_inode_pages_range()"), which started applying that MAX_LFS_FILESIZE limit to block devices too.
NOTE! On 64-bit, the page index isn't a limiter at all, and the limit is actually just the offset type itself (loff_t), which is signed. But for clarity, on 64-bit, just use the maximum signed value, and don't make people have to count the number of 'f' characters in the hex constant.
So just use LLONG_MAX for the 64-bit case. That was what the value had been before too, just written out as a hex constant.
--- include/linux/fs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/fs.h +2 -2
@@ -809,9 +809,9 @@ static inline struct file *get_file(stru/* Page cache limit. The filesystems should put that into their s_maxbytes limits, otherwise bad things can happen in VM. */ #if BITS_PER_LONG ==32 -#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) +#define MAX_LFS_FILESIZE ((loff_t)ULONG_MAX << PAGE_SHIFT)#elif BITS_PER_LONG ==64 -#define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffffLL) +#define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX)#endif #define FL_POSIX 1
PATCH 151/294 xfrm_user: fix info leak in xfrm_notify_sa()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
commit 50329c8a340c9dea60d837645fcf13fc36bfb84d upstream.
The memory reserved to dump the ID of the xfrm state includes a padding byte in struct xfrm_usersa_id added by the compiler for alignment. To prevent the heap info leak, memset(0) the whole struct before filling it.
--- net/xfrm/xfrm_user.c | 1 + 1 file changed, 1 insertion(+)
net/xfrm/xfrm_user.c +1 -0
@@ -2552,6 +2552,7 @@ static int xfrm_notify_sa(struct xfrm_ststruct nlattr *attr; id =nlmsg_data (nlh); +memset (id,0 ,sizeof (*id));memcpy (&id->daddr, &x->id.daddr,sizeof (id->daddr)); id->spi = x->id.spi; id->family = x->props.family;
PATCH 152/294 xfrm_user: fix info leak in build_aevent()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
commit 931e79d7a7ddee4709c56b39de169a36804589a1 upstream.
The memory reserved to dump the ID of the xfrm state includes a padding byte in struct xfrm_usersa_id added by the compiler for alignment. To prevent the heap info leak, memset(0) the sa_id before filling it.
--- net/xfrm/xfrm_user.c | 1 + 1 file changed, 1 insertion(+)
net/xfrm/xfrm_user.c +1 -0
@@ -1752,6 +1752,7 @@ static int build_aevent(struct sk_buff *return -EMSGSIZE ; id =nlmsg_data (nlh); +memset (&id->sa_id,0 ,sizeof (id->sa_id));memcpy (&id->sa_id.daddr, &x->id.daddr,sizeof (x->id.daddr)); id->sa_id.spi = x->id.spi; id->sa_id.family = x->props.family;
PATCH 153/294 dm: convert DM printk macros to pr_<level> macros
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
commit d2c3c8dcb5987b8352e82089c79a41b6e17e28d2 upstream.
Using pr_<level> is the more common logging style.
Standardize style and use new macro DM_FMT.
Use no_printk in DMDEBUG macros when CONFIG_DM_DEBUG is not #defined.
--- include/linux/device-mapper.h | 71 +++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 39 deletions(-)
include/linux/device-mapper.h +31 -38
@@ -489,48 +489,41 @@ extern struct ratelimit_state dm_ratelim#define dm_ratelimit () 0#endif -#define DMCRIT(f, arg...) \ - printk(KERN_CRIT DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) +#define DM_FMT (fmt) DM_NAME ": " DM_MSG_PREFIX ": " fmt "\n" -#define DMERR(f, arg...) \ - printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) -#define DMERR_LIMIT(f, arg...) \ - do { \ - if (dm_ratelimit()) \ - printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " \ - f "\n", ## arg); \ - } while (0) - -#define DMWARN(f, arg...) \ - printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) -#define DMWARN_LIMIT(f, arg...) \ - do { \ - if (dm_ratelimit()) \ - printk(KERN_WARNING DM_NAME ": " DM_MSG_PREFIX ": " \ - f "\n", ## arg); \ - } while (0) - -#define DMINFO(f, arg...) \ - printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) -#define DMINFO_LIMIT(f, arg...) \ - do { \ - if (dm_ratelimit()) \ - printk(KERN_INFO DM_NAME ": " DM_MSG_PREFIX ": " f \ - "\n", ## arg); \ - } while (0) +#define DMCRIT (fmt, ...) pr_crit(DM_FMT(fmt), ##__VA_ARGS__) + +#define DMERR (fmt, ...) pr_err(DM_FMT(fmt), ##__VA_ARGS__) +#define DMERR_LIMIT (fmt, ...) \ +do { \ + if (dm_ratelimit()) \ + DMERR(fmt, ##__VA_ARGS__); \ +} while (0) + +#define DMWARN (fmt, ...) pr_warn(DM_FMT(fmt), ##__VA_ARGS__) +#define DMWARN_LIMIT (fmt, ...) \ +do { \ + if (dm_ratelimit()) \ + DMWARN(fmt, ##__VA_ARGS__); \ +} while (0) + +#define DMINFO (fmt, ...) pr_info(DM_FMT(fmt), ##__VA_ARGS__) +#define DMINFO_LIMIT (fmt, ...) \ +do { \ + if (dm_ratelimit()) \ + DMINFO(fmt, ##__VA_ARGS__); \ +} while (0)#ifdef CONFIG_DM_DEBUG -# define DMDEBUG(f, arg...) \ - printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX " DEBUG: " f "\n", ## arg) -# define DMDEBUG_LIMIT(f, arg...) \ - do { \ - if (dm_ratelimit()) \ - printk(KERN_DEBUG DM_NAME ": " DM_MSG_PREFIX ": " f \ - "\n", ## arg); \ - } while (0) +#define DMDEBUG (fmt, ...) printk(KERN_DEBUG DM_FMT(fmt), ##__VA_ARGS__) +#define DMDEBUG_LIMIT (fmt, ...) \ +do { \ + if (dm_ratelimit()) \ + DMDEBUG(fmt, ##__VA_ARGS__); \ +} while (0)#else -# define DMDEBUG(f, arg...) do {} while (0) -# define DMDEBUG_LIMIT(f, arg...) do {} while (0) +#define DMDEBUG (fmt, ...) no_printk(fmt, ##__VA_ARGS__) +#define DMDEBUG_LIMIT (fmt, ...) no_printk(fmt, ##__VA_ARGS__)#endif #define DMEMIT(x...) sz += ((sz >= maxlen) ? \
Re: [PATCH 3.16 153/294] dm: convert DM printk macros to pr_<level> macros
Quoted 1 line · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
Why include this? It's a simplification, not a bug fix.
Quoted 10 lines
------------------
From: Joe Perches <[email protected]>
commit
d2c3c8dcb5987b8352e82089c79a41b6e17e28d2upstream.Using pr_<level> is the more common logging style.
Standardize style and use new macro
DM_FMT.
Useno_printkin DMDEBUG macros whenCONFIG_DM_DEBUGis not #defined.
Re: [PATCH 3.16 153/294] dm: convert DM printk macros to pr_<level> macros
Quoted 4 lines · Joe Perches
Quoted 1 line · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
Why include this? It's a simplification, not a bug fix.
Logical reason is it serves as a prereq for applying commit 604407890ecf ("dm: fix printk() rate limiting code"). Which is 154/294 in this series.
Mike
Re: [PATCH 3.16 153/294] dm: convert DM printk macros to pr_<level> macros
Quoted 11 lines · Mike Snitzer
Quoted 4 lines · Joe Perches
Quoted 1 line · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
Why include this? It's a simplification, not a bug fix.
Logical reason is it serves as a prereq for applying commit
604407890ecf("dm: fixprintk()rate limiting code"). Which is 154/294 in this series.
Exactly.
Ben.
Signature · 3 lines
Ben Hutchings It is impossible to make anything foolproof because fools are so ingenious.
PATCH 154/294 dm: fix printk() rate limiting code
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 604407890ecf624c2fb41013c82b22aade59b455 upstream.
Using the same rate limiting state for different kinds of messages is wrong because this can cause a high frequency message to suppress a report of a low frequency message. Hence use a unique rate limiting state per message type.
--- drivers/md/dm.c | 10 ---------- include/linux/device-mapper.h | 41 ++++++++++++----------------------------- 2 files changed, 12 insertions(+), 39 deletions(-)
drivers/md/dm.c +0 -10
@@ -24,16 +24,6 @@#define DM_MSG_PREFIX "core" -#ifdef CONFIG_PRINTK -/* -* ratelimit state to be used in DMXXX_LIMIT(). -*/ -DEFINE_RATELIMIT_STATE (dm_ratelimit_state, -DEFAULT_RATELIMIT_INTERVAL , -DEFAULT_RATELIMIT_BURST ); -EXPORT_SYMBOL (dm_ratelimit_state); -#endif -/* * Cookies are numeric values sent with CHANGE and REMOVE * uevents while resuming, removing or renaming the device.
include/linux/device-mapper.h +12 -29
58 lines not on this page · raw message
PATCH 155/294 l2tp: initialise session's refcount before making it reachable
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 9ee369a405c57613d7c83a3967780c3e30c52ecc upstream.
Sessions must be fully initialised before calling l2tp_session_add_to_tunnel(). Otherwise, there's a short time frame where partially initialised sessions can be accessed by external users.
--- net/l2tp/l2tp_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/l2tp/l2tp_core.c +2 -4
@@ -1929,6 +1929,8 @@ struct l2tp_session *l2tp_session_createl2tp_session_set_header_len (session, tunnel->version); +l2tp_session_inc_refcount (session); + err =l2tp_session_add_to_tunnel (tunnel, session);if (err) {kfree (session);
@@ -1936,10 +1938,6 @@ struct l2tp_session *l2tp_session_createreturn ERR_PTR (err); } -/* Bump the reference count. The session context is deleted -* only when this drops to zero. -*/ -l2tp_session_inc_refcount (session);l2tp_tunnel_inc_refcount (tunnel);/* Ensure tunnel socket isn't deleted */