3.16.61-rc1 review
Subsystems (10)
cover 3.16.61-rc1 review
This is the start of the stable review cycle for the 3.16.61 release. There are 366 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 16 18:00:00 UTC 2018. Anything received after that time might be too late.
All the patches have also been committed to the linux-3.16.y-rc branch of
https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable-rc.git . A shortlog and diffstat can be found below.
Ben.
-------------
[email protected] (1):
Input: elantech - fix V4 report decoding for module with middle key
[e0ae2519ca004a628fa55aeef969c37edce522d3]
Aaron Ma (1):
Input: elantech - enable middle button of touchpads on ThinkPad P52
[24bb555e6e46d96e2a954aa0295029a81cc9bbaa]
Al Viro (6):
fix __legitimize_mnt()/mntput() race
[119e1ef80ecfe0d1deb6378d4ab41f5b71519de1]
fix mntput/mntput race
[9ea0a46ca2c318fcc449c1e6b62a7230a17888f1]
make sure that __dentry_kill() always invalidates d_seq, unhashed or not
[4c0d7cd5c8416b1ef41534d19163cb07ffaa03ab]
root dentries need RCU-delayed freeing
[90bad5e05bcdb0308cfa3d3a60f5c0b9c8e2efb3]
unify dentry_iput() and dentry_unlink_inode()
[550dce01dd606c88a837138aa448ccd367fb0cbb]
use ->d_seq to get coherency between ->d_inode and ->d_flags
[a528aca7f359f4b0b1d72ae406097e491a5ba9ea]Alex Estrin (1):
IB/isert: Fix for lib/dma_debug check_sync warning
[763b69654bfb88ea3230d015e7d755ee8339f8ee]
Alex Vesker (2):
net/mlx5: Fix command interface race in polling mode
[d412c31dae053bf30a1bc15582a9990df297a660]
net/mlx5: Fix incorrect raw command length parsing
[603b7bcff824740500ddfa001d7a7168b0b38542]
Alexander Potapenko (1):
vt: prevent leaking uninitialized data to userspace via /dev/vcs*
[21eff69aaaa0e766ca0ce445b477698dc6a9f55a]
Alexander Sverdlin (2):
ASoC: cirrus: i2s: Fix LRCLK configuration
[2d534113be9a2aa532a1ae127a57e83558aed358]
ASoC: cirrus: i2s: Fix {TX|RX}LinCtrlData setup
[5d302ed3cc80564fb835bed5fdba1e1250ecc9e5]
Alexey Brodkin (1):
ARC: Fix CONFIG_SWAP
[6e3761145a9ba3ce267c330b6bff51cf6a057b06]
Alexey Kodanev (1):
dccp: fix undefined behavior with 'cwnd' shift in ccid2_cwnd_restart()
[61ef4b07fcdc30535889990cf4229766502561cf]
Amir Goldstein (3):
ext4: do not update s_last_mounted of a frozen fs
[db6516a5e7ddb6dc72d167b920f2f272596ea22d]
ext4: factor out helper ext4_sample_last_mounted()
[833a950882d33a7dfc319d5e152fdf35028936eb]
vfs: add the sb_start_intwrite_trylock() helper
[0c8e3fe35db9b66ae0030849545030ec7c0fc45c]
Andre Przywara (1):
arm64: add missing data types in smp_load_acquire/smp_store_release
[878a84d5a8a18a4ab241d40cebb791d6aedf5605]
Andrea Arcangeli (1):
ksm: add cond_resched() to the rmap_walks
[ad12695f177c3403a64348b42718faf9727fe358]
Andrew F. Davis (1):
rpmsg: Correct support for MODULE_DEVICE_TABLE()
[5b7d127726de6eed4b900bc3bbb167837690818f]
Andrew Morton (1):
arch/x86/kernel/cpu/common.c: fix unused symbol warning
[e48510f45107613bf14060eeabd658c49a044242]
Andri Yngvason (1):
can: dev: Consolidate and unify state change handling
[bac78aabcfece0c493b2ad824c68fbdc20448cbc]
Andy Lutomirski (1):
fs/proc: Stop trying to report thread stacks
[b18cb64ead400c01bf1580eeba330ace51f8087d]
Aneesh Kumar K.V (1):
powerpc/mm/hash: Add missing isync prior to kernel stack SLB switch
[91d06971881f71d945910de128658038513d1b24]
Anil Gurumurthy (1):
scsi: qla2xxx: Return error when TMF returns
[b4146c4929ef61d5afca011474d59d0918a0cd82]
Anna-Maria Gleixner (1):
nohz: Fix local_timer_softirq_pending()
[80d20d35af1edd632a5e7a3b9c0ab7ceff92769e]
Anssi Hannula (6):
can: xilinx_can: fix RX loop if RXNEMP is asserted without RXOK
[32852c561bffd613d4ed7ec464b1e03e1b7b6c5c]
can: xilinx_can: fix RX overflow interrupt not being enabled
[83997997252f5d3fc7f04abc24a89600c2b504ab]
can: xilinx_can: fix device dropping off bus on RX overrun
[2574fe54515ed3487405de329e4e9f13d7098c10]
can: xilinx_can: fix incorrect clear of non-processed interrupts
[2f4f0f338cf453bfcdbcf089e177c16f35f023c8]
can: xilinx_can: fix recovery from error states not being propagated
[877e0b75947e2c7acf5624331bb17ceb093c98ae]
can: xilinx_can: keep only 1-2 frames in TX FIFO to fix TX accounting
[620050d9c2be15c47017ba95efe59e0832e99a56]
Anton Vasilyev (1):
can: ems_usb: Fix memory leak on ems_usb_disconnect()
[72c05f32f4a5055c9c8fe889bb6903ec959c0aad]
Arnaldo Carvalho de Melo (9):
perf script: Use readdir() instead of deprecated readdir_r()
[a5e8e825bd1704c488bf6a46936aaf3b9f203d6a]
perf thread_map: Correctly size buffer used with dirent->dt_name
[bdf23a9a190d7ecea092fd5c4aabb7d4bd0a9980]
perf thread_map: Use readdir() instead of deprecated readdir_r()
[3354cf71104de49326d19d2f9bdb1f66eea52ef4]
perf tools: Move syscall number fallbacks from perf-sys.h to tools/arch/x86/include/asm/
[cec07f53c398f22576df77052c4777dc13f14962]
perf tools: Use readdir() instead of deprecated readdir_r()
[bfc279f3d233150ff260e9e93012e14f86810648]
perf top: Use __fallthrough
[7b0214b702ad8e124e039a317beeebb3f020d125]
perf trace: Do not process PERF_RECORD_LOST twice
[3ed5ca2efff70e9f589087c2013789572901112d]
perf trace: Fix up fd -> pathname resolution
[cdcd1e6bd8a92f8353fc2f37003c6eae2d1e6903]
tools include: Add a __fallthrough statement
[b5bf1733d6a391c4e90ea8f8468d83023be74a2a]Arnd Bergmann (3):
[media] ir-core: fix gcc-7 warning on bool arithmetic
[bd7e31bbade02bc1e92aa00d5cf2cee2da66838a]
arm64: use linux/types.h in kvm.h
[d19279154b3fff9adff96b54d1a77dfb8f01e3da]
video/omap: add module license tags
[1bde9f2cf142b726412fa5b0e3cb557ff46952b0]
Artem Savkov (1):
tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure
[57ea2a34adf40f3a6e88409aafcf803b8945619a]
Bart Van Assche (1):
scsi: sr: Avoid that opening a CD-ROM hangs with runtime power management enabled
[1214fd7b497400d200e3f4e64e2338b303a20949]
Ben Hutchings (10):
Revert "mtd: nand: omap2: Fix subpage write"
[not upstream; reverted change is good but has larger dependencies]
bcmgenet: Delete unused variable
[not upstream; fixes incorrect backport]
fnic: Fix misleading indentation
[86001f248e943b7b22c22b50151ffaee9447df2d]
iio: iio-trig-periodic-rtc: Free trigger resource correctly
[not upstream; driver was removed]
rtl8723be: Fix misleading indentation
[5c99f04fec93068147a3e95b439b345f203ac5b9]
staging: rtl8192ee: Fix misleading indentation
[not upstream; driver was removed from staging]
staging: vt6656: Fix misleading indentation
[not upstream; functions have been removed]
string: drop __must_check from strscpy()
[08a77676f9c5fc69a681ccd2cd8140e65dcb26c7]
x86/apic: Fix build failure with X86_IO_APIC disabled
[not upstream; failing configuration is no longer possible]
x86/cpufeatures: Hide AMD-specific speculation flags
[e7c587da125291db39ddf1f49b18e5970adbac17]
Bin Liu (1):
usb: core: handle hub C_PORT_OVER_CURRENT condition
[249a32b7eeb3edb6897dd38f89651a62163ac4ed]
Bjorn Helgaas (1):
PCI: shpchp: Fix AMD POGO identification
[bed4e9cfab93a0f3d0144cb919820e6d5c40b8b1]
Bo Chen (1):
ALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream()
[a3aa60d511746bd6c0d0366d4eb90a7998bcde8b]
Boris Brezillon (1):
m68k: Implement ndelay() as an inline function to force type checking/casting
[d8441ba80c55aad435e4b98fe0d7ad5d21e46bf9]
Boris Ostrovsky (1):
xen: Remove unnecessary BUG_ON from __unbind_from_irq()
[eef04c7b3786ff0c9cb1019278b6c6c2ea0ad4ff]
Borislav Petkov (1):
x86/mce: Do not overwrite MCi_STATUS in mce_no_way_out()
[1f74c8a64798e2c488f86efc97e308b85fb7d7aa]
Cannon Matthews (1):
mm: hugetlb: yield when prepping struct pages
[520495fe96d74e05db585fc748351e0504d8f40d]
Changbin Du (1):
tracing: Fix missing return symbol in function_graph output
[1fe4293f4b8de75824935f8d8e9a99c7fc6873da]
Chanho Park (1):
perf tools: define _DEFAULT_SOURCE for glibc_2.20
[512fe365373b9c95a70b4b6357503ee74d27214f]
Chas Williams (1):
net/xen-netfront: only clean up queues if present
[9a873c71e91cabf4c10fd9bbd8358c22deaf6c9e]
Chen-Yu Tsai (1):
Input: i8042 - add Lenovo LaVie Z to the i8042 reset list
[384cf4285b34e08917e3e66603382f2b0c4f6e1b]
Christophe Jaillet (1):
scsi: qlogicpti: Fix an error handling path in 'qpti_sbus_probe()'
[51b910c3c70986a5a0a84eea11cb8e904e37ba8b]
Colin Ian King (2):
libata: zpodd: make arrays cdb static, reduces object code size
[795ef788145ed2fa023efdf11e8d5d7bedc21462]
media: smiapp: fix timeout checking in smiapp_read_nvm
[7a2148dfda8001c983f0effd9afd8a7fa58e99c4]
Cong Wang (1):
vsock: split dwork to avoid reinitializations
[455f05ecd2b219e9a216050796d30c830d9bc393]
Corey Minyard (1):
ipmi:bt: Set the timeout before doing a capabilities check
[fe50a7d0393a552e4539da2d31261a59d6415950]
Dan Carpenter (10):
ALSA: msnd: add some missing curly braces
[096a020a9ef5c947577d3b57199bfc9b7e686b49]
PCI: ibmphp: Fix use-before-set in get_max_bus_speed()
[4051f5ebb11c6ef4b0d3eac2fbbd187c070656c5]
USB: serial: ch341: fix type promotion bug in ch341_control_in()
[e33eab9ded328ccc14308afa51b5be7cbe78d30b]
dmaengine: k3dma: Off by one in k3_of_dma_simple_xlate()
[c4c2b7644cc9a41f17a8cc8904efe3f66ae4c7ed]
drm/nouveau/gem: off by one bugs in nouveau_gem_pushbuf_reloc_apply()
[7f073d011f93e92d4d225526b9ab6b8b0bbd6613]
libata: zpodd: small read overflow in eject_tray()
[18c9a99bce2a57dfd7e881658703b5d7469cc7b9]
mfd: tps65911-comparator: Fix a build error
[ac1886165cd1201c5793099b6fbad1876bf98dfe]
mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()
[01eca2842874b9a85b7cd1e1b0e5b34a5d53a21f]
qlogic: check kstrtoul() for errors
[5fc853cc01c68f84984ecc2d5fd777ecad78240f]
xhci: xhci-mem: off by one in xhci_stream_id_to_ring()
[313db3d6488bb03b61b99de9dbca061f1fd838e1]
Dan Williams (2):
x86/spectre_v1: Disable compiler optimizations over array_index_mask_nospec()
[eab6870fee877258122a042bfd99ee7908c40280]
x86/speculation: Fix up array_index_nospec_mask() asm constraint
[be3233fbfcb8f5acb6e3bcd0895c3ef9e100d470]
Daniel Axtens (1):
powerpc: make feature-fixup tests fortify-safe
[c69a48cdb301a18697bc8c9935baf4f32861cf9e]
Daniel Jordan (1):
mm/swapfile.c: fix swap_count comment about nonexistent SWAP_HAS_CONT
[955c97f0859abef698e77f5697f5c4008303abb9]
Dave Martin (1):
tty: pl011: Avoid spuriously stuck-off interrupts
[4a7e625ce50412a7711efa0f2ef0b96ce3826759]
Dave Wysochanski (1):
NFSv4: Fix possible 1-byte stack overflow in nfs_idmap_read_and_verify_message
[d68894800ec5712d7ddf042356f11e36f87d7f78]
David Disseldorp (1):
scsi: target: Fix truncated PR-in ReadKeys response
[63ce3c384db26494615e3c8972bcd419ed71f4c4]
David Howells (1):
VFS: Impose ordering on accesses of d_inode and d_flags
[4bf46a272647d89e780126b52eda04737defd9f4]
David Rivshin (1):
ARM: 8764/1: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size
[76ed0b803a2ab793a1b27d1dfe0de7955282cd34]David Vrabel (4):
xen-netfront: fix locking in connect error path
[db8c8ab61a28d7e3eb86d247b342a853263262c3]
xen-netfront: properly destroy queues when removing device
[ad0681185770716523c81b156c44b9804d7b8ed2]
xen-netfront: release per-queue Tx and Rx resource when disconnecting
[a5b5dc3ce4df4f05f4d81c7d3c56a7604b242093]
xen-netfront: use different locks for Rx and Tx stats
[900e183301b54f8ca17a86d9835e9569090d182a]
Davide Caratti (1):
net/sched: act_simple: fix parsing of TCA_DEF_DATA
[8d499533e0bc02d44283dbdab03142b599b8ba16]
Dewet Thibaut (1):
x86/MCE: Remove min interval polling limitation
[fbdb328c6bae0a7c78d75734a738b66b86dffc96]
Dmitry Safonov (4):
iommu/vt-d: Ratelimit each dmar fault printing
[6c50d79f66382d78918a768374839d6d1b606d3f]
netlink: Do not subscribe to non-existent groups
[7acf9d4237c46894e0fa0492dd96314a41742e84]
netlink: Don't shift on 64 for ngroups
[91874ecf32e41b5d86a4cb9d60e0bee50d828058]
netlink: Don't shift with UB on nlk->ngroups
[61f4b23769f0cc72ae62c9a81cf08f0397d40da8]Dmitry Torokhov (1):
Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list
[a4c2a13129f7c5bcf81704c06851601593303fd5]Doug Berger (1):
PM / wakeup: Only update last time for active wakeup sources
[2ef7c01c0cdb170142058c6d8fe0697aee4e4d7d]
Doug Ledford (1):
RDMA/ipoib: Update paths on CLIENT_REREG/SM_CHANGE events
[fa9391dbad4b868512ed22a7e41765f881a8a935]
Douglas Anderson (1):
dm bufio: avoid sleeping while holding the dm_bufio lock
[9ea61cac0b1ad0c09022f39fd97e9b99a2cfc2dc]
Eric Biggers (4):
KEYS: DNS: fix parsing multiple options
[c604cb767049b78b3075497b80ebb8fd530ea2cc]
ext4: correct endianness conversion in __xattr_check_inode()
[199625098a18a5522b424dea9b122b254c022fc5]
ext4: don't read out of bounds when checking for in-inode xattrs
[290ab230016f187c3551d8380ea742889276d03a]
reiserfs: fix buffer overflow with long warning messages
[fe10e398e860955bac4d28ec031b701d358465e4]
Eric Dumazet (6):
net/packet: refine check for priv area size
[eb73190f4fbeedf762394e92d6a4ec9ace684c88]
net: metrics: add proper netlink validation
[5b5e7a0de2bbf2a1afcd9f49e940010e9fb80d53]
netfilter: ipv6: nf_defrag: reduce struct net memory waste
[9ce7bc036ae4cfe3393232c86e9e1fea2153c237]
netfilter: nf_queue: augment nfqa_cfg_policy
[ba062ebb2cd561d404e0fba8ee4b3f5ebce7cbfc]
rtnetlink: validate attributes in do_setlink()
[644c7eebbfd59e72982d11ec6cc7d39af12450ae]
xfrm_user: prevent leaking 2 bytes of kernel memory
[45c180bc29babbedd6b8c01b975780ef44d9d09c]
Eric Engestrom (1):
perf tools: Remove duplicate const qualifier
[3b556bced46aa6b1873da7faa18eff235e896adc]
Eric W. Biederman (1):
signal/xtensa: Consistenly use SIGBUS in do_unaligned_user
[7de712ccc096b81d23cc0a941cd9b8cb3956605d]
Evan Green (1):
clk: qcom: Base rcg parent rate off plan frequency
[c7d2a0eb6c028ba064bfe92d7667977418142c7c]
Fabian Frederick (1):
can: constify of_device_id array
[486e957033623656298a07c39a8bf2fd81db285b]
Florian Fainelli (1):
net: ethernet: davinci_emac: Fix printing of base address
[5a04e8f81a4f55ce1c2b7b525744a187c99ba302]
Florian Meier (1):
gcov: add support for gcc version >= 6
[d02038f972538b93011d78c068f44514fbde0a8c]
Florian Westphal (2):
atl1c: reserve min skb headroom
[6e56830776828d8ca9897fc4429eeab47c3bb432]
xfrm: free skb if nlsk pointer is NULL
[86126b77dcd551ce223e7293bb55854e3df05646]
Geert Uytterhoeven (1):
time: Make sure jiffies_to_msecs() preserves non-zero time periods
[abcbcb80cd09cd40f2089d912764e315459b71f7]
Geoff Levand (1):
kexec: Fix make headers_check
[9dc5c05f45ca8101025046cda7f8aca8835204f2]
Guillaume Nault (8):
l2tp: clean up stale tunnel or session in pppol2tp_connect's error path
[bda06be2158c7aa7e41b15500c4d3840369c19a6]
l2tp: filter out non-PPP sessions in pppol2tp_tunnel_ioctl()
[ecd012e45ab5fd76ed57546865897ce35920f56b]
l2tp: fix missing refcount drop in pppol2tp_tunnel_ioctl()
[f664e37dcc525768280cb94321424a09beb1c992]
l2tp: fix pseudo-wire type for sessions created by pppol2tp_connect()
[90904ff5f958a215cc3d26f957a46e80fa178470]
l2tp: fix refcount leakage on PPPoL2TP sockets
[3d609342cc04129ff7568e19316ce3d7451a27e8]
l2tp: only accept PPP sessions in pppol2tp_connect()
[7ac6ab1f8a38ba7f8d97f95475bb6a2575db4658]
l2tp: prevent pppol2tp_connect() from creating kernel sockets
[3e1bc8bf974e2d4e7beb842a4c801c2542eff3bd]
l2tp: reject creation of non-PPP sessions on L2TPv2 tunnels
[de9bada5d389903f4faf33980e6a95a2911c7e6d]
Gustavo A. R. Silva (2):
HID: hiddev: fix potential Spectre v1
[4f65245f2d178b9cba48350620d76faa4a098841]
net: cxgb3_main: fix potential Spectre v1
[676bcfece19f83621e905aa55b5ed2d45cc4f2d3]
Hangbin Liu (2):
ipv6: mcast: fix unsolicited report interval after receiving querys
[6c6da92808442908287fae8ebb0ca041a52469f4]
multicast: do not restore deleted record source filter mode to new one
[08d3ffcc0cfaba36f6b86fd568cc3bc773061fa6]
Hans de Goede (4):
ACPI / LPSS: Add missing prv_offset setting for byt/cht PWM devices
[fdcb613d49321b5bf5d5a1bd0fba8e7c241dcc70]
ahci: Disable LPM on Lenovo 50 series laptops with a too old BIOS
[240630e61870e62e39a97225048f9945848fa5f5]
libata: Drop SanDisk SD7UB3Q*G1001 NOLPM quirk
[2cfce3a86b64b53f0a70e92a6a659c720c319b45]
pwm: lpss: platform: Save/restore the ctrl register over a suspend/resume
[1d375b58c12f08d8570b30b865def4734517f04f]
Herbert Xu (1):
crypto: padlock-aes - Fix Nano workaround data corruption
[46d8c4b28652d35dc6cfb5adf7f54e102fc04384]
Himanshu Madhani (1):
scsi: qla2xxx: Fix setting lower transfer speed if GPSC fails
[413c2f33489b134e3cc65d9c3ff7861e8fdfe899]
Houston Yaroschoff (1):
usb: cdc_acm: Add quirk for Uniden UBC125 scanner
[4a762569a2722b8a48066c7bacf0e1dc67d17fa1]
Huacai Chen (1):
MIPS: io: Add barrier after register read in inX()
[18f3e95b90b28318ef35910d21c39908de672331]
Huang Ying (1):
mm: /proc/pid/pagemap: hide swap entries from unprivileged users
[ab6ecf247a9321e3180e021a6a60164dee53ab2e]
Ingo Flaschberger (1):
1wire: family module autoload fails because of upper/lower case mismatch.
[065c09563c872e52813a17218c52cd642be1dca6]
Jack Morgenstein (1):
net/mlx4_core: Save the qpn from the input modifier in RST2INIT wrapper
[958c696f5a7274d9447a458ad7aa70719b29a50a]
Jan Kara (2):
ext4: fix fencepost error in check for inode count overflow during resize
[4f2f76f751433908364ccff82f437a57d0e6e9b7]
udf: Detect incorrect directory size
[fa65653e575fbd958bdf5fb9c4a71a324e39510d]
Jann Horn (3):
ibmasm: don't write out of bounds in read handler
[a0341fc1981a950c1e902ab901e98f60e0e243f3]
netfilter: nf_log: don't hold nf_log_mutex during user access
[ce00bf07cc95a57cd20b208e02b3c2604e532ae8]
scsi: sg: mitigate read/write abuse
[26b5b874aff5659a7e26e5b1997e3df2c41fa7fd]
Jason Wang (1):
vhost_net: validate sock before trying to put its fd
[b8f1f65882f07913157c44673af7ec0b308d03eb]
Jeff Layton (3):
ceph: don't set req->r_locked_dir in ceph_d_revalidate
[c3f4688a08fd86f1bf8e055724c84b7a40a09733]
ceph: fix endianness of getattr mask in ceph_d_revalidate
[1097680d759918ce4a8705381c0ab2ed7bd60cf1]
nfsd: silence sparse warning about accessing credentials
[ae4b884fc6316b3190be19448cea24b020c1cad6]Jens Axboe (1):
sbitmap: fix race in wait batch accounting
[c854ab5773be1c1a0d3cef0c3a3261f2c48ab7f8]
Jeremy Cline (1):
net: socket: fix potential spectre v1 gadget in socketcall
[c8e8cd579bb4265651df8223730105341e61a2d1]
Jia He (1):
mm/ksm.c: ignore STABLE_FLAG of rmap_item->address in rmap_walk_ksm()
[1105a2fc022f3c7482e32faf516e8bc44095f778]Jiang Biao (1):
virtio_balloon: fix another race between migration and ballooning
[89da619bc18d79bca5304724c11d4ba3b67ce2c6]
Jiri Olsa (2):
perf tools: Fix python extension build for gcc 8
[b7a313d84e853049062011d78cb04b6decd12f5c]
perf tools: Fix snprint warnings for gcc 8
[77f18153c080855e1c3fb520ca31a4e61530121d]
Jiri Slaby (3):
p54: memset(0) whole array
[6f17581788206444cbbcdbc107498f85e9765e3d]
tty: vt, get rid of weird source code flow
[34902b7f2754e6d890feb0cee34187f1bc75c930]
tty: vt, remove reduntant check
[182846a00f489849c55d113954f0c4a8a286ca39]
Joakim Tjernlund (4):
mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking.
[f1ce87f6080b1dda7e7b1eda3da332add19d87b9]
mtd: cfi_cmdset_0002: Fix unlocking requests crossing a chip boudary
[0cd8116f172eed018907303dbff5c112690eeb91]
mtd: cfi_cmdset_0002: Use right chip in do_ppb_xxlock()
[f93aa8c4de307069c270b2d81741961162bead6c]
mtd: cfi_cmdset_0002: fix SEGV unlocking multiple chips
[5fdfc3dbad099281bf027a353d5786c09408a8e5]
Johan Hovold (7):
USB: serial: cp210x: add CESINEL device ids
[24160628a34af962ac99f2f58e547ac3c4cbd26f]
USB: serial: keyspan_pda: fix modem-status error handling
[01b3cdfca263a17554f7b249d20a247b2a751521]
USB: serial: mos7840: fix status-register error handling
[794744abfffef8b1f3c0c8a4896177d6d13d653d]
backlight: as3711_bl: Fix Device Tree node leaks
[d5318d302e7cf6583ec85a2a8bfbb3a3910ae372]
backlight: as3711_bl: Fix Device Tree node lookup
[4a9c8bb2aca5b5a2a15744333729745dd9903562]
backlight: max8925_bl: Fix Device Tree node lookup
[d1cc0ec3da23e44c23712579515494b374f111c9]
backlight: tps65217_bl: Fix Device Tree node lookup
[2b12dfa124dbadf391cb9a616aaa6b056823bf75]John Syne (2):
staging:iio:ade7854: Fix error handling on read/write
[4297b23d927fa5265378f4a71372ecef3c33023a]
staging:iio:ade7854: Fix the wrong number of bits to read
[6cef2ab01636b6021044f349df466a97c408ec27]
Jon Derrick (1):
ext4: check superblock mapped prior to committing
[a17712c8e4be4fa5404d20e9cd3b2b21eae7bc56]
Joshua Frkuska (1):
usb: gadget: u_audio: update hw_ptr in iso_complete after data copied
[6b37bd78d30c890e575a1bda22978d1d2a233362]
Juergen Gross (1):
xen/netfront: don't cache skb_shinfo()
[d472b3a6cf63cd31cae1ed61930f07e6cd6671b5]
Julia Lawall (1):
bnx2x: use the right constant
[dd612f18a49b63af8b3a5f572d999bdb197385bc]
Julian Wiedmann (1):
s390/qeth: don't clobber buffer on async TX completion
[ce28867fd20c23cd769e78b4d619c4755bf71a1c]
Kai-Heng Feng (1):
media: cx231xx: Add support for AverMedia DVD EZMaker 7
[29e61d6ef061b012d320327af7dbb3990e75be45]
Kamal Heib (1):
RDMA/mlx5: Fix memory leak in mlx5_ib_create_srq() error path
[d63c46734c545ad0488761059004a65c46efdde3]
Karoly Pados (1):
USB: serial: cp210x: add Silicon Labs IDs for Windows Update
[2f839823382748664b643daa73f41ee0cc01ced6]Keerthy (1):
ARM: dts: da850: Fix interrups property for gpio
[3eb1b955cd7ed1e621ace856710006c2a8a7f231]
Kees Cook (2):
binfmt_elf: fix calculations for bss padding
[0036d1f7eb95bcc52977f15507f00dd07018e7e2]
mm: refuse wrapped vm_brk requests
[ba093a6d9397da8eafcfbaa7d95bd34255da39a0]
Keith Busch (1):
block: Fix transfer when chunk sectors exceeds max
[15bfd21fbc5d35834b9ea383dc458a1f0c9e3434]
Kiran Kumar Modukuri (5):
cachefiles: Fix missing clear of the CACHEFILES_OBJECT_ACTIVE flag
[5ce83d4bb7d8e11e8c1c687d09f4b5ae67ef3ce3]
cachefiles: Fix refcounting bug in backing-file read monitoring
[934140ab028713a61de8bca58c05332416d037d1]
cachefiles: Wait rather than BUG'ing on "Unexpected object collision"
[c2412ac45a8f8f1cd582723c1a139608694d410d]
fscache: Allow cancelled operations to be enqueued
[d0eb06afe712b7b103b6361f40a9a0c638524669]
fscache: Fix reference overput in fscache_attach_object() error handling
[f29507ce66701084c39aeb1b0ae71690cbff3554]
Konrad Rzeszutek Wilk (3):
x86/bugs: Add AMD's SPEC_CTRL MSR usage
[6ac2f49edb1ef5446089c7c660017732886d62d6]
x86/bugs: Add AMD's variant of SSB_NO
[24809860012e0130fbafe536709e08a22b3e959e]
x86/bugs: Switch the selection of mitigation from CPU vendor to CPU features
[108fab4b5c8f12064ef86e02cb0459992affb30f]
Konstantin Khlebnikov (1):
pagemap: hide physical addresses from non-privileged users
[1c90308e7a77af6742a97d1021cca923b23b7f0d]
Krzysztof Kozlowski (1):
clk: si5351: Constify clock names and struct regmap_config
[8234caed27f7bce141c9fb1f7e76c91a2a66d248]
Lars Persson (1):
cifs: Fix use after free of a mid_q_entry
[696e420bb2a6624478105651d5368d45b502b324]
Laura Abbott (2):
staging: android: ion: Return an ERR_PTR in ion_map_kernel
[0a2bc00341dcfcc793c0dbf4f8d43adf60458b05]
staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy
[45ad559a29629cb1c64ee636563c69b71524f077]
Lee Jones (1):
mfd: tps65911-comparator: Fix an off by one bug
[1768391c3674b0c6bdc4947121f15fb0c2f47ec4]
Leon Romanovsky (4):
RDMA/mlx4: Discard unknown SQP work requests
[6b1ca7ece15e94251d1d0d919f813943e4a58059]
RDMA/uverbs: Don't fail in creation of multiple flows
[fe48aecb4df837540f13b5216f27ddb306aaf4b9]
RDMA/uverbs: Fix slab-out-of-bounds in ib_uverbs_ex_create_flow
[4fae7f170416f970e5655f7e945ce69286b1c4ff]
RDMA/uverbs: Protect from attempts to create flows on unsupported QP
[940efcc8889f0d15567eb07fc9fd69b06e366aa5]
Liang Z Li (1):
xen-netfront: Remove the meaningless code
[905726c1c5a3ca620ba7d73c78eddfb91de5ce28]
Linus Lüssing (2):
batman-adv: Avoid storing non-TT-sync flags on singular entries too
[4a519b83da16927fb98fd32b0f598e639d1f1859]
batman-adv: Fix multicast TT issues with bogus ROAM flags
[a44ebeff6bbd6ef50db41b4195fca87b21aefd20]
Linus Torvalds (2):
squashfs: be more careful about metadata corruption
[01cfb7937a9af2abb1136c7e89fbf3fd92952956]
squashfs: more metadata hardening
[d512584780d3e6a7cacb2f482834849453d444a1]
Lorenzo Bianconi (1):
ipv4: remove BUG_ON() from fib_compute_spec_dst
[9fc12023d6f51551d6ca9ed7e02ecc19d79caf17]
Lorenzo Stoakes (1):
gcov: add support for GCC 5.1
[3e44c471a2dab210f7e9b1e5f7d4d54d52df59eb]
Lubomir Rintel (1):
usb: cdc_acm: Add quirk for Castles VEGA3000
[1445cbe476fc3dd09c0b380b206526a49403c071]
Lukas Czerner (1):
ext4: update mtime in ext4_punch_hole even if no blocks are released
[eee597ac931305eff3d3fd1d61d6aae553bc0984]
Lyude Paul (1):
drm/nouveau: Remove bogus crtc check in pmops_runtime_idle
[68fe23a626b67b56c912c496ea43ed537ea9708f]
Maciej S. Szmigiero (1):
X.509: unpack RSA signatureValue field from BIT STRING
[b65c32ec5a942ab3ada93a048089a938918aba7f]
Mahesh Salgaonkar (1):
powerpc/fadump: Unregister fadump on kexec down path.
[722cde76d68e8cc4f3de42e71c82fd40dea4f7b9]
Marcelo Ricardo Leitner (1):
sctp: fix identification of new acks for SFR-CACC
[51446780fc33e45cb790c05a7fa2c5bf7e8bc53b]
Mark Rutland (1):
arm64: ensure extension of smp_store_release value
[994870bead4ab19087a79492400a5478e2906196]
Markos Chandras (2):
MIPS: asm: compiler: Add new macros to set ISA and arch asm annotations
[be5136988e25ae0dc8379fcb937efc63d87aba9e]
MIPS: asmmacro: Ensure 64-bit FP registers are used with MSA
[2bd7bc254ab1f45269db6dd7957d63b713817408]
Markus Pargmann (1):
batman-adv: debugfs, avoid compiling for !DEBUG_FS
[9bb218828c8f4fa6587af93e248903c96ce469d0]
Martin Kaiser (1):
mtd: rawnand: mxc: set spare area size register explicitly
[3f77f244d8ec28e3a0a81240ffac7d626390060c]
Martin Liska (1):
gcov: support GCC 7.1
[05384213436ab690c46d9dfec706b80ef8d671ab]
Masami Hiramatsu (1):
ring_buffer: tracing: Inherit the tracing setting to next ring buffer
[73c8d8945505acdcbae137c2e00a1232e0be709f]
Matt Turner (2):
tools/power turbostat: Correct SNB_C1/C3_AUTO_UNDEMOTE defines
[e0d34648b4d77ba715e13739d04e7b0692fe5eaa]
x86: msr-index.h: Correct SNB_C1/C3_AUTO_UNDEMOTE defines
[a00072a24a9f5b88cfc56f2dec6afe8ce3874e60]
Mauro Carvalho Chehab (5):
[media] drxd_hard: fix bad alignments
[cea130021448763b15f4b16af184bbab4be118fb]
[media] drxk_hard: fix bad alignments
[89fffac802c18caebdf4e91c0785b522c9f6399a]
media: dvb_frontend: fix locking issues at dvb_frontend_get_event()
[76d81243a487c09619822ef8e7201a756e58a87d]
media: omap3isp/isp: remove an unused static var
[3f4836beb2ebeb0211d9911d878a267d687e0e6e]
media: v4l2-compat-ioctl32: prevent go past max size
[ea72fbf588ac9c017224dcdaa2019ff52ca56fee]
Max Gurtovoy (1):
IB/isert: fix T10-pi check mask setting
[0e12af84cdd3056460f928adc164f9e87f4b303b]
Maxim Moseychuk (1):
usb: do not reset if a low-speed or full-speed device timed out
[6e01827ed93947895680fbdad68c072a0f4e2450]
Michael Ellerman (2):
powerpc/lib: Fix feature fixup test of external branch
[32810d91325ec76b8ef4df463f8a0e9baf353322]
powerpc/lib: Fix the feature fixup tests to actually work
[cad0e39023b43d94d5e38dfd55c103e15bdd093d]
Michael Jeanson (1):
powerpc/e500mc: Set assembler machine type to e500mc
[69a8405999aa1c489de4b8d349468f0c2b83f093]
Michael Karcher (1):
net-next: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()).
[9144c3795c2636351d553e4d0fc5297201182de2]
Michael Neuling (2):
powerpc/ptrace: Fix enforcement of DAWR constraints
[cd6ef7eebf171bfcba7dc2df719c2a4958775040]
powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG
[4f7c06e26ec9cf7fe9f0c54dc90079b6a4f4b2c3]
Michael Schmitz (1):
m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap()
[3f90f9ef2dda316d64e420d5d51ba369587ccc55]
Michal Hocko (2):
mm, elf: handle vm_brk error
[ecc2bc8ac03884266cf73f8a2a42b911465b2fbc]
mm: do not bug_on on incorrect length in __mm_populate()
[bb177a732c4369bb58a1fe1df8f552b6f0f7db5f]
Mika Westerberg (1):
PCI: pciehp: Clear Presence Detect and Data Link Layer Status Changed on resume
[13c65840feab8109194f9490c9870587173cb29d]
Mike Marciniszyn (1):
IB/qib: Fix DMA api warning with debug kernel
[0252f73334f9ef68868e4684200bea3565a4fcee]
Mike Snitzer (1):
dm thin: handle running out of data space vs concurrent discard
[a685557fbbc3122ed11e8ad3fa63a11ebc5de8c3]
Miklos Szeredi (2):
fuse: atomic_o_trunc should truncate pagecache
[df0e91d488276086bc07da2e389986cae0048c37]
fuse: fix control dir setup and teardown
[6becdb601bae2a043d7fb9762c4d48699528ea6e]
Mikulas Patocka (3):
branch-check: fix long->int truncation when profiling branches
[2026d35741f2c3ece73c11eb7e4a15d7c2df9ebe]
dm bufio: drop the lock when doing GFP_NOIO allocation
[41c73a49df31151f4ff868f28fe4f129f113fa2c]
drm/udl: fix display corruption of the last line
[99ec9e77511dea55d81729fc80b6c63a61bfa8e0]Ming_qian (1):
media: uvcvideo: Support realtek's UVC 1.5 device
[f620d1d7afc7db57ab59f35000752840c91f67e7]
Nathan Chancellor (1):
kconfig: Avoid format overflow warning from GCC 8.1
[2ae89c7a82ea9d81a19b4fc2df23bef4b112f24e]
Nathan Sullivan (1):
leds: do not overflow sysfs buffer in led_trigger_show
[3b9b95363c45365d606ad4bbba16acca75fdf6d3]
NeilBrown (1):
w1: support auto-load of w1_bq27000 module.
[4b7e4f8289c1ca60accb6c1baf31984f69bc2771]Nicholas Mc Guire (2):
can: mpc5xxx_can: check of_iomap return before use
[b5c1a23b17e563b656cc9bb76ce5323b997d90e8]
drm: re-enable error handling
[d530b5f1ca0bb66958a2b714bebe40a1248b9c15]
Nico Sneck (1):
usb: quirks: add delay quirks for Corsair Strafe
[bba57eddadda936c94b5dccf73787cb9e159d0a5]
OGAWA Hirofumi (1):
fat: fix memory allocation failure handling of match_strdup()
[35033ab988c396ad7bce3b6d24060c16a9066db8]
Olli Salonen (1):
USB: serial: cp210x: add another USB ID for Qivicon ZigBee stick
[367b160fe4717c14a2a978b6f9ffb75a7762d3ed]Omar Sandoval (3):
Btrfs: don't BUG_ON() in btrfs_truncate_inode_items()
[0552210997badb6a60740a26ff9d976a416510f0]
Btrfs: don't return ino to ino cache if inode item removal fails
[c08db7d8d295a4f3a10faaca376de011afff7950]
Btrfs: reserve space for O_TMPFILE orphan item deletion
[399b0bbf5f680797d3599fa14f16706ffc470145]
Oscar Salvador (1):
fs, elf: make sure to page align bss in load_elf_library
[24962af7e1041b7e50c1bc71d8d10dc678c556b5]
Paul Bolle (1):
eeepc-laptop: simplify parse_arg()
[95369a73a957ad221f1d6b8f11a63a376f38c544]
Paul Burton (1):
MIPS: Fix off-by-one in pci_resource_to_user()
[38c0a74fe06da3be133cae3fb7bde6a9438e698b]
Paulo Alcantara (1):
cifs: Fix infinite loop when using hard mount option
[7ffbe65578b44fafdef577a360eb0583929f7c6e]
Paweł Chmiel (2):
pinctrl: samsung: Correct EINTG banks order
[5cf9a338db94cfd570aa2607bef1b30996f188e3]
regulator: max8998: Fix platform data retrieval.
[c1472737914fe5246a672fef6e85c9455de8473f]
Prabhakar Lad (1):
media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS
[d75cf0144f150272be806b69b4e62553ba07ea1b]
Pranay Kr. Srivastava (1):
ext4: Fix WARN_ON_ONCE in ext4_commit_super()
[4743f83990614af6adb09ea7aa3c37b78c4031ab]
Quinn Tran (1):
scsi: qla2xxx: Fix ISP recovery on unload
[b08abbd9f5996309f021684f9ca74da30dcca36a]
Rasmus Villemoes (1):
net/wireless/brcm80211/brcmfmac: Make return type and name reflect actual semantics
[e843bb199ba58ce5d1364d4c82fcf6975f08eec2]
Ronnie Sahlberg (1):
cifs: store the leaseKey in the fid on SMB2_open
[96164ab2d880c9539989bea68d4790f6fd619b1f]
Ross Lagerwall (4):
xen-netfront: Fix mismatched rtnl_unlock
[cb257783c2927b73614b20f915a91ff78aa6f3e8]
xen-netfront: Fix race between device setup and open
[f599c64fdf7d9c108e8717fb04bc41c680120da4]
xen-netfront: Improve error handling during initialization
[e2e004acc7cbe3c531e752a270a74e95cde3ea48]
xen-netfront: Update features after registering netdev
[45c8184c1bed1ca8a7f02918552063a00b909bf5]
Sabrina Dubroca (1):
ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds
[848235edb5c93ed086700584c8ff64f6d7fc778d]
Sakari Ailus (1):
media: v4l: event: Prevent freeing event subscriptions while accessed
[ad608fbcf166fec809e402d548761768f602702c]
Scott Mayhew (1):
nfsd: restrict rd_maxcount to svc_max_payload in nfsd_encode_readdir
[9c2ece6ef67e9d376f32823086169b489c422ed0]
Sean Young (1):
media: rc: mce_kbd decoder: fix stuck keys
[63039c29f7a4ce8a8bd165173840543c0098d7b0]
Sergey Senozhatsky (1):
tools/lib/subcmd/pager.c: do not alias select() params
[ad343a98e74e85aa91d844310e797f96fee6983b]
Shuah Khan (1):
usbip: stub_rx: fix static checker warning on unnecessary checks
[10c90120930628e8b959bf58d4a0aaef3ae5d945]
Siarhei Liakh (1):
x86: Call fixup_exception() before notify_die() in math_error()
[3ae6295ccb7cf6d344908209701badbbbb503e40]
Silvio Cesare (1):
UBIFS: Fix potential integer overflow in allocation
[353748a359f1821ee934afc579cf04572406b420]
Simon Wunderlich (1):
batman-adv: unify flags access style in tt global add
[ad7e2c466d8b0a7056cd248e1df6bb7296e014f7]
Snild Dolkow (1):
kthread, tracing: Don't expose half-written comm when creating kthreads
[3e536e222f2930534c252c1cc7ae799c725c5ff9]
Song Liu (1):
perf/core: Fix group scheduling with mixed hw and sw events
[a1150c202207cc8501bebc45b63c264f91959260]
Srinivas Kandagatla (2):
ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it
[ff2faf1289c1f81b5b26b9451dd1c2006aac8db8]
of: platform: stop accessing invalid dev in of_platform_device_destroy
[522811e944ed9b36806faa019faec10f9d259cca]
Stefan Agner (1):
mmc: sdhci-esdhc-imx: allow 1.8V modes without 100/200MHz pinctrl states
[92748beac07c471d995fbec642b63572dc01b3dc]
Stefan M Schaeckeler (1):
of: unittest: for strings, account for trailing \\0 in property length field
[3b9cf7905fe3ab35ab437b5072c883e609d3498d]
Stefan Potyra (1):
w1: mxc_w1: Enable clock before calling clk_get_rate() on it
[955bc61328dc0a297fb3baccd84e9d3aee501ed8]
Stefano Brivio (2):
cifs: Fix stack out-of-bounds in smb{2,3}_create_lease_buf()
[729c0c9dd55204f0c9a823ac8a7bfa83d36c7e78]
skbuff: Unconditionally copy pfmemalloc in __skb_clone()
[e78bfb0751d4e312699106ba7efbed2bab1a53ca]
Steffen Maier (7):
scsi: zfcp: fix misleading REC trigger trace where erp_action setup failed
[512857a795cbbda5980efa4cdb3c0b6602330408]
scsi: zfcp: fix missing REC trigger trace for all objects in ERP_FAILED
[8c3d20aada70042a39c6a6625be037c1472ca610]
scsi: zfcp: fix missing REC trigger trace on enqueue without ERP thread
[6a76550841d412330bd86aed3238d1888ba70f0e]
scsi: zfcp: fix missing REC trigger trace on terminate_rport_io early return
[96d9270499471545048ed8a6d7f425a49762283d]
scsi: zfcp: fix missing REC trigger trace on terminate_rport_io for ERP_FAILED
[d70aab55924b44f213fec2b900b095430b33eec6]
scsi: zfcp: fix missing SCSI trace for result of eh_host_reset_handler
[df30781699f53e4fd4c494c6f7dd16e3d5c21d30]
scsi: zfcp: fix missing SCSI trace for retry of abort / scsi_eh TMF
[81979ae63e872ef650a7197f6ce6590059d37172]
Steven Rostedt (3):
tracing: Fix double free of event_trigger_data
[1863c387259b629e4ebfb255495f67cd06aa229b]
tracing: Fix possible double free in event_enable_trigger_func()
[15cc78644d0075e76d59476a4467e7143860f660]
tracing: Quiet gcc warning about maybe unused link variable
[2519c1bbe38d7acacc9aacba303ca6f97482ed53]
Sven Eckelmann (3):
batman-adv: Fix debugfs path for renamed hardif
[36dc621ceca1be3ec885aeade5fdafbbcc452a6d]
batman-adv: Fix debugfs path for renamed softif
[6da7be7d24b2921f8215473ba7552796dff05fe1]
cfg80211: initialize sinfo in cfg80211_get_station
[3c12d0486856b9eb89c2a9ac336713cba90813e3]Tadeusz Struk (1):
tpm: fix race condition in tpm_common_write()
[3ab2011ea368ec3433ad49e1b9e1c7b70d2e65df]
Takashi Iwai (5):
ALSA: core: Assure control device to be registered at last
[dc82e52492f684dcd5ed9e4773e72dbf2203d75e]
ALSA: hda/conexant - Add fixup for HP Z2 G4 workstation
[f16041df4c360eccacfe90f96673b37829e4c959]
ALSA: hda/realtek - Add a quirk for FSC ESPRIMO U9210
[275ec0cb946cb75ac8977f662e608fce92f8b8a8]
ALSA: timer: Fix UBSAN warning at SNDRV_TIMER_IOCTL_NEXT_DEVICE ioctl
[b41f794f284966fd6ec634111e3b40d241389f96]
xen-netfront: Use static attribute groups for sysfs entries
[27b917e54bed7156c2b0249969ace34a5f585626]
Takashi Sakamoto (1):
ALSA: hda/ca0132: fix build failure when a local macro is defined
[8e142e9e628975b0dddd05cf1b095331dff6e2de]
Tetsuo Handa (4):
driver core: Don't ignore class_dir_create_and_add() failure.
[84d0c27d6233a9ba0578b20f5a09701eb66cee42]
fuse: don't keep dead fuse_conn at fuse_fill_super().
[543b8f8662fe6d21f19958b666ab0051af9db21a]
n_tty: Access echo_* variables carefully.
[ebec3f8f5271139df618ebdf8427e24ba102ba94]
n_tty: Fix stall at n_tty_receive_char_special().
[3d63b7e4ae0dc5e02d28ddd2fa1f945defc68d81]
Thadeu Lima de Souza Cascardo (1):
fs/binfmt_misc.c: do not allow offset overflow
[5cc41e099504b77014358b58567c5ea6293dd220]
Theodore Ts'o (7):
ext4: add more mount time checks of the superblock
[bfe0a5f47ada40d7984de67e59a7d3390b9b9ecc]
ext4: bubble errors from ext4_find_inline_data_nolock() up to ext4_iget()
[eb9b5f01c33adebc31cbc236c02695f605b0e417]
ext4: check for allocation block validity with block group locked
[8d5a803c6a6ce4ec258e31f76059ea5153ba46ef]
ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()
[9e92f48c34eb2b9af9d12f892e2fe1fce5e8ce35]
ext4: fix inline data updates with checksums enabled
[362eca70b53389bddf3143fe20f53dcce2cfdf61]
ext4: include the illegal physical block in the bad map ext4_error msg
[bdbd6ce01a70f02e9373a584d0ae9538dcf0a121]
random: mix rdrand with entropy sent in from userspace
[81e69df38e2911b642ec121dec319fad2a4782f3]
Thomas Richter (2):
perf: fix invalid bit in diagnostic entry
[3c0a83b14ea71fef5ccc93a3bd2de5f892be3194]
s390/cpum_sf: Add data entry sizes to sampling trailer entry
[77715b7ddb446bd39a06f3376e85f4bb95b29bb8]
Tobias Jordan (1):
spi: pxa2xx: check clk_prepare_enable() return value
[62bbc864d1946c715063bd481bff3641fd1324e2]
Tokunori Ikegami (5):
MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum
[2a027b47dba6b77ab8c8e47b589ae9bbc5ac6175]
mtd: cfi_cmdset_0002: Change definition naming to retry write operation
[85a82e28b023de9b259a86824afbd6ba07bd6475]
mtd: cfi_cmdset_0002: Change erase functions to check chip good only
[79ca484b613041ca223f74b34608bb6f5221724b]
mtd: cfi_cmdset_0002: Change erase functions to retry for error
[45f75b8a919a4255f52df454f1ffdee0e42443b2]
mtd: cfi_cmdset_0002: Change write buffer to check correct value
[dfeae1073583dc35c33b32150e18b7048bbb37e6]
Tom Lendacky (1):
x86/bugs: Fix the AMD SSBD usage of the SPEC_CTRL MSR
[612bc3b3d4be749f73a513a17d9b3ee1330d3487]
Tomasz Kramkowski (2):
HID: clamp input to logical range if no null state
[c3883fe06488a483658ba5d849b70e49bee15e7c]
HID: usbhid: add quirk for innomedia INNEX GENESIS/ATARI adapter
[9547837bdccb4af127528b36a73377150658b4ac]
Tommi Rantala (1):
xfrm: fix missing dst_release() after policy blocking lbcast and multicast
[8cc88773855f988d6a3bbf102bbd9dd9c828eb81]
Tushar Behera (1):
usb: misc: usb3503: Update error code in print message
[ec5734c41bee2ee7c938a8f34853d31cada7e67a]
Ulrik De Bie (1):
Input: elantech - report the middle button of the touchpad
[f386474e12a560e005ec7899e78f51f6bdc3cf41]
Valtteri Heikkilä (1):
HID: reject input outside logical range only if null state is set
[3f3752705dbd50b66b66ad7b4d54fe33d2f746ed]
Ville Syrjälä (1):
x86/apm: Don't access __preempt_count with zeroed fs
[6f6060a5c9cc76fdbc22748264e6aa3779ec2427]
Vineet Gupta (1):
ARC: mm: allow mprotect to make stack mappings executable
[93312b6da4df31e4102ce5420e6217135a16c7ea]
Vitaly Kuznetsov (1):
xen-netfront: avoid crashing on resume after a failure in talk_to_netback()
[d86b5672b1adb98b4cdd6fbf0224bbfb03db6e2e]
Vladimir Zapolskiy (1):
sh_eth: fix invalid context bug while changing link options by ethtool
[5cb3f52a11e18628fc4bee76dd14b1f0b76349de]
Vlastimil Babka (1):
mm, page_alloc: do not break __GFP_THISNODE by zonelist reset
[7810e6781e0fcbca78b91cf65053f895bf59e85f]
Wanpeng Li (1):
KVM: x86: fix escape of guest dr6 to the host
[efdab992813fb2ed825745625b83c05032e9cda2]
Willem de Bruijn (1):
packet: refine ring v3 block size test to hold one frame
[4576cd469d980317c4edd9173f8b694aa71ea3a3]
Xunlei Pang (1):
sched/fair: Fix bandwidth timer clock drift condition
[512ac999d2755d2b7109e996a76b6fb8b888631d]
Yoshihiro Shimoda (2):
usb: gadget: function: printer: avoid spinlock recursion
[9ada8c582088d32bd5c071c17213bc6edf37443a]
usb: gadget: function: printer: avoid wrong list handling in printer_write()
[4a014a7339f441b0851ce012f469c0fadac61c81]
YueHaibing (1):
net: caif: Add a missing rcu_read_unlock() in caif_flow_cb
[64119e05f7b31e83e2555f6782e6cdc8f81c63f4]
Yuiko Oshino (1):
smsc75xx: Add workaround for gigabit link up hardware errata.
[d461e3da905332189aad546b2ad9adbe6071c7cc]
Zheng Yan (2):
ceph: fix llistxattr on symlink
[0abb43dcacb52145aa265f82c914375d59dfe2da]
ceph: use lookup request to revalidate dentry
[200fd27c8fa2ba8bb4529033967b69a7cbfa2c2e]
Zhong Jiang (1):
sched/topology: Make local variables static
[ace8031099f91480799b5929b4cccf2dcacc5136]
Documentation/filesystems/proc.txt | 31 +- Makefile | 4 +- arch/arc/include/asm/page.h | 2 +- arch/arc/include/asm/pgtable.h | 2 +- arch/arm/boot/dts/da850.dtsi | 6 +- arch/arm/include/asm/kgdb.h | 2 +- arch/arm64/include/asm/barrier.h | 20 ++ arch/arm64/include/uapi/asm/kvm.h | 2 +- arch/m68k/include/asm/delay.h | 11 +- arch/m68k/mm/kmap.c | 3 +- arch/mips/bcm47xx/setup.c | 6 + arch/mips/include/asm/asmmacro.h | 11 + arch/mips/include/asm/compiler.h | 6 + arch/mips/include/asm/io.h | 2 + arch/mips/include/asm/mipsregs.h | 3 + arch/mips/include/asm/pci.h | 2 +- arch/powerpc/Makefile | 1 + arch/powerpc/kernel/entry_64.S | 1 + arch/powerpc/kernel/fadump.c | 3 + arch/powerpc/kernel/hw_breakpoint.c | 4 +- arch/powerpc/kernel/ptrace.c | 1 + arch/powerpc/lib/feature-fixups-test.S | 4 +- arch/powerpc/lib/feature-fixups.c | 180 +++++------ arch/s390/include/asm/cpu_mf.h | 6 +- arch/x86/include/asm/apm.h | 6 - arch/x86/include/asm/barrier.h | 4 +- arch/x86/include/asm/cpufeature.h | 8 +- arch/x86/include/uapi/asm/msr-index.h | 4 +- arch/x86/kernel/apic/apic.c | 3 +- arch/x86/kernel/apm_32.c | 5 + arch/x86/kernel/cpu/bugs.c | 17 +- arch/x86/kernel/cpu/common.c | 13 +- arch/x86/kernel/cpu/mcheck/mce.c | 21 +- arch/x86/kernel/traps.c | 14 +- arch/x86/kvm/cpuid.c | 10 +- arch/x86/kvm/cpuid.h | 2 +- arch/x86/kvm/svm.c | 2 +- arch/x86/kvm/x86.c | 6 + arch/xtensa/kernel/traps.c | 2 +- block/blk-mq-tag.c | 42 ++- crypto/asymmetric_keys/x509_cert_parser.c | 9 + drivers/acpi/acpi_lpss.c | 1 + drivers/ata/ahci.c | 59 ++++ drivers/ata/libata-core.c | 6 +- drivers/ata/libata-zpodd.c | 4 +- drivers/base/core.c | 14 +- drivers/base/power/wakeup.c | 1 - drivers/char/ipmi/ipmi_bt_sm.c | 3 +- drivers/char/random.c | 10 +- drivers/char/tpm/tpm-dev.c | 41 ++- drivers/clk/clk-si5351.c | 10 +- drivers/clk/qcom/clk-rcg2.c | 1 + drivers/crypto/padlock-aes.c | 8 +- drivers/dma/k3dma.c | 2 +- drivers/gpu/drm/drm_context.c | 2 +- drivers/gpu/drm/nouveau/nouveau_drm.c | 7 - drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +- drivers/gpu/drm/udl/udl_fb.c | 5 +- drivers/gpu/drm/udl/udl_transfer.c | 11 +- drivers/hid/hid-ids.h | 3 + drivers/hid/hid-input.c | 20 +- drivers/hid/usbhid/hid-quirks.c | 1 + drivers/hid/usbhid/hiddev.c | 11 + drivers/infiniband/core/uverbs_cmd.c | 27 +- drivers/infiniband/hw/mlx4/mad.c | 1 - drivers/infiniband/hw/mlx5/srq.c | 18 +- drivers/infiniband/hw/qib/qib.h | 3 +- drivers/infiniband/hw/qib/qib_file_ops.c | 10 +- drivers/infiniband/hw/qib/qib_user_pages.c | 20 +- drivers/infiniband/ulp/ipoib/ipoib.h | 2 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 33 +- drivers/infiniband/ulp/isert/ib_isert.c | 27 +- drivers/input/mouse/elantech.c | 28 +- drivers/input/serio/i8042-x86ia64io.h | 14 + drivers/iommu/dmar.c | 8 +- drivers/leds/led-triggers.c | 12 +- drivers/md/dm-bufio.c | 15 +- drivers/md/dm-thin.c | 11 +- drivers/media/dvb-core/dvb_frontend.c | 23 +- drivers/media/dvb-frontends/drxd_hard.c | 3 +- drivers/media/dvb-frontends/drxk_hard.c | 3 +- drivers/media/i2c/smiapp/smiapp-core.c | 11 +- drivers/media/platform/davinci/ccdc_hw_device.h | 10 - drivers/media/platform/davinci/dm355_ccdc.c | 92 +----- drivers/media/platform/davinci/dm644x_ccdc.c | 151 +-------- drivers/media/platform/davinci/vpfe_capture.c | 75 ----- drivers/media/platform/omap3isp/isp.c | 7 - drivers/media/rc/imon.c | 2 +- drivers/media/rc/ir-mce_kbd-decoder.c | 2 + drivers/media/usb/cx231xx/cx231xx-cards.c | 3 + drivers/media/usb/uvc/uvc_video.c | 24 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- drivers/media/v4l2-core/v4l2-event.c | 38 +-- drivers/media/v4l2-core/v4l2-fh.c | 2 + drivers/mfd/tps65911-comparator.c | 17 +- drivers/misc/ibmasm/ibmasmfs.c | 27 +- drivers/mmc/host/sdhci-esdhc-imx.c | 18 +- drivers/mtd/chips/cfi_cmdset_0002.c | 51 ++-- drivers/mtd/nand/mxc_nand.c | 5 +- drivers/mtd/nand/omap2.c | 340 +++++++-------------- drivers/net/can/cc770/cc770_platform.c | 2 +- drivers/net/can/dev.c | 78 +++++ drivers/net/can/grcan.c | 2 +- drivers/net/can/mscan/mpc5xxx_can.c | 7 +- drivers/net/can/sja1000/sja1000_platform.c | 2 +- drivers/net/can/usb/ems_usb.c | 1 + drivers/net/can/xilinx_can.c | 323 ++++++++++++++++---- drivers/net/ethernet/8390/ax88796.c | 1 - drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 1 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 2 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 2 + .../net/ethernet/mellanox/mlx4/resource_tracker.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 8 +- drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 2 + drivers/net/ethernet/renesas/sh_eth.c | 47 +-- drivers/net/ethernet/ti/davinci_emac.c | 4 +- drivers/net/usb/smsc75xx.c | 62 ++++ drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 2 +- .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 7 +- .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | 2 +- drivers/net/wireless/mwifiex/pcie.c | 3 +- drivers/net/wireless/p54/fwio.c | 2 +- drivers/net/wireless/rtlwifi/rtl8723be/hw.c | 2 +- drivers/net/xen-netfront.c | 295 +++++++----------- drivers/of/platform.c | 4 +- drivers/of/selftest.c | 8 +- drivers/pci/hotplug/ibmphp_core.c | 2 +- drivers/pci/hotplug/pciehp.h | 2 +- drivers/pci/hotplug/pciehp_core.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 13 +- drivers/pci/hotplug/shpchp_ctrl.c | 8 +- drivers/pinctrl/pinctrl-exynos.c | 2 +- drivers/platform/x86/eeepc-laptop.c | 36 +-- drivers/pwm/pwm-lpss.c | 24 ++ drivers/regulator/max8998.c | 3 +- drivers/s390/net/qeth_core.h | 11 + drivers/s390/net/qeth_core_main.c | 22 +- drivers/s390/scsi/zfcp_dbf.c | 39 +++ drivers/s390/scsi/zfcp_erp.c | 123 ++++++-- drivers/s390/scsi/zfcp_ext.h | 5 + drivers/s390/scsi/zfcp_scsi.c | 18 +- drivers/scsi/fnic/fnic_fcs.c | 3 +- drivers/scsi/qla2xxx/qla_init.c | 10 +- drivers/scsi/qla2xxx/qla_os.c | 5 +- drivers/scsi/qlogicpti.c | 6 +- drivers/scsi/sg.c | 42 ++- drivers/scsi/sr.c | 33 +- drivers/spi/spi-pxa2xx.c | 18 +- drivers/staging/android/ion/ion.c | 5 +- drivers/staging/android/ion/ion_heap.c | 2 +- drivers/staging/iio/meter/ade7854-i2c.c | 26 +- drivers/staging/iio/meter/ade7854.c | 10 +- .../staging/iio/trigger/iio-trig-periodic-rtc.c | 6 +- .../staging/rtl8192ee/btcoexist/halbtc8821a2ant.c | 4 +- drivers/staging/rtl8192ee/rtl8192ee/hw.c | 14 +- drivers/staging/usbip/stub_rx.c | 11 +- drivers/staging/vt6656/dpc.c | 4 +- drivers/staging/vt6656/main_usb.c | 23 +- drivers/target/target_core_pr.c | 22 +- drivers/tty/n_tty.c | 55 ++-- drivers/tty/serial/amba-pl011.c | 15 + drivers/tty/vt/vt.c | 76 ++--- drivers/usb/class/cdc-acm.c | 6 + drivers/usb/core/hub.c | 12 +- drivers/usb/core/quirks.c | 4 + drivers/usb/gadget/f_uac2.c | 8 +- drivers/usb/gadget/printer.c | 13 +- drivers/usb/host/xhci-mem.c | 2 +- drivers/usb/misc/usb3503.c | 3 +- drivers/usb/serial/ch341.c | 2 +- drivers/usb/serial/cp210x.c | 15 + drivers/usb/serial/keyspan_pda.c | 4 +- drivers/usb/serial/mos7840.c | 3 + drivers/vhost/net.c | 3 +- drivers/video/backlight/as3711_bl.c | 45 ++- drivers/video/backlight/max8925_bl.c | 4 +- drivers/video/backlight/tps65217_bl.c | 4 +- drivers/video/fbdev/omap/lcd_ams_delta.c | 4 + drivers/video/fbdev/omap/lcd_h3.c | 4 + drivers/video/fbdev/omap/lcd_htcherald.c | 4 + drivers/video/fbdev/omap/lcd_inn1510.c | 4 + drivers/video/fbdev/omap/lcd_inn1610.c | 4 + drivers/video/fbdev/omap/lcd_osk.c | 4 + drivers/video/fbdev/omap/lcd_palmte.c | 4 + drivers/video/fbdev/omap/lcd_palmtt.c | 4 + drivers/video/fbdev/omap/lcd_palmz71.c | 4 + drivers/virtio/virtio_balloon.c | 2 + drivers/w1/masters/mxc_w1.c | 20 +- drivers/w1/slaves/w1_bq27000.c | 4 +- drivers/w1/w1.c | 2 +- drivers/w1/w1_family.h | 1 + drivers/xen/events/events_base.c | 2 - fs/binfmt_elf.c | 46 +-- fs/binfmt_misc.c | 12 +- fs/btrfs/inode.c | 33 +- fs/cachefiles/bind.c | 3 +- fs/cachefiles/namei.c | 3 +- fs/cachefiles/rdwr.c | 17 +- fs/ceph/dir.c | 39 +++ fs/ceph/inode.c | 1 + fs/ceph/super.h | 9 + fs/ceph/xattr.c | 10 +- fs/cifs/cifsglob.h | 5 +- fs/cifs/cifsproto.h | 1 + fs/cifs/cifssmb.c | 10 +- fs/cifs/connect.c | 7 +- fs/cifs/smb1ops.c | 1 + fs/cifs/smb2file.c | 11 +- fs/cifs/smb2ops.c | 13 +- fs/cifs/smb2pdu.c | 33 +- fs/cifs/smb2pdu.h | 6 +- fs/cifs/smb2transport.c | 1 + fs/cifs/transport.c | 18 +- fs/dcache.c | 85 +++--- fs/ext4/balloc.c | 3 + fs/ext4/file.c | 90 +++--- fs/ext4/ialloc.c | 5 +- fs/ext4/inline.c | 18 +- fs/ext4/inode.c | 70 +++-- fs/ext4/resize.c | 2 +- fs/ext4/super.c | 75 +++-- fs/ext4/xattr.c | 31 +- fs/fat/inode.c | 20 +- fs/fscache/cache.c | 2 +- fs/fscache/cookie.c | 7 +- fs/fscache/object.c | 1 + fs/fscache/operation.c | 6 +- fs/fuse/control.c | 13 +- fs/fuse/dir.c | 13 +- fs/fuse/inode.c | 1 + fs/namespace.c | 27 +- fs/nfs/idmap.c | 5 +- fs/nfsd/auth.c | 2 +- fs/nfsd/nfs4xdr.c | 5 +- fs/proc/task_mmu.c | 74 ++--- fs/proc/task_nommu.c | 32 +- fs/reiserfs/prints.c | 141 +++++---- fs/squashfs/block.c | 2 + fs/squashfs/cache.c | 3 + fs/squashfs/file.c | 8 +- fs/squashfs/fragment.c | 4 +- fs/squashfs/squashfs_fs.h | 6 + fs/ubifs/journal.c | 5 +- fs/udf/directory.c | 3 + include/linux/blkdev.h | 4 +- include/linux/can/dev.h | 3 + include/linux/compiler.h | 2 +- include/linux/cred.h | 9 + include/linux/dcache.h | 17 -- include/linux/fs.h | 5 + include/linux/libata.h | 1 + include/linux/mfd/as3711.h | 4 +- include/linux/mm.h | 3 +- include/linux/perf_event.h | 8 + include/linux/ring_buffer.h | 1 + include/linux/string.h | 2 +- include/media/davinci/dm644x_ccdc.h | 12 - include/media/davinci/vpfe_capture.h | 10 - include/media/v4l2-fh.h | 1 + include/net/af_vsock.h | 4 +- include/net/net_namespace.h | 1 + include/net/netns/ipv6.h | 1 - include/sound/core.h | 2 +- include/uapi/linux/can/error.h | 1 + include/uapi/linux/kexec.h | 6 - include/uapi/linux/vt.h | 1 - kernel/events/core.c | 21 +- kernel/gcov/base.c | 12 + kernel/gcov/gcc_4_7.c | 6 +- kernel/kthread.c | 8 +- kernel/power/wakelock.c | 1 + kernel/sched/core.c | 2 +- kernel/sched/fair.c | 14 +- kernel/sched/sched.h | 2 + kernel/time.c | 6 +- kernel/time/tick-sched.c | 2 +- kernel/trace/ring_buffer.c | 16 + kernel/trace/trace.c | 6 + kernel/trace/trace_events_trigger.c | 18 +- kernel/trace/trace_functions_graph.c | 7 +- kernel/trace/trace_kprobe.c | 15 +- mm/hugetlb.c | 1 + mm/ksm.c | 16 +- mm/mlock.c | 2 - mm/mmap.c | 13 +- mm/page_alloc.c | 3 +- mm/rmap.c | 4 + mm/swapfile.c | 2 +- mm/util.c | 34 +-- net/batman-adv/Makefile | 2 +- net/batman-adv/debugfs.c | 48 ++- net/batman-adv/debugfs.h | 45 +++ net/batman-adv/hard-interface.c | 37 ++- net/batman-adv/translation-table.c | 7 +- net/caif/caif_dev.c | 4 +- net/core/rtnetlink.c | 8 +- net/core/skbuff.c | 1 + net/dccp/ccids/ccid2.c | 6 +- net/dns_resolver/dns_key.c | 28 +- net/ipv4/fib_frontend.c | 5 +- net/ipv4/fib_semantics.c | 2 + net/ipv4/igmp.c | 3 +- net/ipv6/ip6mr.c | 3 +- net/ipv6/mcast.c | 12 +- net/ipv6/netfilter/nf_conntrack_reasm.c | 6 +- net/l2tp/l2tp_netlink.c | 6 + net/l2tp/l2tp_ppp.c | 76 +++-- net/netfilter/nf_log.c | 9 +- net/netfilter/nfnetlink_queue_core.c | 3 + net/netlink/af_netlink.c | 5 + net/packet/af_packet.c | 10 +- net/sched/act_simple.c | 14 +- net/sctp/outqueue.c | 48 ++- net/socket.c | 2 + net/vmw_vsock/af_vsock.c | 15 +- net/vmw_vsock/vmci_transport.c | 3 +- net/wireless/util.c | 2 + net/xfrm/xfrm_policy.c | 3 + net/xfrm/xfrm_user.c | 18 +- scripts/kconfig/confdata.c | 2 +- scripts/mod/devicetable-offsets.c | 3 + scripts/mod/file2alias.c | 11 + sound/core/device.c | 9 + sound/core/timer.c | 2 +- sound/isa/msnd/msnd_pinnacle_mixer.c | 3 +- sound/pci/hda/hda_controller.c | 4 +- sound/pci/hda/patch_ca0132.c | 8 +- sound/pci/hda/patch_conexant.c | 1 + sound/pci/hda/patch_realtek.c | 1 + sound/soc/cirrus/edb93xx.c | 2 +- sound/soc/cirrus/ep93xx-i2s.c | 26 +- sound/soc/cirrus/snappercl15.c | 2 +- sound/soc/soc-dapm.c | 2 + tools/arch/x86/include/asm/unistd_32.h | 9 + tools/arch/x86/include/asm/unistd_64.h | 9 + tools/include/linux/compiler.h | 9 + tools/perf/Makefile.perf | 2 - tools/perf/builtin-script.c | 82 +++-- tools/perf/builtin-top.c | 2 +- tools/perf/builtin-trace.c | 5 +- tools/perf/config/Makefile | 1 + tools/perf/perf-sys.h | 18 -- tools/perf/tests/attr.c | 4 +- tools/perf/tests/pmu.c | 2 +- tools/perf/util/cgroup.c | 2 +- tools/perf/util/event.c | 12 +- tools/perf/util/include/asm/unistd_32.h | 1 - tools/perf/util/include/asm/unistd_64.h | 1 - tools/perf/util/pager.c | 5 +- tools/perf/util/parse-events.c | 64 ++-- tools/perf/util/pmu.c | 2 +- tools/perf/util/setup.py | 1 + tools/perf/util/thread.c | 2 +- tools/perf/util/thread_map.c | 10 +- tools/perf/util/util.h | 2 + tools/power/x86/turbostat/turbostat.c | 4 +- 357 files changed, 3362 insertions(+), 2348 deletions(-)
Signature · 2 lines
Ben Hutchings Reality is just a crutch for people who can't handle science fiction.
PATCH 1/366 arm64: add missing data types in smp_load_acquire/smp_store_release
3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andre Przywara <[email protected]>
commit 878a84d5a8a18a4ab241d40cebb791d6aedf5605 upstream.
Commit 8053871d0f7f ("smp: Fix smp_call_function_single_async() locking") introduced a call to smp_load_acquire() with a u16 argument, but we only cared about u32 and u64 types in that function so far. This resulted in a compiler warning fortunately, pointing at an uninitialized use. Due to the implementation structure the compiler misses that bug in the smp_store_release(), though.
Add the u16 and u8 variants using ldarh/stlrh and ldarb/stlrb, respectively. Together with the compiletime_assert_atomic_type() check this should cover all cases now.
--- arch/arm64/include/asm/barrier.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm64/include/asm/barrier.h +16 -0
@@ -64,6 +64,14 @@ do { \ { .__val = (__force typeof(*p)) (v) }; \compiletime_assert_atomic_type (*p); \switch (sizeof (*p)) { \ +case 1 : \ + asmvolatile ("stlrb %w1, %0" \ + :"=Q" (*p) :"r" (v) :"memory" ); \ +break ; \ +case 2 : \ + asmvolatile ("stlrh %w1, %0" \ + :"=Q" (*p) :"r" (v) :"memory" ); \ +break ; \case 4 : \ asmvolatile ("stlr %w1, %0" \ : "=Q" (*p) \
@@ -84,6 +92,14 @@ do { \ typeof(*p) ___p1; \compiletime_assert_atomic_type (*p); \switch (sizeof (*p)) { \ +case 1 : \ + asmvolatile ("ldarb %w0, %1" \ + :"=r" (___p1) :"Q" (*p) :"memory" ); \ +break ; \ +case 2 : \ + asmvolatile ("ldarh %w0, %1" \ + :"=r" (___p1) :"Q" (*p) :"memory" ); \ +break ; \case 4 : \ asmvolatile ("ldar %w0, %1" \ :"=r" (___p1) :"Q" (*p) :"memory" ); \
PATCH 2/366 arm64: ensure extension of smp_store_release value
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 994870bead4ab19087a79492400a5478e2906196 upstream.
When an inline assembly operand's type is narrower than the register it is allocated to, the least significant bits of the register (up to the operand type's width) are valid, and any other bits are permitted to contain any arbitrary value. This aligns with the AAPCS64 parameter passing rules.
Our __smp_store_release() implementation does not account for this, and implicitly assumes that operands have been zero-extended to the width of the type being stored to. Thus, we may store unknown values to memory when the value type is narrower than the pointer type (e.g. when storing a char to a long).
This patch fixes the issue by casting the value operand to the same width as the pointer operand in all cases, which ensures that the value is zero-extended as we expect. We use the same union trickery as __smp_load_acquire and {READ,WRITE}_ONCE() to avoid GCC complaining that pointers are potentially cast to narrower width integers in unreachable paths.
A whitespace issue at the top of __smp_store_release() is also corrected.
No changes are necessary for __smp_load_acquire(). Load instructions implicitly clear any upper bits of the register, and the compiler will only consider the least significant bits of the register as valid regardless.
[bwh: The same upstream commit was already backported to 3.16, but we
didn't have the 1-byte and 2-byte cases then so I dropped that part. Now that we do, pick up that part again.]
--- arch/arm64/include/asm/barrier.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
arch/arm64/include/asm/barrier.h +6 -2
@@ -66,11 +66,15 @@ do { \switch (sizeof (*p)) { \case 1 : \ asmvolatile ("stlrb %w1, %0" \ - :"=Q" (*p) :"r" (v) :"memory" ); \ + :"=Q" (*p) \ + :"r" (*(__u8 *)__u.__c) \ + :"memory" ); \break ; \case 2 : \ asmvolatile ("stlrh %w1, %0" \ - :"=Q" (*p) :"r" (v) :"memory" ); \ + :"=Q" (*p) \ + :"r" (*(__u16 *)__u.__c) \ + :"memory" ); \break ; \case 4 : \ asm volatile ("stlr %w1, %0" \
PATCH 3/366 staging: vt6656: Fix misleading indentation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Fix the compiler warnings:
drivers/staging/vt6656/dpc.c:712:5: warning: this 'if' clause does not guard... drivers/staging/vt6656/main_usb.c:1101:7: warning: this 'if' clause does not guard...
by reducing indentation of the following statements in RXbBulkInProcessData() and reformatting the kstrstr() function to kernel coding style.
Both functions have been removed in a later version, so there is no corresponding upstream commit.
---
drivers/staging/vt6656/main_usb.c +11 -10
@@ -1092,17 +1092,18 @@ out:/* find out the start position of str2 from str1 */ static unsigned char *kstrstr (const unsigned char *str1, -const unsigned char *str2) { -int str1_len =strlen (str1); -int str2_len =strlen (str2); +const unsigned char *str2) +{ +int str1_len =strlen (str1); +int str2_len =strlen (str2); -while (str1_len >= str2_len) { - str1_len--; -if (memcmp (str1,str2,str2_len)==0 ) -return (unsigned char *) str1; - str1++; - } -return NULL ; +while (str1_len >= str2_len) { + str1_len--; +if (memcmp (str1, str2, str2_len) ==0 ) +return (unsigned char *)str1; + str1++; + } +return NULL ; } static int Config_FileGetParameter(unsigned char *string,
drivers/staging/vt6656/dpc.c +2 -2
@@ -712,8 +712,8 @@ int RXbBulkInProcessData(struct vnt_privif (FrameSize <12 )return false; - skb->data += cbHeaderOffset; - skb->tail += cbHeaderOffset; + skb->data += cbHeaderOffset; + skb->tail += cbHeaderOffset;skb_put (skb, FrameSize); skb->protocol=eth_type_trans (skb, skb->dev); skb->ip_summed=CHECKSUM_NONE ;
PATCH 4/366 bcmgenet: Delete unused variable
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
I needed to add a "kdev" variable to bcmgenet_desc_rx() when backporting commit 8c4799ac7996 "net: bcmgenet: Utilize correct struct device for all DMA operations", but when I later backported commit d6707bec5986 "net: bcmgenet: rewrite bcmgenet_rx_refill()" it became unused. Delete it.
There is no corresponding upstream commit because these commits were applied in the opposite order and this variable was never introduced.
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c +0 -1
@@ -1344,7 +1344,6 @@ static unsigned int bcmgenet_desc_rx(str unsigned int budget) {struct net_device *dev = priv->dev; -struct device *kdev = &priv->pdev->dev;struct enet_cb *cb;struct sk_buff *skb;u32 dma_length_status;
PATCH 5/366 staging: rtl8192ee: Fix misleading indentation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Fix the compiler warnings:
drivers/staging/rtl8192ee/rtl8192ee/hw.c:524:4: warning: this 'if' clause does not guard... drivers/staging/rtl8192ee/rtl8192ee/hw.c:529:5: warning: this 'if' clause does not guard... drivers/staging/rtl8192ee/btcoexist/halbtc8821a2ant.c:2338:2: warning: this 'else' clause does not guard...
by changing the indentation of these statements to match the upstream code in drivers/net/wireless/realtek/rtlwifi/rtl8192ee/hw.c and drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c.
These were fixed upstream when the driver was removed from staging and re-added with some clean-ups.
---
drivers/staging/rtl8192ee/rtl8192ee/hw.c +7 -7
@@ -523,17 +523,17 @@ void rtl92ee_set_hw_reg(struct ieee80211 fac = (1 << (fac +2 ));if (fac >0xf ) fac =0xf ; -for (i =0 ; i <4 ; i++) { +for (i =0 ; i <4 ; i++) {if ((reg[i] &0xf0 ) > (fac <<4 )) reg[i] = (reg[i] &0x0f ) | (fac <<4 );if ((reg[i] &0x0f ) > fac) reg[i] = (reg[i] &0xf0 ) | fac; -rtl_write_byte (rtlpriv, - (REG_AGGLEN_LMT + i), - reg[i]); - } -RT_TRACE (COMP_MLME ,DBG_LOUD , - ("Set HW_VAR_AMPDU_FACTOR:%#x\n" , fac)); +rtl_write_byte (rtlpriv, + (REG_AGGLEN_LMT + i), + reg[i]); + } +RT_TRACE (COMP_MLME ,DBG_LOUD , + ("Set HW_VAR_AMPDU_FACTOR:%#x\n" , fac)); }break ; }case HW_VAR_AC_PARAM :{
drivers/staging/rtl8192ee/btcoexist/halbtc8821a2ant.c +2 -2
@@ -2339,8 +2339,8 @@ static void halbtc8821a2ant_action_pan_ehalbtc8821a2ant_coex_table (btcoexist,NORMAL_EXEC ,0x55ff55ff ,0x5aff5aff ,0xffff ,0x3 ); -if (BTC_WIFI_BW_HT40 == wifi_bw) { -/* fw mechanism */ +if (BTC_WIFI_BW_HT40 == wifi_bw) { +/* fw mechanism */ if ((bt_rssi_state ==BTC_RSSI_STATE_HIGH ) || (bt_rssi_state ==BTC_RSSI_STATE_STAY_HIGH ))ps21a_tdma (btcoexist,NORMAL_EXEC , true,1 );
PATCH 6/366 fnic: Fix misleading indentation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Fix the compiler warning:
drivers/scsi/fnic/fnic_fcs.c:104:6: warning: this 'else' clause does not guard...
This was done upstream as part of commit 86001f248e94 "fnic: assign FIP_ALL_FCF_MACS to fcoe_all_fcfs".
---
drivers/scsi/fnic/fnic_fcs.c +2 -1
@@ -101,13 +101,14 @@ void fnic_handle_link(struct work_structFNIC_FCS_DBG (KERN_DEBUG , fnic->lport->host,"link up\n" );fcoe_ctlr_link_up (&fnic->ctlr); - }else + }else {/* UP -> UP */ spin_unlock_irqrestore (&fnic->fnic_lock, flags);fnic_fc_trace_set_data ( fnic->lport->host->host_no,FNIC_FC_LE ,"Link Status: UP_UP" ,strlen ("Link Status: UP_UP" )); + } } }else if (fnic->link_status) {/* DOWN -> UP */
PATCH 7/366 drxk_hard: fix bad alignments
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 89fffac802c18caebdf4e91c0785b522c9f6399a upstream.
drivers/media/dvb-frontends/drxk_hard.c:2224:3-22: code aligned with following code on line 2227
--- drivers/media/dvb-frontends/drxk_hard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/drxk_hard.c +2 -1
@@ -2220,12 +2220,13 @@ static int set_agc_rf(struct drxk_state }/* Set TOP, only if IF-AGC is in AUTO mode */ -if (p_if_agc_settings->ctrl_mode ==DRXK_AGC_CTRL_AUTO ) +if (p_if_agc_settings->ctrl_mode ==DRXK_AGC_CTRL_AUTO ) { status =write16 (state,SCU_RAM_AGC_IF_IACCU_HI_TGT_MAX__A , p_agc_cfg->top);if (status <0 ) goto error; + }/* Cut-Off current */ status = write16(state, SCU_RAM_AGC_RF_IACCU_HI_CO__A,
PATCH 8/366 drxd_hard: fix bad alignments
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit cea130021448763b15f4b16af184bbab4be118fb upstream.
As reported by cocinelle:
drivers/media/dvb-frontends/drxd_hard.c:2632:3-51: code aligned with following code on line 2633
--- drivers/media/dvb-frontends/drxd_hard.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/drxd_hard.c +2 -1
@@ -2628,10 +2628,11 @@ static int DRXD_init(struct drxd_state *break ;/* Apply I2c address patch to B1 */ -if (!state->type_A && state->m_HiI2cPatch !=NULL ) +if (!state->type_A && state->m_HiI2cPatch !=NULL ) { status =WriteTable (state, state->m_HiI2cPatch);if (status <0 )break ; + }if (state->type_A) {/* HI firmware patch for UIO readout,
PATCH 9/366 eeepc-laptop: simplify parse_arg()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Bolle <[email protected]>
commit 95369a73a957ad221f1d6b8f11a63a376f38c544 upstream.
parse_arg() has three possible return values:
-EINVAL if sscanf(), in short, fails;
zero if "count" is zero; and
"count" in all other cases
But "count" will never be zero. See, parse_arg() is called by the various store functions. And the callchain of these functions starts with sysfs_kf_write(). And that function checks for a zero "count". So we can stop checking for a zero "count", drop the "count" argument entirely, and transform parse_arg() into a function that returns zero on success or a negative error. That, in turn, allows to make those store functions just return "count" on success. The net effect is that the code becomes a bit easier to understand.
A nice side effect is that this GCC warning is silenced too:
drivers/platform/x86/eeepc-laptop.c: In function ‘store_sys_acpi’:
drivers/platform/x86/eeepc-laptop.c:279:10: warning: ‘value’ may be used uninitialized in this function [-Wmaybe-uninitialized]
int rv, value;
Which is, of course, the reason to have a look at parse_arg().
--- drivers/platform/x86/eeepc-laptop.c | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/platform/x86/eeepc-laptop.c +18 -18
@@ -263,13 +263,11 @@ static int acpi_setter_handle(struct eee/* * Sys helpers */ -static int parse_arg (const char *buf,unsigned long count,int *val) +static int parse_arg (const char *buf,int *val) { -if (!count) -return 0 ;if (sscanf (buf,"%i" , val) !=1 )return -EINVAL ; -return count; +return 0 ; } static ssize_t store_sys_acpi(struct device *dev, int cm,
@@ -278,12 +276,13 @@ static ssize_t store_sys_acpi(struct devstruct eeepc_laptop *eeepc =dev_get_drvdata (dev);int rv, value; - rv =parse_arg (buf, count, &value); -if (rv >0 ) - value =set_acpi (eeepc, cm, value); -if (value <0 ) + rv =parse_arg (buf, &value); +if (rv <0 ) +return rv; + rv =set_acpi (eeepc, cm, value); +if (rv <0 )return -EIO ; -return rv; +return count; }static ssize_t show_sys_acpi (struct device *dev,int cm,char *buf)
@@ -377,13 +376,13 @@ static ssize_t store_cpufv(struct devicereturn -EPERM ;if (get_cpufv (eeepc, &c))return -ENODEV ; - rv =parse_arg (buf, count, &value); + rv =parse_arg (buf, &value);if (rv <0 )return rv; -if (!rv || value <0 || value >= c.num) +if (value <0 || value >= c.num)return -EINVAL ;set_acpi (eeepc,CM_ASL_CPUFV , value); -return rv; +return count; } static ssize_t show_cpufv_disabled(struct device *dev,
@@ -402,7 +401,7 @@ static ssize_t store_cpufv_disabled(strustruct eeepc_laptop *eeepc =dev_get_drvdata (dev);int rv, value; - rv =parse_arg (buf, count, &value); + rv =parse_arg (buf, &value);if (rv <0 )return rv;
@@ -412,7 +411,7 @@ static ssize_t store_cpufv_disabled(strupr_warn ("cpufv enabled (not officially supported " "on this model)\n" ); eeepc->cpufv_disabled = false; -return rv; +return count;case 1 :return -EPERM ;default :
@@ -1042,10 +1041,11 @@ static ssize_t store_sys_hwmon(void (*se {int rv, value; - rv =parse_arg (buf, count, &value); -if (rv >0 ) -set (value); -return rv; + rv =parse_arg (buf, &value); +if (rv <0 ) +return rv; +set (value); +return count; }static ssize_t show_sys_hwmon (int (*get)(void ),char *buf)
PATCH 10/366 rtl8723be: Fix misleading indentation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
Fix the compiler warning:
drivers/net/wireless/rtlwifi/rtl8723be/hw.c:1132:2: warning: this 'else' clause does not guard...
by reducing indentation of the following statement. This was fixed upstream as part of commit 5c99f04fec93 "rtlwifi: rtl8723be: Update driver to match Realtek release of 06/28/14".
---
drivers/net/wireless/rtlwifi/rtl8723be/hw.c +1 -1
@@ -1132,7 +1132,7 @@ static enum version_8723e _rtl8723be_reaelse version = (enum version_8723e )VERSION_TEST_CHIP_1T1R_8723B ; - rtlphy->rf_type =RF_1T1R ; + rtlphy->rf_type =RF_1T1R ; value8 =rtl_read_byte (rtlpriv,REG_ROM_VERSION );if (value8 >=0x02 )
PATCH 11/366 Revert "mtd: nand: omap2: Fix subpage write"
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
This reverts commit e7e13fa736726e9860a86e5e1ae19ce162e11b71, which was commit 739c64414f01748a36e7d82c8e0611dea94412bd upstream. It doesn't appear to fix a real bug in 3.16, and it results in build breakage and/or compiler warnings depending on the kernel configuration.
--- drivers/mtd/nand/omap2.c | 340 +++++++++++++-------------------------- 1 file changed, 115 insertions(+), 225 deletions(-)
drivers/mtd/nand/omap2.c +115 -225
@@ -1163,174 +1163,130 @@ static u8 bch8_polynomial[] = {0xef, 0x 0x97, 0x79, 0xe5, 0x24, 0xb5};/** -* _omap_calculate_ecc_bch - Generate ECC bytes for one sector +* omap_calculate_ecc_bch - Generate bytes of ECC bytes * @mtd: MTD device structure * @dat: The pointer to data on which ecc is computed * @ecc_code: The ecc_code buffer -* @i: The sector number (for a multi sector page) * -* Support calculating of BCH4/8/16 ECC vectors for one sector -* within a page. Sector number is in @i. +* Support calculating of BCH4/8 ecc vectors for the page */ -static int _omap_calculate_ecc_bch (struct mtd_info *mtd, -const u_char *dat,u_char *ecc_calc,int i) +static int __maybe_unused omap_calculate_ecc_bch (struct mtd_info *mtd, +const u_char *dat,u_char *ecc_calc) { struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, mtd);int eccbytes = info->nand.ecc.bytes;struct gpmc_nand_regs *gpmc_regs = &info->reg;u8 *ecc_code; -unsigned long bch_val1, bch_val2, bch_val3, bch_val4; +unsigned long nsectors, bch_val1, bch_val2, bch_val3, bch_val4;u32 val; -int j; - - ecc_code = ecc_calc; -switch (info->ecc_opt) { -case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW : -case OMAP_ECC_BCH8_CODE_HW : - bch_val1 =readl (gpmc_regs->gpmc_bch_result0[i]); - bch_val2 =readl (gpmc_regs->gpmc_bch_result1[i]); - bch_val3 =readl (gpmc_regs->gpmc_bch_result2[i]); - bch_val4 =readl (gpmc_regs->gpmc_bch_result3[i]); - *ecc_code++ = (bch_val4 &0xFF ); - *ecc_code++ = ((bch_val3 >>24 ) &0xFF ); - *ecc_code++ = ((bch_val3 >>16 ) &0xFF ); - *ecc_code++ = ((bch_val3 >>8 ) &0xFF ); - *ecc_code++ = (bch_val3 &0xFF ); - *ecc_code++ = ((bch_val2 >>24 ) &0xFF ); - *ecc_code++ = ((bch_val2 >>16 ) &0xFF ); - *ecc_code++ = ((bch_val2 >>8 ) &0xFF ); - *ecc_code++ = (bch_val2 &0xFF ); - *ecc_code++ = ((bch_val1 >>24 ) &0xFF ); - *ecc_code++ = ((bch_val1 >>16 ) &0xFF ); - *ecc_code++ = ((bch_val1 >>8 ) &0xFF ); - *ecc_code++ = (bch_val1 &0xFF ); -break ; -case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW : -case OMAP_ECC_BCH4_CODE_HW : - bch_val1 =readl (gpmc_regs->gpmc_bch_result0[i]); - bch_val2 =readl (gpmc_regs->gpmc_bch_result1[i]); - *ecc_code++ = ((bch_val2 >>12 ) &0xFF ); - *ecc_code++ = ((bch_val2 >>4 ) &0xFF ); - *ecc_code++ = ((bch_val2 &0xF ) <<4 ) | - ((bch_val1 >>28 ) &0xF ); - *ecc_code++ = ((bch_val1 >>20 ) &0xFF ); - *ecc_code++ = ((bch_val1 >>12 ) &0xFF ); - *ecc_code++ = ((bch_val1 >>4 ) &0xFF ); - *ecc_code++ = ((bch_val1 &0xF ) <<4 ); -break ; -case OMAP_ECC_BCH16_CODE_HW : - val =readl (gpmc_regs->gpmc_bch_result6[i]); - ecc_code[0 ] = ((val >>8 ) &0xFF ); - ecc_code[1 ] = ((val >>0 ) &0xFF ); - val =readl (gpmc_regs->gpmc_bch_result5[i]); - ecc_code[2 ] = ((val >>24 ) &0xFF ); - ecc_code[3 ] = ((val >>16 ) &0xFF ); - ecc_code[4 ] = ((val >>8 ) &0xFF ); - ecc_code[5 ] = ((val >>0 ) &0xFF ); - val =readl (gpmc_regs->gpmc_bch_result4[i]); - ecc_code[6 ] = ((val >>24 ) &0xFF ); - ecc_code[7 ] = ((val >>16 ) &0xFF ); - ecc_code[8 ] = ((val >>8 ) &0xFF ); - ecc_code[9 ] = ((val >>0 ) &0xFF ); - val =readl (gpmc_regs->gpmc_bch_result3[i]); - ecc_code[10 ] = ((val >>24 ) &0xFF ); - ecc_code[11 ] = ((val >>16 ) &0xFF ); - ecc_code[12 ] = ((val >>8 ) &0xFF ); - ecc_code[13 ] = ((val >>0 ) &0xFF ); - val =readl (gpmc_regs->gpmc_bch_result2[i]); - ecc_code[14 ] = ((val >>24 ) &0xFF ); - ecc_code[15 ] = ((val >>16 ) &0xFF ); - ecc_code[16 ] = ((val >>8 ) &0xFF ); - ecc_code[17 ] = ((val >>0 ) &0xFF ); - val =readl (gpmc_regs->gpmc_bch_result1[i]); - ecc_code[18 ] = ((val >>24 ) &0xFF ); - ecc_code[19 ] = ((val >>16 ) &0xFF ); - ecc_code[20 ] = ((val >>8 ) &0xFF ); - ecc_code[21 ] = ((val >>0 ) &0xFF ); - val =readl (gpmc_regs->gpmc_bch_result0[i]); - ecc_code[22 ] = ((val >>24 ) &0xFF ); - ecc_code[23 ] = ((val >>16 ) &0xFF ); - ecc_code[24 ] = ((val >>8 ) &0xFF ); - ecc_code[25 ] = ((val >>0 ) &0xFF ); -break ; -default : -return -EINVAL ; - } - -/* ECC scheme specific syndrome customizations */ -switch (info->ecc_opt) { -case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW : -/* Add constant polynomial to remainder, so that -* ECC of blank pages results in 0x0 on reading back -*/ -for (j =0 ; j < eccbytes; j++) - ecc_calc[j] ^= bch4_polynomial[j]; -break ; -case OMAP_ECC_BCH4_CODE_HW : -/* Set 8th ECC byte as 0x0 for ROM compatibility */ - ecc_calc[eccbytes -1 ] =0x0 ; -break ; -case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW : -/* Add constant polynomial to remainder, so that -* ECC of blank pages results in 0x0 on reading back -*/ -for (j =0 ; j < eccbytes; j++) - ecc_calc[j] ^= bch8_polynomial[j]; -break ; -case OMAP_ECC_BCH8_CODE_HW : -/* Set 14th ECC byte as 0x0 for ROM compatibility */ - ecc_calc[eccbytes -1 ] =0x0 ; -break ; -case OMAP_ECC_BCH16_CODE_HW : -break ; -default : -return -EINVAL ; - } - -return 0 ; -} - -/** -* omap_calculate_ecc_bch_sw - ECC generator for sector for SW based correction -* @mtd: MTD device structure -* @dat: The pointer to data on which ecc is computed -* @ecc_code: The ecc_code buffer -* -* Support calculating of BCH4/8/16 ECC vectors for one sector. This is used -* when SW based correction is required as ECC is required for one sector -* at a time. -*/ -static int omap_calculate_ecc_bch_sw (struct mtd_info *mtd, -const u_char *dat,u_char *ecc_calc) -{ -return _omap_calculate_ecc_bch (mtd, dat, ecc_calc,0 ); -} - -/** -* omap_calculate_ecc_bch_multi - Generate ECC for multiple sectors -* @mtd: MTD device structure -* @dat: The pointer to data on which ecc is computed -* @ecc_code: The ecc_code buffer -* -* Support calculating of BCH4/8/16 ecc vectors for the entire page in one go. -*/ -static int omap_calculate_ecc_bch_multi (struct mtd_info *mtd, -const u_char *dat,u_char *ecc_calc) -{ - struct omap_nand_info *info = container_of(mtd, struct omap_nand_info, - mtd); -int eccbytes = info->nand.ecc.bytes; -unsigned long nsectors; -int i, ret; +int i, j; nsectors = ((readl (info->reg.gpmc_ecc_config) >>4 ) &0x7 ) +1 ;for (i =0 ; i < nsectors; i++) { - ret =_omap_calculate_ecc_bch (mtd, dat, ecc_calc, i); -if (ret) -return ret; + ecc_code = ecc_calc; +switch (info->ecc_opt) { +case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW : +case OMAP_ECC_BCH8_CODE_HW : + bch_val1 =readl (gpmc_regs->gpmc_bch_result0[i]); + bch_val2 =readl (gpmc_regs->gpmc_bch_result1[i]); + bch_val3 =readl (gpmc_regs->gpmc_bch_result2[i]); + bch_val4 =readl (gpmc_regs->gpmc_bch_result3[i]); + *ecc_code++ = (bch_val4 &0xFF ); + *ecc_code++ = ((bch_val3 >>24 ) &0xFF ); + *ecc_code++ = ((bch_val3 >>16 ) &0xFF ); + *ecc_code++ = ((bch_val3 >>8 ) &0xFF ); + *ecc_code++ = (bch_val3 &0xFF ); + *ecc_code++ = ((bch_val2 >>24 ) &0xFF ); + *ecc_code++ = ((bch_val2 >>16 ) &0xFF ); + *ecc_code++ = ((bch_val2 >>8 ) &0xFF ); + *ecc_code++ = (bch_val2 &0xFF ); + *ecc_code++ = ((bch_val1 >>24 ) &0xFF ); + *ecc_code++ = ((bch_val1 >>16 ) &0xFF ); + *ecc_code++ = ((bch_val1 >>8 ) &0xFF ); + *ecc_code++ = (bch_val1 &0xFF ); +break ; +case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW : +case OMAP_ECC_BCH4_CODE_HW : + bch_val1 =readl (gpmc_regs->gpmc_bch_result0[i]); + bch_val2 =readl (gpmc_regs->gpmc_bch_result1[i]); + *ecc_code++ = ((bch_val2 >>12 ) &0xFF ); + *ecc_code++ = ((bch_val2 >>4 ) &0xFF ); + *ecc_code++ = ((bch_val2 &0xF ) <<4 ) | + ((bch_val1 >>28 ) &0xF ); + *ecc_code++ = ((bch_val1 >>20 ) &0xFF ); + *ecc_code++ = ((bch_val1 >>12 ) &0xFF ); + *ecc_code++ = ((bch_val1 >>4 ) &0xFF ); + *ecc_code++ = ((bch_val1 &0xF ) <<4 ); +break ; +case OMAP_ECC_BCH16_CODE_HW : + val =readl (gpmc_regs->gpmc_bch_result6[i]); + ecc_code[0 ] = ((val >>8 ) &0xFF ); + ecc_code[1 ] = ((val >>0 ) &0xFF ); + val =readl (gpmc_regs->gpmc_bch_result5[i]); + ecc_code[2 ] = ((val >>24 ) &0xFF ); + ecc_code[3 ] = ((val >>16 ) &0xFF ); + ecc_code[4 ] = ((val >>8 ) &0xFF ); + ecc_code[5 ] = ((val >>0 ) &0xFF ); + val =readl (gpmc_regs->gpmc_bch_result4[i]); + ecc_code[6 ] = ((val >>24 ) &0xFF ); + ecc_code[7 ] = ((val >>16 ) &0xFF ); + ecc_code[8 ] = ((val >>8 ) &0xFF ); + ecc_code[9 ] = ((val >>0 ) &0xFF ); + val =readl (gpmc_regs->gpmc_bch_result3[i]); + ecc_code[10 ] = ((val >>24 ) &0xFF ); + ecc_code[11 ] = ((val >>16 ) &0xFF ); + ecc_code[12 ] = ((val >>8 ) &0xFF ); + ecc_code[13 ] = ((val >>0 ) &0xFF ); + val =readl (gpmc_regs->gpmc_bch_result2[i]); + ecc_code[14 ] = ((val >>24 ) &0xFF ); + ecc_code[15 ] = ((val >>16 ) &0xFF ); + ecc_code[16 ] = ((val >>8 ) &0xFF ); + ecc_code[17 ] = ((val >>0 ) &0xFF ); + val =readl (gpmc_regs->gpmc_bch_result1[i]); + ecc_code[18 ] = ((val >>24 ) &0xFF ); + ecc_code[19 ] = ((val >>16 ) &0xFF ); + ecc_code[20 ] = ((val >>8 ) &0xFF ); + ecc_code[21 ] = ((val >>0 ) &0xFF ); + val =readl (gpmc_regs->gpmc_bch_result0[i]); + ecc_code[22 ] = ((val >>24 ) &0xFF ); + ecc_code[23 ] = ((val >>16 ) &0xFF ); + ecc_code[24 ] = ((val >>8 ) &0xFF ); + ecc_code[25 ] = ((val >>0 ) &0xFF ); +break ; +default : +return -EINVAL ; + } + +/* ECC scheme specific syndrome customizations */ +switch (info->ecc_opt) { +case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW : +/* Add constant polynomial to remainder, so that +* ECC of blank pages results in 0x0 on reading back */ +for (j =0 ; j < eccbytes; j++) + ecc_calc[j] ^= bch4_polynomial[j]; +break ; +case OMAP_ECC_BCH4_CODE_HW : +/* Set 8th ECC byte as 0x0 for ROM compatibility */ + ecc_calc[eccbytes -1 ] =0x0 ; +break ; +case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW : +/* Add constant polynomial to remainder, so that +* ECC of blank pages results in 0x0 on reading back */ +for (j =0 ; j < eccbytes; j++) + ecc_calc[j] ^= bch8_polynomial[j]; +break ; +case OMAP_ECC_BCH8_CODE_HW : +/* Set 14th ECC byte as 0x0 for ROM compatibility */ + ecc_calc[eccbytes -1 ] =0x0 ; +break ; +case OMAP_ECC_BCH16_CODE_HW : +break ; +default : +return -EINVAL ; + } - ecc_calc += eccbytes; + ecc_calc += eccbytes; }return 0 ;
@@ -1571,7 +1527,7 @@ static int omap_write_page_bch(struct mt chip->write_buf (mtd, buf, mtd->writesize);/* Update ecc vector from GPMC result registers */ -omap_calculate_ecc_bch_multi (mtd, buf, &ecc_calc[0 ]); + chip->ecc.calculate (mtd, buf, &ecc_calc[0 ]);for (i =0 ; i < chip->ecc.total; i++) chip->oob_poi[eccpos[i]] = ecc_calc[i];
@@ -1582,72 +1538,6 @@ static int omap_write_page_bch(struct mt }/** -* omap_write_subpage_bch - BCH hardware ECC based subpage write -* @mtd: mtd info structure -* @chip: nand chip info structure -* @offset: column address of subpage within the page -* @data_len: data length -* @buf: data buffer -* @oob_required: must write chip->oob_poi to OOB -* @page: page number to write -* -* OMAP optimized subpage write method. -*/ -static int omap_write_subpage_bch (struct mtd_info *mtd, -struct nand_chip *chip,u32 offset, -u32 data_len,const u8 *buf, -int oob_required,int page) -{ -u8 *ecc_calc = chip->buffers->ecccalc; -int ecc_size = chip->ecc.size; -int ecc_bytes = chip->ecc.bytes; -int ecc_steps = chip->ecc.steps; -u32 start_step = offset / ecc_size; -u32 end_step = (offset + data_len -1 ) / ecc_size; -int step, ret =0 ; - -/* -* Write entire page at one go as it would be optimal -* as ECC is calculated by hardware. -* ECC is calculated for all subpages but we choose -* only what we want. -*/ - -/* Enable GPMC ECC engine */ - chip->ecc.hwctl (mtd,NAND_ECC_WRITE ); - -/* Write data */ - chip->write_buf (mtd, buf, mtd->writesize); - -for (step =0 ; step < ecc_steps; step++) { -/* mask ECC of un-touched subpages by padding 0xFF */ -if (step < start_step || step > end_step) -memset (ecc_calc,0xff , ecc_bytes); -else - ret =_omap_calculate_ecc_bch (mtd, buf, ecc_calc, step); - -if (ret) -return ret; - - buf += ecc_size; - ecc_calc += ecc_bytes; - } - -/* copy calculated ECC for whole page to chip->buffer->oob */ -/* this include masked-value(0xFF) for unwritten subpages */ - ecc_calc = chip->buffers->ecccalc; - ret =mtd_ooblayout_set_eccbytes (mtd, ecc_calc, chip->oob_poi,0 , - chip->ecc.total); -if (ret) -return ret; - -/* write OOB buffer to NAND device */ - chip->write_buf (mtd, chip->oob_poi, mtd->oobsize); - -return 0 ; -} - -/** * omap_read_page_bch - BCH ecc based page read function for entire page * @mtd: mtd info structure * @chip: nand chip info structure
@@ -1684,7 +1574,7 @@ static int omap_read_page_bch(struct mtd chip->read_buf (mtd, oob, chip->ecc.total);/* Calculate ecc bytes */ -omap_calculate_ecc_bch_multi (mtd, buf, ecc_calc); + chip->ecc.calculate (mtd, buf, ecc_calc);memcpy (ecc_code, &chip->oob_poi[eccpos[0 ]], chip->ecc.total);
@@ -1933,7 +1823,7 @@ static int omap_nand_probe(struct platfo nand_chip->ecc.strength =4 ; nand_chip->ecc.hwctl = omap_enable_hwecc_bch; nand_chip->ecc.correct = nand_bch_correct_data; - nand_chip->ecc.calculate = omap_calculate_ecc_bch_sw; + nand_chip->ecc.calculate = omap_calculate_ecc_bch;/* define ECC layout */ ecclayout->eccbytes = nand_chip->ecc.bytes * (mtd->writesize /
@@ -1973,9 +1863,9 @@ static int omap_nand_probe(struct platfo nand_chip->ecc.strength =4 ; nand_chip->ecc.hwctl = omap_enable_hwecc_bch; nand_chip->ecc.correct = omap_elm_correct_data; + nand_chip->ecc.calculate = omap_calculate_ecc_bch; nand_chip->ecc.read_page = omap_read_page_bch; nand_chip->ecc.write_page = omap_write_page_bch; - nand_chip->ecc.write_subpage = omap_write_subpage_bch;/* define ECC layout */ ecclayout->eccbytes = nand_chip->ecc.bytes * (mtd->writesize /
@@ -2008,7 +1898,7 @@ static int omap_nand_probe(struct platfo nand_chip->ecc.strength =8 ; nand_chip->ecc.hwctl = omap_enable_hwecc_bch; nand_chip->ecc.correct = nand_bch_correct_data; - nand_chip->ecc.calculate = omap_calculate_ecc_bch_sw; + nand_chip->ecc.calculate = omap_calculate_ecc_bch;/* define ECC layout */ ecclayout->eccbytes = nand_chip->ecc.bytes * (mtd->writesize /
@@ -2049,9 +1939,9 @@ static int omap_nand_probe(struct platfo nand_chip->ecc.strength =8 ; nand_chip->ecc.hwctl = omap_enable_hwecc_bch; nand_chip->ecc.correct = omap_elm_correct_data; + nand_chip->ecc.calculate = omap_calculate_ecc_bch; nand_chip->ecc.read_page = omap_read_page_bch; nand_chip->ecc.write_page = omap_write_page_bch; - nand_chip->ecc.write_subpage = omap_write_subpage_bch;/* This ECC scheme requires ELM H/W block */ err =is_elm_present (info, pdata->elm_of_node,BCH8_ECC );if (err <0 ) {
@@ -2084,9 +1974,9 @@ static int omap_nand_probe(struct platfo nand_chip->ecc.strength =16 ; nand_chip->ecc.hwctl = omap_enable_hwecc_bch; nand_chip->ecc.correct = omap_elm_correct_data; + nand_chip->ecc.calculate = omap_calculate_ecc_bch; nand_chip->ecc.read_page = omap_read_page_bch; nand_chip->ecc.write_page = omap_write_page_bch; - nand_chip->ecc.write_subpage = omap_write_subpage_bch;/* This ECC scheme requires ELM H/W block */ err =is_elm_present (info, pdata->elm_of_node,BCH16_ECC );if (err <0 ) {
PATCH 12/366 media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Prabhakar Lad <[email protected]>
commit d75cf0144f150272be806b69b4e62553ba07ea1b upstream.
drop VPFE_CMD_S_CCDC_RAW_PARAMS ioctl from dm355/dm644x following reasons:
- 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.
--- .../media/platform/davinci/ccdc_hw_device.h | 10 -- drivers/media/platform/davinci/dm355_ccdc.c | 92 +---------- drivers/media/platform/davinci/dm644x_ccdc.c | 151 +----------------- drivers/media/platform/davinci/vpfe_capture.c | 75 --------- include/media/davinci/dm644x_ccdc.h | 12 -- include/media/davinci/vpfe_capture.h | 10 -- 6 files changed, 4 insertions(+), 346 deletions(-)
drivers/media/platform/davinci/ccdc_hw_device.h +0 -10
@@ -46,16 +46,6 @@ struct ccdc_hw_ops {int (*set_hw_if_params) (struct vpfe_hw_if_param *param);/* get interface parameters */ int (*get_hw_if_params) (struct vpfe_hw_if_param *param); -/* -* Pointer to function to set parameters. Used -* for implementing VPFE_S_CCDC_PARAMS -*/ -int (*set_params) (void *params); -/* -* Pointer to function to get parameter. Used -* for implementing VPFE_G_CCDC_PARAMS -*/ -int (*get_params) (void *params);/* Pointer to function to configure ccdc */ int (*configure) (void );
drivers/media/platform/davinci/dm355_ccdc.c +1 -91
110 lines not on this page · raw message
drivers/media/platform/davinci/dm644x_ccdc.c +3 -148
189 lines not on this page · raw message
drivers/media/platform/davinci/vpfe_capture.c +0 -75
93 lines not on this page · raw message
include/media/davinci/dm644x_ccdc.h +0 -12
@@ -107,16 +107,6 @@ struct ccdc_black_compensation {char gb; }; -/* structure for fault pixel correction */ -struct ccdc_fault_pixel { -/* Enable or Disable fault pixel correction */ -unsigned char enable; -/* Number of fault pixel */ -unsigned short fp_num; -/* Address of fault pixel table */ -unsigned int fpc_table_addr; -}; -/* Structure for CCDC configuration parameters for raw capture mode passed * by application */
@@ -129,8 +119,6 @@ struct ccdc_config_params_raw {struct ccdc_black_clamp blk_clamp;/* Structure for Black Compensation */ struct ccdc_black_compensation blk_comp; -/* Structure for Fault Pixel Module Configuration */ -struct ccdc_fault_pixel fault_pxl; };
include/media/davinci/vpfe_capture.h +0 -10
@@ -187,14 +187,4 @@ struct vpfe_config_params { };#endif /* End of __KERNEL__ */ -/** -* VPFE_CMD_S_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to set raw capture params -* This can be used to configure modules such as defect pixel correction, -* color space conversion, culling etc. This is an experimental ioctl that -* will change in future kernels. So use this ioctl with care ! -* TODO: This is to be split into multiple ioctls and also explore the -* possibility of extending the v4l2 api to include this -**/ -#define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \ - void *)#endif /* _DAVINCI_VPFE_H */
PATCH 13/366 arch/x86/kernel/cpu/common.c: fix unused symbol warning
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Morton <[email protected]>
commit e48510f45107613bf14060eeabd658c49a044242 upstream.
x86_64 allnoconfig:
arch/x86/kernel/cpu/common.c:968: warning: 'syscall32_cpu_init' defined but not used
--- arch/x86/kernel/cpu/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/common.c +3 -1
@@ -1156,6 +1156,7 @@ static void vgetcpu_set_mode(void) vgetcpu_mode =VGETCPU_LSL ; } +#ifdef CONFIG_IA32_EMULATION /* May not be __init: called during resume */ static void syscall32_cpu_init (void ) {
@@ -1167,7 +1168,8 @@ static void syscall32_cpu_init(void)wrmsrl (MSR_CSTAR , ia32_cstar_target); } -#endif +#endif /* CONFIG_IA32_EMULATION */ +#endif /* CONFIG_X86_64 */ #ifdef CONFIG_X86_32 void enable_sep_cpu (void )
PATCH 14/366 fuse: atomic_o_trunc should truncate pagecache
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit df0e91d488276086bc07da2e389986cae0048c37 upstream.
Fuse has an "atomic_o_trunc" mode, where userspace filesystem uses the O_TRUNC flag in the OPEN request to truncate the file atomically with the open.
In this mode there's no need to send a SETATTR request to userspace after the open, so fuse_do_setattr() checks this mode and returns. But this misses the important step of truncating the pagecache.
Add the missing parts of truncation to the ATTR_OPEN branch.
--- fs/fuse/dir.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/fuse/dir.c +12 -1
@@ -1728,8 +1728,19 @@ int fuse_do_setattr(struct dentry *dentrreturn err;if (attr->ia_valid &ATTR_OPEN ) { -if (fc->atomic_o_trunc) +/* This is coming from open(..., ... | O_TRUNC); */ +WARN_ON (!(attr->ia_valid &ATTR_SIZE )); +WARN_ON (attr->ia_size !=0 ); +if (fc->atomic_o_trunc) { +/* +* No need to send request to userspace, since actual +* truncation has already been done by OPEN. But still +* need to truncate page cache. +*/ +i_size_write (inode,0 ); +truncate_pagecache (inode,0 );return 0 ; + } file =NULL ; }
PATCH 15/366 staging:iio:ade7854: Fix error handling on read/write
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: John Syne <[email protected]>
commit 4297b23d927fa5265378f4a71372ecef3c33023a upstream.
The original code does not correctly handle the error related to I2C read and write. This patch fixes the error handling related to all read/write functions for I2C.
--- drivers/staging/iio/meter/ade7854-i2c.c | 24 ++++++++++++------------ drivers/staging/iio/meter/ade7854.c | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/iio/meter/ade7854-i2c.c +12 -12
@@ -31,7 +31,7 @@ static int ade7854_i2c_write_reg_8(struc ret =i2c_master_send (st->i2c, st->tx,3 );mutex_unlock (&st->buf_lock); -return ret; +return ret <0 ? ret :0 ; } static int ade7854_i2c_write_reg_16(struct device *dev,
@@ -51,7 +51,7 @@ static int ade7854_i2c_write_reg_16(stru ret =i2c_master_send (st->i2c, st->tx,4 );mutex_unlock (&st->buf_lock); -return ret; +return ret <0 ? ret :0 ; } static int ade7854_i2c_write_reg_24(struct device *dev,
@@ -72,7 +72,7 @@ static int ade7854_i2c_write_reg_24(stru ret =i2c_master_send (st->i2c, st->tx,5 );mutex_unlock (&st->buf_lock); -return ret; +return ret <0 ? ret :0 ; } static int ade7854_i2c_write_reg_32(struct device *dev,
@@ -94,7 +94,7 @@ static int ade7854_i2c_write_reg_32(stru ret =i2c_master_send (st->i2c, st->tx,6 );mutex_unlock (&st->buf_lock); -return ret; +return ret <0 ? ret :0 ; } static int ade7854_i2c_read_reg_8(struct device *dev,
@@ -110,11 +110,11 @@ static int ade7854_i2c_read_reg_8(struct st->tx[1 ] = reg_address &0xFF ; ret =i2c_master_send (st->i2c, st->tx,2 ); -if (ret) +if (ret <0 ) goto out; ret =i2c_master_recv (st->i2c, st->rx,1 ); -if (ret) +if (ret <0 ) goto out; *val = st->rx[0 ];
@@ -136,11 +136,11 @@ static int ade7854_i2c_read_reg_16(struc st->tx[1 ] = reg_address &0xFF ; ret =i2c_master_send (st->i2c, st->tx,2 ); -if (ret) +if (ret <0 ) goto out; ret =i2c_master_recv (st->i2c, st->rx,2 ); -if (ret) +if (ret <0 ) goto out; *val = (st->rx[0 ] <<8 ) | st->rx[1 ];
@@ -162,11 +162,11 @@ static int ade7854_i2c_read_reg_24(struc st->tx[1 ] = reg_address &0xFF ; ret =i2c_master_send (st->i2c, st->tx,2 ); -if (ret) +if (ret <0 ) goto out; ret =i2c_master_recv (st->i2c, st->rx,3 ); -if (ret) +if (ret <0 ) goto out; *val = (st->rx[0 ] <<16 ) | (st->rx[1 ] <<8 ) | st->rx[2 ];
@@ -188,11 +188,11 @@ static int ade7854_i2c_read_reg_32(struc st->tx[1 ] = reg_address &0xFF ; ret =i2c_master_send (st->i2c, st->tx,2 ); -if (ret) +if (ret <0 ) goto out; ret =i2c_master_recv (st->i2c, st->rx,3 ); -if (ret) +if (ret <0 ) goto out; *val = (st->rx[0 ] <<24 ) | (st->rx[1 ] <<16 ) | (st->rx[2 ] <<8 ) | st->rx[3 ];
drivers/staging/iio/meter/ade7854.c +5 -5
@@ -33,7 +33,7 @@ static ssize_t ade7854_read_8bit(structstruct iio_dev_attr *this_attr =to_iio_dev_attr (attr); ret = st->read_reg_8 (dev, this_attr->address, &val); -if (ret) +if (ret <0 )return ret;return sprintf (buf,"%u\n" , val);
@@ -50,7 +50,7 @@ static ssize_t ade7854_read_16bit(structstruct iio_dev_attr *this_attr =to_iio_dev_attr (attr); ret = st->read_reg_16 (dev, this_attr->address, &val); -if (ret) +if (ret <0 )return ret;return sprintf (buf,"%u\n" , val);
@@ -67,7 +67,7 @@ static ssize_t ade7854_read_24bit(structstruct iio_dev_attr *this_attr =to_iio_dev_attr (attr); ret = st->read_reg_24 (dev, this_attr->address, &val); -if (ret) +if (ret <0 )return ret;return sprintf (buf,"%u\n" , val);
@@ -84,7 +84,7 @@ static ssize_t ade7854_read_32bit(structstruct ade7854_state *st =iio_priv (indio_dev); ret = st->read_reg_32 (dev, this_attr->address, &val); -if (ret) +if (ret <0 )return ret;return sprintf (buf,"%u\n" , val);
@@ -416,7 +416,7 @@ static int ade7854_set_irq(struct deviceu32 irqen; ret = st->read_reg_32 (dev,ADE7854_MASK0 , &irqen); -if (ret) +if (ret <0 ) goto error_ret;if (enable)
PATCH 16/366 staging:iio:ade7854: Fix the wrong number of bits to read
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: John Syne <[email protected]>
commit 6cef2ab01636b6021044f349df466a97c408ec27 upstream.
The function ade7854_i2c_read_reg_32() have to invoke the i2c_master_recv() for read 32 bits values, however, the counter is set to 3 which means 24 bits. This patch fixes the wrong size of 24 bits, to 32 bits.
--- drivers/staging/iio/meter/ade7854-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/meter/ade7854-i2c.c +1 -1
@@ -191,7 +191,7 @@ static int ade7854_i2c_read_reg_32(strucif (ret <0 ) goto out; - ret =i2c_master_recv (st->i2c, st->rx,3 ); + ret =i2c_master_recv (st->i2c, st->rx,4 );if (ret <0 ) goto out;
PATCH 17/366 media: omap3isp/isp: remove an unused static var
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 3f4836beb2ebeb0211d9911d878a267d687e0e6e upstream.
The isp_xclk_init_data const data isn't used anywere.
drivers/media/platform/omap3isp/isp.c:294:35: warning: ‘isp_xclk_init_data’ defined but not used [-Wunused-const-variable=]
static const struct clk_init_data isp_xclk_init_data = {
^~~~~~~~~~~~~~~~~~--- drivers/media/platform/omap3isp/isp.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/platform/omap3isp/isp.c +0 -7
@@ -279,13 +279,6 @@ static const struct clk_ops isp_xclk_opsstatic const char *isp_xclk_parent_name ="cam_mclk" ; -static const struct clk_init_data isp_xclk_init_data = { - .name ="cam_xclk" , - .ops = &isp_xclk_ops, - .parent_names = &isp_xclk_parent_name, - .num_parents =1 , -}; -static int isp_xclk_init (struct isp_device *isp) {struct isp_platform_data *pdata = isp->pdata;
PATCH 18/366 media: dvb_frontend: fix locking issues at dvb_frontend_get_event()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 76d81243a487c09619822ef8e7201a756e58a87d upstream.
As warned by smatch:
drivers/media/dvb-core/dvb_frontend.c:314 dvb_frontend_get_event() warn: inconsistent returns 'sem:&fepriv->sem'. Locked on: line 288 line 295 line 306 line 314 Unlocked on: line 303
The lock implementation for get event is wrong, as, if an interrupt occurs, down_interruptible() will fail, and the routine will call up() twice when userspace calls the ioctl again.
The bad code is there since when Linux migrated to git, in 2005.
--- drivers/media/dvb-core/dvb_frontend.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/media/dvb-core/dvb_frontend.c +15 -8
@@ -229,8 +229,20 @@ static void dvb_frontend_add_event(strucwake_up_interruptible (&events->wait_queue); } +static int dvb_frontend_test_event (struct dvb_frontend_private *fepriv, +struct dvb_fe_events *events) +{ +int ret; + +up (&fepriv->sem); + ret = events->eventw != events->eventr; +down (&fepriv->sem); + +return ret; +} +static int dvb_frontend_get_event (struct dvb_frontend *fe, -struct dvb_frontend_event *event,int flags) +struct dvb_frontend_event *event,int flags) {struct dvb_frontend_private *fepriv = fe->frontend_priv;struct dvb_fe_events *events = &fepriv->events;
@@ -248,13 +260,8 @@ static int dvb_frontend_get_event(structif (flags &O_NONBLOCK )return -EWOULDBLOCK ; -up (&fepriv->sem); - - ret =wait_event_interruptible (events->wait_queue, - events->eventw != events->eventr); - -if (down_interruptible (&fepriv->sem)) -return -ERESTARTSYS ; + ret =wait_event_interruptible (events->wait_queue, +dvb_frontend_test_event (fepriv, events));if (ret <0 )return ret;
PATCH 19/366 media: v4l2-compat-ioctl32: prevent go past max size
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit ea72fbf588ac9c017224dcdaa2019ff52ca56fee upstream.
As warned by smatch:
drivers/media/v4l2-core/v4l2-compat-ioctl32.c:879 put_v4l2_ext_controls32() warn: check for integer overflow 'count'
The access_ok() logic should check for too big arrays too.
--- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-compat-ioctl32.c +1 -1
@@ -848,7 +848,7 @@ static int put_v4l2_ext_controls32(struc get_user(kcontrols, &kp->controls))return -EFAULT ; -if (!count) +if (!count || count > (U32_MAX /sizeof (*ucontrols)))return 0 ;if (get_user (p, &up->controls))return -EFAULT ;
PATCH 20/366 pinctrl: samsung: Correct EINTG banks order
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paweł Chmiel <[email protected]>
commit 5cf9a338db94cfd570aa2607bef1b30996f188e3 upstream.
All banks with GPIO interrupts should be at beginning of bank array and without any other types of banks between them. This order is expected by exynos_eint_gpio_irq, when doing interrupt group to bank translation. Otherwise, kernel NULL pointer dereference would happen when trying to handle interrupt, due to wrong bank being looked up. Observed on s5pv210, when trying to handle gpj0 interrupt, where kernel was mapping it to gpi bank.
[bwh: Backported to 3.16:
- Drop change to exynos5410_pin_banks0
- Adjust filename]
---
drivers/pinctrl/pinctrl-exynos.c +1 -1
@@ -679,12 +679,12 @@ static struct samsung_pin_bank s5pv210_pEXYNOS_PIN_BANK_EINTG (7 ,0x1c0 ,"gpg1" ,0x38 ),EXYNOS_PIN_BANK_EINTG (7 ,0x1e0 ,"gpg2" ,0x3c ),EXYNOS_PIN_BANK_EINTG (7 ,0x200 ,"gpg3" ,0x40 ), -EXYNOS_PIN_BANK_EINTN (7 ,0x220 ,"gpi" ),EXYNOS_PIN_BANK_EINTG (8 ,0x240 ,"gpj0" ,0x44 ),EXYNOS_PIN_BANK_EINTG (6 ,0x260 ,"gpj1" ,0x48 ),EXYNOS_PIN_BANK_EINTG (8 ,0x280 ,"gpj2" ,0x4c ),EXYNOS_PIN_BANK_EINTG (8 ,0x2a0 ,"gpj3" ,0x50 ),EXYNOS_PIN_BANK_EINTG (5 ,0x2c0 ,"gpj4" ,0x54 ), +EXYNOS_PIN_BANK_EINTN (7 ,0x220 ,"gpi" ),EXYNOS_PIN_BANK_EINTN (8 ,0x2e0 ,"mp01" ),EXYNOS_PIN_BANK_EINTN (4 ,0x300 ,"mp02" ), EXYNOS_PIN_BANK_EINTN(8, 0x320, "mp03"),
PATCH 21/366 net-next: ax88796: Do not free IRQ in ax_remove() (already freed in ax_close()).
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Karcher <[email protected]>
commit 9144c3795c2636351d553e4d0fc5297201182de2 upstream.
This complements the fix in 82533ad9a1c ("net: ethernet: ax88796:
don't call free_irq without request_irq first") that removed the free_irq call in the error path of probe, to also not call free_irq when remove is called to revert the effects of probe.
--- drivers/net/ethernet/8390/ax88796.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/8390/ax88796.c +0 -1
@@ -812,7 +812,6 @@ static int ax_remove(struct platform_devstruct resource *mem;unregister_netdev (dev); -free_irq (dev->irq, dev);iounmap (ei_local->mem); mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
PATCH 22/366 media: cx231xx: Add support for AverMedia DVD EZMaker 7
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kai-Heng Feng <[email protected]>
commit 29e61d6ef061b012d320327af7dbb3990e75be45 upstream.
User reports AverMedia DVD EZMaker 7 can be driven by VIDEO_GRABBER. Add the device to the id_table to make it work.
--- drivers/media/usb/cx231xx/cx231xx-cards.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/usb/cx231xx/cx231xx-cards.c +3 -0
@@ -727,6 +727,9 @@ struct usb_device_id cx231xx_id_table[] .driver_info = CX231XX_BOARD_CNXT_RDE_250}, {USB_DEVICE(0x0572, 0x58A0), .driver_info = CX231XX_BOARD_CNXT_RDU_250}, + /* AverMedia DVD EZMaker 7 */ + {USB_DEVICE(0x07ca, 0xc039), + .driver_info = CX231XX_BOARD_CNXT_VIDEO_GRABBER}, {USB_DEVICE(0x2040, 0xb110), .driver_info = CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL}, {USB_DEVICE(0x2040, 0xb111),
PATCH 23/366 media: rc: mce_kbd decoder: fix stuck keys
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sean Young <[email protected]>
commit 63039c29f7a4ce8a8bd165173840543c0098d7b0 upstream.
The MCE Remote sends a 0 scancode when keys are released. If this is not received or decoded, then keys can get "stuck"; the keyup event is not sent since the input_sync() is missing from the timeout handler.
--- drivers/media/rc/ir-mce_kbd-decoder.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/rc/ir-mce_kbd-decoder.c +2 -0
@@ -130,6 +130,8 @@ static void mce_kbd_rx_timeout(unsignedfor (i =0 ; i <MCIR2_MASK_KEYS_START ; i++)input_report_key (mce_kbd->idev, kbd_keycodes[i],0 ); + +input_sync (mce_kbd->idev); }static enum mce_kbd_mode mce_kbd_mode (struct mce_kbd_dec *data)
PATCH 24/366 PCI: ibmphp: Fix use-before-set in get_max_bus_speed()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 4051f5ebb11c6ef4b0d3eac2fbbd187c070656c5 upstream.
The "rc" variable is only initialized on the error path. The caller doesn't check the return but, if "rc" is non-zero, then this function is basically a no-op.
--- drivers/pci/hotplug/ibmphp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/hotplug/ibmphp_core.c +1 -1
@@ -397,7 +397,7 @@ static int get_adapter_present(struct hostatic int get_max_bus_speed (struct slot *slot) { -int rc; +int rc =0 ;u8 mode =0 ;enum pci_bus_speed speed;struct pci_bus *bus = slot->hotplug_slot->pci_slot->bus;
PATCH 25/366 mwifiex: pcie: tighten a check in mwifiex_pcie_process_event_ready()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 01eca2842874b9a85b7cd1e1b0e5b34a5d53a21f upstream.
If "evt_len" is 1 then we try to memcpy() negative 3 bytes and it would cause memory corruption.
--- drivers/net/wireless/mwifiex/pcie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mwifiex/pcie.c +2 -1
@@ -1692,7 +1692,8 @@ static int mwifiex_pcie_process_event_reskb_pull (skb_cmd,INTF_HEADER_LEN );dev_dbg (adapter->dev,"info: Event length: %d\n" , evt_len); -if ((evt_len >0 ) && (evt_len <MAX_EVENT_SIZE )) +if (evt_len >MWIFIEX_EVENT_HEADER_LEN && + evt_len <MAX_EVENT_SIZE )memcpy (adapter->event_body, skb_cmd->data +MWIFIEX_EVENT_HEADER_LEN , evt_len -MWIFIEX_EVENT_HEADER_LEN );
PATCH 26/366 usb: do not reset if a low-speed or full-speed device timed out
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Moseychuk <[email protected]>
commit 6e01827ed93947895680fbdad68c072a0f4e2450 upstream.
Some low-speed and full-speed devices (for example, bluetooth) do not have time to initialize. For them, ETIMEDOUT is a valid error. We need to give them another try. Otherwise, they will never be initialized correctly and in dmesg will be messages "Bluetooth: hci0 command 0x1002 tx timeout" or similars.
--- drivers/usb/core/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +3 -1
@@ -4381,7 +4381,9 @@ hub_port_init (struct usb_hub *hub, stru* reset. But only on the first attempt, * lest we get into a time out/reset loop */ -if (r ==0 || (r == -ETIMEDOUT && retries ==0 )) +if (r ==0 || (r == -ETIMEDOUT && + retries ==0 && + udev->speed >USB_SPEED_FULL ))break ; } udev->descriptor.bMaxPacketSize0 =
PATCH 27/366 signal/xtensa: Consistenly use SIGBUS in do_unaligned_user
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 7de712ccc096b81d23cc0a941cd9b8cb3956605d upstream.
While working on changing this code to use force_sig_fault I discovered that do_unaliged_user is sets si_signo to SIGBUS and passes SIGSEGV to force_sig_info. Which is just b0rked.
The code is reporting a SIGBUS error so replace the SIGSEGV with SIGBUS.
--- arch/xtensa/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/kernel/traps.c +1 -1
@@ -282,7 +282,7 @@ do_unaligned_user (struct pt_regs *regs) info.si_errno =0 ; info.si_code =BUS_ADRALN ; info.si_addr = (void *) regs->excvaddr; - force_sig_info(SIGSEGV, &info, current); + force_sig_info(SIGBUS, &info, current); }#endif
PATCH 28/366 sctp: fix identification of new acks for SFR-CACC
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Ricardo Leitner <[email protected]>
commit 51446780fc33e45cb790c05a7fa2c5bf7e8bc53b upstream.
It's currently written as:
if (!tchunk->tsn_gap_acked) { [1]
tchunk->tsn_gap_acked = 1; ... }
if (TSN_lte(tsn, sack_ctsn)) {
if (!tchunk->tsn_gap_acked) {
/* SFR-CACC processing */
...
}
}Which causes the SFR-CACC processing on ack reception to never process, as tchunk->tsn_gap_acked is always true by then. Block [1] was moved to that position by the commit marked below.
This patch fixes it by doing SFR-CACC processing earlier, before tsn_gap_acked is set to true.
--- net/sctp/outqueue.c | 48 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 25 deletions(-)
net/sctp/outqueue.c +23 -25
@@ -1346,7 +1346,7 @@ static void sctp_check_transmitted(struc* the outstanding bytes for this chunk, so only * count bytes associated with a transport. */ -if (transport) { +if (transport && !tchunk->tsn_gap_acked) {/* If this chunk is being used for RTT * measurement, calculate the RTT and update * the RTO using this value.
@@ -1358,14 +1358,34 @@ static void sctp_check_transmitted(struc* first instance of the packet or a later * instance). */ -if (!tchunk->tsn_gap_acked && - !tchunk->resent && +if (!tchunk->resent && tchunk->rtt_in_progress) { tchunk->rtt_in_progress =0 ; rtt = jiffies - tchunk->sent_at;sctp_transport_update_rto (transport, rtt); } + +if (TSN_lte (tsn, sack_ctsn)) { +/* +* SFR-CACC algorithm: +* 2) If the SACK contains gap acks +* and the flag CHANGEOVER_ACTIVE is +* set the receiver of the SACK MUST +* take the following action: +* +* B) For each TSN t being acked that +* has not been acked in any SACK so +* far, set cacc_saw_newack to 1 for +* the destination that the TSN was +* sent to. +*/ +if (sack->num_gap_ack_blocks && + q->asoc->peer.primary_path->cacc. + changeover_active) + transport->cacc.cacc_saw_newack + =1 ; + } }/* If the chunk hasn't been marked as ACKED,
@@ -1397,28 +1417,6 @@ static void sctp_check_transmitted(struc restart_timer =1 ; forward_progress = true; -if (!tchunk->tsn_gap_acked) { -/* -* SFR-CACC algorithm: -* 2) If the SACK contains gap acks -* and the flag CHANGEOVER_ACTIVE is -* set the receiver of the SACK MUST -* take the following action: -* -* B) For each TSN t being acked that -* has not been acked in any SACK so -* far, set cacc_saw_newack to 1 for -* the destination that the TSN was -* sent to. -*/ -if (transport && - sack->num_gap_ack_blocks && - q->asoc->peer.primary_path->cacc. - changeover_active) - transport->cacc.cacc_saw_newack - =1 ; - } -list_add_tail (&tchunk->transmitted_list, &q->sacked); }else {
PATCH 29/366 ASoC: cirrus: i2s: Fix LRCLK configuration
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 2d534113be9a2aa532a1ae127a57e83558aed358 upstream.
The bit responsible for LRCLK polarity is i2s_tlrs (0), not i2s_trel (2) (refer to "EP93xx User's Guide").
Previously card drivers which specified SND_SOC_DAIFMT_NB_IF actually got SND_SOC_DAIFMT_NB_NF, an adaptation is necessary to retain the old behavior.
--- sound/soc/cirrus/edb93xx.c | 2 +- sound/soc/cirrus/ep93xx-i2s.c | 8 ++++---- sound/soc/cirrus/snappercl15.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
sound/soc/cirrus/edb93xx.c +1 -1
@@ -67,7 +67,7 @@ static struct snd_soc_dai_link edb93xx_d .cpu_dai_name = "ep93xx-i2s", .codec_name = "spi0.0", .codec_dai_name = "cs4271-hifi", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .ops = &edb93xx_ops, };
sound/soc/cirrus/ep93xx-i2s.c +4 -4
@@ -213,24 +213,24 @@ static int ep93xx_i2s_set_dai_fmt(structswitch (fmt &SND_SOC_DAIFMT_INV_MASK ) {case SND_SOC_DAIFMT_NB_NF :/* Negative bit clock, lrclk low on left word */ - clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP |EP93XX_I2S_CLKCFG_REL ); + clk_cfg &= ~(EP93XX_I2S_CLKCFG_CKP |EP93XX_I2S_CLKCFG_LRS );break ;case SND_SOC_DAIFMT_NB_IF :/* Negative bit clock, lrclk low on right word */ clk_cfg &= ~EP93XX_I2S_CLKCFG_CKP ; - clk_cfg |=EP93XX_I2S_CLKCFG_REL ; + clk_cfg |=EP93XX_I2S_CLKCFG_LRS ;break ;case SND_SOC_DAIFMT_IB_NF :/* Positive bit clock, lrclk low on left word */ clk_cfg |=EP93XX_I2S_CLKCFG_CKP ; - clk_cfg &= ~EP93XX_I2S_CLKCFG_REL ; + clk_cfg &= ~EP93XX_I2S_CLKCFG_LRS ;break ;case SND_SOC_DAIFMT_IB_IF :/* Positive bit clock, lrclk low on right word */ - clk_cfg |=EP93XX_I2S_CLKCFG_CKP |EP93XX_I2S_CLKCFG_REL ; + clk_cfg |=EP93XX_I2S_CLKCFG_CKP |EP93XX_I2S_CLKCFG_LRS ;break ; }
sound/soc/cirrus/snappercl15.c +1 -1
@@ -72,7 +72,7 @@ static struct snd_soc_dai_link snappercl .codec_dai_name = "tlv320aic23-hifi", .codec_name = "tlv320aic23-codec.0-001a", .platform_name = "ep93xx-i2s", - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF | + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .ops = &snappercl15_ops, };
PATCH 30/366 ASoC: cirrus: i2s: Fix {TX|RX}LinCtrlData setup
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 5d302ed3cc80564fb835bed5fdba1e1250ecc9e5 upstream.
According to "EP93xx User’s Guide", I2STXLinCtrlData and I2SRXLinCtrlData registers actually have different format. The only currently used bit (Left_Right_Justify) has different position. Fix this and simplify the whole setup taking into account the fact that both registers have zero default value.
The practical effect of the above is repaired SND_SOC_DAIFMT_RIGHT_J support (currently unused).
--- sound/soc/cirrus/ep93xx-i2s.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
sound/soc/cirrus/ep93xx-i2s.c +10 -8
@@ -51,7 +51,9 @@#define EP93XX_I2S_WRDLEN_24 (1 << 0)#define EP93XX_I2S_WRDLEN_32 (2 << 0) -#define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2)/* Right justify */ +#define EP93XX_I2S_RXLINCTRLDATA_R_JUST BIT(1)/* Right justify */ + +#define EP93XX_I2S_TXLINCTRLDATA_R_JUST BIT(2)/* Right justify */ #define EP93XX_I2S_CLKCFG_LRS (1 << 0)/* lrclk polarity */ #define EP93XX_I2S_CLKCFG_CKP (1 << 1)/* Bit clock polarity */
@@ -170,25 +172,25 @@ static int ep93xx_i2s_set_dai_fmt(struct unsigned int fmt) {struct ep93xx_i2s_info *info =snd_soc_dai_get_drvdata (cpu_dai); -unsigned int clk_cfg, lin_ctrl; +unsigned int clk_cfg; +unsigned int txlin_ctrl =0 ; +unsigned int rxlin_ctrl =0 ; clk_cfg =ep93xx_i2s_read_reg (info,EP93XX_I2S_RXCLKCFG ); - lin_ctrl =ep93xx_i2s_read_reg (info,EP93XX_I2S_RXLINCTRLDATA );switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) {case SND_SOC_DAIFMT_I2S : clk_cfg |=EP93XX_I2S_CLKCFG_REL ; - lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST ;break ;case SND_SOC_DAIFMT_LEFT_J : clk_cfg &= ~EP93XX_I2S_CLKCFG_REL ; - lin_ctrl &= ~EP93XX_I2S_LINCTRLDATA_R_JUST ;break ;case SND_SOC_DAIFMT_RIGHT_J : clk_cfg &= ~EP93XX_I2S_CLKCFG_REL ; - lin_ctrl |=EP93XX_I2S_LINCTRLDATA_R_JUST ; + rxlin_ctrl |=EP93XX_I2S_RXLINCTRLDATA_R_JUST ; + txlin_ctrl |=EP93XX_I2S_TXLINCTRLDATA_R_JUST ;break ;default :
@@ -237,8 +239,8 @@ static int ep93xx_i2s_set_dai_fmt(struct/* Write new register values */ ep93xx_i2s_write_reg (info,EP93XX_I2S_RXCLKCFG , clk_cfg);ep93xx_i2s_write_reg (info,EP93XX_I2S_TXCLKCFG , clk_cfg); -ep93xx_i2s_write_reg (info,EP93XX_I2S_RXLINCTRLDATA , lin_ctrl); -ep93xx_i2s_write_reg (info,EP93XX_I2S_TXLINCTRLDATA , lin_ctrl); +ep93xx_i2s_write_reg (info,EP93XX_I2S_RXLINCTRLDATA , rxlin_ctrl); +ep93xx_i2s_write_reg (info,EP93XX_I2S_TXLINCTRLDATA , txlin_ctrl);return 0 ; }
PATCH 31/366 ALSA: hda/ca0132: fix build failure when a local macro is defined
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit 8e142e9e628975b0dddd05cf1b095331dff6e2de upstream.
DECLARE_TLV_DB_SCALE (alias of SNDRV_CTL_TLVD_DECLARE_DB_SCALE) is used but tlv.h is not included. This causes build failure when local macro is defined by comment-out.
This commit fixes the bug. At the same time, the alias macro is replaced with a destination macro added at a commit 46e860f76804 ("ALSA: rename TLV-related macros so that they're friendly to user applications")
--- sound/pci/hda/patch_ca0132.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/pci/hda/patch_ca0132.c +6 -2
@@ -38,6 +38,10 @@/* Enable this to see controls for tuning purpose. */ /*#define ENABLE_TUNING_CONTROLS*/ +#ifdef ENABLE_TUNING_CONTROLS +#include <sound/tlv.h> +#endif +#define FLOAT_ZERO 0x00000000#define FLOAT_ONE 0x3f800000#define FLOAT_TWO 0x40000000
@@ -3037,8 +3041,8 @@ static int equalizer_ctl_put(struct snd_return 1 ; } -static const DECLARE_TLV_DB_SCALE(voice_focus_db_scale, 2000, 100, 0); -static const DECLARE_TLV_DB_SCALE(eq_db_scale, -2400, 100, 0); +static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(voice_focus_db_scale, 2000, 100, 0); +static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(eq_db_scale, -2400, 100, 0); static int add_tuning_control(struct hda_codec *codec, hda_nid_t pnid, hda_nid_t nid,
PATCH 32/366 iommu/vt-d: Ratelimit each dmar fault printing
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Safonov <[email protected]>
commit 6c50d79f66382d78918a768374839d6d1b606d3f upstream.
There is a ratelimit for printing, but it's incremented each time the cpu recives dmar fault interrupt. While one interrupt may signal about *many* faults.
So, measuring the impact it turns out that reading/clearing one fault takes < 1 usec, and printing info about the fault takes ~170 msec.
Having in mind that maximum number of fault recording registers per remapping hardware unit is 256.. IRQ handler may run for (170*256) msec. And as fault-serving loop runs without a time limit, during servicing new faults may occur..
Ratelimit each fault printing rather than each irq printing.
BUG: spinlock lockup suspected on CPU#0, CliShell/9903 lock: 0xffffffff81a47440, .magic: dead4ead, .owner: kworker/u16:2/8915, .owner_cpu: 6 CPU: 0 PID: 9903 Comm: CliShell Call Trace:$\n' [..] dump_stack+0x65/0x83$\n' [..] spin_dump+0x8f/0x94$\n' [..] do_raw_spin_lock+0x123/0x170$\n' [..] _raw_spin_lock_irqsave+0x32/0x3a$\n' [..] uart_chars_in_buffer+0x20/0x4d$\n' [..] tty_chars_in_buffer+0x18/0x1d$\n' [..] n_tty_poll+0x1cb/0x1f2$\n' [..] tty_poll+0x5e/0x76$\n' [..] do_select+0x363/0x629$\n' [..] compat_core_sys_select+0x19e/0x239$\n' [..] compat_SyS_select+0x98/0xc0$\n' [..] sysenter_dispatch+0x7/0x25$\n' [..] NMI backtrace for cpu 6 CPU: 6 PID: 8915 Comm: kworker/u16:2 Workqueue: dmar_fault dmar_fault_work Call Trace:$\n' [..] wait_for_xmitr+0x26/0x8f$\n' [..] serial8250_console_putchar+0x1c/0x2c$\n' [..] uart_console_write+0x40/0x4b$\n' [..] serial8250_console_write+0xe6/0x13f$\n' [..] call_console_drivers.constprop.13+0xce/0x103$\n' [..] console_unlock+0x1f8/0x39b$\n' [..] vprintk_emit+0x39e/0x3e6$\n' [..] printk+0x4d/0x4f$\n' [..] dmar_fault+0x1a8/0x1fc$\n' [..] dmar_fault_work+0x15/0x17$\n' [..] process_one_work+0x1e8/0x3a9$\n' [..] worker_thread+0x25d/0x345$\n' [..] kthread+0xea/0xf2$\n' [..] ret_from_fork+0x58/0x90$\n'
--- drivers/iommu/dmar.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/iommu/dmar.c +3 -5
@@ -1483,17 +1483,13 @@ irqreturn_t dmar_fault(int irq, void *deint reg, fault_index;u32 fault_status;unsigned long flag; -bool ratelimited; static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); -/* Disable printing, simply clear the fault when ratelimited */ - ratelimited = !__ratelimit (&rs); -raw_spin_lock_irqsave (&iommu->register_lock, flag); fault_status =readl (iommu->reg +DMAR_FSTS_REG ); -if (fault_status && !ratelimited) +if (fault_status &&__ratelimit (&rs))pr_err ("DRHD: handling fault status reg %x\n" , fault_status);/* TBD: ignore advanced fault log currently */
@@ -1503,6 +1499,8 @@ irqreturn_t dmar_fault(int irq, void *de fault_index =dma_fsts_fault_record_index (fault_status); reg =cap_fault_reg_offset (iommu->cap);while (1 ) { +/* Disable printing, simply clear the fault when ratelimited */ +bool ratelimited = !__ratelimit (&rs);u8 fault_reason;u16 source_id;u64 guest_addr;
PATCH 33/366 powerpc/fadump: Unregister fadump on kexec down path.
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mahesh Salgaonkar <[email protected]>
commit 722cde76d68e8cc4f3de42e71c82fd40dea4f7b9 upstream.
Unregister fadump on kexec down path otherwise the fadump registration in new kexec-ed kernel complains that fadump is already registered. This makes new kernel to continue using fadump registered by previous kernel which may lead to invalid vmcore generation. Hence this patch fixes this issue by un-registering fadump in fadump_cleanup() which is called during kexec path so that new kernel can register fadump with new valid values.
--- arch/powerpc/kernel/fadump.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/kernel/fadump.c +3 -0
@@ -1025,6 +1025,9 @@ void fadump_cleanup(void)init_fadump_mem_struct (&fdm, fdm_active->cpu_state_data.destination_address);fadump_invalidate_dump (&fdm); + }else if (fw_dump.dump_registered) { +/* Un-register Firmware-assisted dump if it was registered. */ +fadump_unregister_dump (&fdm); } }
PATCH 34/366 spi: pxa2xx: check clk_prepare_enable() return value
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tobias Jordan <[email protected]>
commit 62bbc864d1946c715063bd481bff3641fd1324e2 upstream.
clk_prepare_enable() can fail, so its return value should be checked and acted upon.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/spi/spi-pxa2xx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/spi/spi-pxa2xx.c +13 -5
@@ -1182,7 +1182,9 @@ static int pxa2xx_spi_probe(struct platf }/* Enable SOC clock */ -clk_prepare_enable (ssp->clk); + status =clk_prepare_enable (ssp->clk); +if (status) + goto out_error_dma_irq_alloc; drv_data->max_clk_rate =clk_get_rate (ssp->clk);
@@ -1221,6 +1223,8 @@ static int pxa2xx_spi_probe(struct platf out_error_clock_enabled:clk_disable_unprepare (ssp->clk); + +out_error_dma_irq_alloc:pxa2xx_spi_dma_release (drv_data);free_irq (ssp->irq, drv_data);
@@ -1296,8 +1300,11 @@ static int pxa2xx_spi_resume(struct devipxa2xx_spi_dma_resume (drv_data);/* Enable the SSP clock */ -if (!pm_runtime_suspended (dev)) -clk_prepare_enable (ssp->clk); +if (!pm_runtime_suspended (dev)) { + status =clk_prepare_enable (ssp->clk); +if (status) +return status; + }/* Restore LPSS private register bits */ lpss_ssp_setup (drv_data);
@@ -1325,9 +1332,10 @@ static int pxa2xx_spi_runtime_suspend(ststatic int pxa2xx_spi_runtime_resume (struct device *dev) {struct driver_data *drv_data =dev_get_drvdata (dev); +int status; -clk_prepare_enable (drv_data->ssp->clk); -return 0 ; + status =clk_prepare_enable (drv_data->ssp->clk); +return status; }#endif
PATCH 35/366 nfsd: restrict rd_maxcount to svc_max_payload in nfsd_encode_readdir
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
commit 9c2ece6ef67e9d376f32823086169b489c422ed0 upstream.
nfsd4_readdir_rsize restricts rd_maxcount to svc_max_payload when estimating the size of the readdir reply, but nfsd_encode_readdir restricts it to INT_MAX when encoding the reply. This can result in log messages like "kernel: RPC request reserved 32896 but used 1049444".
Restrict rd_dircount similarly (no reason it should be larger than svc_max_payload).
--- fs/nfsd/nfs4xdr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/nfs4xdr.c +3 -2
@@ -3343,7 +3343,8 @@ nfsd4_encode_readdir(struct nfsd4_compou nfserr = nfserr_resource; goto err_no_verf; } - maxcount =min_t (u32, readdir->rd_maxcount,INT_MAX ); + maxcount =svc_max_payload (resp->rqstp); + maxcount =min_t (u32, readdir->rd_maxcount, maxcount);/* * Note the rfc defines rd_maxcount as the size of the * READDIR4resok structure, which includes the verifier above
@@ -3357,7 +3358,7 @@ nfsd4_encode_readdir(struct nfsd4_compou/* RFC 3530 14.2.24 allows us to ignore dircount when it's 0: */ if (!readdir->rd_dircount) - readdir->rd_dircount =INT_MAX ; + readdir->rd_dircount =svc_max_payload (resp->rqstp); readdir->xdr = xdr; readdir->rd_maxcount = maxcount;
PATCH 36/366 perf: fix invalid bit in diagnostic entry
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
commit 3c0a83b14ea71fef5ccc93a3bd2de5f892be3194 upstream.
The s390 CPU measurement facility sampling mode supports basic entries and diagnostic entries. Each entry has a valid bit to indicate the status of the entry as valid or invalid.
This bit is bit 31 in the diagnostic entry, but the bit mask definition refers to bit 30.
Fix this by making the reserved field one bit larger.
--- arch/s390/include/asm/cpu_mf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/cpu_mf.h +1 -1
@@ -118,7 +118,7 @@ struct hws_basic_entry {struct hws_diag_entry {unsigned int def:16 ;/* 0-15 Data Entry Format */ -unsigned int R:14 ;/* 16-19 and 20-30 reserved */ +unsigned int R:15 ;/* 16-19 and 20-30 reserved */ unsigned int I:1 ;/* 31 entry valid or invalid */ u8 data[];/* Machine-dependent sample data */ } __packed;
PATCH 37/366 s390/cpum_sf: Add data entry sizes to sampling trailer entry
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
commit 77715b7ddb446bd39a06f3376e85f4bb95b29bb8 upstream.
The CPU Measurement sampling facility creates a trailer entry for each Sample-Data-Block of stored samples. The trailer entry contains the sizes (in bytes) of the stored sampling types:
- basic-sampling data entry size
- diagnostic-sampling data entry size
Both sizes are 2 bytes long.
This patch changes the trailer entry definition to reflect this.
--- arch/s390/include/asm/cpu_mf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/s390/include/asm/cpu_mf.h +3 -1
@@ -134,7 +134,9 @@ struct hws_trailer_entry { unsigned int f:1; /* 0 - Block Full Indicator */ unsigned int a:1; /* 1 - Alert request control */ unsigned int t:1; /* 2 - Timestamp format */ - unsigned long long:61; /* 3 - 63: Reserved */ + unsigned int :29; /* 3 - 31: Reserved */ + unsigned int bsdes:16; /* 32-47: size of basic SDE */ + unsigned int dsdes:16; /* 48-63: size of diagnostic SDE */ };unsigned long long flags;/* 0 - 63: All indicators */ };
PATCH 38/366 PM / wakeup: Only update last time for active wakeup sources
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Doug Berger <[email protected]>
commit 2ef7c01c0cdb170142058c6d8fe0697aee4e4d7d upstream.
When wakelock support was added, the wakeup_source_add() function was updated to set the last_time value of the wakeup source. This has the unintended side effect of producing confusing output from pm_print_active_wakeup_sources() when a wakeup source is added prior to a sleep that is blocked by a different wakeup source.
The function pm_print_active_wakeup_sources() will search for the most recently active wakeup source when no active source is found. If a wakeup source is added after a different wakeup source blocks the system from going to sleep it may have a later last_time value than the blocking source and be output as the last active wakeup source even if it has never actually been active.
It looks to me like the change to wakeup_source_add() was made to prevent the wakelock garbage collection from accidentally dropping a wakelock during the narrow window between adding the wakelock to the wakelock list in wakelock_lookup_add() and the activation of the wakeup source in pm_wake_lock().
This commit changes the behavior so that only the last_time of the wakeup source used by a wakelock is initialized prior to adding it to the wakeup source list. This preserves the meaning of the last_time value as the last time the wakeup source was active and allows a wakeup source that has never been active to have a last_time value of 0.
--- drivers/base/power/wakeup.c | 1 - kernel/power/wakelock.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/wakeup.c +0 -1
@@ -135,7 +135,6 @@ void wakeup_source_add(struct wakeup_souspin_lock_init (&ws->lock);setup_timer (&ws->timer, pm_wakeup_timer_fn, (unsigned long )ws); ws->active = false; - ws->last_time =ktime_get ();spin_lock_irqsave (&events_lock, flags);list_add_rcu (&ws->entry, &wakeup_sources);
kernel/power/wakelock.c +1 -0
@@ -175,6 +175,7 @@ static struct wakelock *wakelock_lookup_return ERR_PTR (-ENOMEM ); } wl->ws.name = wl->name; + wl->ws.last_time =ktime_get ();wakeup_source_add (&wl->ws);rb_link_node (&wl->node, parent, node);rb_insert_color (&wl->node, &wakelocks_tree);
PATCH 39/366 clk: qcom: Base rcg parent rate off plan frequency
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Evan Green <[email protected]>
commit c7d2a0eb6c028ba064bfe92d7667977418142c7c upstream.
_freq_tbl_determine_rate uses the pre_div found in the clock plan multiplied by the requested rate from the caller to determine the best parent rate to set. If the requested rate is not exactly equal to the rate that was found in the clock plan, then using the requested rate in parent rate calculations is incorrect. For instance, if 150MHz was requested, but 200MHz was the match found, and that plan had a pre_div of 3, then the parent should be set to 600MHz, not 450MHz.
--- drivers/clk/qcom/clk-rcg2.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/clk-rcg2.c +1 -0
@@ -199,6 +199,7 @@ static long _freq_tbl_determine_rate(str clk_flags =__clk_get_flags (hw->clk); *p =clk_get_parent_by_index (hw->clk, f->src);if (clk_flags &CLK_SET_RATE_PARENT ) { + rate = f->freq;if (f->pre_div) { rate /=2 ; rate *= f->pre_div +1 ;
PATCH 40/366 powerpc/lib: Fix feature fixup test of external branch
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit 32810d91325ec76b8ef4df463f8a0e9baf353322 upstream.
The expected case for this test was wrong, the source of the alternate code sequence is:
FTR_SECTION_ELSE
2: or 2,2,2
PPC_LCMPI r3,1
beq 3f
blt 2b
b 3f
b 1b
ALT_FTR_SECTION_END(0, 1)
3: or 1,1,1
or 2,2,2
4: or 3,3,3
So when it's patched the '3' label should still be on the 'or 1,1,1', and the 4 label is irrelevant and can be removed.
--- arch/powerpc/lib/feature-fixups-test.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/lib/feature-fixups-test.S +2 -2
@@ -167,9 +167,9 @@ globl(ftr_fixup_test6_expected) blt 2b b 3f b 1b -2: or 1,1,1 +3: or 1,1,1 or 2,2,2 -3: or 3,3,3 + or 3,3,3 #if 0
PATCH 41/366 powerpc: make feature-fixup tests fortify-safe
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Axtens <[email protected]>
commit c69a48cdb301a18697bc8c9935baf4f32861cf9e upstream.
Testing the fortified string functions[1] would cause a kernel panic on boot in test_feature_fixups() due to a buffer overflow in memcmp.
This boils down to things like this:
extern unsigned int ftr_fixup_test1;
extern unsigned int ftr_fixup_test1_orig;
check(memcmp(&ftr_fixup_test1, &ftr_fixup_test1_orig, size) == 0);
We know that these are asm labels so it is safe to read up to 'size' bytes at those addresses.
However, because we have passed the address of a single unsigned int to memcmp, the compiler believes the underlying object is in fact a single unsigned int. So if size > sizeof(unsigned int), there will be a panic at runtime.
We can fix this by changing the types: instead of calling the asm labels unsigned ints, call them unsigned int[]s. Therefore the size isn't incorrectly determined at compile time and we get a regular unsafe memcmp and no panic.
[1] http://openwall.com/lists/kernel-hardening/2017/05/09/2
--- arch/powerpc/lib/feature-fixups.c | 180 +++++++++++++++--------------- 1 file changed, 90 insertions(+), 90 deletions(-)
arch/powerpc/lib/feature-fixups.c +90 -90
@@ -166,192 +166,192 @@ static long calc_offset(struct fixup_entvoid test_basic_patching (void ) { -extern unsigned int ftr_fixup_test1; -extern unsigned int end_ftr_fixup_test1; -extern unsigned int ftr_fixup_test1_orig; -extern unsigned int ftr_fixup_test1_expected; -int size = &end_ftr_fixup_test1 - &ftr_fixup_test1; +extern unsigned int ftr_fixup_test1[]; +extern unsigned int end_ftr_fixup_test1[]; +extern unsigned int ftr_fixup_test1_orig[]; +extern unsigned int ftr_fixup_test1_expected[]; +int size = end_ftr_fixup_test1 - ftr_fixup_test1; fixup.value = fixup.mask =8 ; - fixup.start_off =calc_offset (&fixup, &ftr_fixup_test1 +1 ); - fixup.end_off =calc_offset (&fixup, &ftr_fixup_test1 +2 ); + fixup.start_off =calc_offset (&fixup, ftr_fixup_test1 +1 ); + fixup.end_off =calc_offset (&fixup, ftr_fixup_test1 +2 ); fixup.alt_start_off = fixup.alt_end_off =0 ;/* Sanity check */ -check (memcmp (&ftr_fixup_test1, &ftr_fixup_test1_orig, size) ==0 ); +check (memcmp (ftr_fixup_test1, ftr_fixup_test1_orig, size) ==0 );/* Check we don't patch if the value matches */ patch_feature_section (8 , &fixup); -check (memcmp (&ftr_fixup_test1, &ftr_fixup_test1_orig, size) ==0 ); +check (memcmp (ftr_fixup_test1, ftr_fixup_test1_orig, size) ==0 );/* Check we do patch if the value doesn't match */ patch_feature_section (0 , &fixup); -check (memcmp (&ftr_fixup_test1, &ftr_fixup_test1_expected, size) ==0 ); +check (memcmp (ftr_fixup_test1, ftr_fixup_test1_expected, size) ==0 );/* Check we do patch if the mask doesn't match */ -memcpy (&ftr_fixup_test1, &ftr_fixup_test1_orig, size); -check (memcmp (&ftr_fixup_test1, &ftr_fixup_test1_orig, size) ==0 ); +memcpy (ftr_fixup_test1, ftr_fixup_test1_orig, size); +check (memcmp (ftr_fixup_test1, ftr_fixup_test1_orig, size) ==0 );patch_feature_section (~8 , &fixup); -check (memcmp (&ftr_fixup_test1, &ftr_fixup_test1_expected, size) ==0 ); +check (memcmp (ftr_fixup_test1, ftr_fixup_test1_expected, size) ==0 ); }static void test_alternative_patching (void ) { -extern unsigned int ftr_fixup_test2; -extern unsigned int end_ftr_fixup_test2; -extern unsigned int ftr_fixup_test2_orig; -extern unsigned int ftr_fixup_test2_alt; -extern unsigned int ftr_fixup_test2_expected; -int size = &end_ftr_fixup_test2 - &ftr_fixup_test2; +extern unsigned int ftr_fixup_test2[]; +extern unsigned int end_ftr_fixup_test2[]; +extern unsigned int ftr_fixup_test2_orig[]; +extern unsigned int ftr_fixup_test2_alt[]; +extern unsigned int ftr_fixup_test2_expected[]; +int size = end_ftr_fixup_test2 - ftr_fixup_test2; fixup.value = fixup.mask =0xF ; - fixup.start_off =calc_offset (&fixup, &ftr_fixup_test2 +1 ); - fixup.end_off =calc_offset (&fixup, &ftr_fixup_test2 +2 ); - fixup.alt_start_off =calc_offset (&fixup, &ftr_fixup_test2_alt); - fixup.alt_end_off =calc_offset (&fixup, &ftr_fixup_test2_alt +1 ); + fixup.start_off =calc_offset (&fixup, ftr_fixup_test2 +1 ); + fixup.end_off =calc_offset (&fixup, ftr_fixup_test2 +2 ); + fixup.alt_start_off =calc_offset (&fixup, ftr_fixup_test2_alt); + fixup.alt_end_off =calc_offset (&fixup, ftr_fixup_test2_alt +1 );/* Sanity check */ -check (memcmp (&ftr_fixup_test2, &ftr_fixup_test2_orig, size) ==0 ); +check (memcmp (ftr_fixup_test2, ftr_fixup_test2_orig, size) ==0 );/* Check we don't patch if the value matches */ patch_feature_section (0xF , &fixup); -check (memcmp (&ftr_fixup_test2, &ftr_fixup_test2_orig, size) ==0 ); +check (memcmp (ftr_fixup_test2, ftr_fixup_test2_orig, size) ==0 );/* Check we do patch if the value doesn't match */ patch_feature_section (0 , &fixup); -check (memcmp (&ftr_fixup_test2, &ftr_fixup_test2_expected, size) ==0 ); +check (memcmp (ftr_fixup_test2, ftr_fixup_test2_expected, size) ==0 );/* Check we do patch if the mask doesn't match */ -memcpy (&ftr_fixup_test2, &ftr_fixup_test2_orig, size); -check (memcmp (&ftr_fixup_test2, &ftr_fixup_test2_orig, size) ==0 ); +memcpy (ftr_fixup_test2, ftr_fixup_test2_orig, size); +check (memcmp (ftr_fixup_test2, ftr_fixup_test2_orig, size) ==0 );patch_feature_section (~0xF , &fixup); -check (memcmp (&ftr_fixup_test2, &ftr_fixup_test2_expected, size) ==0 ); +check (memcmp (ftr_fixup_test2, ftr_fixup_test2_expected, size) ==0 ); }static void test_alternative_case_too_big (void ) { -extern unsigned int ftr_fixup_test3; -extern unsigned int end_ftr_fixup_test3; -extern unsigned int ftr_fixup_test3_orig; -extern unsigned int ftr_fixup_test3_alt; -int size = &end_ftr_fixup_test3 - &ftr_fixup_test3; +extern unsigned int ftr_fixup_test3[]; +extern unsigned int end_ftr_fixup_test3[]; +extern unsigned int ftr_fixup_test3_orig[]; +extern unsigned int ftr_fixup_test3_alt[]; +int size = end_ftr_fixup_test3 - ftr_fixup_test3; fixup.value = fixup.mask =0xC ; - fixup.start_off =calc_offset (&fixup, &ftr_fixup_test3 +1 ); - fixup.end_off =calc_offset (&fixup, &ftr_fixup_test3 +2 ); - fixup.alt_start_off =calc_offset (&fixup, &ftr_fixup_test3_alt); - fixup.alt_end_off =calc_offset (&fixup, &ftr_fixup_test3_alt +2 ); + fixup.start_off =calc_offset (&fixup, ftr_fixup_test3 +1 ); + fixup.end_off =calc_offset (&fixup, ftr_fixup_test3 +2 ); + fixup.alt_start_off =calc_offset (&fixup, ftr_fixup_test3_alt); + fixup.alt_end_off =calc_offset (&fixup, ftr_fixup_test3_alt +2 );/* Sanity check */ -check (memcmp (&ftr_fixup_test3, &ftr_fixup_test3_orig, size) ==0 ); +check (memcmp (ftr_fixup_test3, ftr_fixup_test3_orig, size) ==0 );/* Expect nothing to be patched, and the error returned to us */ check (patch_feature_section (0xF , &fixup) ==1 ); -check (memcmp (&ftr_fixup_test3, &ftr_fixup_test3_orig, size) ==0 ); +check (memcmp (ftr_fixup_test3, ftr_fixup_test3_orig, size) ==0 );check (patch_feature_section (0 , &fixup) ==1 ); -check (memcmp (&ftr_fixup_test3, &ftr_fixup_test3_orig, size) ==0 ); +check (memcmp (ftr_fixup_test3, ftr_fixup_test3_orig, size) ==0 );check (patch_feature_section (~0xF , &fixup) ==1 ); -check (memcmp (&ftr_fixup_test3, &ftr_fixup_test3_orig, size) ==0 ); +check (memcmp (ftr_fixup_test3, ftr_fixup_test3_orig, size) ==0 ); }static void test_alternative_case_too_small (void ) { -extern unsigned int ftr_fixup_test4; -extern unsigned int end_ftr_fixup_test4; -extern unsigned int ftr_fixup_test4_orig; -extern unsigned int ftr_fixup_test4_alt; -extern unsigned int ftr_fixup_test4_expected; -int size = &end_ftr_fixup_test4 - &ftr_fixup_test4; +extern unsigned int ftr_fixup_test4[]; +extern unsigned int end_ftr_fixup_test4[]; +extern unsigned int ftr_fixup_test4_orig[]; +extern unsigned int ftr_fixup_test4_alt[]; +extern unsigned int ftr_fixup_test4_expected[]; +int size = end_ftr_fixup_test4 - ftr_fixup_test4;unsigned long flag;/* Check a high-bit flag */ flag =1UL << ((sizeof (unsigned long ) -1 ) *8 ); fixup.value = fixup.mask = flag; - fixup.start_off =calc_offset (&fixup, &ftr_fixup_test4 +1 ); - fixup.end_off =calc_offset (&fixup, &ftr_fixup_test4 +5 ); - fixup.alt_start_off =calc_offset (&fixup, &ftr_fixup_test4_alt); - fixup.alt_end_off =calc_offset (&fixup, &ftr_fixup_test4_alt +2 ); + fixup.start_off =calc_offset (&fixup, ftr_fixup_test4 +1 ); + fixup.end_off =calc_offset (&fixup, ftr_fixup_test4 +5 ); + fixup.alt_start_off =calc_offset (&fixup, ftr_fixup_test4_alt); + fixup.alt_end_off =calc_offset (&fixup, ftr_fixup_test4_alt +2 );/* Sanity check */ -check (memcmp (&ftr_fixup_test4, &ftr_fixup_test4_orig, size) ==0 ); +check (memcmp (ftr_fixup_test4, ftr_fixup_test4_orig, size) ==0 );/* Check we don't patch if the value matches */ patch_feature_section (flag, &fixup); -check (memcmp (&ftr_fixup_test4, &ftr_fixup_test4_orig, size) ==0 ); +check (memcmp (ftr_fixup_test4, ftr_fixup_test4_orig, size) ==0 );/* Check we do patch if the value doesn't match */ patch_feature_section (0 , &fixup); -check (memcmp (&ftr_fixup_test4, &ftr_fixup_test4_expected, size) ==0 ); +check (memcmp (ftr_fixup_test4, ftr_fixup_test4_expected, size) ==0 );/* Check we do patch if the mask doesn't match */ -memcpy (&ftr_fixup_test4, &ftr_fixup_test4_orig, size); -check (memcmp (&ftr_fixup_test4, &ftr_fixup_test4_orig, size) ==0 ); +memcpy (ftr_fixup_test4, ftr_fixup_test4_orig, size); +check (memcmp (ftr_fixup_test4, ftr_fixup_test4_orig, size) ==0 );patch_feature_section (~flag, &fixup); -check (memcmp (&ftr_fixup_test4, &ftr_fixup_test4_expected, size) ==0 ); +check (memcmp (ftr_fixup_test4, ftr_fixup_test4_expected, size) ==0 ); }static void test_alternative_case_with_branch (void ) { -extern unsigned int ftr_fixup_test5; -extern unsigned int end_ftr_fixup_test5; -extern unsigned int ftr_fixup_test5_expected; -int size = &end_ftr_fixup_test5 - &ftr_fixup_test5; +extern unsigned int ftr_fixup_test5[]; +extern unsigned int end_ftr_fixup_test5[]; +extern unsigned int ftr_fixup_test5_expected[]; +int size = end_ftr_fixup_test5 - ftr_fixup_test5; -check (memcmp (&ftr_fixup_test5, &ftr_fixup_test5_expected, size) ==0 ); +check (memcmp (ftr_fixup_test5, ftr_fixup_test5_expected, size) ==0 ); }static void test_alternative_case_with_external_branch (void ) { -extern unsigned int ftr_fixup_test6; -extern unsigned int end_ftr_fixup_test6; -extern unsigned int ftr_fixup_test6_expected; -int size = &end_ftr_fixup_test6 - &ftr_fixup_test6; +extern unsigned int ftr_fixup_test6[]; +extern unsigned int end_ftr_fixup_test6[]; +extern unsigned int ftr_fixup_test6_expected[]; +int size = end_ftr_fixup_test6 - ftr_fixup_test6; -check (memcmp (&ftr_fixup_test6, &ftr_fixup_test6_expected, size) ==0 ); +check (memcmp (ftr_fixup_test6, ftr_fixup_test6_expected, size) ==0 ); }static void test_cpu_macros (void ) { -extern u8 ftr_fixup_test_FTR_macros; -extern u8 ftr_fixup_test_FTR_macros_expected; -unsigned long size = &ftr_fixup_test_FTR_macros_expected - - &ftr_fixup_test_FTR_macros; +extern u8 ftr_fixup_test_FTR_macros[]; +extern u8 ftr_fixup_test_FTR_macros_expected[]; +unsigned long size = ftr_fixup_test_FTR_macros_expected - + ftr_fixup_test_FTR_macros;/* The fixups have already been done for us during boot */ -check (memcmp (&ftr_fixup_test_FTR_macros, - &ftr_fixup_test_FTR_macros_expected, size) ==0 ); +check (memcmp (ftr_fixup_test_FTR_macros, + ftr_fixup_test_FTR_macros_expected, size) ==0 ); }static void test_fw_macros (void ) {#ifdef CONFIG_PPC64 -extern u8 ftr_fixup_test_FW_FTR_macros; -extern u8 ftr_fixup_test_FW_FTR_macros_expected; -unsigned long size = &ftr_fixup_test_FW_FTR_macros_expected - - &ftr_fixup_test_FW_FTR_macros; +extern u8 ftr_fixup_test_FW_FTR_macros[]; +extern u8 ftr_fixup_test_FW_FTR_macros_expected[]; +unsigned long size = ftr_fixup_test_FW_FTR_macros_expected - + ftr_fixup_test_FW_FTR_macros;/* The fixups have already been done for us during boot */ -check (memcmp (&ftr_fixup_test_FW_FTR_macros, - &ftr_fixup_test_FW_FTR_macros_expected, size) ==0 ); +check (memcmp (ftr_fixup_test_FW_FTR_macros, + ftr_fixup_test_FW_FTR_macros_expected, size) ==0 );#endif }static void test_lwsync_macros (void ) { -extern u8 lwsync_fixup_test; -extern u8 end_lwsync_fixup_test; -extern u8 lwsync_fixup_test_expected_LWSYNC; -extern u8 lwsync_fixup_test_expected_SYNC; -unsigned long size = &end_lwsync_fixup_test - - &lwsync_fixup_test; +extern u8 lwsync_fixup_test[]; +extern u8 end_lwsync_fixup_test[]; +extern u8 lwsync_fixup_test_expected_LWSYNC[]; +extern u8 lwsync_fixup_test_expected_SYNC[]; +unsigned long size = end_lwsync_fixup_test - + lwsync_fixup_test;/* The fixups have already been done for us during boot */ if (cur_cpu_spec->cpu_features &CPU_FTR_LWSYNC ) { -check (memcmp (&lwsync_fixup_test, - &lwsync_fixup_test_expected_LWSYNC, size) ==0 ); +check (memcmp (lwsync_fixup_test, + lwsync_fixup_test_expected_LWSYNC, size) ==0 ); }else { -check (memcmp (&lwsync_fixup_test, - &lwsync_fixup_test_expected_SYNC, size) ==0 ); +check (memcmp (lwsync_fixup_test, + lwsync_fixup_test_expected_SYNC, size) ==0 ); } }
PATCH 42/366 powerpc/lib: Fix the feature fixup tests to actually work
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
commit cad0e39023b43d94d5e38dfd55c103e15bdd093d upstream.
The code patching code has always been a bit confused about whether it's best to use void *, unsigned int *, char *, etc. to point to instructions. In fact in the feature fixups tests we use both unsigned int[] and u8[] in different places.
Unfortunately the tests that use unsigned int[] calculate the size of the code blocks using subtraction of those unsigned int pointers, and then pass the result to memcmp(). This means we're only comparing 1/4 of the bytes we need to, because we need to multiply by sizeof(unsigned int) to get the number of *bytes*.
The result is that the tests do all the patching and then only compare some of the resulting code, so patching bugs that only effect that last 3/4 of the code could slip through undetected. It turns out that hasn't been happening, although one test had a bad expected case (see previous commit).
Fix it for now by multiplying the size by 4 in the affected functions.
--- arch/powerpc/lib/feature-fixups.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/lib/feature-fixups.c +6 -6
@@ -170,7 +170,7 @@ void test_basic_patching(void)extern unsigned int end_ftr_fixup_test1[];extern unsigned int ftr_fixup_test1_orig[];extern unsigned int ftr_fixup_test1_expected[]; -int size = end_ftr_fixup_test1 - ftr_fixup_test1; +int size =4 * (end_ftr_fixup_test1 - ftr_fixup_test1); fixup.value = fixup.mask =8 ; fixup.start_off =calc_offset (&fixup, ftr_fixup_test1 +1 );
@@ -202,7 +202,7 @@ static void test_alternative_patching(voextern unsigned int ftr_fixup_test2_orig[];extern unsigned int ftr_fixup_test2_alt[];extern unsigned int ftr_fixup_test2_expected[]; -int size = end_ftr_fixup_test2 - ftr_fixup_test2; +int size =4 * (end_ftr_fixup_test2 - ftr_fixup_test2); fixup.value = fixup.mask =0xF ; fixup.start_off =calc_offset (&fixup, ftr_fixup_test2 +1 );
@@ -234,7 +234,7 @@ static void test_alternative_case_too_biextern unsigned int end_ftr_fixup_test3[];extern unsigned int ftr_fixup_test3_orig[];extern unsigned int ftr_fixup_test3_alt[]; -int size = end_ftr_fixup_test3 - ftr_fixup_test3; +int size =4 * (end_ftr_fixup_test3 - ftr_fixup_test3); fixup.value = fixup.mask =0xC ; fixup.start_off =calc_offset (&fixup, ftr_fixup_test3 +1 );
@@ -261,7 +261,7 @@ static void test_alternative_case_too_smextern unsigned int ftr_fixup_test4_orig[];extern unsigned int ftr_fixup_test4_alt[];extern unsigned int ftr_fixup_test4_expected[]; -int size = end_ftr_fixup_test4 - ftr_fixup_test4; +int size =4 * (end_ftr_fixup_test4 - ftr_fixup_test4);unsigned long flag;/* Check a high-bit flag */
@@ -295,7 +295,7 @@ static void test_alternative_case_with_bextern unsigned int ftr_fixup_test5[];extern unsigned int end_ftr_fixup_test5[];extern unsigned int ftr_fixup_test5_expected[]; -int size = end_ftr_fixup_test5 - ftr_fixup_test5; +int size =4 * (end_ftr_fixup_test5 - ftr_fixup_test5);check (memcmp (ftr_fixup_test5, ftr_fixup_test5_expected, size) ==0 ); }
@@ -305,7 +305,7 @@ static void test_alternative_case_with_eextern unsigned int ftr_fixup_test6[];extern unsigned int end_ftr_fixup_test6[];extern unsigned int ftr_fixup_test6_expected[]; -int size = end_ftr_fixup_test6 - ftr_fixup_test6; +int size =4 * (end_ftr_fixup_test6 - ftr_fixup_test6);check (memcmp (ftr_fixup_test6, ftr_fixup_test6_expected, size) ==0 ); }
PATCH 43/366 ext4: update mtime in ext4_punch_hole even if no blocks are released
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Czerner <[email protected]>
commit eee597ac931305eff3d3fd1d61d6aae553bc0984 upstream.
Currently in ext4_punch_hole we're going to skip the mtime update if there are no actual blocks to release. However we've actually modified the file by zeroing the partial block so the mtime should be updated.
Moreover the sync and datasync handling is skipped as well, which is also wrong. Fix it.
--- fs/ext4/inode.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
fs/ext4/inode.c +20 -20
@@ -3749,28 +3749,28 @@ int ext4_punch_hole(struct inode *inode,EXT4_BLOCK_SIZE_BITS (sb); stop_block = (offset + length) >>EXT4_BLOCK_SIZE_BITS (sb); -/* If there are no blocks to remove, return now */ -if (first_block >= stop_block) - goto out_stop; - -down_write (&EXT4_I (inode)->i_data_sem); -ext4_discard_preallocations (inode); - - ret =ext4_es_remove_extent (inode, first_block, - stop_block - first_block); -if (ret) { -up_write (&EXT4_I (inode)->i_data_sem); - goto out_stop; - } +/* If there are blocks to remove, do it */ +if (stop_block > first_block) { + +down_write (&EXT4_I (inode)->i_data_sem); +ext4_discard_preallocations (inode); -if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )) - ret =ext4_ext_remove_space (inode, first_block, - stop_block -1 ); -else - ret =ext4_ind_remove_space (handle, inode, first_block, - stop_block); + ret =ext4_es_remove_extent (inode, first_block, + stop_block - first_block); +if (ret) { +up_write (&EXT4_I (inode)->i_data_sem); + goto out_stop; + } + +if (ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )) + ret =ext4_ext_remove_space (inode, first_block, + stop_block -1 ); +else + ret =ext4_ind_remove_space (handle, inode, first_block, + stop_block); -up_write (&EXT4_I (inode)->i_data_sem); +up_write (&EXT4_I (inode)->i_data_sem); + }if (IS_SYNC (inode))ext4_handle_sync (handle);
PATCH 44/366 ext4: factor out helper ext4_sample_last_mounted()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit 833a950882d33a7dfc319d5e152fdf35028936eb upstream.
[bwh: Backported to 3.16:
- Move up declaration of ret in ext4_file_open()
- Adjust context]
--- fs/ext4/file.c | 82 ++++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 36 deletions(-)
fs/ext4/file.c +49 -37
@@ -208,52 +208,64 @@ static int ext4_file_mmap(struct file *freturn 0 ; } -static int ext4_file_open (struct inode * inode,struct file * filp) +static int ext4_sample_last_mounted (struct super_block *sb, +struct vfsmount *mnt) { -struct super_block *sb = inode->i_sb; -struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb); -struct vfsmount *mnt = filp->f_path.mnt; +struct ext4_sb_info *sbi =EXT4_SB (sb);struct path path;char buf[64 ], *cp; +handle_t *handle; +int err; + +if (likely (sbi->s_mount_flags &EXT4_MF_MNTDIR_SAMPLED )) +return 0 ; + +if (sb->s_flags &MS_RDONLY ) +return 0 ; + + sbi->s_mount_flags |=EXT4_MF_MNTDIR_SAMPLED ; +/* +* Sample where the filesystem has been mounted and +* store it in the superblock for sysadmin convenience +* when trying to sort through large numbers of block +* devices or filesystem images. +*/ +memset (buf,0 ,sizeof (buf)); + path.mnt = mnt; + path.dentry = mnt->mnt_root; + cp =d_path (&path, buf,sizeof (buf)); +if (IS_ERR (cp)) +return 0 ; + + handle =ext4_journal_start_sb (sb,EXT4_HT_MISC ,1 ); +if (IS_ERR (handle)) +return PTR_ERR (handle); +BUFFER_TRACE (sbi->s_sbh,"get_write_access" ); + err =ext4_journal_get_write_access (handle, sbi->s_sbh); +if (err) + goto out; +strlcpy (sbi->s_es->s_last_mounted, cp, +sizeof (sbi->s_es->s_last_mounted)); +ext4_handle_dirty_super (handle, sb); +out: +ext4_journal_stop (handle); +return err; +} + +static int ext4_file_open (struct inode * inode,struct file * filp) +{ +int ret; + + ret =ext4_sample_last_mounted (inode->i_sb, filp->f_path.mnt); +if (ret) +return ret; -if (unlikely (!(sbi->s_mount_flags &EXT4_MF_MNTDIR_SAMPLED ) && - !(sb->s_flags &MS_RDONLY ))) { - sbi->s_mount_flags |=EXT4_MF_MNTDIR_SAMPLED ; -/* -* Sample where the filesystem has been mounted and -* store it in the superblock for sysadmin convenience -* when trying to sort through large numbers of block -* devices or filesystem images. -*/ -memset (buf,0 ,sizeof (buf)); - path.mnt = mnt; - path.dentry = mnt->mnt_root; - cp =d_path (&path, buf,sizeof (buf)); -if (!IS_ERR (cp)) { -handle_t *handle; -int err; - - handle =ext4_journal_start_sb (sb,EXT4_HT_MISC ,1 ); -if (IS_ERR (handle)) -return PTR_ERR (handle); -BUFFER_TRACE (sbi->s_sbh,"get_write_access" ); - err =ext4_journal_get_write_access (handle, sbi->s_sbh); -if (err) { -ext4_journal_stop (handle); -return err; - } -strlcpy (sbi->s_es->s_last_mounted, cp, -sizeof (sbi->s_es->s_last_mounted)); -ext4_handle_dirty_super (handle, sb); -ext4_journal_stop (handle); - } - }/* * Set up the jbd2_inode if we are opening the inode for * writing and the journal is present */ if (filp->f_mode &FMODE_WRITE ) { -int ret =ext4_inode_attach_jinode (inode); + ret =ext4_inode_attach_jinode (inode);if (ret <0 )return ret; }
PATCH 45/366 vfs: add the sb_start_intwrite_trylock() helper
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit 0c8e3fe35db9b66ae0030849545030ec7c0fc45c upstream.
Needed by ext4 to test frozen fs before updating s_last_mounted.
--- include/linux/fs.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/fs.h +5 -0
@@ -1389,6 +1389,11 @@ static inline void sb_start_intwrite(str__sb_start_write (sb,SB_FREEZE_FS , true); } +static inline int sb_start_intwrite_trylock (struct super_block *sb) +{ +return __sb_start_write (sb,SB_FREEZE_FS , false); +} +extern bool inode_owner_or_capable (const struct inode *inode);
PATCH 46/366 ext4: do not update s_last_mounted of a frozen fs
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
commit db6516a5e7ddb6dc72d167b920f2f272596ea22d upstream.
If fs is frozen after mount and before the first file open, the update of s_last_mounted bypasses freeze protection and prints out a WARNING splat:
$ mount /vdf $ fsfreeze -f /vdf $ cat /vdf/foo
[ 31.578555] WARNING: CPU: 1 PID: 1415 at
fs/ext4/ext4_jbd2.c:53 ext4_journal_check_start+0x48/0x82
[ 31.614016] Call Trace: [ 31.614997] __ext4_journal_start_sb+0xe4/0x1a4 [ 31.616771] ? ext4_file_open+0xb6/0x189 [ 31.618094] ext4_file_open+0xb6/0x189
If fs is frozen, skip s_last_mounted update.
[backport hint: to apply to stable tree, need to apply also patches
vfs: add the sb_start_intwrite_trylock() helper
ext4: factor out helper ext4_sample_last_mounted()]
--- fs/ext4/file.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
fs/ext4/file.c +9 -5
@@ -220,7 +220,7 @@ static int ext4_sample_last_mounted(struif (likely (sbi->s_mount_flags &EXT4_MF_MNTDIR_SAMPLED ))return 0 ; -if (sb->s_flags &MS_RDONLY ) +if (sb->s_flags &MS_RDONLY || !sb_start_intwrite_trylock (sb))return 0 ; sbi->s_mount_flags |=EXT4_MF_MNTDIR_SAMPLED ;
@@ -234,21 +234,25 @@ static int ext4_sample_last_mounted(stru path.mnt = mnt; path.dentry = mnt->mnt_root; cp =d_path (&path, buf,sizeof (buf)); + err =0 ;if (IS_ERR (cp)) -return 0 ; + goto out; handle =ext4_journal_start_sb (sb,EXT4_HT_MISC ,1 ); + err =PTR_ERR (handle);if (IS_ERR (handle)) -return PTR_ERR (handle); + goto out;BUFFER_TRACE (sbi->s_sbh,"get_write_access" ); err =ext4_journal_get_write_access (handle, sbi->s_sbh);if (err) - goto out; + goto out_journal;strlcpy (sbi->s_es->s_last_mounted, cp,sizeof (sbi->s_es->s_last_mounted));ext4_handle_dirty_super (handle, sb); -out: +out_journal:ext4_journal_stop (handle); +out: +sb_end_intwrite (sb);return err; }
PATCH 47/366 tty: pl011: Avoid spuriously stuck-off interrupts
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Martin <[email protected]>
commit 4a7e625ce50412a7711efa0f2ef0b96ce3826759 upstream.
Commit 9b96fbacda34 ("serial: PL011: clear pending interrupts") clears the RX and receive timeout interrupts on pl011 startup, to avoid a screaming-interrupt scenario that can occur when the firmware or bootloader leaves these interrupts asserted.
This has been noted as an issue when running Linux on qemu [1].
Unfortunately, the above fix seems to lead to potential misbehaviour if the RX FIFO interrupt is asserted _non_ spuriously on driver startup, if the RX FIFO is also already full to the trigger level.
Clearing the RX FIFO interrupt does not change the FIFO fill level. In this scenario, because the interrupt is now clear and because the FIFO is already full to the trigger level, no new assertion of the RX FIFO interrupt can occur unless the FIFO is drained back below the trigger level. This never occurs because the pl011 driver is waiting for an RX FIFO interrupt to tell it that there is something to read, and does not read the FIFO at all until that interrupt occurs.
Thus, simply clearing "spurious" interrupts on startup may be misguided, since there is no way to be sure that the interrupts are truly spurious, and things can go wrong if they are not.
This patch instead clears the interrupt condition by draining the RX FIFO during UART startup, after clearing any potentially spurious interrupt. This should ensure that an interrupt will definitely be asserted if the RX FIFO subsequently becomes sufficiently full.
The drain is done at the point of enabling interrupts only. This means that it will occur any time the UART is newly opened through the tty layer. It will not apply to polled-mode use of the UART by
kgdboc: since that scenario cannot use interrupts by design, this should not matter. kgdboc will interact badly with "normal" use of the UART in any case: this patch makes no attempt to paper over such issues.
This patch does not attempt to address the case where the RX FIFO fills faster than it can be drained: that is a pathological hardware design problem that is beyond the scope of the driver to work around. As a failsafe, the number of poll iterations for draining the FIFO is limited to twice the FIFO size. This will ensure that the kernel at least boots even if it is impossible to drain the FIFO for some reason.
[1] [Qemu-devel] [Qemu-arm] [PATCH] pl011: do not put into fifo before enabled the interruption
https://lists.gnu.org/archive/html/qemu-devel/2018-01/msg06446.html
[bwh: Backported to 3.16:
- Open-code pl011_read()
- s/REG_/UART01x_/
- Adjust context]
--- drivers/tty/serial/amba-pl011.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/tty/serial/amba-pl011.c +15 -0
@@ -1531,6 +1531,7 @@ static int pl011_startup(struct uart_porstruct uart_amba_port *uap = (struct uart_amba_port *)port;unsigned int cr, lcr_h, fbrd, ibrd;int retval; +unsigned int i; retval =pl011_hwinit (port);if (retval)
@@ -1595,6 +1596,20 @@ static int pl011_startup(struct uart_por/* Clear out any spuriously appearing RX interrupts */ writew (UART011_RTIS |UART011_RXIS , uap->port.membase +UART011_ICR ); + +/* +* RXIS is asserted only when the RX FIFO transitions from below +* to above the trigger threshold. If the RX FIFO is already +* full to the threshold this can't happen and RXIS will now be +* stuck off. Drain the RX FIFO explicitly to fix this: +*/ +for (i =0 ; i < uap->fifosize *2 ; ++i) { +if (readw (uap->port.membase + UART01x_FR) & UART01x_FR_RXFE) +break ; + +readw (uap->port.membase + UART01x_DR); + } + uap->im =UART011_RTIM ;if (!pl011_dma_rx_running (uap)) uap->im |=UART011_RXIM ;
PATCH 48/366 w1: mxc_w1: Enable clock before calling clk_get_rate() on it
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Potyra <[email protected]>
commit 955bc61328dc0a297fb3baccd84e9d3aee501ed8 upstream.
According to the API, you may only call clk_get_rate() after actually enabling it.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/w1/masters/mxc_w1.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/w1/masters/mxc_w1.c +13 -7
@@ -111,6 +111,10 @@ static int mxc_w1_probe(struct platform_if (IS_ERR (mdev->clk))return PTR_ERR (mdev->clk); + err =clk_prepare_enable (mdev->clk); +if (err) +return err; + clkrate =clk_get_rate (mdev->clk);if (clkrate <10000000 ) dev_warn(&pdev->dev,
@@ -124,12 +128,10 @@ static int mxc_w1_probe(struct platform_ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); mdev->regs =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (mdev->regs)) -return PTR_ERR (mdev->regs); - - err =clk_prepare_enable (mdev->clk); -if (err) -return err; +if (IS_ERR (mdev->regs)) { + err =PTR_ERR (mdev->regs); + goto out_disable_clk; + }writeb (clkdiv -1 , mdev->regs +MXC_W1_TIME_DIVIDER );
@@ -141,8 +143,12 @@ static int mxc_w1_probe(struct platform_ err =w1_add_master_device (&mdev->bus_master);if (err) -clk_disable_unprepare (mdev->clk); + goto out_disable_clk; + +return 0 ; +out_disable_clk: +clk_disable_unprepare (mdev->clk);return err; }
PATCH 49/366 w1: support auto-load of w1_bq27000 module.
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 4b7e4f8289c1ca60accb6c1baf31984f69bc2771 upstream.
1/ change request_module call to zero-pad single digit
family numbers. This appears to be the intention of the code, but not what it actually does.
This means that the alias created for W1_FAMILY_SMEM_01 might actually be useful.
2/ Define a family name for the BQ27000 battery charge monitor.
Unfortunately this is the same number as W1_FAMILY_SMEM_01 so if both a compiled on a system, one module might need to be blacklisted.
3/ Add a MODULE_ALIAS for the bq27000.
--- drivers/w1/slaves/w1_bq27000.c | 4 ++-- drivers/w1/w1.c | 2 +- drivers/w1/w1_family.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/w1/slaves/w1_bq27000.c +2 -2
@@ -88,7 +88,7 @@ static struct w1_family_ops w1_bq27000_f };static struct w1_family w1_bq27000_family = { - .fid =1 , + .fid =W1_FAMILY_BQ27000 , .fops = &w1_bq27000_fops, };
@@ -111,7 +111,7 @@ module_exit(w1_bq27000_exit);module_param (F_ID , int,S_IRUSR );MODULE_PARM_DESC (F_ID ,"1-wire slave FID for BQ device" ); - +MODULE_ALIAS ("w1-family-" __stringify(W1_FAMILY_BQ27000 ));MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Texas Instruments Ltd" );MODULE_DESCRIPTION ("HDQ/1-wire slave driver bq27000 battery monitor chip" );
drivers/w1/w1.c +1 -1
@@ -727,7 +727,7 @@ int w1_attach_slave_device(struct w1_mas/* slave modules need to be loaded in a context with unlocked mutex */ mutex_unlock (&dev->mutex); -request_module ("w1-family-0x%0x" , rn->family); +request_module ("w1-family-0x%02x" , rn->family);mutex_lock (&dev->mutex);spin_lock (&w1_flock);
drivers/w1/w1_family.h +1 -0
@@ -27,6 +27,7 @@#include <linux/atomic.h> #define W1_FAMILY_DEFAULT 0 +#define W1_FAMILY_BQ27000 0x01#define W1_FAMILY_SMEM_01 0x01#define W1_FAMILY_SMEM_81 0x81#define W1_THERM_DS18S20 0x10
PATCH 50/366 1wire: family module autoload fails because of upper/lower case mismatch.
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Flaschberger <[email protected]>
commit 065c09563c872e52813a17218c52cd642be1dca6 upstream.
1wire family module autoload fails because of upper/lower
case mismatch.
--- drivers/w1/w1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/w1/w1.c +1 -1
@@ -727,7 +727,7 @@ int w1_attach_slave_device(struct w1_mas/* slave modules need to be loaded in a context with unlocked mutex */ mutex_unlock (&dev->mutex); -request_module ("w1-family-0x%02x" , rn->family); +request_module ("w1-family-0x%02X" , rn->family);mutex_lock (&dev->mutex);spin_lock (&w1_flock);
PATCH 51/366 rpmsg: Correct support for MODULE_DEVICE_TABLE()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Andrew F. Davis" <[email protected]>
commit 5b7d127726de6eed4b900bc3bbb167837690818f upstream.
Due to missing a missing entry in file2alias.c MODULE_DEVICE_TABLE() are not generating the proper module aliases. Add the needed entry here.
--- scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 11 +++++++++++ 2 files changed, 14 insertions(+)
scripts/mod/devicetable-offsets.c +3 -0
@@ -136,6 +136,9 @@ int main(void)DEVID (hv_vmbus_device_id);DEVID_FIELD (hv_vmbus_device_id, guid); +DEVID (rpmsg_device_id); +DEVID_FIELD (rpmsg_device_id, name); +DEVID (i2c_device_id);DEVID_FIELD (i2c_device_id, name);
scripts/mod/file2alias.c +11 -0
@@ -884,6 +884,17 @@ static int do_vmbus_entry(const char *fi }ADD_TO_DEVTABLE ("vmbus" , hv_vmbus_device_id, do_vmbus_entry); +/* Looks like: rpmsg:S */ +static int do_rpmsg_entry (const char *filename,void *symval, +char *alias) +{ +DEF_FIELD_ADDR (symval, rpmsg_device_id, name); +sprintf (alias,RPMSG_DEVICE_MODALIAS_FMT , *name); + +return 1 ; +} +ADD_TO_DEVTABLE ("rpmsg" , rpmsg_device_id, do_rpmsg_entry); +/* Looks like: i2c:S */ static int do_i2c_entry (const char *filename,void *symval,char *alias)
PATCH 52/366 driver core: Don't ignore class_dir_create_and_add() failure.
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 84d0c27d6233a9ba0578b20f5a09701eb66cee42 upstream.
syzbot is hitting WARN() at kernfs_add_one() [1].
This is because kernfs_create_link() is confused by previous device_add() call which continued without setting dev->kobj.parent field when get_device_parent() failed by memory allocation fault injection. Fix this by propagating the error from class_dir_create_and_add() to the calllers of get_device_parent().
[1] https://syzkaller.appspot.com/bug?id=fae0fb607989ea744526d1c082a5b8de6529116f
--- drivers/base/core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/base/core.c +12 -2
@@ -709,7 +709,7 @@ class_dir_create_and_add(struct class *c dir =kzalloc (sizeof (*dir),GFP_KERNEL );if (!dir) -return NULL ; +return ERR_PTR (-ENOMEM ); dir->class = class;kobject_init (&dir->kobj, &class_dir_ktype);
@@ -719,7 +719,7 @@ class_dir_create_and_add(struct class *c retval =kobject_add (&dir->kobj, parent_kobj,"%s" , class->name);if (retval <0 ) {kobject_put (&dir->kobj); -return NULL ; +return ERR_PTR (retval); }return &dir->kobj; }
@@ -1000,6 +1000,10 @@ int device_add(struct device *dev) parent =get_device (dev->parent); kobj =get_device_parent (dev, parent); +if (IS_ERR (kobj)) { + error =PTR_ERR (kobj); + goto parent_error; + }if (kobj) dev->kobj.parent = kobj;
@@ -1097,6 +1101,7 @@ done:kobject_del (&dev->kobj); Error:cleanup_device_parent (dev); +parent_error:if (parent)put_device (parent); name_error:
@@ -1867,6 +1872,11 @@ int device_move(struct device *dev, strudevice_pm_lock (); new_parent =get_device (new_parent); new_parent_kobj =get_device_parent (dev, new_parent); +if (IS_ERR (new_parent_kobj)) { + error =PTR_ERR (new_parent_kobj); +put_device (new_parent); + goto out; + }pr_debug ("device: '%s': %s: moving to '%s'\n" ,dev_name (dev), __func__, new_parent ?dev_name (new_parent) :"<NULL>" );
PATCH 53/366 sbitmap: fix race in wait batch accounting
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit c854ab5773be1c1a0d3cef0c3a3261f2c48ab7f8 upstream.
If we have multiple callers of sbq_wake_up(), we can end up in a situation where the wait_cnt will continually go more and more negative. Consider the case where our wake batch is 1, hence wait_cnt will start out as 1.
wait_cnt == 1
CPU0 CPU1atomic_dec_return(), cnt == 0
atomic_dec_return(), cnt == -1 cmpxchg(-1, 0) (succeeds) [wait_cnt now 0]
cmpxchg(0, 1) (fails)
This ends up with wait_cnt being 0, we'll wakeup immediately next time. Going through the same loop as above again, and we'll have wait_cnt -1.
For the case where we have a larger wake batch, the only difference is that the starting point will be higher. We'll still end up with continually smaller batch wakeups, which defeats the purpose of the rolling wakeups.
Always reset the wait_cnt to the batch value. Then it doesn't matter who wins the race. But ensure that whomever does win the race is the one that increments the ws index and wakes up our batch count, loser gets to call __sbq_wake_up() again to account his wakeups towards the next active wait state index.
[bwh: Backported to 3.16:
- Rename almost everything
- Adjust filename, context]
--- block/blk-mq-tag.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-)
block/blk-mq-tag.c +29 -13
@@ -336,42 +336,58 @@ static struct bt_wait_state *bt_wake_ptrreturn NULL ; } -static void bt_clear_tag (struct blk_mq_bitmap_tags *bt,unsigned int tag) +static bool __bt_wake_up (struct blk_mq_bitmap_tags *bt) { -const int index =TAG_TO_INDEX (bt, tag);struct bt_wait_state *bs;unsigned int wake_batch;int wait_cnt; -clear_bit (TAG_TO_BIT (bt, tag), &bt->map[index].word); -/* Ensure that the wait list checks occur after clear_bit(). */ smp_mb (); bs =bt_wake_ptr (bt);if (!bs) -return ; +return false; wait_cnt =atomic_dec_return (&bs->wait_cnt);if (wait_cnt <=0 ) { +int ret; + wake_batch =ACCESS_ONCE (bt->wake_cnt); +/* * Pairs with the memory barrier in bt_update_count() to * ensure that we see the batch size update before the wait * count is reset. */ smp_mb__before_atomic (); +/* -* If there are concurrent callers to bt_clear_tag(), the last -* one to decrement the wait count below zero will bump it back -* up. If there is a concurrent resize, the count reset will -* either cause the cmpxchg to fail or overwrite after the -* cmpxchg. +* For concurrent callers of this, the one that failed the +* atomic_cmpxhcg() race should call this function again +* to wakeup a new batch on a different 'bs'. */ -atomic_cmpxchg (&bs->wait_cnt, wait_cnt, wait_cnt + wake_batch); -bt_index_atomic_inc (&bt->wake_index); -wake_up (&bs->wait); + ret =atomic_cmpxchg (&bs->wait_cnt, wait_cnt, wake_batch); +if (ret == wait_cnt) { +bt_index_atomic_inc (&bt->wake_index); +wake_up (&bs->wait); +return false; + } + +return true; } + +return false; +} + +static void bt_clear_tag (struct blk_mq_bitmap_tags *bt,unsigned int tag) +{ +const int index =TAG_TO_INDEX (bt, tag); + +clear_bit (TAG_TO_BIT (bt, tag), &bt->map[index].word); + +while (__bt_wake_up (bt)) + ; }static void __blk_mq_put_tag (struct blk_mq_tags *tags,unsigned int tag)
PATCH 54/366 staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <[email protected]>
commit 45ad559a29629cb1c64ee636563c69b71524f077 upstream.
Syzbot reported yet another warning with Ion:
WARNING: CPU: 0 PID: 1467 at drivers/staging/android/ion/ion.c:122 ion_buffer_destroy+0xd4/0x190 drivers/staging/android/ion/ion.c:122 Kernel panic - not syncing: panic_on_warn set ...
This is catching that a buffer was freed with an existing kernel mapping still present. This can be easily be triggered from userspace by calling DMA_BUF_SYNC_START without calling DMA_BUF_SYNC_END. Switch to a single pr_warn_once to indicate the error without being disruptive.
--- drivers/staging/android/ion/ion.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/android/ion/ion.c +4 -1
@@ -272,8 +272,11 @@ err2:void ion_buffer_destroy (struct ion_buffer *buffer) { -if (WARN_ON (buffer->kmap_cnt >0 )) +if (buffer->kmap_cnt >0 ) { +pr_warn_once ("%s: buffer still mapped in the kernel\n" , + __func__); buffer->heap->ops->unmap_kernel (buffer->heap, buffer); + } buffer->heap->ops->unmap_dma (buffer->heap, buffer); buffer->heap->ops->free (buffer);if (buffer->pages)
PATCH 55/366 mfd: tps65911-comparator: Fix a build error
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit ac1886165cd1201c5793099b6fbad1876bf98dfe upstream.
In 2012, we changed the tps65910 API and fixed most drivers but forgot to update this one.
--- drivers/mfd/tps65911-comparator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/tps65911-comparator.c +3 -3
@@ -78,7 +78,7 @@ static int comp_threshold_set(struct tpsreturn -EINVAL ; val = index <<1 ; - ret = tps65910->write (tps65910, tps_comp.reg,1 , &val); + ret =tps65910_reg_write (tps65910, tps_comp.reg, val);return ret; }
@@ -86,13 +86,13 @@ static int comp_threshold_set(struct tpsstatic int comp_threshold_get (struct tps65910 *tps65910,int id) {struct comparator tps_comp = tps_comparators[id]; +unsigned int val;int ret; -u8 val;if (id ==COMP )return 0 ; - ret = tps65910->read (tps65910, tps_comp.reg,1 , &val); + ret =tps65910_reg_read (tps65910, tps_comp.reg, &val);if (ret <0 )return ret;
PATCH 56/366 mfd: tps65911-comparator: Fix an off by one bug
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
commit 1768391c3674b0c6bdc4947121f15fb0c2f47ec4 upstream.
The COMP1 and COMP2 elements are in 0 and 1 respectively so this code is accessing the wrong elements and one space beyond the end of the array.
The "id" variable is never COMP (0) so that code can be removed.
--- drivers/mfd/tps65911-comparator.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/mfd/tps65911-comparator.c +2 -9
@@ -22,9 +22,8 @@#include <linux/gpio.h> #include <linux/mfd/tps65910.h> -#define COMP 0 -#define COMP1 1 -#define COMP2 2 +#define COMP1 0 +#define COMP2 1/* Comparator 1 voltage selection table in millivolts */ static const u16 COMP_VSEL_TABLE [] = {
@@ -63,9 +62,6 @@ static int comp_threshold_set(struct tpsint ret;u8 index =0 , val; -if (id ==COMP ) -return 0 ; -while (curr_voltage < tps_comp.uV_max) { curr_voltage = tps_comp.vsel_table[index];if (curr_voltage >= voltage)
@@ -89,9 +85,6 @@ static int comp_threshold_get(struct tpsunsigned int val;int ret; -if (id ==COMP ) -return 0 ; - ret =tps65910_reg_read (tps65910, tps_comp.reg, &val);if (ret <0 )return ret;
PATCH 57/366 regulator: max8998: Fix platform data retrieval.
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paweł Chmiel <[email protected]>
commit c1472737914fe5246a672fef6e85c9455de8473f upstream.
Since the max8998 MFD driver supports instantiation by DT, platform data retrieval is handled in MFD probe and cell drivers should get use the pdata field of max8998_dev struct to obtain them.
--- drivers/regulator/max8998.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/regulator/max8998.c +1 -2
@@ -309,8 +309,7 @@ static int max8998_set_voltage_buck_sel( unsigned selector) {struct max8998_data *max8998 =rdev_get_drvdata (rdev); -struct max8998_platform_data *pdata = -dev_get_platdata (max8998->iodev->dev); +struct max8998_platform_data *pdata = max8998->iodev->pdata;struct i2c_client *i2c = max8998->iodev->i2c;int buck =rdev_get_id (rdev);int reg, shift =0 , mask, ret, j;
PATCH 58/366 ALSA: core: Assure control device to be registered at last
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit dc82e52492f684dcd5ed9e4773e72dbf2203d75e upstream.
The commit 289ca025ee1d ("ALSA: Use priority list for managing device list") changed the way to register/disconnect/free devices via a single priority list. This helped to make behavior consistent, but it also changed a slight behavior change: namely, the control device is registered earlier than others, while it was supposed to be the very last one.
I've put SNDRV_DEV_CONTROL in the current position as the release of ctl elements often conflict with the private ctl elements some PCM or other components may create, which often leads to a double-free. But, the order of register and disconnect should be indeed fixed as expected in the early days: the control device gets registered at last, and disconnected at first.
This patch changes the priority list order to move SNDRV_DEV_CONTROL as the last guy to assure the register / disconnect order. Meanwhile, for keeping the messy resource release order, manually treat the control and lowlevel devices as last freed one.
Additional note:
The lowlevel device is the device where a card driver creates at probe. And, we still keep the release order control -> lowlevel, as there might be link from a control element back to a lowlevel object.
--- include/sound/core.h | 2 +- sound/core/device.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
include/sound/core.h +1 -1
@@ -51,7 +51,6 @@ struct completion;*/ enum snd_device_type {SNDRV_DEV_LOWLEVEL , -SNDRV_DEV_CONTROL ,SNDRV_DEV_INFO ,SNDRV_DEV_BUS ,SNDRV_DEV_CODEC ,
@@ -62,6 +61,7 @@ enum snd_device_type {SNDRV_DEV_SEQUENCER ,SNDRV_DEV_HWDEP ,SNDRV_DEV_JACK , + SNDRV_DEV_CONTROL, /* NOTE: this must be the last one */ }; enum snd_device_state {
sound/core/device.c +9 -0
@@ -219,6 +219,15 @@ void snd_device_free_all(struct snd_cardif (snd_BUG_ON (!card))return ; +list_for_each_entry_safe_reverse (dev, next, &card->devices, list) { +/* exception: free ctl and lowlevel stuff later */ +if (dev->type ==SNDRV_DEV_CONTROL || + dev->type ==SNDRV_DEV_LOWLEVEL ) +continue ; +__snd_device_free (dev); + } + +/* free all */ list_for_each_entry_safe_reverse (dev, next, &card->devices, list)__snd_device_free (dev); }
PATCH 59/366 media: smiapp: fix timeout checking in smiapp_read_nvm
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 7a2148dfda8001c983f0effd9afd8a7fa58e99c4 upstream.
The current code decrements the timeout counter i and the end of each loop i is incremented, so the check for timeout will always be false and hence the timeout mechanism is just a dead code path. Potentially, if the RD_READY bit is not set, we could end up in an infinite loop.
Fix this so the timeout starts from 1000 and decrements to zero, if at the end of the loop i is zero we have a timeout condition.
Detected by CoverityScan, CID#1324008 ("Logically dead code")
--- drivers/media/i2c/smiapp/smiapp-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/media/i2c/smiapp/smiapp-core.c +5 -6
@@ -899,7 +899,7 @@ static int smiapp_read_nvm(struct smiappif (rval) goto out; -for (i =0 ; i <1000 ; i++) { +for (i =1000 ; i >0 ; i--) { rval =smiapp_read ( sensor,SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS , &s);
@@ -910,11 +910,10 @@ static int smiapp_read_nvm(struct smiappif (s &SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY )break ; -if (--i ==0 ) { - rval = -ETIMEDOUT ; - goto out; - } - + } +if (!i) { + rval = -ETIMEDOUT ; + goto out; }for (i =0 ; i <SMIAPP_NVM_PAGE_SIZE ; i++) {
PATCH 60/366 scsi: zfcp: fix missing SCSI trace for result of eh_host_reset_handler
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit df30781699f53e4fd4c494c6f7dd16e3d5c21d30 upstream.
For problem determination we need to see whether and why we were successful or not. This allows deduction of scsi_eh escalation.
Example trace record formatted with zfcpdbf from s390-tools:
Timestamp : ...
Area : SCSI
Subarea : 00
Level : 1
Exception : -
CPU ID : ..
Caller : 0x...
Record ID : 1
Tag : schrh_r SCSI host reset handler result
Request ID : 0x0000000000000000 none (invalid)
SCSI ID : 0xffffffff none (invalid)
SCSI LUN : 0xffffffff none (invalid)
SCSI LUN high : 0xffffffff none (invalid)
SCSI result : 0x00002002 field re-used for midlayer value: SUCCESS
or in other cases: 0x2009 == FAST_IO_FAIL
SCSI retries : 0xff none (invalid)
SCSI allowed : 0xff none (invalid)
SCSI scribble : 0xffffffffffffffff none (invalid)
SCSI opcode : ffffffff ffffffff ffffffff ffffffff none (invalid)
FCP rsp inf cod: 0xff none (invalid)
FCP rsp IU : 00000000 00000000 00000000 00000000 none (invalid)
00000000 00000000
v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code from fc_block_scsi_eh to scsi eh") introduced the first return with something other than the previously hardcoded single SUCCESS return path.
[bwh: Backported to 3.16: Drop assignment to zfcp_dbf_scsi::scsi_lun_64_hi
which doesn't exist here]
---
drivers/s390/scsi/zfcp_dbf.c +39 -0
@@ -624,6 +624,45 @@ void zfcp_dbf_scsi(char *tag, int level,spin_unlock_irqrestore (&dbf->scsi_lock, flags); } +/** +* zfcp_dbf_scsi_eh() - Trace event for special cases of scsi_eh callbacks. +* @tag: Identifier for event. +* @adapter: Pointer to zfcp adapter as context for this event. +* @scsi_id: SCSI ID/target to indicate scope of task management function (TMF). +* @ret: Return value of calling function. +* +* This SCSI trace variant does not depend on any of: +* scsi_cmnd, zfcp_fsf_req, scsi_device. +*/ +void zfcp_dbf_scsi_eh (char *tag,struct zfcp_adapter *adapter, +unsigned int scsi_id,int ret) +{ +struct zfcp_dbf *dbf = adapter->dbf; +struct zfcp_dbf_scsi *rec = &dbf->scsi_buf; +unsigned long flags; +static int const level =1 ; + +if (unlikely (!debug_level_enabled (adapter->dbf->scsi, level))) +return ; + +spin_lock_irqsave (&dbf->scsi_lock, flags); +memset (rec,0 ,sizeof (*rec)); + +memcpy (rec->tag, tag,ZFCP_DBF_TAG_LEN ); + rec->id =ZFCP_DBF_SCSI_CMND ; + rec->scsi_result = ret;/* re-use field, int is 4 bytes and fits */ + rec->scsi_retries = ~0 ; + rec->scsi_allowed = ~0 ; + rec->fcp_rsp_info = ~0 ; + rec->scsi_id = scsi_id; + rec->scsi_lun = (u32 )ZFCP_DBF_INVALID_LUN ; + rec->host_scribble = ~0 ; +memset (rec->scsi_opcode,0xff ,ZFCP_DBF_SCSI_OPCODE ); + +debug_event (dbf->scsi, level, rec,sizeof (*rec)); +spin_unlock_irqrestore (&dbf->scsi_lock, flags); +} +static debug_info_t *zfcp_dbf_reg (const char *name,int size,int rec_size) {struct debug_info *d;
drivers/s390/scsi/zfcp_ext.h +2 -0
@@ -52,6 +52,8 @@ extern void zfcp_dbf_san_res(char *, strextern void zfcp_dbf_san_in_els (char *,struct zfcp_fsf_req *);extern void zfcp_dbf_scsi (char *,int ,struct scsi_cmnd *,struct zfcp_fsf_req *); +extern void zfcp_dbf_scsi_eh (char *tag,struct zfcp_adapter *adapter, +unsigned int scsi_id,int ret);/* zfcp_erp.c */ extern void zfcp_erp_set_adapter_status (struct zfcp_adapter *,u32 );
drivers/s390/scsi/zfcp_scsi.c +6 -5
@@ -343,15 +343,16 @@ static int zfcp_scsi_eh_host_reset_handl {struct zfcp_scsi_dev *zfcp_sdev =sdev_to_zfcp (scpnt->device);struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; -int ret; +int ret =SUCCESS , fc_ret;zfcp_erp_adapter_reopen (adapter,0 ,"schrh_1" );zfcp_erp_wait (adapter); - ret =fc_block_scsi_eh (scpnt); -if (ret) -return ret; + fc_ret =fc_block_scsi_eh (scpnt); +if (fc_ret) + ret = fc_ret; -return SUCCESS ; +zfcp_dbf_scsi_eh ("schrh_r" , adapter, ~0 , ret); +return ret; }struct scsi_transport_template *zfcp_scsi_transport_template;
PATCH 61/366 scsi: zfcp: fix missing SCSI trace for retry of abort / scsi_eh TMF
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 81979ae63e872ef650a7197f6ce6590059d37172 upstream.
We already have a SCSI trace for the end of abort and scsi_eh TMF. Due to zfcp_erp_wait() and fc_block_scsi_eh() time can pass between the start of our eh callback and an actual send/recv of an abort / TMF request. In order to see the temporal sequence including any abort / TMF send retries, add a trace before the above two blocking functions. This supports problem determination with scsi_eh and parallel zfcp ERP.
No need to explicitly trace the beginning of our eh callback, since we typically can send an abort / TMF and see its HBA response (in the worst case, it's a pseudo response on dismiss all of adapter recovery, e.g. due to an FSF request timeout [fsrth_1] of the abort / TMF). If we cannot send, we now get a trace record for the first "abrt_wt" or "[lt]r_wait" which denotes almost the beginning of the callback.
No need to explicitly trace the wakeup after the above two blocking functions because the next retry loop causes another trace in any case and that is sufficient.
Example trace records formatted with zfcpdbf from s390-tools:
Timestamp : ...
Area : SCSI
Subarea : 00
Level : 1
Exception : -
CPU ID : ..
Caller : 0x...
Record ID : 1
Tag : abrt_wt abort, before zfcp_erp_wait()
Request ID : 0x0000000000000000 none (invalid)
SCSI ID : 0x<scsi_id>
SCSI LUN : 0x<scsi_lun>
SCSI LUN high : 0x<scsi_lun_high>
SCSI result : 0x<scsi_result_of_cmd_to_be_aborted>
SCSI retries : 0x<retries_of_cmd_to_be_aborted>
SCSI allowed : 0x<allowed_retries_of_cmd_to_be_aborted>
SCSI scribble : 0x<req_id_of_cmd_to_be_aborted>
SCSI opcode : <CDB_of_cmd_to_be_aborted>
FCP rsp inf cod: 0x.. none (invalid)
FCP rsp IU : ... none (invalid)
Timestamp : ...
Area : SCSI
Subarea : 00
Level : 1
Exception : -
CPU ID : ..
Caller : 0x...
Record ID : 1
Tag : lr_wait LUN reset, before zfcp_erp_wait()
Request ID : 0x0000000000000000 none (invalid)
SCSI ID : 0x<scsi_id>
SCSI LUN : 0x<scsi_lun>
SCSI LUN high : 0x<scsi_lun_high>
SCSI result : 0x... unrelated
SCSI retries : 0x.. unrelated
SCSI allowed : 0x.. unrelated
SCSI scribble : 0x... unrelated
SCSI opcode : ... unrelated
FCP rsp inf cod: 0x.. none (invalid)
FCP rsp IU : ... none (invalid)
--- drivers/s390/scsi/zfcp_scsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/s390/scsi/zfcp_scsi.c +2 -0
@@ -201,6 +201,7 @@ static int zfcp_scsi_eh_abort_handler(stif (abrt_req)break ; +zfcp_dbf_scsi_abort ("abrt_wt" , scpnt,NULL );zfcp_erp_wait (adapter); ret =fc_block_scsi_eh (scpnt);if (ret) {
@@ -297,6 +298,7 @@ static int zfcp_task_mgmt_function(strucif (fsf_req)break ; +zfcp_dbf_scsi_devreset ("wait" , scpnt, tm_flags,NULL );zfcp_erp_wait (adapter); ret =fc_block_scsi_eh (scpnt);if (ret) {
PATCH 62/366 scsi: zfcp: fix misleading REC trigger trace where erp_action setup failed
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 512857a795cbbda5980efa4cdb3c0b6602330408 upstream.
If a SCSI device is deleted during scsi_eh host reset, we cannot get a reference to the SCSI device anymore since scsi_device_get returns !=0 by design. Assuming the recovery of adapter and port(s) was successful, zfcp_erp_strategy_followup_success() attempts to trigger a LUN reset for the half-gone SCSI device. Unfortunately, it causes the following confusing trace record which states that zfcp will do a LUN recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and equals "ERP want".
Old example trace record formatted with zfcpdbf from s390-tools:
Tag: : ersfs_3 ERP, trigger, unit reopen, port reopen succeeded
LUN : 0x<FCP_LUN>
WWPN : 0x<WWPN>D_ID : 0x<N_Port-ID>
Adapter status : 0x5400050b
Port status : 0x54000001
LUN status : 0x40000000 ZFCP_STATUS_COMMON_RUNNING
but not ZFCP_STATUS_COMMON_UNBLOCKED as it was closed on close part of adapter reopen
ERP want : 0x01
ERP need : 0x01 misleading
However, zfcp_erp_setup_act() returns NULL as it cannot get the reference. Hence, zfcp_erp_action_enqueue() takes an early goto out and _NO_ recovery actually happens.
We always do want the recovery trigger trace record even if no erp_action could be enqueued as in this case. For other cases where we did not enqueue an erp_action, 'need' has always been zero to indicate this. In order to indicate above goto out, introduce an eyecatcher "flag" to mark the "ERP need" as 'not needed' but still keep the information which erp_action type, that zfcp_erp_required_act() had decided upon, is needed. 0xc_ is chosen to be visibly different from 0x0_ in "ERP want".
New example trace record formatted with zfcpdbf from s390-tools:
Tag: : ersfs_3 ERP, trigger, unit reopen, port reopen succeeded
LUN : 0x<FCP_LUN>
WWPN : 0x<WWPN>D_ID : 0x<N_Port-ID>
Adapter status : 0x5400050b
Port status : 0x54000001
LUN status : 0x40000000
ERP want : 0x01
ERP need : 0xc1 would need LUN ERP, but no action set up
^
Before v2.6.38 commit ae0904f60fab ("[SCSI] zfcp: Redesign of the debug tracing for recovery actions.") we could detect this case because the "erp_action" field in the trace was NULL. The rework removed erp_action as argument and field from the trace.
This patch here is for tracing. A fix to allow LUN recovery in the case at hand is a topic for a separate patch.
See also commit fdbd1c5e27da ("[SCSI] zfcp: Allow running unit/LUN shutdown without acquiring reference") for a similar case and background info.
--- drivers/s390/scsi/zfcp_erp.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/s390/scsi/zfcp_erp.c +15 -1
@@ -34,11 +34,23 @@ enum zfcp_erp_steps { ZFCP_ERP_STEP_LUN_OPENING = 0x2000, }; +/** +* enum zfcp_erp_act_type - Type of ERP action object. +* @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery. +* @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery. +* @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery. +* @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery. +* @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with +* either of the other enum values. +* Used to indicate that an ERP action could not be +* set up despite a detected need for some recovery. +*/ enum zfcp_erp_act_type {ZFCP_ERP_ACTION_REOPEN_LUN =1 ,ZFCP_ERP_ACTION_REOPEN_PORT =2 ,ZFCP_ERP_ACTION_REOPEN_PORT_FORCED =3 ,ZFCP_ERP_ACTION_REOPEN_ADAPTER =4 , +ZFCP_ERP_ACTION_NONE =0xc0 , };enum zfcp_erp_act_state {
@@ -256,8 +268,10 @@ static int zfcp_erp_action_enqueue(int w goto out; act =zfcp_erp_setup_act (need, act_status, adapter, port, sdev); -if (!act) +if (!act) { + need |=ZFCP_ERP_ACTION_NONE ;/* marker for trace */ goto out; + }atomic_set_mask (ZFCP_STATUS_ADAPTER_ERP_PENDING , &adapter->status); ++adapter->erp_total_count;list_add_tail (&act->list, &adapter->erp_ready_head);
PATCH 63/366 scsi: zfcp: fix missing REC trigger trace on terminate_rport_io early return
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 96d9270499471545048ed8a6d7f425a49762283d upstream.
get_device() and its internally used kobject_get() only return NULL if they get passed NULL as argument. zfcp_get_port_by_wwpn() loops over adapter->port_list so the iteration variable port is always non-NULL. Struct device is embedded in struct zfcp_port so &port->dev is always non-NULL. This is the argument to get_device(). However, if we get an fc_rport in terminate_rport_io() for which we cannot find a match within zfcp_get_port_by_wwpn(), the latter can return NULL. v2.6.30 commit 70932935b61e ("[SCSI] zfcp: Fix oops when port disappears") introduced an early return without adding a trace record for this case. Even if we don't need recovery in this case, for debugging we should still see that our callback was invoked originally by scsi_transport_fc.
Example trace record formatted with zfcpdbf from s390-tools:
Timestamp : ...
Area : REC
Subarea : 00
Level : 1
Exception : -
CPU ID : ..
Caller : 0x...
Record ID : 1
Tag : sctrpin SCSI terminate rport I/O, no zfcp port
LUN : 0xffffffffffffffff none (invalid)
WWPN : 0x<wwpn> WWPND_ID : 0x<n_port_id> N_Port-ID
Adapter status : 0x...
Port status : 0xffffffff unknown (-1)
LUN status : 0x00000000 none (invalid)
Ready count : 0x...
Running count : 0x...
ERP want : 0x03 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED
ERP need : 0xc0 ZFCP_ERP_ACTION_NONE
--- drivers/s390/scsi/zfcp_erp.c | 20 ++++++++++++++++++++ drivers/s390/scsi/zfcp_ext.h | 3 +++ drivers/s390/scsi/zfcp_scsi.c | 5 +++++ 3 files changed, 28 insertions(+)
drivers/s390/scsi/zfcp_erp.c +20 -0
@@ -282,6 +282,26 @@ static int zfcp_erp_action_enqueue(int wreturn retval; } +void zfcp_erp_port_forced_no_port_dbf (char *id,struct zfcp_adapter *adapter, +u64 port_name,u32 port_id) +{ +unsigned long flags; +static /* don't waste stack */ struct zfcp_port tmpport; + +write_lock_irqsave (&adapter->erp_lock, flags); +/* Stand-in zfcp port with fields just good enough for +* zfcp_dbf_rec_trig() and zfcp_dbf_set_common(). +* Under lock because tmpport is static. +*/ +atomic_set (&tmpport.status,-1 );/* unknown */ + tmpport.wwpn = port_name; + tmpport.d_id = port_id; +zfcp_dbf_rec_trig (id, adapter, &tmpport,NULL , +ZFCP_ERP_ACTION_REOPEN_PORT_FORCED , +ZFCP_ERP_ACTION_NONE ); +write_unlock_irqrestore (&adapter->erp_lock, flags); +} +static int _zfcp_erp_adapter_reopen (struct zfcp_adapter *adapter,int clear_mask,char *id) {
drivers/s390/scsi/zfcp_ext.h +3 -0
@@ -58,6 +58,9 @@ extern void zfcp_dbf_scsi_eh(char *tag,/* zfcp_erp.c */ extern void zfcp_erp_set_adapter_status (struct zfcp_adapter *,u32 );extern void zfcp_erp_clear_adapter_status (struct zfcp_adapter *,u32 ); +extern void zfcp_erp_port_forced_no_port_dbf (char *id, +struct zfcp_adapter *adapter, +u64 port_name,u32 port_id);extern void zfcp_erp_adapter_reopen (struct zfcp_adapter *,int ,char *);extern void zfcp_erp_adapter_shutdown (struct zfcp_adapter *,int ,char *);extern void zfcp_erp_set_port_status (struct zfcp_port *,u32 );
drivers/s390/scsi/zfcp_scsi.c +5 -0
@@ -624,6 +624,11 @@ static void zfcp_scsi_terminate_rport_ioif (port) {zfcp_erp_port_forced_reopen (port,0 ,"sctrpi1" );put_device (&port->dev); + }else { +zfcp_erp_port_forced_no_port_dbf ( +"sctrpin" , adapter, + rport->port_name/* zfcp_scsi_rport_register */ , + rport->port_id/* zfcp_scsi_rport_register */ ); } }
PATCH 64/366 scsi: zfcp: fix missing REC trigger trace on terminate_rport_io for ERP_FAILED
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit d70aab55924b44f213fec2b900b095430b33eec6 upstream.
For problem determination we always want to see when we were invoked on the terminate_rport_io callback whether we perform something or not.
Temporal event sequence of interest with a long fast_io_fail_tmo of 27 sec:
loose remote port
t workqueue
[s] zfcp_q_<dev> IRQ zfcperp<dev>
=== ================== =================== ============================
0 recv RSCN
q p.test_link_work
block rport
start fast_io_fail_tmo
send ADISC ELS
4 recv ADISC fail
block zfcp_port
port forced reopen send open port
12 recv open port fail
q p.gid_pn_work zfcp_erp_wakeup (zfcp_erp_wait would return)
GID_PN fail
Before this point, we got a SCSI trace with tag "sctrpi1" on fast_io_fail, e.g. with the typical 5 sec setting.
port.status |= ERP_FAILED
If fast_io_fail_tmo triggers after this point, we missed a SCSI trace.
workqueue
fc_dl_<host>
================== 27 fc_timeout_fail_rport_io
fc_terminate_rport_io
zfcp_scsi_terminate_rport_io
zfcp_erp_port_forced_reopen
_zfcp_erp_port_forced_reopen
if (port.status & ERP_FAILED)
return;
Therefore, write a trace before above early return.
Example trace record formatted with zfcpdbf from s390-tools:
Timestamp : ...
Area : REC
Subarea : 00
Level : 1
Exception : -
CPU ID : ..
Caller : 0x...
Record ID : 1 ZFCP_DBF_REC_TRIG
Tag : sctrpi1 SCSI terminate rport I/O
LUN : 0xffffffffffffffff none (invalid)
WWPN : 0x<wwpn>D_ID : 0x<n_port_id>
Adapter status : 0x...
Port status : 0x...
LUN status : 0x00000000 none (invalid)
Ready count : 0x...
Running count : 0x...
ERP want : 0x03 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED
ERP need : 0xe0 ZFCP_ERP_ACTION_FAILED
--- drivers/s390/scsi/zfcp_erp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_erp.c +11 -2
@@ -41,9 +41,13 @@ enum zfcp_erp_steps {* @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery. * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery. * @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with -* either of the other enum values. +* either of the first four enum values. * Used to indicate that an ERP action could not be * set up despite a detected need for some recovery. +* @ZFCP_ERP_ACTION_FAILED: Eyecatcher pseudo flag to bitwise or-combine with +* either of the first four enum values. +* Used to indicate that ERP not needed because +* the object has ZFCP_STATUS_COMMON_ERP_FAILED. */ enum zfcp_erp_act_type {ZFCP_ERP_ACTION_REOPEN_LUN =1 ,
@@ -51,6 +55,7 @@ enum zfcp_erp_act_type {ZFCP_ERP_ACTION_REOPEN_PORT_FORCED =3 ,ZFCP_ERP_ACTION_REOPEN_ADAPTER =4 ,ZFCP_ERP_ACTION_NONE =0xc0 , + ZFCP_ERP_ACTION_FAILED = 0xe0, }; enum zfcp_erp_act_state {
@@ -378,8 +383,12 @@ static void _zfcp_erp_port_forced_reopenzfcp_erp_port_block (port, clear);zfcp_scsi_schedule_rport_block (port); -if (atomic_read (&port->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) +if (atomic_read (&port->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) { +zfcp_dbf_rec_trig (id, port->adapter, port,NULL , +ZFCP_ERP_ACTION_REOPEN_PORT_FORCED , +ZFCP_ERP_ACTION_FAILED );return ; + }zfcp_erp_action_enqueue (ZFCP_ERP_ACTION_REOPEN_PORT_FORCED , port->adapter, port,NULL , id,0 );
PATCH 65/366 scsi: zfcp: fix missing REC trigger trace for all objects in ERP_FAILED
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 8c3d20aada70042a39c6a6625be037c1472ca610 upstream.
That other commit introduced an inconsistency because it would trace on ERP_FAILED for all callers of port forced reopen triggers (not just terminate_rport_io), but it would not trace on ERP_FAILED for all callers of other ERP triggers such as adapter, port regular, LUN.
Therefore, generalize that other commit. zfcp_erp_action_enqueue() already had two early outs which re-used the one zfcp_dbf_rec_trig() call. All ERP trigger functions finally run through zfcp_erp_action_enqueue(). So move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED into zfcp_erp_action_enqueue() and add another early out with new trace marker for pseudo ERP need in this case. This removes all early returns from all ERP trigger functions so we always end up at zfcp_dbf_rec_trig().
Example trace record formatted with zfcpdbf from s390-tools:
Timestamp : ...
Area : REC
Subarea : 00
Level : 1
Exception : -
CPU ID : ..
Caller : 0x...
Record ID : 1 ZFCP_DBF_REC_TRIG
Tag : .......
LUN : 0x...
WWPN : 0x...D_ID : 0x...
Adapter status : 0x...
Port status : 0x...
LUN status : 0x...
Ready count : 0x...
Running count : 0x...
ERP want : 0x0. ZFCP_ERP_ACTION_REOPEN_...
ERP need : 0xe0 ZFCP_ERP_ACTION_FAILED
--- drivers/s390/scsi/zfcp_erp.c | 79 +++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 28 deletions(-)
drivers/s390/scsi/zfcp_erp.c +51 -28
@@ -142,6 +142,49 @@ static void zfcp_erp_action_dismiss_adap } } +static int zfcp_erp_handle_failed (int want,struct zfcp_adapter *adapter, +struct zfcp_port *port, +struct scsi_device *sdev) +{ +int need = want; +struct zfcp_scsi_dev *zsdev; + +switch (want) { +case ZFCP_ERP_ACTION_REOPEN_LUN : + zsdev =sdev_to_zfcp (sdev); +if (atomic_read (&zsdev->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) + need =0 ; +break ; +case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED : +if (atomic_read (&port->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) + need =0 ; +break ; +case ZFCP_ERP_ACTION_REOPEN_PORT : +if (atomic_read (&port->status) & +ZFCP_STATUS_COMMON_ERP_FAILED ) { + need =0 ; +/* ensure propagation of failed status to new devices */ +zfcp_erp_set_port_status ( + port,ZFCP_STATUS_COMMON_ERP_FAILED ); + } +break ; +case ZFCP_ERP_ACTION_REOPEN_ADAPTER : +if (atomic_read (&adapter->status) & +ZFCP_STATUS_COMMON_ERP_FAILED ) { + need =0 ; +/* ensure propagation of failed status to new devices */ +zfcp_erp_set_adapter_status ( + adapter,ZFCP_STATUS_COMMON_ERP_FAILED ); + } +break ; +default : + need =0 ; +break ; + } + +return need; +} +static int zfcp_erp_required_act (int want,struct zfcp_adapter *adapter,struct zfcp_port *port,struct scsi_device *sdev)
@@ -265,6 +308,12 @@ static int zfcp_erp_action_enqueue(int wint retval =1 , need;struct zfcp_erp_action *act; + need =zfcp_erp_handle_failed (want, adapter, port, sdev); +if (!need) { + need =ZFCP_ERP_ACTION_FAILED ;/* marker for trace */ + goto out; + } +if (!adapter->erp_thread)return -EIO ;
@@ -313,12 +362,6 @@ static int _zfcp_erp_adapter_reopen(struzfcp_erp_adapter_block (adapter, clear_mask);zfcp_scsi_schedule_rports_block (adapter); -/* ensure propagation of failed status to new devices */ -if (atomic_read (&adapter->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) { -zfcp_erp_set_adapter_status (adapter, -ZFCP_STATUS_COMMON_ERP_FAILED ); -return -EIO ; - }return zfcp_erp_action_enqueue (ZFCP_ERP_ACTION_REOPEN_ADAPTER , adapter,NULL ,NULL , id,0 ); }
@@ -337,12 +380,8 @@ void zfcp_erp_adapter_reopen(struct zfcpzfcp_scsi_schedule_rports_block (adapter);write_lock_irqsave (&adapter->erp_lock, flags); -if (atomic_read (&adapter->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) -zfcp_erp_set_adapter_status (adapter, -ZFCP_STATUS_COMMON_ERP_FAILED ); -else -zfcp_erp_action_enqueue (ZFCP_ERP_ACTION_REOPEN_ADAPTER , adapter, -NULL ,NULL , id,0 ); +zfcp_erp_action_enqueue (ZFCP_ERP_ACTION_REOPEN_ADAPTER , adapter, +NULL ,NULL , id,0 );write_unlock_irqrestore (&adapter->erp_lock, flags); }
@@ -383,13 +422,6 @@ static void _zfcp_erp_port_forced_reopenzfcp_erp_port_block (port, clear);zfcp_scsi_schedule_rport_block (port); -if (atomic_read (&port->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) { -zfcp_dbf_rec_trig (id, port->adapter, port,NULL , -ZFCP_ERP_ACTION_REOPEN_PORT_FORCED , -ZFCP_ERP_ACTION_FAILED ); -return ; - } -zfcp_erp_action_enqueue (ZFCP_ERP_ACTION_REOPEN_PORT_FORCED , port->adapter, port,NULL , id,0 ); }
@@ -415,12 +447,6 @@ static int _zfcp_erp_port_reopen(structzfcp_erp_port_block (port, clear);zfcp_scsi_schedule_rport_block (port); -if (atomic_read (&port->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) { -/* ensure propagation of failed status to new devices */ -zfcp_erp_set_port_status (port,ZFCP_STATUS_COMMON_ERP_FAILED ); -return -EIO ; - } -return zfcp_erp_action_enqueue (ZFCP_ERP_ACTION_REOPEN_PORT , port->adapter, port,NULL , id,0 ); }
@@ -460,9 +486,6 @@ static void _zfcp_erp_lun_reopen(structzfcp_erp_lun_block (sdev, clear); -if (atomic_read (&zfcp_sdev->status) &ZFCP_STATUS_COMMON_ERP_FAILED ) -return ; -zfcp_erp_action_enqueue (ZFCP_ERP_ACTION_REOPEN_LUN , adapter, zfcp_sdev->port, sdev, id, act_status); }
PATCH 66/366 scsi: zfcp: fix missing REC trigger trace on enqueue without ERP thread
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 6a76550841d412330bd86aed3238d1888ba70f0e upstream.
Example trace record formatted with zfcpdbf from s390-tools:
Timestamp : ...
Area : REC
Subarea : 00
Level : 1
Exception : -
CPU ID : ..
Caller : 0x...
Record ID : 1 ZFCP_DBF_REC_TRIG
Tag : .......
LUN : 0x...
WWPN : 0x...D_ID : 0x...
Adapter status : 0x...
Port status : 0x...
LUN status : 0x...
Ready count : 0x...
Running count : 0x...
ERP want : 0x0. ZFCP_ERP_ACTION_REOPEN_...
ERP need : 0xc0 ZFCP_ERP_ACTION_NONE
--- drivers/s390/scsi/zfcp_erp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_erp.c +5 -2
@@ -314,8 +314,11 @@ static int zfcp_erp_action_enqueue(int w goto out; } -if (!adapter->erp_thread) -return -EIO ; +if (!adapter->erp_thread) { + need =ZFCP_ERP_ACTION_NONE ;/* marker for trace */ + retval = -EIO ; + goto out; + } need =zfcp_erp_required_act (want, adapter, port, sdev);if (!need)
PATCH 67/366 scsi: qlogicpti: Fix an error handling path in 'qpti_sbus_probe()'
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Jaillet <[email protected]>
commit 51b910c3c70986a5a0a84eea11cb8e904e37ba8b upstream.
The 'free_irq()' call is not at the right place in the error handling path. The changed order has been introduced in commit 3d4253d9afab ("[SCSI] qlogicpti: Convert to new SBUS device framework.")
--- drivers/scsi/qlogicpti.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/qlogicpti.c +3 -3
@@ -1386,6 +1386,9 @@ fail_unmap_queues: qpti->req_cpu, qpti->req_dvma);#undef QSIZE +fail_free_irq: +free_irq (qpti->irq, qpti); + fail_unmap_regs:of_iounmap (&op->resource[0 ], qpti->qregs,resource_size (&op->resource[0 ]));
@@ -1393,9 +1396,6 @@ fail_unmap_regs:of_iounmap (&op->resource[0 ], qpti->sreg,sizeof (unsigned char )); -fail_free_irq: -free_irq (qpti->irq, qpti); - fail_unlink:scsi_host_put (host);
PATCH 68/366 ARM: 8764/1: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Rivshin <[email protected]>
commit 76ed0b803a2ab793a1b27d1dfe0de7955282cd34 upstream.
NUMREGBYTES (which is used as the size for gdb_regs[]) is incorrectly based on DBG_MAX_REG_NUM instead of GDB_MAX_REGS. DBG_MAX_REG_NUM is the number of total registers, while GDB_MAX_REGS is the number of 'unsigned longs' it takes to serialize those registers. Since FP registers require 3 'unsigned longs' each, DBG_MAX_REG_NUM is smaller than GDB_MAX_REGS.
This causes GDB 8.0 give the following error on connect:
"Truncated register 19 in remote 'g' packet"
This also causes the register serialization/deserialization logic to overflow gdb_regs[], overwriting whatever follows.
--- arch/arm/include/asm/kgdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/kgdb.h +1 -1
@@ -76,7 +76,7 @@ extern int kgdb_fault_expected;#define KGDB_MAX_NO_CPUS 1#define BUFMAX 400 -#define NUMREGBYTES (DBG_MAX_REG_NUM << 2) +#define NUMREGBYTES (GDB_MAX_REGS << 2)#define NUMCRITREGBYTES (32 << 2)#define _R0 0
PATCH 69/366 powerpc/ptrace: Fix enforcement of DAWR constraints
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit cd6ef7eebf171bfcba7dc2df719c2a4958775040 upstream.
Back when we first introduced the DAWR, in commit 4ae7ebe9522a ("powerpc: Change hardware breakpoint to allow longer ranges"), we screwed up the constraint making it a 1024 byte boundary rather than a
512. This makes the check overly permissive. Fortunately GDB is the only real user and it always did they right thing, so we never noticed.
This fixes the constraint to 512 bytes.
--- arch/powerpc/kernel/hw_breakpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/hw_breakpoint.c +2 -2
@@ -174,8 +174,8 @@ int arch_validate_hwbkpt_settings(structif (cpu_has_feature (CPU_FTR_DAWR )) { length_max =512 ;/* 64 doublewords */ /* DAWR region can't cross 512 boundary */ -if ((bp->attr.bp_addr >>10 ) != - ((bp->attr.bp_addr + bp->attr.bp_len -1 ) >>10 )) +if ((bp->attr.bp_addr >>9 ) != + ((bp->attr.bp_addr + bp->attr.bp_len -1 ) >>9 ))return -EINVAL ; } if (info->len >
PATCH 70/366 powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Neuling <[email protected]>
commit 4f7c06e26ec9cf7fe9f0c54dc90079b6a4f4b2c3 upstream.
In commit e2a800beaca1 ("powerpc/hw_brk: Fix off by one error when validating DAWR region end") we fixed setting the DAWR end point to its max value via PPC_PTRACE_SETHWDEBUG. Unfortunately we broke PTRACE_SET_DEBUGREG when setting a 512 byte aligned breakpoint.
PTRACE_SET_DEBUGREG currently sets the length of the breakpoint to zero (memset() in hw_breakpoint_init()). This worked with arch_validate_hwbkpt_settings() before the above patch was applied but is now broken if the breakpoint is 512byte aligned.
This sets the length of the breakpoint to 8 bytes when using PTRACE_SET_DEBUGREG.
--- arch/powerpc/kernel/ptrace.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/ptrace.c +1 -0
@@ -1011,6 +1011,7 @@ int ptrace_set_debugreg(struct task_stru/* Create a new breakpoint request if one doesn't exist already */ hw_breakpoint_init (&attr); attr.bp_addr = hw_brk.address; + attr.bp_len =8 ;arch_bp_generic_fields (hw_brk.type, &attr.bp_type);
PATCH 71/366 net: ethernet: davinci_emac: Fix printing of base address
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 5a04e8f81a4f55ce1c2b7b525744a187c99ba302 upstream.
Use %pa which is the correct formatter to print a physical address, instead of %p which is just a pointer.
--- drivers/net/ethernet/ti/davinci_emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +2 -2
@@ -2024,8 +2024,8 @@ static int davinci_emac_probe(struct plaif (netif_msg_probe (priv)) {dev_notice (&pdev->dev,"DaVinci EMAC Probe found device " -"(regs: %p, irq: %d)\n" , - (void *)priv->emac_base_phys, ndev->irq); +"(regs: %pa, irq: %d)\n" , + &priv->emac_base_phys, ndev->irq); }pm_runtime_put (&pdev->dev);
PATCH 72/366 m68k: Implement ndelay() as an inline function to force type checking/casting
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit d8441ba80c55aad435e4b98fe0d7ad5d21e46bf9 upstream.
ndelay() is supposed to take an unsigned long, but if you define ndelay() as a macro and the caller pass an unsigned long long instead of an unsigned long, the unsigned long long to unsigned long cast is not done and we end up with an "undefined reference to `__udivdi3'" error at link time.
Fix that by making ndelay() an inline function and then defining dummy ndelay() macro that redirects to the ndelay() function (it's how most archs do to implement ndelay()).
--- arch/m68k/include/asm/delay.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/m68k/include/asm/delay.h +8 -3
@@ -48,8 +48,6 @@ extern void __bad_udelay(void);* The simpler m68k and ColdFire processors do not have a 32*32->64 * multiply instruction. So we need to handle them a little differently. * We use a bit of shifting and a single 32*32->32 multiply to get close. -* This is a macro so that the const version can factor out the first -* multiply and shift. */ #define HZSCALE (268435456 / (1000000 / HZ))
@@ -114,6 +112,13 @@ static inline void __udelay(unsigned lon*/ #define HZSCALE (268435456 / (1000000 / HZ)) -#define ndelay (n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000)) +static inline void ndelay (unsigned long nsec) +{ +__delay (DIV_ROUND_UP (nsec * + ((((HZSCALE ) >>11 ) * + (loops_per_jiffy >>11 )) >>6 ), +1000 )); +} +#define ndelay (n) ndelay(n)#endif /* defined(_M68K_DELAY_H) */
PATCH 73/366 ALSA: hda/conexant - Add fixup for HP Z2 G4 workstation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit f16041df4c360eccacfe90f96673b37829e4c959 upstream.
HP Z2 G4 requires the same workaround as other HP machines that have no mic-pin detection.
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -3454,6 +3454,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x103c ,0x8115 ,"HP Z1 Gen3" ,CXT_FIXUP_HP_GATE_MIC ),SND_PCI_QUIRK (0x103c ,0x8299 ,"HP 800 G3 SFF" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x829a ,"HP 800 G3 DM" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x103c ,0x8455 ,"HP Z2 G4" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x138d ,"Asus" ,CXT_FIXUP_HEADPHONE_MIC_PIN ),SND_PCI_QUIRK (0x152d ,0x0833 ,"OLPC XO-1.5" ,CXT_FIXUP_OLPC_XO ), SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
PATCH 74/366 RDMA/ipoib: Update paths on CLIENT_REREG/SM_CHANGE events
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Doug Ledford <[email protected]>
commit fa9391dbad4b868512ed22a7e41765f881a8a935 upstream.
We do a light flush on CLIENT_REREG and SM_CHANGE events. This goes through and marks paths invalid. But we weren't always checking for this validity when we needed to, and so we could keep using a path marked invalid. What's more, once we establish a path with a valid ah, we put a pointer to the ah in the neigh struct directly, so even if we mark the path as invalid, as long as the neigh has a direct pointer to the ah, it keeps using the old, outdated ah.
To fix this we do several things.
1) Put the valid flag in the ah instead of the path struct, so when we put the ah pointer directly in the neigh struct, we can easily check the validity of the ah on send events.
2) Check the neigh->ah and neigh->ah->valid elements in the needed places, and if we have an ah, but it's invalid, then invoke a refresh of the ah.
3) Fix the various places that check for path, but didn't check for path->valid (now path->ah && path->ah->valid).
[bwh: Backported to 3.16:
- s/phdr->hwaddr/cb->hdwaddr/
- s/ipoib_priv/netdev_priv/
- Adjust context]
--- drivers/infiniband/ulp/ipoib/ipoib.h | 2 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 33 ++++++++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
@@ -384,6 +384,7 @@ struct ipoib_ah {struct list_head list;struct kref ref;unsigned last_send; +int valid; };struct ipoib_path {
@@ -400,7 +401,6 @@ struct ipoib_path {struct rb_node rb_node;struct list_head list; -int valid; };struct ipoib_neigh {
drivers/infiniband/ulp/ipoib/ipoib_main.c +27 -6
@@ -426,7 +426,8 @@ void ipoib_mark_paths_invalid(struct netipoib_dbg (priv,"mark path LID 0x%04x GID %pI6 invalid\n" ,be16_to_cpu (path->pathrec.dlid), path->pathrec.dgid.raw); - path->valid =0 ; +if (path->ah) + path->ah->valid =0 ; }spin_unlock_irq (&priv->lock);
@@ -535,7 +536,7 @@ static void path_rec_completion(int statwhile ((skb =__skb_dequeue (&neigh->queue)))__skb_queue_tail (&skqueue, skb); } - path->valid =1 ; + path->ah->valid =1 ; } path->query =NULL ;
@@ -615,6 +616,24 @@ static int path_rec_start(struct net_devreturn 0 ; } +static void neigh_refresh_path (struct ipoib_neigh *neigh,u8 *daddr, +struct net_device *dev) +{ +struct ipoib_dev_priv *priv =netdev_priv (dev); +struct ipoib_path *path; +unsigned long flags; + +spin_lock_irqsave (&priv->lock, flags); + + path =__path_find (dev, daddr +4 ); +if (!path) + goto out; +if (!path->query) +path_rec_start (dev, path); +out: +spin_unlock_irqrestore (&priv->lock, flags); +} +static struct ipoib_neigh *neigh_add_path (struct sk_buff *skb,u8 *daddr,struct net_device *dev) {
@@ -651,7 +670,7 @@ static struct ipoib_neigh *neigh_add_patlist_add_tail (&neigh->list, &path->neigh_list); -if (path->ah) { +if (path->ah && path->ah->valid) {kref_get (&path->ah->ref); neigh->ah = path->ah;
@@ -710,7 +729,7 @@ static void unicast_arp_send(struct sk_bspin_lock_irqsave (&priv->lock, flags); path =__path_find (dev, cb->hwaddr +4 ); -if (!path || !path->valid) { +if (!path || !path->ah || !path->ah->valid) {int new_path =0 ;if (!path) {
@@ -736,7 +755,7 @@ static void unicast_arp_send(struct sk_breturn ; } -if (path->ah) { +if (path->ah && path->ah->valid) {ipoib_dbg (priv,"Send unicast ARP to %04x\n" ,be16_to_cpu (path->pathrec.dlid));
@@ -818,9 +837,11 @@ send_using_neigh:ipoib_cm_send (dev, skb,ipoib_cm_get (neigh)); goto unref; } - }else if (neigh->ah) { + }else if (neigh->ah && neigh->ah->valid) {ipoib_send (dev, skb, neigh->ah,IPOIB_QPN (cb->hwaddr)); goto unref; + }else if (neigh->ah) { +neigh_refresh_path (neigh, cb->hwaddr, dev); }if (skb_queue_len (&neigh->queue) <IPOIB_MAX_PATH_REC_QUEUE ) {
PATCH 75/366 of: unittest: for strings, account for trailing \\0 in property length field
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan M Schaeckeler <[email protected]>
commit 3b9cf7905fe3ab35ab437b5072c883e609d3498d upstream.
For strings, account for trailing \0 in property length field:
This is consistent with how dtc builds string properties.
Function __of_prop_dup() would misbehave on such properties as it duplicates properties based on the property length field creating new string values without trailing \0s.
--- drivers/of/selftest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/of/selftest.c +4 -4
@@ -97,20 +97,20 @@ static void __init of_selftest_dynamic(v/* Add a new property - should pass*/ prop->name ="new-property" ; prop->value ="new-property-data" ; - prop->length =strlen (prop->value); + prop->length =strlen (prop->value) +1 ;selftest (of_add_property (np, prop) ==0 ,"Adding a new property failed\n" );/* Try to add an existing property - should fail */ prop++; prop->name ="new-property" ; prop->value ="new-property-data-should-fail" ; - prop->length =strlen (prop->value); + prop->length =strlen (prop->value) +1 ;selftest (of_add_property (np, prop) !=0 ,"Adding an existing property should have failed\n" );/* Try to modify an existing property - should pass */ prop->value ="modify-property-data-should-pass" ; - prop->length =strlen (prop->value); + prop->length =strlen (prop->value) +1 ;selftest (of_update_property (np, prop) ==0 ,"Updating an existing property should have passed\n" );
@@ -118,7 +118,7 @@ static void __init of_selftest_dynamic(v prop++; prop->name ="modify-property" ; prop->value ="modify-missing-property-data-should-pass" ; - prop->length =strlen (prop->value); + prop->length =strlen (prop->value) +1 ;selftest (of_update_property (np, prop) ==0 ,"Updating a missing property should have passed\n" );
PATCH 76/366 ipmi:bt: Set the timeout before doing a capabilities check
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit fe50a7d0393a552e4539da2d31261a59d6415950 upstream.
There was one place where the timeout value for an operation was not being set, if a capabilities request was done from idle. Move the timeout value setting to before where that change might be requested.
IMHO the cause here is the invisible returns in the macros. Maybe that's a job for later, though.
--- drivers/char/ipmi/ipmi_bt_sm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_bt_sm.c +2 -1
@@ -522,11 +522,12 @@ static enum si_sm_result bt_event(structif (status &BT_H_BUSY )/* clear a leftover H_BUSY */ BT_CONTROL (BT_H_BUSY ); + bt->timeout = bt->BT_CAP_req2rsp; +/* Read BT capabilities if it hasn't been done yet */ if (!bt->BT_CAP_outreqs)BT_STATE_CHANGE (BT_STATE_CAPABILITIES_BEGIN ,SI_SM_CALL_WITHOUT_DELAY ); - bt->timeout = bt->BT_CAP_req2rsp;BT_SI_SM_RETURN (SI_SM_IDLE );case BT_STATE_XACTION_START :
PATCH 77/366 ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 9e92f48c34eb2b9af9d12f892e2fe1fce5e8ce35 upstream.
We aren't checking to see if the in-inode extended attribute is corrupted before we try to expand the inode's extra isize fields.
This can lead to potential crashes caused by the BUG_ON() check in ext4_xattr_shift_entries().
--- fs/ext4/xattr.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
fs/ext4/xattr.c +28 -4
@@ -243,6 +243,27 @@ ext4_xattr_check_block(struct inode *inoreturn error; } +static int +__xattr_check_inode (struct inode *inode,struct ext4_xattr_ibody_header *header, +void *end,const char *function,unsigned int line) +{ +struct ext4_xattr_entry *entry =IFIRST (header); +int error = -EIO ; + +if (((void *) header >= end) || + (header->h_magic !=le32_to_cpu (EXT4_XATTR_MAGIC ))) + goto errout; + error =ext4_xattr_check_names (entry, end, entry); +errout: +if (error) +__ext4_error_inode (inode, function, line,0 , +"corrupted in-inode xattr" ); +return error; +} + +#define xattr_check_inode (inode, header, end) \ + __xattr_check_inode((inode), (header), (end), __func__, __LINE__) +static inline int ext4_xattr_check_entry (struct ext4_xattr_entry *entry,size_t size) {
@@ -368,7 +389,7 @@ ext4_xattr_ibody_get(struct inode *inode header =IHDR (inode, raw_inode); entry =IFIRST (header); end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; - error =ext4_xattr_check_names (entry, end, entry); + error =xattr_check_inode (inode, header, end);if (error) goto cleanup; error = xattr_find_entry(inode, &entry, end, name_index, name,
@@ -506,7 +527,7 @@ ext4_xattr_ibody_list(struct dentry *den raw_inode =ext4_raw_inode (&iloc); header =IHDR (inode, raw_inode); end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size; - error =ext4_xattr_check_names (IFIRST (header), end,IFIRST (header)); + error =xattr_check_inode (inode, header, end);if (error) goto cleanup; error = ext4_xattr_list_entries(dentry, IFIRST(header),
@@ -1038,8 +1059,7 @@ int ext4_xattr_ibody_find(struct inode * is->s.here = is->s.first; is->s.end = (void *)raw_inode +EXT4_SB (inode->i_sb)->s_inode_size;if (ext4_test_inode_state (inode,EXT4_STATE_XATTR )) { - error =ext4_xattr_check_names (IFIRST (header), is->s.end, -IFIRST (header)); + error =xattr_check_inode (inode, header, is->s.end);if (error)return error;/* Find the named attribute. */
@@ -1319,6 +1339,10 @@ retry: last = entry; total_ino =sizeof (struct ext4_xattr_ibody_header ); + error =xattr_check_inode (inode, header, end); +if (error) + goto cleanup; + free =ext4_xattr_free_space (last, &min_offs, base, &total_ino);if (free >= new_extra_isize) { entry =IFIRST (header);
PATCH 78/366 ext4: correct endianness conversion in __xattr_check_inode()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 199625098a18a5522b424dea9b122b254c022fc5 upstream.
It should be cpu_to_le32(), not le32_to_cpu(). No change in behavior.
Found with sparse, and this was the only endianness warning in fs/ext4/.
--- fs/ext4/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/xattr.c +1 -1
@@ -251,7 +251,7 @@ __xattr_check_inode(struct inode *inode,int error = -EIO ;if (((void *) header >= end) || - (header->h_magic !=le32_to_cpu (EXT4_XATTR_MAGIC ))) + (header->h_magic !=cpu_to_le32 (EXT4_XATTR_MAGIC ))) goto errout; error =ext4_xattr_check_names (entry, end, entry); errout:
PATCH 79/366 ext4: don't read out of bounds when checking for in-inode xattrs
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 290ab230016f187c3551d8380ea742889276d03a upstream.
With i_extra_isize equal to or close to the available space, it was possible for us to read past the end of the inode when trying to detect or validate in-inode xattrs. Fix this by checking for the needed extra space first.
This patch shouldn't have any noticeable effect on non-corrupted/non-malicious filesystems.
--- fs/ext4/inode.c | 4 +++- fs/ext4/xattr.c | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-)
fs/ext4/inode.c +3 -1
@@ -4165,7 +4165,9 @@ static inline void ext4_iget_extra_inode {__le32 *magic = (void *)raw_inode +EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize; -if (*magic ==cpu_to_le32 (EXT4_XATTR_MAGIC )) { +if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize +sizeof (__le32) <= +EXT4_INODE_SIZE (inode->i_sb) && + *magic ==cpu_to_le32 (EXT4_XATTR_MAGIC )) {ext4_set_inode_state (inode,EXT4_STATE_XATTR );ext4_find_inline_data_nolock (inode); }else
fs/ext4/xattr.c +2 -3
@@ -247,13 +247,12 @@ static int __xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header, void *end, const char *function, unsigned int line) { - struct ext4_xattr_entry *entry = IFIRST(header); int error = -EIO; -if (((void *) header >= end) || +if (end - (void *)header <sizeof (*header) +sizeof (u32) || (header->h_magic !=cpu_to_le32 (EXT4_XATTR_MAGIC ))) goto errout; - error =ext4_xattr_check_names (entry, end, entry); + error =ext4_xattr_check_names (IFIRST (header), end,IFIRST (header)); errout: if (error) __ext4_error_inode(inode, function, line, 0,
PATCH 80/366 ext4: bubble errors from ext4_find_inline_data_nolock() up to ext4_iget()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit eb9b5f01c33adebc31cbc236c02695f605b0e417 upstream.
If ext4_find_inline_data_nolock() returns an error it needs to get reflected up to ext4_iget(). In order to fix this, ext4_iget_extra_inode() needs to return an error (and not return void).
This is related to "ext4: do not allow external inodes for inline data" (which fixes CVE-2018-11412) in that in the errors=continue case, it would be useful to for userspace to receive an error indicating that file system is corrupted.
--- fs/ext4/inode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/ext4/inode.c +7 -3
@@ -4159,19 +4159,21 @@ static blkcnt_t ext4_inode_blocks(struct } } -static inline void ext4_iget_extra_inode (struct inode *inode, +static inline int ext4_iget_extra_inode (struct inode *inode,struct ext4_inode *raw_inode,struct ext4_inode_info *ei) {__le32 *magic = (void *)raw_inode +EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize; +if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize +sizeof (__le32) <=EXT4_INODE_SIZE (inode->i_sb) && *magic ==cpu_to_le32 (EXT4_XATTR_MAGIC )) {ext4_set_inode_state (inode,EXT4_STATE_XATTR ); -ext4_find_inline_data_nolock (inode); +return ext4_find_inline_data_nolock (inode); }else EXT4_I (inode)->i_inline_off =0 ; +return 0 ; }struct inode *ext4_iget (struct super_block *sb,unsigned long ino)
@@ -4331,7 +4333,9 @@ struct inode *ext4_iget(struct super_blo ei->i_extra_isize =sizeof (struct ext4_inode ) -EXT4_GOOD_OLD_INODE_SIZE ; }else { -ext4_iget_extra_inode (inode, raw_inode, ei); + ret =ext4_iget_extra_inode (inode, raw_inode, ei); +if (ret) + goto bad_inode; } }
PATCH 81/366 PCI: pciehp: Clear Presence Detect and Data Link Layer Status Changed on resume
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
commit 13c65840feab8109194f9490c9870587173cb29d upstream.
After a suspend/resume cycle the Presence Detect or Data Link Layer Status Changed bits might be set. If we don't clear them those events will not fire anymore and nothing happens for instance when a device is now hot-unplugged.
Fix this by clearing those bits in a newly introduced function pcie_reenable_notification(). This should be fine because immediately after, we check if the adapter is still present by reading directly from the status register.
--- drivers/pci/hotplug/pciehp.h | 2 +- drivers/pci/hotplug/pciehp_core.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-)
drivers/pci/hotplug/pciehp.h +1 -1
@@ -143,7 +143,7 @@ struct controller *pcie_init(struct pcieint pcie_init_notification (struct controller *ctrl);int pciehp_enable_slot (struct slot *p_slot);int pciehp_disable_slot (struct slot *p_slot); -void pcie_enable_notification (struct controller *ctrl); +void pcie_reenable_notification (struct controller *ctrl);int pciehp_power_on_slot (struct slot *slot);void pciehp_power_off_slot (struct slot *slot);void pciehp_get_power_status (struct slot *slot,u8 *status);
drivers/pci/hotplug/pciehp_core.c +1 -1
@@ -332,7 +332,7 @@ static int pciehp_resume(struct pcie_dev ctrl =get_service_data (dev);/* reinitialize the chipset's event detection logic */ -pcie_enable_notification (ctrl); +pcie_reenable_notification (ctrl); slot = ctrl->slot;
drivers/pci/hotplug/pciehp_hpc.c +12 -1
@@ -580,7 +580,7 @@ static irqreturn_t pcie_isr(int irq, voireturn IRQ_HANDLED ; } -void pcie_enable_notification (struct controller *ctrl) +static void pcie_enable_notification (struct controller *ctrl) {u16 cmd, mask;
@@ -618,6 +618,17 @@ void pcie_enable_notification(struct conpcie_write_cmd (ctrl, cmd, mask); } +void pcie_reenable_notification (struct controller *ctrl) +{ +/* +* Clear both Presence and Data Link Layer Changed to make sure +* those events still fire after we have re-enabled them. +*/ +pcie_capability_write_word (ctrl->pcie->port,PCI_EXP_SLTSTA , +PCI_EXP_SLTSTA_PDC |PCI_EXP_SLTSTA_DLLSC ); +pcie_enable_notification (ctrl); +} +static void pcie_disable_notification (struct controller *ctrl) {u16 mask;
PATCH 82/366 m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michael Schmitz <[email protected]>
commit 3f90f9ef2dda316d64e420d5d51ba369587ccc55 upstream.
If 020/030 support is enabled, get_io_area() leaves an IO_SIZE gap between mappings which is added to the vm_struct representing the mapping. __ioremap() uses the actual requested size (after alignment), while __iounmap() is passed the size from the vm_struct.
On 020/030, early termination descriptors are used to set up mappings of extent 'size', which are validated on unmapping. The unmapped gap of size IO_SIZE defeats the sanity check of the pmd tables, causing __iounmap() to loop forever on 030.
On 040/060, unmapping of page table entries does not check for a valid mapping, so the umapping loop always completes there.
Adjust size to be unmapped by the gap that had been added in the vm_struct prior.
This fixes the hang in atari_platform_init() reported a long time ago, and a similar one reported by Finn recently (addressed by removing ioremap() use from the SWIM driver.
Tested on my Falcon in 030 mode - untested but should work the same on 040/060 (the extra page tables cleared there would never have been set up anyway).
--- arch/m68k/mm/kmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/m68k/mm/kmap.c +2 -1
@@ -88,7 +88,8 @@ static inline void free_io_area(void *adfor (p = &iolist ; (tmp = *p) ; p = &tmp->next) {if (tmp->addr == addr) { *p = tmp->next; -__iounmap (tmp->addr, tmp->size); +/* remove gap added in get_io_area() */ +__iounmap (tmp->addr, tmp->size -IO_SIZE );kfree (tmp);return ; }
PATCH 83/366 IB/isert: Fix for lib/dma_debug check_sync warning
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Estrin <[email protected]>
commit 763b69654bfb88ea3230d015e7d755ee8339f8ee upstream.
The following error message occurs on a target host in a debug build during session login:
[ 3524.411874] WARNING: CPU: 5 PID: 12063 at lib/dma-debug.c:1207 check_sync+0x4ec/0x5b0 [ 3524.421057] infiniband hfi1_0: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x0000000000000000] [size=76 bytes]
......snip .....
[ 3524.535846] CPU: 5 PID: 12063 Comm: iscsi_np Kdump: loaded Not tainted 3.10.0-862.el7.x86_64.debug #1 [ 3524.546764] Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 1.2.6 06/08/2015 [ 3524.555740] Call Trace: [ 3524.559102] [<ffffffffa5fe915b>] dump_stack+0x19/0x1b [ 3524.565477] [<ffffffffa58a2f58>] __warn+0xd8/0x100 [ 3524.571557] [<ffffffffa58a2fdf>] warn_slowpath_fmt+0x5f/0x80 [ 3524.578610] [<ffffffffa5bf5b8c>] check_sync+0x4ec/0x5b0 [ 3524.585177] [<ffffffffa58efc3f>] ? set_cpus_allowed_ptr+0x5f/0x1c0 [ 3524.592812] [<ffffffffa5bf5cd0>] debug_dma_sync_single_for_cpu+0x80/0x90 [ 3524.601029] [<ffffffffa586add3>] ? x2apic_send_IPI_mask+0x13/0x20 [ 3524.608574] [<ffffffffa585ee1b>] ? native_smp_send_reschedule+0x5b/0x80 [ 3524.616699] [<ffffffffa58e9b76>] ? resched_curr+0xf6/0x140 [ 3524.623567] [<ffffffffc0879af0>] isert_create_send_desc.isra.26+0xe0/0x110 [ib_isert] [ 3524.633060] [<ffffffffc087af95>] isert_put_login_tx+0x55/0x8b0 [ib_isert] [ 3524.641383] [<ffffffffa58ef114>] ? try_to_wake_up+0x1a4/0x430 [ 3524.648561] [<ffffffffc098cfed>] iscsi_target_do_tx_login_io+0xdd/0x230 [iscsi_target_mod] [ 3524.658557] [<ffffffffc098d827>] iscsi_target_do_login+0x1a7/0x600 [iscsi_target_mod] [ 3524.668084] [<ffffffffa59f9bc9>] ? kstrdup+0x49/0x60 [ 3524.674420] [<ffffffffc098e976>] iscsi_target_start_negotiation+0x56/0xc0 [iscsi_target_mod] [ 3524.684656] [<ffffffffc098c2ee>] __iscsi_target_login_thread+0x90e/0x1070 [iscsi_target_mod] [ 3524.694901] [<ffffffffc098ca50>] ? __iscsi_target_login_thread+0x1070/0x1070 [iscsi_target_mod] [ 3524.705446] [<ffffffffc098ca50>] ? __iscsi_target_login_thread+0x1070/0x1070 [iscsi_target_mod] [ 3524.715976] [<ffffffffc098ca78>] iscsi_target_login_thread+0x28/0x60 [iscsi_target_mod] [ 3524.725739] [<ffffffffa58d60ff>] kthread+0xef/0x100 [ 3524.732007] [<ffffffffa58d6010>] ? insert_kthread_work+0x80/0x80 [ 3524.739540] [<ffffffffa5fff1b7>] ret_from_fork_nospec_begin+0x21/0x21 [ 3524.747558] [<ffffffffa58d6010>] ? insert_kthread_work+0x80/0x80 [ 3524.755088] ---[ end trace 23f8bf9238bd1ed8 ]--- [ 3595.510822] iSCSI/iqn.1994-05.com.redhat:537fa56299: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION.
The code calls dma_sync on login_tx_desc->dma_addr prior to initializing it with dma-mapped address.login_tx_desc is a part of iser_conn structure and is used only once during login negotiation, so the issue is fixed by eliminating dma_sync call for this buffer using a special case routine.
[bwh: Backported to 3.16:
- Parameters to isert_create_send_desc() are not redundant; forward them all to __isert_create_send_desc()
- Adjust context]
--- drivers/infiniband/ulp/isert/ib_isert.c | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +17 -8
@@ -1033,14 +1033,10 @@ isert_post_send(struct isert_conn *isert }static void -isert_create_send_desc (struct isert_conn *isert_conn, -struct isert_cmd *isert_cmd, -struct iser_tx_desc *tx_desc) +__isert_create_send_desc (struct isert_conn *isert_conn, +struct isert_cmd *isert_cmd, +struct iser_tx_desc *tx_desc) { -struct ib_device *ib_dev = isert_conn->conn_cm_id->device; - -ib_dma_sync_single_for_cpu (ib_dev, tx_desc->dma_addr, -ISER_HEADERS_LEN ,DMA_TO_DEVICE );memset (&tx_desc->iser_header,0 ,sizeof (struct iser_hdr )); tx_desc->iser_header.flags =ISER_VER ;
@@ -1054,6 +1050,19 @@ isert_create_send_desc(struct isert_conn } } +static void +isert_create_send_desc (struct isert_conn *isert_conn, +struct isert_cmd *isert_cmd, +struct iser_tx_desc *tx_desc) +{ +struct ib_device *ib_dev = isert_conn->conn_cm_id->device; + +ib_dma_sync_single_for_cpu (ib_dev, tx_desc->dma_addr, +ISER_HEADERS_LEN ,DMA_TO_DEVICE ); + +__isert_create_send_desc (isert_conn, isert_cmd, tx_desc); +} +static int isert_init_tx_hdrs (struct isert_conn *isert_conn,struct iser_tx_desc *tx_desc)
@@ -1150,7 +1159,7 @@ isert_put_login_tx(struct iscsi_conn *costruct iser_tx_desc *tx_desc = &isert_conn->conn_login_tx_desc;int ret; -isert_create_send_desc (isert_conn,NULL , tx_desc); +__isert_create_send_desc (isert_conn,NULL , tx_desc);memcpy (&tx_desc->iscsi_header, &login->rsp[0 ],sizeof (struct iscsi_hdr ));
PATCH 84/366 IB/qib: Fix DMA api warning with debug kernel
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <[email protected]>
commit 0252f73334f9ef68868e4684200bea3565a4fcee upstream.
The following error occurs in a debug build when running MPI PSM:
[ 307.415911] WARNING: CPU: 4 PID: 23867 at lib/dma-debug.c:1158 check_unmap+0x4ee/0xa20 [ 307.455661] ib_qib 0000:05:00.0: DMA-API: device driver failed to check map error[device address=0x00000000df82b000] [size=4096 bytes] [mapped as page] [ 307.517494] Modules linked in: [ 307.531584] ib_isert iscsi_target_mod ib_srpt target_core_mod rpcrdma
sunrpc ib_srp scsi_transport_srp scsi_tgt ib_iser libiscsi ib_ipoib scsi_transport_iscsi rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm ib_qib intel_powerclamp coretemp rdmavt intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel ipmi_ssif ib_core aesni_intel sg ipmi_si lrw gf128mul dca glue_helper ipmi_devintf iTCO_wdt gpio_ich hpwdt iTCO_vendor_support ablk_helper hpilo acpi_power_meter cryptd ipmi_msghandler ie31200_edac shpchp pcc_cpufreq lpc_ich pcspkr ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm ahci crct10dif_pclmul crct10dif_common drm crc32c_intel libahci tg3 libata serio_raw ptp i2c_core
[ 307.846113] pps_core dm_mirror dm_region_hash dm_log dm_mod [ 307.866505] CPU: 4 PID: 23867 Comm: mpitests-IMB-MP Kdump: loaded Not tainted 3.10.0-862.el7.x86_64.debug #1 [ 307.911178] Hardware name: HP ProLiant DL320e Gen8, BIOS J05 11/09/2013 [ 307.944206] Call Trace: [ 307.956973] [<ffffffffbd9e915b>] dump_stack+0x19/0x1b [ 307.982201] [<ffffffffbd2a2f58>] __warn+0xd8/0x100 [ 308.005999] [<ffffffffbd2a2fdf>] warn_slowpath_fmt+0x5f/0x80 [ 308.034260] [<ffffffffbd5f667e>] check_unmap+0x4ee/0xa20 [ 308.060801] [<ffffffffbd41acaa>] ? page_add_file_rmap+0x2a/0x1d0 [ 308.090689] [<ffffffffbd5f6c4d>] debug_dma_unmap_page+0x9d/0xb0 [ 308.120155] [<ffffffffbd4082e0>] ? might_fault+0xa0/0xb0 [ 308.146656] [<ffffffffc07761a5>] qib_tid_free.isra.14+0x215/0x2a0 [ib_qib] [ 308.180739] [<ffffffffc0776bf4>] qib_write+0x894/0x1280 [ib_qib] [ 308.210733] [<ffffffffbd540b00>] ? __inode_security_revalidate+0x70/0x80 [ 308.244837] [<ffffffffbd53c2b7>] ? security_file_permission+0x27/0xb0 [ 308.266025] qib_ib0.8006: multicast join failed for ff12:401b:8006:0000:0000:0000:ffff:ffff, status -22 [ 308.323421] [<ffffffffbd46f5d3>] vfs_write+0xc3/0x1f0 [ 308.347077] [<ffffffffbd492a5c>] ? fget_light+0xfc/0x510 [ 308.372533] [<ffffffffbd47045a>] SyS_write+0x8a/0x100 [ 308.396456] [<ffffffffbd9ff355>] system_call_fastpath+0x1c/0x21
The code calls a qib_map_page() which has never correctly tested for a mapping error.
Fix by testing for pci_dma_mapping_error() in all cases and properly handling the failure in the caller.
Additionally, streamline qib_map_page() arguments to satisfy just the single caller.
--- drivers/infiniband/hw/qib/qib.h | 3 +-- drivers/infiniband/hw/qib/qib_file_ops.c | 10 +++++++--- drivers/infiniband/hw/qib/qib_user_pages.c | 20 ++++++++++++-------- 3 files changed, 20 insertions(+), 13 deletions(-)
drivers/infiniband/hw/qib/qib.h +1 -2
@@ -1452,8 +1452,7 @@ u64 qib_sps_ints(void);/* * dma_addr wrappers - all 0's invalid for hw */ -dma_addr_t qib_map_page (struct pci_dev *,struct page *,unsigned long , -size_t ,int ); +int qib_map_page (struct pci_dev *d,struct page *p,dma_addr_t *daddr);const char *qib_get_unit_name (int unit);/*
drivers/infiniband/hw/qib/qib_file_ops.c +7 -3
@@ -359,6 +359,8 @@ static int qib_tid_update(struct qib_ctx goto done; }for (i =0 ; i < cnt; i++, vaddr +=PAGE_SIZE ) { +dma_addr_t daddr; +for (; ntids--; tid++) {if (tid == tidcnt) tid =0 ;
@@ -375,12 +377,14 @@ static int qib_tid_update(struct qib_ctx ret = -ENOMEM ;break ; } + ret =qib_map_page (dd->pcidev, pagep[i], &daddr); +if (ret) +break ; + tidlist[i] = tid + tidoff;/* we "know" system pages and TID pages are same size */ dd->pageshadow[ctxttid + tid] = pagep[i]; - dd->physshadow[ctxttid + tid] = -qib_map_page (dd->pcidev, pagep[i],0 ,PAGE_SIZE , -PCI_DMA_FROMDEVICE ); + dd->physshadow[ctxttid + tid] = daddr;/* * don't need atomic or it's overhead */
drivers/infiniband/hw/qib/qib_user_pages.c +12 -8
@@ -98,23 +98,27 @@ bail:* * I'm sure we won't be so lucky with other iommu's, so FIXME. */ -dma_addr_t qib_map_page (struct pci_dev *hwdev,struct page *page, -unsigned long offset,size_t size,int direction) +int qib_map_page (struct pci_dev *hwdev,struct page *page,dma_addr_t *daddr) {dma_addr_t phys; - phys =pci_map_page (hwdev, page, offset, size, direction); + phys =pci_map_page (hwdev, page,0 ,PAGE_SIZE ,PCI_DMA_FROMDEVICE ); +if (pci_dma_mapping_error (hwdev, phys)) +return -ENOMEM ; -if (phys ==0 ) { -pci_unmap_page (hwdev, phys, size, direction); - phys =pci_map_page (hwdev, page, offset, size, direction); +if (!phys) { +pci_unmap_page (hwdev, phys,PAGE_SIZE ,PCI_DMA_FROMDEVICE ); + phys =pci_map_page (hwdev, page,0 ,PAGE_SIZE , +PCI_DMA_FROMDEVICE ); +if (pci_dma_mapping_error (hwdev, phys)) +return -ENOMEM ;/* * FIXME: If we get 0 again, we should keep this page, * map another, then free the 0 page. */ } - -return phys; + *daddr = phys; +return 0 ; }/**
PATCH 85/366 usb: gadget: function: printer: avoid spinlock recursion
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
commit 9ada8c582088d32bd5c071c17213bc6edf37443a upstream.
If usb_gadget_giveback_request() is called in usb_ep_queue(), this printer_write() is possible to cause spinlock recursion. So, this patch adds spin_unlock() before calls usb_ep_queue() to avoid it.
--- drivers/usb/gadget/printer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/gadget/printer.c +6 -1
@@ -587,6 +587,7 @@ printer_write(struct file *fd, const chasize_t size;/* Amount of data in a TX request. */ size_t bytes_copied =0 ;struct usb_request *req; +int value;DBG (dev,"printer_write trying to send %d bytes\n" , (int )len);
@@ -666,7 +667,11 @@ printer_write(struct file *fd, const chareturn -EAGAIN ; } -if (usb_ep_queue (dev->in_ep, req,GFP_ATOMIC )) { +/* here, we unlock, and only unlock, to avoid deadlock. */ +spin_unlock (&dev->lock); + value =usb_ep_queue (dev->in_ep, req,GFP_ATOMIC ); +spin_lock (&dev->lock); +if (value) {list_add (&req->list, &dev->tx_reqs);spin_unlock_irqrestore (&dev->lock, flags);mutex_unlock (&dev->lock_printer_io);
PATCH 86/366 usb: gadget: function: printer: avoid wrong list handling in printer_write()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
commit 4a014a7339f441b0851ce012f469c0fadac61c81 upstream.
When printer_write() calls usb_ep_queue(), a udc driver (e.g. renesas_usbhs driver) may call usb_gadget_giveback_request() in the udc .queue ops immediately. Then, printer_write() calls list_add(&req->list, &dev->tx_reqs_active) wrongly. After that, if we do unbind the printer driver, WARN_ON() happens in printer_func_unbind() because the list entry is not removed.
So, this patch moves list_add(&req->list, &dev->tx_reqs_active) calling before usb_ep_queue().
--- drivers/usb/gadget/printer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/printer.c +3 -3
@@ -667,19 +667,19 @@ printer_write(struct file *fd, const chareturn -EAGAIN ; } +list_add (&req->list, &dev->tx_reqs_active); +/* here, we unlock, and only unlock, to avoid deadlock. */ spin_unlock (&dev->lock); value =usb_ep_queue (dev->in_ep, req,GFP_ATOMIC );spin_lock (&dev->lock);if (value) { +list_del (&req->list);list_add (&req->list, &dev->tx_reqs);spin_unlock_irqrestore (&dev->lock, flags);mutex_unlock (&dev->lock_printer_io);return -EAGAIN ; } - -list_add (&req->list, &dev->tx_reqs_active); - }spin_unlock_irqrestore (&dev->lock, flags);
PATCH 87/366 perf/core: Fix group scheduling with mixed hw and sw events
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Song Liu <[email protected]>
commit a1150c202207cc8501bebc45b63c264f91959260 upstream.
When hw and sw events are mixed in the same group, they are all attached to the hw perf_event_context. This sometimes requires moving group of perf_event to a different context.
We found a bug in how the kernel handles this, for example if we do:
perf stat -e '{faults,ref-cycles,faults}' -I 1000
1.005591180 1,297 faults
1.005591180 457,476,576 ref-cycles
1.005591180 <not supported> faultsFirst, sw event "faults" is attached to the sw context, and becomes the group leader. Then, hw event "ref-cycles" is attached, so both events are moved to the hw context. Last, another sw "faults" tries to attach, but it fails because of mismatch between the new target ctx (from sw pmu) and the group_leader's ctx (hw context, same as ref-cycles).
The broken condition is:
group_leader is sw event;
group_leader is on hw context;
add a sw event to the group.
Fix this scenario by checking group_leader's context (instead of just event type). If group_leader is on hw context, use the ->pmu of this context to look up context for the new event.
--- include/linux/perf_event.h | 8 ++++++++ kernel/events/core.c | 21 +++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-)
include/linux/perf_event.h +8 -0
@@ -640,6 +640,14 @@ static inline int is_software_event(strureturn event->pmu->task_ctx_nr == perf_sw_context; } +/* +* Return 1 for event in sw context, 0 for event in hw context +*/ +static inline int in_software_context (struct perf_event *event) +{ +return event->ctx->pmu->task_ctx_nr == perf_sw_context; +} +extern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX ];extern void ___perf_sw_event (u32 ,u64 ,struct pt_regs *,u64 );
kernel/events/core.c +11 -10
@@ -7502,19 +7502,20 @@ SYSCALL_DEFINE5(perf_event_open,*/ pmu = event->pmu; -if (group_leader && - (is_software_event (event) !=is_software_event (group_leader))) { -if (is_software_event (event)) { +if (group_leader) { +if (is_software_event (event) && + !in_software_context (group_leader)) {/* -* If event and group_leader are not both a software -* event, and event is, then group leader is not. +* If the event is a sw event, but the group_leader +* is on hw context. * -* Allow the addition of software events to !software -* groups, this is safe because software events never -* fail to schedule. +* Allow the addition of software events to hw +* groups, this is safe because software events +* never fail to schedule. */ - pmu = group_leader->pmu; - }else if (is_software_event (group_leader) && + pmu = group_leader->ctx->pmu; + }else if (!is_software_event (event) && +is_software_event (group_leader) && (group_leader->group_flags &PERF_GROUP_SOFTWARE )) {/* * In case the group is a pure software group, and we
PATCH 88/366 ext4: fix fencepost error in check for inode count overflow during resize
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 4f2f76f751433908364ccff82f437a57d0e6e9b7 upstream.
ext4_resize_fs() has an off-by-one bug when checking whether growing of a filesystem will not overflow inode count. As a result it allows a filesystem with 8192 inodes per group to grow to 64TB which overflows inode count to 0 and makes filesystem unusable. Fix it.
--- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/resize.c +1 -1
@@ -1906,7 +1906,7 @@ retry:return 0 ; n_group =ext4_get_group_number (sb, n_blocks_count -1 ); -if (n_group > (0xFFFFFFFFUL /EXT4_INODES_PER_GROUP (sb))) { +if (n_group >= (0xFFFFFFFFUL /EXT4_INODES_PER_GROUP (sb))) {ext4_warning (sb,"resize would cause inodes_count overflow" );return -EINVAL ; }
PATCH 89/366 Btrfs: don't BUG_ON() in btrfs_truncate_inode_items()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit 0552210997badb6a60740a26ff9d976a416510f0 upstream.
btrfs_free_extent() can fail because of ENOMEM. There's no reason to panic here, we can just abort the transaction.
[bwh: Backported to 3.16:
- Also pass root to btrfs_abort_transaction()
- Adjust context]
--- fs/btrfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +4 -1
@@ -4313,7 +4313,10 @@ delete: extent_num_bytes,0 ,btrfs_header_owner (leaf), ino, extent_offset, 0); -BUG_ON (ret); +if (ret) { +btrfs_abort_transaction (trans, root, ret); +break ; + } }if (found_type ==BTRFS_INODE_ITEM_KEY )
PATCH 90/366 Btrfs: don't return ino to ino cache if inode item removal fails
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit c08db7d8d295a4f3a10faaca376de011afff7950 upstream.
In btrfs_evict_inode(), if btrfs_truncate_inode_items() fails, the inode item will still be in the tree but we still return the ino to the ino cache. That will blow up later when someone tries to allocate that ino, so don't return it to the cache.
[bwh: Backported to 3.16:
- Pass inode, not btrfs_inode, to btrfs_orphan_del()
- Pass btrfs_root, not btrfs_fs_info, to btrfs_free_block_rsv()
- Adjust context]
--- fs/btrfs/inode.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
fs/btrfs/inode.c +13 -12
@@ -4908,13 +4908,18 @@ void btrfs_evict_inode(struct inode *ino trans->block_rsv = rsv; ret =btrfs_truncate_inode_items (trans, root, inode,0 ,0 ); -if (ret != -ENOSPC ) +if (ret) { + trans->block_rsv = &root->fs_info->trans_block_rsv; +btrfs_end_transaction (trans, root); +btrfs_btree_balance_dirty (root); +if (ret != -ENOSPC ) { +btrfs_orphan_del (NULL , inode); +btrfs_free_block_rsv (root, rsv); + goto no_delete; + } + }else {break ; - - trans->block_rsv = &root->fs_info->trans_block_rsv; -btrfs_end_transaction (trans, root); - trans =NULL ; -btrfs_btree_balance_dirty (root); + } }btrfs_free_block_rsv (root, rsv);
@@ -4923,12 +4928,8 @@ void btrfs_evict_inode(struct inode *ino* Errors here aren't a big deal, it just means we leave orphan items * in the tree. They will be cleaned up on the next mount. */ -if (ret ==0 ) { - trans->block_rsv = root->orphan_block_rsv; -btrfs_orphan_del (trans, inode); - }else { -btrfs_orphan_del (NULL , inode); - } + trans->block_rsv = root->orphan_block_rsv; +btrfs_orphan_del (trans, inode); trans->block_rsv = &root->fs_info->trans_block_rsv; if (!(root == root->fs_info->tree_root ||
PATCH 91/366 Btrfs: reserve space for O_TMPFILE orphan item deletion
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Omar Sandoval <[email protected]>
commit 399b0bbf5f680797d3599fa14f16706ffc470145 upstream.
btrfs_link() calls btrfs_orphan_del() if it's linking an O_TMPFILE but it doesn't reserve space to do so. Even before the removal of the orphan_block_rsv it wasn't using it.
--- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +2 -1
@@ -6142,8 +6142,9 @@ static int btrfs_link(struct dentry *old* 2 items for inode and inode ref * 2 items for dir items * 1 item for parent inode +* 1 item for orphan item deletion if O_TMPFILE */ - trans =btrfs_start_transaction (root,5 ); + trans =btrfs_start_transaction (root, inode->i_nlink ?5 :6 );if (IS_ERR (trans)) { err =PTR_ERR (trans); goto fail;
PATCH 92/366 media: uvcvideo: Support realtek's UVC 1.5 device
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: ming_qian <[email protected]>
commit f620d1d7afc7db57ab59f35000752840c91f67e7 upstream.
media: uvcvideo: Support UVC 1.5 video probe & commit controls
The length of UVC 1.5 video control is 48, and it is 34 for UVC 1.1. Change it to 48 for UVC 1.5 device, and the UVC 1.5 device can be recognized.
More changes to the driver are needed for full UVC 1.5 compatibility. However, at least the UVC 1.5 Realtek RTS5847/RTS5852 cameras have been reported to work well.
[[email protected]: Factor out code to helper function, update size checks]
--- drivers/media/usb/uvc/uvc_video.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/media/usb/uvc/uvc_video.c +18 -6
@@ -155,14 +155,27 @@ static void uvc_fixup_video_ctrl(struct } } +static size_t uvc_video_ctrl_size (struct uvc_streaming *stream) +{ +/* +* Return the size of the video probe and commit controls, which depends +* on the protocol version. +*/ +if (stream->dev->uvc_version <0x0110 ) +return 26 ; +else if (stream->dev->uvc_version <0x0150 ) +return 34 ; +else +return 48 ; +} +static int uvc_get_video_ctrl (struct uvc_streaming *stream,struct uvc_streaming_control *ctrl,int probe,__u8 query) { +u16 size =uvc_video_ctrl_size (stream);__u8 *data; -__u16 size;int ret; - size = stream->dev->uvc_version >=0x0110 ?34 :26 ;if ((stream->dev->quirks &UVC_QUIRK_PROBE_DEF ) && query ==UVC_GET_DEF )return -EIO ;
@@ -217,7 +230,7 @@ static int uvc_get_video_ctrl(struct uvc ctrl->dwMaxVideoFrameSize =get_unaligned_le32 (&data[18 ]); ctrl->dwMaxPayloadTransferSize =get_unaligned_le32 (&data[22 ]); -if (size ==34 ) { +if (size >=34 ) { ctrl->dwClockFrequency =get_unaligned_le32 (&data[26 ]); ctrl->bmFramingInfo = data[30 ]; ctrl->bPreferedVersion = data[31 ];
@@ -246,11 +259,10 @@ out:static int uvc_set_video_ctrl (struct uvc_streaming *stream,struct uvc_streaming_control *ctrl,int probe) { +u16 size =uvc_video_ctrl_size (stream);__u8 *data; -__u16 size;int ret; - size = stream->dev->uvc_version >=0x0110 ?34 :26 ; data =kzalloc (size,GFP_KERNEL );if (data ==NULL )return -ENOMEM ;
@@ -267,7 +279,7 @@ static int uvc_set_video_ctrl(struct uvcput_unaligned_le32 (ctrl->dwMaxVideoFrameSize, &data[18 ]);put_unaligned_le32 (ctrl->dwMaxPayloadTransferSize, &data[22 ]); -if (size ==34 ) { +if (size >=34 ) {put_unaligned_le32 (ctrl->dwClockFrequency, &data[26 ]); data[30 ] = ctrl->bmFramingInfo; data[31 ] = ctrl->bPreferedVersion;
PATCH 93/366 libata: zpodd: make arrays cdb static, reduces object code size
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit 795ef788145ed2fa023efdf11e8d5d7bedc21462 upstream.
Don't populate the arrays cdb on the stack, instead make them static. Makes the object code smaller by 230 bytes:
Before:
text data bss dec hex filename
3797 240 0 4037 fc5 drivers/ata/libata-zpodd.o
After:
text data bss dec hex filename
3407 400 0 3807 edf drivers/ata/libata-zpodd.o
--- drivers/ata/libata-zpodd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/libata-zpodd.c +2 -2
@@ -34,7 +34,7 @@ struct zpodd {static int eject_tray (struct ata_device *dev) {struct ata_taskfile tf; -const char cdb[] = {GPCMD_START_STOP_UNIT , +static const char cdb[] = {GPCMD_START_STOP_UNIT ,0 ,0 ,0 ,0x02 ,/* LoEj */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,
@@ -55,7 +55,7 @@ static enum odd_mech_type zpodd_get_mechunsigned int ret;struct rm_feature_desc *desc = (void *)(buf +8 );struct ata_taskfile tf; -char cdb[] = {GPCMD_GET_CONFIGURATION , +static const char cdb[] = {GPCMD_GET_CONFIGURATION ,2 ,/* only 1 feature descriptor requested */ 0 ,3 ,/* 3, removable medium feature */ 0 ,0 ,0 ,/* reserved */
PATCH 94/366 libata: zpodd: small read overflow in eject_tray()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 18c9a99bce2a57dfd7e881658703b5d7469cc7b9 upstream.
We read from the cdb[] buffer in ata_exec_internal_sg(). It has to be ATAPI_CDB_LEN (16) bytes long, but this buffer is only 12 bytes.
--- drivers/ata/libata-zpodd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-zpodd.c +1 -1
@@ -34,7 +34,7 @@ struct zpodd {static int eject_tray (struct ata_device *dev) {struct ata_taskfile tf; -static const char cdb[] = {GPCMD_START_STOP_UNIT , +static const char cdb[ATAPI_CDB_LEN ] = {GPCMD_START_STOP_UNIT ,0 ,0 ,0 ,0x02 ,/* LoEj */ 0 ,0 ,0 ,0 ,0 ,0 ,0 ,
PATCH 95/366 tpm: fix race condition in tpm_common_write()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tadeusz Struk <[email protected]>
commit 3ab2011ea368ec3433ad49e1b9e1c7b70d2e65df upstream.
There is a race condition in tpm_common_write function allowing two threads on the same /dev/tpm<N>, or two different applications on the same /dev/tpmrm<N> to overwrite each other commands/responses. Fixed this by taking the priv->buffer_mutex early in the function.
Also converted the priv->data_pending from atomic to a regular size_t type. There is no need for it to be atomic since it is only touched under the protection of the priv->buffer_mutex.
---
drivers/char/tpm/tpm-dev.c +19 -22
@@ -26,7 +26,7 @@ struct file_priv {struct tpm_chip *chip;/* Data passed to and from the tpm via the read/write calls */ -atomic_t data_pending; +size_t data_pending;struct mutex buffer_mutex;struct timer_list user_read_timer;/* user needs to claim result */
@@ -47,7 +47,7 @@ static void timeout_work(struct work_str struct file_priv *priv = container_of(work, struct file_priv, work);mutex_lock (&priv->buffer_mutex); -atomic_set (&priv->data_pending,0 ); + priv->data_pending =0 ;memset (priv->data_buffer,0 ,sizeof (priv->data_buffer));mutex_unlock (&priv->buffer_mutex); }
@@ -74,7 +74,6 @@ static int tpm_open(struct inode *inode, } priv->chip = chip; -atomic_set (&priv->data_pending,0 );mutex_init (&priv->buffer_mutex);setup_timer (&priv->user_read_timer, user_reader_timeout, (unsigned long )priv);
@@ -89,28 +88,24 @@ static ssize_t tpm_read(struct file *fil size_t size, loff_t *off) { struct file_priv *priv = file->private_data; -ssize_t ret_size; +ssize_t ret_size =0 ;int rc;del_singleshot_timer_sync (&priv->user_read_timer);flush_work (&priv->work); - ret_size =atomic_read (&priv->data_pending); -if (ret_size >0 ) {/* relay data */ -ssize_t orig_ret_size = ret_size; -if (size < ret_size) - ret_size = size; +mutex_lock (&priv->buffer_mutex); -mutex_lock (&priv->buffer_mutex); +if (priv->data_pending) { + ret_size =min_t (ssize_t, size, priv->data_pending); rc =copy_to_user (buf, priv->data_buffer, ret_size); -memset (priv->data_buffer,0 , orig_ret_size); +memset (priv->data_buffer,0 , priv->data_pending);if (rc) ret_size = -EFAULT ; -mutex_unlock (&priv->buffer_mutex); + priv->data_pending =0 ; } -atomic_set (&priv->data_pending,0 ); - +mutex_unlock (&priv->buffer_mutex);return ret_size; }
@@ -121,17 +116,19 @@ static ssize_t tpm_write(struct file *fisize_t in_size = size;ssize_t out_size; +if (in_size >TPM_BUFSIZE ) +return -E2BIG ; + +mutex_lock (&priv->buffer_mutex); +/* cannot perform a write until the read has cleared either via tpm_read or a user_read_timer timeout. This also prevents splitted buffered writes from blocking here. */ -if (atomic_read (&priv->data_pending) !=0 ) +if (priv->data_pending !=0 ) { +mutex_unlock (&priv->buffer_mutex);return -EBUSY ; - -if (in_size >TPM_BUFSIZE ) -return -E2BIG ; - -mutex_lock (&priv->buffer_mutex); + }if (copy_from_user (priv->data_buffer, (void __user *) buf, in_size)) {
@@ -153,7 +150,7 @@ static ssize_t tpm_write(struct file *fireturn out_size; } -atomic_set (&priv->data_pending, out_size); + priv->data_pending = out_size;mutex_unlock (&priv->buffer_mutex);/* Set a timeout by which the reader must come claim the result */
@@ -172,7 +169,7 @@ static int tpm_release(struct inode *inodel_singleshot_timer_sync (&priv->user_read_timer);flush_work (&priv->work); file->private_data =NULL ; -atomic_set (&priv->data_pending,0 ); + priv->data_pending =0 ;clear_bit (0 , &priv->chip->is_open);put_device (priv->chip->dev);kfree (priv);
PATCH 96/366 mtd: cfi_cmdset_0002: Change write buffer to check correct value
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tokunori Ikegami <[email protected]>
commit dfeae1073583dc35c33b32150e18b7048bbb37e6 upstream.
For the word write it is checked if the chip has the correct value. But it is not checked for the write buffer as only checked if ready. To make sure for the write buffer change to check the value.
It is enough as this patch is only checking the last written word. Since it is described by data sheets to check the operation status.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/chips/cfi_cmdset_0002.c +1 -1
@@ -1541,7 +1541,7 @@ static int __xipram do_write_buffer(struif (time_after (jiffies, timeo) && !chip_ready (map, adr))break ; -if (chip_ready (map, adr)) { +if (chip_good (map, adr, datum)) {xip_enable (map, chip, adr); goto op_done; }
PATCH 97/366 mtd: cfi_cmdset_0002: Change definition naming to retry write operation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tokunori Ikegami <[email protected]>
commit 85a82e28b023de9b259a86824afbd6ba07bd6475 upstream.
The definition can be used for other program and erase operations also. So change the naming to MAX_RETRIES from MAX_WORD_RETRIES.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/chips/cfi_cmdset_0002.c +3 -3
@@ -42,7 +42,7 @@#define AMD_BOOTLOC_BUG #define FORCE_WORD_WRITE 0 -#define MAX_WORD_RETRIES 3 +#define MAX_RETRIES 3#define SST49LF004B 0x0060#define SST49LF040B 0x0050
@@ -1314,7 +1314,7 @@ static int __xipram do_write_oneword(strmap_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ -if (++retry_cnt <=MAX_WORD_RETRIES ) +if (++retry_cnt <=MAX_RETRIES ) goto retry; ret = -EIO ;
@@ -1765,7 +1765,7 @@ retry:map_write (map,CMD (0xF0 ), chip->start);/* FIXME - should have reset delay before continuing */ -if (++retry_cnt <=MAX_WORD_RETRIES ) +if (++retry_cnt <=MAX_RETRIES ) goto retry; ret = -EIO ;
PATCH 98/366 mtd: cfi_cmdset_0002: Change erase functions to retry for error
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tokunori Ikegami <[email protected]>
commit 45f75b8a919a4255f52df454f1ffdee0e42443b2 upstream.
For the word write functions it is retried for error. But it is not implemented to retry for the erase functions. To make sure for the erase functions change to retry as same.
This is needed to prevent the flash erase error caused only once. It was caused by the error case of chip_good() in the do_erase_oneblock(). Also it was confirmed on the MACRONIX flash device MX29GL512FHT2I-11G. But the error issue behavior is not able to reproduce at this moment. The flash controller is parallel Flash interface integrated on BCM53003.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mtd/chips/cfi_cmdset_0002.c +10 -0
@@ -1900,6 +1900,7 @@ static int __xipram do_erase_chip(structunsigned long int adr;DECLARE_WAITQUEUE (wait, current);int ret =0 ; +int retry_cnt =0 ; adr = cfi->addr_unlock1;
@@ -1917,6 +1918,7 @@ static int __xipram do_erase_chip(structENABLE_VPP (map);xip_disable (map, chip, adr); + retry:cfi_send_gen_cmd (0xAA , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x55 , cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x80 , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );
@@ -1971,6 +1973,9 @@ static int __xipram do_erase_chip(structmap_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ +if (++retry_cnt <=MAX_RETRIES ) + goto retry; + ret = -EIO ; }
@@ -1990,6 +1995,7 @@ static int __xipram do_erase_oneblock(stunsigned long timeo = jiffies +HZ ;DECLARE_WAITQUEUE (wait, current);int ret =0 ; +int retry_cnt =0 ; adr += chip->start;
@@ -2007,6 +2013,7 @@ static int __xipram do_erase_oneblock(stENABLE_VPP (map);xip_disable (map, chip, adr); + retry:cfi_send_gen_cmd (0xAA , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x55 , cfi->addr_unlock2, chip->start, map, cfi, cfi->device_type,NULL );cfi_send_gen_cmd (0x80 , cfi->addr_unlock1, chip->start, map, cfi, cfi->device_type,NULL );
@@ -2064,6 +2071,9 @@ static int __xipram do_erase_oneblock(stmap_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ +if (++retry_cnt <=MAX_RETRIES ) + goto retry; + ret = -EIO ; }
PATCH 99/366 mtd: cfi_cmdset_0002: Change erase functions to check chip good only
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tokunori Ikegami <[email protected]>
commit 79ca484b613041ca223f74b34608bb6f5221724b upstream.
Currently the functions use to check both chip ready and good. But the chip ready is not enough to check the operation status. So change this to check the chip good instead of this. About the retry functions to make sure the error handling remain it.
--- drivers/mtd/chips/cfi_cmdset_0002.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/mtd/chips/cfi_cmdset_0002.c +12 -10
@@ -1955,12 +1955,13 @@ static int __xipram do_erase_chip(struct chip->erase_suspended =0 ; } -if (chip_ready (map, adr)) +if (chip_good (map, adr,map_word_ff (map)))break ;if (time_after (jiffies, timeo)) {printk (KERN_WARNING "MTD %s(): software timeout\n" , __func__ ); + ret = -EIO ;break ; }
@@ -1968,15 +1969,15 @@ static int __xipram do_erase_chip(structUDELAY (map, chip, adr,1000000 /HZ ); }/* Did we succeed? */ -if (!chip_good (map, adr,map_word_ff (map))) { +if (ret) {/* reset on all failures. */ map_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ -if (++retry_cnt <=MAX_RETRIES ) +if (++retry_cnt <=MAX_RETRIES ) { + ret =0 ; goto retry; - - ret = -EIO ; + } } chip->state =FL_READY ;
@@ -2050,7 +2051,7 @@ static int __xipram do_erase_oneblock(st chip->erase_suspended =0 ; } -if (chip_ready (map, adr)) { +if (chip_good (map, adr,map_word_ff (map))) {xip_enable (map, chip, adr);break ; }
@@ -2059,6 +2060,7 @@ static int __xipram do_erase_oneblock(stxip_enable (map, chip, adr);printk (KERN_WARNING "MTD %s(): software timeout\n" , __func__ ); + ret = -EIO ;break ; }
@@ -2066,15 +2068,15 @@ static int __xipram do_erase_oneblock(stUDELAY (map, chip, adr,1000000 /HZ ); }/* Did we succeed? */ -if (!chip_good (map, adr,map_word_ff (map))) { +if (ret) {/* reset on all failures. */ map_write ( map,CMD (0xF0 ), chip->start );/* FIXME - should have reset delay before continuing */ -if (++retry_cnt <=MAX_RETRIES ) +if (++retry_cnt <=MAX_RETRIES ) { + ret =0 ; goto retry; - - ret = -EIO ; + } } chip->state =FL_READY ;
PATCH 100/366 fuse: fix control dir setup and teardown
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 6becdb601bae2a043d7fb9762c4d48699528ea6e upstream.
syzbot is reporting NULL pointer dereference at fuse_ctl_remove_conn() [1]. Since fc->ctl_ndents is incremented by fuse_ctl_add_conn() when new_inode() failed, fuse_ctl_remove_conn() reaches an inode-less dentry and tries to clear d_inode(dentry)->i_private field.
Fix by only adding the dentry to the array after being fully set up.
When tearing down the control directory, do d_invalidate() on it to get rid of any mounts that might have been added.
[1] https://syzkaller.appspot.com/bug?id=f396d863067238959c91c0b7cfc10b163638cac6
--- fs/fuse/control.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/fuse/control.c +10 -3
@@ -211,10 +211,11 @@ static struct dentry *fuse_ctl_add_dentrif (!dentry)return NULL ; - fc->ctl_dentry[fc->ctl_ndents++] = dentry; inode =new_inode (fuse_control_sb); -if (!inode) +if (!inode) { +dput (dentry);return NULL ; + } inode->i_ino =get_next_ino (); inode->i_mode = mode;
@@ -228,6 +229,9 @@ static struct dentry *fuse_ctl_add_dentrset_nlink (inode, nlink); inode->i_private = fc;d_add (dentry, inode); + + fc->ctl_dentry[fc->ctl_ndents++] = dentry; +return dentry; }
@@ -284,7 +288,10 @@ void fuse_ctl_remove_conn(struct fuse_cofor (i = fc->ctl_ndents -1 ; i >=0 ; i--) {struct dentry *dentry = fc->ctl_dentry[i]; dentry->d_inode->i_private =NULL ; -d_drop (dentry); +if (!i) { +/* Get rid of submounts: */ +d_invalidate (dentry); + }dput (dentry); }drop_nlink (fuse_control_sb->s_root->d_inode);
PATCH 101/366 fuse: don't keep dead fuse_conn at fuse_fill_super().
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 543b8f8662fe6d21f19958b666ab0051af9db21a upstream.
syzbot is reporting use-after-free at fuse_kill_sb_blk() [1]. Since sb->s_fs_info field is not cleared after fc was released by fuse_conn_put() when initialization failed, fuse_kill_sb_blk() finds already released fc and tries to hold the lock. Fix this by clearing sb->s_fs_info field after calling fuse_conn_put().
[1] https://syzkaller.appspot.com/bug?id=a07a680ed0a9290585ca424546860464dd9658db
--- fs/fuse/inode.c | 1 + 1 file changed, 1 insertion(+)
fs/fuse/inode.c +1 -0
@@ -1125,6 +1125,7 @@ static int fuse_fill_super(struct super_ err_put_conn:fuse_bdi_destroy (fc);fuse_conn_put (fc); + sb->s_fs_info =NULL ; err_fput:fput (file); err:
PATCH 102/366 libata: Drop SanDisk SD7UB3Q*G1001 NOLPM quirk
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 2cfce3a86b64b53f0a70e92a6a659c720c319b45 upstream.
Commit 184add2ca23c ("libata: Apply NOLPM quirk for SanDisk SD7UB3Q*G1001 SSDs") disabled LPM for SanDisk SD7UB3Q*G1001 SSDs.
This has lead to several reports of users of that SSD where LPM was working fine and who know have a significantly increased idle power consumption on their laptops.
Likely there is another problem on the T450s from the original reporter which gets exposed by the uncore reaching deeper sleep states (higher PC-states) due to LPM being enabled. The problem as reported, a hardfreeze about once a day, already did not sound like it would be caused by LPM and the reports of the SSD working fine confirm this. The original reporter is ok with dropping the quirk.
A X250 user has reported the same hard freeze problem and for him the problem went away after unrelated updates, I suspect some GPU driver stack changes fixed things.
TL;DR: The original reporters problem were triggered by LPM but not an LPM issue, so drop the quirk for the SSD in question.
--- drivers/ata/libata-core.c | 3 --- 1 file changed, 3 deletions(-)
drivers/ata/libata-core.c +0 -3
@@ -4243,9 +4243,6 @@ static const struct ata_blacklist_entry {"Crucial_CT960M500*" ,NULL ,ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_NOLPM, }, - /* Sandisk devices which are known to not handle LPM well */ - { "SanDisk SD7UB3Q*G1001", NULL, ATA_HORKAGE_NOLPM, }, - /* devices that don't properly handle queued TRIM commands */ { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM, }, { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },
PATCH 103/366 NFSv4: Fix possible 1-byte stack overflow in nfs_idmap_read_and_verify_message
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Wysochanski <[email protected]>
commit d68894800ec5712d7ddf042356f11e36f87d7f78 upstream.
In nfs_idmap_read_and_verify_message there is an incorrect sprintf '%d' that converts the __u32 'im_id' from struct idmap_msg to 'id_str', which is a stack char array variable of length NFS_UINT_MAXLEN == 11. If a uid or gid value is > 2147483647 = 0x7fffffff, the conversion overflows into a negative value, for example:
crash> p (unsigned) (0x80000000)
$1 = 2147483648
crash> p (signed) (0x80000000)
$2 = -2147483648
The '-' sign is written to the buffer and this causes a 1 byte overflow when the NULL byte is written, which corrupts kernel stack memory. If CONFIG_CC_STACKPROTECTOR_STRONG is set we see a stack-protector panic:
[11558053.616565] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffffa05b8a8c [11558053.639063] CPU: 6 PID: 9423 Comm: rpc.idmapd Tainted: G W ------------ T 3.10.0-514.el7.x86_64 #1 [11558053.641990] Hardware name: Red Hat OpenStack Compute, BIOS 1.10.2-3.el7_4.1 04/01/2014 [11558053.644462] ffffffff818c7bc0 00000000b1f3aec1 ffff880de0f9bd48 ffffffff81685eac [11558053.646430] ffff880de0f9bdc8 ffffffff8167f2b3 ffffffff00000010 ffff880de0f9bdd8 [11558053.648313] ffff880de0f9bd78 00000000b1f3aec1 ffffffff811dcb03 ffffffffa05b8a8c [11558053.650107] Call Trace: [11558053.651347] [<ffffffff81685eac>] dump_stack+0x19/0x1b [11558053.653013] [<ffffffff8167f2b3>] panic+0xe3/0x1f2 [11558053.666240] [<ffffffff811dcb03>] ? kfree+0x103/0x140 [11558053.682589] [<ffffffffa05b8a8c>] ? idmap_pipe_downcall+0x1cc/0x1e0 [nfsv4] [11558053.689710] [<ffffffff810855db>] __stack_chk_fail+0x1b/0x30 [11558053.691619] [<ffffffffa05b8a8c>] idmap_pipe_downcall+0x1cc/0x1e0 [nfsv4] [11558053.693867] [<ffffffffa00209d6>] rpc_pipe_write+0x56/0x70 [sunrpc] [11558053.695763] [<ffffffff811fe12d>] vfs_write+0xbd/0x1e0 [11558053.702236] [<ffffffff810acccc>] ? task_work_run+0xac/0xe0 [11558053.704215] [<ffffffff811fec4f>] SyS_write+0x7f/0xe0 [11558053.709674] [<ffffffff816964c9>] system_call_fastpath+0x16/0x1b
Fix this by calling the internally defined nfs_map_numeric_to_string() function which properly uses '%u' to convert this __u32. For consistency, also replace the one other place where snprintf is called.
--- fs/nfs/idmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfs/idmap.c +3 -2
@@ -339,7 +339,7 @@ static ssize_t nfs_idmap_lookup_name(__uint id_len;ssize_t ret; - id_len =snprintf (id_str,sizeof (id_str),"%u" , id); + id_len =nfs_map_numeric_to_string (id, id_str,sizeof (id_str)); ret =nfs_idmap_get_key (id_str, id_len, type, buf, buflen, idmap);if (ret <0 )return -EINVAL ;
@@ -636,7 +636,8 @@ static int nfs_idmap_read_and_verify_mesif (strcmp (upcall->im_name, im->im_name) !=0 )break ;/* Note: here we store the NUL terminator too */ - len =sprintf (id_str,"%d" , im->im_id) +1 ; + len =1 +nfs_map_numeric_to_string (im->im_id, id_str, +sizeof (id_str)); ret =nfs_idmap_instantiate (key, authkey, id_str, len);break ;case IDMAP_CONV_IDTONAME :
PATCH 104/366 ALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bo Chen <[email protected]>
commit a3aa60d511746bd6c0d0366d4eb90a7998bcde8b upstream.
When 'kzalloc()' fails in 'snd_hda_attach_pcm_stream()', a new pcm instance is created without setting its operators via 'snd_pcm_set_ops()'. Following operations on the new pcm instance can trigger kernel null pointer dereferences and cause kernel oops.
This bug was found with my work on building a gray-box fault-injection tool for linux-kernel-module binaries. A kernel null pointer dereference was confirmed from line 'substream->ops->open()' in function 'snd_pcm_open_substream()' in file 'sound/core/pcm_native.c'.
This patch fixes the bug by calling 'snd_device_free()' in the error handling path of 'kzalloc()', which removes the new pcm instance from the snd card before returns with an error code.
--- sound/pci/hda/hda_controller.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/pci/hda/hda_controller.c +3 -1
@@ -998,8 +998,10 @@ static int azx_attach_pcm_stream(structreturn err;strlcpy (pcm->name, cpcm->name,sizeof (pcm->name)); apcm =kzalloc (sizeof (*apcm),GFP_KERNEL ); -if (apcm ==NULL ) +if (apcm ==NULL ) { +snd_device_free (chip->card, pcm);return -ENOMEM ; + } apcm->chip = chip; apcm->pcm = pcm; apcm->codec = codec;
PATCH 105/366 RDMA/mlx4: Discard unknown SQP work requests
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
commit 6b1ca7ece15e94251d1d0d919f813943e4a58059 upstream.
There is no need to crash the machine if unknown work request was received in SQP MAD.
--- drivers/infiniband/hw/mlx4/mad.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/mlx4/mad.c +0 -1
@@ -1748,7 +1748,6 @@ static void mlx4_ib_sqp_comp_worker(stru "buf:%lld\n", wc.wr_id);break ;default : -BUG_ON (1 );break ; } }else {
PATCH 106/366 tools/power turbostat: Correct SNB_C1/C3_AUTO_UNDEMOTE defines
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matt Turner <[email protected]>
commit e0d34648b4d77ba715e13739d04e7b0692fe5eaa upstream.
According to the Intel Software Developers' Manual, Vol. 4, Order No. 335592, these macros have been reversed since they were added.
--- tools/power/x86/turbostat/turbostat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/power/x86/turbostat/turbostat.c +2 -2
@@ -1088,8 +1088,8 @@ void print_verbose_header(void) print_nhm_turbo_ratio_limits:get_msr (0 ,MSR_NHM_SNB_PKG_CST_CFG_CTL , &msr); -#define SNB_C1_AUTO_UNDEMOTE (1UL << 27) -#define SNB_C3_AUTO_UNDEMOTE (1UL << 28) +#define SNB_C3_AUTO_UNDEMOTE (1UL << 27) +#define SNB_C1_AUTO_UNDEMOTE (1UL << 28)fprintf (stderr,"cpu0: MSR_NHM_SNB_PKG_CST_CFG_CTL: 0x%08llx" , msr);
PATCH 107/366 x86: msr-index.h: Correct SNB_C1/C3_AUTO_UNDEMOTE defines
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matt Turner <[email protected]>
commit a00072a24a9f5b88cfc56f2dec6afe8ce3874e60 upstream.
According to the Intel Software Developers' Manual, Vol. 4, Order No. 335592, these macros have been reversed since they were added in the initial turbostat commit. The reversed definitions were presumably copied from turbostat.c to this file.
--- arch/x86/include/uapi/asm/msr-index.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/uapi/asm/msr-index.h +2 -2
@@ -50,8 +50,8 @@#define NHM_C3_AUTO_DEMOTE (1UL << 25)#define NHM_C1_AUTO_DEMOTE (1UL << 26)#define ATM_LNC_C6_AUTO_DEMOTE (1UL << 25) -#define SNB_C1_AUTO_UNDEMOTE (1UL << 27) -#define SNB_C3_AUTO_UNDEMOTE (1UL << 28) +#define SNB_C3_AUTO_UNDEMOTE (1UL << 27) +#define SNB_C1_AUTO_UNDEMOTE (1UL << 28)#define MSR_PLATFORM_INFO 0x000000ce#define MSR_MTRRcap 0x000000fe
PATCH 108/366 powerpc/mm/hash: Add missing isync prior to kernel stack SLB switch
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Aneesh Kumar K.V" <[email protected]>
commit 91d06971881f71d945910de128658038513d1b24 upstream.
Currently we do not have an isync, or any other context synchronizing instruction prior to the slbie/slbmte in _switch() that updates the SLB entry for the kernel stack.
However that is not correct as outlined in the ISA.
=46romPower ISA Version 3.0B, Book III, Chapter 11, page 1133:
"Changing the contents of ... the contents of SLB entries ... can
have the side effect of altering the context in which data addresses and instruction addresses are interpreted, and in which instructions are executed and data accesses are performed.
...
These side effects need not occur in program order, and therefore may require explicit synchronization by software.
...
The synchronizing instruction before the context-altering instruction ensures that all instructions up to and including that synchronizing instruction are fetched and executed in the context that existed before the alteration."
And page 1136:
"For data accesses, the context synchronizing instruction before the
slbie, slbieg, slbia, slbmte, tlbie, or tlbiel instruction ensures that all preceding instructions that access data storage have completed to a point at which they have reported all exceptions they will cause."
We're not aware of any bugs caused by this, but it should be fixed regardless.
Add the missing isync when updating kernel stack SLB entry.
--- arch/powerpc/kernel/entry_64.S | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/entry_64.S +1 -0
@@ -525,6 +525,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEG * actually hit this code path. */ + isync slbie r6 slbie r6 /* Workaround POWER5 < DD2.1 issue */ slbmte r7,r0
PATCH 109/366 ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
commit ff2faf1289c1f81b5b26b9451dd1c2006aac8db8 upstream.
dapm_kcontrol_data is freed as part of dapm_kcontrol_free(), leaving the paths pointer dangling in the list.
This leads to system crash when we try to unload and reload sound card. I hit this bug during ADSP crash/reboot test case on Dragon board DB410c.
Without this patch, on SLAB Poisoning enabled build, kernel crashes with
"BUG kmalloc-128 (Tainted: G W ): Poison overwritten"
--- sound/soc/soc-dapm.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/soc-dapm.c +2 -0
@@ -254,6 +254,8 @@ static int dapm_kcontrol_data_alloc(strustatic void dapm_kcontrol_free (struct snd_kcontrol *kctl) {struct dapm_kcontrol_data *data =snd_kcontrol_chip (kctl); + +list_del (&data->paths);kfree (data->wlist);kfree (data); }
PATCH 110/366 IB/isert: fix T10-pi check mask setting
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Gurtovoy <[email protected]>
commit 0e12af84cdd3056460f928adc164f9e87f4b303b upstream.
A copy/paste bug (probably) caused setting of an app_tag check mask in case where a ref_tag check was needed.
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/isert/ib_isert.c +1 -1
@@ -2822,7 +2822,7 @@ static inline u8 isert_set_prot_checks(u8 prot_checks) {return (prot_checks &TARGET_DIF_CHECK_GUARD ?0xc0 :0 ) | - (prot_checks &TARGET_DIF_CHECK_REFTAG ?0x30 :0 ) | + (prot_checks &TARGET_DIF_CHECK_APPTAG ?0x30 :0 ) | (prot_checks &TARGET_DIF_CHECK_REFTAG ?0x0f :0 ); }
PATCH 111/366 net/packet: refine check for priv area size
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit eb73190f4fbeedf762394e92d6a4ec9ace684c88 upstream.
syzbot was able to trick af_packet again [1]
Various commits tried to address the problem in the past, but failed to take into account V3 header size.
[1]
tpacket_rcv: packet too big, clamped from 72 to 4294967224. macoff=96
BUG: KASAN: use-after-free in prb_run_all_ft_ops net/packet/af_packet.c:1016 [inline]
BUG: KASAN: use-after-free in prb_fill_curr_block.isra.59+0x4e5/0x5c0 net/packet/af_packet.c:1039
Write of size 2 at addr ffff8801cb62000e by task kworker/1:2/2106
CPU: 1 PID: 2106 Comm: kworker/1:2 Not tainted 4.17.0-rc7+ #77
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: ipv6_addrconf addrconf_dad_work
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1b9/0x294 lib/dump_stack.c:113
print_address_description+0x6c/0x20b mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
__asan_report_store2_noabort+0x17/0x20 mm/kasan/report.c:436
prb_run_all_ft_ops net/packet/af_packet.c:1016 [inline]
prb_fill_curr_block.isra.59+0x4e5/0x5c0 net/packet/af_packet.c:1039
__packet_lookup_frame_in_block net/packet/af_packet.c:1094 [inline]
packet_current_rx_frame net/packet/af_packet.c:1117 [inline]
tpacket_rcv+0x1866/0x3340 net/packet/af_packet.c:2282
dev_queue_xmit_nit+0x891/0xb90 net/core/dev.c:2018
xmit_one net/core/dev.c:3049 [inline]
dev_hard_start_xmit+0x16b/0xc10 net/core/dev.c:3069
__dev_queue_xmit+0x2724/0x34c0 net/core/dev.c:3584
dev_queue_xmit+0x17/0x20 net/core/dev.c:3617
neigh_resolve_output+0x679/0xad0 net/core/neighbour.c:1358
neigh_output include/net/neighbour.h:482 [inline]
ip6_finish_output2+0xc9c/0x2810 net/ipv6/ip6_output.c:120
ip6_finish_output+0x5fe/0xbc0 net/ipv6/ip6_output.c:154
NF_HOOK_COND include/linux/netfilter.h:277 [inline]
ip6_output+0x227/0x9b0 net/ipv6/ip6_output.c:171
dst_output include/net/dst.h:444 [inline]
NF_HOOK include/linux/netfilter.h:288 [inline]
ndisc_send_skb+0x100d/0x1570 net/ipv6/ndisc.c:491
ndisc_send_ns+0x3c1/0x8d0 net/ipv6/ndisc.c:633
addrconf_dad_work+0xbef/0x1340 net/ipv6/addrconf.c:4033
process_one_work+0xc1e/0x1b50 kernel/workqueue.c:2145
worker_thread+0x1cc/0x1440 kernel/workqueue.c:2279
kthread+0x345/0x410 kernel/kthread.c:240
ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:412
The buggy address belongs to the page:
page:ffffea00072d8800 count:0 mapcount:-127 mapping:0000000000000000 index:0xffff8801cb620e80
flags: 0x2fffc0000000000()
raw: 02fffc0000000000 0000000000000000 ffff8801cb620e80 00000000ffffff80
raw: ffffea00072e3820 ffffea0007132d20 0000000000000002 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8801cb61ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8801cb61ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8801cb620000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8801cb620080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8801cb620100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff--- net/packet/af_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/packet/af_packet.c +1 -1
@@ -3898,7 +3898,7 @@ static int packet_set_ring(struct sock * goto out;if (po->tp_version >=TPACKET_V3 && req->tp_block_size <= -BLK_PLUS_PRIV ((u64 )req_u->req3.tp_sizeof_priv)) +BLK_PLUS_PRIV ((u64 )req_u->req3.tp_sizeof_priv) +sizeof (struct tpacket3_hdr )) goto out;if (unlikely (req->tp_frame_size < po->tp_hdrlen + po->tp_reserve))
PATCH 112/366 of: platform: stop accessing invalid dev in of_platform_device_destroy
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
commit 522811e944ed9b36806faa019faec10f9d259cca upstream.
Immediately after the platform_device_unregister() the device will be cleaned up. Accessing the freed pointer immediately after that will crash the system.
Found this bug when kernel is built with CONFIG_PAGE_POISONING and testing loading/unloading audio drivers in a loop on Qcom platforms.
Fix this by moving of_node_clear_flag() just before the unregister calls.
Below is the crash trace:
Unable to handle kernel paging request at virtual address 6b6b6b6b6b6c03
Mem abort info:
ESR = 0x96000021
Exception class = DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000021
CM = 0, WnR = 0
[006b6b6b6b6b6c03] address between user and kernel address ranges
Internal error: Oops: 96000021 [#1] PREEMPT SMP Modules linked in: CPU: 2 PID: 1784 Comm: sh Tainted: G W 4.17.0-rc7-02230-ge3a63a7ef641-dirty #204 Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) pstate: 80000005 (Nzcv daif -PAN -UAO) pc : clear_bit+0x18/0x2c lr : of_platform_device_destroy+0x64/0xb8
sp : ffff00000c9c3930
x29: ffff00000c9c3930 x28: ffff80003d39b200
x27: ffff000008bb1000 x26: 0000000000000040
x25: 0000000000000124 x24: ffff80003a9a3080
x23: 0000000000000060 x22: ffff00000939f518
x21: ffff80003aa79e98 x20: ffff80003aa3dae0
x19: ffff80003aa3c890 x18: ffff800009feb794
x17: 0000000000000000 x16: 0000000000000000
x15: ffff800009feb790 x14: 0000000000000000
x13: ffff80003a058778 x12: ffff80003a058728
x11: ffff80003a058750 x10: 0000000000000000
x9 : 0000000000000006 x8 : ffff80003a825988
x7 : bbbbbbbbbbbbbbbb x6 : 0000000000000001
x5 : 0000000000000000 x4 : 0000000000000001
x3 : 0000000000000008 x2 : 0000000000000001
x1 : 6b6b6b6b6b6b6c03 x0 : 0000000000000000
Process sh (pid: 1784, stack limit = 0x (ptrval))
Call trace: clear_bit+0x18/0x2c q6afe_remove+0x20/0x38 apr_device_remove+0x30/0x70 device_release_driver_internal+0x170/0x208 device_release_driver+0x14/0x20 bus_remove_device+0xcc/0x150 device_del+0x10c/0x310 device_unregister+0x1c/0x70 apr_remove_device+0xc/0x18 device_for_each_child+0x50/0x80 apr_remove+0x18/0x20 rpmsg_dev_remove+0x38/0x68 device_release_driver_internal+0x170/0x208 device_release_driver+0x14/0x20 bus_remove_device+0xcc/0x150 device_del+0x10c/0x310 device_unregister+0x1c/0x70 qcom_smd_remove_device+0xc/0x18 device_for_each_child+0x50/0x80 qcom_smd_unregister_edge+0x3c/0x70 smd_subdev_remove+0x18/0x28 rproc_stop+0x48/0xd8 rproc_shutdown+0x60/0xe8 state_store+0xbc/0xf8 dev_attr_store+0x18/0x28 sysfs_kf_write+0x3c/0x50 kernfs_fop_write+0x118/0x1e0 __vfs_write+0x18/0x110 vfs_write+0xa4/0x1a8 ksys_write+0x48/0xb0 sys_write+0xc/0x18 el0_svc_naked+0x30/0x34 Code: d2800022 8b400c21 f9800031 9ac32043 (c85f7c22) ---[ end trace 32020935775616a2 ]---
--- drivers/of/platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/of/platform.c +2 -2
@@ -522,6 +522,8 @@ static int of_platform_device_destroy(streturn 0 ; } +of_node_clear_flag (dev->of_node,OF_POPULATED ); +if (dev->bus == &platform_bus_type)platform_device_unregister (to_platform_device (dev));#ifdef CONFIG_ARM_AMBA
@@ -533,8 +535,6 @@ static int of_platform_device_destroy(streturn 0 ; } -of_node_clear_flag (dev->of_node,OF_POPULATED ); -return 0 ; }
PATCH 113/366 PCI: shpchp: Fix AMD POGO identification
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit bed4e9cfab93a0f3d0144cb919820e6d5c40b8b1 upstream.
The fix for an AMD POGO erratum related to SHPC incorrectly identified the device. The workaround should be applied only for AMD POGO devices, but it was instead applied to:
- all AMD bridges, and
- all devices from any vendor with device ID 0x7458
--- drivers/pci/hotplug/shpchp_ctrl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/hotplug/shpchp_ctrl.c +4 -4
@@ -595,13 +595,13 @@ static int shpchp_enable_slot (struct slctrl_dbg (ctrl,"%s: p_slot->pwr_save %x\n" , __func__, p_slot->pwr_save); p_slot->hpc_ops->get_latch_status (p_slot, &getstatus); -if (((p_slot->ctrl->pci_dev->vendor ==PCI_VENDOR_ID_AMD ) || - (p_slot->ctrl->pci_dev->device ==PCI_DEVICE_ID_AMD_POGO_7458 )) +if ((p_slot->ctrl->pci_dev->vendor ==PCI_VENDOR_ID_AMD && + p_slot->ctrl->pci_dev->device ==PCI_DEVICE_ID_AMD_POGO_7458 ) && p_slot->ctrl->num_slots ==1 ) { -/* handle amd pogo errata; this must be done before enable */ +/* handle AMD POGO errata; this must be done before enable */ amd_pogo_errata_save_misc_reg (p_slot); retval =board_added (p_slot); -/* handle amd pogo errata; this must be done after enable */ +/* handle AMD POGO errata; this must be done after enable */ amd_pogo_errata_restore_misc_reg (p_slot); }else retval =board_added (p_slot);
PATCH 114/366 branch-check: fix long->int truncation when profiling branches
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 2026d35741f2c3ece73c11eb7e4a15d7c2df9ebe upstream.
The function __builtin_expect returns long type (see the gcc documentation), and so do macros likely and unlikely. Unfortunatelly, when CONFIG_PROFILE_ANNOTATED_BRANCHES is selected, the macros likely and unlikely expand to __branch_check__ and __branch_check__ truncates the long type to int. This unintended truncation may cause bugs in various kernel code (we found a bug in dm-writecache because of it), so it's better to fix __branch_check__ to return long.
--- include/linux/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler.h +1 -1
@@ -105,7 +105,7 @@ void ftrace_likely_update(struct ftrace_#define unlikely_notrace (x) __builtin_expect(!!(x), 0)#define __branch_check__ (x, expect) ({ \ - int ______r; \ + long ______r; \ static struct ftrace_branch_data \ __attribute__((__aligned__(4))) \ __attribute__((section("_ftrace_annotated_branch"))) \
PATCH 115/366 kconfig: Avoid format overflow warning from GCC 8.1
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 2ae89c7a82ea9d81a19b4fc2df23bef4b112f24e upstream.
In file included from scripts/kconfig/zconf.tab.c:2485:scripts/kconfig/confdata.c: In function ‘conf_write’:scripts/kconfig/confdata.c:773:22: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
sprintf(newname, "%s%s", dirname, basename);
^~
scripts/kconfig/confdata.c:773:19: note: assuming directive output of 7 bytes
sprintf(newname, "%s%s", dirname, basename);
^~~~~~scripts/kconfig/confdata.c:773:2: note: ‘sprintf’ output 1 or more bytes (assuming 4104) into a destination of size 4097
sprintf(newname, "%s%s", dirname, basename);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~scripts/kconfig/confdata.c:776:23: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
^~~~~~~~~~~scripts/kconfig/confdata.c:776:3: note: ‘sprintf’ output between 13 and 4119 bytes into a destination of size 4097
sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid()); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Increase the size of tmpname and newname to make GCC happy.
--- scripts/kconfig/confdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/confdata.c +1 -1
@@ -738,7 +738,7 @@ int conf_write(const char *name)struct menu *menu;const char *basename;const char *str; -char dirname[PATH_MAX +1 ], tmpname[PATH_MAX +1 ], newname[PATH_MAX +1 ]; +char dirname[PATH_MAX +1 ], tmpname[PATH_MAX +22 ], newname[PATH_MAX +8 ];char *env; dirname[0 ] =0 ;
PATCH 116/366 l2tp: fix refcount leakage on PPPoL2TP sockets
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 3d609342cc04129ff7568e19316ce3d7451a27e8 upstream.
Commit d02ba2a6110c ("l2tp: fix race in pppol2tp_release with session object destroy") tried to fix a race condition where a PPPoL2TP socket would disappear while the L2TP session was still using it. However, it missed the root issue which is that an L2TP session may accept to be reconnected if its associated socket has entered the release process.
The tentative fix makes the session hold the socket it is connected to. That saves the kernel from crashing, but introduces refcount leakage, preventing the socket from completing the release process. Once stalled, everything the socket depends on can't be released anymore, including the L2TP session and the l2tp_ppp module.
The root issue is that, when releasing a connected PPPoL2TP socket, the session's ->sk pointer (RCU-protected) is reset to NULL and we have to wait for a grace period before destroying the socket. The socket drops the session in its ->sk_destruct callback function, so the session will exist until the last reference on the socket is dropped. Therefore, there is a time frame where pppol2tp_connect() may accept reconnecting a session, as it only checks ->sk to figure out if the session is connected. This time frame is shortened by the fact that pppol2tp_release() calls l2tp_session_delete(), making the session unreachable before resetting ->sk. However, pppol2tp_connect() may grab the session before it gets unhashed by l2tp_session_delete(), but it may test ->sk after the later got reset. The race is not so hard to trigger and syzbot found a pretty reliable reproducer:
https://syzkaller.appspot.com/bug?id=418578d2a4389074524e04d641eacb091961b2cf
Before d02ba2a6110c, another race could let pppol2tp_release() overwrite the ->__sk pointer of an L2TP session, thus tricking pppol2tp_put_sk() into calling sock_put() on a socket that is different than the one for which pppol2tp_release() was originally called. To get there, we had to trigger the race described above, therefore having one PPPoL2TP socket being released, while the session it is connected to is reconnecting to a different PPPoL2TP socket. When releasing this new socket fast enough, pppol2tp_release() overwrites the session's ->__sk pointer with the address of the new socket, before the first pppol2tp_put_sk() call gets scheduled. Then the pppol2tp_put_sk() call invoked by the original socket will sock_put() the new socket, potentially dropping its last reference. When the second pppol2tp_put_sk() finally runs, its socket has already been freed.
With d02ba2a6110c, the session takes a reference on both sockets. Furthermore, the session's ->sk pointer is reset in the pppol2tp_session_close() callback function rather than in pppol2tp_release(). Therefore, ->__sk can't be overwritten and pppol2tp_put_sk() is called only once (l2tp_session_delete() will only run pppol2tp_session_close() once, to protect the session against concurrent deletion requests). Now pppol2tp_put_sk() will properly sock_put() the original socket, but the new socket will remain, as l2tp_session_delete() prevented the release process from completing. Here, we don't depend on the ->__sk race to trigger the bug. Getting into the pppol2tp_connect() race is enough to leak the reference, no matter when new socket is released.
So it all boils down to pppol2tp_connect() failing to realise that the session has already been connected. This patch drops the unneeded extra reference counting (mostly reverting d02ba2a6110c) and checks that neither ->sk nor ->__sk is set before allowing a session to be connected.
--- net/l2tp/l2tp_ppp.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
net/l2tp/l2tp_ppp.c +17 -18
@@ -449,16 +449,6 @@ static void pppol2tp_put_sk(struct rcu_h*/ static void pppol2tp_session_close (struct l2tp_session *session) { -struct pppol2tp_session *ps; - - ps =l2tp_session_priv (session); -mutex_lock (&ps->sk_lock); - ps->__sk =rcu_dereference_protected (ps->sk, -lockdep_is_held (&ps->sk_lock)); -RCU_INIT_POINTER (ps->sk,NULL ); -if (ps->__sk) -call_rcu (&ps->rcu, pppol2tp_put_sk); -mutex_unlock (&ps->sk_lock); }/* Really kill the session socket. (Called from sock_put() if
@@ -501,15 +491,24 @@ static int pppol2tp_release(struct sockesock_orphan (sk); sock->sk =NULL ; -/* If the socket is associated with a session, -* l2tp_session_delete will call pppol2tp_session_close which -* will drop the session's ref on the socket. -*/ session =pppol2tp_sock_to_session (sk);if (session) { +struct pppol2tp_session *ps; +l2tp_session_delete (session); -/* drop the ref obtained by pppol2tp_sock_to_session */ -sock_put (sk); + + ps =l2tp_session_priv (session); +mutex_lock (&ps->sk_lock); + ps->__sk =rcu_dereference_protected (ps->sk, +lockdep_is_held (&ps->sk_lock)); +RCU_INIT_POINTER (ps->sk,NULL ); +mutex_unlock (&ps->sk_lock); +call_rcu (&ps->rcu, pppol2tp_put_sk); + +/* Rely on the sock_put() call at the end of the function for +* dropping the reference held by pppol2tp_sock_to_session(). +* The last reference will be dropped by pppol2tp_put_sk(). +*/ }release_sock (sk);
@@ -764,7 +763,8 @@ static int pppol2tp_connect(struct socke*/ mutex_lock (&ps->sk_lock);if (rcu_dereference_protected (ps->sk, -lockdep_is_held (&ps->sk_lock))) { +lockdep_is_held (&ps->sk_lock)) || + ps->__sk) {mutex_unlock (&ps->sk_lock); error = -EEXIST ; goto end;
@@ -832,7 +832,6 @@ static int pppol2tp_connect(struct socke out_no_ppp:/* This is how we get the session context from the socket. */ -sock_hold (sk); sk->sk_user_data = session;rcu_assign_pointer (ps->sk, sk);mutex_unlock (&ps->sk_lock);
PATCH 117/366 ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
commit 848235edb5c93ed086700584c8ff64f6d7fc778d upstream.
Currently, raw6_sk(sk)->ip6mr_table is set unconditionally during ip6_mroute_setsockopt(MRT6_TABLE). A subsequent attempt at the same setsockopt will fail with -ENOENT, since we haven't actually created that table.
A similar fix for ipv4 was included in commit 5e1859fbcc3c ("ipv4: ipmr:
various fixes and cleanups").
--- net/ipv6/ip6mr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/ip6mr.c +2 -1
@@ -1785,7 +1785,8 @@ int ip6_mroute_setsockopt(struct sock *s ret =0 ;if (!ip6mr_new_table (net, v)) ret = -ENOMEM ; -raw6_sk (sk)->ip6mr_table = v; +else +raw6_sk (sk)->ip6mr_table = v;rtnl_unlock ();return ret; }
PATCH 118/366 net: metrics: add proper netlink validation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 5b5e7a0de2bbf2a1afcd9f49e940010e9fb80d53 upstream.
Before using nla_get_u32(), better make sure the attribute is of the proper size.
Code recently was changed, but bug has been there from beginning of git.
BUG: KMSAN: uninit-value in rtnetlink_put_metrics+0x553/0x960 net/core/rtnetlink.c:746 CPU: 1 PID: 14139 Comm: syz-executor6 Not tainted 4.17.0-rc5+ #103 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:113 kmsan_report+0x149/0x260 mm/kmsan/kmsan.c:1084 __msan_warning_32+0x6e/0xc0 mm/kmsan/kmsan_instr.c:686 rtnetlink_put_metrics+0x553/0x960 net/core/rtnetlink.c:746 fib_dump_info+0xc42/0x2190 net/ipv4/fib_semantics.c:1361 rtmsg_fib+0x65f/0x8c0 net/ipv4/fib_semantics.c:419 fib_table_insert+0x2314/0x2b50 net/ipv4/fib_trie.c:1287 inet_rtm_newroute+0x210/0x340 net/ipv4/fib_frontend.c:779 rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646 netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448 rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x455a09 RSP: 002b:00007faae5fd8c68 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007faae5fd96d4 RCX: 0000000000455a09 RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000013 RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000005d0 R14: 00000000006fdc20 R15: 0000000000000000
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline] kmsan_save_stack mm/kmsan/kmsan.c:294 [inline] kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:685 __msan_chain_origin+0x69/0xc0 mm/kmsan/kmsan_instr.c:529 fib_convert_metrics net/ipv4/fib_semantics.c:1056 [inline] fib_create_info+0x2d46/0x9dc0 net/ipv4/fib_semantics.c:1150 fib_table_insert+0x3e4/0x2b50 net/ipv4/fib_trie.c:1146 inet_rtm_newroute+0x210/0x340 net/ipv4/fib_frontend.c:779 rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646 netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448 rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Uninit was created at: kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315 kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan.c:322 slab_post_alloc_hook mm/slab.h:446 [inline] slab_alloc_node mm/slub.c:2753 [inline] __kmalloc_node_track_caller+0xb32/0x11b0 mm/slub.c:4395 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cb/0x9e0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:988 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1182 [inline] netlink_sendmsg+0x76e/0x1350 net/netlink/af_netlink.c:1876 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9
---
net/ipv4/fib_semantics.c +2 -0
@@ -862,6 +862,8 @@ struct fib_info *fib_create_info(structif (type >RTAX_MAX ) goto err_inval; +if (nla_len (nla) !=sizeof (u32)) + goto err_inval; val =nla_get_u32 (nla);if (type ==RTAX_ADVMSS && val >65535 -40 ) val =65535 -40 ;
PATCH 119/366 rtnetlink: validate attributes in do_setlink()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 644c7eebbfd59e72982d11ec6cc7d39af12450ae upstream.
It seems that rtnl_group_changelink() can call do_setlink while a prior call to validate_linkmsg(dev = NULL, ...) could not validate IFLA_ADDRESS / IFLA_BROADCAST
Make sure do_setlink() calls validate_linkmsg() instead of letting its callers having this responsibility.
With help from Dmitry Vyukov, thanks a lot !
BUG: KMSAN: uninit-value in is_valid_ether_addr include/linux/etherdevice.h:199 [inline] BUG: KMSAN: uninit-value in eth_prepare_mac_addr_change net/ethernet/eth.c:275 [inline] BUG: KMSAN: uninit-value in eth_mac_addr+0x203/0x2b0 net/ethernet/eth.c:308 CPU: 1 PID: 8695 Comm: syz-executor3 Not tainted 4.17.0-rc5+ #103 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:113 kmsan_report+0x149/0x260 mm/kmsan/kmsan.c:1084 __msan_warning_32+0x6e/0xc0 mm/kmsan/kmsan_instr.c:686 is_valid_ether_addr include/linux/etherdevice.h:199 [inline] eth_prepare_mac_addr_change net/ethernet/eth.c:275 [inline] eth_mac_addr+0x203/0x2b0 net/ethernet/eth.c:308 dev_set_mac_address+0x261/0x530 net/core/dev.c:7157 do_setlink+0xbc3/0x5fc0 net/core/rtnetlink.c:2317 rtnl_group_changelink net/core/rtnetlink.c:2824 [inline] rtnl_newlink+0x1fe9/0x37a0 net/core/rtnetlink.c:2976 rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646 netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448 rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x455a09 RSP: 002b:00007fc07480ec68 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007fc07480f6d4 RCX: 0000000000455a09 RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000014 RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000005d0 R14: 00000000006fdc20 R15: 0000000000000000
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline] kmsan_save_stack mm/kmsan/kmsan.c:294 [inline] kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:685 kmsan_memcpy_origins+0x11d/0x170 mm/kmsan/kmsan.c:527 __msan_memcpy+0x109/0x160 mm/kmsan/kmsan_instr.c:478 do_setlink+0xb84/0x5fc0 net/core/rtnetlink.c:2315 rtnl_group_changelink net/core/rtnetlink.c:2824 [inline] rtnl_newlink+0x1fe9/0x37a0 net/core/rtnetlink.c:2976 rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646 netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448 rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Uninit was created at: kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315 kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan.c:322 slab_post_alloc_hook mm/slab.h:446 [inline] slab_alloc_node mm/slub.c:2753 [inline] __kmalloc_node_track_caller+0xb32/0x11b0 mm/slub.c:4395 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cb/0x9e0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:988 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1182 [inline] netlink_sendmsg+0x76e/0x1350 net/netlink/af_netlink.c:1876 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec0/0x1310 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- net/core/rtnetlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/core/rtnetlink.c +4 -4
@@ -1483,6 +1483,10 @@ static int do_setlink(const struct sk_buconst struct net_device_ops *ops = dev->netdev_ops;int err; + err =validate_linkmsg (dev, tb); +if (err <0 ) +return err; +if (tb[IFLA_NET_NS_PID ] || tb[IFLA_NET_NS_FD ]) {struct net *net =rtnl_link_get_net (dev_net (dev), tb);if (IS_ERR (net)) {
@@ -1747,10 +1751,6 @@ static int rtnl_setlink(struct sk_buff * goto errout; } - err =validate_linkmsg (dev, tb); -if (err <0 ) - goto errout; - err =do_setlink (skb, dev, ifm, tb, ifname,0 ); errout:return err;
PATCH 120/366 scsi: qla2xxx: Fix setting lower transfer speed if GPSC fails
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Himanshu Madhani <[email protected]>
commit 413c2f33489b134e3cc65d9c3ff7861e8fdfe899 upstream.
This patch prevents driver from setting lower default speed of 1 GB/sec, if the switch does not support Get Port Speed Capabilities (GPSC) command. Setting this default speed results into much lower write performance for large sequential WRITE. This patch modifies driver to check for gpsc_supported flags and prevents driver from issuing MBC_SET_PORT_PARAM (001Ah) to set default speed of 1 GB/sec. If driver does not send this mailbox command, firmware assumes maximum supported link speed and will operate at the max speed.
--- drivers/scsi/qla2xxx/qla_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +2 -1
@@ -3205,7 +3205,8 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vhreturn ;if (fcport->fp_speed ==PORT_SPEED_UNKNOWN || - fcport->fp_speed > ha->link_data_rate) + fcport->fp_speed > ha->link_data_rate || + !ha->flags.gpsc_supported)return ; rval = qla2x00_set_idma_speed(vha, fcport->loop_id, fcport->fp_speed,
PATCH 121/366 pwm: lpss: platform: Save/restore the ctrl register over a suspend/resume
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 1d375b58c12f08d8570b30b865def4734517f04f upstream.
On some devices the contents of the ctrl register get lost over a suspend/resume and the PWM comes back up disabled after the resume.
This is seen on some Bay Trail devices with the PWM in ACPI enumerated mode, so it shows up as a platform device instead of a PCI device.
If we still think it is enabled and then try to change the duty-cycle after this, we end up with a "PWM_SW_UPDATE was not cleared" error and the PWM is stuck in that state from then on.
This commit adds suspend and resume pm callbacks to the pwm-lpss-platform code, which save/restore the ctrl register over a suspend/resume, fixing this.
Note that:
1) There is no need to do this over a runtime suspend, since we only runtime suspend when disabled and then we properly set the enable bit and reprogram the timings when we re-enable the PWM.
2) This may be happening on more systems then we realize, but has been covered up sofar by a bug in the acpi-lpss.c code which was save/restoring the regular device registers instead of the lpss private registers due to lpss_device_desc.prv_offset not being set. This is fixed by a later patch in this series.
[bwh: Backported to 3.16:
- pwm-lpss is a single module, so make the new functions static
- Only one PWM per chip is supported; remove the npwm assertion and loops
- Adjust filenames, context]
---
drivers/pwm/pwm-lpss.c +24 -0
@@ -39,6 +39,7 @@ struct pwm_lpss_chip {void __iomem *regs;struct clk *clk;unsigned long clk_rate; +u32 saved_ctrl; };struct pwm_lpss_boardinfo {
@@ -177,6 +178,24 @@ static int pwm_lpss_remove(struct pwm_lpreturn pwmchip_remove (&lpwm->chip); } +static int pwm_lpss_suspend (struct device *dev) +{ +struct pwm_lpss_chip *lpwm =dev_get_drvdata (dev); + + lpwm->saved_ctrl =readl (lpwm->regs +PWM ); + +return 0 ; +} + +static int pwm_lpss_resume (struct device *dev) +{ +struct pwm_lpss_chip *lpwm =dev_get_drvdata (dev); + +writel (lpwm->saved_ctrl, lpwm->regs +PWM ); + +return 0 ; +} +static int pwm_lpss_probe_pci (struct pci_dev *pdev,const struct pci_device_id *id) {
@@ -241,6 +260,10 @@ static int pwm_lpss_remove_platform(strureturn pwm_lpss_remove (lpwm); } +static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, + pwm_lpss_suspend, + pwm_lpss_resume); +static const struct acpi_device_id pwm_lpss_acpi_match[] = { {"80860F09" ,0 }, { },
@@ -251,6 +274,7 @@ static struct platform_driver pwm_lpss_d .driver = { .name = "pwm-lpss", .acpi_match_table = pwm_lpss_acpi_match, + .pm = &pwm_lpss_platform_pm_ops, }, .probe = pwm_lpss_probe_platform, .remove = pwm_lpss_remove_platform,
PATCH 122/366 ACPI / LPSS: Add missing prv_offset setting for byt/cht PWM devices
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit fdcb613d49321b5bf5d5a1bd0fba8e7c241dcc70 upstream.
The LPSS PWM device on on Bay Trail and Cherry Trail devices has a set of private registers at offset 0x800, the current lpss_device_desc for them already sets the LPSS_SAVE_CTX flag to have these saved/restored over device-suspend, but the current lpss_device_desc was not setting the prv_offset field, leading to the regular device registers getting saved/restored instead.
This is causing the PWM controller to no longer work, resulting in a black screen, after a suspend/resume on systems where the firmware clears the APB clock and reset bits at offset 0x804.
This commit fixes this by properly setting prv_offset to 0x800 for the PWM devices.
[bwh: Backported to 3.16:
- Drop changes for Braswell
- Adjust context]
---
drivers/acpi/acpi_lpss.c +1 -0
@@ -150,6 +150,7 @@ static struct lpss_shared_clock pwm_clocstatic struct lpss_device_desc byt_pwm_dev_desc = { .clk_required = true, + .prv_offset =0x800 , .save_ctx = true, .shared_clock = &pwm_clock, };
PATCH 123/366 bnx2x: use the right constant
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julia Lawall <[email protected]>
commit dd612f18a49b63af8b3a5f572d999bdb197385bc upstream.
Nearby code that also tests port suggests that the P0 constant should be used when port is zero.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e,e1;
@@
* e ? e1 : e1
// </smpl>
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +1 -1
@@ -581,7 +581,7 @@ static void bnx2x_ets_e3b0_nig_disabled(* slots for the highest priority. */ REG_WR (bp, (port) ?NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS : -NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS ,0x100 ); +NIG_REG_P0_TX_ARB_NUM_STRICT_ARB_SLOTS ,0x100 );/* Mapping between the CREDIT_WEIGHT registers and actual client * numbers */
PATCH 124/366 pagemap: hide physical addresses from non-privileged users
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 1c90308e7a77af6742a97d1021cca923b23b7f0d upstream.
This patch makes pagemap readable for normal users and hides physical addresses from them. For some use-cases PFN isn't required at all.
See http://lkml.kernel.org/r/[email protected]
[bwh: Backported to 3.16:
- Add the same check in the places where we look up a PFN
- Adjust context]
--- fs/proc/task_mmu.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
fs/proc/task_mmu.c +10 -7
@@ -862,6 +862,7 @@ struct pagemapread {int pos, len;/* units: PM_ENTRY_BYTES, not bytes */ pagemap_entry_t *buffer;bool v2; +bool show_pfn; };#define PAGEMAP_WALK_SIZE (PMD_SIZE)
@@ -921,12 +922,13 @@ static int pagemap_pte_hole(unsigned lonstatic void pte_to_pagemap_entry (pagemap_entry_t *pme,struct pagemapread *pm,struct vm_area_struct *vma,unsigned long addr,pte_t pte) { -u64 frame, flags; +u64 frame =0 , flags;struct page *page =NULL ;int flags2 =0 ;if (pte_present (pte)) { - frame =pte_pfn (pte); +if (pm->show_pfn) + frame =pte_pfn (pte); flags =PM_PRESENT ; page =vm_normal_page (vma, addr, pte);if (pte_soft_dirty (pte))
@@ -966,7 +968,7 @@ static void thp_pmd_to_pagemap_entry(pag* This if-check is just to prepare for future implementation. */ if (pmd_present (pmd)) - *pme =make_pme (PM_PFRAME (pmd_pfn (pmd) + offset) + *pme =make_pme ((pm->show_pfn ?PM_PFRAME (pmd_pfn (pmd) + offset) :0 ) |PM_STATUS2 (pm->v2, pmd_flags2) |PM_PRESENT );else *pme =make_pme (PM_NOT_PRESENT (pm->v2) |PM_STATUS2 (pm->v2, pmd_flags2));
@@ -1075,7 +1077,7 @@ static void huge_pte_to_pagemap_entry(pa pte_t pte, int offset, int flags2) { if (pte_present(pte)) - *pme = make_pme(PM_PFRAME(pte_pfn(pte) + offset) | + *pme = make_pme((pm->show_pfn ? PM_PFRAME(pte_pfn(pte) + offset) : 0) |PM_STATUS2 (pm->v2, flags2) |PM_PRESENT ); else
@@ -1167,6 +1169,10 @@ static ssize_t pagemap_read(struct file goto out_task; pm.v2 = soft_dirty_cleared; + +/* do not disclose physical addresses: attack vector */ + pm.show_pfn =file_ns_capable (file, &init_user_ns,CAP_SYS_ADMIN ); + pm.len = (PAGEMAP_WALK_SIZE >>PAGE_SHIFT ); pm.buffer =kmalloc (pm.len *PM_ENTRY_BYTES ,GFP_TEMPORARY ); ret = -ENOMEM ;
@@ -1241,9 +1247,6 @@ out:static int pagemap_open (struct inode *inode,struct file *file) { -/* do not disclose physical addresses: attack vector */ -if (!capable (CAP_SYS_ADMIN )) -return -EPERM ;pr_warn_once ("Bits 55-60 of /proc/PID/pagemap entries are about " "to stop being page-shift some time soon. See the " "linux/Documentation/vm/pagemap.txt for details.\n" );
PATCH 125/366 mm: /proc/pid/pagemap: hide swap entries from unprivileged users
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Huang Ying <[email protected]>
commit ab6ecf247a9321e3180e021a6a60164dee53ab2e upstream.
In commit ab676b7d6fbf ("pagemap: do not leak physical addresses to non-privileged userspace"), the /proc/PID/pagemap is restricted to be readable only by CAP_SYS_ADMIN to address some security issue.
In commit 1c90308e7a77 ("pagemap: hide physical addresses from non-privileged users"), the restriction is relieved to make /proc/PID/pagemap readable, but hide the physical addresses for non-privileged users.
But the swap entries are readable for non-privileged users too. This has some security issues. For example, for page under migrating, the swap entry has physical address information. So, in this patch, the swap entries are hided for non-privileged users too.
[bwh: Backported to 3.16:
- Only PTEs can be swap entries
- Adjust context]
---
fs/proc/task_mmu.c +3 -2
@@ -938,8 +938,9 @@ static void pte_to_pagemap_entry(pagemapif (pte_swp_soft_dirty (pte)) flags2 |= __PM_SOFT_DIRTY; entry =pte_to_swp_entry (pte); - frame =swp_type (entry) | - (swp_offset (entry) <<MAX_SWAPFILES_SHIFT ); +if (pm->show_pfn) + frame =swp_type (entry) | + (swp_offset (entry) <<MAX_SWAPFILES_SHIFT ); flags =PM_SWAP ;if (is_migration_entry (entry)) page =migration_entry_to_page (entry);
PATCH 126/366 mm, page_alloc: do not break __GFP_THISNODE by zonelist reset
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vlastimil Babka <[email protected]>
commit 7810e6781e0fcbca78b91cf65053f895bf59e85f upstream.
In __alloc_pages_slowpath() we reset zonelist and preferred_zoneref for allocations that can ignore memory policies. The zonelist is obtained from current CPU's node. This is a problem for __GFP_THISNODE allocations that want to allocate on a different node, e.g. because the allocating thread has been migrated to a different CPU.
This has been observed to break SLAB in our 4.4-based kernel, because there it relies on __GFP_THISNODE working as intended. If a slab page is put on wrong node's list, then further list manipulations may corrupt the list because page_to_nid() is used to determine which node's list_lock should be locked and thus we may take a wrong lock and race.
Current SLAB implementation seems to be immune by luck thanks to commit 511e3a058812 ("mm/slab: make cache_grow() handle the page allocated on arbitrary node") but there may be others assuming that __GFP_THISNODE works as promised.
We can fix it by simply removing the zonelist reset completely. There is actually no reason to reset it, because memory policies and cpusets don't affect the zonelist choice in the first place. This was different when commit 183f6371aac2 ("mm: ignore mempolicies when using ALLOC_NO_WATERMARK") introduced the code, as mempolicies provided their own restricted zonelists.
We might consider this for 4.17 although I don't know if there's anything currently broken.
SLAB is currently not affected, but in kernels older than 4.7 that don't yet have 511e3a058812 ("mm/slab: make cache_grow() handle the page allocated on arbitrary node") it is. That's at least 4.4 LTS. Older ones I'll have to check.
So stable backports should be more important, but will have to be reviewed carefully, as the code went through many changes. BTW I think that also the ac->preferred_zoneref reset is currently useless if we don't also reset ac->nodemask from a mempolicy to NULL first (which we probably should for the OOM victims etc?), but I would leave that for a separate patch.
[bwh: Backported to 3.16: Resetting the zonelist may still be useful here,
so keep doing it if __GFP_THISNODE is not used.]
--- mm/page_alloc.c | 1 - 1 file changed, 1 deletion(-)
mm/page_alloc.c +2 -1
@@ -2594,7 +2594,8 @@ rebalance:* the allocation is high priority and these type of * allocations are system rather than user orientated */ - zonelist =node_zonelist (numa_node_id (), gfp_mask); +if (!(gfp_mask & __GFP_THISNODE)) + zonelist =node_zonelist (numa_node_id (), gfp_mask); page = __alloc_pages_high_priority(gfp_mask, order, zonelist, high_zoneidx, nodemask,
PATCH 127/366 fs/binfmt_misc.c: do not allow offset overflow
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 5cc41e099504b77014358b58567c5ea6293dd220 upstream.
WHen registering a new binfmt_misc handler, it is possible to overflow the offset to get a negative value, which might crash the system, or possibly leak kernel data.
Here is a crash log when 2500000000 was used as an offset:
BUG: unable to handle kernel paging request at ffff989cfd6edca0
IP: load_misc_binary+0x22b/0x470 [binfmt_misc]
PGD 1ef3e067 P4D 1ef3e067 PUD 0
Oops: 0000 [#1] SMP NOPTI
Modules linked in: binfmt_misc kvm_intel ppdev kvm irqbypass joydev input_leds serio_raw mac_hid parport_pc qemu_fw_cfg parpy
CPU: 0 PID: 2499 Comm: bash Not tainted 4.15.0-22-generic #24-Ubuntu
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.1-1 04/01/2014
RIP: 0010:load_misc_binary+0x22b/0x470 [binfmt_misc]
Call Trace:
search_binary_handler+0x97/0x1d0
do_execveat_common.isra.34+0x667/0x810
SyS_execve+0x31/0x40
do_syscall_64+0x73/0x130
entry_SYSCALL_64_after_hwframe+0x3d/0xa2Use kstrtoint instead of simple_strtoul. It will work as the code already set the delimiter byte to '\0' and we only do it when the field is not empty.
Tested with offsets -1, 2500000000, UINT_MAX and INT_MAX. Also tested with examples documented at Documentation/admin-guide/binfmt-misc.rst and other registrations from packages on Ubuntu.
[bwh: Backported to 3.16:
- Error label is "Einval"
- Adjust context]
--- fs/binfmt_misc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
fs/binfmt_misc.c +9 -3
@@ -319,8 +319,13 @@ static Node *create_entry(const char __uchar *s =strchr (p, del);if (!s) goto Einval; - *s++ ='\0' ; - e->offset =simple_strtoul (p, &p,10 ); + *s ='\0' ; +if (p != s) { +int r =kstrtoint (p,10 , &e->offset); +if (r !=0 || e->offset <0 ) + goto Einval; + } + p = s;if (*p++) goto Einval; e->magic = p;
@@ -341,7 +346,8 @@ static Node *create_entry(const char __uif (e->mask &&string_unescape_inplace (e->mask,UNESCAPE_HEX ) != e->size) goto Einval; -if (e->size + e->offset >BINPRM_BUF_SIZE ) +if (e->size >BINPRM_BUF_SIZE || +BINPRM_BUF_SIZE - e->size < e->offset) goto Einval; }else { p =strchr (p, del);
PATCH 128/366 video/omap: add module license tags
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 1bde9f2cf142b726412fa5b0e3cb557ff46952b0 upstream.
I got a bunch of warnings in a randconfig build:
WARNING: modpost: missing MODULE_LICENSE() in drivers/video/fbdev/omap/lcd_ams_delta.o
WARNING: modpost: missing MODULE_LICENSE() in drivers/video/fbdev/omap/lcd_inn1510.o
WARNING: modpost: missing MODULE_LICENSE() in drivers/video/fbdev/omap/lcd_palmte.o
WARNING: modpost: missing MODULE_LICENSE() in drivers/video/fbdev/omap/lcd_palmtt.o
These come from an earlier patch of mine that turned all display drivers into separate modules. The fix is to add a MODULE_LICENSE tag. Since I'm doing that, adding a description and author field also makes sense. I went by the authors listed in the comment at the top of each file, but removed Imre's Nokia email address that I assume is not valid any more, since Imre is working at Intel these days.
--- drivers/video/fbdev/omap/lcd_ams_delta.c | 4 ++++ drivers/video/fbdev/omap/lcd_h3.c | 4 ++++ drivers/video/fbdev/omap/lcd_htcherald.c | 4 ++++ drivers/video/fbdev/omap/lcd_inn1510.c | 4 ++++ drivers/video/fbdev/omap/lcd_inn1610.c | 4 ++++ drivers/video/fbdev/omap/lcd_osk.c | 4 ++++ drivers/video/fbdev/omap/lcd_palmte.c | 4 ++++ drivers/video/fbdev/omap/lcd_palmtt.c | 4 ++++ drivers/video/fbdev/omap/lcd_palmz71.c | 4 ++++ 9 files changed, 36 insertions(+)
drivers/video/fbdev/omap/lcd_ams_delta.c +4 -0
@@ -223,3 +223,7 @@ static struct platform_driver ams_delta_ };module_platform_driver (ams_delta_panel_driver); + +MODULE_AUTHOR ("Jonathan McDowell <[email protected]>" ); +MODULE_DESCRIPTION ("LCD panel support for the Amstrad E3 (Delta) videophone" ); +MODULE_LICENSE ("GPL" );
drivers/video/fbdev/omap/lcd_h3.c +4 -0
@@ -125,3 +125,7 @@ static struct platform_driver h3_panel_d };module_platform_driver (h3_panel_driver); + +MODULE_AUTHOR ("Imre Deak" ); +MODULE_DESCRIPTION ("LCD panel support for the TI OMAP H3 board" ); +MODULE_LICENSE ("GPL" );
drivers/video/fbdev/omap/lcd_htcherald.c +4 -0
@@ -116,3 +116,7 @@ static struct platform_driver htcherald_ };module_platform_driver (htcherald_panel_driver); + +MODULE_AUTHOR ("Cory Maccarrone" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("LCD panel support for the HTC Herald" );
drivers/video/fbdev/omap/lcd_inn1510.c +4 -0
@@ -111,3 +111,7 @@ static struct platform_driver innovator1 };module_platform_driver (innovator1510_panel_driver); + +MODULE_AUTHOR ("Imre Deak" ); +MODULE_DESCRIPTION ("LCD panel support for the TI OMAP1510 Innovator board" ); +MODULE_LICENSE ("GPL" );
drivers/video/fbdev/omap/lcd_inn1610.c +4 -0
@@ -132,3 +132,7 @@ static struct platform_driver innovator1 };module_platform_driver (innovator1610_panel_driver); + +MODULE_AUTHOR ("Imre Deak" ); +MODULE_DESCRIPTION ("LCD panel support for the TI OMAP1610 Innovator board" ); +MODULE_LICENSE ("GPL" );
drivers/video/fbdev/omap/lcd_osk.c +4 -0
@@ -131,3 +131,7 @@ static struct platform_driver osk_panel_ };module_platform_driver (osk_panel_driver); + +MODULE_AUTHOR ("Imre Deak" ); +MODULE_DESCRIPTION ("LCD panel support for the TI OMAP OSK board" ); +MODULE_LICENSE ("GPL" );
drivers/video/fbdev/omap/lcd_palmte.c +4 -0
@@ -108,3 +108,7 @@ static struct platform_driver palmte_pan };module_platform_driver (palmte_panel_driver); + +MODULE_AUTHOR ("Romain Goyet <[email protected]>, Laurent Gonzalez <[email protected]>" ); +MODULE_DESCRIPTION ("LCD panel support for the Palm Tungsten E" ); +MODULE_LICENSE ("GPL" );
drivers/video/fbdev/omap/lcd_palmtt.c +4 -0
@@ -114,3 +114,7 @@ static struct platform_driver palmtt_pan };module_platform_driver (palmtt_panel_driver); + +MODULE_AUTHOR ("Marek Vasut <[email protected]>" ); +MODULE_DESCRIPTION ("LCD panel support for Palm Tungsten|T" ); +MODULE_LICENSE ("GPL" );
drivers/video/fbdev/omap/lcd_palmz71.c +4 -0
@@ -110,3 +110,7 @@ static struct platform_driver palmz71_pa };module_platform_driver (palmz71_panel_driver); + +MODULE_AUTHOR ("Romain Goyet, Laurent Gonzalez, Marek Vasut" ); +MODULE_LICENSE ("GPL" ); +MODULE_DESCRIPTION ("LCD panel support for the Palm Zire71" );
PATCH 129/366 net/sched: act_simple: fix parsing of TCA_DEF_DATA
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
commit 8d499533e0bc02d44283dbdab03142b599b8ba16 upstream.
use nla_strlcpy() to avoid copying data beyond the length of TCA_DEF_DATA netlink attribute, in case it is less than SIMP_MAX_DATA and it does not end with '\0' character.
v2: fix errors in the commit message, thanks Hangbin Liu
---
net/sched/act_simple.c +6 -8
@@ -52,22 +52,22 @@ static void tcf_simp_release(struct tc_akfree (d->tcfd_defdata); } -static int alloc_defdata (struct tcf_defact *d,char *defdata) +static int alloc_defdata (struct tcf_defact *d,const struct nlattr *defdata) { d->tcfd_defdata =kzalloc (SIMP_MAX_DATA ,GFP_KERNEL );if (unlikely (!d->tcfd_defdata))return -ENOMEM ; -strlcpy (d->tcfd_defdata, defdata,SIMP_MAX_DATA ); +nla_strlcpy (d->tcfd_defdata, defdata,SIMP_MAX_DATA );return 0 ; } -static void reset_policy (struct tcf_defact *d,char *defdata, +static void reset_policy (struct tcf_defact *d,const struct nlattr *defdata,struct tc_defact *p) {spin_lock_bh (&d->tcf_lock); d->tcf_action = p->action;memset (d->tcfd_defdata,0 ,SIMP_MAX_DATA ); -strlcpy (d->tcfd_defdata, defdata,SIMP_MAX_DATA ); +nla_strlcpy (d->tcfd_defdata, defdata,SIMP_MAX_DATA );spin_unlock_bh (&d->tcf_lock); }
@@ -83,7 +83,6 @@ static int tcf_simp_init(struct net *netstruct nlattr *tb[TCA_DEF_MAX +1 ];struct tc_defact *parm;struct tcf_defact *d; -char *defdata;int ret =0 , err;if (nla ==NULL )
@@ -100,7 +99,6 @@ static int tcf_simp_init(struct net *netreturn -EINVAL ; parm =nla_data (tb[TCA_DEF_PARMS ]); - defdata =nla_data (tb[TCA_DEF_DATA ]);if (!tcf_hash_check (parm->index, a, bind)) { ret =tcf_hash_create (parm->index, est, a,sizeof (*d), bind);
@@ -108,7 +106,7 @@ static int tcf_simp_init(struct net *netreturn ret; d =to_defact (a); - ret =alloc_defdata (d, defdata); + ret =alloc_defdata (d, tb[TCA_DEF_DATA ]);if (ret <0 ) {tcf_hash_cleanup (a, est);return ret;
@@ -124,7 +122,7 @@ static int tcf_simp_init(struct net *netif (!ovr)return -EEXIST ; -reset_policy (d, defdata, parm); +reset_policy (d, tb[TCA_DEF_DATA ], parm); }if (ret ==ACT_P_CREATED )
PATCH 130/366 backlight: as3711_bl: Fix Device Tree node lookup
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 4a9c8bb2aca5b5a2a15744333729745dd9903562 upstream.
Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children.
To make things worse, the parent mfd node was also prematurely freed.
--- drivers/video/backlight/as3711_bl.c | 33 ++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-)
drivers/video/backlight/as3711_bl.c +23 -10
@@ -262,10 +262,10 @@ static int as3711_bl_register(struct plastatic int as3711_backlight_parse_dt (struct device *dev) {struct as3711_bl_pdata *pdata =dev_get_platdata (dev); -struct device_node *bl = -of_find_node_by_name (dev->parent->of_node,"backlight" ), *fb; +struct device_node *bl, *fb;int ret; + bl =of_get_child_by_name (dev->parent->of_node,"backlight" );if (!bl) {dev_dbg (dev,"backlight node not found\n" );return -ENODEV ;
@@ -279,7 +279,7 @@ static int as3711_backlight_parse_dt(strif (pdata->su1_max_uA <=0 ) ret = -EINVAL ;if (ret <0 ) -return ret; + goto err_put_bl; } fb =of_parse_phandle (bl,"su2-dev" ,0 );
@@ -292,7 +292,7 @@ static int as3711_backlight_parse_dt(strif (pdata->su2_max_uA <=0 ) ret = -EINVAL ;if (ret <0 ) -return ret; + goto err_put_bl;if (of_find_property (bl,"su2-feedback-voltage" ,NULL )) { pdata->su2_feedback =AS3711_SU2_VOLTAGE ;
@@ -314,8 +314,10 @@ static int as3711_backlight_parse_dt(str pdata->su2_feedback =AS3711_SU2_CURR_AUTO ; count++; } -if (count !=1 ) -return -EINVAL ; +if (count !=1 ) { + ret = -EINVAL ; + goto err_put_bl; + } count =0 ;if (of_find_property (bl,"su2-fbprot-lx-sd4" ,NULL )) {
@@ -334,8 +336,10 @@ static int as3711_backlight_parse_dt(str pdata->su2_fbprot =AS3711_SU2_GPIO4 ; count++; } -if (count !=1 ) -return -EINVAL ; +if (count !=1 ) { + ret = -EINVAL ; + goto err_put_bl; + } count =0 ;if (of_find_property (bl,"su2-auto-curr1" ,NULL )) {
@@ -355,11 +359,20 @@ static int as3711_backlight_parse_dt(str* At least one su2-auto-curr* must be specified iff * AS3711_SU2_CURR_AUTO is used */ -if (!count ^ (pdata->su2_feedback !=AS3711_SU2_CURR_AUTO )) -return -EINVAL ; +if (!count ^ (pdata->su2_feedback !=AS3711_SU2_CURR_AUTO )) { + ret = -EINVAL ; + goto err_put_bl; + } } +of_node_put (bl); +return 0 ; + +err_put_bl: +of_node_put (bl); + +return ret; }static int as3711_backlight_probe (struct platform_device *pdev)
PATCH 131/366 backlight: max8925_bl: Fix Device Tree node lookup
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit d1cc0ec3da23e44c23712579515494b374f111c9 upstream.
Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children.
To make things worse, the parent mfd node was also prematurely freed, while the child backlight node was leaked.
--- drivers/video/backlight/max8925_bl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/video/backlight/max8925_bl.c +3 -1
@@ -116,7 +116,7 @@ static void max8925_backlight_dt_init(stif (!pdata)return ; - np =of_find_node_by_name (nproot,"backlight" ); + np =of_get_child_by_name (nproot,"backlight" );if (!np) {dev_err (&pdev->dev,"failed to find backlight node\n" );return ;
@@ -125,6 +125,8 @@ static void max8925_backlight_dt_init(stif (!of_property_read_u32 (np,"maxim,max8925-dual-string" , &val)) pdata->dual_string = val; +of_node_put (np); + pdev->dev.platform_data = pdata; }
PATCH 132/366 backlight: tps65217_bl: Fix Device Tree node lookup
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 2b12dfa124dbadf391cb9a616aaa6b056823bf75 upstream.
Fix child-node lookup during probe, which ended up searching the whole device tree depth-first starting at the parent rather than just matching on its children.
This would only cause trouble if the child node is missing while there is an unrelated node named "backlight" elsewhere in the tree.
--- drivers/video/backlight/tps65217_bl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/backlight/tps65217_bl.c +2 -2
@@ -190,11 +190,11 @@ static struct tps65217_bl_pdata * tps65217_bl_parse_dt(struct platform_device *pdev) {struct tps65217 *tps =dev_get_drvdata (pdev->dev.parent); -struct device_node *node =of_node_get (tps->dev->of_node); +struct device_node *node;struct tps65217_bl_pdata *pdata, *err;u32 val; - node =of_find_node_by_name (node,"backlight" ); + node =of_get_child_by_name (tps->dev->of_node,"backlight" );if (!node)return ERR_PTR (-ENODEV );
PATCH 133/366 backlight: as3711_bl: Fix Device Tree node leaks
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit d5318d302e7cf6583ec85a2a8bfbb3a3910ae372 upstream.
Two framebuffer device-node names were looked up during probe, but were only used as flags to indicate the presence of two framebuffer device.
Drop the unused framebuffer name along with a likewise unused device pointer from the driver data, and update the platform data to pass in booleans instead of the framebuffer strings. This allows us do drop the node references acquired during probe, which would otherwise leak.
Note that there are no other in-kernel users of the modified platform-data fields.
--- drivers/video/backlight/as3711_bl.c | 12 ++++++------ include/linux/mfd/as3711.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/video/backlight/as3711_bl.c +6 -6
@@ -28,8 +28,6 @@ enum as3711_bl_type {struct as3711_bl_data {bool powered; -const char *fb_name; -struct device *fb_dev;enum as3711_bl_type type;int brightness;struct backlight_device *bl;
@@ -273,7 +271,9 @@ static int as3711_backlight_parse_dt(str fb =of_parse_phandle (bl,"su1-dev" ,0 );if (fb) { - pdata->su1_fb = fb->full_name; +of_node_put (fb); + + pdata->su1_fb = true; ret =of_property_read_u32 (bl,"su1-max-uA" , &pdata->su1_max_uA);if (pdata->su1_max_uA <=0 )
@@ -286,7 +286,9 @@ static int as3711_backlight_parse_dt(strif (fb) {int count =0 ; - pdata->su2_fb = fb->full_name; +of_node_put (fb); + + pdata->su2_fb = true; ret =of_property_read_u32 (bl,"su2-max-uA" , &pdata->su2_max_uA);if (pdata->su2_max_uA <=0 )
@@ -425,7 +427,6 @@ static int as3711_backlight_probe(structif (pdata->su1_fb) { su = &supply->su1; - su->fb_name = pdata->su1_fb; su->type =AS3711_BL_SU1 ; max_brightness =min (pdata->su1_max_uA,31 );
@@ -436,7 +437,6 @@ static int as3711_backlight_probe(structif (pdata->su2_fb) { su = &supply->su2; - su->fb_name = pdata->su2_fb; su->type =AS3711_BL_SU2 ;switch (pdata->su2_fbprot) {
include/linux/mfd/as3711.h +2 -2
@@ -107,9 +107,9 @@ struct as3711_regulator_pdata { };struct as3711_bl_pdata { -const char *su1_fb; +bool su1_fb;int su1_max_uA; -const char *su2_fb; +bool su2_fb;int su2_max_uA;enum as3711_su2_feedback su2_feedback;enum as3711_su2_fbprot su2_fbprot;
PATCH 134/366 UBIFS: Fix potential integer overflow in allocation
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Silvio Cesare <[email protected]>
commit 353748a359f1821ee934afc579cf04572406b420 upstream.
There is potential for the size and len fields in ubifs_data_node to be too large causing either a negative value for the length fields or an integer overflow leading to an incorrect memory allocation. Likewise, when the len field is small, an integer underflow may occur.
[bwh: Backported to 3.16: We have a different set of length variables in
recomp_data_node()]
--- fs/ubifs/journal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ubifs/journal.c +3 -2
@@ -1099,10 +1099,11 @@ out_free:static int recomp_data_node (struct ubifs_data_node *dn,int *new_len) {void *buf; -int err, len, compr_type, out_len; +int err, compr_type; +u32 len, out_len; out_len =le32_to_cpu (dn->size); - buf =kmalloc (out_len *WORST_COMPR_FACTOR ,GFP_NOFS ); + buf =kmalloc_array (out_len,WORST_COMPR_FACTOR ,GFP_NOFS );if (!buf)return -ENOMEM ;
PATCH 135/366 ksm: add cond_resched() to the rmap_walks
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit ad12695f177c3403a64348b42718faf9727fe358 upstream.
While at it add it to the file and anon walks too.
--- mm/ksm.c | 2 ++ mm/rmap.c | 4 ++++ 2 files changed, 6 insertions(+)
mm/ksm.c +2 -0
@@ -1915,9 +1915,11 @@ again:struct anon_vma_chain *vmac;struct vm_area_struct *vma; +cond_resched ();anon_vma_lock_read (anon_vma);anon_vma_interval_tree_foreach (vmac, &anon_vma->rb_root, 0, ULONG_MAX) { +cond_resched (); vma = vmac->vma;if (rmap_item->address < vma->vm_start || rmap_item->address >= vma->vm_end)
mm/rmap.c +4 -0
@@ -1486,6 +1486,8 @@ static int rmap_walk_anon(struct page *pstruct vm_area_struct *vma = avc->vma;unsigned long address =vma_address (page, vma); +cond_resched (); +if (rwc->invalid_vma && rwc->invalid_vma (vma, rwc->arg))continue ;
@@ -1533,6 +1535,8 @@ static int rmap_walk_file(struct page *p vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {unsigned long address =vma_address (page, vma); +cond_resched (); +if (rwc->invalid_vma && rwc->invalid_vma (vma, rwc->arg))continue ;
PATCH 136/366 mm/ksm.c: ignore STABLE_FLAG of rmap_item->address in rmap_walk_ksm()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jia He <[email protected]>
commit 1105a2fc022f3c7482e32faf516e8bc44095f778 upstream.
In our armv8a server(QDF2400), I noticed lots of WARN_ON caused by PAGE_SIZE unaligned for rmap_item->address under memory pressure tests(start 20 guests and run memhog in the host).
WARNING: CPU: 4 PID: 4641 at virt/kvm/arm/mmu.c:1826 kvm_age_hva_handler+0xc0/0xc8 CPU: 4 PID: 4641 Comm: memhog Tainted: G W 4.17.0-rc3+ #8 Call trace: kvm_age_hva_handler+0xc0/0xc8 handle_hva_to_gpa+0xa8/0xe0 kvm_age_hva+0x4c/0xe8 kvm_mmu_notifier_clear_flush_young+0x54/0x98 __mmu_notifier_clear_flush_young+0x6c/0xa0 page_referenced_one+0x154/0x1d8 rmap_walk_ksm+0x12c/0x1d0 rmap_walk+0x94/0xa0 page_referenced+0x194/0x1b0 shrink_page_list+0x674/0xc28 shrink_inactive_list+0x26c/0x5b8 shrink_node_memcg+0x35c/0x620 shrink_node+0x100/0x430 do_try_to_free_pages+0xe0/0x3a8 try_to_free_pages+0xe4/0x230 __alloc_pages_nodemask+0x564/0xdc0 alloc_pages_vma+0x90/0x228 do_anonymous_page+0xc8/0x4d0 __handle_mm_fault+0x4a0/0x508 handle_mm_fault+0xf8/0x1b0 do_page_fault+0x218/0x4b8 do_translation_fault+0x90/0xa0 do_mem_abort+0x68/0xf0 el0_da+0x24/0x28
In rmap_walk_ksm, the rmap_item->address might still have the STABLE_FLAG, then the start and end in handle_hva_to_gpa might not be PAGE_SIZE aligned. Thus it will cause exceptions in handle_hva_to_gpa on arm64.
This patch fixes it by ignoring (not removing) the low bits of address when doing rmap_walk_ksm.
IMO, it should be backported to stable tree. the storm of WARN_ONs is very easy for me to reproduce. More than that, I watched a panic (not reproducible) as follows:
page:ffff7fe003742d80 count:-4871 mapcount:-2126053375 mapping: (null) index:0x0
flags: 0x1fffc00000000000()
raw: 1fffc00000000000 0000000000000000 0000000000000000 ffffecf981470000
raw: dead000000000100 dead000000000200 ffff8017c001c000 0000000000000000
page dumped because: nonzero _refcount
CPU: 29 PID: 18323 Comm: qemu-kvm Tainted: G W 4.14.15-5.hxt.aarch64 #1
Hardware name: <snip for confidential issues>
Call trace:
dump_backtrace+0x0/0x22c
show_stack+0x24/0x2c
dump_stack+0x8c/0xb0
bad_page+0xf4/0x154
free_pages_check_bad+0x90/0x9c
free_pcppages_bulk+0x464/0x518
free_hot_cold_page+0x22c/0x300
__put_page+0x54/0x60
unmap_stage2_range+0x170/0x2b4
kvm_unmap_hva_handler+0x30/0x40
handle_hva_to_gpa+0xb0/0xec
kvm_unmap_hva_range+0x5c/0xd0I even injected a fault on purpose in kvm_unmap_hva_range by seting size=size-0x200, the call trace is similar as above. So I thought the panic is similarly caused by the root cause of WARN_ON.
Andrea said:
: It looks a straightforward safe fix, on x86 hva_to_gfn_memslot would : zap those bits and hide the misalignment caused by the low metadata : bits being erroneously left set in the address, but the arm code : notices when that's the last page in the memslot and the hva_end is : getting aligned and the size is below one page.
:
: I think the problem triggers in the addr += PAGE_SIZE of : unmap_stage2_ptes that never matches end because end is aligned but : addr is not.
:
: } while (pte++, addr += PAGE_SIZE, addr != end);
:
: x86 again only works on hva_start/hva_end after converting it to : gfn_start/end and that being in pfn units the bits are zapped before : they risk to cause trouble.
Jia He said:
: I've tested by myself in arm64 server (QDF2400,46 cpus,96G mem) Without : this patch, the WARN_ON is very easy for reproducing. After this patch, I : have run the same benchmarch for a whole day without any WARN_ONs
--- mm/ksm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
mm/ksm.c +10 -4
@@ -181,6 +181,8 @@ struct rmap_item {#define SEQNR_MASK 0x0ff/* low bits of unstable tree seqnr */ #define UNSTABLE_FLAG 0x100/* is a node of the unstable tree */ #define STABLE_FLAG 0x200/* is listed from the stable tree */ +#define KSM_FLAG_MASK (SEQNR_MASK|UNSTABLE_FLAG|STABLE_FLAG) +/* to mask all the flags */ /* The stable and unstable tree heads */ static struct rb_root one_stable_tree[1 ] = {RB_ROOT };
@@ -1919,10 +1921,15 @@ again:anon_vma_lock_read (anon_vma);anon_vma_interval_tree_foreach (vmac, &anon_vma->rb_root, 0, ULONG_MAX) { +unsigned long addr; +cond_resched (); vma = vmac->vma; -if (rmap_item->address < vma->vm_start || - rmap_item->address >= vma->vm_end) + +/* Ignore the stable/unstable/sqnr flags */ + addr = rmap_item->address & ~KSM_FLAG_MASK ; + +if (addr < vma->vm_start || addr >= vma->vm_end)continue ;/* * Initially we examine only the vma which covers this
@@ -1936,8 +1943,7 @@ again:if (rwc->invalid_vma && rwc->invalid_vma (vma, rwc->arg))continue ; - ret = rwc->rmap_one (page, vma, - rmap_item->address, rwc->arg); + ret = rwc->rmap_one (page, vma, addr, rwc->arg);if (ret !=SWAP_AGAIN ) {anon_vma_unlock_read (anon_vma); goto out;
PATCH 137/366 mm/swapfile.c: fix swap_count comment about nonexistent SWAP_HAS_CONT
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Jordan <[email protected]>
commit 955c97f0859abef698e77f5697f5c4008303abb9 upstream.
Commit 570a335b8e22 ("swap_info: swap count continuations") introduces COUNT_CONTINUED but refers to it incorrectly as SWAP_HAS_CONT in a comment in swap_count. Fix it.
--- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swapfile.c +1 -1
@@ -88,7 +88,7 @@ static atomic_t proc_poll_event = ATOMICstatic inline unsigned char swap_count (unsigned char ent) { -return ent & ~SWAP_HAS_CACHE ;/* may include SWAP_HAS_CONT flag */ +return ent & ~SWAP_HAS_CACHE ;/* may include COUNT_CONTINUED flag */ }/* returns 1 if swap entry is freed */
PATCH 138/366 l2tp: fix pseudo-wire type for sessions created by pppol2tp_connect()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 90904ff5f958a215cc3d26f957a46e80fa178470 upstream.
Define cfg.pw_type so that the new session is created with its .pwtype field properly set (L2TP_PWTYPE_PPP).
Not setting the pseudo-wire type had several annoying effects:
* Invalid value returned in the L2TP_ATTR_PW_TYPE attribute when dumping sessions with the netlink API.
* Impossibility to delete the session using the netlink API (because l2tp_nl_cmd_session_delete() gets the deletion callback function from an array indexed by the session's pseudo-wire type).
Also, there are several cases where we should check a session's pseudo-wire type. For example, pppol2tp_connect() should refuse to connect a session that is not PPPoL2TP, but that requires the session's .pwtype field to be properly set.
--- net/l2tp/l2tp_ppp.c | 1 + 1 file changed, 1 insertion(+)
net/l2tp/l2tp_ppp.c +1 -0
@@ -780,6 +780,7 @@ static int pppol2tp_connect(struct socke/* Default MTU must allow space for UDP/L2TP/PPP headers */ cfg.mtu =1500 -PPPOL2TP_HEADER_OVERHEAD ; cfg.mru = cfg.mtu; + cfg.pw_type =L2TP_PWTYPE_PPP ; session = l2tp_session_create(sizeof(struct pppol2tp_session), tunnel, session_id,
PATCH 139/366 l2tp: only accept PPP sessions in pppol2tp_connect()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 7ac6ab1f8a38ba7f8d97f95475bb6a2575db4658 upstream.
l2tp_session_priv() returns a struct pppol2tp_session pointer only for PPPoL2TP sessions. In particular, if the session is an L2TP_PWTYPE_ETH pseudo-wire, l2tp_session_priv() returns a pointer to an l2tp_eth_sess structure, which is much smaller than struct pppol2tp_session. This leads to invalid memory dereference when trying to lock ps->sk_lock.
--- net/l2tp/l2tp_ppp.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/l2tp/l2tp_ppp.c +6 -0
@@ -756,6 +756,12 @@ static int pppol2tp_connect(struct socke session =l2tp_session_get (sock_net (sk), tunnel, session_id, false);if (session) { drop_refcnt = true; + +if (session->pwtype !=L2TP_PWTYPE_PPP ) { + error = -EPROTOTYPE ; + goto end; + } + ps =l2tp_session_priv (session);/* Using a pre-existing session is fine as long as it hasn't
PATCH 140/366 l2tp: prevent pppol2tp_connect() from creating kernel sockets
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 3e1bc8bf974e2d4e7beb842a4c801c2542eff3bd upstream.
If 'fd' is negative, l2tp_tunnel_create() creates a tunnel socket using the configuration passed in 'tcfg'. Currently, pppol2tp_connect() sets the relevant fields to zero, tricking l2tp_tunnel_create() into setting up an unusable kernel socket.
We can't set 'tcfg' with the required fields because there's no way to get them from the current connect() parameters. So let's restrict kernel sockets creation to the netlink API, which is the original use case.
--- net/l2tp/l2tp_ppp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/l2tp/l2tp_ppp.c +9 -0
@@ -723,6 +723,15 @@ static int pppol2tp_connect(struct socke .encap = L2TP_ENCAPTYPE_UDP, .debug = 0, }; + +/* Prevent l2tp_tunnel_register() from trying to set up +* a kernel socket. +*/ +if (fd <0 ) { + error = -EBADF ; + goto end; + } + error =l2tp_tunnel_create (sock_net (sk), fd, ver, tunnel_id, peer_tunnel_id, &tcfg, &tunnel);if (error <0 ) goto end;
PATCH 141/366 l2tp: clean up stale tunnel or session in pppol2tp_connect's error path
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit bda06be2158c7aa7e41b15500c4d3840369c19a6 upstream.
pppol2tp_connect() may create a tunnel or a session. Remove them in case of error.
--- net/l2tp/l2tp_ppp.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/l2tp/l2tp_ppp.c +10 -0
@@ -634,6 +634,8 @@ static int pppol2tp_connect(struct sockeu32 session_id, peer_session_id;bool drop_refcnt = false;bool drop_tunnel = false; +bool new_session = false; +bool new_tunnel = false;int ver =2 ;int fd;
@@ -744,6 +746,7 @@ static int pppol2tp_connect(struct socke goto end; } drop_tunnel = true; + new_tunnel = true; } }else {/* Error if we can't find the tunnel */
@@ -817,6 +820,7 @@ static int pppol2tp_connect(struct socke goto end; } drop_refcnt = true; + new_session = true; }/* Special case: if source & dest session_id == 0x0000, this
@@ -863,6 +867,12 @@ out_no_ppp: session->name); end: +if (error) { +if (new_session) +l2tp_session_delete (session); +if (new_tunnel) +l2tp_tunnel_delete (tunnel); + }if (drop_refcnt)l2tp_session_dec_refcount (session);if (drop_tunnel)
PATCH 142/366 cfg80211: initialize sinfo in cfg80211_get_station
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit 3c12d0486856b9eb89c2a9ac336713cba90813e3 upstream.
Most of the implementations behind cfg80211_get_station will not initialize sinfo to zero before manipulating it. For example, the member "filled", which indicates the filled in parts of this struct, is often only modified by enabling certain bits in the bitfield while keeping the remaining bits in their original state. A caller without a preinitialized sinfo.filled can then no longer decide which parts of sinfo were filled in by cfg80211_get_station (or actually the underlying implementations).
cfg80211_get_station must therefore take care that sinfo is initialized to zero. Otherwise, the caller may tries to read information which was not filled in and which must therefore also be considered uninitialized. In batadv_v_elp_get_throughput's case, an invalid "random" expected throughput may be stored for this neighbor and thus the B.A.T.M.A.N V algorithm may switch to non-optimal neighbors for certain destinations.
--- net/wireless/util.c | 2 ++ 1 file changed, 2 insertions(+)
net/wireless/util.c +2 -0
@@ -1566,6 +1566,8 @@ int cfg80211_get_station(struct net_deviif (!rdev->ops->get_station)return -EOPNOTSUPP ; +memset (sinfo,0 ,sizeof (*sinfo)); +return rdev_get_station (rdev, dev, mac_addr, sinfo); }EXPORT_SYMBOL (cfg80211_get_station);
PATCH 143/366 l2tp: reject creation of non-PPP sessions on L2TPv2 tunnels
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit de9bada5d389903f4faf33980e6a95a2911c7e6d upstream.
The /proc/net/pppol2tp handlers (pppol2tp_seq_*()) iterate over all L2TPv2 tunnels, and rightfully expect that only PPP sessions can be found there. However, l2tp_netlink accepts creating Ethernet sessions regardless of the underlying tunnel version.
This confuses pppol2tp_seq_session_show(), which expects that l2tp_session_priv() returns a pppol2tp_session structure. When the session is an Ethernet pseudo-wire, a struct l2tp_eth_sess is returned instead. This leads to invalid memory access when pppol2tp_session_get_sock() later tries to dereference ps->sk.
--- net/l2tp/l2tp_netlink.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/l2tp/l2tp_netlink.c +6 -0
@@ -460,6 +460,12 @@ static int l2tp_nl_cmd_session_create(st goto out_tunnel; } +/* L2TPv2 only accepts PPP pseudo-wires */ +if (tunnel->version ==2 && cfg.pw_type !=L2TP_PWTYPE_PPP ) { + ret = -EPROTONOSUPPORT ; + goto out_tunnel; + } +if (tunnel->version >2 ) {if (info->attrs[L2TP_ATTR_OFFSET ]) cfg.offset =nla_get_u16 (info->attrs[L2TP_ATTR_OFFSET ]);
PATCH 144/366 l2tp: filter out non-PPP sessions in pppol2tp_tunnel_ioctl()
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit ecd012e45ab5fd76ed57546865897ce35920f56b upstream.
pppol2tp_tunnel_ioctl() can act on an L2TPv3 tunnel, in which case 'session' may be an Ethernet pseudo-wire.
However, pppol2tp_session_ioctl() expects a PPP pseudo-wire, as it assumes l2tp_session_priv() points to a pppol2tp_session structure. For an Ethernet pseudo-wire l2tp_session_priv() points to an l2tp_eth_sess structure instead, making pppol2tp_session_ioctl() access invalid memory.
--- net/l2tp/l2tp_ppp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_ppp.c +1 -1
@@ -1231,7 +1231,7 @@ static int pppol2tp_tunnel_ioctl(structl2tp_session_get (sock_net (sk), tunnel, stats.session_id, true); -if (session) { +if (session && session->pwtype ==L2TP_PWTYPE_PPP ) { err =pppol2tp_session_ioctl (session, cmd, arg);if (session->deref)
PATCH 145/366 ext4: include the illegal physical block in the bad map ext4_error msg
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit bdbd6ce01a70f02e9373a584d0ae9538dcf0a121 upstream.
--- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/inode.c +2 -2
@@ -414,9 +414,9 @@ static int __check_block_validity(structif (!ext4_data_block_valid (EXT4_SB (inode->i_sb), map->m_pblk, map->m_len)) {ext4_error_inode (inode, func, line, map->m_pblk, -"lblock %lu mapped to illegal pblock " +"lblock %lu mapped to illegal pblock %llu " "(length %d)" , (unsigned long ) map->m_lblk, - map->m_len); + map->m_pblk, map->m_len);return -EIO ; }return 0 ;
PATCH 146/366 ext4: add more mount time checks of the superblock
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit bfe0a5f47ada40d7984de67e59a7d3390b9b9ecc upstream.
The kernel's ext4 mount-time checks were more permissive than e2fsprogs's libext2fs checks when opening a file system. The superblock is considered too insane for debugfs or e2fsck to operate on it, the kernel has no business trying to mount it.
This will make file system fuzzing tools work harder, but the failure cases that they find will be more useful and be easier to evaluate.
--- fs/ext4/super.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
fs/ext4/super.c +26 -11
@@ -3725,6 +3725,13 @@ static int ext4_fill_super(struct super_ le32_to_cpu(es->s_log_block_size)); goto failed_mount; } +if (le32_to_cpu (es->s_log_cluster_size) > + (EXT4_MAX_CLUSTER_LOG_SIZE -EXT4_MIN_BLOCK_LOG_SIZE )) { +ext4_msg (sb,KERN_ERR , +"Invalid log cluster size: %u" , +le32_to_cpu (es->s_log_cluster_size)); + goto failed_mount; + }if (le16_to_cpu (sbi->s_es->s_reserved_gdt_blocks) > (blocksize /4 )) { ext4_msg(sb, KERN_ERR,
@@ -3853,13 +3860,6 @@ static int ext4_fill_super(struct super_ "block size (%d)", clustersize, blocksize); goto failed_mount; } -if (le32_to_cpu (es->s_log_cluster_size) > - (EXT4_MAX_CLUSTER_LOG_SIZE -EXT4_MIN_BLOCK_LOG_SIZE )) { -ext4_msg (sb,KERN_ERR , -"Invalid log cluster size: %u" , -le32_to_cpu (es->s_log_cluster_size)); - goto failed_mount; - } sbi->s_cluster_bits =le32_to_cpu (es->s_log_cluster_size) -le32_to_cpu (es->s_log_block_size); sbi->s_clusters_per_group =
@@ -3880,10 +3880,10 @@ static int ext4_fill_super(struct super_ } }else {if (clustersize != blocksize) { -ext4_warning (sb,"fragment/cluster size (%d) != " -"block size (%d)" , clustersize, - blocksize); - clustersize = blocksize; +ext4_msg (sb,KERN_ERR , +"fragment/cluster size (%d) != " +"block size (%d)" , clustersize, blocksize); + goto failed_mount; }if (sbi->s_blocks_per_group > blocksize *8 ) { ext4_msg(sb, KERN_ERR,
@@ -3937,6 +3937,13 @@ static int ext4_fill_super(struct super_ ext4_blocks_count(es)); goto failed_mount; } +if ((es->s_first_data_block ==0 ) && (es->s_log_block_size ==0 ) && + (sbi->s_cluster_ratio ==1 )) { +ext4_msg (sb,KERN_WARNING ,"bad geometry: first data " +"block is 0 with a 1k block and cluster size" ); + goto failed_mount; + } + blocks_count = (ext4_blocks_count (es) -le32_to_cpu (es->s_first_data_block) +EXT4_BLOCKS_PER_GROUP (sb) -1 );
@@ -3972,6 +3979,14 @@ static int ext4_fill_super(struct super_ ret = -ENOMEM ; goto failed_mount; } +if (((u64 )sbi->s_groups_count * sbi->s_inodes_per_group) != +le32_to_cpu (es->s_inodes_count)) { +ext4_msg (sb,KERN_ERR ,"inodes count not valid: %u vs %llu" , +le32_to_cpu (es->s_inodes_count), + ((u64 )sbi->s_groups_count * sbi->s_inodes_per_group)); + ret = -EINVAL ; + goto failed_mount; + }if (ext4_proc_root) sbi->s_proc =proc_mkdir (sb->s_id, ext4_proc_root);
PATCH 147/366 USB: serial: cp210x: add Silicon Labs IDs for Windows Update
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Karoly Pados <[email protected]>
commit 2f839823382748664b643daa73f41ee0cc01ced6 upstream.
Silicon Labs defines alternative VID/PID pairs for some chips that when used will automatically install drivers for Windows users without manual intervention. Unfortunately, these IDs are not recognized by the Linux module, so using these IDs improves user experience on one platform but degrades it on Linux. This patch addresses this problem.
--- drivers/usb/serial/cp210x.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/cp210x.c +3 -0
@@ -139,8 +139,11 @@ static const struct usb_device_id id_tab { 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, 0xEA63) }, /* Silicon Labs Windows Update (CP2101-4/CP2102N) */ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ + { USB_DEVICE(0x10C4, 0xEA7A) }, /* Silicon Labs Windows Update (CP2105) */ + { USB_DEVICE(0x10C4, 0xEA7B) }, /* Silicon Labs Windows Update (CP2108) */ { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ { USB_DEVICE(0x10C4, 0xF003) }, /* Elan Digital Systems USBpulse100 */
PATCH 148/366 USB: serial: cp210x: add CESINEL device ids
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 24160628a34af962ac99f2f58e547ac3c4cbd26f upstream.
Add device ids for CESINEL products.
--- drivers/usb/serial/cp210x.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/serial/cp210x.c +11 -0
@@ -91,6 +91,9 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ + { USB_DEVICE(0x10C4, 0x817C) }, /* CESINEL MEDCAL N Power Quality Monitor */ + { USB_DEVICE(0x10C4, 0x817D) }, /* CESINEL MEDCAL NT Power Quality Monitor */ + { USB_DEVICE(0x10C4, 0x817E) }, /* CESINEL MEDCAL S Power Quality Monitor */ { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
@@ -108,6 +111,9 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ + { USB_DEVICE(0x10C4, 0x82EF) }, /* CESINEL FALCO 6105 AC Power Supply */ + { USB_DEVICE(0x10C4, 0x82F1) }, /* CESINEL MEDCAL EFD Earth Fault Detector */ + { USB_DEVICE(0x10C4, 0x82F2) }, /* CESINEL MEDCAL ST Network Analyzer */ { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */ { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
@@ -120,7 +126,9 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */ { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */ + { USB_DEVICE(0x10C4, 0x851E) }, /* CESINEL MEDCAL PT Network Analyzer */ { USB_DEVICE(0x10C4, 0x85A7) }, /* LifeScan OneTouch Verio IQ */ + { USB_DEVICE(0x10C4, 0x85B8) }, /* CESINEL ReCon T Energy Logger */ { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
@@ -130,10 +138,13 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8857) }, /* CEL EM357 ZigBee USB Stick */ { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ + { USB_DEVICE(0x10C4, 0x88FB) }, /* CESINEL MEDCAL STII Network Analyzer */ + { USB_DEVICE(0x10C4, 0x8938) }, /* CESINEL MEDCAL S II Network Analyzer */ { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ { USB_DEVICE(0x10C4, 0x8962) }, /* Brim Brothers charging dock */ { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ + { USB_DEVICE(0x10C4, 0x89A4) }, /* CESINEL FTBC Flexible Thyristor Bridge Controller */ { 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 */
PATCH 149/366 netfilter: nf_queue: augment nfqa_cfg_policy
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit ba062ebb2cd561d404e0fba8ee4b3f5ebce7cbfc upstream.
Three attributes are currently not verified, thus can trigger KMSAN warnings such as :
BUG: KMSAN: uninit-value in __arch_swab32 arch/x86/include/uapi/asm/swab.h:10 [inline] BUG: KMSAN: uninit-value in __fswab32 include/uapi/linux/swab.h:59 [inline] BUG: KMSAN: uninit-value in nfqnl_recv_config+0x939/0x17d0 net/netfilter/nfnetlink_queue.c:1268 CPU: 1 PID: 4521 Comm: syz-executor120 Not tainted 4.17.0+ #5 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x185/0x1d0 lib/dump_stack.c:113 kmsan_report+0x188/0x2a0 mm/kmsan/kmsan.c:1117 __msan_warning_32+0x70/0xc0 mm/kmsan/kmsan_instr.c:620 __arch_swab32 arch/x86/include/uapi/asm/swab.h:10 [inline] __fswab32 include/uapi/linux/swab.h:59 [inline] nfqnl_recv_config+0x939/0x17d0 net/netfilter/nfnetlink_queue.c:1268 nfnetlink_rcv_msg+0xb2e/0xc80 net/netfilter/nfnetlink.c:212 netlink_rcv_skb+0x37e/0x600 net/netlink/af_netlink.c:2448 nfnetlink_rcv+0x2fe/0x680 net/netfilter/nfnetlink.c:513 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline] netlink_unicast+0x1680/0x1750 net/netlink/af_netlink.c:1336 netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec8/0x1320 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x15b/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x43fd59 RSP: 002b:00007ffde0e30d28 EFLAGS: 00000213 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043fd59 RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8 R10: 00000000004002c8 R11: 0000000000000213 R12: 0000000000401680 R13: 0000000000401710 R14: 0000000000000000 R15: 0000000000000000
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline] kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189 kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315 kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan.c:322 slab_post_alloc_hook mm/slab.h:446 [inline] slab_alloc_node mm/slub.c:2753 [inline] __kmalloc_node_track_caller+0xb35/0x11b0 mm/slub.c:4395 __kmalloc_reserve net/core/skbuff.c:138 [inline] __alloc_skb+0x2cb/0x9e0 net/core/skbuff.c:206 alloc_skb include/linux/skbuff.h:988 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1182 [inline] netlink_sendmsg+0x76e/0x1350 net/netlink/af_netlink.c:1876 sock_sendmsg_nosec net/socket.c:629 [inline] sock_sendmsg net/socket.c:639 [inline] ___sys_sendmsg+0xec8/0x1320 net/socket.c:2117 __sys_sendmsg net/socket.c:2155 [inline] __do_sys_sendmsg net/socket.c:2164 [inline] __se_sys_sendmsg net/socket.c:2162 [inline] __x64_sys_sendmsg+0x331/0x460 net/socket.c:2162 do_syscall_64+0x15b/0x230 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- net/netfilter/nfnetlink_queue_core.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nfnetlink_queue_core.c +3 -0
@@ -1039,6 +1039,9 @@ nfqnl_recv_unsupp(struct sock *ctnl, strstatic const struct nla_policy nfqa_cfg_policy[NFQA_CFG_MAX +1 ] = { [NFQA_CFG_CMD ] = { .len =sizeof (struct nfqnl_msg_config_cmd ) }, [NFQA_CFG_PARAMS ] = { .len =sizeof (struct nfqnl_msg_config_params ) }, + [NFQA_CFG_QUEUE_MAXLEN ] = { .type =NLA_U32 }, + [NFQA_CFG_MASK ] = { .type =NLA_U32 }, + [NFQA_CFG_FLAGS ] = { .type =NLA_U32 }, };static const struct nf_queue_handler nfqh = {
PATCH 150/366 netfilter: ipv6: nf_defrag: reduce struct net memory waste
In reply to Ben Hutchings3.16.61-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 9ce7bc036ae4cfe3393232c86e9e1fea2153c237 upstream.
It is a waste of memory to use a full "struct netns_sysctl_ipv6" while only one pointer is really used, considering netns_sysctl_ipv6 keeps growing.
Also, since "struct netns_frags" has cache line alignment, it is better to move the frags_hdr pointer outside, otherwise we spend a full cache line for this pointer.
This saves 192 bytes of memory per netns.
--- include/net/net_namespace.h | 1 + include/net/netns/ipv6.h | 1 - net/ipv6/netfilter/nf_conntrack_reasm.c | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-)
include/net/net_namespace.h +1 -0
@@ -112,6 +112,7 @@ struct net {#endif #if IS_ENABLED (CONFIG_NF_DEFRAG_IPV6 )struct netns_nf_frag nf_frag; +struct ctl_table_header *nf_frag_frags_hdr;#endif struct sock *nfnl;struct sock *nfnl_stash;
include/net/netns/ipv6.h +0 -1
@@ -80,7 +80,6 @@ struct netns_ipv6 {#if IS_ENABLED (CONFIG_NF_DEFRAG_IPV6 )struct netns_nf_frag { -struct netns_sysctl_ipv6 sysctl;struct netns_frags frags; };#endif
net/ipv6/netfilter/nf_conntrack_reasm.c +3 -3
@@ -109,7 +109,7 @@ static int nf_ct_frag6_sysctl_register(sif (hdr ==NULL ) goto err_reg; - net->nf_frag.sysctl.frags_hdr = hdr; + net->nf_frag_frags_hdr = hdr;return 0 ; err_reg:
@@ -123,8 +123,8 @@ static void __net_exit nf_ct_frags6_sysc {struct ctl_table *table; - table = net->nf_frag.sysctl.frags_hdr->ctl_table_arg; -unregister_net_sysctl_table (net->nf_frag.sysctl.frags_hdr); + table = net->nf_frag_frags_hdr->ctl_table_arg; +unregister_net_sysctl_table (net->nf_frag_frags_hdr);if (!net_eq (net, &init_net))kfree (table); }