3.16.40-rc1 review
Subsystems (5)
cover 3.16.40-rc1 review
This is the start of the stable review cycle for the 3.16.40 release. There are 306 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 Thu Feb 23 00:00:00 UTC 2017. Anything received after that time might be too late.
A combined patch relative to 3.16.39 will be posted as an additional response to this. A shortlog and diffstat can be found below.
I have not yet worked through commits marked with 'cc: stable' or 'fixed:' that were merged after 4.9, and I haven't checked through all the direct requests for inclusion in stable. So if a fix is missing from this but it falls into those categories, please be patient and let me know only if it's still missing in the next review cycle.
Ben.
-------------
Al Viro (2):
arc: don't leak bits of kernel stack into coredump
[7798bf2140ebcc36eafec6a4194fffd8d585d471]
sg_write()/bsg_write() is not fit to be called under KERNEL_DS
[128394eff343fc6d2f32172f03e24829539c5835]
Alan Stern (1):
memstick: rtsx_usb_ms: Runtime resume the device when polling for cards
[796aa46adf1d90eab36ae06a42e6d3f10b28a75c]
Alex Deucher (4):
drm/radeon/si/dpm: fix phase shedding setup
[427920292b00474d978d632bc03a8e4e50029af3]
drm/radeon/si_dpm: workaround for SI kickers
[7dc86ef5ac91642dfc3eb93ee0f0458e702a343e]
drm/radeon: change vblank_time's calculation method to reduce computational error.
[02cfb5fccb0f9f968f0e208d89d9769aa16267bc]
drm/radeon: narrow asic_init for virtualization
[884031f0aacf57dad1575f96714efc80de9b19cc]
Alexander Usyskin (2):
mei: bus: fix received data size check in NFC fixup
[582ab27a063a506ccb55fc48afcc325342a2deba]
mei: txe: don't clean an unprocessed interrupt cause.
[43605e293eb13c07acb546c14f407a271837af17]
Andrew Bresticker (1):
pstore/ram: Use memcpy_fromio() to save old buffer
[d771fdf94180de2bd811ac90cba75f0f346abf8d]
Andrew Donnellan (1):
powerpc/eeh: Fix deadlock when PE frozen state can't be cleared
[409bf7f8a02ef88db5a0f2cdcf9489914f4b8508]
Andrew Lunn (1):
net: ethernet: mvneta: Remove IFF_UNICAST_FLT which is not implemented
[97db8afa2ab919fc400fe982f5054060868bdf07]
Andrew Lutomirski (1):
hwrng: core - Don't use a stack buffer in add_early_randomness()
[6d4952d9d9d4dc2bb9c0255d95a09405a1e958f7]
Andrey Grodzovsky (1):
scsi: mpt3sas: Fix secure erase premature termination
[18f6084a989ba1b38702f9af37a2e4049a924be6]
Andrey Ryabinin (2):
coredump: fix unfreezable coredumping task
[70d78fe7c8b640b5acfad56ad341985b3810998a]
mpi: Fix NULL ptr dereference in mpi_powm() [ver #3]
[f5527fffff3f002b0a6b376163613b82f69de073]
Andy Gospodarek (1):
bgmac: stop clearing DMA receive control register right after it is set
[fcdefccac976ee51dd6071832b842d8fb41c479c]
Andy Lutomirski (1):
x86/traps: Ignore high word of regs->cs in early_fixup_exception()
[fc0e81b2bea0ebceb71889b61d2240856141c9ee]Anssi Hannula (1):
ALSA: usb-audio: Extend DragonFly dB scale quirk to cover other variants
[eb1a74b7bea17eea31915c4f76385cefe69d9795]
Anton Blanchard (1):
powerpc/vdso64: Use double word compare on pointers
[5045ea37377ce8cca6890d32b127ad6770e6dce5]
Ard Biesheuvel (1):
ALSA: hda - allow 40 bit DMA mask for NVidia devices
[3ab7511eafdd5c4f40d2832f09554478dfbea170]
Arnaldo Carvalho de Melo (1):
perf symbols: Fixup symbol sizes before picking best ones
[432746f8e0b6a82ba832b771afe31abd51af6752]
Arnd Bergmann (2):
[media] dvb-usb: avoid link error with dib3000m{b,c|
[d0fe85e95f56a01a49e4893aa26263e8aee67eef]
staging: iio: ad5933: avoid uninitialized variable in error case
[34eee70a7b82b09dbda4cb453e0e21d460dae226]
Ashok Raj (1):
iommu/vt-d: Fix IOMMU lookup for SR-IOV Virtual Functions
[1c387188c60f53b338c20eee32db055dfe022a9b]
Baoquan He (1):
iommu/amd: Free domain id when free a domain of struct dma_ops_domain
[c3db901c54466a9c135d1e6e95fec452e8a42666]
Bart Van Assche (3):
IB/srp: Fix infinite loop when FMR sg[0].offset != 0
[681cc3608355737c1effebc8145f95c8c3344bc3]
blkcg: Annotate blkg_hint correctly
[55679c8d23d191c24ad133abc5647e3054ca8de1]
dm: mark request_queue dead before destroying the DM device
[3b785fbcf81c3533772c52b717f77293099498d3]Ben Hutchings (2):
Revert "fs: Give dentry to inode_change_ok() instead of inode"
[not upstream; reverts partly broken backport]
net: Add __sock_queue_rcv_skb()
[e6afc8ace6dd5cef5e812f26c72579da8806f5ac]
Benjamin Tissoires (1):
HID: core: prevent out-of-bound readings
[50220dead1650609206efe91f0cc116132d59b3f]
Boris Brezillon (2):
UBI: fastmap: scrub PEB when bitflips are detected in a free PEB EC header
[ecbfa8eabae9cd73522d1d3d15869703c263d859]
m68k: Fix ndelay() macro
[7e251bb21ae08ca2e4fb28cc0981fac2685a8efa]
Borislav Petkov (1):
kbuild: Steal gcc's pie from the very beginning
[c6a385539175ebc603da53aafb7753d39089f32e]
Brian King (1):
scsi: ibmvfc: Fix I/O hang when port is not mapped
[07d0e9a847401ffd2f09bd450d41644cd090e81d]
Brian Norris (2):
PM / sleep: don't suspend parent when async child suspend_{noirq, late} fails
[6f75c3fd56daf547d684127a7f83c283c3c160d1]
mwifiex: printk() overflow with 32-byte SSIDs
[fcd2042e8d36cf644bd2d69c26378d17158b17df]
Calvin Owens (1):
sg: Fix double-free when drives detach during SG_IO
[f3951a3709ff50990bf3e188c27d346792103432]
Chen-Yu Tsai (2):
ASoC: dapm: Fix value setting for _ENUM_DOUBLE MUX's second channel
[071133a209354f39d4e5785d5a6a390e03241841]
phy: sun4i-usb: Use spinlock to guard phyctl register access
[919ab2524c52e5f801d8873f09145ce822cdd43a]
Ching Huang (1):
scsi: arcmsr: Send SYNCHRONIZE_CACHE command to firmware
[2bf7dc8443e113844d078fd6541b7f4aa544f92f]
Chris Brandt (1):
sh_eth: remove unchecked interrupts for RZ/A1
[33d446dbba4d4d6a77e1e900d434fa99e0f02c86]
Chris Mason (1):
btrfs: fix races on root_log_ctx lists
[570dd45042a7c8a7aba1ee029c5dd0f5ccf41b9b]
Chris Metcalf (1):
tile: avoid using clocksource_cyc2ns with absolute cycle count
[e658a6f14d7c0243205f035979d0ecf6c12a036f]
Chuck Lever (1):
svcrdma: Tail iovec leaves an orphaned DMA mapping
[cace564f8b6260e806f5e28d7f192fd0e0c603ed]
Daeho Jeong (1):
ext4: reinforce check of i_dtime when clearing high fields of uid and gid
[93e3b4e6631d2a74a8cf7429138096862ff9f452]
Dan Carpenter (6):
KVM: PPC: BookE: Fix a sanity check
[ac0e89bb4744d3882ccd275f2416d9ce22f4e1e7]
mfd: 88pm80x: Double shifting bug in suspend/resume
[9a6dc644512fd083400a96ac4a035ac154fe6b8d]
netfilter: nf_tables: underflow in nft_parse_u32_check()
[09525a09ad3099efd9ba49b0b90bddc350d6b53a]
scsi: zfcp: spin_lock_irqsave() is not nestable
[e7cb08e894a0b876443ef8fdb0706575dc00a5d2]
ser_gigaset: return -ENOMEM on error instead of success
[93a97c50cbf1c007caf12db5cc23e0d5b9c8473c]
x86/apic/uv: Silence a shift wrapping warning
[c4597fd756836a5fb7900f2091797ab564390ad0]Daniel Glöckner (1):
mmc: block: don't use CMD23 with very old MMC cards
[0ed50abb2d8fc81570b53af25621dad560cd49b3]
Daniel Jurgens (1):
IB/mlx5: Use cache line size to select CQE stride
[16b0e0695a73b68d8ca40288c8f9614ef208917b]
Daniel Mentz (1):
lib/genalloc.c: start search from start of chunk
[62e931fac45b17c2a42549389879411572f75804]
Dave Chinner (1):
xfs: change mailing list address
[541d48f05fa1c19a4a968d38df685529e728a20a]
David Hsu (1):
pwm: Unexport children before chip removal
[0733424c9ba9f42242409d1ece780777272f7ea1]
Dinesh Israni (1):
target: Don't override EXTENDED_COPY xcopy_pt_cmd SCSI status code
[926317de33998c112c5510301868ea9aa34097e2]
Dmitry Torokhov (1):
Input: elantech - add Fujitsu Lifebook E556 to force crc_enabled
[62837b3c1a95535d1a287c9c8c6563bbd8d37033]
Dmitry Vyukov (1):
tty: limit terminal size to 4M chars
[32b2921e6a7461fe63b71217067a6cf4bddb132f]
Doug Brown (1):
USB: serial: ftdi_sio: add support for TI CC3200 LaunchPad
[9bfef729a3d11f04d12788d749a3ce6b47645734]
Eli Cohen (1):
IB/mlx5: Fix NULL pointer dereference on debug print
[a1ab8402d15d2305d2315d96ec3294bfdf16587e]
Eli Cooper (3):
ip6_tunnel: Clear IP6CB in ip6tunnel_xmit()
[23f4ffedb7d751c7e298732ba91ca75d224bc1a6]
ipv4: Set skb->protocol properly for local output
[f4180439109aa720774baafdd798b3234ab1a0d2]
ipv6: Set skb->protocol properly for local output
[b4e479a96fc398ccf83bb1cffb4ffef8631beaf1]Erez Shitrit (1):
net/mlx4_en: Process all completions in RX rings after port goes up
[8d59de8f7bb3db296331c665779c653b0c8d13ba]
Eric Dumazet (5):
ipv4: accept u8 in IP_TOS ancillary data
[e895cdce683161081e3626c4f5a5c55cb72089f8]
net: avoid signed overflows for SO_{SND|RCV}BUFFORCE
[b98b0bc8c431e3ceb4b26b0dfc8db509518fb290]
netlink: do not enter direct reclaim from netlink_dump()
[d35c99ff77ecb2eb239731b799386f3b3637a31e]
pkt_sched: fq: use proper locking in fq_dump_stats()
[695b4ec0f0a9cf29deabd3ac075911d58b31f42b]
tcp: take care of truncations done by sk_filter()
[ac6e780070e30e4c35bd395acfe9191e6268bdd3]
Eugenia Emantayev (1):
net/mlx4_en: Resolve dividing by zero in 32-bit system
[4850cf4581578216468b7b3c3d06cc5abb0a697d]
EunTaik Lee (1):
staging/android/ion : fix a race condition in the ion driver
[9590232bb4f4cc824f3425a6e1349afbe6d6d2b7]
Ewan D. Milne (1):
scsi: scsi_debug: Fix memory leak if LBP enabled and module is unloaded
[4d2b496f19f3c2cfaca1e8fa0710688b5ff3811d]
Fabio Estevam (1):
mmc: mxs: Initialize the spinlock prior to using it
[f91346e8b5f46aaf12f1df26e87140584ffd1b3f]
Felipe Balbi (1):
usb: gadget: u_ether: remove interrupt throttling
[fd9afd3cbe404998d732be6cc798f749597c5114]
Florian Fainelli (3):
net: bcmgenet: Utilize correct struct device for all DMA operations
[8c4799ac799665065f9bf1364fd71bf4f7dc6a4a]
net: ep93xx_eth: Do not crash unloading module
[c823abac17926767fb50175e098f087a6ac684c3]
net: systemport: Fix ordering in intrl2_*_mask_clear macro
[9a0a5c4cb1af98b625dcefd72e987ca4929db71d]
Florian Westphal (1):
netfilter: restart search if moved to other chain
[95a8d19f28e6b29377a880c6264391a62e07fccc]
Furquan Shaikh (1):
pstore/ram: Use memcpy_toio instead of memcpy
[7e75678d23167c2527e655658a8ef36a36c8b4d9]
Gavin Shan (1):
powerpc/powernv: Use CPU-endian PEST in pnv_pci_dump_p7ioc_diag_data()
[5adaf8629b193f185ca5a1665b9e777a0579f518]
Geert Uytterhoeven (1):
clk: divider: Fix clk_divider_round_rate() to use clk_readl()
[2cf9a57811bddb6fa6b0f8d7376da164d5534813]
Gerald Schaefer (3):
GenWQE: Fix bad page access during abort of resource allocation
[a7a7aeefbca2982586ba2c9fd7739b96416a6d1d]
mm/hugetlb: check for reserved hugepages during memory offline
[082d5b6b60e9f25e1511557fcfcb21eedd267446]
mm/hugetlb: fix memory offline with hugepage size > memory block size
[2247bb335ab9c40058484cac36ea74ee652f3b7b]
Gmail (1):
ext4: release bh in make_indexed_dir
[e81d44778d1d57bbaef9e24c4eac7c8a7a401d40]
Greg Kroah-Hartman (2):
Revert "usbtmc: convert to devm_kzalloc"
[ab21b63e8aedfc73565dd9cdd51eb338341177cb]
usb: misc: legousbtower: Fix NULL pointer deference
[2fae9e5a7babada041e2e161699ade2447a01989]
Guenter Roeck (1):
metag: Only define atomic_dec_if_positive conditionally
[35d04077ad96ed33ceea2501f5a4f1eacda77218]
Guilherme G Piccoli (1):
i40e: avoid NULL pointer dereference and recursive errors on early PCI error
[edfc23ee3e0ebbb6713d7574ab1b00abff178f6c]
Guillaume Nault (1):
l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()
[32c231164b762dddefa13af5a0101032c70b50ef]
Haibo Chen (1):
mmc: sdhci: cast unsigned int to unsigned long long to avoid unexpeted error
[02265cd60335a2c1417abae4192611e1fc05a6e5]
Hangbin Liu (1):
igmp: do not remove igmp souce list info when set link down
[24803f38a5c0b6c57ed800b47e695f9ce474bc3a]
Hidehiro Kawai (2):
mips/panic: replace smp_send_stop() with kdump friendly version in panic path
[54c721b857fd45f3ad3bda695ee4f472518db02a]
x86/panic: replace smp_send_stop() with kdump friendly version in panic path
[0ee59413c967c35a6dd2dbdab605b4cd42025ee5]
Hongxu Jia (1):
netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel
[17a49cd549d9dc8707dc9262210166455c612dde]
Hui Wang (2):
ALSA: hda - Adding one more ALC255 pin definition for headset problem
[392c9da24a994f238c5d7ea611c6245be4617014]
ALSA: hda - add a new condition to check if it is thinkpad
[2ecb704a1290edb5e3d53a75529192e7ed2a1a28]
Ido Yariv (1):
KVM: x86: fix wbinvd_dirty_mask use-after-free
[bd768e146624cbec7122ed15dead8daa137d909d]
Ignacio Alvarado (1):
KVM: Disable irq while unregistering user notifier
[1650b4ebc99da4c137bfbfc531be4a2405f951dd]
Jack Morgenstein (4):
net/mlx4: Fix uninitialized fields in rule when adding promiscuous mode to device managed flow steering
[44b911e77793d686b481608770d0c55c18055ba0]
net/mlx4_core: Fix deadlock when switching between polling and event fw commands
[a7e1f04905e5b2b90251974dddde781301b6be37]
net/mlx4_core: Fix the resource-type enum in res tracker to conform to FW spec
[aa0c08feae8161b945520ada753d0dfe62b14fe7]
net/mlx4_en: Fix potential deadlock in port statistics flow
[d2582a03939ed0a80ffcd3ea5345505bc8067c54]
Jakub Sitnicki (1):
ipv6: Don't use ufo handling on later transformed packets
[f89c56ce710afa65e1b2ead555b52c4807f34ff7]
James Hogan (2):
KVM: MIPS: Make ERET handle ERL before EXL
[ede5f3e7b54a4347be4d8525269eae50902bd7cd]
KVM: MIPS: Precalculate MMIO load resume PC
[e1e575f6b026734be3b1f075e780e91ab08ca541]
Jan Kara (4):
fs: Give dentry to inode_change_ok() instead of inode
[31051c85b5e2aaaf6315f74c72a732673632a905]
fuse: Propagate dentry down to inode_change_ok()
[62490330769c1ce5dcba3f1f3e8f4005e9b797e6]
isofs: Do not return EACCES for unknown filesystems
[a2ed0b391dd9c3ef1d64c7c3e370f4a5ffcd324a]
xfs: Propagate dentry down to inode_change_ok()
[69bca80744eef58fa155e8042996b968fec17b26]
Jan Remmet (1):
regulator: tps65910: Work around silicon erratum SWCZ010
[8f9165c981fed187bb483de84caf9adf835aefda]
Jan Viktorin (1):
uio: fix dmem_region_start computation
[4d31a2588ae37a5d0f61f4d956454e9504846aeb]
Jann Horn (1):
swapfile: fix memory corruption via malformed swapfile
[dd111be69114cc867f8e826284559bfbc1c40e37]
Jason Gunthorpe (1):
gpio/mvebu: Use irq_domain_add_linear
[812d47889a8e418d7bea9bec383581a34c19183e]
Jiri Slaby (2):
mmc: core: Annotate cmd_hdr as __le32
[3f2d26643595973e835e8356ea90c7c15cb1b0f1]
tty: vt, fix bogus division in csi_J
[42acfc6615f47e465731c263bee0c799edb098f2]
Joe Perches (1):
ipc: remove use of seq_printf return value
[7f032d6ef6154868a2a5d5f6b2c3f8587292196c]
Johan Hovold (11):
PM / sleep: fix device reference leak in test_suspend
[ceb75787bc75d0a7b88519ab8a68067ac690f55a]
USB: cdc-acm: fix TIOCMIWAIT
[18266403f3fe507f0246faa1d5432333a2f139ca]
USB: serial: fix potential NULL-dereference at probe
[126d26f66d9890a69158812a6caa248c05359daa]
mfd: core: Fix device reference leak in mfd_clone_cell
[722f191080de641f023feaa7d5648caf377844f5]
net: ethernet: ti: cpsw: fix bad register access in probe error path
[c46ab7e08c79be7400f6d59edbc6f26a91941c5a]
net: ethernet: ti: cpsw: fix device and of_node leaks
[c7262aaace1b17a650598063e3b9ee1785fde377]
net: ethernet: ti: cpsw: fix mdio device reference leak
[86e1d5adcef961eb383ce4eacbe0ef22f06e2045]
net: ethernet: ti: cpsw: fix secondary-emac probe error path
[a7fe9d466f6a33558a38c7ca9d58bcc83512d577]
of_mdio: fix node leak in of_phy_register_fixed_link error path
[48c1699d5335bc045b50989a06b1c526b17a25ff]
pwm: Fix device reference leak
[0e1614ac84f1719d87bed577963bb8140d0c9ce8]
uwb: fix device reference leaks
[d6124b409ca33c100170ffde51cd8dff761454a1]
Johannes Berg (2):
cfg80211: limit scan results cache size
[9853a55ef1bb66d7411136046060bbfb69c714fa]
mac80211: discard multicast and 4-addr A-MSDUs
[ea720935cf6686f72def9d322298bf7e9bd53377]
Johannes Weiner (1):
mm: filemap: fix mapping->nrpages double accounting in fuse
[3ddf40e8c31964b744ff10abb48c8e36a83ec6e7]John David Anglin (5):
parisc: Also flush data TLB in flush_icache_page_asm
[5035b230e7b67ac12691ed3b5495bbb617027b68]
parisc: Ensure consistent state when switching to kernel stack at syscall entry
[6ed518328d0189e0fdf1bb7c73290d546143ea66]
parisc: Fix race in pci-dma.c
[c0452fb9fb8f49c7d68ab9fa0ad092016be7b45f]
parisc: Purge TLB before setting PTE
[c78e710c1c9fbeff43dddc0aa3d0ff458e70b0cc]
parisc: Remove unnecessary TLB purges from flush_dcache_page_asm and flush_icache_page_asm
[febe42964fe182281859b3d43d844bb25ca49367]
John Johansen (1):
apparmor: fix change_hat not finding hat after policy replacement
[3d40658c977769ce2138f286cf131537bf68bdfe]
John W. Linville (1):
netfilter: nf_tables: fix type mismatch with error return from nft_parse_u32_check
[f1d505bb762e30bf316ff5d3b604914649d6aed3]
Josh Poimboeuf (1):
x86/dumpstack: Fix x86_32 kernel_stack_pointer() previous stack access
[72b4f6a5e903b071f2a7c4eb1418cbe4eefdc344]
Justin Maggard (1):
async_pq_val: fix DMA memory leak
[c84750906b4818d4929fbf73a4ae6c113b94f52b]
Kamal Heib (1):
net/mlx4_en: Fix wrong indentation
[57c970c2e8d8772237294bb8a6a25a205448fd96]
Kashyap Desai (1):
scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices
[1e793f6fc0db920400574211c48f9157a37e3945]
Kees Cook (2):
fbdev: color map copying bounds checking
[2dc705a9930b4806250fbf5a76e55266e59389f2]
net: ping: check minimum size on ICMP header length
[0eab121ef8750a5c8637d51534d5e9143fb0633f]
Keith Busch (1):
nvme/pci: Don't free queues on error
[d48756228ee9161ac8836b346589a43fabdc9f3c]
Krzysztof Kozlowski (1):
ARM: dts: exynos: Fix mismatched value for SD4 pull up/down configuration on exynos4210
[f7061ffb44116490f282f130a220ca2d10849248]
Kyle Jones (1):
USB: serial: cp210x: Add ID for a Juniper console
[decc5360f23e9efe0252094f47f57f254dcbb3a9]Lance Richardson (1):
ipv4: allow local fragmentation in ip_finish_output_gso()
[9ee6c5dc816aa8256257f2cd4008a9291ec7e985]
Larry Finger (1):
rtlwifi: Fix missing country code for Great Britain
[0c9d3491530773858ff9d705ec2a9c382f449230]
Lars-Peter Clausen (1):
usb: gadget: f_fs: Fix use-after-free
[38740a5b87d53ceb89eb2c970150f6e94e00373a]
Laura Abbott (1):
HID: usbhid: Add HID_QUIRK_NOGET for Aten DVI KVM switch
[849eca7b9dae0364e2fbe8afdf0fb610d12c9c8f]
Laura Garcia Liebana (2):
netfilter: nf_tables: validate maximum value of u32 netlink attributes
[36b701fae12ac763a568037e4e7c96b5727a8b3e]
netfilter: nft_exthdr: Add size check on u8 nft_exthdr attributes
[4da449ae1df9cfeb167e78f250b250eff64bc65e]
Laurent Dufour (1):
powerpc/pseries: Fix stack corruption in htpe code
[05af40e885955065aee8bb7425058eb3e1adca08]
Linus Lüssing (1):
batman-adv: fix splat on disabling an interface
[9799c50372b23ed774791bdb87d700f1286ee8a9]
Linus Torvalds (1):
Fix potential infoleak in older kernels
[1c109fabbd51863475cd12ac206bdd249aee35af]
Liping Zhang (1):
netfilter: nf_tables: destroy the set if fail to add transaction
[c17c3cdff10b9f59ef1244a14604f10949f17117]
Long Li (1):
hv: do not lose pending heartbeat vmbus packets
[407a3aee6ee2d2cb46d9ba3fc380bc29f35d020c]
Lu Baolu (1):
mfd: rtsx_usb: Avoid setting ucr->current_sg.status
[8dcc5ff8fcaf778bb57ab4448fedca9e381d088f]Lucas Stach (1):
drm/radeon: drop register readback in cayman_cp_int_cntl_setup
[537b4b462caa8bfb9726d9695b8e56e2d5e6b41e]
Lyude (2):
drm/i915/vlv: Make intel_crt_reset() per-encoder
[28cf71ce3e206db1c3f30b3da31e7b48b2269e4c]
drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init()
[9504a89247595b6c066c68aea0c34af1fc78d021]
Maik Broemme (1):
PCI: Mark Atheros AR9580 to avoid bus reset
[8e2e03179923479ca0c0b6fdc7c93ecf89bce7a8]
Manfred Spraul (1):
ipc/sem.c: fix complex_count vs. simple op race
[5864a2fd3088db73d47942370d0f7210a807b9bc]
Marc Dietrich (1):
staging: nvec: remove managed resource from PS2 driver
[68fae2f3df455f53d0dfe33483a49020b3b758f3]
Marc Kleine-Budde (1):
can: raw: raw_setsockopt: limit number of can_filter that can be set
[332b05ca7a438f857c61a3c21a88489a21532364]
Marc Zyngier (1):
arm64: kernel: Init MDCR_EL2 even in the absence of a PMU
[850540351bb1a4fa5f192e5ce55b89928cc57f42]
Marcel Hasler (1):
ALSA: usb-audio: Add quirk for Syntek STK1160
[bdc3478f90cd4d2928197f36629d5cf93b64dbe9]
Marcelo Ricardo Leitner (1):
sctp: validate chunk len before actually using it
[bf911e985d6bbaa328c20c3e05f4eb03de11fdd6]
Marcin Nowakowski (1):
MIPS: ptrace: Fix regs_return_value for kernel context
[74f1077b5b783e7bf4fa3007cefdc8dbd6c07518]
Mark Bloch (2):
IB/cm: Mark stale CM id's whenever the mad agent was unregistered
[9db0ff53cb9b43ed75bacd42a89c1a0ab048b2b0]
IB/core: Avoid unsigned int overflow in sg_alloc_table
[3c7ba5760ab8eedec01159b267bb9bfcffe522ac]
Matan Barak (1):
IB/mlx4: Fix create CQ error flow
[593ff73bcfdc79f79a8a0df55504f75ad3e5d1a9]
Mathias Krause (1):
rtnl: reset calcit fptr in rtnl_unregister()
[f567e950bf51290755a2539ff2aaef4c26f735d3]
Mathias Nyman (2):
xhci: add restart quirk for Intel Wildcatpoint PCH
[4c39135aa412d2f1381e43802523da110ca7855c]
xhci: workaround for hosts missing CAS bit
[346e99736c3ce328fd42d678343b70243aca5f36]
Matt Redfearn (1):
virtio: console: Unlock vqs while freeing buffers
[34563769e438d2881f62cf4d9badc4e589ac0ec0]
Mauro Carvalho Chehab (4):
[media] cx231xx: don't return error on success
[1871d718a9db649b70f0929d2778dc01bc49b286]
[media] cx231xx: fix GPIOs for Pixelview SBTVD hybrid
[24b923f073ac37eb744f56a2c7f77107b8219ab2]
[media] mb86a20s: fix demod settings
[505a0ea706fc1db4381baa6c6bd2e596e730a55e]
[media] mb86a20s: fix the locking logic
[dafb65fb98d85d8e78405e82c83e81975e5d5480]
Max Staudt (1):
fbdev/efifb: Fix 16 color palette entry calculation
[d50b3f43db739f03fcf8c0a00664b3d2fed0496e]
Michael Holzheu (1):
s390/hypfs: Use get_free_page() instead of kmalloc to ensure page alignment
[237d6e6884136923b6bd26d5141ebe1d065960c9]
Michal Kubeček (1):
tipc: check minimum bearer MTU
[3de81b758853f0b29c61e246679d20b513c4cfec]
Mike Galbraith (1):
reiserfs: Unlock superblock before calling reiserfs_quota_on_mount()
[420902c9d086848a7548c83e0a49021514bd71b7]
Mike Snitzer (1):
dm mpath: check if path's request_queue is dying in activate_path()
[f10e06b744074824fb8ec7066bc03ecc90918f5b]
Miklos Szeredi (5):
fuse: fix clearing suid, sgid for chown()
[c01638f5d919728f565bf8b5e0a6a159642df0d9]
fuse: fix fuse_write_end() if zero bytes were copied
[59c3b76cc61d1d676f965c192cc7969aa5cb2744]
fuse: fix killing s[ug]id in setattr
[a09f99eddef44035ec764075a37bace8181bec38]
fuse: invalidate dir dentry after chmod
[5e2b8828ff3d79aca8c3a1730652758753205b61]
fuse: listxattr: verify xattr list
[cb3ae6d25a5471be62bfe6ac1fccc0e91edeaba0]
Ming Lei (1):
scsi: Fix use-after-free
[bcd8f2e94808fcddf6ef3af5f060a36820dcc432]
Moshe Lazer (1):
IB/mlx5: Resolve soft lock on massive reg MRs
[6bc1a656ab9f57f0112823b4a36930c9a29d1f89]
Murray Foster (1):
ASoC: cs4270: fix DAPM stream name mismatch
[aa5f920993bda2095952177eea79bc8e58ae6065]
NeilBrown (1):
md: be careful not lot leak internal curr_resync value into metadata. -- (all)
[1217e1d1999ed6c9c1e1b1acae0a74ab70464ae2]
Nicholas Bellinger (1):
target: Make EXTENDED_COPY 0xe4 failure return COPY TARGET DEVICE NOT REACHABLE
[449a137846c84829a328757cd21fd9ca65c08519]Nicholas Mc Guire (2):
MIPS: KVM: Fix unused variable build warning
[5f508c43a7648baa892528922402f1e13f258bd4]
mmc: moxart: fix wait_for_completion_interruptible_timeout return variable type
[41f469cac2663a41a7b0c84cb94e8f7024385ae4]
Nicolas Dichtel (1):
ipv6: correctly add local routes when lo goes up
[a220445f9f4382c36a53d8ef3e08165fa27f7e2c]
Nikolay Aleksandrov (1):
bridge: multicast: restore perm router ports on multicast enable
[7cb3f9214dfa443c1ccc2be637dcc6344cc203f0]
Noa Osherovich (1):
net/mlx5: Avoid passing dma address 0 to firmware
[6b276190c50a12511d889d9079ffb901ff94a822]
Oleg Nesterov (1):
fs/super.c: fix race between freeze_super() and thaw_super()
[89f39af129382a40d7cd1f6914617282cfeee28e]
Oliver Hartkopp (1):
can: bcm: fix warning in bcm_connect/proc_register
[deb507f91f1adbf64317ad24ac46c56eeccfb754]
Oliver Neukum (1):
HID: usbhid: add ATEN CS962 to list of quirky devices
[cf0ea4da4c7df11f7a508b2f37518e0f117f3791]
Ondrej Mosnáček (1):
crypto: gcm - Fix IV buffer size in crypto_gcm_setkey
[50d2e6dc1f83db0563c7d6603967bf9585ce934b]
Pan Xinhui (1):
powerpc/nvram: Fix an incorrect partition merge
[11b7e154b132232535befe51c55db048069c8461]
Paolo Bonzini (1):
KVM: x86: fix missed SRCU usage in kvm_lapic_set_vapic_addr
[7301d6abaea926d685832f7e1f0c37dd206b01f4]
Patrick Scheuring (1):
Input: i8042 - add XMG C504 to keyboard reset table
[da25311c7ca8b0254a686fc0d597075b9aa3b683]
Paul E. McKenney (1):
compiler: Allow 1- and 2-byte smp_load_acquire() and smp_store_release()
[536fa402221f09633e7c5801b327055ab716a363]
Paul Fertser (2):
Revert "staging: nvec: ps2: change serio type to passthrough"
[17c1c9ba15b238ef79b51cf40d855c05b58d5934]
drivers: staging: nvec: remove bogus reset command for PS/2 interface
[d8f8a74d5fece355d2234e1731231d1aebc66b38]
Paul Jakma (1):
USB: serial: cp210x: add ID for the Zone DPMX
[2ab13292d7a314fa45de0acc808e41aaad31989c]Paul Mackerras (2):
KVM: PPC: Book3S: Treat VTB as a per-subcore register, not per-thread
[88b02cf97bb7e742db3e31671d54177e3e19fd89]
powerpc/64: Fix incorrect return value from __copy_tofrom_user
[1a34439e5a0b2235e43f96816dbb15ee1154f656]
Peter Chen (1):
usb: chipidea: move the lock initialization to core file
[a5d906bb261cde5f881a949d3b0fbaa285dcc574]
Peter Hurley (1):
tty: Prevent ldisc drivers from re-using stale tty fields
[dd42bf1197144ede075a9d4793123f7689e164bc]
Peter Zijlstra (5):
perf/core: Fix concurrent sys_perf_event_open() vs. 'move_group' race
[321027c1fe77f892f4ea07846aeae08cefbbb290]
perf/x86: Fix full width counter, counter overflow
[7f612a7f0bc13a2361a152862435b7941156b6af]
perf: Do not double free
[130056275ade730e7a79c110212c8815202773ee]
perf: Fix event->ctx locking
[f63a8daa5812afef4f06c962351687e1ff9ccb2b]
perf: Fix race in swevent hash
[12ca6ad2e3a896256f086497a7c7406a547ee373]Petr Vandrovec (1):
Fix USB CB/CBI storage devices with CONFIG_VMAP_STACK=y
[2ce9d2272b98743b911196c49e7af5841381c206]
Phil Turnbull (1):
netfilter: nfnetlink: correctly validate length of batch messages
[c58d6c93680f28ac58984af61d0a7ebf4319c241]
Philip Pettersson (1):
packet: fix race condition in packet_set_ring
[84ac7260236a49c79eede91617700174c2c19b0c]
Punit Agrawal (1):
ACPI / APEI: Fix incorrect return value of ghes_proc()
[806487a8fc8f385af75ed261e9ab658fc845e633]
Radim Krčmář (1):
KVM: x86: drop error recovery in em_jmp_far and em_ret_far
[2117d5398c81554fbf803f5fd1dc55eb78216c0c]
Richard Weinberger (6):
ubi: Deal with interrupted erasures in WL
[2365418879e9abf12ea9def7f9f3caf0dfa7ffb0]
ubi: Fix Fastmap's update_vol()
[f7d11b33d4e8cedf19367c09b891bbc705163976]
ubi: Fix races around ubi_refill_pools()
[2e8f08deabbc7eefe4c5838aaa6aa9a23a8acf2e]
ubifs: Abort readdir upon error
[c83ed4c9dbb358b9e7707486e167e940d48bfeed]
ubifs: Fix regression in ubifs_readdir()
[a00052a296e54205cf238c75bd98d17d5d02a6db]
ubifs: Fix xattr_names length in exit paths
[843741c5778398ea67055067f4cc65ae6c80ca0e]
Robert Jarzmik (1):
ARM: pxa: fix GPIO double shifts
[ca26475bf02ed8562b9b46f91d3e8b52ec312541]
Ross Lagerwall (1):
cifs: Limit the overall credit acquired
[7d414f396c91a3382e51cf628c1cf0709ad0188b]
Russell Currey (1):
powerpc/eeh: Null check uses of eeh_pe_bus_get
[04fec21c06e35b169a83e75a84a015ab4606bf5e]
Sabrina Dubroca (1):
rtnetlink: fix rtnl_vfinfo_size
[7e75f74a171a8146cc3ee92d5562878b40c25fb5]
Sachin Kamat (1):
iio: hid-sensors: Fix compilation warning
[a034234277d2f51104deadd559dd9584ba00a8cc]
Sascha Silbe (2):
s390/con3270: fix insufficient space padding
[6cd997db911f28f2510b771691270c52b63ed2e6]
s390/con3270: fix use of uninitialised data
[c14f2aac7aa147861793eed9f41f91dd530f0be1]
Scot Doyle (1):
vt: clear selection before resizing
[009e39ae44f4191188aeb6dfbf661b771dbbe515]
Sean Young (1):
dib0700: fix nec repeat handling
[ba13e98f2cebd55a3744c5ffaa08f9dca73bf521]
Sebastian Andrzej Siewior (3):
kbuild: add -fno-PIE
[8ae94224c9d72fc4d9aaac93b2d7833cf46d7141]
pstore/core: drop cmpxchg based updates
[d5a9bf0b38d2ac85c9a693c7fb851f74fd2a2494]
scripts/has-stack-protector: add -fno-PIE
[82031ea29e454b574bc6f49a33683a693ca5d907]
Sebastian Frias (1):
genirq/generic_chip: Add irq_unmap callback
[ee26c013cdee0b947e29d6cadfb9ff3341c69ff9]
Segher Boessenkool (1):
powerpc: Convert cmp to cmpd in idle enter sequence
[80f23935cadb1c654e81951f5a8b7ceae0acc1b4]
Sergei Shtylyov (1):
platform: don't return 0 from platform_get_irq[_byname]() on error
[e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af]
Shao Fu (1):
rtlwifi: Update regulatory database
[02b5fffbe9e02f5d63fa4a801fb807cf0aab4fc9]
Song Hongyan (1):
iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
[6f77199e9e4b84340c751c585691d7642a47d226]
Stefan Richter (1):
firewire: net: fix fragmented datagram_size off-by-one
[e9300a4b7bbae83af1f7703938c94cf6dc6d308f]
Stefan Tauner (1):
USB: serial: ftdi_sio: add support for Infineon TriBoard TC2X7
[ca006f785fbfd7a5c901900bd3fe2b26e946a1ee]
Steffen Maier (10):
zfcp: close window with unblocked rport during rport gone
[4eeaa4f3f1d6c47b69f70e222297a4df4743363e]
zfcp: fix D_ID field with actual value on tracing SAN responses
[771bf03537ddfa4a4dde62ef9dfbc82e4f77ab20]
zfcp: fix ELS/GS request&response length for hardware data router
[70369f8e15b220f50a16348c79a61d3f7054813c]
zfcp: fix fc_host port_type with NPIV
[bd77befa5bcff8c51613de271913639edf85fbc2]
zfcp: fix payload trace length for SAN request&response
[94db3725f049ead24c96226df4a4fb375b880a77]
zfcp: restore tracing of handle for port and LUN with HBA records
[7c964ffe586bc0c3d9febe9bf97a2e4b2866e5b7]
zfcp: restore: Dont use 0 to indicate invalid LUN in rec trace
[0102a30a6ff60f4bb4c07358ca3b1f92254a6c25]
zfcp: retain trace level for SCSI and HBA FSF response records
[35f040df97fa0e94c7851c054ec71533c88b4b81]
zfcp: trace full payload of all SAN records (req,resp,iels)
[aceeffbb59bb91404a0bda32a542d7ebf878433a]
zfcp: trace on request for open and close of WKA port
[d27a7cb91960cf1fdd11b10071e601828cbf4b1f]
Stephen Suryaputra Lin (1):
ipv4: use new_gw for redirect neigh lookup
[969447f226b451c453ddc83cac6144eaeac6f2e3]
Steve French (6):
Clarify locking of cifs file and tcon structures and make more granular
[3afca265b5f53a0b15b79531c13858049505582d]
Cleanup missing frees on some ioctls
[24df1483c272c99ed88b0cba135d0e1dfdee3930]
Display number of credits available
[9742805d6b1bfb45d7f267648c34fb5bcd347397]
Do not send SMB3 SET_INFO request if nothing is changing
[18dd8e1a65ddae2351d0f0d6dd4a334f441fc5fa]
SMB3: GUIDs should be constructed as random but valid uuids
[fa70b87cc6641978b20e12cc5d517e9ffc0086d4]
Set previous session id correctly on SMB3 reconnect
[c2afb8147e69819885493edf3a7c1ce03aaf2d4e]
Sumit Saxena (1):
scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
[5e5ec1759dd663a1d5a2f10930224dd009e500e8]
Sven Eckelmann (1):
batman-adv: Check for alloc errors when preparing TT local data
[c2d0f48a13e53b4747704c9e692f5e765e52041a]
Taesoo Kim (1):
jbd2: fix incorrect unlock on j_list_lock
[559cce698eaf4ccecb2213b2519ea3a0413e5155]
Takashi Iwai (5):
ALSA: ali5451: Fix out-of-bound position reporting
[db68577966abc1aeae4ec597b3dcfa0d56e92041]
ALSA: hda - Fix mic regression by ASRock mobo fixup
[9a2541910dc7eaaa6859eea8a0ffda673059a623]
ALSA: hda - Fix surround output pins for ASRock B150M mobo
[1a3f099101b85cc93d864eb030d97e7725c72ea7]
ALSA: pcm : Call kill_fasync() in stream lock
[3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4]
xc2028: Fix use-after-free bug properly
[22a1e7783e173ab3d86018eb590107d68df46c11]
Tang.Junhui (1):
dm table: fix missing dm_put_target_type() in dm_table_add_target()
[dafa724bf582181d9a7d54f5cb4ca0bf8ef29269]
Tariq Toukan (1):
IB/uverbs: Fix leak of XRC target QPs
[5b810a242c28e1d8d64d718cebe75b79d86a0b2d]
Theodore Ts'o (1):
ext4: sanity check the block and cluster size at mount time
[8cdf3372fe8368f56315e66bea9f35053c418093]
Thomas Gleixner (1):
locking/rtmutex: Prevent dequeue vs. unlock race
[dbb26055defd03d59f678cb5f2c992abe05b064a]
Thomas Huth (1):
KVM: PPC: Book3s PR: Allow access to unprivileged MMCR2 register
[fa73c3b25bd8d0d393dc6109a1dba3c2aef0451e]
Tom St Denis (1):
drm/radeon/si_dpm: Limit clocks on HD86xx part
[fb9a5b0c1c9893db2e0d18544fd49e19d784a87d]
Trond Myklebust (1):
NFSv4: Open state recovery must account for file permission changes
[304020fe48c6c7fff8b5a38f382b54404f0f79d3]
Ulf Hansson (3):
memstick: rtsx_usb_ms: Manage runtime PM when accessing the device
[9158cb29e7c2f10dd325eb1589f0fe745a271257]
mmc: rtsx_usb_sdmmc: Avoid keeping the device runtime resumed when unused
[31cf742f515c275d22843c4c756e048d2b6d716c]
mmc: rtsx_usb_sdmmc: Handle runtime PM while changing the led
[4f48aa7a11bfed9502a7c85a5b68cd40ea827f73]
Ulrich Weber (1):
netfilter: nf_conntrack_sip: extend request line validation
[444f901742d054a4cd5ff045871eac5131646cfb]
Uwe Kleine-König (1):
mfd: wm8350-i2c: Make sure the i2c regmap functions are compiled
[88003fb10f1fc606e1704611c62ceae95fd1d7da]
Vladimir Zapolskiy (1):
i2c: core: fix NULL pointer dereference under race condition
[147b36d5b70c083cc76770c47d60b347e8eaf231]
WANG Cong (2):
ipv4: use the right lock for ping_group_range
[396a30cce15d084b2b1a395aa6d515c3d559c674]
neigh: check error pointer instead of NULL for ipv4_neigh_lookup()
[2c1a4311b61072afe2309d4152a7993e92caa41c]
Wangguang (1):
ext4: bugfix for mmaped pages in mpage_release_unused_pages()
[4e800c0359d9a53e6bf0ab216954971b2515247f]
Wei Fang (1):
vfs,mm: fix a dead loop in truncate_inode_pages_range()
[c2a9737f45e27d8263ff9643f994bda9bac0b944]
Wei Yongjun (2):
staging: rtl8188eu: fix double unlock error in rtw_resume_process()
[23bf40424a0f641ca7ff4225add4aa592086bdd5]
staging: rtl8188eu: fix missing unlock on error in rtw_resume_process()
[eaf47b713b602e7d0129ed8d18d2818246a17e49]
Will Deacon (2):
arm64: KVM: Take S1 walks into account when determining S2 write faults
[60e21a0ef54cd836b9eb22c7cb396989b5b11648]
arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP
[3a402a709500c5a3faca2111668c33d96555e35a]
Willem de Bruijn (3):
dccp: limit sk_filter trim to payload
[4f0c40d94461cfd23893a17335b2ab78ecb333c8]
packet: on direct_xmit, limit tso and csum to supported devices
[104ba78c98808ae837d1f63aae58c183db5505df]
rose: limit sk_filter trim to payload
[f4979fcea7fd36d8e2f556abef86f80e0d5af1ba]
Xin Long (1):
sctp: do not return the transmit err back to sctp_sendmsg
[66388f2c08dfa38071f9eceae7bb29060d9be9aa]
Zhou Chengming (1):
sysctl: Drop reference added by grab_header in proc_sys_readdir
[93362fa47fe98b62e4a34ab408c4a418432e7939]
추지호 (1):
can: peak: fix bad memory access and free sequence
[b67d0dd7d0dc9e456825447bbeb935d8ef43ea7c]
MAINTAINERS | 9 +- Makefile | 9 +- arch/arc/kernel/signal.c | 7 +- arch/arm/boot/dts/exynos4210-pinctrl.dtsi | 2 +- arch/arm/mach-pxa/corgi_pm.c | 13 +- arch/arm/mach-pxa/include/mach/sharpsl_pm.h | 2 +- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- arch/arm/mach-pxa/spitz_pm.c | 9 +- arch/arm64/include/asm/kvm_emulate.h | 11 +- arch/arm64/kernel/debug-monitors.c | 6 +- arch/arm64/kernel/head.S | 3 +- arch/m68k/include/asm/delay.h | 2 +- arch/metag/include/asm/atomic.h | 3 +- arch/mips/cavium-octeon/setup.c | 14 + arch/mips/include/asm/kexec.h | 1 + arch/mips/include/asm/kvm_host.h | 7 +- arch/mips/include/asm/ptrace.h | 2 +- arch/mips/kernel/crash.c | 18 +- arch/mips/kernel/machine_kexec.c | 1 + arch/mips/kvm/kvm_mips_emul.c | 39 ++- arch/parisc/include/asm/pgtable.h | 8 +- arch/parisc/kernel/pacache.S | 49 ++-- arch/parisc/kernel/pci-dma.c | 2 +- arch/parisc/kernel/syscall.S | 11 +- arch/powerpc/include/asm/kvm_book3s.h | 1 + arch/powerpc/include/asm/kvm_host.h | 2 +- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kernel/asm-offsets.c | 2 +- arch/powerpc/kernel/eeh_driver.c | 12 +- arch/powerpc/kernel/idle_power7.S | 2 +- arch/powerpc/kernel/nvram_64.c | 6 +- arch/powerpc/kernel/vdso64/datapage.S | 2 +- arch/powerpc/kernel/vdso64/gettimeofday.S | 2 +- arch/powerpc/kvm/book3s_emulate.c | 2 + arch/powerpc/kvm/book3s_hv.c | 4 +- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 14 +- arch/powerpc/kvm/book3s_pr.c | 6 + arch/powerpc/kvm/booke.c | 2 +- arch/powerpc/lib/copyuser_64.S | 2 +- arch/powerpc/platforms/powernv/eeh-ioda.c | 5 + arch/powerpc/platforms/powernv/pci.c | 4 +- arch/powerpc/platforms/pseries/lpar.c | 4 +- arch/s390/hypfs/hypfs_diag.c | 6 +- arch/tile/kernel/time.c | 4 +- arch/x86/include/asm/kexec.h | 1 + arch/x86/include/asm/smp.h | 1 + arch/x86/include/asm/uaccess.h | 10 +- arch/x86/kernel/apic/x2apic_uv_x.c | 4 +- arch/x86/kernel/cpu/perf_event.c | 2 +- arch/x86/kernel/cpu/perf_event_intel.c | 2 +- arch/x86/kernel/crash.c | 22 +- arch/x86/kernel/head_32.S | 2 +- arch/x86/kernel/ptrace.c | 4 +- arch/x86/kernel/smp.c | 5 + arch/x86/kvm/emulate.c | 36 +-- arch/x86/kvm/x86.c | 20 +- block/blk-cgroup.h | 2 +- block/bsg.c | 3 + crypto/async_tx/async_pq.c | 8 +- crypto/gcm.c | 2 +- drivers/acpi/apei/ghes.c | 2 +- drivers/base/platform.c | 4 +- drivers/base/power/main.c | 8 +- drivers/block/nvme-core.c | 6 +- drivers/char/hw_random/core.c | 6 +- drivers/char/virtio_console.c | 22 +- drivers/clk/clk-divider.c | 2 +- drivers/firewire/net.c | 8 +- drivers/gpio/gpio-mvebu.c | 94 +++--- drivers/gpu/drm/i915/intel_crt.c | 10 +- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_pm.c | 9 + drivers/gpu/drm/radeon/ni.c | 4 +- drivers/gpu/drm/radeon/r600_dpm.c | 15 +- drivers/gpu/drm/radeon/radeon_device.c | 5 +- drivers/gpu/drm/radeon/si_dpm.c | 55 +++- drivers/gpu/drm/radeon/sislands_smc.h | 1 + drivers/hid/hid-core.c | 3 + drivers/hid/hid-ids.h | 2 + drivers/hid/usbhid/hid-quirks.c | 2 + drivers/hv/hv_util.c | 10 +- drivers/i2c/i2c-core.c | 2 +- .../iio/common/hid-sensors/hid-sensor-attributes.c | 60 ++-- drivers/infiniband/core/cm.c | 125 +++++++- drivers/infiniband/core/umem.c | 2 +- drivers/infiniband/core/uverbs_main.c | 7 +- drivers/infiniband/hw/mlx4/cq.c | 5 +- drivers/infiniband/hw/mlx5/cq.c | 3 +- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 + drivers/infiniband/hw/mlx5/mr.c | 6 +- drivers/infiniband/hw/mlx5/qp.c | 5 +- drivers/infiniband/ulp/srp/ib_srp.c | 8 +- drivers/input/mouse/elantech.c | 11 +- drivers/input/serio/i8042-x86ia64io.h | 7 + drivers/iommu/amd_iommu.c | 3 + drivers/iommu/dmar.c | 4 +- drivers/iommu/intel-iommu.c | 13 + drivers/isdn/gigaset/ser-gigaset.c | 4 +- drivers/md/dm-mpath.c | 6 +- drivers/md/dm-table.c | 24 +- drivers/md/dm.c | 5 + drivers/md/md.c | 2 +- drivers/media/dvb-frontends/mb86a20s.c | 104 +++---- drivers/media/tuners/tuner-xc2028.c | 37 +-- drivers/media/usb/cx231xx/cx231xx-avcore.c | 5 +- drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +- drivers/media/usb/cx231xx/cx231xx-core.c | 3 +- drivers/media/usb/dvb-usb/Kconfig | 1 + drivers/media/usb/dvb-usb/dib0700_core.c | 5 +- drivers/memstick/host/rtsx_usb_ms.c | 6 + drivers/mfd/Kconfig | 1 + drivers/mfd/mfd-core.c | 2 + drivers/mfd/rtsx_usb.c | 10 +- drivers/misc/genwqe/card_utils.c | 12 +- drivers/misc/mei/hw-txe.c | 6 +- drivers/misc/mei/nfc.c | 2 +- drivers/mmc/card/block.c | 5 +- drivers/mmc/card/queue.h | 2 +- drivers/mmc/host/moxart-mmc.c | 5 +- drivers/mmc/host/mxs-mmc.c | 4 +- drivers/mmc/host/rtsx_usb_sdmmc.c | 7 +- drivers/mmc/host/sdhci.c | 2 +- drivers/mtd/ubi/eba.c | 4 +- drivers/mtd/ubi/fastmap.c | 22 +- drivers/mtd/ubi/wl.c | 45 ++- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 6 +- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- drivers/net/ethernet/broadcom/bgmac.c | 5 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 11 +- drivers/net/ethernet/cirrus/ep93xx_eth.c | 4 + drivers/net/ethernet/intel/i40e/i40e_main.c | 6 + drivers/net/ethernet/marvell/mvneta.c | 2 +- drivers/net/ethernet/mellanox/mlx4/cmd.c | 23 +- drivers/net/ethernet/mellanox/mlx4/en_clock.c | 5 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 7 + drivers/net/ethernet/mellanox/mlx4/en_port.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +- drivers/net/ethernet/mellanox/mlx4/mcg.c | 7 +- drivers/net/ethernet/mellanox/mlx4/mlx4.h | 7 +- drivers/net/ethernet/mellanox/mlx4/port.c | 13 +- .../net/ethernet/mellanox/mlx5/core/pagealloc.c | 26 +- drivers/net/ethernet/renesas/sh_eth.c | 2 +- drivers/net/ethernet/ti/cpsw-phy-sel.c | 3 + drivers/net/ethernet/ti/cpsw.c | 16 +- drivers/net/wireless/mwifiex/cfg80211.c | 13 +- drivers/net/wireless/rtlwifi/regd.c | 45 ++- drivers/net/wireless/rtlwifi/regd.h | 1 + drivers/of/of_mdio.c | 5 +- drivers/pci/quirks.c | 1 + drivers/phy/phy-sun4i-usb.c | 11 +- drivers/pwm/core.c | 2 + drivers/pwm/sysfs.c | 20 ++ drivers/regulator/tps65910-regulator.c | 6 + drivers/s390/char/con3270.c | 11 +- drivers/s390/scsi/zfcp_dbf.c | 162 +++++++++-- drivers/s390/scsi/zfcp_dbf.h | 14 +- drivers/s390/scsi/zfcp_erp.c | 12 +- drivers/s390/scsi/zfcp_ext.h | 8 +- drivers/s390/scsi/zfcp_fsf.c | 22 +- drivers/s390/scsi/zfcp_fsf.h | 4 +- drivers/s390/scsi/zfcp_scsi.c | 8 +- drivers/scsi/arcmsr/arcmsr_hba.c | 9 - drivers/scsi/ibmvscsi/ibmvfc.c | 1 - drivers/scsi/megaraid/megaraid_sas.h | 2 +- drivers/scsi/megaraid/megaraid_sas_base.c | 13 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 15 +- drivers/scsi/scsi_debug.c | 1 + drivers/scsi/scsi_scan.c | 2 +- drivers/scsi/sg.c | 8 +- drivers/staging/android/ion/ion.c | 55 +++- drivers/staging/iio/impedance-analyzer/ad5933.c | 17 +- drivers/staging/nvec/nvec_ps2.c | 8 +- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 4 +- drivers/target/target_core_transport.c | 11 + drivers/target/target_core_xcopy.c | 34 ++- drivers/tty/tty_ldisc.c | 7 + drivers/tty/vt/vt.c | 7 +- drivers/uio/uio_dmem_genirq.c | 2 +- drivers/usb/chipidea/core.c | 1 + drivers/usb/chipidea/udc.c | 2 - drivers/usb/class/cdc-acm.c | 2 - drivers/usb/class/usbtmc.c | 3 +- drivers/usb/gadget/f_fs.c | 1 - drivers/usb/gadget/u_ether.c | 7 - drivers/usb/host/xhci-hub.c | 37 +++ drivers/usb/host/xhci-pci.c | 10 +- drivers/usb/host/xhci.h | 3 + drivers/usb/misc/legousbtower.c | 35 ++- drivers/usb/serial/cp210x.c | 2 + drivers/usb/serial/ftdi_sio.c | 5 +- drivers/usb/serial/ftdi_sio_ids.h | 11 +- drivers/usb/serial/usb-serial.c | 3 +- drivers/usb/storage/transport.c | 7 +- drivers/uwb/lc-rc.c | 16 +- drivers/uwb/pal.c | 2 + drivers/video/fbdev/core/fbcmap.c | 26 +- drivers/video/fbdev/efifb.c | 6 +- fs/btrfs/tree-log.c | 20 +- fs/cifs/cifs_debug.c | 1 + fs/cifs/cifsfs.c | 3 +- fs/cifs/cifsglob.h | 30 +- fs/cifs/cifssmb.c | 4 +- fs/cifs/connect.c | 2 +- fs/cifs/file.c | 66 +++-- fs/cifs/misc.c | 15 +- fs/cifs/readdir.c | 6 +- fs/cifs/smb2glob.h | 10 + fs/cifs/smb2inode.c | 6 + fs/cifs/smb2misc.c | 16 +- fs/cifs/smb2ops.c | 5 +- fs/cifs/smb2pdu.c | 21 +- fs/cifs/smb2pdu.h | 2 +- fs/coredump.c | 3 + fs/ext4/ext4.h | 1 + fs/ext4/inode.c | 10 +- fs/ext4/namei.c | 14 +- fs/ext4/super.c | 17 +- fs/fuse/dir.c | 62 +++- fs/fuse/file.c | 8 +- fs/isofs/inode.c | 8 +- fs/jbd2/transaction.c | 3 +- fs/nfs/nfs4state.c | 3 + fs/proc/proc_sysctl.c | 3 +- fs/pstore/ram_core.c | 49 +--- fs/reiserfs/super.c | 12 +- fs/super.c | 6 +- fs/ubifs/dir.c | 16 +- fs/ubifs/xattr.c | 2 + fs/xfs/xfs_acl.c | 3 +- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_ioctl.c | 2 +- fs/xfs/xfs_iops.c | 96 +++--- fs/xfs/xfs_iops.h | 7 +- include/linux/compiler.h | 2 +- include/linux/filter.h | 6 +- include/linux/hugetlb.h | 6 +- include/linux/mfd/88pm80x.h | 4 +- include/linux/pwm.h | 5 + include/linux/sem.h | 1 + include/linux/sunrpc/svc_rdma.h | 9 + include/net/ip6_tunnel.h | 1 + include/net/netfilter/nf_tables.h | 1 + include/net/sock.h | 9 +- include/net/tcp.h | 1 + include/target/target_core_base.h | 1 + include/uapi/linux/can.h | 1 + ipc/msg.c | 34 ++- ipc/sem.c | 165 ++++++----- ipc/shm.c | 42 +-- ipc/util.c | 6 +- kernel/events/core.c | 322 +++++++++++++++++---- kernel/irq/generic-chip.c | 22 ++ kernel/locking/rtmutex.c | 68 ++++- kernel/panic.c | 48 ++- kernel/power/suspend_test.c | 4 +- lib/genalloc.c | 3 +- lib/mpi/mpi-pow.c | 7 +- mm/filemap.c | 5 +- mm/hugetlb.c | 39 ++- mm/memory_hotplug.c | 4 +- mm/swapfile.c | 2 + net/batman-adv/hard-interface.c | 1 - net/batman-adv/translation-table.c | 4 +- net/bridge/br_multicast.c | 23 +- net/can/bcm.c | 32 +- net/can/raw.c | 3 + net/core/filter.c | 10 +- net/core/rtnetlink.c | 8 +- net/core/sock.c | 30 +- net/dccp/ipv4.c | 2 +- net/dccp/ipv6.c | 2 +- net/ipv4/igmp.c | 49 +++- net/ipv4/ip_output.c | 7 +- net/ipv4/ip_sockglue.c | 7 +- net/ipv4/netfilter/arp_tables.c | 4 +- net/ipv4/ping.c | 4 + net/ipv4/route.c | 6 +- net/ipv4/sysctl_net_ipv4.c | 8 +- net/ipv4/tcp_ipv4.c | 19 +- net/ipv6/addrconf.c | 2 +- net/ipv6/ip6_output.c | 2 +- net/ipv6/output_core.c | 2 + net/ipv6/tcp_ipv6.c | 6 +- net/l2tp/l2tp_ip.c | 5 +- net/l2tp/l2tp_ip6.c | 5 +- net/mac80211/rx.c | 24 +- net/netfilter/nf_conntrack_core.c | 7 + net/netfilter/nf_conntrack_sip.c | 5 +- net/netfilter/nf_tables_api.c | 29 +- net/netfilter/nfnetlink.c | 9 +- net/netfilter/nft_bitwise.c | 7 +- net/netfilter/nft_byteorder.c | 15 +- net/netfilter/nft_cmp.c | 3 + net/netfilter/nft_exthdr.c | 13 +- net/netfilter/nft_immediate.c | 4 + net/netlink/af_netlink.c | 7 +- net/packet/af_packet.c | 29 +- net/rose/rose_in.c | 3 +- net/sched/sch_fq.c | 32 +- net/sctp/sm_sideeffect.c | 16 +- net/sctp/sm_statefuns.c | 12 +- net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 2 +- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 20 +- net/sunrpc/xprtrdma/svc_rdma_transport.c | 20 +- net/tipc/bearer.c | 13 +- net/tipc/bearer.h | 16 + net/wireless/core.h | 1 + net/wireless/scan.c | 69 +++++ scripts/gcc-x86_64-has-stack-protector.sh | 2 +- security/apparmor/domain.c | 6 +- sound/core/pcm_lib.c | 2 +- sound/pci/ali5451/ali5451.c | 2 + sound/pci/hda/hda_intel.c | 7 +- sound/pci/hda/patch_realtek.c | 14 + sound/pci/hda/thinkpad_helper.c | 3 + sound/soc/codecs/cs4270.c | 8 +- sound/soc/soc-dapm.c | 2 +- sound/usb/mixer_quirks.c | 22 +- sound/usb/quirks-table.h | 17 ++ tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 2 +- 322 files changed, 2923 insertions(+), 1289 deletions(-)
Signature · 3 lines
Ben Hutchings
Lowery's Law:
If it jams, force it. If it breaks, it needed replacing anyway.PATCH 1/306 Revert "fs: Give dentry to inode_change_ok() instead of inode"
3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
This reverts commit be9df699432235753c3824b0f5a27d46de7fdc9e, which was commit 31051c85b5e2aaaf6315f74c72a732673632a905 upstream. The backport breaks fuse and makes a mess of xfs, which can be improved by picking further upstream commits as I should have done in the first place.
---
Documentation/filesystems/porting +2 -2
@@ -287,8 +287,8 @@ implementing on-disk size changes. Star and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to be in order of zeroing blocks using block_truncate_page or similar helpers, size update and on finally on-disk truncation which should not fail. -setattr_prepare (which used to be inode_change_ok) now includes the size checks -for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally. +inode_change_ok now includes the size checks for ATTR_SIZE and must be called +in the beginning of ->setattr unconditionally. [mandatory]
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -1386,7 +1386,7 @@ int ll_setattr_raw(struct dentry *dentry attr->ia_valid |=ATTR_MTIME |ATTR_CTIME ; } -/* POSIX: check before ATTR_*TIME_SET set (from setattr_prepare) */ +/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */ if (attr->ia_valid &TIMES_SET_FLAGS ) {if ((!uid_eq (current_fsuid (), inode->i_uid)) && !capable (CFS_CAP_FOWNER ))
fs/9p/vfs_inode.c +1 -1
@@ -1094,7 +1094,7 @@ static int v9fs_vfs_setattr(struct dentrstruct p9_wstat wstat;p9_debug (P9_DEBUG_VFS ,"\n" ); - retval =setattr_prepare (dentry, iattr); + retval =inode_change_ok (dentry->d_inode, iattr);if (retval)return retval;
fs/9p/vfs_inode_dotl.c +1 -1
@@ -560,7 +560,7 @@ int v9fs_vfs_setattr_dotl(struct dentryp9_debug (P9_DEBUG_VFS ,"\n" ); - retval =setattr_prepare (dentry, iattr); + retval =inode_change_ok (inode, iattr);if (retval)return retval;
fs/adfs/inode.c +1 -1
@@ -303,7 +303,7 @@ adfs_notify_change(struct dentry *dentryunsigned int ia_valid = attr->ia_valid;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);/* * we can't change the UID or GID of any file -
fs/affs/inode.c +1 -1
@@ -222,7 +222,7 @@ affs_notify_change(struct dentry *dentrypr_debug ("notify_change(%lu,0x%x)\n" , inode->i_ino, attr->ia_valid); - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode,attr);if (error) goto out;
fs/attr.c +6 -9
@@ -17,22 +17,19 @@#include <linux/ima.h> /** -* setattr_prepare - check if attribute changes to a dentry are allowed -* @dentry: dentry to check +* inode_change_ok - check if attribute changes to an inode are allowed +* @inode: inode to check * @attr: attributes to change * * Check if we are allowed to change the attributes contained in @attr -* in the given dentry. This includes the normal unix access permission -* checks, as well as checks for rlimits and others. The function also clears -* SGID bit from mode if user is not allowed to set it. Also file capabilities -* and IMA extended attributes are cleared if ATTR_KILL_PRIV is set. +* in the given inode. This includes the normal unix access permission +* checks, as well as checks for rlimits and others. * * Should be called as the first thing in ->setattr implementations, * possibly after taking additional locks. */ -int setattr_prepare (struct dentry *dentry,struct iattr *attr) +int inode_change_ok (const struct inode *inode,struct iattr *attr) { -struct inode *inode =d_inode (dentry);unsigned int ia_valid = attr->ia_valid;/*
@@ -92,7 +89,7 @@ kill_priv:return 0 ; } -EXPORT_SYMBOL (setattr_prepare); +EXPORT_SYMBOL (inode_change_ok);/** * inode_newsize_ok - may this inode be truncated to a given size
fs/btrfs/inode.c +1 -1
@@ -4690,7 +4690,7 @@ static int btrfs_setattr(struct dentry *if (btrfs_root_readonly (root))return -EROFS ; - err =setattr_prepare (dentry, attr); + err =inode_change_ok (inode, attr);if (err)return err;
fs/ceph/inode.c +1 -1
@@ -1708,7 +1708,7 @@ int ceph_setattr(struct dentry *dentry,if (ceph_snap (inode) !=CEPH_NOSNAP )return -EROFS ; - err =setattr_prepare (dentry, attr); + err =inode_change_ok (inode, attr);if (err !=0 )return err;
fs/cifs/inode.c +2 -2
@@ -2074,7 +2074,7 @@ cifs_setattr_unix(struct dentry *direntrif (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_PERM ) attrs->ia_valid |=ATTR_FORCE ; - rc =setattr_prepare (direntry, attrs); + rc =inode_change_ok (inode, attrs);if (rc <0 ) goto out;
@@ -2215,7 +2215,7 @@ cifs_setattr_nounix(struct dentry *direnif (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_PERM ) attrs->ia_valid |=ATTR_FORCE ; - rc =setattr_prepare (direntry, attrs); + rc =inode_change_ok (inode, attrs);if (rc <0 ) {free_xid (xid);return rc;
fs/ecryptfs/inode.c +1 -1
@@ -952,7 +952,7 @@ static int ecryptfs_setattr(struct dentr }mutex_unlock (&crypt_stat->cs_mutex); - rc =setattr_prepare (dentry, ia); + rc =inode_change_ok (inode, ia);if (rc) goto out;if (ia->ia_valid &ATTR_SIZE ) {
fs/exofs/inode.c +1 -1
@@ -1039,7 +1039,7 @@ int exofs_setattr(struct dentry *dentry,if (unlikely (error))return error; - error =setattr_prepare (dentry, iattr); + error =inode_change_ok (inode, iattr);if (unlikely (error))return error;
fs/ext2/inode.c +1 -1
@@ -1547,7 +1547,7 @@ int ext2_setattr(struct dentry *dentry,struct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, iattr); + error =inode_change_ok (inode, iattr);if (error)return error;
fs/ext3/inode.c +1 -1
@@ -3244,7 +3244,7 @@ int ext3_setattr(struct dentry *dentry,int error, rc =0 ;const unsigned int ia_valid = attr->ia_valid; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/ext4/inode.c +1 -1
@@ -4672,7 +4672,7 @@ int ext4_setattr(struct dentry *dentry,int orphan =0 ;const unsigned int ia_valid = attr->ia_valid; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/f2fs/file.c +1 -1
@@ -500,7 +500,7 @@ int f2fs_setattr(struct dentry *dentry,struct f2fs_inode_info *fi =F2FS_I (inode);int err; - err =setattr_prepare (dentry, attr); + err =inode_change_ok (inode, attr);if (err)return err;
fs/fat/file.c +1 -1
@@ -394,7 +394,7 @@ int fat_setattr(struct dentry *dentry, s attr->ia_valid &= ~TIMES_SET_FLAGS ; } - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr); attr->ia_valid = ia_valid;if (error) {if (sbi->options.quiet)
fs/fuse/dir.c +4 -5
@@ -1704,10 +1704,9 @@ int fuse_flush_times(struct inode *inode* vmtruncate() doesn't allow for this case, so do the rlimit checking * and the actual truncation by hand. */ -int fuse_do_setattr (struct dentry *dentry,struct iattr *attr, +int fuse_do_setattr (struct inode *inode,struct iattr *attr,struct file *file) { -struct inode *inode = dentry->d_inode;struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_inode *fi =get_fuse_inode (inode);struct fuse_req *req;
@@ -1722,7 +1721,7 @@ int fuse_do_setattr(struct dentry *dentrif (!(fc->flags &FUSE_DEFAULT_PERMISSIONS )) attr->ia_valid |=ATTR_FORCE ; - err =setattr_prepare (dentry, attr); + err =inode_change_ok (inode, attr);if (err)return err;
@@ -1827,9 +1826,9 @@ static int fuse_setattr(struct dentry *ereturn -EACCES ;if (attr->ia_valid &ATTR_FILE ) -return fuse_do_setattr (entry, attr, attr->ia_file); +return fuse_do_setattr (inode, attr, attr->ia_file);else -return fuse_do_setattr (entry, attr,NULL ); +return fuse_do_setattr (inode, attr,NULL ); } static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
fs/fuse/fuse_i.h +1 -1
@@ -894,7 +894,7 @@ bool fuse_write_update_size(struct inodeint fuse_flush_times (struct inode *inode,struct fuse_file *ff);int fuse_write_inode (struct inode *inode,struct writeback_control *wbc); -int fuse_do_setattr (struct dentry *dentry,struct iattr *attr, +int fuse_do_setattr (struct inode *inode,struct iattr *attr,struct file *file);#endif /* _FS_FUSE_I_H */
fs/gfs2/inode.c +1 -1
@@ -1774,7 +1774,7 @@ static int gfs2_setattr(struct dentry *dif (IS_IMMUTABLE (inode) ||IS_APPEND (inode)) goto out; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error) goto out;
fs/hfs/inode.c +1 -1
@@ -604,7 +604,7 @@ int hfs_inode_setattr(struct dentry *denstruct hfs_sb_info *hsb =HFS_SB (inode->i_sb);int error; - error =setattr_prepare (dentry, attr);/* basic permission checks */ + error =inode_change_ok (inode, attr);/* basic permission checks */ if (error)return error;
fs/hfsplus/inode.c +1 -1
@@ -247,7 +247,7 @@ static int hfsplus_setattr(struct dentrystruct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/hostfs/hostfs_kern.c +1 -1
@@ -792,7 +792,7 @@ static int hostfs_setattr(struct dentryint fd =HOSTFS_I (inode)->fd; - err =setattr_prepare (dentry, attr); + err =inode_change_ok (inode, attr);if (err)return err;
fs/hpfs/inode.c +1 -1
@@ -272,7 +272,7 @@ int hpfs_setattr(struct dentry *dentry,if ((attr->ia_valid &ATTR_SIZE ) && attr->ia_size > inode->i_size) goto out_unlock; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error) goto out_unlock;
fs/hugetlbfs/inode.c +1 -1
@@ -429,7 +429,7 @@ static int hugetlbfs_setattr(struct dentBUG_ON (!inode); - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/jffs2/fs.c +1 -1
@@ -193,7 +193,7 @@ int jffs2_setattr(struct dentry *dentry,struct inode *inode = dentry->d_inode;int rc; - rc =setattr_prepare (dentry, iattr); + rc =inode_change_ok (inode, iattr);if (rc)return rc;
fs/jfs/file.c +1 -1
@@ -103,7 +103,7 @@ int jfs_setattr(struct dentry *dentry, sstruct inode *inode = dentry->d_inode;int rc; - rc =setattr_prepare (dentry, iattr); + rc =inode_change_ok (inode, iattr);if (rc)return rc;
fs/kernfs/inode.c +1 -1
@@ -131,7 +131,7 @@ int kernfs_iop_setattr(struct dentry *dereturn -EINVAL ;mutex_lock (&kernfs_mutex); - error =setattr_prepare (dentry, iattr); + error =inode_change_ok (inode, iattr);if (error) goto out;
fs/libfs.c +1 -1
@@ -371,7 +371,7 @@ int simple_setattr(struct dentry *dentrystruct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, iattr); + error =inode_change_ok (inode, iattr);if (error)return error;
fs/logfs/file.c +1 -1
@@ -244,7 +244,7 @@ static int logfs_setattr(struct dentry *struct inode *inode = dentry->d_inode;int err =0 ; - err =setattr_prepare (dentry, attr); + err =inode_change_ok (inode, attr);if (err)return err;
fs/minix/file.c +1 -1
@@ -28,7 +28,7 @@ static int minix_setattr(struct dentry *struct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/ncpfs/inode.c +1 -1
@@ -885,7 +885,7 @@ int ncp_notify_change(struct dentry *den/* ageing the dentry to force validation */ ncp_age_dentry (server, dentry); - result =setattr_prepare (dentry, attr); + result =inode_change_ok (inode, attr);if (result <0 ) goto out;
fs/nfsd/vfs.c +5 -7
@@ -300,19 +300,17 @@ commit_metadata(struct svc_fh *fhp)* NFS semantics and what Linux expects. */ static void -nfsd_sanitize_attrs (struct dentry *dentry,struct iattr *iap) +nfsd_sanitize_attrs (struct inode *inode,struct iattr *iap) { -struct inode *inode = dentry->d_inode; -/* * NFSv2 does not differentiate between "set-[ac]time-to-now" * which only requires access, and "set-[ac]time-to-X" which * requires ownership. * So if it looks like it might be "set both to the same time which -* is close to now", and if setattr_prepare fails, then we +* is close to now", and if inode_change_ok fails, then we * convert to "set to now" instead of "set to explicit time" * -* We only call setattr_prepare as the last test as technically +* We only call inode_change_ok as the last test as technically * it is not an interface that we should be using. */ #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
@@ -330,7 +328,7 @@ nfsd_sanitize_attrs(struct dentry *dentrif (delta <0 ) delta = -delta;if (delta <MAX_TOUCH_TIME_ERROR && -setattr_prepare (dentry, iap) !=0 ) { +inode_change_ok (inode, iap) !=0 ) {/* * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. * This will cause notify_change to set these times
@@ -437,7 +435,7 @@ nfsd_setattr(struct svc_rqst *rqstp, strif (!iap->ia_valid) goto out; -nfsd_sanitize_attrs (dentry, iap); +nfsd_sanitize_attrs (inode, iap);/* * The size case is special, it changes the file in addition to the
fs/nilfs2/inode.c +1 -1
@@ -839,7 +839,7 @@ int nilfs_setattr(struct dentry *dentry,struct super_block *sb = inode->i_sb;int err; - err =setattr_prepare (dentry, iattr); + err =inode_change_ok (inode, iattr);if (err)return err;
fs/ntfs/inode.c +1 -1
@@ -2891,7 +2891,7 @@ int ntfs_setattr(struct dentry *dentry,int err;unsigned int ia_valid = attr->ia_valid; - err =setattr_prepare (dentry, attr); + err =inode_change_ok (vi, attr);if (err) goto out;/* We do not support NTFS ACLs yet. */
fs/ocfs2/dlmfs/dlmfs.c +1 -1
@@ -211,7 +211,7 @@ static int dlmfs_file_setattr(struct denstruct inode *inode = dentry->d_inode; attr->ia_valid &= ~ATTR_SIZE ; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/ocfs2/file.c +1 -1
@@ -1144,7 +1144,7 @@ int ocfs2_setattr(struct dentry *dentry,if (!(attr->ia_valid &OCFS2_VALID_ATTRS ))return 0 ; - status =setattr_prepare (dentry, attr); + status =inode_change_ok (inode, attr);if (status)return status;
fs/omfs/file.c +1 -1
@@ -351,7 +351,7 @@ static int omfs_setattr(struct dentry *dstruct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/proc/base.c +1 -1
@@ -536,7 +536,7 @@ int proc_setattr(struct dentry *dentry,if (attr->ia_valid &ATTR_MODE )return -EPERM ; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/proc/generic.c +1 -1
@@ -41,7 +41,7 @@ static int proc_notify_change(struct denstruct proc_dir_entry *de =PDE (inode);int error; - error =setattr_prepare (dentry, iattr); + error =inode_change_ok (inode, iattr);if (error)return error;
fs/proc/proc_sysctl.c +1 -1
@@ -753,7 +753,7 @@ static int proc_sys_setattr(struct dentrif (attr->ia_valid & (ATTR_MODE |ATTR_UID |ATTR_GID ))return -EPERM ; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/ramfs/file-nommu.c +1 -1
@@ -163,7 +163,7 @@ static int ramfs_nommu_setattr(struct deint ret =0 ;/* POSIX UID/GID verification for setting inode attributes */ - ret =setattr_prepare (dentry, ia); + ret =inode_change_ok (inode, ia);if (ret)return ret;
fs/reiserfs/inode.c +1 -1
@@ -3312,7 +3312,7 @@ int reiserfs_setattr(struct dentry *dentunsigned int ia_valid;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/sysv/file.c +1 -1
@@ -35,7 +35,7 @@ static int sysv_setattr(struct dentry *dstruct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/ubifs/file.c +1 -1
@@ -1262,7 +1262,7 @@ int ubifs_setattr(struct dentry *dentry,dbg_gen ("ino %lu, mode %#x, ia_valid %#x" , inode->i_ino, inode->i_mode, attr->ia_valid); - err =setattr_prepare (dentry, attr); + err =inode_change_ok (inode, attr);if (err)return err;
fs/udf/file.c +1 -1
@@ -269,7 +269,7 @@ static int udf_setattr(struct dentry *destruct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/ufs/truncate.c +1 -1
@@ -496,7 +496,7 @@ int ufs_setattr(struct dentry *dentry, sunsigned int ia_valid = attr->ia_valid;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
fs/utimes.c +2 -2
@@ -81,7 +81,7 @@ static int utimes_common(struct path *pa newattrs.ia_valid |=ATTR_MTIME_SET ; }/* -* Tell setattr_prepare(), that this is an explicit time +* Tell inode_change_ok(), that this is an explicit time * update, even if neither ATTR_ATIME_SET nor ATTR_MTIME_SET * were used. */
@@ -90,7 +90,7 @@ static int utimes_common(struct path *pa/* * If times is NULL (or both times are UTIME_NOW), * then we need to check permissions, because -* setattr_prepare() won't do it. +* inode_change_ok() won't do it. */ error = -EACCES ;if (IS_IMMUTABLE (inode))
fs/xfs/xfs_acl.c +1 -2
@@ -244,8 +244,7 @@ xfs_set_mode(struct inode *inode, umode_ iattr.ia_mode = mode; iattr.ia_ctime =current_fs_time (inode->i_sb); - error = -xfs_setattr_nonsize (NULL ,XFS_I (inode), &iattr, -XFS_ATTR_NOACL ); + error = -xfs_setattr_nonsize (XFS_I (inode), &iattr,XFS_ATTR_NOACL ); }return error;
fs/xfs/xfs_file.c +1 -1
@@ -862,7 +862,7 @@ xfs_file_fallocate( iattr.ia_valid =ATTR_SIZE ; iattr.ia_size = new_size; - error =xfs_setattr_size (file->f_dentry, &iattr); + error =xfs_setattr_size (ip, &iattr); } out_unlock:
fs/xfs/xfs_ioctl.c +1 -1
@@ -717,7 +717,7 @@ xfs_ioc_space( iattr.ia_valid =ATTR_SIZE ; iattr.ia_size = bf->l_start; - error =xfs_setattr_size (filp->f_dentry, &iattr); + error =xfs_setattr_size (ip, &iattr);if (!error) clrprealloc = true;break ;
fs/xfs/xfs_iops.c +7 -9
@@ -527,7 +527,6 @@ xfs_setattr_time(int xfs_setattr_nonsize ( -struct dentry *dentry,struct xfs_inode *ip,struct iattr *iattr,int flags)
@@ -552,7 +551,7 @@ xfs_setattr_nonsize(if (XFS_FORCED_SHUTDOWN (mp))return XFS_ERROR (EIO ); - error = -setattr_prepare (dentry, iattr); + error = -inode_change_ok (inode, iattr);if (error)return XFS_ERROR (error); }
@@ -735,12 +734,11 @@ out_dqrele:*/ int xfs_setattr_size ( -struct dentry *dentry, +struct xfs_inode *ip,struct iattr *iattr) { -struct inode *inode = dentry->d_inode; -struct xfs_inode *ip =XFS_I (inode);struct xfs_mount *mp = ip->i_mount; +struct inode *inode =VFS_I (ip);xfs_off_t oldsize, newsize;struct xfs_trans *tp;int error;
@@ -756,7 +754,7 @@ xfs_setattr_size(if (XFS_FORCED_SHUTDOWN (mp))return XFS_ERROR (EIO ); - error = -setattr_prepare (dentry, iattr); + error = -inode_change_ok (inode, iattr);if (error)return XFS_ERROR (error);
@@ -780,7 +778,7 @@ xfs_setattr_size(* Use the regular setattr path to update the timestamps. */ iattr->ia_valid &= ~ATTR_SIZE ; -return xfs_setattr_nonsize (dentry, ip, iattr,0 ); +return xfs_setattr_nonsize (ip, iattr,0 ); }/*
@@ -941,10 +939,10 @@ xfs_vn_setattr(if (iattr->ia_valid &ATTR_SIZE ) {xfs_ilock (ip,XFS_IOLOCK_EXCL |XFS_MMAPLOCK_EXCL ); - error =xfs_setattr_size (dentry, iattr); + error =xfs_setattr_size (ip, iattr);xfs_iunlock (ip,XFS_IOLOCK_EXCL |XFS_MMAPLOCK_EXCL ); }else { - error =xfs_setattr_nonsize (dentry, ip, iattr,0 ); + error =xfs_setattr_nonsize (ip, iattr,0 ); }return -error;
fs/xfs/xfs_iops.h +3 -3
@@ -32,8 +32,8 @@ extern void xfs_setup_inode(struct xfs_i*/ #define XFS_ATTR_NOACL 0x01/* Don't call posix_acl_chmod */ -extern int xfs_setattr_nonsize (struct dentry *dentry,struct xfs_inode *ip, -struct iattr *vap,int flags); -extern int xfs_setattr_size (struct dentry *dentry,struct iattr *vap); +extern int xfs_setattr_nonsize (struct xfs_inode *ip,struct iattr *vap, +int flags); +extern int xfs_setattr_size (struct xfs_inode *ip,struct iattr *vap);#endif /* __XFS_IOPS_H__ */
include/linux/fs.h +1 -1
@@ -2627,7 +2627,7 @@ extern int buffer_migrate_page(struct ad#define buffer_migrate_page NULL#endif -extern int setattr_prepare (struct dentry *,struct iattr *); +extern int inode_change_ok (const struct inode *,struct iattr *);extern int inode_newsize_ok (const struct inode *,loff_t offset);extern void setattr_copy (struct inode *inode,const struct iattr *attr);
mm/shmem.c +1 -1
@@ -540,7 +540,7 @@ static int shmem_setattr(struct dentry *struct inode *inode = dentry->d_inode;int error; - error =setattr_prepare (dentry, attr); + error =inode_change_ok (inode, attr);if (error)return error;
PATCH 2/306 xfs: Propagate dentry down to inode_change_ok()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 69bca80744eef58fa155e8042996b968fec17b26 upstream.
To avoid clearing of capabilities or security related extended attributes too early, inode_change_ok() will need to take dentry instead of inode. Propagate dentry down to functions calling inode_change_ok(). This is rather straightforward except for xfs_set_mode() function which does not have dentry easily available. Luckily that function does not call inode_change_ok() anyway so we just have to do a little dance with function prototypes.
[bwh: Backported to 3.16:
- Keep XFS_ERROR() calls
- Adjust context, indentation]
--- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_ioctl.c | 2 +- fs/xfs/xfs_iops.c | 94 ++++++++++++++++++++++++++++++++++++------------------ fs/xfs/xfs_iops.h | 3 +- 5 files changed, 68 insertions(+), 35 deletions(-)
fs/xfs/xfs_file.c +1 -1
@@ -862,7 +862,7 @@ xfs_file_fallocate( iattr.ia_valid =ATTR_SIZE ; iattr.ia_size = new_size; - error =xfs_setattr_size (ip, &iattr); + error =xfs_vn_setattr_size (file->f_dentry, &iattr); } out_unlock:
fs/xfs/xfs_inode.c +1 -1
@@ -1776,7 +1776,7 @@ xfs_inactive_truncate(/* * Log the inode size first to prevent stale data exposure in the event * of a system crash before the truncate completes. See the related -* comment in xfs_setattr_size() for details. +* comment in xfs_vn_setattr_size() for details. */ ip->i_d.di_size =0 ;xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE );
fs/xfs/xfs_ioctl.c +1 -1
@@ -717,7 +717,7 @@ xfs_ioc_space( iattr.ia_valid =ATTR_SIZE ; iattr.ia_size = bf->l_start; - error =xfs_setattr_size (ip, &iattr); + error =xfs_vn_setattr_size (filp->f_dentry, &iattr);if (!error) clrprealloc = true;break ;
fs/xfs/xfs_iops.c +61 -29
130 lines not on this page · raw message
fs/xfs/xfs_iops.h +2 -1
@@ -34,6 +34,7 @@ extern void xfs_setup_inode(struct xfs_iextern int xfs_setattr_nonsize (struct xfs_inode *ip,struct iattr *vap,int flags); -extern int xfs_setattr_size (struct xfs_inode *ip,struct iattr *vap); +extern int xfs_vn_setattr_nonsize (struct dentry *dentry,struct iattr *vap); +extern int xfs_vn_setattr_size (struct dentry *dentry,struct iattr *vap);#endif /* __XFS_IOPS_H__ */
PATCH 3/306 fuse: Propagate dentry down to inode_change_ok()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 62490330769c1ce5dcba3f1f3e8f4005e9b797e6 upstream.
To avoid clearing of capabilities or security related extended attributes too early, inode_change_ok() will need to take dentry instead of inode. Propagate it down to fuse_do_setattr().
--- fs/fuse/dir.c | 7 ++++--- fs/fuse/file.c | 2 +- fs/fuse/fuse_i.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
fs/fuse/dir.c +4 -3
@@ -1704,9 +1704,10 @@ int fuse_flush_times(struct inode *inode* vmtruncate() doesn't allow for this case, so do the rlimit checking * and the actual truncation by hand. */ -int fuse_do_setattr (struct inode *inode,struct iattr *attr, +int fuse_do_setattr (struct dentry *dentry,struct iattr *attr,struct file *file) { +struct inode *inode =d_inode (dentry);struct fuse_conn *fc =get_fuse_conn (inode);struct fuse_inode *fi =get_fuse_inode (inode);struct fuse_req *req;
@@ -1826,9 +1827,9 @@ static int fuse_setattr(struct dentry *ereturn -EACCES ;if (attr->ia_valid &ATTR_FILE ) -return fuse_do_setattr (inode, attr, attr->ia_file); +return fuse_do_setattr (entry, attr, attr->ia_file);else -return fuse_do_setattr (inode, attr,NULL ); +return fuse_do_setattr (entry, attr,NULL ); } static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
fs/fuse/file.c +1 -1
@@ -2879,7 +2879,7 @@ static void fuse_do_truncate(struct file attr.ia_file = file; attr.ia_valid |=ATTR_FILE ; -fuse_do_setattr (inode, &attr, file); +fuse_do_setattr (file->f_dentry, &attr, file); }static inline loff_t fuse_round_up (loff_t off)
fs/fuse/fuse_i.h +1 -1
@@ -894,7 +894,7 @@ bool fuse_write_update_size(struct inodeint fuse_flush_times (struct inode *inode,struct fuse_file *ff);int fuse_write_inode (struct inode *inode,struct writeback_control *wbc); -int fuse_do_setattr (struct inode *inode,struct iattr *attr, +int fuse_do_setattr (struct dentry *dentry,struct iattr *attr,struct file *file);#endif /* _FS_FUSE_I_H */
PATCH 4/306 fs: Give dentry to inode_change_ok() instead of inode
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 31051c85b5e2aaaf6315f74c72a732673632a905 upstream.
inode_change_ok() will be resposible for clearing capabilities and IMA extended attributes and as such will need dentry. Give it as an argument to inode_change_ok() instead of an inode. Also rename inode_change_ok() to setattr_prepare() to better relect that it does also some modifications in addition to checks.
[bwh: Backported to 3.16:
- Drop changes to orangefs, overlayfs
- Adjust filenames, context
- In nfsd, pass dentry to nfsd_sanitize_attrs()
- Update ext3 as well]
---
Documentation/filesystems/porting +2 -2
@@ -287,8 +287,8 @@ implementing on-disk size changes. Star and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to be in order of zeroing blocks using block_truncate_page or similar helpers, size update and on finally on-disk truncation which should not fail. -inode_change_ok now includes the size checks for ATTR_SIZE and must be called -in the beginning of ->setattr unconditionally. +setattr_prepare (which used to be inode_change_ok) now includes the size checks +for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally. [mandatory]
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -1386,7 +1386,7 @@ int ll_setattr_raw(struct dentry *dentry attr->ia_valid |=ATTR_MTIME |ATTR_CTIME ; } -/* POSIX: check before ATTR_*TIME_SET set (from inode_change_ok) */ +/* POSIX: check before ATTR_*TIME_SET set (from setattr_prepare) */ if (attr->ia_valid &TIMES_SET_FLAGS ) {if ((!uid_eq (current_fsuid (), inode->i_uid)) && !capable (CFS_CAP_FOWNER ))
fs/9p/vfs_inode.c +1 -1
@@ -1094,7 +1094,7 @@ static int v9fs_vfs_setattr(struct dentrstruct p9_wstat wstat;p9_debug (P9_DEBUG_VFS ,"\n" ); - retval =inode_change_ok (dentry->d_inode, iattr); + retval =setattr_prepare (dentry, iattr);if (retval)return retval;
fs/9p/vfs_inode_dotl.c +1 -1
@@ -560,7 +560,7 @@ int v9fs_vfs_setattr_dotl(struct dentryp9_debug (P9_DEBUG_VFS ,"\n" ); - retval =inode_change_ok (inode, iattr); + retval =setattr_prepare (dentry, iattr);if (retval)return retval;
fs/adfs/inode.c +1 -1
@@ -303,7 +303,7 @@ adfs_notify_change(struct dentry *dentryunsigned int ia_valid = attr->ia_valid;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);/* * we can't change the UID or GID of any file -
fs/affs/inode.c +1 -1
@@ -222,7 +222,7 @@ affs_notify_change(struct dentry *dentrypr_debug ("notify_change(%lu,0x%x)\n" , inode->i_ino, attr->ia_valid); - error =inode_change_ok (inode,attr); + error =setattr_prepare (dentry, attr);if (error) goto out;
fs/attr.c +9 -6
@@ -17,19 +17,22 @@#include <linux/ima.h> /** -* inode_change_ok - check if attribute changes to an inode are allowed -* @inode: inode to check +* setattr_prepare - check if attribute changes to a dentry are allowed +* @dentry: dentry to check * @attr: attributes to change * * Check if we are allowed to change the attributes contained in @attr -* in the given inode. This includes the normal unix access permission -* checks, as well as checks for rlimits and others. +* in the given dentry. This includes the normal unix access permission +* checks, as well as checks for rlimits and others. The function also clears +* SGID bit from mode if user is not allowed to set it. Also file capabilities +* and IMA extended attributes are cleared if ATTR_KILL_PRIV is set. * * Should be called as the first thing in ->setattr implementations, * possibly after taking additional locks. */ -int inode_change_ok (const struct inode *inode,struct iattr *attr) +int setattr_prepare (struct dentry *dentry,struct iattr *attr) { +struct inode *inode =d_inode (dentry);unsigned int ia_valid = attr->ia_valid;/*
@@ -89,7 +92,7 @@ kill_priv:return 0 ; } -EXPORT_SYMBOL (inode_change_ok); +EXPORT_SYMBOL (setattr_prepare);/** * inode_newsize_ok - may this inode be truncated to a given size
fs/btrfs/inode.c +1 -1
@@ -4690,7 +4690,7 @@ static int btrfs_setattr(struct dentry *if (btrfs_root_readonly (root))return -EROFS ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/ceph/inode.c +1 -1
@@ -1708,7 +1708,7 @@ int ceph_setattr(struct dentry *dentry,if (ceph_snap (inode) !=CEPH_NOSNAP )return -EROFS ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err !=0 )return err;
fs/cifs/inode.c +2 -2
@@ -2074,7 +2074,7 @@ cifs_setattr_unix(struct dentry *direntrif (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_PERM ) attrs->ia_valid |=ATTR_FORCE ; - rc =inode_change_ok (inode, attrs); + rc =setattr_prepare (direntry, attrs);if (rc <0 ) goto out;
@@ -2215,7 +2215,7 @@ cifs_setattr_nounix(struct dentry *direnif (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_NO_PERM ) attrs->ia_valid |=ATTR_FORCE ; - rc =inode_change_ok (inode, attrs); + rc =setattr_prepare (direntry, attrs);if (rc <0 ) {free_xid (xid);return rc;
fs/ecryptfs/inode.c +1 -1
@@ -952,7 +952,7 @@ static int ecryptfs_setattr(struct dentr }mutex_unlock (&crypt_stat->cs_mutex); - rc =inode_change_ok (inode, ia); + rc =setattr_prepare (dentry, ia);if (rc) goto out;if (ia->ia_valid &ATTR_SIZE ) {
fs/exofs/inode.c +1 -1
@@ -1039,7 +1039,7 @@ int exofs_setattr(struct dentry *dentry,if (unlikely (error))return error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (unlikely (error))return error;
fs/ext2/inode.c +1 -1
@@ -1547,7 +1547,7 @@ int ext2_setattr(struct dentry *dentry,struct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error)return error;
fs/ext3/inode.c +1 -1
@@ -3244,7 +3244,7 @@ int ext3_setattr(struct dentry *dentry,int error, rc =0 ;const unsigned int ia_valid = attr->ia_valid; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ext4/inode.c +1 -1
@@ -4672,7 +4672,7 @@ int ext4_setattr(struct dentry *dentry,int orphan =0 ;const unsigned int ia_valid = attr->ia_valid; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/f2fs/file.c +1 -1
@@ -500,7 +500,7 @@ int f2fs_setattr(struct dentry *dentry,struct f2fs_inode_info *fi =F2FS_I (inode);int err; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/fat/file.c +1 -1
@@ -394,7 +394,7 @@ int fat_setattr(struct dentry *dentry, s attr->ia_valid &= ~TIMES_SET_FLAGS ; } - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr); attr->ia_valid = ia_valid;if (error) {if (sbi->options.quiet)
fs/fuse/dir.c +1 -1
@@ -1722,7 +1722,7 @@ int fuse_do_setattr(struct dentry *dentrif (!(fc->flags &FUSE_DEFAULT_PERMISSIONS )) attr->ia_valid |=ATTR_FORCE ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/gfs2/inode.c +1 -1
@@ -1774,7 +1774,7 @@ static int gfs2_setattr(struct dentry *dif (IS_IMMUTABLE (inode) ||IS_APPEND (inode)) goto out; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error) goto out;
fs/hfs/inode.c +1 -1
@@ -604,7 +604,7 @@ int hfs_inode_setattr(struct dentry *denstruct hfs_sb_info *hsb =HFS_SB (inode->i_sb);int error; - error =inode_change_ok (inode, attr);/* basic permission checks */ + error =setattr_prepare (dentry, attr);/* basic permission checks */ if (error)return error;
fs/hfsplus/inode.c +1 -1
@@ -247,7 +247,7 @@ static int hfsplus_setattr(struct dentrystruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/hostfs/hostfs_kern.c +1 -1
@@ -792,7 +792,7 @@ static int hostfs_setattr(struct dentryint fd =HOSTFS_I (inode)->fd; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/hpfs/inode.c +1 -1
@@ -272,7 +272,7 @@ int hpfs_setattr(struct dentry *dentry,if ((attr->ia_valid &ATTR_SIZE ) && attr->ia_size > inode->i_size) goto out_unlock; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error) goto out_unlock;
fs/hugetlbfs/inode.c +1 -1
@@ -429,7 +429,7 @@ static int hugetlbfs_setattr(struct dentBUG_ON (!inode); - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/jffs2/fs.c +1 -1
@@ -193,7 +193,7 @@ int jffs2_setattr(struct dentry *dentry,struct inode *inode = dentry->d_inode;int rc; - rc =inode_change_ok (inode, iattr); + rc =setattr_prepare (dentry, iattr);if (rc)return rc;
fs/jfs/file.c +1 -1
@@ -103,7 +103,7 @@ int jfs_setattr(struct dentry *dentry, sstruct inode *inode = dentry->d_inode;int rc; - rc =inode_change_ok (inode, iattr); + rc =setattr_prepare (dentry, iattr);if (rc)return rc;
fs/kernfs/inode.c +1 -1
@@ -131,7 +131,7 @@ int kernfs_iop_setattr(struct dentry *dereturn -EINVAL ;mutex_lock (&kernfs_mutex); - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error) goto out;
fs/libfs.c +1 -1
@@ -371,7 +371,7 @@ int simple_setattr(struct dentry *dentrystruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error)return error;
fs/logfs/file.c +1 -1
@@ -244,7 +244,7 @@ static int logfs_setattr(struct dentry *struct inode *inode = dentry->d_inode;int err =0 ; - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/minix/file.c +1 -1
@@ -28,7 +28,7 @@ static int minix_setattr(struct dentry *struct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ncpfs/inode.c +1 -1
@@ -885,7 +885,7 @@ int ncp_notify_change(struct dentry *den/* ageing the dentry to force validation */ ncp_age_dentry (server, dentry); - result =inode_change_ok (inode, attr); + result =setattr_prepare (dentry, attr);if (result <0 ) goto out;
fs/nfsd/vfs.c +7 -5
@@ -300,17 +300,19 @@ commit_metadata(struct svc_fh *fhp)* NFS semantics and what Linux expects. */ static void -nfsd_sanitize_attrs (struct inode *inode,struct iattr *iap) +nfsd_sanitize_attrs (struct dentry *dentry,struct iattr *iap) { +struct inode *inode = dentry->d_inode; +/* * NFSv2 does not differentiate between "set-[ac]time-to-now" * which only requires access, and "set-[ac]time-to-X" which * requires ownership. * So if it looks like it might be "set both to the same time which -* is close to now", and if inode_change_ok fails, then we +* is close to now", and if setattr_prepare fails, then we * convert to "set to now" instead of "set to explicit time" * -* We only call inode_change_ok as the last test as technically +* We only call setattr_prepare as the last test as technically * it is not an interface that we should be using. */ #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
@@ -328,7 +330,7 @@ nfsd_sanitize_attrs(struct inode *inode,if (delta <0 ) delta = -delta;if (delta <MAX_TOUCH_TIME_ERROR && -inode_change_ok (inode, iap) !=0 ) { +setattr_prepare (dentry, iap) !=0 ) {/* * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME. * This will cause notify_change to set these times
@@ -435,7 +437,7 @@ nfsd_setattr(struct svc_rqst *rqstp, strif (!iap->ia_valid) goto out; -nfsd_sanitize_attrs (inode, iap); +nfsd_sanitize_attrs (dentry, iap);/* * The size case is special, it changes the file in addition to the
fs/nilfs2/inode.c +1 -1
@@ -839,7 +839,7 @@ int nilfs_setattr(struct dentry *dentry,struct super_block *sb = inode->i_sb;int err; - err =inode_change_ok (inode, iattr); + err =setattr_prepare (dentry, iattr);if (err)return err;
fs/ntfs/inode.c +1 -1
@@ -2891,7 +2891,7 @@ int ntfs_setattr(struct dentry *dentry,int err;unsigned int ia_valid = attr->ia_valid; - err =inode_change_ok (vi, attr); + err =setattr_prepare (dentry, attr);if (err) goto out;/* We do not support NTFS ACLs yet. */
fs/ocfs2/dlmfs/dlmfs.c +1 -1
@@ -211,7 +211,7 @@ static int dlmfs_file_setattr(struct denstruct inode *inode = dentry->d_inode; attr->ia_valid &= ~ATTR_SIZE ; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ocfs2/file.c +1 -1
@@ -1144,7 +1144,7 @@ int ocfs2_setattr(struct dentry *dentry,if (!(attr->ia_valid &OCFS2_VALID_ATTRS ))return 0 ; - status =inode_change_ok (inode, attr); + status =setattr_prepare (dentry, attr);if (status)return status;
fs/omfs/file.c +1 -1
@@ -351,7 +351,7 @@ static int omfs_setattr(struct dentry *dstruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/proc/base.c +1 -1
@@ -536,7 +536,7 @@ int proc_setattr(struct dentry *dentry,if (attr->ia_valid &ATTR_MODE )return -EPERM ; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/proc/generic.c +1 -1
@@ -41,7 +41,7 @@ static int proc_notify_change(struct denstruct proc_dir_entry *de =PDE (inode);int error; - error =inode_change_ok (inode, iattr); + error =setattr_prepare (dentry, iattr);if (error)return error;
fs/proc/proc_sysctl.c +1 -1
@@ -753,7 +753,7 @@ static int proc_sys_setattr(struct dentrif (attr->ia_valid & (ATTR_MODE |ATTR_UID |ATTR_GID ))return -EPERM ; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ramfs/file-nommu.c +1 -1
@@ -163,7 +163,7 @@ static int ramfs_nommu_setattr(struct deint ret =0 ;/* POSIX UID/GID verification for setting inode attributes */ - ret =inode_change_ok (inode, ia); + ret =setattr_prepare (dentry, ia);if (ret)return ret;
fs/reiserfs/inode.c +1 -1
@@ -3312,7 +3312,7 @@ int reiserfs_setattr(struct dentry *dentunsigned int ia_valid;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/sysv/file.c +1 -1
@@ -35,7 +35,7 @@ static int sysv_setattr(struct dentry *dstruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ubifs/file.c +1 -1
@@ -1262,7 +1262,7 @@ int ubifs_setattr(struct dentry *dentry,dbg_gen ("ino %lu, mode %#x, ia_valid %#x" , inode->i_ino, inode->i_mode, attr->ia_valid); - err =inode_change_ok (inode, attr); + err =setattr_prepare (dentry, attr);if (err)return err;
fs/udf/file.c +1 -1
@@ -269,7 +269,7 @@ static int udf_setattr(struct dentry *destruct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/ufs/truncate.c +1 -1
@@ -496,7 +496,7 @@ int ufs_setattr(struct dentry *dentry, sunsigned int ia_valid = attr->ia_valid;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
fs/utimes.c +2 -2
@@ -81,7 +81,7 @@ static int utimes_common(struct path *pa newattrs.ia_valid |=ATTR_MTIME_SET ; }/* -* Tell inode_change_ok(), that this is an explicit time +* Tell setattr_prepare(), that this is an explicit time * update, even if neither ATTR_ATIME_SET nor ATTR_MTIME_SET * were used. */
@@ -90,7 +90,7 @@ static int utimes_common(struct path *pa/* * If times is NULL (or both times are UTIME_NOW), * then we need to check permissions, because -* inode_change_ok() won't do it. +* setattr_prepare() won't do it. */ error = -EACCES ;if (IS_IMMUTABLE (inode))
fs/xfs/xfs_iops.c +4 -6
@@ -530,9 +530,7 @@ xfs_vn_change_ok(struct dentry *dentry, struct iattr *iattr) { - struct inode *inode = d_inode(dentry); -struct xfs_inode *ip =XFS_I (inode); -struct xfs_mount *mp = ip->i_mount; + struct xfs_mount *mp = XFS_I(d_inode(dentry))->i_mount;if (mp->m_flags &XFS_MOUNT_RDONLY )return XFS_ERROR (EROFS );
@@ -540,14 +538,14 @@ xfs_vn_change_ok(if (XFS_FORCED_SHUTDOWN (mp))return XFS_ERROR (EIO ); -return XFS_ERROR (-inode_change_ok (inode, iattr)); +return XFS_ERROR (-setattr_prepare (dentry, iattr)); }/* * Set non-size attributes of an inode. * * Caution: The caller of this function is responsible for calling -* inode_change_ok() or otherwise verifying the change is fine. +* setattr_prepare() or otherwise verifying the change is fine. */ int xfs_setattr_nonsize(
@@ -758,7 +756,7 @@ xfs_vn_setattr_nonsize(* Truncate file. Must have write permission and not be a directory. * * Caution: The caller of this function is responsible for calling -* inode_change_ok() or otherwise verifying the change is fine. +* setattr_prepare() or otherwise verifying the change is fine. */ int xfs_setattr_size(
include/linux/fs.h +1 -1
@@ -2627,7 +2627,7 @@ extern int buffer_migrate_page(struct ad#define buffer_migrate_page NULL#endif -extern int inode_change_ok (const struct inode *,struct iattr *); +extern int setattr_prepare (struct dentry *,struct iattr *);extern int inode_newsize_ok (const struct inode *,loff_t offset);extern void setattr_copy (struct inode *inode,const struct iattr *attr);
mm/shmem.c +1 -1
@@ -540,7 +540,7 @@ static int shmem_setattr(struct dentry *struct inode *inode = dentry->d_inode;int error; - error =inode_change_ok (inode, attr); + error =setattr_prepare (dentry, attr);if (error)return error;
PATCH 5/306 drm/i915/vlv: Make intel_crt_reset() per-encoder
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lyude <[email protected]>
commit 28cf71ce3e206db1c3f30b3da31e7b48b2269e4c upstream.
This lets call intel_crt_reset() in contexts where IRQs are disabled and as such, can't hold the locks required to work with the connectors.
--- drivers/gpu/drm/i915/intel_crt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +5 -5
@@ -742,11 +742,11 @@ static int intel_crt_set_property(structreturn 0 ; } -static void intel_crt_reset (struct drm_connector *connector) +static void intel_crt_reset (struct drm_encoder *encoder) { -struct drm_device *dev = connector->dev; +struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crt *crt =intel_attached_crt (connector); +struct intel_crt *crt =intel_encoder_to_crt (to_intel_encoder (encoder));if (INTEL_INFO (dev)->gen >=5 ) {u32 adpa;
@@ -768,7 +768,6 @@ static void intel_crt_reset(struct drm_c*/ static const struct drm_connector_funcs intel_crt_connector_funcs = { - .reset = intel_crt_reset, .dpms = intel_crt_dpms, .detect = intel_crt_detect, .fill_modes = drm_helper_probe_single_connector_modes,
@@ -783,6 +782,7 @@ static const struct drm_connector_helper };static const struct drm_encoder_funcs intel_crt_enc_funcs = { + .reset = intel_crt_reset, .destroy = intel_encoder_destroy, };
@@ -902,5 +902,5 @@ void intel_crt_init(struct drm_device *d dev_priv->fdi_rx_config =I915_READ (_FDI_RXA_CTL) & fdi_config; } -intel_crt_reset (connector); +intel_crt_reset (&crt->base.base); }
PATCH 6/306 drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lyude <[email protected]>
commit 9504a89247595b6c066c68aea0c34af1fc78d021 upstream.
While VGA hotplugging worked(ish) before, it looks like that was mainly because we'd unintentionally enable it in valleyview_crt_detect_hotplug() when we did a force trigger. This doesn't work reliably enough because whenever the display powerwell on vlv gets disabled, the values set in VLV_ADPA get cleared and consequently VGA hotplugging gets disabled. This causes bugs such as one we found on an Intel NUC, where doing the following sequence of hotplugs:
- Disconnect all monitors
- Connect VGA
- Disconnect VGA
- Connect HDMI
Would result in VGA hotplugging becoming disabled, due to the powerwells getting toggled in the process of connecting HDMI.
Changes since v3:
- Expose intel_crt_reset() through intel_drv.h and call that in vlv_display_power_well_init() instead of encoder->base.funcs->reset(&encoder->base);
Changes since v2:
- Use intel_encoder structs instead of drm_encoder structs
Changes since v1:
- Instead of handling the register writes ourself, we just reuse intel_crt_detect()
- Instead of resetting the ADPA during display IRQ installation, we now reset them in vlv_display_power_well_init()
[bwh: Backported to 3.16:
- Adjust filename, context
- Open-code for_each_intel_encoder()]
---
drivers/gpu/drm/i915/intel_crt.c +1 -1
@@ -742,7 +742,7 @@ static int intel_crt_set_property(structreturn 0 ; } -static void intel_crt_reset (struct drm_encoder *encoder) +void intel_crt_reset (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -690,7 +690,7 @@ void i9xx_check_fifo_underruns(struct dr/* intel_crt.c */ void intel_crt_init (struct drm_device *dev); - +void intel_crt_reset (struct drm_encoder *encoder);/* intel_ddi.c */ void intel_prepare_ddi (struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +9 -0
@@ -5897,6 +5897,8 @@ static bool vlv_power_well_enabled(strucstatic void vlv_display_power_well_enable (struct drm_i915_private *dev_priv,struct i915_power_well *power_well) { +struct intel_encoder *encoder; +WARN_ON_ONCE (power_well->data !=PUNIT_POWER_WELL_DISP2D );vlv_set_power_well (dev_priv, power_well, true);
@@ -5914,6 +5916,13 @@ static void vlv_display_power_well_enablintel_hpd_init (dev_priv->dev); +/* Re-enable the ADPA, if we have one */ +list_for_each_entry (encoder, &dev_priv->dev->mode_config.encoder_list, + base.head) { +if (encoder->type ==INTEL_OUTPUT_ANALOG ) +intel_crt_reset (&encoder->base); + } +i915_redisable_vga_power_on (dev_priv->dev); }
PATCH 7/306 fbdev/efifb: Fix 16 color palette entry calculation
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Max Staudt <[email protected]>
commit d50b3f43db739f03fcf8c0a00664b3d2fed0496e upstream.
When using efifb with a 16-bit (5:6:5) visual, fbcon's text is rendered in the wrong colors - e.g. text gray (#aaaaaa) is rendered as green (#50bc50) and neighboring pixels have slightly different values (such as #50bc78).
The reason is that fbcon loads its 16 color palette through efifb_setcolreg(), which in turn calculates a 32-bit value to write into memory for each palette index.
Until now, this code could only handle 8-bit visuals and didn't mask overlapping values when ORing them.
With this patch, fbcon displays the correct colors when a qemu VM is booted in 16-bit mode (in GRUB: "set gfxpayload=800x600x16").
--- drivers/video/fbdev/efifb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/fbdev/efifb.c +3 -3
@@ -52,9 +52,9 @@ static int efifb_setcolreg(unsigned regnreturn 1 ;if (regno <16 ) { - red >>=8 ; - green >>=8 ; - blue >>=8 ; + red >>=16 - info->var.red.length; + green >>=16 - info->var.green.length; + blue >>=16 - info->var.blue.length; ((u32 *)(info->pseudo_palette))[regno] = (red << info->var.red.offset) | (green << info->var.green.offset) |
PATCH 8/306 zfcp: fix fc_host port_type with NPIV
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit bd77befa5bcff8c51613de271913639edf85fbc2 upstream.
For an NPIV-enabled FCP device, zfcp can erroneously show "NPort (fabric via point-to-point)" instead of "NPIV VPORT" for the port_type sysfs attribute of the corresponding fc_host.
s390-tools that can be affected are dbginfo.sh and ziomon.
zfcp_fsf_exchange_config_evaluate() ignores fsf_qtcb_bottom_config.connection_features indicating NPIV and only sets fc_host_port_type to FC_PORTTYPE_NPORT if fsf_qtcb_bottom_config.fc_topology is FSF_TOPO_FABRIC.
Only the independent zfcp_fsf_exchange_port_evaluate() evaluates connection_features to overwrite fc_host_port_type to FC_PORTTYPE_NPIV in case of NPIV.
Code was introduced with upstream kernel 2.6.30 commit 0282985da5923fa6365adcc1a1586ae0c13c1617 ("[SCSI] zfcp: Report fc_host_port_type as NPIV").
This works during FCP device recovery (such as set online) because it performs FSF_QTCB_EXCHANGE_CONFIG_DATA followed by FSF_QTCB_EXCHANGE_PORT_DATA in sequence.
However, the zfcp-specific scsi host sysfs attributes "requests", "megabytes", or "seconds_active" trigger only zfcp_fsf_exchange_config_evaluate() resetting fc_host port_type to FC_PORTTYPE_NPORT despite NPIV.
The zfcp-specific scsi host sysfs attribute "utilization" triggers only zfcp_fsf_exchange_port_evaluate() correcting the fc_host port_type again in case of NPIV.
Evaluate fsf_qtcb_bottom_config.connection_features in zfcp_fsf_exchange_config_evaluate() where it belongs to.
--- drivers/s390/scsi/zfcp_fsf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/s390/scsi/zfcp_fsf.c +5 -3
@@ -3,7 +3,7 @@* * Implementation of FSF commands. * -* Copyright IBM Corp. 2002, 2013 +* Copyright IBM Corp. 2002, 2015 */ #define KMSG_COMPONENT "zfcp"
@@ -508,7 +508,10 @@ static int zfcp_fsf_exchange_config_evalfc_host_port_type (shost) =FC_PORTTYPE_PTP ;break ;case FSF_TOPO_FABRIC : -fc_host_port_type (shost) =FC_PORTTYPE_NPORT ; +if (bottom->connection_features &FSF_FEATURE_NPIV_MODE ) +fc_host_port_type (shost) =FC_PORTTYPE_NPIV ; +else +fc_host_port_type (shost) =FC_PORTTYPE_NPORT ;break ;case FSF_TOPO_AL :fc_host_port_type (shost) =FC_PORTTYPE_NLPORT ;
@@ -613,7 +616,6 @@ static void zfcp_fsf_exchange_port_evaluif (adapter->connection_features &FSF_FEATURE_NPIV_MODE ) {fc_host_permanent_port_name (shost) = bottom->wwpn; -fc_host_port_type (shost) =FC_PORTTYPE_NPIV ; }else fc_host_permanent_port_name (shost) =fc_host_port_name (shost);fc_host_maxframe_size (shost) = bottom->maximum_frame_size;
PATCH 9/306 zfcp: fix ELS/GS request&response length for hardware data router
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 70369f8e15b220f50a16348c79a61d3f7054813c upstream.
In the hardware data router case, introduced with kernel 3.2 commit 86a9668a8d29 ("[SCSI] zfcp: support for hardware data router") the ELS/GS request&response length needs to be initialized as in the chained SBAL case.
Otherwise, the FCP channel rejects ELS requests with FSF_REQUEST_SIZE_TOO_LARGE.
Such ELS requests can be issued by user space through BSG / HBA API, or zfcp itself uses ADISC ELS for remote port link test on RSCN. The latter can cause a short path outage due to unnecessary remote target port recovery because the always failing ADISC cannot detect extremely short path interruptions beyond the local FCP channel.
Below example is decoded with zfcpdbf from s390-tools:
Timestamp : ...
Area : SAN
Subarea : 00
Level : 1
Exception : -
CPU id : ..
Caller : zfcp_dbf_san_req+0408
Record id : 1
Tag : fssels1
Request id : 0x<reqid>
Destination ID : 0x00<target d_id>
Payload info : 52000000 00000000 <our wwpn > [ADISC]
<our wwnn > 00<s_id> 00000000
00000000 00000000 00000000 00000000Timestamp : ...
Area : HBA
Subarea : 00
Level : 1
Exception : -
CPU id : ..
Caller : zfcp_dbf_hba_fsf_res+0740
Record id : 1
Tag : fs_ferr
Request id : 0x<reqid>
Request status : 0x00000010
FSF cmnd : 0x0000000b [FSF_QTCB_SEND_ELS]
FSF sequence no: 0x...
FSF issued : ...
FSF stat : 0x00000061 [FSF_REQUEST_SIZE_TOO_LARGE]
FSF stat qual : 00000000 00000000 00000000 00000000
Prot stat : 0x00000100
Prot stat qual : 00000000 00000000 00000000 00000000
--- drivers/s390/scsi/zfcp_fsf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/s390/scsi/zfcp_fsf.c +4 -0
@@ -984,8 +984,12 @@ static int zfcp_fsf_setup_ct_els_sbals(sif (zfcp_adapter_multi_buffer_active (adapter)) {if (zfcp_qdio_sbals_from_sg (qdio, &req->qdio_req, sg_req))return -EIO ; + qtcb->bottom.support.req_buf_length = +zfcp_qdio_real_bytes (sg_req);if (zfcp_qdio_sbals_from_sg (qdio, &req->qdio_req, sg_resp))return -EIO ; + qtcb->bottom.support.resp_buf_length = +zfcp_qdio_real_bytes (sg_resp);zfcp_qdio_set_data_div (qdio, &req->qdio_req,zfcp_qdio_sbale_count (sg_req));
PATCH 10/306 zfcp: close window with unblocked rport during rport gone
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 4eeaa4f3f1d6c47b69f70e222297a4df4743363e upstream.
On a successful end of reopen port forced, zfcp_erp_strategy_followup_success() re-uses the port erp_action and the subsequent zfcp_erp_action_cleanup() now
sees ZFCP_ERP_SUCCEEDED with erp_action->action==ZFCP_ERP_ACTION_REOPEN_PORT instead of ZFCP_ERP_ACTION_REOPEN_PORT_FORCED
but must not perform zfcp_scsi_schedule_rport_register().
We can detect this because the fresh port reopen erp_action is in its very first step ZFCP_ERP_STEP_UNINITIALIZED.
Otherwise this opens a time window with unblocked rport (until the followup port reopen recovery would block it again). If a scsi_cmnd timeout occurs during this time window fc_timed_out() cannot work as desired and such command would indeed time out and trigger scsi_eh. This prevents a clean and timely path failover.
This should not happen if the path issue can be recovered on FC transport layer such as path issues involving RSCNs.
Also, unnecessary and repeated DID_IMM_RETRY for pending and undesired new requests occur because internally zfcp still has its zfcp_port blocked.
As follow-on errors with scsi_eh, it can cause,
in the worst case, permanently lost paths due to one of:
sd <scsidev>: [<scsidisk>] Medium access timeout failure. Offlining disk! sd <scsidev>: Device offlined - not ready after error recovery
For fix validation and to aid future debugging with other recoveries we now also trace (un)blocking of rports.
--- drivers/s390/scsi/zfcp_dbf.h | 7 ++++++- drivers/s390/scsi/zfcp_erp.c | 12 +++++++++--- drivers/s390/scsi/zfcp_scsi.c | 8 +++++++- 3 files changed, 22 insertions(+), 5 deletions(-)
drivers/s390/scsi/zfcp_dbf.h +6 -1
@@ -2,7 +2,7 @@* zfcp device driver * debug feature declarations * -* Copyright IBM Corp. 2008, 2010 +* Copyright IBM Corp. 2008, 2015 */ #ifndef ZFCP_DBF_H
@@ -17,6 +17,11 @@#define ZFCP_DBF_INVALID_LUN 0xFFFFFFFFFFFFFFFFull +enum zfcp_dbf_pseudo_erp_act_type { +ZFCP_PSEUDO_ERP_ACTION_RPORT_ADD =0xff , +ZFCP_PSEUDO_ERP_ACTION_RPORT_DEL =0xfe , +}; +/** * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action * @ready: number of ready recovery actions
drivers/s390/scsi/zfcp_erp.c +9 -3
@@ -3,7 +3,7 @@* * Error Recovery Procedures (ERP). * -* Copyright IBM Corp. 2002, 2010 +* Copyright IBM Corp. 2002, 2015 */ #define KMSG_COMPONENT "zfcp"
@@ -1224,8 +1224,14 @@ static void zfcp_erp_action_cleanup(strubreak ;case ZFCP_ERP_ACTION_REOPEN_PORT : -if (result ==ZFCP_ERP_SUCCEEDED ) -zfcp_scsi_schedule_rport_register (port); +/* This switch case might also happen after a forced reopen +* was successfully done and thus overwritten with a new +* non-forced reopen at `ersfs_2'. In this case, we must not +* do the clean-up of the non-forced version. +*/ +if (act->step !=ZFCP_ERP_STEP_UNINITIALIZED ) +if (result ==ZFCP_ERP_SUCCEEDED ) +zfcp_scsi_schedule_rport_register (port);/* fall through */ case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED :put_device (&port->dev);
drivers/s390/scsi/zfcp_scsi.c +7 -1
@@ -3,7 +3,7 @@* * Interface to Linux SCSI midlayer. * -* Copyright IBM Corp. 2002, 2013 +* Copyright IBM Corp. 2002, 2015 */ #define KMSG_COMPONENT "zfcp"
@@ -577,6 +577,9 @@ static void zfcp_scsi_rport_register(str ids.port_id = port->d_id; ids.roles =FC_RPORT_ROLE_FCP_TARGET ; +zfcp_dbf_rec_trig ("scpaddy" , port->adapter, port,NULL , +ZFCP_PSEUDO_ERP_ACTION_RPORT_ADD , +ZFCP_PSEUDO_ERP_ACTION_RPORT_ADD ); rport =fc_remote_port_add (port->adapter->scsi_host,0 , &ids);if (!rport) { dev_err(&port->adapter->ccw_device->dev,
@@ -598,6 +601,9 @@ static void zfcp_scsi_rport_block(structstruct fc_rport *rport = port->rport;if (rport) { +zfcp_dbf_rec_trig ("scpdely" , port->adapter, port,NULL , +ZFCP_PSEUDO_ERP_ACTION_RPORT_DEL , +ZFCP_PSEUDO_ERP_ACTION_RPORT_DEL );fc_remote_port_delete (rport); port->rport =NULL ; }
PATCH 11/306 zfcp: retain trace level for SCSI and HBA FSF response records
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 35f040df97fa0e94c7851c054ec71533c88b4b81 upstream.
While retaining the actual filtering according to trace level, the following commits started to write such filtered records with a hardcoded record level of 1 instead of the actual record level:
commit 250a1352b95e1db3216e5c5d4f4365bea5122f4a
("[SCSI] zfcp: Redesign of the debug tracing for SCSI records.") commit a54ca0f62f953898b05549391ac2a8a4dad6482b
("[SCSI] zfcp: Redesign of the debug tracing for HBA records.")
Now we can distinguish written records again for offline level filtering.
--- drivers/s390/scsi/zfcp_dbf.c | 11 ++++++----- drivers/s390/scsi/zfcp_dbf.h | 4 ++-- drivers/s390/scsi/zfcp_ext.h | 7 ++++--- 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +6 -5
@@ -3,7 +3,7 @@* * Debug traces for zfcp. * -* Copyright IBM Corp. 2002, 2013 +* Copyright IBM Corp. 2002, 2015 */ #define KMSG_COMPONENT "zfcp"
@@ -65,7 +65,7 @@ void zfcp_dbf_pl_write(struct zfcp_dbf ** @tag: tag indicating which kind of unsolicited status has been received * @req: request for which a response was received */ -void zfcp_dbf_hba_fsf_res (char *tag,struct zfcp_fsf_req *req) +void zfcp_dbf_hba_fsf_res (char *tag,int level,struct zfcp_fsf_req *req) {struct zfcp_dbf *dbf = req->adapter->dbf;struct fsf_qtcb_prefix *q_pref = &req->qtcb->prefix;
@@ -97,7 +97,7 @@ void zfcp_dbf_hba_fsf_res(char *tag, str rec->pl_len, "fsf_res", req->req_id); } -debug_event (dbf->hba,1 , rec,sizeof (*rec)); +debug_event (dbf->hba, level, rec,sizeof (*rec));spin_unlock_irqrestore (&dbf->hba_lock, flags); }
@@ -399,7 +399,8 @@ void zfcp_dbf_san_in_els(char *tag, stru* @sc: pointer to struct scsi_cmnd * @fsf: pointer to struct zfcp_fsf_req */ -void zfcp_dbf_scsi (char *tag,struct scsi_cmnd *sc,struct zfcp_fsf_req *fsf) +void zfcp_dbf_scsi (char *tag,int level,struct scsi_cmnd *sc, +struct zfcp_fsf_req *fsf) {struct zfcp_adapter *adapter = (struct zfcp_adapter *) sc->device->host->hostdata[0 ];
@@ -441,7 +442,7 @@ void zfcp_dbf_scsi(char *tag, struct scs } } -debug_event (dbf->scsi,1 , rec,sizeof (*rec)); +debug_event (dbf->scsi, level, rec,sizeof (*rec));spin_unlock_irqrestore (&dbf->scsi_lock, flags); }
drivers/s390/scsi/zfcp_dbf.h +2 -2
@@ -284,7 +284,7 @@ static inlinevoid zfcp_dbf_hba_fsf_resp (char *tag,int level,struct zfcp_fsf_req *req) {if (debug_level_enabled (req->adapter->dbf->hba, level)) -zfcp_dbf_hba_fsf_res (tag, req); +zfcp_dbf_hba_fsf_res (tag, level, req); }/**
@@ -323,7 +323,7 @@ void _zfcp_dbf_scsi(char *tag, int level scmd->device->host->hostdata[0 ];if (debug_level_enabled (adapter->dbf->scsi, level)) -zfcp_dbf_scsi (tag, scmd, req); +zfcp_dbf_scsi (tag, level, scmd, req); }/**
drivers/s390/scsi/zfcp_ext.h +4 -3
@@ -3,7 +3,7 @@* * External function declarations. * -* Copyright IBM Corp. 2002, 2010 +* Copyright IBM Corp. 2002, 2015 */ #ifndef ZFCP_EXT_H
@@ -36,7 +36,7 @@ extern void zfcp_dbf_rec_trig(char *, st struct zfcp_port *, struct scsi_device *, u8, u8);extern void zfcp_dbf_rec_run (char *,struct zfcp_erp_action *);extern void zfcp_dbf_hba_fsf_uss (char *,struct zfcp_fsf_req *); -extern void zfcp_dbf_hba_fsf_res (char *,struct zfcp_fsf_req *); +extern void zfcp_dbf_hba_fsf_res (char *,int ,struct zfcp_fsf_req *);extern void zfcp_dbf_hba_bit_err (char *,struct zfcp_fsf_req *);extern void zfcp_dbf_hba_berr (struct zfcp_dbf *,struct zfcp_fsf_req *);extern void zfcp_dbf_hba_def_err (struct zfcp_adapter *,u64 ,u16 ,void **);
@@ -44,7 +44,8 @@ extern void zfcp_dbf_hba_basic(char *, sextern void zfcp_dbf_san_req (char *,struct zfcp_fsf_req *,u32 );extern void zfcp_dbf_san_res (char *,struct zfcp_fsf_req *);extern void zfcp_dbf_san_in_els (char *,struct zfcp_fsf_req *); -extern void zfcp_dbf_scsi (char *,struct scsi_cmnd *,struct zfcp_fsf_req *); +extern void zfcp_dbf_scsi (char *,int ,struct scsi_cmnd *, +struct zfcp_fsf_req *);/* zfcp_erp.c */ extern void zfcp_erp_set_adapter_status (struct zfcp_adapter *,u32 );
PATCH 12/306 zfcp: restore: Dont use 0 to indicate invalid LUN in rec trace
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 0102a30a6ff60f4bb4c07358ca3b1f92254a6c25 upstream.
bring back
commit d21e9daa63e009ce5b87bbcaa6d11ce48e07bbbe
("[SCSI] zfcp: Dont use 0 to indicate invalid LUN in rec trace") which was lost with
commit ae0904f60fab7cb20c48d32eefdd735e478b91fb
("[SCSI] zfcp: Redesign of the debug tracing for recovery actions.")
--- drivers/s390/scsi/zfcp_dbf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/s390/scsi/zfcp_dbf.c +2 -1
@@ -241,7 +241,8 @@ static void zfcp_dbf_set_common(struct zif (sdev) { rec->lun_status =atomic_read (&sdev_to_zfcp (sdev)->status); rec->lun =zfcp_scsi_dev_lun (sdev); - } + }else + rec->lun =ZFCP_DBF_INVALID_LUN ; }/**
PATCH 13/306 zfcp: trace on request for open and close of WKA port
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit d27a7cb91960cf1fdd11b10071e601828cbf4b1f upstream.
Since commit a54ca0f62f953898b05549391ac2a8a4dad6482b ("[SCSI] zfcp: Redesign of the debug tracing for HBA records.") HBA records no longer contain WWPN, D_ID, or LUN
to reduce duplicate information which is already in REC records. In contrast to "regular" target ports, we don't use recovery to open WKA ports such as directory/nameserver, so we don't get REC records. Therefore, introduce pseudo REC running records without any actual recovery action but including D_ID of WKA port on open/close.
--- drivers/s390/scsi/zfcp_dbf.c | 32 ++++++++++++++++++++++++++++++++ drivers/s390/scsi/zfcp_ext.h | 1 + drivers/s390/scsi/zfcp_fsf.c | 8 ++++++-- 3 files changed, 39 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +32 -0
@@ -321,6 +321,38 @@ void zfcp_dbf_rec_run(char *tag, structspin_unlock_irqrestore (&dbf->rec_lock, flags); } +/** +* zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery +* @tag: identifier for event +* @wka_port: well known address port +* @req_id: request ID to correlate with potential HBA trace record +*/ +void zfcp_dbf_rec_run_wka (char *tag,struct zfcp_fc_wka_port *wka_port, +u64 req_id) +{ +struct zfcp_dbf *dbf = wka_port->adapter->dbf; +struct zfcp_dbf_rec *rec = &dbf->rec_buf; +unsigned long flags; + +spin_lock_irqsave (&dbf->rec_lock, flags); +memset (rec,0 ,sizeof (*rec)); + + rec->id =ZFCP_DBF_REC_RUN ; +memcpy (rec->tag, tag,ZFCP_DBF_TAG_LEN ); + rec->port_status = wka_port->status; + rec->d_id = wka_port->d_id; + rec->lun =ZFCP_DBF_INVALID_LUN ; + + rec->u.run.fsf_req_id = req_id; + rec->u.run.rec_status = ~0 ; + rec->u.run.rec_step = ~0 ; + rec->u.run.rec_action = ~0 ; + rec->u.run.rec_count = ~0 ; + +debug_event (dbf->rec,1 , rec,sizeof (*rec)); +spin_unlock_irqrestore (&dbf->rec_lock, flags); +} +static inline void zfcp_dbf_san (char *tag,struct zfcp_dbf *dbf,void *data,u8 id,u16 len,u64 req_id,u32 d_id)
drivers/s390/scsi/zfcp_ext.h +1 -0
@@ -35,6 +35,7 @@ extern void zfcp_dbf_adapter_unregister(extern void zfcp_dbf_rec_trig (char *,struct zfcp_adapter *,struct zfcp_port *,struct scsi_device *,u8 ,u8 );extern void zfcp_dbf_rec_run (char *,struct zfcp_erp_action *); +extern void zfcp_dbf_rec_run_wka (char *,struct zfcp_fc_wka_port *,u64 );extern void zfcp_dbf_hba_fsf_uss (char *,struct zfcp_fsf_req *);extern void zfcp_dbf_hba_fsf_res (char *,int ,struct zfcp_fsf_req *);extern void zfcp_dbf_hba_bit_err (char *,struct zfcp_fsf_req *);
drivers/s390/scsi/zfcp_fsf.c +6 -2
@@ -1582,7 +1582,7 @@ out:int zfcp_fsf_open_wka_port (struct zfcp_fc_wka_port *wka_port) {struct zfcp_qdio *qdio = wka_port->adapter->qdio; -struct zfcp_fsf_req *req; +struct zfcp_fsf_req *req =NULL ;int retval = -EIO ;spin_lock_irq (&qdio->req_q_lock);
@@ -1611,6 +1611,8 @@ int zfcp_fsf_open_wka_port(struct zfcp_fzfcp_fsf_req_free (req); out:spin_unlock_irq (&qdio->req_q_lock); +if (req && !IS_ERR (req)) +zfcp_dbf_rec_run_wka ("fsowp_1" , wka_port, req->req_id);return retval; }
@@ -1635,7 +1637,7 @@ static void zfcp_fsf_close_wka_port_handint zfcp_fsf_close_wka_port (struct zfcp_fc_wka_port *wka_port) {struct zfcp_qdio *qdio = wka_port->adapter->qdio; -struct zfcp_fsf_req *req; +struct zfcp_fsf_req *req =NULL ;int retval = -EIO ;spin_lock_irq (&qdio->req_q_lock);
@@ -1664,6 +1666,8 @@ int zfcp_fsf_close_wka_port(struct zfcp_zfcp_fsf_req_free (req); out:spin_unlock_irq (&qdio->req_q_lock); +if (req && !IS_ERR (req)) +zfcp_dbf_rec_run_wka ("fscwp_1" , wka_port, req->req_id);return retval; }
PATCH 14/306 zfcp: restore tracing of handle for port and LUN with HBA records
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 7c964ffe586bc0c3d9febe9bf97a2e4b2866e5b7 upstream.
This information was lost with
commit a54ca0f62f953898b05549391ac2a8a4dad6482b ("[SCSI] zfcp: Redesign of the debug tracing for HBA records.") but is required to debug e.g. invalid handle situations.
--- drivers/s390/scsi/zfcp_dbf.c | 2 ++ drivers/s390/scsi/zfcp_dbf.h | 2 ++ 2 files changed, 4 insertions(+)
drivers/s390/scsi/zfcp_dbf.c +2 -0
@@ -85,6 +85,8 @@ void zfcp_dbf_hba_fsf_res(char *tag, int rec->u.res.req_issued = req->issued; rec->u.res.prot_status = q_pref->prot_status; rec->u.res.fsf_status = q_head->fsf_status; + rec->u.res.port_handle = q_head->port_handle; + rec->u.res.lun_handle = q_head->lun_handle;memcpy (rec->u.res.prot_status_qual, &q_pref->prot_status_qual,FSF_PROT_STATUS_QUAL_SIZE );
drivers/s390/scsi/zfcp_dbf.h +2 -0
@@ -131,6 +131,8 @@ struct zfcp_dbf_hba_res {u8 prot_status_qual[FSF_PROT_STATUS_QUAL_SIZE ];u32 fsf_status;u8 fsf_status_qual[FSF_STATUS_QUALIFIER_SIZE ]; +u32 port_handle; +u32 lun_handle; } __packed;/**
PATCH 15/306 zfcp: fix D_ID field with actual value on tracing SAN responses
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 771bf03537ddfa4a4dde62ef9dfbc82e4f77ab20 upstream.
With commit 2c55b750a884b86dea8b4cc5f15e1484cc47a25c ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.") we lost the N_Port-ID where an ELS response comes from. With commit 7c7dc196814b9e1d5cc254dc579a5fa78ae524f7 ("[SCSI] zfcp: Simplify handling of ct and els requests") we lost the N_Port-ID where a CT response comes from. It's especially useful if the request SAN trace record with D_ID was already lost due to trace buffer wrap.
GS uses an open WKA port handle and ELS just a D_ID, and only for ELS we could get D_ID from QTCB bottom via zfcp_fsf_req. To cover both cases, add a new field to zfcp_fsf_ct_els and fill it in on request to use in SAN response trace. Strictly speaking the D_ID on SAN response is the FC frame's S_ID. We don't need a field for the other end which is always us.
--- drivers/s390/scsi/zfcp_dbf.c | 2 +- drivers/s390/scsi/zfcp_fsf.c | 2 ++ drivers/s390/scsi/zfcp_fsf.h | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +1 -1
@@ -407,7 +407,7 @@ void zfcp_dbf_san_res(char *tag, struct length = (u16)(ct_els->resp->length +FC_CT_HDR_LEN );zfcp_dbf_san (tag, dbf,sg_virt (ct_els->resp),ZFCP_DBF_SAN_RES , length, - fsf->req_id,0 ); + fsf->req_id, ct_els->d_id); }/**
drivers/s390/scsi/zfcp_fsf.c +2 -0
@@ -1079,6 +1079,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_ req->handler = zfcp_fsf_send_ct_handler; req->qtcb->header.port_handle = wka_port->handle; + ct->d_id = wka_port->d_id; req->data = ct;zfcp_dbf_san_req ("fssct_1" , req, wka_port->d_id);
@@ -1175,6 +1176,7 @@ int zfcp_fsf_send_els(struct zfcp_adaptehton24 (req->qtcb->bottom.support.d_id, d_id); req->handler = zfcp_fsf_send_els_handler; + els->d_id = d_id; req->data = els;zfcp_dbf_san_req ("fssels1" , req, d_id);
drivers/s390/scsi/zfcp_fsf.h +3 -1
@@ -3,7 +3,7 @@* * Interface to the FSF support functions. * -* Copyright IBM Corp. 2002, 2010 +* Copyright IBM Corp. 2002, 2015 */ #ifndef FSF_H
@@ -436,6 +436,7 @@ struct zfcp_blk_drv_data {* @handler_data: data passed to handler function * @port: Optional pointer to port for zfcp internal ELS (only test link ADISC) * @status: used to pass error status to calling function +* @d_id: Destination ID of either open WKA port for CT or of D_ID for ELS */ struct zfcp_fsf_ct_els {struct scatterlist *req;
@@ -444,6 +445,7 @@ struct zfcp_fsf_ct_els {void *handler_data;struct zfcp_port *port;int status; + u32 d_id; };#endif /* FSF_H */
PATCH 16/306 zfcp: fix payload trace length for SAN request&response
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit 94db3725f049ead24c96226df4a4fb375b880a77 upstream.
commit 2c55b750a884b86dea8b4cc5f15e1484cc47a25c
("[SCSI] zfcp: Redesign of the debug tracing for SAN records.") started to add FC_CT_HDR_LEN which made zfcp dump random data out of bounds for RSPN GS responses because u.rspn.rsp is the largest and last field in the union of struct zfcp_fc_req. Other request/response types only happened to stay within bounds due to the padding of the union or
due to the trace capping of u.gspn.rsp to ZFCP_DBF_SAN_MAX_PAYLOAD.
Timestamp : ...
Area : SAN
Subarea : 00
Level : 1
Exception : -
CPU id : ..
Caller : ...
Record id : 2
Tag : fsscth2
Request id : 0x...
Destination ID : 0x00fffffc
Payload short : 01000000 fc020000 80020000 00000000
xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx <===
00000000 00000000 00000000 00000000Payload length : 32 <===
struct zfcp_fc_req {
[0] struct zfcp_fsf_ct_els ct_els;
[56] struct scatterlist sg_req;
[96] struct scatterlist sg_rsp;
union {
struct {req; rsp;} adisc; SIZE: 28+28= 56
struct {req; rsp;} gid_pn; SIZE: 24+20= 44
struct {rspsg; req;} gpn_ft; SIZE: 40*4+20=180
struct {req; rsp;} gspn; SIZE: 20+273= 293
struct {req; rsp;} rspn; SIZE: 277+16= 293 [136] } u;
}
SIZE: 432
--- drivers/s390/scsi/zfcp_dbf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +2 -2
@@ -389,7 +389,7 @@ void zfcp_dbf_san_req(char *tag, structstruct zfcp_fsf_ct_els *ct_els = fsf->data;u16 length; - length = (u16)(ct_els->req->length +FC_CT_HDR_LEN ); + length = (u16)(ct_els->req->length);zfcp_dbf_san (tag, dbf,sg_virt (ct_els->req),ZFCP_DBF_SAN_REQ , length, fsf->req_id, d_id); }
@@ -405,7 +405,7 @@ void zfcp_dbf_san_res(char *tag, structstruct zfcp_fsf_ct_els *ct_els = fsf->data;u16 length; - length = (u16)(ct_els->resp->length +FC_CT_HDR_LEN ); + length = (u16)(ct_els->resp->length);zfcp_dbf_san (tag, dbf,sg_virt (ct_els->resp),ZFCP_DBF_SAN_RES , length, fsf->req_id, ct_els->d_id); }
PATCH 17/306 zfcp: trace full payload of all SAN records (req,resp,iels)
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Maier <[email protected]>
commit aceeffbb59bb91404a0bda32a542d7ebf878433a upstream.
This was lost with commit 2c55b750a884b86dea8b4cc5f15e1484cc47a25c ("[SCSI] zfcp: Redesign of the debug tracing for SAN records.") but is necessary for problem determination, e.g. to see the currently active zone set during automatic port scan.
For the large GPN_FT response (4 pages), save space by not dumping any empty residual entries.
--- drivers/s390/scsi/zfcp_dbf.c | 116 ++++++++++++++++++++++++++++++++++++++----- drivers/s390/scsi/zfcp_dbf.h | 1 + 2 files changed, 104 insertions(+), 13 deletions(-)
drivers/s390/scsi/zfcp_dbf.c +103 -13
@@ -3,7 +3,7 @@* * Debug traces for zfcp. * -* Copyright IBM Corp. 2002, 2015 +* Copyright IBM Corp. 2002, 2016 */ #define KMSG_COMPONENT "zfcp"
@@ -356,12 +356,15 @@ void zfcp_dbf_rec_run_wka(char *tag, str }static inline -void zfcp_dbf_san (char *tag,struct zfcp_dbf *dbf,void *data,u8 id,u16 len, -u64 req_id,u32 d_id) +void zfcp_dbf_san (char *tag,struct zfcp_dbf *dbf, +char *paytag,struct scatterlist *sg,u8 id,u16 len, +u64 req_id,u32 d_id,u16 cap_len) {struct zfcp_dbf_san *rec = &dbf->san_buf;u16 rec_len;unsigned long flags; +struct zfcp_dbf_pay *payload = &dbf->pay_buf; +u16 pay_sum =0 ;spin_lock_irqsave (&dbf->san_lock, flags);memset (rec,0 ,sizeof (*rec));
@@ -369,10 +372,41 @@ void zfcp_dbf_san(char *tag, struct zfcp rec->id = id; rec->fsf_req_id = req_id; rec->d_id = d_id; - rec_len =min (len, (u16 )ZFCP_DBF_SAN_MAX_PAYLOAD ); -memcpy (rec->payload, data, rec_len);memcpy (rec->tag, tag,ZFCP_DBF_TAG_LEN ); + rec->pl_len = len;/* full length even if we cap pay below */ +if (!sg) + goto out; + rec_len = min_t(unsigned int, sg->length, ZFCP_DBF_SAN_MAX_PAYLOAD); +memcpy (rec->payload,sg_virt (sg), rec_len);/* part of 1st sg entry */ +if (len <= rec_len) + goto out;/* skip pay record if full content in rec->payload */ + +/* if (len > rec_len): +* dump data up to cap_len ignoring small duplicate in rec->payload +*/ +spin_lock_irqsave (&dbf->pay_lock, flags); +memset (payload,0 ,sizeof (*payload)); +memcpy (payload->area, paytag,ZFCP_DBF_TAG_LEN ); + payload->fsf_req_id = req_id; + payload->counter =0 ; +for (; sg && pay_sum < cap_len; sg =sg_next (sg)) { +u16 pay_len, offset =0 ; + +while (offset < sg->length && pay_sum < cap_len) { + pay_len =min ((u16 )ZFCP_DBF_PAY_MAX_REC , + (u16)(sg->length - offset)); +/* cap_len <= pay_sum < cap_len+ZFCP_DBF_PAY_MAX_REC */ +memcpy (payload->data,sg_virt (sg) + offset, pay_len); +debug_event (dbf->pay,1 , payload, +zfcp_dbf_plen (pay_len)); + payload->counter++; + offset += pay_len; + pay_sum += pay_len; + } + } +spin_unlock (&dbf->pay_lock); +out:debug_event (dbf->san,1 , rec,sizeof (*rec));spin_unlock_irqrestore (&dbf->san_lock, flags); }
@@ -389,9 +423,62 @@ void zfcp_dbf_san_req(char *tag, structstruct zfcp_fsf_ct_els *ct_els = fsf->data;u16 length; - length = (u16)(ct_els->req->length); -zfcp_dbf_san (tag, dbf,sg_virt (ct_els->req),ZFCP_DBF_SAN_REQ , length, - fsf->req_id, d_id); + length = (u16 )zfcp_qdio_real_bytes (ct_els->req); +zfcp_dbf_san (tag, dbf,"san_req" , ct_els->req,ZFCP_DBF_SAN_REQ , + length, fsf->req_id, d_id, length); +} + +static u16 zfcp_dbf_san_res_cap_len_if_gpn_ft (char *tag, +struct zfcp_fsf_req *fsf, +u16 len) +{ +struct zfcp_fsf_ct_els *ct_els = fsf->data; +struct fc_ct_hdr *reqh =sg_virt (ct_els->req); +struct fc_ns_gid_ft *reqn = (struct fc_ns_gid_ft *)(reqh +1 ); +struct scatterlist *resp_entry = ct_els->resp; +struct fc_gpn_ft_resp *acc; +int max_entries, x, last =0 ; + +if (!(memcmp (tag,"fsscth2" ,7 ) ==0 + && ct_els->d_id ==FC_FID_DIR_SERV + && reqh->ct_rev ==FC_CT_REV + && reqh->ct_in_id[0 ] ==0 + && reqh->ct_in_id[1 ] ==0 + && reqh->ct_in_id[2 ] ==0 + && reqh->ct_fs_type ==FC_FST_DIR + && reqh->ct_fs_subtype ==FC_NS_SUBTYPE + && reqh->ct_options ==0 + && reqh->_ct_resvd1 ==0 + && reqh->ct_cmd ==FC_NS_GPN_FT +/* reqh->ct_mr_size can vary so do not match but read below */ + && reqh->_ct_resvd2 ==0 + && reqh->ct_reason ==0 + && reqh->ct_explan ==0 + && reqh->ct_vendor ==0 + && reqn->fn_resvd ==0 + && reqn->fn_domain_id_scope ==0 + && reqn->fn_area_id_scope ==0 + && reqn->fn_fc4_type ==FC_TYPE_FCP )) +return len;/* not GPN_FT response so do not cap */ + + acc =sg_virt (resp_entry); + max_entries = (reqh->ct_mr_size *4 /sizeof (struct fc_gpn_ft_resp )) + +1 /* zfcp_fc_scan_ports: bytes correct, entries off-by-one +* to account for header as 1st pseudo "entry" */ ; + +/* the basic CT_IU preamble is the same size as one entry in the GPN_FT +* response, allowing us to skip special handling for it - just skip it +*/ +for (x =1 ; x < max_entries && !last; x++) { +if (x % (ZFCP_FC_GPN_FT_ENT_PAGE +1 )) + acc++; +else + acc =sg_virt (++resp_entry); + + last = acc->fp_flags &FC_NS_FID_LAST ; + } + len =min (len, (u16)(x *sizeof (struct fc_gpn_ft_resp ))); +return len;/* cap after last entry */ }/**
@@ -405,9 +492,10 @@ void zfcp_dbf_san_res(char *tag, structstruct zfcp_fsf_ct_els *ct_els = fsf->data;u16 length; - length = (u16)(ct_els->resp->length); -zfcp_dbf_san (tag, dbf,sg_virt (ct_els->resp),ZFCP_DBF_SAN_RES , length, - fsf->req_id, ct_els->d_id); + length = (u16 )zfcp_qdio_real_bytes (ct_els->resp); +zfcp_dbf_san (tag, dbf,"san_res" , ct_els->resp,ZFCP_DBF_SAN_RES , + length, fsf->req_id, ct_els->d_id, +zfcp_dbf_san_res_cap_len_if_gpn_ft (tag, fsf, length)); }/**
@@ -421,11 +509,13 @@ void zfcp_dbf_san_in_els(char *tag, strustruct fsf_status_read_buffer *srb = (struct fsf_status_read_buffer *) fsf->data;u16 length; +struct scatterlist sg; length = (u16)(srb->length - offsetof(struct fsf_status_read_buffer , payload)); -zfcp_dbf_san (tag, dbf, srb->payload.data,ZFCP_DBF_SAN_ELS , length, - fsf->req_id,ntoh24 (srb->d_id)); +sg_init_one (&sg, srb->payload.data, length); +zfcp_dbf_san (tag, dbf,"san_els" , &sg,ZFCP_DBF_SAN_ELS , length, + fsf->req_id,ntoh24 (srb->d_id), length); }/**
drivers/s390/scsi/zfcp_dbf.h +1 -0
@@ -115,6 +115,7 @@ struct zfcp_dbf_san {u32 d_id;#define ZFCP_DBF_SAN_MAX_PAYLOAD (FC_CT_HDR_LEN + 32)char payload[ZFCP_DBF_SAN_MAX_PAYLOAD ]; +u16 pl_len; } __packed;/**
PATCH 18/306 clk: divider: Fix clk_divider_round_rate() to use clk_readl()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 2cf9a57811bddb6fa6b0f8d7376da164d5534813 upstream.
clk-divider uses clk_readl()/clk_writel() everywhere, except in clk_divider_round_rate(), where plain readl() is used. Change this to clk_readl(), as it makes a difference on powerpc.
--- drivers/clk/clk-divider.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-divider.c +1 -1
@@ -263,7 +263,7 @@ static int clk_divider_bestdiv(struct cl/* if read only, just return current value */ if (divider->flags &CLK_DIVIDER_READ_ONLY ) { - bestdiv =readl (divider->reg) >> divider->shift; + bestdiv =clk_readl (divider->reg) >> divider->shift; bestdiv &=div_mask (divider); bestdiv =_get_div (divider, bestdiv);return bestdiv;
PATCH 19/306 x86/dumpstack: Fix x86_32 kernel_stack_pointer() previous stack access
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 72b4f6a5e903b071f2a7c4eb1418cbe4eefdc344 upstream.
On x86_32, when an interrupt happens from kernel space, SS and SP aren't pushed and the existing stack is used. So pt_regs is effectively two words shorter, and the previous stack pointer is normally the memory after the shortened pt_regs, aka '®s->sp'.
But in the rare case where the interrupt hits right after the stack pointer has been changed to point to an empty stack, like for example when call_on_stack() is used, the address immediately after the shortened pt_regs is no longer on the stack. In that case, instead of '®s->sp', the previous stack pointer should be retrieved from the beginning of the current stack page.
kernel_stack_pointer() wants to do that, but it forgets to dereference the pointer. So instead of returning a pointer to the previous stack, it returns a pointer to the beginning of the current stack.
Note that it's probably outside of kernel_stack_pointer()'s scope to be switching stacks at all. The x86_64 version of this function doesn't do it, and it would be better for the caller to do it if necessary. But that's a patch for another day. This just fixes the original intent.
--- arch/x86/kernel/ptrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/ptrace.c +2 -2
@@ -190,8 +190,8 @@ unsigned long kernel_stack_pointer(strucreturn sp; prev_esp = (u32 *)(context); -if (prev_esp) -return (unsigned long )prev_esp; +if (*prev_esp) +return (unsigned long )*prev_esp;return (unsigned long )regs; }
PATCH 20/306 PCI: Mark Atheros AR9580 to avoid bus reset
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Maik Broemme <[email protected]>
commit 8e2e03179923479ca0c0b6fdc7c93ecf89bce7a8 upstream.
Similar to the AR93xx and the AR94xx series, the AR95xx also have the same quirk for the Bus Reset. It will lead to instant system reset if the device is assigned via VFIO to a KVM VM. I've been able reproduce this behavior with a MikroTik R11e-2HnD.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -3083,6 +3083,7 @@ static void quirk_no_bus_reset(struct pcDECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0030 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0032 , quirk_no_bus_reset);DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x003c , quirk_no_bus_reset); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_ATHEROS ,0x0033 , quirk_no_bus_reset);static void pci_do_fixups (struct pci_dev *dev,struct pci_fixup *f,struct pci_fixup *end)
PATCH 21/306 net: systemport: Fix ordering in intrl2_*_mask_clear macro
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
commit 9a0a5c4cb1af98b625dcefd72e987ca4929db71d upstream.
Since we keep shadow copies of which interrupt sources are enabled through the intrl2_*_mask_{set,clear} macros, make sure that the ordering in which we do these two operations: update the copy, then unmask the register is correct.
This is not currently a problem because we actually do not use them, but we will in a subsequent patch optimizing register accesses, so better be safe here.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +1 -1
@@ -58,8 +58,8 @@ BCM_SYSPORT_IO_MACRO(topctrl, SYS_PORT_T static inline void intrl2_##which##_mask_clear(struct bcm_sysport_priv *priv, \ u32 mask) \ { \ - intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ priv->irq##which##_mask &= ~(mask); \ + intrl2_##which##_writel(priv, mask, INTRL2_CPU_MASK_CLEAR); \ } \ static inline void intrl2_##which##_mask_set(struct bcm_sysport_priv *priv, \ u32 mask) \
PATCH 22/306 netfilter: restart search if moved to other chain
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 95a8d19f28e6b29377a880c6264391a62e07fccc upstream.
In case nf_conntrack_tuple_taken did not find a conflicting entry check that all entries in this hash slot were tested and restart in case an entry was moved to another chain.
[bwh: Backported to 3.16:
- Adjust context
- Use NF_CT_STAT_INC(), not the _ATOMIC variant, since we disable BHs]
--- net/netfilter/nf_conntrack_core.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/netfilter/nf_conntrack_core.c +7 -0
@@ -726,6 +726,7 @@ nf_conntrack_tuple_taken(const struct nf* least once for the stats anyway. */ rcu_read_lock_bh (); + begin:hlist_nulls_for_each_entry_rcu (h, n, &net->ct.hash[hash], hnnode) { ct =nf_ct_tuplehash_to_ctrack (h); if (ct != ignored_conntrack &&
@@ -737,6 +738,12 @@ nf_conntrack_tuple_taken(const struct nf }NF_CT_STAT_INC (net, searched); } + +if (get_nulls_value (n) != hash) { +NF_CT_STAT_INC (net, search_restart); + goto begin; + } +rcu_read_unlock_bh ();return 0 ;
PATCH 23/306 uio: fix dmem_region_start computation
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Viktorin <[email protected]>
commit 4d31a2588ae37a5d0f61f4d956454e9504846aeb upstream.
The variable i contains a total number of resources (including IORESOURCE_IRQ). However, we want the dmem_region_start to point after the last resource of type IORESOURCE_MEM. The original behaviour leads (very likely) to skipping several UIO mapping regions and makes them useless. Fix this by computing dmem_region_start from the uiomem which points to the last used UIO mapping.
--- drivers/uio/uio_dmem_genirq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/uio/uio_dmem_genirq.c +1 -1
@@ -229,7 +229,7 @@ static int uio_dmem_genirq_probe(struct ++uiomem; } - priv->dmem_region_start = i; + priv->dmem_region_start = uiomem - &uioinfo->mem[0 ]; priv->num_dmem_regions = pdata->num_dynamic_regions;for (i =0 ; i < pdata->num_dynamic_regions; ++i) {
PATCH 24/306 platform: don't return 0 from platform_get_irq[_byname]() on error
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Shtylyov <[email protected]>
commit e330b9a6bb35dc7097a4f02cb1ae7b6f96df92af upstream.
of_irq_get[_byname]() return 0 iff irq_create_of_mapping() call fails. Returning both error code and 0 on failure is a sign of a misdesigned API, it makes the failure check unnecessarily complex and error prone. We should rely on the platform IRQ resource in this case, not return 0, especially as 0 can be a valid IRQ resource too...
--- drivers/base/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/platform.c +2 -2
@@ -93,7 +93,7 @@ int platform_get_irq(struct platform_devint ret; ret =of_irq_get (dev->dev.of_node, num); -if (ret >=0 || ret == -EPROBE_DEFER ) +if (ret >0 || ret == -EPROBE_DEFER )return ret; }
@@ -142,7 +142,7 @@ int platform_get_irq_byname(struct platfint ret; ret =of_irq_get_byname (dev->dev.of_node, name); -if (ret >=0 || ret == -EPROBE_DEFER ) +if (ret >0 || ret == -EPROBE_DEFER )return ret; }
PATCH 25/306 arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 3a402a709500c5a3faca2111668c33d96555e35a upstream.
When TIF_SINGLESTEP is set for a task, the single-step state machine is enabled and we must take care not to reset it to the active-not-pending state if it is already in the active-pending state.
Unfortunately, that's exactly what user_enable_single_step does, by unconditionally setting the SS bit in the SPSR for the current task. This causes failures in the GDB testsuite, where GDB ends up missing expected step traps if the instruction being stepped generates another trap, e.g. PTRACE_EVENT_FORK from an SVC instruction.
This patch fixes the problem by preserving the current state of the stepping state machine when TIF_SINGLESTEP is set on the current thread.
--- arch/arm64/kernel/debug-monitors.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/kernel/debug-monitors.c +4 -2
@@ -427,8 +427,10 @@ int kernel_active_single_step(void)/* ptrace API */ void user_enable_single_step (struct task_struct *task) { -set_ti_thread_flag (task_thread_info (task),TIF_SINGLESTEP ); -set_regs_spsr_ss (task_pt_regs (task)); +struct thread_info *ti =task_thread_info (task); + +if (!test_and_set_ti_thread_flag (ti,TIF_SINGLESTEP )) +set_regs_spsr_ss (task_pt_regs (task)); }void user_disable_single_step (struct task_struct *task)
PATCH 26/306 perf symbols: Fixup symbol sizes before picking best ones
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
commit 432746f8e0b6a82ba832b771afe31abd51af6752 upstream.
When we call symbol__fixup_duplicate() we use algorithms to pick the "best" symbols for cases where there are various functions/aliases to an address, and those check zero size symbols, which, before calling symbol__fixup_end() are _all_ symbols in a just parsed kallsyms file.
So first fixup the end, then fixup the duplicates.
Found while trying to figure out why 'perf test vmlinux' failed, see the output of 'perf test -v vmlinux' to see cases where the symbols picked as best for vmlinux don't match the ones picked for kallsyms.
--- tools/perf/util/symbol-elf.c | 2 +- tools/perf/util/symbol.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/symbol-elf.c +1 -1
@@ -958,8 +958,8 @@ new_symbol:* For misannotated, zeroed, ASM function sizes. */ if (nr >0 ) { -symbols__fixup_duplicate (&dso->symbols[map->type]);symbols__fixup_end (&dso->symbols[map->type]); +symbols__fixup_duplicate (&dso->symbols[map->type]);if (kmap) {/* * We need to fixup this here too because we create new
tools/perf/util/symbol.c +1 -1
@@ -1176,8 +1176,8 @@ int dso__load_kallsyms(struct dso *dso,if (kallsyms__delta (map, filename, &delta))return -1 ; -symbols__fixup_duplicate (&dso->symbols[map->type]);symbols__fixup_end (&dso->symbols[map->type]); +symbols__fixup_duplicate (&dso->symbols[map->type]);if (dso->kernel ==DSO_TYPE_GUEST_KERNEL ) dso->symtab_type =DSO_BINARY_TYPE__GUEST_KALLSYMS ;
PATCH 27/306 ASoC: dapm: Fix value setting for _ENUM_DOUBLE MUX's second channel
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 071133a209354f39d4e5785d5a6a390e03241841 upstream.
The value for the second channel in _ENUM_DOUBLE (double channel) MUXs is not correctly updated, due to using the wrong bit shift.
Use the correct bit shift, so both channels toggle together.
--- sound/soc/soc-dapm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-dapm.c +1 -1
@@ -2870,7 +2870,7 @@ int snd_soc_dapm_put_enum_double(structif (e->shift_l != e->shift_r) {if (item[1 ] > e->items)return -EINVAL ; - val |=snd_soc_enum_item_to_val (e, item[1 ]) << e->shift_l; + val |=snd_soc_enum_item_to_val (e, item[1 ]) << e->shift_r; mask |= e->mask << e->shift_r; }
PATCH 28/306 genirq/generic_chip: Add irq_unmap callback
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Frias <[email protected]>
commit ee26c013cdee0b947e29d6cadfb9ff3341c69ff9 upstream.
Without this patch irq_domain_disassociate() cannot properly release the interrupt. In fact, irq_map_generic_chip() checks a bit on 'gc->installed' but said bit is never cleared, only set.
Commit 088f40b7b027 ("genirq: Generic chip: Add linear irq domain support") added irq_map_generic_chip() function and also stated "This lacks a removal function for now".
This commit provides an implementation of an unmap function that can be called by irq_domain_disassociate().
[ tglx: Made the function static and removed the export as we have neither
a prototype nor a modular user. ]
[bwh: Backported to 3.16: open-code irq_domain_get_irq_data(),
irq_domain_set_info()]
---
kernel/irq/generic-chip.c +22 -0
@@ -395,8 +395,30 @@ static int irq_map_generic_chip(struct ireturn 0 ; } +static void irq_unmap_generic_chip (struct irq_domain *d,unsigned int virq) +{ +struct irq_data *data =irq_get_irq_data (virq); +struct irq_domain_chip_generic *dgc = d->gc; +unsigned int hw_irq = data->hwirq; +struct irq_chip_generic *gc; +int irq_idx; + + gc =irq_get_domain_generic_chip (d, hw_irq); +if (!gc) +return ; + + irq_idx = hw_irq % dgc->irqs_per_chip; + +clear_bit (irq_idx, &gc->installed); + data->chip = &no_irq_chip; + data->chip_data =NULL ; +__irq_set_handler (virq,NULL ,0 ,NULL ); +irq_set_handler_data (virq,NULL ); +} +struct irq_domain_ops irq_generic_chip_ops = { .map = irq_map_generic_chip, + .unmap = irq_unmap_generic_chip, .xlate = irq_domain_xlate_onetwocell, };EXPORT_SYMBOL_GPL (irq_generic_chip_ops);
PATCH 29/306 rtlwifi: Update regulatory database
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Shao Fu <[email protected]>
commit 02b5fffbe9e02f5d63fa4a801fb807cf0aab4fc9 upstream.
Driver rtlwifi maintains its own regulatory information, The Chrome Autotest
(https://www.chromium.org/chromium-os/testing/autotest-user-doc)
showed some errors. This patch adds the necessary information for rtlwifi.
---
drivers/net/wireless/rtlwifi/regd.c +38 -3
@@ -44,6 +44,7 @@ static struct country_code_to_enum_rd al {COUNTRY_CODE_GLOBAL_DOMAIN, "JP"}, {COUNTRY_CODE_WORLD_WIDE_13, "EC"}, {COUNTRY_CODE_TELEC_NETGEAR, "EC"}, + {COUNTRY_CODE_WORLD_WIDE_13_5G_ALL, "US"}, };/*
@@ -131,6 +132,17 @@ static const struct ieee80211_regdomain } }; +static const struct ieee80211_regdomain rtl_regdom_12_13_5g_all = { + .n_reg_rules =4 , + .alpha2 ="99" , + .reg_rules = { + RTL819x_2GHZ_CH01_11, + RTL819x_2GHZ_CH12_13, + RTL819x_5GHZ_5150_5350, + RTL819x_5GHZ_5470_5850, + } +}; +static const struct ieee80211_regdomain rtl_regdom_14 = { .n_reg_rules =3 , .alpha2 ="99" ,
@@ -330,6 +342,8 @@ static const struct ieee80211_regdomainreturn &rtl_regdom_14_60_64;case COUNTRY_CODE_GLOBAL_DOMAIN :return &rtl_regdom_14; +case COUNTRY_CODE_WORLD_WIDE_13_5G_ALL : +return &rtl_regdom_12_13_5g_all;default :return &rtl_regdom_no_midband; }
@@ -367,6 +381,25 @@ static struct country_code_to_enum_rd *_return NULL ; } +static u8 channel_plan_to_country_code (u8 channelplan) +{ +switch (channelplan) { +case 0x20 : +case 0x21 : +return COUNTRY_CODE_WORLD_WIDE_13 ; +case 0x22 : +return COUNTRY_CODE_IC ; +case 0x32 : +return COUNTRY_CODE_TELEC_NETGEAR ; +case 0x41 : +return COUNTRY_CODE_GLOBAL_DOMAIN ; +case 0x7f : +return COUNTRY_CODE_WORLD_WIDE_13_5G_ALL ; +default : +return COUNTRY_CODE_MAX ;/*Error*/ + } +} +int rtl_regd_init (struct ieee80211_hw *hw,void (*reg_notifier) (struct wiphy *wiphy,struct regulatory_request *request))
@@ -379,10 +412,12 @@ int rtl_regd_init(struct ieee80211_hw *hreturn -EINVAL ;/* init country_code from efuse channel plan */ - rtlpriv->regd.country_code = rtlpriv->efuse.channel_plan; + rtlpriv->regd.country_code = +channel_plan_to_country_code (rtlpriv->efuse.channel_plan); -RT_TRACE (rtlpriv,COMP_REGD ,DBG_TRACE , -"rtl: EEPROM regdomain: 0x%0x\n" , rtlpriv->regd.country_code); +RT_TRACE (rtlpriv,COMP_REGD ,DBG_DMESG , +"rtl: EEPROM regdomain: 0x%0x conuntry code: %d\n" , + rtlpriv->efuse.channel_plan, rtlpriv->regd.country_code);if (rtlpriv->regd.country_code >=COUNTRY_CODE_MAX ) { RT_TRACE(rtlpriv, COMP_REGD, DBG_DMESG,
drivers/net/wireless/rtlwifi/regd.h +1 -0
@@ -49,6 +49,7 @@ enum country_code_type_t {COUNTRY_CODE_GLOBAL_DOMAIN =10 ,COUNTRY_CODE_WORLD_WIDE_13 =11 ,COUNTRY_CODE_TELEC_NETGEAR =12 , +COUNTRY_CODE_WORLD_WIDE_13_5G_ALL =13 ,/*add new channel plan above this line */ COUNTRY_CODE_MAX
PATCH 30/306 rtlwifi: Fix missing country code for Great Britain
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 0c9d3491530773858ff9d705ec2a9c382f449230 upstream.
Some RTL8821AE devices sold in Great Britain have the country code of 0x25 encoded in their EEPROM. This value is not tested in the routine that establishes the regulatory info for the chip. The fix is to set this code to have the same capabilities as the EU countries. In addition, the channels allowed for COUNTRY_CODE_ETSI were more properly suited for China and Israel, not the EU. This problem has also been fixed.
--- drivers/net/wireless/rtlwifi/regd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/regd.c +3 -1
@@ -327,9 +327,9 @@ static const struct ieee80211_regdomainreturn &rtl_regdom_no_midband;case COUNTRY_CODE_IC :return &rtl_regdom_11; -case COUNTRY_CODE_ETSI :case COUNTRY_CODE_TELEC_NETGEAR :return &rtl_regdom_60_64; +case COUNTRY_CODE_ETSI :case COUNTRY_CODE_SPAIN :case COUNTRY_CODE_FRANCE :case COUNTRY_CODE_ISRAEL :
@@ -389,6 +389,8 @@ static u8 channel_plan_to_country_code(ureturn COUNTRY_CODE_WORLD_WIDE_13 ;case 0x22 :return COUNTRY_CODE_IC ; +case 0x25 : +return COUNTRY_CODE_ETSI ;case 0x32 :return COUNTRY_CODE_TELEC_NETGEAR ;case 0x41 :
PATCH 31/306 pwm: Unexport children before chip removal
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Hsu <[email protected]>
commit 0733424c9ba9f42242409d1ece780777272f7ea1 upstream.
Exported pwm channels aren't removed before the pwmchip and are leaked. This results in invalid sysfs files. This fix removes all exported pwm channels before chip removal.
--- drivers/pwm/core.c | 2 ++ drivers/pwm/sysfs.c | 18 ++++++++++++++++++ include/linux/pwm.h | 5 +++++ 3 files changed, 25 insertions(+)
drivers/pwm/core.c +2 -0
@@ -293,6 +293,8 @@ int pwmchip_remove(struct pwm_chip *chipunsigned int i;int ret =0 ; +pwmchip_sysfs_unexport_children (chip); +mutex_lock (&pwm_lock);for (i =0 ; i < chip->npwm; i++) {
drivers/pwm/sysfs.c +18 -0
@@ -340,6 +340,24 @@ void pwmchip_sysfs_unexport(struct pwm_c } } +void pwmchip_sysfs_unexport_children (struct pwm_chip *chip) +{ +struct device *parent; +unsigned int i; + + parent =class_find_device (&pwm_class,NULL , chip, + pwmchip_sysfs_match); +if (!parent) +return ; + +for (i =0 ; i < chip->npwm; i++) { +struct pwm_device *pwm = &chip->pwms[i]; + +if (test_bit (PWMF_EXPORTED , &pwm->flags)) +pwm_unexport_child (parent, pwm); + } +} +static int __init pwm_sysfs_init (void ) {return class_register (&pwm_class);
include/linux/pwm.h +5 -0
@@ -299,6 +299,7 @@ static inline void pwm_add_table(struct#ifdef CONFIG_PWM_SYSFS void pwmchip_sysfs_export (struct pwm_chip *chip);void pwmchip_sysfs_unexport (struct pwm_chip *chip); +void pwmchip_sysfs_unexport_children (struct pwm_chip *chip);#else static inline void pwmchip_sysfs_export (struct pwm_chip *chip) {
@@ -307,6 +308,10 @@ static inline void pwmchip_sysfs_export(static inline void pwmchip_sysfs_unexport (struct pwm_chip *chip) { } + +static inline void pwmchip_sysfs_unexport_children (struct pwm_chip *chip) +{ +}#endif /* CONFIG_PWM_SYSFS */ #endif /* __LINUX_PWM_H */
PATCH 32/306 mb86a20s: fix the locking logic
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit dafb65fb98d85d8e78405e82c83e81975e5d5480 upstream.
On this frontend, it takes a while to start output normal TS data. That only happens on state S9. On S8, the TS output is enabled, but it is not reliable enough.
However, the zigzag loop is too fast to let it sync.
As, on practical tests, the zigzag software loop doesn't seem to be helping, but just slowing down the tuning, let's switch to hardware algorithm, as the tuners used on such devices are capable of work with frequency drifts without any help from software.
--- drivers/media/dvb-frontends/mb86a20s.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/mb86a20s.c +11 -1
@@ -321,7 +321,11 @@ static int mb86a20s_read_status(struct dif (val >=7 ) *status |=FE_HAS_SYNC ; -if (val >=8 )/* Maybe 9? */ +/* +* Actually, on state S8, it starts receiving TS, but the TS +* output is only on normal state after the transition to S9. +*/ +if (val >=9 ) *status |=FE_HAS_LOCK ; dev_dbg(&state->i2c->dev, "%s: Status = 0x%02x (state = %d)\n",
@@ -2080,6 +2084,11 @@ static void mb86a20s_release(struct dvb_kfree (state); } +static int mb86a20s_get_frontend_algo (struct dvb_frontend *fe) +{ +return DVBFE_ALGO_HW ; +} +static struct dvb_frontend_ops mb86a20s_ops; struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config,
@@ -2153,6 +2162,7 @@ static struct dvb_frontend_ops mb86a20s_ .read_status = mb86a20s_read_status_and_stats, .read_signal_strength = mb86a20s_read_signal_strength_from_cache, .tune = mb86a20s_tune, + .get_frontend_algo = mb86a20s_get_frontend_algo, };MODULE_DESCRIPTION ("DVB Frontend module for Fujitsu mb86A20s hardware" );
PATCH 33/306 mb86a20s: fix demod settings
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 505a0ea706fc1db4381baa6c6bd2e596e730a55e upstream.
With the current settings, only one channel locks properly. That's likely because, when this driver was written, Brazil were still using experimental transmissions.
Change it to reproduce the settings used by the newer drivers. That makes it lock on other channels.
Tested with both PixelView SBTVD Hybrid (cx231xx-based) and C3Tech Digital Duo HDTV/SDTV (em28xx-based) devices.
--- drivers/media/dvb-frontends/mb86a20s.c | 92 ++++++++++++++++------------------ 1 file changed, 42 insertions(+), 50 deletions(-)
drivers/media/dvb-frontends/mb86a20s.c +42 -50
@@ -75,25 +75,27 @@ static struct regdata mb86a20s_init1[] = };static struct regdata mb86a20s_init2[] = { - {0x28 ,0x22 }, {0x29 ,0x00 }, {0x2a ,0x1f }, {0x2b ,0xf0 }, + {0x50 ,0xd1 }, {0x51 ,0x22 }, + {0x39 ,0x01 }, + {0x71 ,0x00 }, {0x3b ,0x21 }, - {0x3c ,0x38 }, + {0x3c ,0x3a }, {0x01 ,0x0d }, - {0x04 ,0x08 }, {0x05 ,0x03 }, + {0x04 ,0x08 }, {0x05 ,0x05 }, {0x04 ,0x0e }, {0x05 ,0x00 }, - {0x04 ,0x0f }, {0x05 ,0x37 }, - {0x04 ,0x0b }, {0x05 ,0x78 }, + {0x04 ,0x0f }, {0x05 ,0x14 }, + {0x04 ,0x0b }, {0x05 ,0x8c }, {0x04 ,0x00 }, {0x05 ,0x00 }, - {0x04 ,0x01 }, {0x05 ,0x1e }, - {0x04 ,0x02 }, {0x05 ,0x07 }, - {0x04 ,0x03 }, {0x05 ,0xd0 }, + {0x04 ,0x01 }, {0x05 ,0x07 }, + {0x04 ,0x02 }, {0x05 ,0x0f }, + {0x04 ,0x03 }, {0x05 ,0xa0 }, {0x04 ,0x09 }, {0x05 ,0x00 }, {0x04 ,0x0a }, {0x05 ,0xff }, - {0x04 ,0x27 }, {0x05 ,0x00 }, + {0x04 ,0x27 }, {0x05 ,0x64 }, {0x04 ,0x28 }, {0x05 ,0x00 }, - {0x04 ,0x1e }, {0x05 ,0x00 }, - {0x04 ,0x29 }, {0x05 ,0x64 }, - {0x04 ,0x32 }, {0x05 ,0x02 }, + {0x04 ,0x1e }, {0x05 ,0xff }, + {0x04 ,0x29 }, {0x05 ,0x0a }, + {0x04 ,0x32 }, {0x05 ,0x0a }, {0x04 ,0x14 }, {0x05 ,0x02 }, {0x04 ,0x04 }, {0x05 ,0x00 }, {0x04 ,0x05 }, {0x05 ,0x22 },
@@ -101,8 +103,6 @@ static struct regdata mb86a20s_init2[] = { 0x04, 0x07 }, { 0x05, 0xd8 }, { 0x04, 0x12 }, { 0x05, 0x00 }, { 0x04, 0x13 }, { 0x05, 0xff }, - { 0x04, 0x15 }, { 0x05, 0x4e }, - { 0x04, 0x16 }, { 0x05, 0x20 },/* * On this demod, when the bit count reaches the count below,
@@ -156,42 +156,36 @@ static struct regdata mb86a20s_init2[] = { 0x50, 0x51 }, { 0x51, 0x04 }, /* MER symbol 4 */ { 0x45, 0x04 }, /* CN symbol 4 */ { 0x48, 0x04 }, /* CN manual mode */ - + { 0x50, 0xd5 }, { 0x51, 0x01 }, { 0x50, 0xd6 }, { 0x51, 0x1f }, { 0x50, 0xd2 }, { 0x51, 0x03 }, - { 0x50, 0xd7 }, { 0x51, 0xbf }, - { 0x28, 0x74 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0xff }, - { 0x28, 0x46 }, { 0x29, 0x00 }, { 0x2a, 0x1a }, { 0x2b, 0x0c }, - - { 0x04, 0x40 }, { 0x05, 0x00 }, - { 0x28, 0x00 }, { 0x2b, 0x08 }, - { 0x28, 0x05 }, { 0x2b, 0x00 }, + { 0x50, 0xd7 }, { 0x51, 0x3f }, { 0x1c, 0x01 }, - { 0x28, 0x06 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x1f }, - { 0x28, 0x07 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x18 }, - { 0x28, 0x08 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x12 }, - { 0x28, 0x09 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x30 }, - { 0x28, 0x0a }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x37 }, - { 0x28, 0x0b }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x02 }, - { 0x28, 0x0c }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x09 }, - { 0x28, 0x0d }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x06 }, - { 0x28, 0x0e }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x7b }, - { 0x28, 0x0f }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x76 }, - { 0x28, 0x10 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x7d }, - { 0x28, 0x11 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x08 }, - { 0x28, 0x12 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0b }, - { 0x28, 0x13 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x00 }, - { 0x28, 0x14 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xf2 }, - { 0x28, 0x15 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xf3 }, - { 0x28, 0x16 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x05 }, - { 0x28, 0x17 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x16 }, - { 0x28, 0x18 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0f }, - { 0x28, 0x19 }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xef }, - { 0x28, 0x1a }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xd8 }, - { 0x28, 0x1b }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xf1 }, - { 0x28, 0x1c }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x3d }, - { 0x28, 0x1d }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x94 }, - { 0x28, 0x1e }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0xba }, + { 0x28, 0x06 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x03 }, + { 0x28, 0x07 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0d }, + { 0x28, 0x08 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x02 }, + { 0x28, 0x09 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x01 }, + { 0x28, 0x0a }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x21 }, + { 0x28, 0x0b }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x29 }, + { 0x28, 0x0c }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x16 }, + { 0x28, 0x0d }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x31 }, + { 0x28, 0x0e }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0e }, + { 0x28, 0x0f }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x4e }, + { 0x28, 0x10 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x46 }, + { 0x28, 0x11 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x0f }, + { 0x28, 0x12 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x56 }, + { 0x28, 0x13 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x35 }, + { 0x28, 0x14 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xbe }, + { 0x28, 0x15 }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0x84 }, + { 0x28, 0x16 }, { 0x29, 0x00 }, { 0x2a, 0x03 }, { 0x2b, 0xee }, + { 0x28, 0x17 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x98 }, + { 0x28, 0x18 }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x9f }, + { 0x28, 0x19 }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0xb2 }, + { 0x28, 0x1a }, { 0x29, 0x00 }, { 0x2a, 0x06 }, { 0x2b, 0xc2 }, + { 0x28, 0x1b }, { 0x29, 0x00 }, { 0x2a, 0x07 }, { 0x2b, 0x4a }, + { 0x28, 0x1c }, { 0x29, 0x00 }, { 0x2a, 0x01 }, { 0x2b, 0xbc }, + { 0x28, 0x1d }, { 0x29, 0x00 }, { 0x2a, 0x04 }, { 0x2b, 0xba }, + { 0x28, 0x1e }, { 0x29, 0x00 }, { 0x2a, 0x06 }, { 0x2b, 0x14 }, { 0x50, 0x1e }, { 0x51, 0x5d }, { 0x50, 0x22 }, { 0x51, 0x00 }, { 0x50, 0x23 }, { 0x51, 0xc8 },
@@ -200,9 +194,7 @@ static struct regdata mb86a20s_init2[] = { 0x50, 0x26 }, { 0x51, 0x00 }, { 0x50, 0x27 }, { 0x51, 0xc3 }, { 0x50, 0x39 }, { 0x51, 0x02 }, - { 0xec, 0x0f }, - { 0xeb, 0x1f }, - { 0x28, 0x6a }, { 0x29, 0x00 }, { 0x2a, 0x00 }, { 0x2b, 0x00 }, + { 0x50, 0xd5 }, { 0x51, 0x01 }, { 0xd0, 0x00 }, };
PATCH 34/306 cx231xx: don't return error on success
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 1871d718a9db649b70f0929d2778dc01bc49b286 upstream.
The cx231xx_set_agc_analog_digital_mux_select() callers expect it to return 0 or an error. Returning a positive value makes the first attempt to switch between analog/digital to fail.
--- drivers/media/usb/cx231xx/cx231xx-avcore.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/usb/cx231xx/cx231xx-avcore.c +4 -1
@@ -1260,7 +1260,10 @@ int cx231xx_set_agc_analog_digital_mux_s dev->board.agc_analog_digital_select_gpio, analog_or_digital); -return status; +if (status <0 ) +return status; + +return 0 ; }int cx231xx_enable_i2c_port_3 (struct cx231xx *dev,bool is_port_3)
PATCH 35/306 cx231xx: fix GPIOs for Pixelview SBTVD hybrid
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 24b923f073ac37eb744f56a2c7f77107b8219ab2 upstream.
This device uses GPIOs: 28 to switch between analog and digital modes: on digital mode, it should be set to 1.
The code that sets it on analog mode is OK, but it misses the logic that sets it on digital mode.
--- drivers/media/usb/cx231xx/cx231xx-cards.c | 2 +- drivers/media/usb/cx231xx/cx231xx-core.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/media/usb/cx231xx/cx231xx-cards.c +1 -1
@@ -489,7 +489,7 @@ struct cx231xx_board cx231xx_boards[] = .output_mode = OUT_MODE_VIP11, .demod_xfer_mode = 0, .ctl_pin_status_mask = 0xFFFFFFC4, - .agc_analog_digital_select_gpio = 0x00, /* According with PV cxPolaris.inf file */ + .agc_analog_digital_select_gpio = 0x1c, .tuner_sif_gpio = -1, .tuner_scl_gpio = -1, .tuner_sda_gpio = -1,
drivers/media/usb/cx231xx/cx231xx-core.c +2 -1
@@ -723,6 +723,7 @@ int cx231xx_set_mode(struct cx231xx *devbreak ;case CX231XX_BOARD_CNXT_RDE_253S :case CX231XX_BOARD_CNXT_RDU_253S : +case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID : errCode =cx231xx_set_agc_analog_digital_mux_select (dev,1 );break ;case CX231XX_BOARD_HAUPPAUGE_EXETER :
@@ -747,7 +748,7 @@ int cx231xx_set_mode(struct cx231xx *devcase CX231XX_BOARD_PV_PLAYTV_USB_HYBRID :case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL :case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC : - errCode =cx231xx_set_agc_analog_digital_mux_select (dev,0 ); + errCode =cx231xx_set_agc_analog_digital_mux_select (dev,0 );break ;default :break ;
PATCH 36/306 ext4: reinforce check of i_dtime when clearing high fields of uid and gid
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daeho Jeong <[email protected]>
commit 93e3b4e6631d2a74a8cf7429138096862ff9f452 upstream.
Now, ext4_do_update_inode() clears high 16-bit fields of uid/gid of deleted and evicted inode to fix up interoperability with old kernels. However, it checks only i_dtime of an inode to determine whether the inode was deleted and evicted, and this is very risky, because i_dtime can be used for the pointer maintaining orphan inode list, too. We need to further check whether the i_dtime is being used for the orphan inode list even if the i_dtime is not NULL.
We found that high 16-bit fields of uid/gid of inode are unintentionally and permanently cleared when the inode truncation is just triggered, but not finished, and the inode metadata, whose high uid/gid bits are cleared, is written on disk, and the sudden power-off follows that in order.
--- fs/ext4/inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/ext4/inode.c +4 -4
@@ -4422,14 +4422,14 @@ static int ext4_do_update_inode(handle_t* Fix up interoperability with old kernels. Otherwise, old inodes get * re-used with the upper 16 bits of the uid/gid intact */ -if (!ei->i_dtime) { +if (ei->i_dtime &&list_empty (&ei->i_orphan)) { + raw_inode->i_uid_high =0 ; + raw_inode->i_gid_high =0 ; + }else { raw_inode->i_uid_high =cpu_to_le16 (high_16_bits (i_uid)); raw_inode->i_gid_high =cpu_to_le16 (high_16_bits (i_gid)); - }else { - raw_inode->i_uid_high =0 ; - raw_inode->i_gid_high =0 ; } }else { raw_inode->i_uid_low =cpu_to_le16 (fs_high2lowuid (i_uid));
PATCH 37/306 pstore/core: drop cmpxchg based updates
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit d5a9bf0b38d2ac85c9a693c7fb851f74fd2a2494 upstream.
I have here a FPGA behind PCIe which exports SRAM which I use for pstore. Now it seems that the FPGA no longer supports cmpxchg based updates and writes back 0xff…ff and returns the same. This leads to crash during crash rendering pstore useless.
Since I doubt that there is much benefit from using cmpxchg() here, I am dropping this atomic access and use the spinlock based version.
--- fs/pstore/ram_core.c | 43 ++----------------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-)
fs/pstore/ram_core.c +2 -41
@@ -47,43 +47,10 @@ static inline size_t buffer_start(structreturn atomic_read (&prz->buffer->start); } -/* increase and wrap the start pointer, returning the old value */ -static size_t buffer_start_add_atomic (struct persistent_ram_zone *prz,size_t a) -{ -int old; -int new; - -do { - old =atomic_read (&prz->buffer->start); - new = old + a; -while (unlikely (new >= prz->buffer_size)) - new -= prz->buffer_size; - }while (atomic_cmpxchg (&prz->buffer->start, old, new) != old); - -return old; -} - -/* increase the size counter until it hits the max size */ -static void buffer_size_add_atomic (struct persistent_ram_zone *prz,size_t a) -{ -size_t old; -size_t new; - -if (atomic_read (&prz->buffer->size) == prz->buffer_size) -return ; - -do { - old =atomic_read (&prz->buffer->size); - new = old + a; -if (new > prz->buffer_size) - new = prz->buffer_size; - }while (atomic_cmpxchg (&prz->buffer->size, old, new) != old); -} -static DEFINE_RAW_SPINLOCK (buffer_lock);/* increase and wrap the start pointer, returning the old value */ -static size_t buffer_start_add_locked (struct persistent_ram_zone *prz,size_t a) +static size_t buffer_start_add (struct persistent_ram_zone *prz,size_t a) {int old;int new;
@@ -103,7 +70,7 @@ static size_t buffer_start_add_locked(st }/* increase the size counter until it hits the max size */ -static void buffer_size_add_locked (struct persistent_ram_zone *prz,size_t a) +static void buffer_size_add (struct persistent_ram_zone *prz,size_t a) {size_t old;size_t new;
@@ -124,9 +91,6 @@ exit:raw_spin_unlock_irqrestore (&buffer_lock, flags); } -static size_t (*buffer_start_add)(struct persistent_ram_zone *,size_t ) = buffer_start_add_atomic; -static void (*buffer_size_add)(struct persistent_ram_zone *,size_t ) = buffer_size_add_atomic; - static void notrace persistent_ram_encode_rs8(struct persistent_ram_zone *prz,uint8_t *data,size_t len,uint8_t *ecc) {
@@ -426,9 +390,6 @@ static void *persistent_ram_iomap(phys_areturn NULL ; } - buffer_start_add = buffer_start_add_locked; - buffer_size_add = buffer_size_add_locked; -if (memtype) va =ioremap (start, size);else
PATCH 38/306 pstore/ram: Use memcpy_toio instead of memcpy
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Furquan Shaikh <[email protected]>
commit 7e75678d23167c2527e655658a8ef36a36c8b4d9 upstream.
persistent_ram_update uses vmap / iomap based on whether the buffer is in memory region or reserved region. However, both map it as non-cacheable memory. For armv8 specifically, non-cacheable mapping requests use a memory type that has to be accessed aligned to the request size. memcpy() doesn't guarantee that.
--- fs/pstore/ram_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/ram_core.c +1 -1
@@ -263,7 +263,7 @@ static void notrace persistent_ram_updat const void *s, unsigned int start, unsigned int count) { struct persistent_ram_buffer *buffer = prz->buffer; -memcpy (buffer->data + start, s, count); +memcpy_toio (buffer->data + start, s, count);persistent_ram_update_ecc (prz, start, count); }
PATCH 39/306 pstore/ram: Use memcpy_fromio() to save old buffer
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Bresticker <[email protected]>
commit d771fdf94180de2bd811ac90cba75f0f346abf8d upstream.
The ramoops buffer may be mapped as either I/O memory or uncached memory. On ARM64, this results in a device-type (strongly-ordered) mapping. Since unnaligned accesses to device-type memory will generate an alignment fault (regardless of whether or not strict alignment checking is enabled), it is not safe to use memcpy(). memcpy_fromio() is guaranteed to only use aligned accesses, so use that instead.
--- fs/pstore/ram_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/pstore/ram_core.c +2 -2
@@ -286,8 +286,8 @@ void persistent_ram_save_old(struct pers } prz->old_log_size = size; -memcpy (prz->old_log, &buffer->data[start], size - start); -memcpy (prz->old_log + size - start, &buffer->data[0 ], start); +memcpy_fromio (prz->old_log, &buffer->data[start], size - start); +memcpy_fromio (prz->old_log + size - start, &buffer->data[0 ], start); } int notrace persistent_ram_write(struct persistent_ram_zone *prz,
PATCH 40/306 ipv4: accept u8 in IP_TOS ancillary data
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit e895cdce683161081e3626c4f5a5c55cb72089f8 upstream.
In commit f02db315b8d8 ("ipv4: IP_TOS and IP_TTL can be specified as ancillary data") Francesco added IP_TOS values specified as integer.
However, kernel sends to userspace (at recvmsg() time) an IP_TOS value in a single byte, when IP_RECVTOS is set on the socket.
It can be very useful to reflect all ancillary options as given by the kernel in a subsequent sendmsg(), instead of aborting the sendmsg() with EINVAL after Francesco patch.
So this patch extends IP_TOS ancillary to accept an u8, so that an UDP server can simply reuse same ancillary block without having to mangle it.
Jesper can then augment
https://github.com/netoptimizer/network-testing/blob/master/src/udp_example02.c
to add TOS reflection ;)
--- net/ipv4/ip_sockglue.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv4/ip_sockglue.c +5 -2
@@ -242,9 +242,12 @@ int ip_cmsg_send(struct net *net, struct ipc->ttl = val;break ;case IP_TOS : -if (cmsg->cmsg_len !=CMSG_LEN (sizeof (int ))) +if (cmsg->cmsg_len ==CMSG_LEN (sizeof (int ))) + val = *(int *)CMSG_DATA (cmsg); +else if (cmsg->cmsg_len ==CMSG_LEN (sizeof (u8))) + val = *(u8 *)CMSG_DATA (cmsg); +else return -EINVAL ; - val = *(int *)CMSG_DATA (cmsg);if (val <0 || val >255 )return -EINVAL ; ipc->tos = val;
PATCH 41/306 ARM: pxa: fix GPIO double shifts
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Robert Jarzmik <[email protected]>
commit ca26475bf02ed8562b9b46f91d3e8b52ec312541 upstream.
The commit 9bf448c66d4b ("ARM: pxa: use generic gpio operation instead of gpio register") from Oct 17, 2011, leads to the following static checker warning:
arch/arm/mach-pxa/spitz_pm.c:172 spitz_charger_wakeup()
warn: double left shift '!gpio_get_value(SPITZ_GPIO_KEY_INT)
<< (1 << ((SPITZ_GPIO_KEY_INT) & 31))'
As Dan reported, the value is shifted three times :
- once by gpio_get_value(), which returns either 0 or BIT(gpio)
- once by the shift operation '<<'
- a last time by GPIO_bit(gpio) which is BIT(gpio)
Therefore the calculation lead to a chained or operator of :
- (1 << gpio) << (1 << gpio) = (2^gpio)^gpio = 2 ^ (gpio * gpio)
It is be sheer luck the former statement works, only because each gpio used is strictly smaller than 6, and therefore 2^(gpio^2) never overflows a 32 bits value, and because it is used as a boolean value to check a gpio activation.
As the xxx_charger_wakeup() functions are used as a true/false detection mechanism, take that opportunity to change their prototypes from integer return value to boolean one.
gpio register")
--- arch/arm/mach-pxa/corgi_pm.c | 13 ++++--------- arch/arm/mach-pxa/include/mach/sharpsl_pm.h | 2 +- arch/arm/mach-pxa/sharpsl_pm.c | 2 +- arch/arm/mach-pxa/spitz_pm.c | 9 +++------ 4 files changed, 9 insertions(+), 17 deletions(-)
arch/arm/mach-pxa/corgi_pm.c +4 -9
@@ -131,16 +131,11 @@ static int corgi_should_wakeup(unsignedreturn is_resume; } -static unsigned long corgi_charger_wakeup (void ) +static bool corgi_charger_wakeup (void ) { -unsigned long ret; - - ret = (!gpio_get_value (CORGI_GPIO_AC_IN ) <<GPIO_bit (CORGI_GPIO_AC_IN )) - | (!gpio_get_value (CORGI_GPIO_KEY_INT ) - <<GPIO_bit (CORGI_GPIO_KEY_INT )) - | (!gpio_get_value (CORGI_GPIO_WAKEUP ) - <<GPIO_bit (CORGI_GPIO_WAKEUP )); -return ret; +return !gpio_get_value (CORGI_GPIO_AC_IN ) || + !gpio_get_value (CORGI_GPIO_KEY_INT ) || + !gpio_get_value (CORGI_GPIO_WAKEUP ); }unsigned long corgipm_read_devdata (int type)
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -744,7 +744,7 @@ static int sharpsl_off_charge_battery(vo time =RCNR ;while (1 ) {/* Check if any wakeup event had occurred */ -if (sharpsl_pm.machinfo->charger_wakeup () !=0 ) +if (sharpsl_pm.machinfo->charger_wakeup ())return 0 ;/* Check for timeout */ if ((RCNR - time) >SHARPSL_WAIT_CO_TIME )
arch/arm/mach-pxa/include/mach/sharpsl_pm.h +1 -1
@@ -34,7 +34,7 @@ struct sharpsl_charger_machinfo {#define SHARPSL_STATUS_LOCK 5#define SHARPSL_STATUS_CHRGFULL 6#define SHARPSL_STATUS_FATAL 7 -unsigned long (*charger_wakeup)(void ); +bool (*charger_wakeup)(void );int (*should_wakeup)(unsigned int resume_on_alarm);void (*backlight_limit)(int );int (*backlight_get_status) (void );
arch/arm/mach-pxa/spitz_pm.c +3 -6
@@ -165,13 +165,10 @@ static int spitz_should_wakeup(unsignedreturn is_resume; } -static unsigned long spitz_charger_wakeup (void ) +static bool spitz_charger_wakeup (void ) { -unsigned long ret; - ret = ((!gpio_get_value (SPITZ_GPIO_KEY_INT ) - <<GPIO_bit (SPITZ_GPIO_KEY_INT )) - |gpio_get_value (SPITZ_GPIO_SYNC )); -return ret; +return !gpio_get_value (SPITZ_GPIO_KEY_INT ) || +gpio_get_value (SPITZ_GPIO_SYNC ); }unsigned long spitzpm_read_devdata (int type)
PATCH 42/306 phy: sun4i-usb: Use spinlock to guard phyctl register access
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 919ab2524c52e5f801d8873f09145ce822cdd43a upstream.
The musb driver calls into this phy driver to disable/enable squelch detection. This function was introduced in 24fe86a617c5 ("phy: sun4i-usb:
Add a sunxi specific function for setting squelch-detect"). This function in turn calls sun4i_usb_phy_write, which uses a mutex to guard the common access register. Unfortunately musb does this in atomic context, which results in the following warning with lock debugging enabled:
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:97 in_atomic(): 1, irqs_disabled(): 128, pid: 96, name: kworker/0:2 CPU: 0 PID: 96 Comm: kworker/0:2 Not tainted 4.8.0-rc4-00181-gd502f8ad1c3e #13 Hardware name: Allwinner sun8i Family Workqueue: events musb_deassert_reset [<c010bc01>] (unwind_backtrace) from [<c0109237>] (show_stack+0xb/0xc) [<c0109237>] (show_stack) from [<c02a669b>] (dump_stack+0x67/0x74) [<c02a669b>] (dump_stack) from [<c05d68c9>] (mutex_lock+0x15/0x2c) [<c05d68c9>] (mutex_lock) from [<c02c3589>] (sun4i_usb_phy_write+0x39/0xec) [<c02c3589>] (sun4i_usb_phy_write) from [<c03e6327>] (musb_port_reset+0xfb/0x184) [<c03e6327>] (musb_port_reset) from [<c03e4917>] (musb_deassert_reset+0x1f/0x2c) [<c03e4917>] (musb_deassert_reset) from [<c012ecb5>] (process_one_work+0x129/0x2b8) [<c012ecb5>] (process_one_work) from [<c012f5e3>] (worker_thread+0xf3/0x424) [<c012f5e3>] (worker_thread) from [<c0132dbd>] (kthread+0xa1/0xb8) [<c0132dbd>] (kthread) from [<c0105f31>] (ret_from_fork+0x11/0x20)
Since the register access is mmio, we can use a spinlock to guard this specific access, rather than the mutex that guards the entire phy.
--- drivers/phy/phy-sun4i-usb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/phy/phy-sun4i-usb.c +7 -4
@@ -32,6 +32,7 @@#include <linux/platform_device.h> #include <linux/regulator/consumer.h> #include <linux/reset.h> +#include <linux/spinlock.h> #define REG_ISCR 0x00#define REG_PHYCTL 0x04
@@ -62,7 +63,7 @@ struct sun4i_usb_phy_data { void __iomem *base; - struct mutex mutex; + spinlock_t reg_lock; /* guard access to phyctl reg */ int num_phys; u32 disc_thresh; struct sun4i_usb_phy {
@@ -83,9 +84,10 @@ static void sun4i_usb_phy_write(struct s {struct sun4i_usb_phy_data *phy_data =to_sun4i_usb_phy_data (phy);u32 temp, usbc_bit =BIT (phy->index *2 ); +unsigned long flags;int i; -mutex_lock (&phy_data->mutex); +spin_lock_irqsave (&phy_data->reg_lock, flags);for (i =0 ; i < len; i++) { temp =readl (phy_data->base +REG_PHYCTL );
@@ -117,7 +119,8 @@ static void sun4i_usb_phy_write(struct s data >>=1 ; } -mutex_unlock (&phy_data->mutex); + +spin_unlock_irqrestore (&phy_data->reg_lock, flags); }static void sun4i_usb_phy_passby (struct sun4i_usb_phy *phy,int enable)
@@ -232,7 +235,7 @@ static int sun4i_usb_phy_probe(struct plif (!data)return -ENOMEM ; -mutex_init (&data->mutex); +spin_lock_init (&data->reg_lock);if (of_device_is_compatible (np,"allwinner,sun5i-a13-usb-phy" )) data->num_phys =2 ;
PATCH 43/306 xfs: change mailing list address
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit 541d48f05fa1c19a4a968d38df685529e728a20a upstream.
oss.sgi.com is going away, move contact details over to vger.
[bwh: Backported to 3.16: Also update the git URL, done upstream in commit
9f273c24ec5f "MAINTAINERS: add/fix git URLs for various subsystems"]
---
MAINTAINERS +4 -5
@@ -10057,12 +10057,11 @@ F: arch/x86/xen/*swiotlb* F: drivers/xen/*swiotlb* XFS FILESYSTEM -P: Silicon Graphics Inc M: Dave Chinner <[email protected]> -M: [email protected] -L: [email protected] -W: http://oss.sgi.com/projects/xfs -T: git git://oss.sgi.com/xfs/xfs.git +M: [email protected] +L: [email protected] +W: http://xfs.org/ +T: git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git S: Supported F: Documentation/filesystems/xfs.txt F: fs/xfs/
Re: [PATCH 3.16 043/306] xfs: change mailing list address
Quoted 21 lines · Ben Hutchings
3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
541d48f05fa1c19a4a968d38df685529e728a20aupstream.oss.sgi.com is going away, move contact details over to vger.
Signed-off-by Dave Chinner <[email protected]>[bwh: Backported to 3.16: Also update the git URL, done upstream in commit
9f273c24ec5f"MAINTAINERS: add/fix git URLs for various subsystems"]Signed-off-by Ben Hutchings <[email protected]>---
MAINTAINERS +0
-0@@ -10057,12 +10057,11 @@ F: arch/x86/xen/*swiotlb* F: drivers/xen/*swiotlb* XFS FILESYSTEM
MAINTAINERS F: arch/x86/xen/*swiotlb* · line 10064
Quoted 10 lines
MAINTAINERS +4
-5-P: Silicon Graphics Inc M: Dave Chinner <[email protected]> -M: [email protected] -L: [email protected] -W: http://oss.sgi.com/projects/xfs -T: git git://oss.sgi.com/xfs/xfs.git +M: [email protected] +L: [email protected] +W: http://xfs.org/ +T: git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git
This is already out of date:
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Re: [PATCH 3.16 043/306] xfs: change mailing list address
Quoted 35 lines · Dave Chinner
Quoted 23 lines · Ben Hutchings
3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit
541d48f05fa1c19a4a968d38df685529e728a20aupstream.oss.sgi.com is going away, move contact details over to vger.
Signed-off-by Dave Chinner <[email protected]>[bwh: Backported to 3.16: Also update the git URL, done upstream in commit
9f273c24ec5f"MAINTAINERS: add/fix git URLs for various subsystems"]Signed-off-by Ben Hutchings <[email protected]>---
MAINTAINERS +0
-0@@ -10057,12 +10057,11 @@ F: arch/x86/xen/*swiotlb*F:
drivers/xen/*swiotlb*
XFS FILESYSTEM
-P: Silicon Graphics Inc
M: Dave Chinner <[email protected]>MAINTAINERS F: arch/x86/xen/*swiotlb* · line 10064
Quoted 8 lines
MAINTAINERS +4
-4-M: [email protected] -L: [email protected] -W: http://oss.sgi.com/projects/xfs -T: git git://oss.sgi.com/xfs/xfs.git +M: [email protected] +L: [email protected] +W: http://xfs.org/ +T: git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.gitThis is already out of date:
But no-one thought to mark that commit for stable! Anyway I've queued it up for the next update to 3.16.
Ben.
Signature · 3 lines
Ben Hutchings Unix is many things to many people, but it's never been everything to anybody.
PATCH 44/306 dm: mark request_queue dead before destroying the DM device
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 3b785fbcf81c3533772c52b717f77293099498d3 upstream.
This avoids that new requests are queued while __dm_destroy() is in progress.
--- drivers/md/dm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/dm.c +5 -0
@@ -2407,6 +2407,7 @@ EXPORT_SYMBOL_GPL(dm_device_name);static void __dm_destroy (struct mapped_device *md,bool wait) { +struct request_queue *q = md->queue;struct dm_table *map;int srcu_idx;
@@ -2417,6 +2418,10 @@ static void __dm_destroy(struct mapped_dset_bit (DMF_FREEING , &md->flags);spin_unlock (&_minor_lock); +spin_lock_irq (q->queue_lock); +queue_flag_set (QUEUE_FLAG_DYING , q); +spin_unlock_irq (q->queue_lock); +/* * Take suspend_lock so that presuspend and postsuspend methods * do not race with internal suspend.
PATCH 45/306 dm mpath: check if path's request_queue is dying in activate_path()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit f10e06b744074824fb8ec7066bc03ecc90918f5b upstream.
If pg_init_retries is set and a request is queued against a multipath device with all underlying block device request_queues in the "dying" state then an infinite loop is triggered because activate_path() never succeeds and hence never calls pg_init_done().
This change avoids that device removal triggers an infinite loop by failing the activate_path() which causes the "dying" path to be failed.
--- drivers/md/dm-mpath.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/dm-mpath.c +3 -3
@@ -1196,10 +1196,10 @@ static void activate_path(struct work_st {struct pgpath *pgpath = container_of(work, struct pgpath, activate_path.work); +struct request_queue *q =bdev_get_queue (pgpath->path.dev->bdev); -if (pgpath->is_active) -scsi_dh_activate (bdev_get_queue (pgpath->path.dev->bdev), - pg_init_done, pgpath); +if (pgpath->is_active && !blk_queue_dying (q)) +scsi_dh_activate (q, pg_init_done, pgpath);else pg_init_done (pgpath,SCSI_DH_DEV_OFFLINED ); }
PATCH 46/306 ext4: bugfix for mmaped pages in mpage_release_unused_pages()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: wangguang <[email protected]>
commit 4e800c0359d9a53e6bf0ab216954971b2515247f upstream.
Pages clear buffers after ext4 delayed block allocation failed, However, it does not clean its pte_dirty flag.
if the pages unmap ,in cording to the pte_dirty , unmap_page_range may try to call __set_page_dirty,
which may lead to the bugon at mpage_prepare_extent_to_map:head = page_buffers(page);.
This patch just call clear_page_dirty_for_io to clean pte_dirty at mpage_release_unused_pages for pages mmaped.
Steps to reproduce the bug:
(1) mmap a file in ext4
addr = (char *)mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); memset(addr, 'i', 4096);
(2) return EIO at
ext4_writepages->mpage_map_and_submit_extent->mpage_map_one_extent
which causes this log message to be print:
ext4_msg(sb, KERN_CRIT,
"Delayed block allocation failed for "
"inode %lu at logical offset %llu with"
" max blocks %u with error %d",
inode->i_ino,
(unsigned long long)map->m_lblk,
(unsigned)map->m_len, -err);(3)Unmap the addr cause warning at
__set_page_dirty:WARN_ON_ONCE(warn && !PageUptodate(page));
(4) wait for a minute,then bugon happen.
--- fs/ext4/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ext4/inode.c +2 -0
@@ -1494,6 +1494,8 @@ static void mpage_release_unused_pages(sBUG_ON (!PageLocked (page));BUG_ON (PageWriteback (page));if (invalidate) { +if (page_mapped (page)) +clear_page_dirty_for_io (page);block_invalidatepage (page,0 ,PAGE_CACHE_SIZE );ClearPageUptodate (page); }
PATCH 47/306 arc: don't leak bits of kernel stack into coredump
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 7798bf2140ebcc36eafec6a4194fffd8d585d471 upstream.
On faulting sigreturn we do get SIGSEGV, all right, but anything we'd put into pt_regs could end up in the coredump. And since __copy_from_user() never zeroed on arc, we'd better bugger off on its failure without copying random uninitialized bits of kernel stack into pt_regs...
[bwh: Backported to 3.16:
- Adjust context
- Don't change the single return statement]
--- arch/arc/kernel/signal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arc/kernel/signal.c +4 -3
@@ -80,11 +80,12 @@ static int restore_usr_regs(struct pt_reint err; err =__copy_from_user (&set, &sf->uc.uc_sigmask,sizeof (set)); -if (!err) -set_current_blocked (&set); - err |=__copy_from_user (regs, &(sf->uc.uc_mcontext.regs.scratch),sizeof (sf->uc.uc_mcontext.regs.scratch)); +if (err) +return err; + +set_current_blocked (&set);return err; }
PATCH 48/306 ARM: dts: exynos: Fix mismatched value for SD4 pull up/down configuration on exynos4210
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit f7061ffb44116490f282f130a220ca2d10849248 upstream.
The pinctrl pull up/down register on exynos4210 is 2-bit wide for each pin and it accepts only values of 0, 1 and 3. The pins sd4-bus-width8 were configured with value of 4. The driver does not validate the value so this overflow effectively set a bit 1 in adjacent pins thus configuring them to pull down.
The author's intention was probably to set drive strength of 4x. All other bus-widths pins are configured with pull up and drive strength of 4x. Fix this one with same pattern.
--- arch/arm/boot/dts/exynos4210-pinctrl.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4210-pinctrl.dtsi +1 -1
@@ -647,7 +647,7 @@ sd4_bus8: sd4-bus-width8 { samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; samsung,pin-function = <3>; - samsung,pin-pud = <4>; + samsung,pin-pud = <3>; samsung,pin-drv = <3>; };
PATCH 49/306 reiserfs: Unlock superblock before calling reiserfs_quota_on_mount()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mike Galbraith <[email protected]>
commit 420902c9d086848a7548c83e0a49021514bd71b7 upstream.
If we hold the superblock lock while calling reiserfs_quota_on_mount(), we can deadlock our own worker - mount blocks kworker/3:2, sleeps forever more.
crash> ps|grep UN
715 2 3 ffff880220734d30 UN 0.0 0 0 [kworker/3:2] 9369 9341 2 ffff88021ffb7560 UN 1.3 493404 123184 Xorg 9665 9664 3 ffff880225b92ab0 UN 0.0 47368 812 udisks-daemon 10635 10403 3 ffff880222f22c70 UN 0.0 14904 936 mount
crash> bt ffff880220734d30
PID: 715 TASK: ffff880220734d30 CPU: 3 COMMAND: "kworker/3:2"
#0 [ffff8802244c3c20] schedule at ffffffff8144584b
#1 [ffff8802244c3cc8] __rt_mutex_slowlock at ffffffff814472b3 #2 [ffff8802244c3d28] rt_mutex_slowlock at ffffffff814473f5 #3 [ffff8802244c3dc8] reiserfs_write_lock at ffffffffa05f28fd [reiserfs] #4 [ffff8802244c3de8] flush_async_commits at ffffffffa05ec91d [reiserfs] #5 [ffff8802244c3e08] process_one_work at ffffffff81073726 #6 [ffff8802244c3e68] worker_thread at ffffffff81073eba
#7 [ffff8802244c3ec8] kthread at ffffffff810782e0
#8 [ffff8802244c3f48] kernel_thread_helper at ffffffff81450064
crash> rd ffff8802244c3cc8 10
ffff8802244c3cc8: ffffffff814472b3 ffff880222f23250 .rD.....P2."....
ffff8802244c3cd8: 0000000000000000 0000000000000286 ................
ffff8802244c3ce8: ffff8802244c3d30 ffff880220734d80 0=L$.....Ms ....
ffff8802244c3cf8: ffff880222e8f628 0000000000000000 (.."............
ffff8802244c3d08: 0000000000000000 0000000000000002 ................
crash> struct rt_mutex ffff880222e8f628
struct rt_mutex {
wait_lock = {
raw_lock = {
slock = 65537
}
},
wait_list = {
node_list = {
next = 0xffff8802244c3d48,
prev = 0xffff8802244c3d48
} },
owner = 0xffff880222f22c71,
save_state = 0
}
crash> bt 0xffff880222f22c70
PID: 10635 TASK: ffff880222f22c70 CPU: 3 COMMAND: "mount"
#0 [ffff8802216a9868] schedule at ffffffff8144584b
#1 [ffff8802216a9910] schedule_timeout at ffffffff81446865 #2 [ffff8802216a99a0] wait_for_common at ffffffff81445f74
#3 [ffff8802216a9a30] flush_work at ffffffff810712d3
#4 [ffff8802216a9ab0] schedule_on_each_cpu at ffffffff81074463 #5 [ffff8802216a9ae0] invalidate_bdev at ffffffff81178aba
#6 [ffff8802216a9af0] vfs_load_quota_inode at ffffffff811a3632 #7 [ffff8802216a9b50] dquot_quota_on_mount at ffffffff811a375c #8 [ffff8802216a9b80] finish_unfinished at ffffffffa05dd8b0 [reiserfs] #9 [ffff8802216a9cc0] reiserfs_fill_super at ffffffffa05de825 [reiserfs]
RIP: 00007f7b9303997a RSP: 00007ffff443c7a8 RFLAGS: 00010202
RAX: 00000000000000a5 RBX: ffffffff8144ef12 RCX: 00007f7b932e9ee0
RDX: 00007f7b93d9a400 RSI: 00007f7b93d9a3e0 RDI: 00007f7b93d9a3c0
RBP: 00007f7b93d9a2c0 R8: 00007f7b93d9a550 R9: 0000000000000001
R10: ffffffffc0ed040e R11: 0000000000000202 R12: 000000000000040e
R13: 0000000000000000 R14: 00000000c0ed040e R15: 00007ffff443ca20
ORIG_RAX: 00000000000000a5 CS: 0033 SS: 002b--- fs/reiserfs/super.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/reiserfs/super.c +11 -1
@@ -189,7 +189,15 @@ static int remove_save_link_only(structstatic int reiserfs_quota_on_mount (struct super_block *,int );#endif -/* look for uncompleted unlinks and truncates and complete them */ +/* +* Look for uncompleted unlinks and truncates and complete them +* +* Called with superblock write locked. If quotas are enabled, we have to +* release/retake lest we call dquot_quota_on_mount(), proceed to +* schedule_on_each_cpu() in invalidate_bdev() and deadlock waiting for the per +* cpu worklets to complete flush_async_commits() that in turn wait for the +* superblock write lock. +*/ static int finish_unfinished (struct super_block *s) {INITIALIZE_PATH (path);
@@ -236,7 +244,9 @@ static int finish_unfinished(struct supe quota_enabled[i] =0 ;continue ; } +reiserfs_write_unlock (s); ret =reiserfs_quota_on_mount (s, i); +reiserfs_write_lock (s);if (ret <0 )reiserfs_warning (s,"reiserfs-2500" , "cannot turn on journaled "
PATCH 50/306 sctp: do not return the transmit err back to sctp_sendmsg
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
commit 66388f2c08dfa38071f9eceae7bb29060d9be9aa upstream.
Once a chunk is enqueued successfully, sctp queues can take care of it. Even if it is failed to transmit (like because of nomem), it should be put into retransmit queue.
If sctp report this error to users, it confuses them, they may resend that msg, but actually in kernel sctp stack is in charge of retransmit it already.
Besides, this error probably is not from the failure of transmitting current msg, but transmitting or retransmitting another msg's chunks, as sctp_outq_flush just tries to send out all transports' chunks.
This patch is to make sctp_cmd_send_msg return avoid, and not return the transmit err back to sctp_sendmsg
--- net/sctp/sm_sideeffect.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
net/sctp/sm_sideeffect.c +5 -11
@@ -1028,19 +1028,13 @@ static void sctp_cmd_t1_timer_update(str* This way the whole message is queued up and bundling if * encouraged for small fragments. */ -static int sctp_cmd_send_msg (struct sctp_association *asoc, -struct sctp_datamsg *msg) +static void sctp_cmd_send_msg (struct sctp_association *asoc, +struct sctp_datamsg *msg) {struct sctp_chunk *chunk; -int error =0 ; -list_for_each_entry (chunk, &msg->chunks, frag_list) { - error =sctp_outq_tail (&asoc->outqueue, chunk); -if (error) -break ; - } - -return error; +list_for_each_entry (chunk, &msg->chunks, frag_list) +sctp_outq_tail (&asoc->outqueue, chunk); }
@@ -1714,7 +1708,7 @@ static int sctp_cmd_interpreter(sctp_evesctp_outq_cork (&asoc->outqueue); local_cork =1 ; } - error =sctp_cmd_send_msg (asoc, cmd->obj.msg); +sctp_cmd_send_msg (asoc, cmd->obj.msg);break ;case SCTP_CMD_SEND_NEXT_ASCONF :sctp_cmd_send_asconf (asoc);
PATCH 51/306 pkt_sched: fq: use proper locking in fq_dump_stats()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 695b4ec0f0a9cf29deabd3ac075911d58b31f42b upstream.
When fq is used on 32bit kernels, we need to lock the qdisc before copying 64bit fields.
Otherwise "tc -s qdisc ..." might report bogus values.
--- net/sched/sch_fq.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
net/sched/sch_fq.c +18 -14
@@ -789,20 +789,24 @@ nla_put_failure:static int fq_dump_stats (struct Qdisc *sch,struct gnet_dump *d) {struct fq_sched_data *q =qdisc_priv (sch); -u64 now =ktime_to_ns (ktime_get ()); -struct tc_fq_qd_stats st = { - .gc_flows = q->stat_gc_flows, - .highprio_packets = q->stat_internal_packets, - .tcp_retrans = q->stat_tcp_retrans, - .throttled = q->stat_throttled, - .flows_plimit = q->stat_flows_plimit, - .pkts_too_long = q->stat_pkts_too_long, - .allocation_errors = q->stat_allocation_errors, - .flows = q->flows, - .inactive_flows = q->inactive_flows, - .throttled_flows = q->throttled_flows, - .time_next_delayed_flow = q->time_next_delayed_flow - now, - }; +struct tc_fq_qd_stats st; + +sch_tree_lock (sch); + + st.gc_flows = q->stat_gc_flows; + st.highprio_packets = q->stat_internal_packets; + st.tcp_retrans = q->stat_tcp_retrans; + st.throttled = q->stat_throttled; + st.flows_plimit = q->stat_flows_plimit; + st.pkts_too_long = q->stat_pkts_too_long; + st.allocation_errors = q->stat_allocation_errors; + st.time_next_delayed_flow = q->time_next_delayed_flow -ktime_to_ns (ktime_get ()); + st.flows = q->flows; + st.inactive_flows = q->inactive_flows; + st.throttled_flows = q->throttled_flows; + st.pad =0 ; + +sch_tree_unlock (sch);return gnet_stats_copy_app (d, &st,sizeof (st)); }
PATCH 52/306 iommu/amd: Free domain id when free a domain of struct dma_ops_domain
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Baoquan He <[email protected]>
commit c3db901c54466a9c135d1e6e95fec452e8a42666 upstream.
The current code missed freeing domain id when free a domain of struct dma_ops_domain.
--- drivers/iommu/amd_iommu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iommu/amd_iommu.c +3 -0
@@ -2037,6 +2037,9 @@ static void dma_ops_domain_free(struct dkfree (dom->aperture[i]); } +if (dom->domain.id) +domain_id_free (dom->domain.id); +kfree (dom); }
PATCH 53/306 scsi: ibmvfc: Fix I/O hang when port is not mapped
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Brian King <[email protected]>
commit 07d0e9a847401ffd2f09bd450d41644cd090e81d upstream.
If a VFC port gets unmapped in the VIOS, it may not respond with a CRQ init complete following H_REG_CRQ. If this occurs, we can end up having called scsi_block_requests and not a resulting unblock until the init complete happens, which may never occur, and we end up hanging I/O requests. This patch ensures the host action stay set to IBMVFC_HOST_ACTION_TGT_DEL so we move all rports into devloss state and unblock unless we receive an init complete.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/ibmvscsi/ibmvfc.c +0 -1
@@ -717,7 +717,6 @@ static int ibmvfc_reset_crq(struct ibmvfspin_lock_irqsave (vhost->host->host_lock, flags); vhost->state =IBMVFC_NO_CRQ ; vhost->logged_in =0 ; -ibmvfc_set_host_action (vhost,IBMVFC_HOST_ACTION_NONE );/* Clean out the queue */ memset (crq->msgs,0 ,PAGE_SIZE );
PATCH 54/306 powerpc/nvram: Fix an incorrect partition merge
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pan Xinhui <[email protected]>
commit 11b7e154b132232535befe51c55db048069c8461 upstream.
When we merge two contiguous partitions whose signatures are marked NVRAM_SIG_FREE, We need update prev's length and checksum, then write it to nvram, not cur's. So lets fix this mistake now.
Also use memset instead of strncpy to set the partition's name. It's more readable if we want to fill up with duplicate chars .
--- arch/powerpc/kernel/nvram_64.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/nvram_64.c +3 -3
@@ -292,7 +292,7 @@ int __init nvram_remove_partition(const/* Make partition a free partition */ part->header.signature =NVRAM_SIG_FREE ; -strncpy (part->header.name,"wwwwwwwwwwww" ,12 ); +memset (part->header.name,'w' ,12 ); part->header.checksum =nvram_checksum (&part->header); rc =nvram_write_header (part);if (rc <=0 ) {
@@ -310,8 +310,8 @@ int __init nvram_remove_partition(const }if (prev) { prev->header.length += part->header.length; - prev->header.checksum =nvram_checksum (&part->header); - rc =nvram_write_header (part); + prev->header.checksum =nvram_checksum (&prev->header); + rc =nvram_write_header (prev);if (rc <=0 ) {printk (KERN_ERR "nvram_remove_partition: nvram_write failed (%d)\n" , rc);return rc;
PATCH 55/306 ALSA: ali5451: Fix out-of-bound position reporting
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit db68577966abc1aeae4ec597b3dcfa0d56e92041 upstream.
The pointer callbacks of ali5451 driver may return the value at the boundary occasionally, and it results in the kernel warning like
snd_ali5451 0000:00:06.0: BUG: , pos = 16384, buffer size = 16384, period size = 1024
It seems that folding the position offset is enough for fixing the warning and no ill-effect has been seen by that.
--- sound/pci/ali5451/ali5451.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/ali5451/ali5451.c +2 -0
@@ -1408,6 +1408,7 @@ snd_ali_playback_pointer(struct snd_pcm_spin_unlock (&codec->reg_lock);dev_dbg (codec->card->dev,"playback pointer returned cso=%xh.\n" , cso); + cso %= runtime->buffer_size;return cso; }
@@ -1428,6 +1429,7 @@ static snd_pcm_uframes_t snd_ali_pointer cso =inw (ALI_REG (codec,ALI_CSO_ALPHA_FMS +2 ));spin_unlock (&codec->reg_lock); + cso %= runtime->buffer_size;return cso; }
PATCH 56/306 usb: misc: legousbtower: Fix NULL pointer deference
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 2fae9e5a7babada041e2e161699ade2447a01989 upstream.
This patch fixes a NULL pointer dereference caused by a race codition in the probe function of the legousbtower driver. It re-structures the probe function to only register the interface after successfully reading the board's firmware ID.
The probe function does not deregister the usb interface after an error receiving the devices firmware ID. The device file registered (/dev/usb/legousbtower%d) may be read/written globally before the probe function returns. When tower_delete is called in the probe function (after an r/w has been initiated), core dev structures are deleted while the file operation functions are still running. If the 0 address is mappable on the machine, this vulnerability can be used to create a Local Priviege Escalation exploit via a write-what-where condition by remapping dev->interrupt_out_buffer in tower_write. A forged USB device and local program execution would be required for LPE. The USB device would have to delay the control message in tower_probe and accept the control urb in tower_open whilst guest code initiated a write to the device file as tower_delete is called from the error in tower_probe.
This bug has existed since 2003. Patch tested by emulated device.
--- drivers/usb/misc/legousbtower.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-)
drivers/usb/misc/legousbtower.c +17 -18
@@ -898,24 +898,6 @@ static int tower_probe (struct usb_inter dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval; dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval; -/* we can register the device now, as it is ready */ -usb_set_intfdata (interface, dev); - - retval =usb_register_dev (interface, &tower_class); - -if (retval) { -/* something prevented us from registering this driver */ -dev_err (idev,"Not able to get a minor for this device.\n" ); -usb_set_intfdata (interface,NULL ); - goto error; - } - dev->minor = interface->minor; - -/* let the user know what node this device is now attached to */ -dev_info (&interface->dev,"LEGO USB Tower #%d now attached to major " -"%d minor %d\n" , (dev->minor -LEGO_USB_TOWER_MINOR_BASE ), -USB_MAJOR , dev->minor); -/* get the firmware version and log it */ result = usb_control_msg (udev, usb_rcvctrlpipe(udev, 0),
@@ -936,6 +918,23 @@ static int tower_probe (struct usb_inter get_version_reply.minor, le16_to_cpu(get_version_reply.build_no)); +/* we can register the device now, as it is ready */ +usb_set_intfdata (interface, dev); + + retval =usb_register_dev (interface, &tower_class); + +if (retval) { +/* something prevented us from registering this driver */ +dev_err (idev,"Not able to get a minor for this device.\n" ); +usb_set_intfdata (interface,NULL ); + goto error; + } + dev->minor = interface->minor; + +/* let the user know what node this device is now attached to */ +dev_info (&interface->dev,"LEGO USB Tower #%d now attached to major " +"%d minor %d\n" , (dev->minor -LEGO_USB_TOWER_MINOR_BASE ), +USB_MAJOR , dev->minor); exit:return retval;
PATCH 57/306 net/mlx4_en: Fix wrong indentation
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kamal Heib <[email protected]>
commit 57c970c2e8d8772237294bb8a6a25a205448fd96 upstream.
Use tabs instead of spaces before if statement, no functional change.
--- drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_rx.c +1 -1
@@ -835,7 +835,7 @@ int mlx4_en_process_rx_cq(struct net_dev goto next; } -if (unlikely (priv->validate_loopback)) { +if (unlikely (priv->validate_loopback)) {validate_loopback (priv, skb); goto next; }
PATCH 58/306 net/mlx4_core: Fix deadlock when switching between polling and event fw commands
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit a7e1f04905e5b2b90251974dddde781301b6be37 upstream.
When switching from polling-based fw commands to event-based fw commands, there is a race condition which could cause a fw command in another task to hang: that task will keep waiting for the polling sempahore, but may never be able to acquire it. This is due to mlx4_cmd_use_events, which "down"s the sempahore back to 0.
During driver initialization, this is not a problem, since no other tasks which invoke FW commands are active.
However, there is a problem if the driver switches to polling mode and then back to event mode during normal operation.
The "test_interrupts" feature does exactly that. Running "ethtool -t <eth device> offline" causes the PF driver to temporarily switch to polling mode, and then back to event mode. (Note that for VF drivers, such switching is not performed).
Fix this by adding a read-write semaphore for protection when switching between modes.
--- drivers/net/ethernet/mellanox/mlx4/cmd.c | 23 +++++++++++++++++------ drivers/net/ethernet/mellanox/mlx4/mlx4.h | 2 ++ 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx4/cmd.c +17 -6
@@ -606,14 +606,20 @@ int __mlx4_cmd(struct mlx4_dev *dev, u64return -EIO ;if (!mlx4_is_mfunc (dev) || (native &&mlx4_is_master (dev))) { +int ret; + +down_read (&mlx4_priv (dev)->cmd.switch_sem);if (mlx4_priv (dev)->cmd.use_events) -return mlx4_cmd_wait (dev, in_param, out_param, - out_is_imm, in_modifier, - op_modifier, op, timeout); + ret =mlx4_cmd_wait (dev, in_param, out_param, + out_is_imm, in_modifier, + op_modifier, op, timeout);else -return mlx4_cmd_poll (dev, in_param, out_param, - out_is_imm, in_modifier, - op_modifier, op, timeout); + ret =mlx4_cmd_poll (dev, in_param, out_param, + out_is_imm, in_modifier, + op_modifier, op, timeout); + +up_read (&mlx4_priv (dev)->cmd.switch_sem); +return ret; }return mlx4_slave_cmd (dev, in_param, out_param, out_is_imm, in_modifier, op_modifier, op, timeout);
@@ -2092,6 +2098,7 @@ int mlx4_cmd_init(struct mlx4_dev *dev) {struct mlx4_priv *priv =mlx4_priv (dev); +init_rwsem (&priv->cmd.switch_sem);mutex_init (&priv->cmd.hcr_mutex);mutex_init (&priv->cmd.slave_cmd_mutex);sema_init (&priv->cmd.poll_sem,1 );
@@ -2188,6 +2195,7 @@ int mlx4_cmd_use_events(struct mlx4_devif (!priv->cmd.context)return -ENOMEM ; +down_write (&priv->cmd.switch_sem);for (i =0 ; i < priv->cmd.max_cmds; ++i) { priv->cmd.context[i].token = i; priv->cmd.context[i].next = i +1 ;
@@ -2207,6 +2215,7 @@ int mlx4_cmd_use_events(struct mlx4_devdown (&priv->cmd.poll_sem); priv->cmd.use_events =1 ; +up_write (&priv->cmd.switch_sem);return err; }
@@ -2219,6 +2228,7 @@ void mlx4_cmd_use_polling(struct mlx4_destruct mlx4_priv *priv =mlx4_priv (dev);int i; +down_write (&priv->cmd.switch_sem); priv->cmd.use_events =0 ;for (i =0 ; i < priv->cmd.max_cmds; ++i)
@@ -2227,6 +2237,7 @@ void mlx4_cmd_use_polling(struct mlx4_dekfree (priv->cmd.context);up (&priv->cmd.poll_sem); +up_write (&priv->cmd.switch_sem); }struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox (struct mlx4_dev *dev)
drivers/net/ethernet/mellanox/mlx4/mlx4.h +2 -0
@@ -43,6 +43,7 @@#include <linux/timer.h> #include <linux/semaphore.h> #include <linux/workqueue.h> +#include <linux/rwsem.h> #include <linux/mlx4/device.h> #include <linux/mlx4/driver.h>
@@ -598,6 +599,7 @@ struct mlx4_cmd {struct mutex slave_cmd_mutex;struct semaphore poll_sem;struct semaphore event_sem; +struct rw_semaphore switch_sem;int max_cmds;spinlock_t context_lock;int free_head;
PATCH 59/306 drm/radeon: narrow asic_init for virtualization
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 884031f0aacf57dad1575f96714efc80de9b19cc upstream.
Only needed on CIK+ due to the way pci reset is handled by the GPU.
--- drivers/gpu/drm/radeon/radeon_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_device.c +3 -2
@@ -629,8 +629,9 @@ bool radeon_card_posted(struct radeon_de {uint32_t reg; -/* for pass through, always force asic_init */ -if (radeon_device_is_virtual ()) +/* for pass through, always force asic_init for CI */ +if (rdev->family >=CHIP_BONAIRE && +radeon_device_is_virtual ())return false;/* required for EFI mode on macbook2,1 which uses an r5xx asic */
PATCH 60/306 dvb-usb: avoid link error with dib3000m{b,c|
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit d0fe85e95f56a01a49e4893aa26263e8aee67eef upstream.
Tha ARM randconfig builds came up with another rare build failure for the dib3000mc driver, when dvb-usb-dibusb-mb is built-in and dib3000mc is a loadable module:
ERROR: "dibusb_dib3000mc_frontend_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!
ERROR: "dibusb_dib3000mc_tuner_attach" [drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!
Apparently this used to be a valid configuration (build-time, not run-time), but broke as part of a cleanup.
I tried reverting the cleanup, but saw that the code was still wrong then. This version adds a dependency for dib3000mb, to ensure that dib3000mb does not force the dibusb_dib3000mc_frontend_attach function to be built-in when dib3000mc is a loadable module.
I have also checked the two other files that were changed in the original cleanup, and found them to be correct in either version, so I do not touch that part.
As this is a rather obscure bug, there is no need for backports.
--- drivers/media/usb/dvb-usb/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/dvb-usb/Kconfig +1 -0
@@ -34,6 +34,7 @@ config DVB_USB_DIBUSB_MB depends on DVB_USB select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT select DVB_DIB3000MB + depends on DVB_DIB3000MC || !DVB_DIB3000MC select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT help Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by
Re: [PATCH 3.16 060/306] [media] dvb-usb: avoid link error with dib3000m{b,c|
Quoted 5 lines · Ben Hutchings
3.16.40-rc1 review patch. If anyone has any objections, please let me know.
From: Arnd Bergmann <[email protected]>
commit
d0fe85e95f56a01a49e4893aa26263e8aee67eefupstream.
...
Quoted 7 lines
As this is a rather obscure bug, there is no need for backports.
Fixes 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED")Signed-off-by Arnd Bergmann <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Ben Hutchings <[email protected]>
I'd probably drop this one. Nobody is going to care (it took me thousands of randconfig builds to even run into it), and the surrounding code has changed a few times, so I'm not completely sure it is still the right fix for 3.16 (it probably
is, but it's not worth the time to investigate more closely I think).
I also looked at the other backports from fixes I did in this series, they all look fine.
Arnd
Re: [PATCH 3.16 060/306] [media] dvb-usb: avoid link error with dib3000m{b,c|
Quoted 16 lines · Arnd Bergmann
Quoted 6 lines · Ben Hutchings
3.16.40-rc1 review patch. If anyone has any objections, please let me know.
From: Arnd Bergmann <[email protected]>
commit
d0fe85e95f56a01a49e4893aa26263e8aee67eefupstream....
Quoted 7 lines
As this is a rather obscure bug, there is no need for backports.
Fixes 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED")Signed-off-by Arnd Bergmann <[email protected]>Signed-off-by Mauro Carvalho Chehab <[email protected]>Signed-off-by Ben Hutchings <[email protected]>
Quoted 5 lines
I'd probably drop this one. Nobody is going to care (it took me thousands of randconfig builds to even run into it), and the surrounding code has changed a few times, so I'm not completely sure it is still the right fix for 3.16 (it probably
is, but it's not worth the time to investigate more closely I think).
OK, I've dropped it.
Quoted 2 lines
I also looked at the other backports from fixes I did in this series, they all look fine.
Thanks.
Ben.
Signature · 3 lines
Ben Hutchings The most exhausting thing in life is being insincere. - Anne Morrow Lindberg
PATCH 61/306 powerpc/eeh: Null check uses of eeh_pe_bus_get
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
commit 04fec21c06e35b169a83e75a84a015ab4606bf5e upstream.
eeh_pe_bus_get() can return NULL if a PCI bus isn't found for a given PE. Some callers don't check this, and can cause a null pointer dereference under certain circumstances.
Fix this by checking NULL everywhere eeh_pe_bus_get() is called.
--- arch/powerpc/kernel/eeh_driver.c | 8 ++++++++ arch/powerpc/platforms/powernv/eeh-ioda.c | 5 +++++ 2 files changed, 13 insertions(+)
arch/powerpc/kernel/eeh_driver.c +8 -0
@@ -828,6 +828,14 @@ static void eeh_handle_special_event(voi/* Notify all devices to be down */ bus =eeh_pe_bus_get (phb_pe); +if (!bus) { +pr_err ("%s: Cannot find PCI bus for " +"PHB#%d-PE#%x\n" , + __func__, + pe->phb->global_number, + pe->addr); +break ; + }eeh_pe_dev_traverse (pe, eeh_report_failure,NULL );pcibios_remove_pci_devices (bus);
arch/powerpc/platforms/powernv/eeh-ioda.c +5 -0
@@ -578,6 +578,11 @@ static int ioda_eeh_reset(struct eeh_pe ret =ioda_eeh_phb_reset (hose, option); }else { bus =eeh_pe_bus_get (pe); +if (!bus) { +pr_err ("%s: Cannot find PCI bus for PHB#%d-PE#%x\n" , + __func__, pe->phb->global_number, pe->addr); +return -EIO ; + }if (pci_is_root_bus (bus) ||pci_is_root_bus (bus->parent)) ret =ioda_eeh_root_reset (hose, option);
PATCH 62/306 ALSA: usb-audio: Extend DragonFly dB scale quirk to cover other variants
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Anssi Hannula <[email protected]>
commit eb1a74b7bea17eea31915c4f76385cefe69d9795 upstream.
The DragonFly quirk added in 42e3121d90f4 ("ALSA: usb-audio: Add a more accurate volume quirk for AudioQuest DragonFly") applies a custom dB map on the volume control when its range is reported as 0..50 (0 .. 0.2dB).
However, there exists at least one other variant (hw v1.0c, as opposed to the tested v1.2) which reports a different non-sensical volume range (0..53) and the custom map is therefore not applied for that device.
This results in all of the volume change appearing close to 100% on mixer UIs that utilize the dB TLV information.
Add a fallback case where no dB TLV is reported at all if the control range is not 0..50 but still 0..N where N <= 1000 (3.9 dB). Also restrict the quirk to only apply to the volume control as there is also a mute control which would match the check otherwise.
--- sound/usb/mixer_quirks.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
sound/usb/mixer_quirks.c +16 -6
@@ -1717,6 +1717,7 @@ void snd_usb_mixer_rc_memory_change(stru }static void snd_dragonfly_quirk_db_scale (struct usb_mixer_interface *mixer, +struct usb_mixer_elem_info *cval,struct snd_kcontrol *kctl) {/* Approximation using 10 ranges based on output measurement on hw v1.2.
@@ -1734,10 +1735,19 @@ static void snd_dragonfly_quirk_db_scale 41, 50, TLV_DB_MINMAX_ITEM(-441, 0), ); -usb_audio_info (mixer->chip,"applying DragonFly dB scale quirk\n" ); - kctl->tlv.p = scale; - kctl->vd[0 ].access |=SNDRV_CTL_ELEM_ACCESS_TLV_READ ; - kctl->vd[0 ].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK ; +if (cval->min ==0 && cval->max ==50 ) { +usb_audio_info (mixer->chip,"applying DragonFly dB scale quirk (0-50 variant)\n" ); + kctl->tlv.p = scale; + kctl->vd[0 ].access |=SNDRV_CTL_ELEM_ACCESS_TLV_READ ; + kctl->vd[0 ].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK ; + + }else if (cval->min ==0 && cval->max <=1000 ) { +/* Some other clearly broken DragonFly variant. +* At least a 0..53 variant (hw v1.0) exists. +*/ +usb_audio_info (mixer->chip,"ignoring too narrow dB range on a DragonFly device" ); + kctl->vd[0 ].access &= ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK ; + } } void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
@@ -1746,8 +1756,8 @@ void snd_usb_mixer_fu_apply_quirk(struct {switch (mixer->chip->usb_id) {case USB_ID (0x21b4 ,0x0081 ):/* AudioQuest DragonFly */ -if (unitid ==7 && cval->min ==0 && cval->max ==50 ) -snd_dragonfly_quirk_db_scale (mixer, kctl); +if (unitid ==7 && cval->control ==UAC_FU_VOLUME ) +snd_dragonfly_quirk_db_scale (mixer, cval, kctl);break ; } }
PATCH 63/306 netfilter: nft_exthdr: Add size check on u8 nft_exthdr attributes
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Laura Garcia Liebana <[email protected]>
commit 4da449ae1df9cfeb167e78f250b250eff64bc65e upstream.
Fix the direct assignment of offset and length attributes included in nft_exthdr structure from u32 data to u8.
--- net/netfilter/nft_exthdr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/netfilter/nft_exthdr.c +9 -2
@@ -59,6 +59,7 @@ static int nft_exthdr_init(const struct {struct nft_exthdr *priv =nft_expr_priv (expr);int err; +u32 offset, len; if (tb[NFTA_EXTHDR_DREG] == NULL || tb[NFTA_EXTHDR_TYPE] == NULL ||
@@ -66,9 +67,15 @@ static int nft_exthdr_init(const struct tb[NFTA_EXTHDR_LEN] == NULL)return -EINVAL ; + offset =ntohl (nla_get_be32 (tb[NFTA_EXTHDR_OFFSET ])); + len =ntohl (nla_get_be32 (tb[NFTA_EXTHDR_LEN ])); + +if (offset >U8_MAX || len >U8_MAX ) +return -ERANGE ; + priv->type =nla_get_u8 (tb[NFTA_EXTHDR_TYPE ]); - priv->offset =ntohl (nla_get_be32 (tb[NFTA_EXTHDR_OFFSET ])); - priv->len =ntohl (nla_get_be32 (tb[NFTA_EXTHDR_LEN ])); + priv->offset = offset; + priv->len = len;if (priv->len ==0 || priv->len > FIELD_SIZEOF(struct nft_data, data))return -EINVAL ;
PATCH 64/306 netfilter: nf_tables: validate maximum value of u32 netlink attributes
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Laura Garcia Liebana <[email protected]>
commit 36b701fae12ac763a568037e4e7c96b5727a8b3e upstream.
Fetch value and validate u32 netlink attribute. This validation is usually required when the u32 netlink attributes are being stored in a field whose size is smaller.
This patch revisits 4da449ae1df9 ("netfilter: nft_exthdr: Add size check on u8 nft_exthdr attributes").
---
include/net/netfilter/nf_tables.h +1 -0
@@ -113,6 +113,7 @@ static inline enum nft_registers nft_typreturn type ==NFT_DATA_VERDICT ?NFT_REG_VERDICT :NFT_REG_1 ; } +unsigned int nft_parse_u32_check (const struct nlattr *attr,int max,u32 *dest);int nft_validate_input_register (enum nft_registers reg);int nft_validate_output_register (enum nft_registers reg); int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg,
net/netfilter/nf_tables_api.c +25 -0
@@ -3712,6 +3712,31 @@ static int nf_tables_check_loops(const s }/** +* nft_parse_u32_check - fetch u32 attribute and check for maximum value +* +* @attr: netlink attribute to fetch value from +* @max: maximum value to be stored in dest +* @dest: pointer to the variable +* +* Parse, check and store a given u32 netlink attribute into variable. +* This function returns -ERANGE if the value goes over maximum value. +* Otherwise a 0 is returned and the attribute value is stored in the +* destination variable. +*/ +unsigned int nft_parse_u32_check (const struct nlattr *attr,int max,u32 *dest) +{ +int val; + + val =ntohl (nla_get_be32 (attr)); +if (val > max) +return -ERANGE ; + + *dest = val; +return 0 ; +} +EXPORT_SYMBOL_GPL (nft_parse_u32_check); + +/** * nft_validate_input_register - validate an expressions' input register * * @reg: the register number
net/netfilter/nft_bitwise.c +6 -1
@@ -54,6 +54,7 @@ static int nft_bitwise_init(const struct {struct nft_bitwise *priv =nft_expr_priv (expr);struct nft_data_desc d1, d2; +u32 len;int err; if (tb[NFTA_BITWISE_SREG] == NULL ||
@@ -76,7 +77,11 @@ static int nft_bitwise_init(const structif (err <0 )return err; - priv->len =ntohl (nla_get_be32 (tb[NFTA_BITWISE_LEN ])); + err =nft_parse_u32_check (tb[NFTA_BITWISE_LEN ],U8_MAX , &len); +if (err <0 ) +return err; + + priv->len = len; err =nft_data_init (NULL , &priv->mask, &d1, tb[NFTA_BITWISE_MASK ]);if (err <0 )
net/netfilter/nft_byteorder.c +13 -2
@@ -78,6 +78,7 @@ static int nft_byteorder_init(const stru const struct nlattr * const tb[]) {struct nft_byteorder *priv =nft_expr_priv (expr); +u32 size, len;int err; if (tb[NFTA_BYTEORDER_SREG] == NULL ||
@@ -109,11 +110,21 @@ static int nft_byteorder_init(const strureturn -EINVAL ; } - priv->len =ntohl (nla_get_be32 (tb[NFTA_BYTEORDER_LEN ])); + err =nft_parse_u32_check (tb[NFTA_BYTEORDER_LEN ],U8_MAX , &len); +if (err <0 ) +return err; + + priv->len = len; + if (priv->len == 0 || priv->len > FIELD_SIZEOF(struct nft_data, data))return -EINVAL ; - priv->size =ntohl (nla_get_be32 (tb[NFTA_BYTEORDER_SIZE ])); + err =nft_parse_u32_check (tb[NFTA_BYTEORDER_SIZE ],U8_MAX , &size); +if (err <0 ) +return err; + + priv->size = size; +switch (priv->size) {case 2 :case 4 :
net/netfilter/nft_cmp.c +3 -0
@@ -81,6 +81,9 @@ static int nft_cmp_init(const struct nft err =nft_data_init (NULL , &priv->data, &desc, tb[NFTA_CMP_DATA ]);BUG_ON (err <0 ); +if (desc.len >U8_MAX ) +return -ERANGE ; + priv->len = desc.len;return 0 ; }
net/netfilter/nft_exthdr.c +6 -4
@@ -67,11 +67,13 @@ static int nft_exthdr_init(const struct tb[NFTA_EXTHDR_LEN] == NULL)return -EINVAL ; - offset =ntohl (nla_get_be32 (tb[NFTA_EXTHDR_OFFSET ])); - len =ntohl (nla_get_be32 (tb[NFTA_EXTHDR_LEN ])); + err =nft_parse_u32_check (tb[NFTA_EXTHDR_OFFSET ],U8_MAX , &offset); +if (err <0 ) +return err; -if (offset >U8_MAX || len >U8_MAX ) -return -ERANGE ; + err =nft_parse_u32_check (tb[NFTA_EXTHDR_LEN ],U8_MAX , &len); +if (err <0 ) +return err; priv->type =nla_get_u8 (tb[NFTA_EXTHDR_TYPE ]); priv->offset = offset;
net/netfilter/nft_immediate.c +4 -0
@@ -57,6 +57,10 @@ static int nft_immediate_init(const stru err =nft_data_init (ctx, &priv->data, &desc, tb[NFTA_IMMEDIATE_DATA ]);if (err <0 )return err; + +if (desc.len >U8_MAX ) +return -ERANGE ; + priv->dlen = desc.len; err =nft_validate_data_load (ctx, priv->dreg, &priv->data, desc.type);
PATCH 65/306 svcrdma: Tail iovec leaves an orphaned DMA mapping
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit cace564f8b6260e806f5e28d7f192fd0e0c603ed upstream.
The ctxt's count field is overloaded to mean the number of pages in the ctxt->page array and the number of SGEs in the ctxt->sge array. Typically these two numbers are the same.
However, when an inline RPC reply is constructed from an xdr_buf with a tail iovec, the head and tail often occupy the same page, but each are DMA mapped independently. In that case, ->count equals the number of pages, but it does not equal the number of SGEs. There's one more SGE, for the tail iovec. Hence there is one more DMA mapping than there are pages in the ctxt->page array.
This isn't a real problem until the server's iommu is enabled. Then each RPC reply that has content in that iovec orphans a DMA mapping that consists of real resources.
krb5i and krb5p always populate that tail iovec. After a couple million sent krb5i/p RPC replies, the NFS server starts behaving erratically. Reboot is needed to clear the problem.
[bwh: Backported to 3.16:
- Adjust context
- Drop changes to svc_rdma_bc_sendto()
- s/xprt->sc_pd->local_dma_lkey/xprt->sc_dma_lkey/
---
include/linux/sunrpc/svc_rdma.h +9 -0
@@ -83,6 +83,7 @@ struct svc_rdma_op_ctxt {unsigned long flags;enum dma_data_direction direction;int count; +unsigned int mapped_sges;struct ib_sge sge[RPCSVC_MAXPAGES ];struct page *pages[RPCSVC_MAXPAGES ]; };
@@ -178,6 +179,14 @@ struct svcxprt_rdma {#define RPCRDMA_MAX_REQUESTS 16#define RPCRDMA_MAX_REQ_SIZE 4096 +/* Track DMA maps for this transport and context */ +static inline void svc_rdma_count_mappings (struct svcxprt_rdma *rdma, +struct svc_rdma_op_ctxt *ctxt) +{ + ctxt->mapped_sges++; +atomic_inc (&rdma->sc_dma_used); +} +/* svc_rdma_marshal.c */ extern void svc_rdma_rcl_chunk_counts (struct rpcrdma_read_chunk *,int *,int *);
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +1 -1
@@ -178,7 +178,7 @@ static int rdma_read_chunk_lcl(struct sv ctxt->sge[pno].addr);if (ret) goto err; -atomic_inc (&xprt->sc_dma_used); +svc_rdma_count_mappings (xprt, ctxt);/* The lkey here is either a local dma lkey or a dma_mr lkey */ ctxt->sge[pno].lkey = xprt->sc_dma_lkey;
net/sunrpc/xprtrdma/svc_rdma_sendto.c +3 -17
@@ -184,7 +184,7 @@ static int send_write(struct svcxprt_rdmif (ib_dma_mapping_error (xprt->sc_cm_id->device, sge[sge_no].addr)) goto err; -atomic_inc (&xprt->sc_dma_used); +svc_rdma_count_mappings (xprt, ctxt); sge[sge_no].lkey = xprt->sc_dma_lkey; ctxt->count++; sge_off =0 ;
@@ -411,7 +411,7 @@ static int send_reply(struct svcxprt_rdm ctxt->sge[0].length, DMA_TO_DEVICE);if (ib_dma_mapping_error (rdma->sc_cm_id->device, ctxt->sge[0 ].addr)) goto err; -atomic_inc (&rdma->sc_dma_used); +svc_rdma_count_mappings (rdma, ctxt); ctxt->direction =DMA_TO_DEVICE ;
@@ -427,7 +427,7 @@ static int send_reply(struct svcxprt_rdmif (ib_dma_mapping_error (rdma->sc_cm_id->device, ctxt->sge[sge_no].addr)) goto err; -atomic_inc (&rdma->sc_dma_used); +svc_rdma_count_mappings (rdma, ctxt); ctxt->sge[sge_no].lkey = rdma->sc_dma_lkey; ctxt->sge[sge_no].length = sge_bytes; }
@@ -442,23 +442,9 @@ static int send_reply(struct svcxprt_rdm ctxt->pages[page_no+1 ] = rqstp->rq_respages[page_no]; ctxt->count++; rqstp->rq_respages[page_no] =NULL ; -/* -* If there are more pages than SGE, terminate SGE -* list so that svc_rdma_unmap_dma doesn't attempt to -* unmap garbage. -*/ -if (page_no+1 >= sge_no) - ctxt->sge[page_no+1 ].length =0 ; } rqstp->rq_next_page = rqstp->rq_respages +1 ; -/* The loop above bumps sc_dma_used for each sge. The -* xdr_buf.tail gets a separate sge, but resides in the -* same page as xdr_buf.head. Don't count it twice. -*/ -if (sge_no > ctxt->count) -atomic_dec (&rdma->sc_dma_used); -BUG_ON (sge_no > rdma->sc_max_sge);memset (&send_wr,0 ,sizeof send_wr); ctxt->wr_op =IB_WR_SEND ;
net/sunrpc/xprtrdma/svc_rdma_transport.c +13 -7
@@ -108,6 +108,7 @@ struct svc_rdma_op_ctxt *svc_rdma_get_co ctxt->xprt = xprt;INIT_LIST_HEAD (&ctxt->dto_q); ctxt->count =0 ; + ctxt->mapped_sges =0 ; ctxt->frmr =NULL ;atomic_inc (&xprt->sc_ctxt_used);return ctxt;
@@ -116,22 +117,27 @@ struct svc_rdma_op_ctxt *svc_rdma_get_covoid svc_rdma_unmap_dma (struct svc_rdma_op_ctxt *ctxt) {struct svcxprt_rdma *xprt = ctxt->xprt; -int i; -for (i =0 ; i < ctxt->count && ctxt->sge[i].length; i++) { +struct ib_device *device = xprt->sc_cm_id->device; +u32 lkey = xprt->sc_dma_lkey; +unsigned int i, count; + +for (count =0 , i =0 ; i < ctxt->mapped_sges; i++) {/* * Unmap the DMA addr in the SGE if the lkey matches * the sc_dma_lkey, otherwise, ignore it since it is * an FRMR lkey and will be unmapped later when the * last WR that uses it completes. */ -if (ctxt->sge[i].lkey == xprt->sc_dma_lkey) { -atomic_dec (&xprt->sc_dma_used); -ib_dma_unmap_page (xprt->sc_cm_id->device, +if (ctxt->sge[i].lkey == lkey) { + count++; +ib_dma_unmap_page (device, ctxt->sge[i].addr, ctxt->sge[i].length, ctxt->direction); } } + ctxt->mapped_sges =0 ; +atomic_sub (count, &xprt->sc_dma_used); }void svc_rdma_put_context (struct svc_rdma_op_ctxt *ctxt,int free_pages)
@@ -521,7 +527,7 @@ int svc_rdma_post_recv(struct svcxprt_rd DMA_FROM_DEVICE);if (ib_dma_mapping_error (xprt->sc_cm_id->device, pa)) goto err_put_ctxt; -atomic_inc (&xprt->sc_dma_used); +svc_rdma_count_mappings (xprt, ctxt); ctxt->sge[sge_no].addr = pa; ctxt->sge[sge_no].length =PAGE_SIZE ; ctxt->sge[sge_no].lkey = xprt->sc_dma_lkey;
@@ -1346,7 +1352,7 @@ void svc_rdma_send_error(struct svcxprt_svc_rdma_put_context (ctxt,1 );return ; } -atomic_inc (&xprt->sc_dma_used); +svc_rdma_count_mappings (xprt, ctxt); ctxt->sge[0 ].lkey = xprt->sc_dma_lkey; ctxt->sge[0 ].length = length;
PATCH 66/306 blkcg: Annotate blkg_hint correctly
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 55679c8d23d191c24ad133abc5647e3054ca8de1 upstream.
Avoid that sparse complains about blkg_hint manipulations.
--- block/blk-cgroup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-cgroup.h +1 -1
@@ -47,7 +47,7 @@ struct blkcg {spinlock_t lock;struct radix_tree_root blkg_tree; -struct blkcg_gq *blkg_hint; +struct blkcg_gq __rcu *blkg_hint;struct hlist_head blkg_list;/* for policies to test whether associated blkcg has changed */
PATCH 67/306 regulator: tps65910: Work around silicon erratum SWCZ010
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jan Remmet <[email protected]>
commit 8f9165c981fed187bb483de84caf9adf835aefda upstream.
http://www.ti.com/lit/pdf/SWCZ010:
DCDC o/p voltage can go higher than programmed value
Impact:
VDDI, VDD2, and VIO output programmed voltage level can go higher than expected or crash, when coming out of PFM to PWM mode or using DVFS.
Description:
When DCDC CLK SYNC bits are 11/01:
* VIO 3-MHz oscillator is the source clock of the digital core and input clock of VDD1 and VDD2
* Turn-on of VDD1 and VDD2 HSD PFETis synchronized or at a constant phase shift
* Current pulled though VCC1+VCC2 is Iload(VDD1) + Iload(VDD2)
* The 3 HSD PFET will be turned-on at the same time, causing the highest possible switching noise on the application. This noise level depends on the layout, the VBAT level, and the load current. The noise level increases with improper layout.
When DCDC CLK SYNC bits are 00:
* VIO 3-MHz oscillator is the source clock of digital core
* VDD1 and VDD2 are running on their own 3-MHz oscillator
* Current pulled though VCC1+VCC2 average of Iload(VDD1) + Iload(VDD2)
* The switching noise of the 3 SMPS will be randomly spread over time, causing lower overall switching noise.
Workaround:
Set DCDCCTRL_REG[1:0]= 00.
--- drivers/regulator/tps65910-regulator.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/regulator/tps65910-regulator.c +6 -0
@@ -1111,6 +1111,12 @@ static int tps65910_probe(struct platfor pmic->num_regulators =ARRAY_SIZE (tps65910_regs); pmic->ext_sleep_control = tps65910_ext_sleep_control; info = tps65910_regs; +/* Work around silicon erratum SWCZ010: output programmed +* voltage level can go higher than expected or crash +* Workaround: use no synchronization of DCDC clocks +*/ +tps65910_reg_clear_bits (pmic->mfd,TPS65910_DCDCCTRL , +DCDCCTRL_DCDCCKSYNC_MASK );break ;case TPS65911 : pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
PATCH 68/306 ALSA: hda - Adding one more ALC255 pin definition for headset problem
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hui Wang <[email protected]>
commit 392c9da24a994f238c5d7ea611c6245be4617014 upstream.
We have two new Dell laptop models, they have the same ALC255 pin definition, but not in the pin quirk table yet, as a result, the headset microphone can't work. After adding the definition in the table, the headset microphone works well.
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -5103,6 +5103,10 @@ static const struct hda_model_fixup alc2static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {SND_HDA_PIN_QUIRK (0x10ec0255 ,0x1028 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE , + {0x14, 0x90170110}, + {0x1b, 0x02011020}, + {0x21, 0x0221101f}), +SND_HDA_PIN_QUIRK (0x10ec0255 ,0x1028 ,"Dell" ,ALC255_FIXUP_DELL1_MIC_NO_PRESENCE , {0x14, 0x90170130}, {0x21, 0x02211040}), SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
PATCH 69/306 mmc: moxart: fix wait_for_completion_interruptible_timeout return variable type
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Mc Guire <[email protected]>
commit 41f469cac2663a41a7b0c84cb94e8f7024385ae4 upstream.
wait_for_completion_timeout_interruptible returns long not unsigned long so dma_time, which is used exclusively here, is changed to long.
--- drivers/mmc/host/moxart-mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/moxart-mmc.c +3 -2
@@ -257,7 +257,7 @@ static void moxart_dma_complete(void *pastatic void moxart_transfer_dma (struct mmc_data *data,struct moxart_host *host) {u32 len, dir_data, dir_slave; -unsigned long dma_time; +long dma_time;struct dma_async_tx_descriptor *desc =NULL ;struct dma_chan *dma_chan;
@@ -397,7 +397,8 @@ static void moxart_prepare_data(struct mstatic void moxart_request (struct mmc_host *mmc,struct mmc_request *mrq) {struct moxart_host *host =mmc_priv (mmc); -unsigned long pio_time, flags; +long pio_time; +unsigned long flags;u32 status;spin_lock_irqsave (&host->lock, flags);
PATCH 70/306 mmc: block: don't use CMD23 with very old MMC cards
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Glöckner <[email protected]>
commit 0ed50abb2d8fc81570b53af25621dad560cd49b3 upstream.
CMD23 aka SET_BLOCK_COUNT was introduced with MMC v3.1. Older versions of the specification allowed to terminate multi-block transfers only with CMD12.
The patch fixes the following problem:
mmc0: new MMC card at address 0001
mmcblk0: mmc0:0001 SDMB-16 15.3 MiB
mmcblk0: timed out sending SET_BLOCK_COUNT command, card status 0x400900
...
blk_update_request: I/O error, dev mmcblk0, sector 0
Buffer I/O error on dev mmcblk0, logical block 0, async page read
mmcblk0: unable to read partition table
--- drivers/mmc/card/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/card/block.c +2 -1
@@ -2170,7 +2170,8 @@ static struct mmc_blk_data *mmc_blk_alloset_capacity (md->disk, size);if (mmc_host_cmd23 (card->host)) { -if (mmc_card_mmc (card) || +if ((mmc_card_mmc (card) && + card->csd.mmca_vsn >=CSD_SPEC_VER_3 ) || (mmc_card_sd (card) && card->scr.cmds &SD_SCR_CMD23_SUPPORT )) md->flags |=MMC_BLK_CMD23 ;
PATCH 71/306 KVM: PPC: Book3S: Treat VTB as a per-subcore register, not per-thread
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit 88b02cf97bb7e742db3e31671d54177e3e19fd89 upstream.
POWER8 has one virtual timebase (VTB) register per subcore, not one per CPU thread. The HV KVM code currently treats VTB as a per-thread register, which can lead to spurious soft lockup messages from guests which use the VTB as the time source for the soft lockup detector. (CPUs before POWER8 did not have the VTB register.)
For HV KVM, this fixes the problem by making only the primary thread in each virtual core save and restore the VTB value. With this, the VTB state becomes part of the kvmppc_vcore structure. This also means that "piggybacking" of multiple virtual cores onto one subcore is not possible on POWER8, because then the virtual cores would share a single VTB register.
PR KVM emulates a VTB register, which is per-vcpu because PR KVM has no notion of CPU threads or SMT. For PR KVM we move the VTB state into the kvmppc_vcpu_book3s struct.
[bwh: Backported to 3.16:
- Adjust filenames, context
- Drop changes to kvmppc_core_emulate_mfspr_pr(), can_piggyback_subcore(), kvmppc_copy_from_svcpu()]
---
arch/powerpc/include/asm/kvm_book3s.h +1 -0
@@ -83,6 +83,7 @@ struct kvmppc_vcpu_book3s {u64 sdr1;u64 hior;u64 msr_mask; +u64 vtb;u64 purr_offset;u64 spurr_offset;#ifdef CONFIG_PPC_BOOK3S_32
arch/powerpc/include/asm/kvm_host.h +1 -1
@@ -305,6 +305,7 @@ struct kvmppc_vcore {u32 arch_compat;ulong pcr;ulong dpdes;/* doorbell state (POWER8) */ +ulong vtb;/* virtual timebase */ };#define VCORE_ENTRY_COUNT (vc) ((vc)->entry_exit_count & 0xff)
@@ -462,7 +463,6 @@ struct kvm_vcpu_arch {ulong purr;ulong spurr;ulong ic; -ulong vtb;ulong dscr;ulong amr;ulong uamor;
arch/powerpc/kernel/asm-offsets.c +1 -1
@@ -506,7 +506,6 @@ int main(void) DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr)); DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr)); DEFINE(VCPU_IC, offsetof(struct kvm_vcpu, arch.ic)); - DEFINE(VCPU_VTB, offsetof(struct kvm_vcpu, arch.vtb)); DEFINE(VCPU_DSCR, offsetof(struct kvm_vcpu, arch.dscr)); DEFINE(VCPU_AMR, offsetof(struct kvm_vcpu, arch.amr)); DEFINE(VCPU_UAMOR, offsetof(struct kvm_vcpu, arch.uamor));
@@ -560,6 +559,7 @@ int main(void)DEFINE (VCORE_LPCR , offsetof(struct kvmppc_vcore , lpcr));DEFINE (VCORE_PCR , offsetof(struct kvmppc_vcore , pcr));DEFINE (VCORE_DPDES , offsetof(struct kvmppc_vcore , dpdes)); +DEFINE (VCORE_VTB , offsetof(struct kvmppc_vcore , vtb));DEFINE (VCPU_SLB_E , offsetof(struct kvmppc_slb , orige));DEFINE (VCPU_SLB_V , offsetof(struct kvmppc_slb , origv));DEFINE (VCPU_SLB_SIZE ,sizeof (struct kvmppc_slb ));
arch/powerpc/kvm/book3s_hv.c +2 -2
@@ -909,7 +909,7 @@ static int kvmppc_get_one_reg_hv(struct *val =get_reg_val (id, vcpu->arch.ic);break ;case KVM_REG_PPC_VTB : - *val =get_reg_val (id, vcpu->arch.vtb); + *val =get_reg_val (id, vcpu->arch.vcore->vtb);break ;case KVM_REG_PPC_CSIGR : *val =get_reg_val (id, vcpu->arch.csigr);
@@ -1110,7 +1110,7 @@ static int kvmppc_set_one_reg_hv(struct vcpu->arch.ic =set_reg_val (id, *val);break ;case KVM_REG_PPC_VTB : - vcpu->arch.vtb =set_reg_val (id, *val); + vcpu->arch.vcore->vtb =set_reg_val (id, *val);break ;case KVM_REG_PPC_CSIGR : vcpu->arch.csigr =set_reg_val (id, *val);
arch/powerpc/kvm/book3s_hv_rmhandlers.S +7 -7
@@ -457,9 +457,11 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_2 38: BEGIN_FTR_SECTION - /* DPDES is shared between threads */ + /* DPDES and VTB are shared between threads */ ld r8, VCORE_DPDES(r5) + ld r7, VCORE_VTB(r5) mtspr SPRN_DPDES, r8 + mtspr SPRN_VTB, r7 END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) li r0,1
@@ -736,10 +738,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) mtspr SPRN_CIABR, r7 mtspr SPRN_TAR, r8 ld r5, VCPU_IC(r4) - ld r6, VCPU_VTB(r4) - mtspr SPRN_IC, r5 - mtspr SPRN_VTB, r6 ld r8, VCPU_EBBHR(r4) + mtspr SPRN_IC, r5 mtspr SPRN_EBBHR, r8 ld r5, VCPU_EBBRR(r4) ld r6, VCPU_BESCR(r4)
@@ -1147,10 +1147,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) stw r6, VCPU_PSPB(r9) std r7, VCPU_FSCR(r9) mfspr r5, SPRN_IC - mfspr r6, SPRN_VTB mfspr r7, SPRN_TAR std r5, VCPU_IC(r9) - std r6, VCPU_VTB(r9) std r7, VCPU_TAR(r9) mfspr r8, SPRN_EBBHR std r8, VCPU_EBBHR(r9)
@@ -1442,9 +1440,11 @@ secondary_too_late: isync BEGIN_FTR_SECTION - /* DPDES is shared between threads */ + /* DPDES and VTB are shared between threads */ mfspr r7, SPRN_DPDES + mfspr r8, SPRN_VTB std r7, VCORE_DPDES(r5) + std r8, VCORE_VTB(r5) /* clear DPDES so we don't get guest doorbells in the host */ li r8, 0 mtspr SPRN_DPDES, r8
arch/powerpc/kvm/book3s_pr.c +6 -0
@@ -1232,6 +1232,9 @@ static int kvmppc_get_one_reg_pr(structcase KVM_REG_PPC_HIOR : *val =get_reg_val (id,to_book3s (vcpu)->hior);break ; +case KVM_REG_PPC_VTB : + *val =get_reg_val (id,to_book3s (vcpu)->vtb); +break ;case KVM_REG_PPC_LPCR :case KVM_REG_PPC_LPCR_64 :/*
@@ -1268,6 +1271,9 @@ static int kvmppc_set_one_reg_pr(structto_book3s (vcpu)->hior =set_reg_val (id, *val);to_book3s (vcpu)->hior_explicit = true;break ; +case KVM_REG_PPC_VTB : +to_book3s (vcpu)->vtb =set_reg_val (id, *val); +break ;case KVM_REG_PPC_LPCR :case KVM_REG_PPC_LPCR_64 :kvmppc_set_lpcr_pr (vcpu,set_reg_val (id, *val));
PATCH 72/306 KVM: PPC: BookE: Fix a sanity check
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit ac0e89bb4744d3882ccd275f2416d9ce22f4e1e7 upstream.
We use logical negate where bitwise negate was intended. It means that we never return -EINVAL here.
--- arch/powerpc/kvm/booke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kvm/booke.c +1 -1
@@ -1841,7 +1841,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(if (type ==KVMPPC_DEBUG_NONE )continue ; -if (type & !(KVMPPC_DEBUG_WATCH_READ | +if (type & ~(KVMPPC_DEBUG_WATCH_READ |KVMPPC_DEBUG_WATCH_WRITE |KVMPPC_DEBUG_BREAKPOINT ))return -EINVAL ;
PATCH 73/306 KVM: PPC: Book3s PR: Allow access to unprivileged MMCR2 register
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Huth <[email protected]>
commit fa73c3b25bd8d0d393dc6109a1dba3c2aef0451e upstream.
The MMCR2 register is available twice, one time with number 785 (privileged access), and one time with number 769 (unprivileged, but it can be disabled completely). In former times, the Linux kernel was using the unprivileged register 769 only, but since commit 8dd75ccb571f3c92c ("powerpc: Use privileged SPR number for MMCR2"), it uses the privileged register 785 instead. The KVM-PR code then of course also switched to use the SPR 785, but this is causing older guest kernels to crash, since these kernels still access 769 instead. So to support older kernels with KVM-PR again, we have to support register 769 in KVM-PR, too.
--- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kvm/book3s_emulate.c | 2 ++ 2 files changed, 3 insertions(+)
arch/powerpc/include/asm/reg.h +1 -0
@@ -705,6 +705,7 @@#define MMCR0_FCHV 0x00000001UL/* freeze conditions in hypervisor mode */ #define SPRN_MMCR1 798#define SPRN_MMCR2 785 +#define SPRN_UMMCR2 769#define SPRN_MMCRA 0x312#define MMCRA_SDSYNC 0x80000000UL/* SDAR synced with SIAR */ #define MMCRA_SDAR_DCACHE_MISS 0x40000000UL
arch/powerpc/kvm/book3s_emulate.c +2 -0
@@ -503,6 +503,7 @@ int kvmppc_core_emulate_mtspr_pr(structcase SPRN_MMCR0 :case SPRN_MMCR1 :case SPRN_MMCR2 : +case SPRN_UMMCR2 :#endif break ; unprivileged:
@@ -633,6 +634,7 @@ int kvmppc_core_emulate_mfspr_pr(structcase SPRN_MMCR0 :case SPRN_MMCR1 :case SPRN_MMCR2 : +case SPRN_UMMCR2 :case SPRN_TIR :#endif *spr_val =0 ;
PATCH 74/306 USB: serial: cp210x: Add ID for a Juniper console
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Jones <[email protected]>
commit decc5360f23e9efe0252094f47f57f254dcbb3a9 upstream.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -117,6 +117,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */ { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ + { 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, 0x85EA) }, /* AC-Services IBUS-IF */
PATCH 75/306 NFSv4: Open state recovery must account for file permission changes
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 304020fe48c6c7fff8b5a38f382b54404f0f79d3 upstream.
If the file permissions change on the server, then we may not be able to recover open state. If so, we need to ensure that we mark the file descriptor appropriately.
--- fs/nfs/nfs4state.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfs/nfs4state.c +3 -0
@@ -1494,6 +1494,9 @@ restart: __func__, status);case -ENOENT :case -ENOMEM : +case -EACCES : +case -EROFS : +case -EIO :case -ESTALE :/* Open state on this file cannot be recovered */ nfs4_state_mark_recovery_failed (state, status);
PATCH 76/306 Revert "usbtmc: convert to devm_kzalloc"
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit ab21b63e8aedfc73565dd9cdd51eb338341177cb upstream.
This reverts commit e6c7efdcb76f11b04e3d3f71c8d764ab75c9423b.
Turns out it was totally wrong. The memory is supposed to be bound to the kref, as the original code was doing correctly, not the device/driver binding as the devm_kzalloc() would cause.
This fixes an oops when read would be called after the device was unbound from the driver.
--- drivers/usb/class/usbtmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/class/usbtmc.c +2 -1
@@ -120,6 +120,7 @@ static void usbtmc_delete(struct kref *kstruct usbtmc_device_data *data =to_usbtmc_data (kref);usb_put_dev (data->usb_dev); +kfree (data); }static int usbtmc_open (struct inode *inode,struct file *filp)
@@ -1103,7 +1104,7 @@ static int usbtmc_probe(struct usb_interdev_dbg (&intf->dev,"%s called\n" , __func__); - data =devm_kzalloc (&intf->dev,sizeof (*data),GFP_KERNEL ); + data =kmalloc (sizeof (*data),GFP_KERNEL );if (!data) {dev_err (&intf->dev,"Unable to allocate kernel memory\n" );return -ENOMEM ;
PATCH 77/306 drm/radeon/si/dpm: fix phase shedding setup
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 427920292b00474d978d632bc03a8e4e50029af3 upstream.
Used the wrong index to setup the phase shedding mask.
--- drivers/gpu/drm/radeon/si_dpm.c | 2 +- drivers/gpu/drm/radeon/sislands_smc.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/si_dpm.c +1 -1
@@ -3982,7 +3982,7 @@ static int si_populate_smc_voltage_table &rdev->pm.dpm.dyn_state.phase_shedding_limits_table)) {si_populate_smc_voltage_table (rdev, &si_pi->vddc_phase_shed_table, table); - table->phaseMaskTable.lowMask[SISLANDS_SMC_VOLTAGEMASK_VDDC ] = + table->phaseMaskTable.lowMask[SISLANDS_SMC_VOLTAGEMASK_VDDC_PHASE_SHEDDING ] =cpu_to_be32 (si_pi->vddc_phase_shed_table.mask_low); si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_phase_shedding_delay,
drivers/gpu/drm/radeon/sislands_smc.h +1 -0
@@ -194,6 +194,7 @@ typedef struct SISLANDS_SMC_SWSTATE SISL#define SISLANDS_SMC_VOLTAGEMASK_VDDC 0#define SISLANDS_SMC_VOLTAGEMASK_MVDD 1#define SISLANDS_SMC_VOLTAGEMASK_VDDCI 2 +#define SISLANDS_SMC_VOLTAGEMASK_VDDC_PHASE_SHEDDING 3#define SISLANDS_SMC_VOLTAGEMASK_MAX 4struct SISLANDS_SMC_VOLTAGEMASKTABLE
PATCH 78/306 powerpc/vdso64: Use double word compare on pointers
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit 5045ea37377ce8cca6890d32b127ad6770e6dce5 upstream.
__kernel_get_syscall_map() and __kernel_clock_getres() use cmpli to check if the passed in pointer is non zero. cmpli maps to a 32 bit compare on binutils, so we ignore the top 32 bits.
A simple test case can be created by passing in a bogus pointer with the bottom 32 bits clear. Using a clk_id that is handled by the VDSO, then one that is handled by the kernel shows the problem:
printf("%d\n", clock_getres(CLOCK_REALTIME, (void *)0x100000000));
printf("%d\n", clock_getres(CLOCK_BOOTTIME, (void *)0x100000000));And we get:
0
-1
The bigger issue is if we pass a valid pointer with the bottom 32 bits clear, in this case we will return success but won't write any data to the pointer.
I stumbled across this issue because the LLVM integrated assembler doesn't accept cmpli with 3 arguments. Fix this by converting them to cmpldi.
--- arch/powerpc/kernel/vdso64/datapage.S | 2 +- arch/powerpc/kernel/vdso64/gettimeofday.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/vdso64/datapage.S +1 -1
@@ -57,7 +57,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_ma bl V_LOCAL_FUNC(__get_datapage) mtlr r12 addi r3,r3,CFG_SYSCALL_MAP64 - cmpli cr0,r4,0 + cmpldi cr0,r4,0 crclr cr0*4+so beqlr li r0,__NR_syscalls
arch/powerpc/kernel/vdso64/gettimeofday.S +1 -1
@@ -145,7 +145,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) bne cr0,99f li r3,0 - cmpli cr0,r4,0 + cmpldi cr0,r4,0 crclr cr0*4+so beqlr lis r5,CLOCK_REALTIME_RES@h
PATCH 79/306 ext4: release bh in make_indexed_dir
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: gmail <[email protected]>
commit e81d44778d1d57bbaef9e24c4eac7c8a7a401d40 upstream.
The commit 6050d47adcad: "ext4: bail out from make_indexed_dir() on first error" could end up leaking bh2 in the error path.
[ Also avoid renaming bh2 to bh, which just confuses things --tytso ]
--- fs/ext4/namei.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
fs/ext4/namei.c +6 -8
@@ -1845,33 +1845,31 @@ static int make_indexed_dir(handle_t *ha frame->entries = entries; frame->at = entries; frame->bh = bh; - bh = bh2; retval =ext4_handle_dirty_dx_node (handle, dir, frame->bh);if (retval) goto out_frames; - retval =ext4_handle_dirty_dirent_node (handle, dir, bh); + retval =ext4_handle_dirty_dirent_node (handle, dir, bh2);if (retval) goto out_frames; - de =do_split (handle,dir, &bh, frame, &hinfo); + de =do_split (handle,dir, &bh2, frame, &hinfo);if (IS_ERR (de)) { retval =PTR_ERR (de); goto out_frames; } -dx_release (frames); - retval =add_dirent_to_buf (handle, dentry, inode, de, bh); -brelse (bh); -return retval; + retval =add_dirent_to_buf (handle, dentry, inode, de, bh2); out_frames:/* * Even if the block split failed, we have to properly write * out all the changes we did so far. Otherwise we can end up * with corrupted filesystem. */ -ext4_mark_inode_dirty (handle, dir); +if (retval) +ext4_mark_inode_dirty (handle, dir);dx_release (frames); +brelse (bh2);return retval; }
PATCH 80/306 s390/con3270: fix use of uninitialised data
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Silbe <[email protected]>
commit c14f2aac7aa147861793eed9f41f91dd530f0be1 upstream.
con3270 contains an optimisation that reduces the amount of data to be transmitted to the 3270 terminal by putting a Repeat to Address (RA) order into the data stream. The RA order itself takes up space, so con3270 only uses it if there's enough space left in the line buffer. Otherwise it just pads out the line manually.
For lines too long to include the RA order, one byte was left uninitialised. This was caused by an off-by-one bug in the loop that pads out the line. Since the buffer is allocated from a common pool, the single byte left uninitialised contained some previous buffer content. Usually this was just a space or some character (which can result in clutter but is otherwise harmless). Sometimes, however, it was a Repeat to Address order, messing up the entire screen layout and causing the display to send the entire buffer content on every keystroke.
--- drivers/s390/char/con3270.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/char/con3270.c +1 -1
@@ -461,7 +461,7 @@ con3270_cline_end(struct con3270 *cp) s->string[s->len -4 ] =TO_RA ; s->string[s->len -1 ] =0 ; }else { -while (--size > cp->cline->len) +while (--size >= cp->cline->len) s->string[size] = cp->view.ascebc[' ' ]; }/* Replace cline with allocated line s and reset cline. */
PATCH 81/306 s390/con3270: fix insufficient space padding
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Silbe <[email protected]>
commit 6cd997db911f28f2510b771691270c52b63ed2e6 upstream.
con3270 contains an optimisation that reduces the amount of data to be transmitted to the 3270 terminal by putting a Repeat to Address (RA) order into the data stream. The RA order itself takes up space, so con3270 only uses it if there's enough space left in the line buffer. Otherwise it just pads out the line manually.
For lines that were _just_ short enough that the RA order still fit in the line buffer, the line was instead padded with an insufficient amount of spaces. This was caused by examining the size of the allocated line buffer rather than the length of the string to be displayed.
For con3270_cline_end(), we just compare against the line length. For con3270_update_string() however that isn't available anymore, so we check whether the Repeat to Address order is present.
--- drivers/s390/char/con3270.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/s390/char/con3270.c +7 -2
@@ -124,7 +124,12 @@ con3270_create_status(struct con3270 *cpstatic void con3270_update_string (struct con3270 *cp,struct string *s,int nr) { -if (s->len >= cp->view.cols -5 ) +if (s->len <4 ) { +/* This indicates a bug, but printing a warning would +* cause a deadlock. */ +return ; + } +if (s->string[s->len -4 ] !=TO_RA )return ;raw3270_buffer_address (cp->view.dev, s->string + s->len -3 , cp->view.cols * (nr +1 ));
@@ -457,7 +462,7 @@ con3270_cline_end(struct con3270 *cp) cp->cline->len + 4 : cp->view.cols; s =con3270_alloc_string (cp, size);memcpy (s->string, cp->cline->string, cp->cline->len); -if (s->len < cp->view.cols -5 ) { +if (cp->cline->len < cp->view.cols -5 ) { s->string[s->len -4 ] =TO_RA ; s->string[s->len -1 ] =0 ; }else {
PATCH 82/306 fuse: invalidate dir dentry after chmod
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 5e2b8828ff3d79aca8c3a1730652758753205b61 upstream.
Without "default_permissions" the userspace filesystem's lookup operation needs to perform the check for search permission on the directory.
If directory does not allow search for everyone (this is quite rare) then userspace filesystem has to set entry timeout to zero to make sure permissions are always performed.
Changing the mode bits of the directory should also invalidate the (previously cached) dentry to make sure the next lookup will have a chance of updating the timeout, if needed.
--- fs/fuse/dir.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/fuse/dir.c +10 -2
@@ -1822,14 +1822,22 @@ error:static int fuse_setattr (struct dentry *entry,struct iattr *attr) {struct inode *inode = entry->d_inode; +int ret;if (!fuse_allow_current_process (get_fuse_conn (inode)))return -EACCES ;if (attr->ia_valid &ATTR_FILE ) -return fuse_do_setattr (entry, attr, attr->ia_file); + ret =fuse_do_setattr (entry, attr, attr->ia_file);else -return fuse_do_setattr (entry, attr,NULL ); + ret =fuse_do_setattr (entry, attr,NULL ); + +if (!ret) { +/* Directory mode changed, may need to revalidate access */ +if (d_is_dir (entry) && (attr->ia_valid &ATTR_MODE )) +fuse_invalidate_entry_cache (entry); + } +return ret; } static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
PATCH 83/306 fuse: fix killing s[ug]id in setattr
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit a09f99eddef44035ec764075a37bace8181bec38 upstream.
Fuse allowed VFS to set mode in setattr in order to clear suid/sgid on chown and truncate, and (since writeback_cache) write. The problem with this is that it'll potentially restore a stale mode.
The poper fix would be to let the filesystems do the suid/sgid clearing on the relevant operations. Possibly some are already doing it but there's no way we can detect this.
So fix this by refreshing and recalculating the mode. Do this only if ATTR_KILL_S[UG]ID is set to not destroy performance for writes. This is still racy but the size of the window is reduced.
--- fs/fuse/dir.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
fs/fuse/dir.c +28 -4
@@ -1822,16 +1822,40 @@ error:static int fuse_setattr (struct dentry *entry,struct iattr *attr) {struct inode *inode = entry->d_inode; +struct file *file = (attr->ia_valid &ATTR_FILE ) ? attr->ia_file :NULL ;int ret;if (!fuse_allow_current_process (get_fuse_conn (inode)))return -EACCES ; -if (attr->ia_valid &ATTR_FILE ) - ret =fuse_do_setattr (entry, attr, attr->ia_file); -else - ret =fuse_do_setattr (entry, attr,NULL ); +if (attr->ia_valid & (ATTR_KILL_SUID |ATTR_KILL_SGID )) { +int kill; + attr->ia_valid &= ~(ATTR_KILL_SUID |ATTR_KILL_SGID | +ATTR_MODE ); +/* +* ia_mode calculation may have used stale i_mode. Refresh and +* recalculate. +*/ + ret =fuse_do_getattr (inode,NULL , file); +if (ret) +return ret; + + attr->ia_mode = inode->i_mode; + kill =should_remove_suid (entry); +if (kill &ATTR_KILL_SUID ) { + attr->ia_valid |=ATTR_MODE ; + attr->ia_mode &= ~S_ISUID ; + } +if (kill &ATTR_KILL_SGID ) { + attr->ia_valid |=ATTR_MODE ; + attr->ia_mode &= ~S_ISGID ; + } + } +if (!attr->ia_valid) +return 0 ; + + ret =fuse_do_setattr (entry, attr, file);if (!ret) {/* Directory mode changed, may need to revalidate access */ if (d_is_dir (entry) && (attr->ia_valid &ATTR_MODE ))
PATCH 84/306 fuse: listxattr: verify xattr list
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit cb3ae6d25a5471be62bfe6ac1fccc0e91edeaba0 upstream.
Make sure userspace filesystem is returning a well formed list of xattr names (zero or more nonzero length, null terminated strings).
[Michael Theall: only verify in the nonzero size case]
---
fs/fuse/dir.c +21 -2
@@ -1968,6 +1968,23 @@ static ssize_t fuse_getxattr(struct dentreturn ret; } +static int fuse_verify_xattr_list (char *list,size_t size) +{ +size_t origsize = size; + +while (size) { +size_t thislen =strnlen (list, size); + +if (!thislen || thislen == size) +return -EIO ; + + size -= thislen +1 ; + list += thislen +1 ; + } + +return origsize; +} +static ssize_t fuse_listxattr (struct dentry *entry,char *list,size_t size) {struct inode *inode = entry->d_inode;
@@ -2006,9 +2023,11 @@ static ssize_t fuse_listxattr(struct den }fuse_request_send (fc, req); ret = req->out.h.error; -if (!ret) +if (!ret) { ret = size ? req->out.args[0 ].size : outarg.size; -else { +if (ret >0 && size) + ret =fuse_verify_xattr_list (list, ret); + }else {if (ret == -ENOSYS ) { fc->no_listxattr =1 ; ret = -EOPNOTSUPP ;
PATCH 85/306 crypto: gcm - Fix IV buffer size in crypto_gcm_setkey
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Mosnáček <[email protected]>
commit 50d2e6dc1f83db0563c7d6603967bf9585ce934b upstream.
The cipher block size for GCM is 16 bytes, and thus the CTR transform used in crypto_gcm_setkey() will also expect a 16-byte IV. However, the code currently reserves only 8 bytes for the IV, causing an out-of-bounds access in the CTR transform. This patch fixes the issue by setting the size of the IV buffer to 16 bytes.
--- crypto/gcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/gcm.c +1 -1
@@ -109,7 +109,7 @@ static int crypto_gcm_setkey(struct crypstruct crypto_ablkcipher *ctr = ctx->ctr;struct {be128 hash; -u8 iv[8 ]; +u8 iv[16 ];struct crypto_gcm_setkey_result result;
PATCH 86/306 staging: rtl8188eu: fix missing unlock on error in rtw_resume_process()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit eaf47b713b602e7d0129ed8d18d2818246a17e49 upstream.
Add the missing unlock before return from function rtw_resume_process() in the error handling case.
[bwh: Backported to 3.16:
- Adjust context
- Unlock pwrctrl_priv::lock]
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +3 -1
@@ -511,8 +511,10 @@ int rtw_resume_process(struct adapter *p ret =0 ; exit: -if (pwrpriv) +if (pwrpriv) { pwrpriv->bInSuspend = false; +_exit_pwrlock (&pwrpriv->lock); + }DBG_88E ("<=== %s return %d.............. in %dms\n" , __func__, ret,rtw_get_passing_time_ms (start_time));
PATCH 87/306 staging: rtl8188eu: fix double unlock error in rtw_resume_process()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 23bf40424a0f641ca7ff4225add4aa592086bdd5 upstream.
Fix following static checker warning:
drivers/staging/rtl8188eu/os_dep/usb_intf.c:311 rtw_resume_process()
error: double unlock 'mutex:&pwrpriv->mutex_lock'[bwh: Backported to 3.16:
- Adjust context
- Unlock pwrctrl_priv::lock]
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +4 -4
@@ -494,8 +494,10 @@ int rtw_resume_process(struct adapter *p pwrpriv->bkeepfwalive = false;DBG_88E ("bkeepfwalive(%x)\n" , pwrpriv->bkeepfwalive); -if (pm_netdev_open (pnetdev, true) !=0 ) +if (pm_netdev_open (pnetdev, true) !=0 ) { +_exit_pwrlock (&pwrpriv->lock); goto exit; + }netif_device_attach (pnetdev);netif_carrier_on (pnetdev);
@@ -511,10 +513,8 @@ int rtw_resume_process(struct adapter *p ret =0 ; exit: -if (pwrpriv) { +if (pwrpriv) pwrpriv->bInSuspend = false; -_exit_pwrlock (&pwrpriv->lock); - }DBG_88E ("<=== %s return %d.............. in %dms\n" , __func__, ret,rtw_get_passing_time_ms (start_time));
PATCH 88/306 UBI: fastmap: scrub PEB when bitflips are detected in a free PEB EC header
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit ecbfa8eabae9cd73522d1d3d15869703c263d859 upstream.
scan_pool() does not mark the PEB for scrubing when bitflips are detected in the EC header of a free PEB (VID header region left to 0xff).
Make sure we scrub the PEB in this case.
--- drivers/mtd/ubi/fastmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mtd/ubi/fastmap.c +4 -3
@@ -445,10 +445,11 @@ static int scan_pool(struct ubi_device *unsigned long long ec =be64_to_cpu (ech->ec);unmap_peb (ai, pnum);dbg_bld ("Adding PEB to free: %i" , pnum); +if (err ==UBI_IO_FF_BITFLIPS ) -add_aeb (ai, free, pnum, ec,1 ); -else -add_aeb (ai, free, pnum, ec,0 ); + scrub =1 ; + +add_aeb (ai, free, pnum, ec, scrub);continue ; }else if (err ==0 || err ==UBI_IO_BITFLIPS ) {dbg_bld ("Found non empty PEB:%i in pool" , pnum);
PATCH 89/306 ubi: Deal with interrupted erasures in WL
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 2365418879e9abf12ea9def7f9f3caf0dfa7ffb0 upstream.
When Fastmap is used we can face here an -EBADMSG since Fastmap cannot know about unmaps.
If the erasure was interrupted the PEB may show ECC errors and UBI would go to ro-mode as it assumes that the PEB was check during attach time, which is not the case with Fastmap.
--- drivers/mtd/ubi/wl.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/mtd/ubi/wl.c +19 -2
@@ -1000,7 +1000,7 @@ static int wear_leveling_worker(struct u int cancel) {int err, scrubbing =0 , torture =0 , protect =0 , erroneous =0 ; -int vol_id =-1 , lnum =-1 ; +int erase =0 , keep =0 , vol_id =-1 , lnum =-1 ;#ifdef CONFIG_MTD_UBI_FASTMAP int anchor = wrk->anchor;#endif
@@ -1134,6 +1134,16 @@ static int wear_leveling_worker(struct u e1->pnum); scrubbing =1 ; goto out_not_moved; + }else if (ubi->fast_attach && err ==UBI_IO_BAD_HDR_EBADMSG ) { +/* +* While a full scan would detect interrupted erasures +* at attach time we can face them here when attached from +* Fastmap. +*/ +dbg_wl ("PEB %d has ECC errors, maybe from an interrupted erasure" , + e1->pnum); + erase =1 ; + goto out_not_moved; } ubi_err("error %d while reading VID header from PEB %d",
@@ -1167,6 +1177,7 @@ static int wear_leveling_worker(struct u* Target PEB had bit-flips or write error - torture it. */ torture =1 ; + keep =1 ; goto out_not_moved; }
@@ -1252,7 +1263,7 @@ out_not_moved: ubi->erroneous_peb_count +=1 ; }else if (scrubbing)wl_tree_add (e1, &ubi->scrub); -else +else if (keep)wl_tree_add (e1, &ubi->used);ubi_assert (!ubi->move_to_put); ubi->move_from = ubi->move_to =NULL ;
@@ -1264,6 +1275,12 @@ out_not_moved:if (err) goto out_ro; +if (erase) { + err =do_sync_erase (ubi, e1, vol_id, lnum,1 ); +if (err) + goto out_ro; + } +mutex_unlock (&ubi->move_mutex);return 0 ;
PATCH 90/306 ubi: Fix races around ubi_refill_pools()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 2e8f08deabbc7eefe4c5838aaa6aa9a23a8acf2e upstream.
When writing a new Fastmap the first thing that happens is refilling the pools in memory.
At this stage it is possible that new PEBs from the new pools get already claimed and written with data.
If this happens before the new Fastmap data structure hits the flash and we face power cut the freshly written PEB will not scanned and unnoticed.
Solve the issue by locking the pools until Fastmap is written.
[bwh: Backported to 3.16:
- Adjust filename, context, indentation
- s/ubi->fm_eba_sem/ubi->fm_sem/]
---
drivers/mtd/ubi/eba.c +2 -2
@@ -1021,6 +1021,8 @@ int ubi_eba_copy_leb(struct ubi_device *struct ubi_volume *vol;uint32_t crc; +ubi_assert (rwsem_is_locked (&ubi->fm_sem)); + vol_id =be32_to_cpu (vid_hdr->vol_id); lnum =be32_to_cpu (vid_hdr->lnum);
@@ -1189,9 +1191,7 @@ int ubi_eba_copy_leb(struct ubi_device * }ubi_assert (vol->eba_tbl[lnum] == from); -down_read (&ubi->fm_sem); vol->eba_tbl[lnum] = to; -up_read (&ubi->fm_sem); out_unlock_buf:mutex_unlock (&ubi->buf_mutex);
drivers/mtd/ubi/fastmap.c +10 -4
@@ -1413,22 +1413,30 @@ int ubi_update_fastmap(struct ubi_devicestruct ubi_wl_entry *tmp_e;mutex_lock (&ubi->fm_mutex); +down_write (&ubi->work_sem); +down_write (&ubi->fm_sem);ubi_refill_pools (ubi);if (ubi->ro_mode || ubi->fm_disabled) { +up_write (&ubi->fm_sem); +up_write (&ubi->work_sem);mutex_unlock (&ubi->fm_mutex);return 0 ; } ret =ubi_ensure_anchor_pebs (ubi);if (ret) { +up_write (&ubi->fm_sem); +up_write (&ubi->work_sem);mutex_unlock (&ubi->fm_mutex);return ret; } new_fm =kzalloc (sizeof (*new_fm),GFP_KERNEL );if (!new_fm) { +up_write (&ubi->fm_sem); +up_write (&ubi->work_sem);mutex_unlock (&ubi->fm_mutex);return -ENOMEM ; }
@@ -1539,16 +1547,14 @@ int ubi_update_fastmap(struct ubi_device new_fm->e[0 ]->ec = tmp_e->ec; } -down_write (&ubi->work_sem); -down_write (&ubi->fm_sem); ret =ubi_write_fastmap (ubi, new_fm); -up_write (&ubi->fm_sem); -up_write (&ubi->work_sem);if (ret) goto err; out_unlock: +up_write (&ubi->fm_sem); +up_write (&ubi->work_sem);mutex_unlock (&ubi->fm_mutex);kfree (old_fm);return ret;
drivers/mtd/ubi/wl.c +17 -7
@@ -653,6 +653,8 @@ static struct ubi_wl_entry *get_peb_for_struct ubi_fm_pool *pool = &ubi->fm_wl_pool;int pnum; +ubi_assert (rwsem_is_locked (&ubi->fm_sem)); +if (pool->used == pool->size || !pool->size) {/* We cannot update the fastmap here because this * function is called in atomic context.
@@ -889,7 +891,7 @@ int ubi_is_erase_work(struct ubi_work *w* failure. */ static int schedule_erase (struct ubi_device *ubi,struct ubi_wl_entry *e, -int vol_id,int lnum,int torture) +int vol_id,int lnum,int torture,bool nested) {struct ubi_work *wl_wrk;
@@ -909,7 +911,10 @@ static int schedule_erase(struct ubi_dev wl_wrk->lnum = lnum; wl_wrk->torture = torture; -schedule_ubi_work (ubi, wl_wrk); +if (nested) +__schedule_ubi_work (ubi, wl_wrk); +else +schedule_ubi_work (ubi, wl_wrk);return 0 ; }
@@ -982,7 +987,7 @@ int ubi_wl_put_fm_peb(struct ubi_devicespin_unlock (&ubi->wl_lock); vol_id = lnum ?UBI_FM_DATA_VOLUME_ID :UBI_FM_SB_VOLUME_ID ; - return schedule_erase(ubi, e, vol_id, lnum, torture); + return schedule_erase(ubi, e, vol_id, lnum, torture, true); }#endif
@@ -1015,6 +1020,7 @@ static int wear_leveling_worker(struct uif (!vid_hdr)return -ENOMEM ; +down_read (&ubi->fm_sem);mutex_lock (&ubi->move_mutex);spin_lock (&ubi->wl_lock);ubi_assert (!ubi->move_from && !ubi->move_to);
@@ -1241,6 +1247,7 @@ static int wear_leveling_worker(struct udbg_wl ("done" );mutex_unlock (&ubi->move_mutex); +up_read (&ubi->fm_sem);return 0 ;/*
@@ -1282,6 +1289,7 @@ out_not_moved: }mutex_unlock (&ubi->move_mutex); +up_read (&ubi->fm_sem);return 0 ; out_error:
@@ -1303,6 +1311,7 @@ out_error: out_ro:ubi_ro_mode (ubi);mutex_unlock (&ubi->move_mutex); +up_read (&ubi->fm_sem);ubi_assert (err !=0 );return err <0 ? err : -EIO ;
@@ -1310,6 +1319,7 @@ out_cancel: ubi->wl_scheduled =0 ;spin_unlock (&ubi->wl_lock);mutex_unlock (&ubi->move_mutex); +up_read (&ubi->fm_sem);ubi_free_vid_hdr (ubi, vid_hdr);return 0 ; }
@@ -1411,7 +1421,7 @@ int ubi_ensure_anchor_pebs(struct ubi_de wrk->anchor =1 ; wrk->func = &wear_leveling_worker; -schedule_ubi_work (ubi, wrk); +__schedule_ubi_work (ubi, wrk); return 0; }#endif
@@ -1477,7 +1487,7 @@ static int erase_worker(struct ubi_devicint err1;/* Re-schedule the LEB for erasure */ - err1 =schedule_erase (ubi, e, vol_id, lnum,0 ); + err1 =schedule_erase (ubi, e, vol_id, lnum,0 , false);if (err1) { err = err1; goto out_ro;
@@ -1633,7 +1643,7 @@ retry: }spin_unlock (&ubi->wl_lock); - err =schedule_erase (ubi, e, vol_id, lnum, torture); + err =schedule_erase (ubi, e, vol_id, lnum, torture, false);if (err) {spin_lock (&ubi->wl_lock);wl_tree_add (e, &ubi->used);
@@ -1922,7 +1932,7 @@ int ubi_wl_init(struct ubi_device *ubi, e->ec = aeb->ec;ubi_assert (!ubi_is_fm_block (ubi, e->pnum)); ubi->lookuptbl[e->pnum] = e; -if (schedule_erase (ubi, e, aeb->vol_id, aeb->lnum,0 )) { +if (schedule_erase (ubi, e, aeb->vol_id, aeb->lnum,0 , false)) {kmem_cache_free (ubi_wl_entry_slab, e); goto out_free; }
PATCH 91/306 ubi: Fix Fastmap's update_vol()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit f7d11b33d4e8cedf19367c09b891bbc705163976 upstream.
Usually Fastmap is free to consider every PEB in one of the pools as newer than the existing PEB. Since PEBs in a pool are by definition newer than everything else.
But update_vol() missed the case that a pool can contain more than one candidate.
--- drivers/mtd/ubi/fastmap.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/ubi/fastmap.c +1 -0
@@ -258,6 +258,7 @@ static int update_vol(struct ubi_device aeb->pnum = new_aeb->pnum; aeb->copy_flag = new_vh->copy_flag; aeb->scrub = new_aeb->scrub; + aeb->sqnum = new_aeb->sqnum;kmem_cache_free (ai->aeb_slab_cache, new_aeb);/* new_aeb is older */
PATCH 92/306 i40e: avoid NULL pointer dereference and recursive errors on early PCI error
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guilherme G Piccoli <[email protected]>
commit edfc23ee3e0ebbb6713d7574ab1b00abff178f6c upstream.
Although rare, it's possible to hit PCI error early on device probe, meaning possibly some structs are not entirely initialized, and some might even be completely uninitialized, leading to NULL pointer dereference.
The i40e driver currently presents a "bad" behavior if device hits such early PCI error: firstly, the struct i40e_pf might not be attached to pci_dev yet, leading to a NULL pointer dereference on access to pf->state.
Even checking if the struct is NULL and avoiding the access in that case isn't enough, since the driver cannot recover from PCI error that early; in our experiments we saw multiple failures on kernel log, like:
[549.664] i40e 0007:01:00.1: Initial pf_reset failed: -15 [549.664] i40e: probe of 0007:01:00.1 failed with error -15 [...] [871.644] i40e 0007:01:00.1: The driver for the device stopped because the device firmware failed to init. Try updating your NVM image. [871.644] i40e: probe of 0007:01:00.1 failed with error -32 [...] [872.516] i40e 0007:01:00.0: ARQ: Unknown event 0x0000 ignored
Between the first probe failure (error -15) and the second (error -32) another PCI error happened due to the first bad probe. Also, driver started to flood console with those ARQ event messages.
This patch will prevent these issues by allowing error recovery mechanism to remove the failed device from the system instead of trying to recover from early PCI errors during device probe.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -0
@@ -8829,6 +8829,12 @@ static pci_ers_result_t i40e_pci_error_ddev_info (&pdev->dev,"%s: error %d\n" , __func__, error); +if (!pf) { +dev_info (&pdev->dev, +"Cannot recover - error happened during device probe\n" ); +return PCI_ERS_RESULT_DISCONNECT ; + } +/* shutdown all operations */ if (!test_bit (__I40E_SUSPENDED, &pf->state)) {rtnl_lock ();
PATCH 93/306 powerpc/powernv: Use CPU-endian PEST in pnv_pci_dump_p7ioc_diag_data()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit 5adaf8629b193f185ca5a1665b9e777a0579f518 upstream.
This fixes the warnings reported from sparse:
pci.c:312:33: warning: restricted __be64 degrades to integer pci.c:313:33: warning: restricted __be64 degrades to integer
--- arch/powerpc/platforms/powernv/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/powernv/pci.c +2 -2
@@ -189,8 +189,8 @@ static void pnv_pci_dump_p7ioc_diag_data data->dma1ErrorLog0, data->dma1ErrorLog1);for (i =0 ; i <OPAL_P7IOC_NUM_PEST_REGS ; i++) { -if ((data->pestA[i] >>63 ) ==0 && - (data->pestB[i] >>63 ) ==0 ) +if ((be64_to_cpu (data->pestA[i]) >>63 ) ==0 && + (be64_to_cpu (data->pestB[i]) >>63 ) ==0 )continue ; pr_info("PE[%3d] A/B: %016llx %016llx\n",
PATCH 94/306 mfd: wm8350-i2c: Make sure the i2c regmap functions are compiled
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
commit 88003fb10f1fc606e1704611c62ceae95fd1d7da upstream.
This fixes a compile failure:
drivers/built-in.o: In function `wm8350_i2c_probe': core.c:(.text+0x828b0): undefined reference to `__devm_regmap_init_i2c' Makefile:953: recipe for target 'vmlinux' failed
--- drivers/mfd/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/Kconfig +1 -0
@@ -1203,6 +1203,7 @@ config MFD_WM8350 config MFD_WM8350_I2C bool "Wolfson Microelectronics WM8350 with I2C" select MFD_WM8350 + select REGMAP_I2C depends on I2C=y help The WM8350 is an integrated audio and power management
PATCH 95/306 mfd: 88pm80x: Double shifting bug in suspend/resume
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 9a6dc644512fd083400a96ac4a035ac154fe6b8d upstream.
set_bit() and clear_bit() take the bit number so this code is really doing "1 << (1 << irq)" which is a double shift bug. It's done consistently so it won't cause a problem unless "irq" is more than 4.
--- include/linux/mfd/88pm80x.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/mfd/88pm80x.h +2 -2
@@ -349,7 +349,7 @@ static inline int pm80x_dev_suspend(struint irq =platform_get_irq (pdev,0 );if (device_may_wakeup (dev)) -set_bit ((1 << irq), &chip->wu_flag); +set_bit (irq, &chip->wu_flag);return 0 ; }
@@ -361,7 +361,7 @@ static inline int pm80x_dev_resume(strucint irq =platform_get_irq (pdev,0 );if (device_may_wakeup (dev)) -clear_bit ((1 << irq), &chip->wu_flag); +clear_bit (irq, &chip->wu_flag);return 0 ; }
PATCH 96/306 mfd: rtsx_usb: Avoid setting ucr->current_sg.status
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lu Baolu <[email protected]>
commit 8dcc5ff8fcaf778bb57ab4448fedca9e381d088f upstream.
Member "status" of struct usb_sg_request is managed by usb core. A spin lock is used to serialize the change of it. The driver could check the value of req->status, but should avoid changing it without the hold of the spinlock. Otherwise, it could cause race or error in usb core.
This patch could be backported to stable kernels with version later than v3.14.
--- drivers/mfd/rtsx_usb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/rtsx_usb.c +5 -5
@@ -46,9 +46,6 @@ static void rtsx_usb_sg_timed_out(unsigndev_dbg (&ucr->pusb_intf->dev,"%s: sg transfer timed out" , __func__);usb_sg_cancel (&ucr->current_sg); - -/* we know the cancellation is caused by time-out */ - ucr->current_sg.status = -ETIMEDOUT ; } static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr,
@@ -67,12 +64,15 @@ static int rtsx_usb_bulk_transfer_sglist ucr->sg_timer.expires = jiffies +msecs_to_jiffies (timeout);add_timer (&ucr->sg_timer);usb_sg_wait (&ucr->current_sg); -del_timer_sync (&ucr->sg_timer); +if (!del_timer_sync (&ucr->sg_timer)) + ret = -ETIMEDOUT ; +else + ret = ucr->current_sg.status;if (act_len) *act_len = ucr->current_sg.bytes; -return ucr->current_sg.status; +return ret; } int rtsx_usb_transfer_data(struct rtsx_ucr *ucr, unsigned int pipe,
PATCH 97/306 async_pq_val: fix DMA memory leak
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Justin Maggard <[email protected]>
commit c84750906b4818d4929fbf73a4ae6c113b94f52b upstream.
Add missing dmaengine_unmap_put(), so we don't OOM during RAID6 sync.
--- crypto/async_tx/async_pq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
crypto/async_tx/async_pq.c +4 -4
@@ -355,8 +355,6 @@ async_syndrome_val(struct page **blocks,dma_set_unmap (tx, unmap);async_tx_submit (chan, tx, submit); - -return tx; }else {struct page *p_src =P (blocks, disks);struct page *q_src =Q (blocks, disks);
@@ -411,9 +409,11 @@ async_syndrome_val(struct page **blocks, submit->cb_param = cb_param_orig; submit->flags = flags_orig;async_tx_sync_epilog (submit); - -return NULL ; + tx =NULL ; } +dmaengine_unmap_put (unmap); + +return tx; }EXPORT_SYMBOL_GPL (async_syndrome_val);
PATCH 98/306 mm: filemap: fix mapping->nrpages double accounting in fuse
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit 3ddf40e8c31964b744ff10abb48c8e36a83ec6e7 upstream.
Commit 22f2ac51b6d6 ("mm: workingset: fix crash in shadow node shrinker caused by replace_page_cache_page()") switched replace_page_cache() from raw radix tree operations to page_cache_tree_insert() but didn't take into account that the latter function, unlike the raw radix tree op, handles mapping->nrpages. As a result, that counter is bumped for each page replacement rather than balanced out even.
The mapping->nrpages counter is used to skip needless radix tree walks when invalidating, truncating, syncing inodes without pages, as well as statistics for userspace. Since the error is positive, we'll do more page cache tree walks than necessary; we won't miss a necessary one. And we'll report more buffer pages to userspace than there are. The error is limited to fuse inodes.
--- mm/filemap.c | 1 - 1 file changed, 1 deletion(-)
mm/filemap.c +0 -1
@@ -545,7 +545,6 @@ int replace_page_cache_page(struct page__delete_from_page_cache (old,NULL ); error =page_cache_tree_insert (mapping, new,NULL );BUG_ON (error); - mapping->nrpages++;__inc_zone_page_state (new,NR_FILE_PAGES );if (PageSwapBacked (new))__inc_zone_page_state (new,NR_SHMEM );
PATCH 99/306 netlink: do not enter direct reclaim from netlink_dump()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit d35c99ff77ecb2eb239731b799386f3b3637a31e upstream.
Since linux-3.15, netlink_dump() can use up to 16384 bytes skb allocations.
Due to struct skb_shared_info ~320 bytes overhead, we end up using order-3 (on x86) page allocations, that might trigger direct reclaim and add stress.
The intent was really to attempt a large allocation but immediately fallback to a smaller one (order-1 on x86) in case of memory stress.
On recent kernels (linux-4.4), we can remove __GFP_DIRECT_RECLAIM to meet the goal. Old kernels would need to remove __GFP_WAIT
While we are at it, since we do an order-3 allocation, allow to use all the allocated bytes instead of 16384 to reduce syscalls during large dumps.
iproute2 already uses 32KB recvmsg() buffer sizes.
Alexei provided an initial patch downsizing to SKB_WITH_OVERHEAD(16384)
[bwh: Backported to 3.16:
- Adjust context
- Mask out __GFP_WAIT, as suggested]
--- net/netlink/af_netlink.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netlink/af_netlink.c +3 -4
@@ -2461,7 +2461,7 @@ static int netlink_recvmsg(struct kiocb/* Record the max length of recvmsg() calls for future allocations */ nlk->max_recvmsg_len =max (nlk->max_recvmsg_len, len); nlk->max_recvmsg_len =min_t (size_t, nlk->max_recvmsg_len, -16384 ); +SKB_WITH_OVERHEAD (32768 )); copied = data_skb->len;if (len < copied) {
@@ -2719,9 +2719,8 @@ static int netlink_dump(struct sock *sk)if (alloc_min_size < nlk->max_recvmsg_len) { alloc_size = nlk->max_recvmsg_len; skb =netlink_alloc_skb (sk, alloc_size, nlk->portid, -GFP_KERNEL | - __GFP_NOWARN | - __GFP_NORETRY); + (GFP_KERNEL & ~__GFP_WAIT) | + __GFP_NOWARN | __GFP_NORETRY); }if (!skb) { alloc_size = alloc_min_size;
PATCH 100/306 metag: Only define atomic_dec_if_positive conditionally
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 35d04077ad96ed33ceea2501f5a4f1eacda77218 upstream.
The definition of atomic_dec_if_positive() assumes that atomic_sub_if_positive() exists, which is only the case if metag specific atomics are used. This results in the following build error when trying to build metag1_defconfig.
kernel/ucount.c: In function 'dec_ucount':kernel/ucount.c:211: error:
implicit declaration of function 'atomic_sub_if_positive'
Moving the definition of atomic_dec_if_positive() into the metag conditional code fixes the problem.
--- arch/metag/include/asm/atomic.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/metag/include/asm/atomic.h +1 -2
@@ -39,11 +39,10 @@#define atomic_dec (v) atomic_sub(1, (v))#define atomic_inc_not_zero (v) atomic_add_unless((v), 1, 0) +#define atomic_dec_if_positive (v) atomic_sub_if_positive(1, v)#endif -#define atomic_dec_if_positive (v) atomic_sub_if_positive(1, v) -#include <asm-generic/atomic64.h> #endif /* __ASM_METAG_ATOMIC_H */
PATCH 101/306 IB/srp: Fix infinite loop when FMR sg[0].offset != 0
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 681cc3608355737c1effebc8145f95c8c3344bc3 upstream.
Avoid that mapping an sg-list in which the first element has a non-zero offset triggers an infinite loop when using FMR. This patch makes the FMR mapping code similar to that of ib_sg_to_pages().
Note: older Mellanox HCAs do not support non-zero offsets for FMR. See also commit 8c4037b501ac ("IB/srp: always avoid non-zero offsets into an FMR").
--- drivers/infiniband/ulp/srp/ib_srp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/infiniband/ulp/srp/ib_srp.c +5 -3
@@ -1310,7 +1310,9 @@ static int srp_map_sg_entry(struct srp_mwhile (dma_len) {unsigned offset = dma_addr & ~dev->mr_page_mask; -if (state->npages == dev->max_pages_per_mr || offset !=0 ) { + +if (state->npages == dev->max_pages_per_mr || + (state->npages >0 && offset !=0 )) { ret =srp_finish_mapping (state, target);if (ret)return ret;
@@ -1329,12 +1331,12 @@ static int srp_map_sg_entry(struct srp_m }/* -* If the last entry of the MR wasn't a full page, then we need to +* If the end of the MR is not on a page boundary then we need to * close it out and start a new one -- we can only merge at page * boundries. */ ret =0 ; -if (len != dev->mr_page_size) { +if ((dma_addr & ~dev->mr_page_mask) !=0 ) { ret =srp_finish_mapping (state, target);if (!ret)srp_map_update_start (state,NULL ,0 ,0 );
PATCH 102/306 Input: elantech - add Fujitsu Lifebook E556 to force crc_enabled
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 62837b3c1a95535d1a287c9c8c6563bbd8d37033 upstream.
Another Lifebook machine that needs the same quirk as other similar models to make the driver working.
Also let's reorder elantech_dmi_force_crc_enabled list so LIfebook enries are in alphabetical order.
--- drivers/input/mouse/elantech.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/input/mouse/elantech.c +9 -2
@@ -1389,6 +1389,13 @@ static const struct dmi_system_id elante }, }, { +/* Fujitsu LIFEBOOK E544 does not work with crc_enabled == 0 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"), + }, + }, + {/* Fujitsu LIFEBOOK E554 does not work with crc_enabled == 0 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
@@ -1396,10 +1403,10 @@ static const struct dmi_system_id elante }, }, { -/* Fujitsu LIFEBOOK E544 does not work with crc_enabled == 0 */ +/* Fujitsu LIFEBOOK E556 does not work with crc_enabled == 0 */ .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), - DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E556"), }, }, {
PATCH 103/306 mm/hugetlb: fix memory offline with hugepage size > memory block size
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <[email protected]>
commit 2247bb335ab9c40058484cac36ea74ee652f3b7b upstream.
Patch series "mm/hugetlb: memory offline issues with hugepages", v4.
This addresses several issues with hugepages and memory offline. While the first patch fixes a panic, and is therefore rather important, the last patch is just a performance optimization.
The second patch fixes a theoretical issue with reserved hugepages, while still leaving some ugly usability issue, see description.
This patch (of 3):
dissolve_free_huge_pages() will either run into the VM_BUG_ON() or a list corruption and addressing exception when trying to set a memory block offline that is part (but not the first part) of a "gigantic" hugetlb page with a size > memory block size.
When no other smaller hugetlb page sizes are present, the VM_BUG_ON() will trigger directly. In the other case we will run into an addressing exception later, because dissolve_free_huge_page() will not work on the head page of the compound hugetlb page which will result in a NULL hstate from page_hstate().
To fix this, first remove the VM_BUG_ON() because it is wrong, and then use the compound head page in dissolve_free_huge_page(). This means that an unused pre-allocated gigantic page that has any part of itself inside the memory block that is going offline will be dissolved completely. Losing an unused gigantic hugepage is preferable to failing the memory offline, for example in the situation where a (possibly faulty) memory DIMM needs to go offline.
--- mm/hugetlb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
mm/hugetlb.c +7 -6
@@ -1073,12 +1073,13 @@ static void dissolve_free_huge_page(stru {spin_lock (&hugetlb_lock);if (PageHuge (page) && !page_count (page)) { -struct hstate *h =page_hstate (page); -int nid =page_to_nid (page); -list_del (&page->lru); +struct page *head =compound_head (page); +struct hstate *h =page_hstate (head); +int nid =page_to_nid (head); +list_del (&head->lru); h->free_huge_pages--; h->free_huge_pages_node[nid]--; -update_and_free_page (h, page); +update_and_free_page (h, head); }spin_unlock (&hugetlb_lock); }
@@ -1086,7 +1087,8 @@ static void dissolve_free_huge_page(stru/* * Dissolve free hugepages in a given pfn range. Used by memory hotplug to * make specified memory blocks removable from the system. -* Note that start_pfn should aligned with (minimum) hugepage size. +* Note that this will dissolve a free gigantic hugepage completely, if any +* part of it lies within the given range. */ void dissolve_free_huge_pages (unsigned long start_pfn,unsigned long end_pfn) {
@@ -1095,7 +1097,6 @@ void dissolve_free_huge_pages(unsigned lif (!hugepages_supported ())return ; -VM_BUG_ON (!IS_ALIGNED (start_pfn,1 << minimum_order));for (pfn = start_pfn; pfn < end_pfn; pfn +=1 << minimum_order)dissolve_free_huge_page (pfn_to_page (pfn)); }
PATCH 104/306 mm/hugetlb: check for reserved hugepages during memory offline
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <[email protected]>
commit 082d5b6b60e9f25e1511557fcfcb21eedd267446 upstream.
In dissolve_free_huge_pages(), free hugepages will be dissolved without making sure that there are enough of them left to satisfy hugepage reservations.
Fix this by adding a return value to dissolve_free_huge_pages() and checking h->free_huge_pages vs. h->resv_huge_pages. Note that this may lead to the situation where dissolve_free_huge_page() returns an error and all free hugepages that were dissolved before that error are lost, while the memory block still cannot be set offline.
--- include/linux/hugetlb.h | 6 +++--- mm/hugetlb.c | 26 +++++++++++++++++++++----- mm/memory_hotplug.c | 4 +++- 3 files changed, 27 insertions(+), 9 deletions(-)
include/linux/hugetlb.h +3 -3
@@ -396,8 +396,8 @@ static inline pgoff_t basepage_index(strreturn __basepage_index (page); } -extern void dissolve_free_huge_pages (unsigned long start_pfn, -unsigned long end_pfn); +extern int dissolve_free_huge_pages (unsigned long start_pfn, +unsigned long end_pfn);static inline int hugepage_migration_supported (struct hstate *h) {#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
@@ -452,7 +452,7 @@ static inline pgoff_t basepage_index(str {return page->index; } -#define dissolve_free_huge_pages (s, e) do {} while (0) +#define dissolve_free_huge_pages (s, e) 0#define hugepage_migration_supported (h) 0 static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
mm/hugetlb.c +21 -5
@@ -1067,21 +1067,31 @@ static int free_pool_huge_page(struct hs/* * Dissolve a given free hugepage into free buddy pages. This function does -* nothing for in-use (including surplus) hugepages. +* nothing for in-use (including surplus) hugepages. Returns -EBUSY if the +* number of free hugepages would be reduced below the number of reserved +* hugepages. */ -static void dissolve_free_huge_page (struct page *page) +static int dissolve_free_huge_page (struct page *page) { +int rc =0 ; +spin_lock (&hugetlb_lock);if (PageHuge (page) && !page_count (page)) {struct page *head =compound_head (page);struct hstate *h =page_hstate (head);int nid =page_to_nid (head); +if (h->free_huge_pages - h->resv_huge_pages ==0 ) { + rc = -EBUSY ; + goto out; + }list_del (&head->lru); h->free_huge_pages--; h->free_huge_pages_node[nid]--;update_and_free_page (h, head); } +out:spin_unlock (&hugetlb_lock); +return rc; }/*
@@ -1089,16 +1099,22 @@ static void dissolve_free_huge_page(stru* make specified memory blocks removable from the system. * Note that this will dissolve a free gigantic hugepage completely, if any * part of it lies within the given range. +* Also note that if dissolve_free_huge_page() returns with an error, all +* free hugepages that were dissolved before that error are lost. */ -void dissolve_free_huge_pages (unsigned long start_pfn,unsigned long end_pfn) +int dissolve_free_huge_pages (unsigned long start_pfn,unsigned long end_pfn) {unsigned long pfn; +int rc =0 ;if (!hugepages_supported ()) -return ; +return rc;for (pfn = start_pfn; pfn < end_pfn; pfn +=1 << minimum_order) -dissolve_free_huge_page (pfn_to_page (pfn)); +if (rc =dissolve_free_huge_page (pfn_to_page (pfn))) +break ; + +return rc; }static struct page *alloc_buddy_huge_page (struct hstate *h,int nid)
mm/memory_hotplug.c +3 -1
@@ -1732,7 +1732,9 @@ repeat:* dissolve free hugepages in the memory block before doing offlining * actually in order to make hugetlbfs's object counting consistent. */ -dissolve_free_huge_pages (start_pfn, end_pfn); + ret =dissolve_free_huge_pages (start_pfn, end_pfn); +if (ret) + goto failed_removal;/* check again */ offlined_pages =check_pages_isolated (start_pfn, end_pfn);if (offlined_pages <0 ) {
PATCH 105/306 vfs,mm: fix a dead loop in truncate_inode_pages_range()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
commit c2a9737f45e27d8263ff9643f994bda9bac0b944 upstream.
We triggered a deadloop in truncate_inode_pages_range() on 32 bits architecture with the test case bellow:
... fd = open(); write(fd, buf, 4096); preadv64(fd, &iovec, 1, 0xffffffff000); ftruncate(fd, 0); ...
Then ftruncate() will not return forever.
The filesystem used in this case is ubifs, but it can be triggered on many other filesystems.
When preadv64() is called with offset=0xffffffff000, a page with index=0xffffffff will be added to the radix tree of ->mapping. Then this page can be found in ->mapping with pagevec_lookup(). After that, truncate_inode_pages_range(), which is called in ftruncate(), will fall into an infinite loop:
- find a page with index=0xffffffff, since index>=end, this page won't be truncated
- index++, and index become 0
- the page with index=0xffffffff will be found again
The data type of index is unsigned long, so index won't overflow to 0 on 64 bits architecture in this case, and the dead loop won't happen.
Since truncate_inode_pages_range() is executed with holding lock of inode->i_rwsem, any operation related with this lock will be blocked, and a hung task will happen, e.g.:
INFO: task truncate_test:3364 blocked for more than 120 seconds.
...
call_rwsem_down_write_failed+0x17/0x30
generic_file_write_iter+0x32/0x1c0
ubifs_write_iter+0xcc/0x170
__vfs_write+0xc4/0x120
vfs_write+0xb2/0x1b0
SyS_write+0x46/0xa0The page with index=0xffffffff added to ->mapping is useless. Fix this by checking the read position before allocating pages.
--- mm/filemap.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/filemap.c +4 -0
@@ -1464,6 +1464,10 @@ static ssize_t do_generic_file_read(struunsigned int prev_offset;int error =0 ; +if (unlikely (*ppos >= inode->i_sb->s_maxbytes)) +return -EINVAL ; +iov_iter_truncate (iter, inode->i_sb->s_maxbytes); + index = *ppos >>PAGE_CACHE_SHIFT ; prev_index = ra->prev_pos >>PAGE_CACHE_SHIFT ; prev_offset = ra->prev_pos & (PAGE_CACHE_SIZE -1 );
Re: [PATCH 3.16 105/306] vfs,mm: fix a dead loop in truncate_inode_pages_range()
Hi, Ben,
Commit d05c5f7ba164 "vfs,mm: fix return value of read() at s_maxbytes" need be backported with this patch, otherwise we'll get an error when reading at the end of the file.
Thanks,
Wei
Quoted 82 lines · Ben Hutchings
3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
commit
c2a9737f45e27d8263ff9643f994bda9bac0b944upstream.We triggered a deadloop in
truncate_inode_pages_range()on 32 bits architecture with the test case bellow:... fd = open(); write(fd, buf, 4096); preadv64(fd, &iovec, 1, 0xffffffff000); ftruncate(fd, 0); ...Then
ftruncate()will not return forever.The filesystem used in this case is ubifs, but it can be triggered on many other filesystems.
When
preadv64()is called with offset=0xffffffff000, a page with index=0xffffffff will be added to the radix tree of ->mapping. Then this page can be found in ->mapping withpagevec_lookup(). After that,truncate_inode_pages_range(), which is called inftruncate(), will fall into an infinite loop:- find a page with index=0xffffffff, since index>=end, this page won't be truncated
- index++, and index become 0
- the page with index=0xffffffff will be found again
The data type of index is unsigned long, so index won't overflow to 0 on 64 bits architecture in this case, and the dead loop won't happen.
Since
truncate_inode_pages_range()is executed with holding lock ofinode->i_rwsem, any operation related with this lock will be blocked, and a hung task will happen, e.g.:INFO: task truncate_test:3364 blocked for more than 120 seconds. ... call_rwsem_down_write_failed+0x17/0x30 generic_file_write_iter+0x32/0x1c0 ubifs_write_iter+0xcc/0x170 __vfs_write+0xc4/0x120 vfs_write+0xb2/0x1b0 SyS_write+0x46/0xa0The page with index=0xffffffff added to ->mapping is useless. Fix this by checking the read position before allocating pages.
Signed-off-by Wei Fang <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Dave Chinner <[email protected]>Cc Al Viro <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>[bwh: Backported to 3.16: adjust context]Signed-off-by Ben Hutchings <[email protected]>--- mm/filemap.c | 4 ++++ 1 file changed, 4 insertions(+)mm/filemap.c +4
-0@@ -1464,6 +1464,10 @@ static ssize_t do_generic_file_read(struunsigned int prev_offset;int error =0 ; +if (unlikely (*ppos >= inode->i_sb->s_maxbytes)) +return -EINVAL ; +iov_iter_truncate (iter, inode->i_sb->s_maxbytes); + index = *ppos >>PAGE_CACHE_SHIFT ; prev_index = ra->prev_pos >>PAGE_CACHE_SHIFT ; prev_offset = ra->prev_pos & (PAGE_CACHE_SIZE -1 );
Re: [PATCH 3.16 105/306] vfs,mm: fix a dead loop in truncate_inode_pages_range()
Quoted 5 lines · Wei Fang
Hi, Ben,
Commit
d05c5f7ba164"vfs,mm: fix return value ofread()ats_maxbytes" need be backported with this patch, otherwise we'll get an error when reading at the end of the file.
[...]
Sorry, I should have seen the notes for this commit pointing that out. I'll add the second commit.
Ben.
Signature · 3 lines
Ben Hutchings The most exhausting thing in life is being insincere. - Anne Morrow Lindberg
PATCH 106/306 powerpc/pseries: Fix stack corruption in htpe code
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Dufour <[email protected]>
commit 05af40e885955065aee8bb7425058eb3e1adca08 upstream.
This commit fixes a stack corruption in the pseries specific code dealing with the huge pages.
In __pSeries_lpar_hugepage_invalidate() the buffer used to pass arguments to the hypervisor is not large enough. This leads to a stack corruption where a previously saved register could be corrupted leading to unexpected result in the caller, like the following panic:
Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=2048 NUMA pSeries Modules linked in: virtio_balloon ip_tables x_tables autofs4 virtio_blk 8139too virtio_pci virtio_ring 8139cp virtio CPU: 11 PID: 1916 Comm: mmstress Not tainted 4.8.0 #76 task: c000000005394880 task.stack: c000000005570000 NIP: c00000000027bf6c LR: c00000000027bf64 CTR: 0000000000000000 REGS: c000000005573820 TRAP: 0300 Not tainted (4.8.0) MSR: 8000000000009033 <SF,EE,ME,IR,DR,RI,LE> CR: 84822884 XER: 20000000 CFAR: c00000000010a924 DAR: 420000000014e5e0 DSISR: 40000000 SOFTE: 1 GPR00: c00000000027bf64 c000000005573aa0 c000000000e02800 c000000004447964 GPR04: c00000000404de18 c000000004d38810 00000000042100f5 00000000f5002104 GPR08: e0000000f5002104 0000000000000001 042100f5000000e0 00000000042100f5 GPR12: 0000000000002200 c00000000fe02c00 c00000000404de18 0000000000000000 GPR16: c1ffffffffffe7ff 00003fff62000000 420000000014e5e0 00003fff63000000 GPR20: 0008000000000000 c0000000f7014800 0405e600000000e0 0000000000010000 GPR24: c000000004d38810 c000000004447c10 c00000000404de18 c000000004447964 GPR28: c000000005573b10 c000000004d38810 00003fff62000000 420000000014e5e0 NIP [c00000000027bf6c] zap_huge_pmd+0x4c/0x470 LR [c00000000027bf64] zap_huge_pmd+0x44/0x470 Call Trace: [c000000005573aa0] [c00000000027bf64] zap_huge_pmd+0x44/0x470 (unreliable) [c000000005573af0] [c00000000022bbd8] unmap_page_range+0xcf8/0xed0 [c000000005573c30] [c00000000022c2d4] unmap_vmas+0x84/0x120 [c000000005573c80] [c000000000235448] unmap_region+0xd8/0x1b0 [c000000005573d80] [c0000000002378f0] do_munmap+0x2d0/0x4c0 [c000000005573df0] [c000000000237be4] SyS_munmap+0x64/0xb0 [c000000005573e30] [c000000000009560] system_call+0x38/0x108 Instruction dump: fbe1fff8 fb81ffe0 7c7f1b78 7ca32b78 7cbd2b78 f8010010 7c9a2378 f821ffb1 7cde3378 4bfffea9 7c7b1b79 41820298 <e87f0000> 48000130 7fa5eb78 7fc4f378
Most of the time, the bug is surfacing in a caller up in the stack from __pSeries_lpar_hugepage_invalidate() which is quite confusing.
This bug is pending since v3.11 but was hidden if a caller of the caller of __pSeries_lpar_hugepage_invalidate() has pushed the corruped register (r18 in this case) in the stack and is not using it until restoring it. GCC 6.2.0 seems to raise it more frequently.
This commit also change the definition of the parameter buffer in pSeries_lpar_flush_hash_range() to rely on the global define PLPAR_HCALL9_BUFSIZE (no functional change here).
--- arch/powerpc/platforms/pseries/lpar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/lpar.c +2 -2
@@ -391,7 +391,7 @@ static void __pSeries_lpar_hugepage_inva unsigned long *vpn, int count, int psize, int ssize) { - unsigned long param[8]; + unsigned long param[PLPAR_HCALL9_BUFSIZE];int i =0 , pix =0 , rc;unsigned long flags =0 ;int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE );
@@ -508,7 +508,7 @@ static void pSeries_lpar_flush_hash_rangunsigned long flags =0 ;struct ppc64_tlb_batch *batch = &__get_cpu_var (ppc64_tlb_batch);int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE ); -unsigned long param[9 ]; +unsigned long param[PLPAR_HCALL9_BUFSIZE ];unsigned long hash, index, shift, hidx, slot;real_pte_t pte;int psize, ssize;
PATCH 107/306 powerpc/64: Fix incorrect return value from __copy_tofrom_user
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit 1a34439e5a0b2235e43f96816dbb15ee1154f656 upstream.
Debugging a data corruption issue with virtio-net/vhost-net led to the observation that __copy_tofrom_user was occasionally returning a value 16 larger than it should. Since the return value from __copy_tofrom_user is the number of bytes not copied, this means that __copy_tofrom_user can occasionally return a value larger than the number of bytes it was asked to copy. In turn this can cause higher-level copy functions such as copy_page_to_iter_iovec to corrupt memory by copying data into the wrong memory locations.
It turns out that the failing case involves a fault on the store at label 79, and at that point the first unmodified byte of the destination is at R3 + 16. Consequently the exception handler for that store needs to add 16 to R3 before using it to work out how many bytes were not copied, but in this one case it was not adding the offset to R3. To fix it, this moves the label 179 to the point where we add 16 to R3. I have checked manually all the exception handlers for the loads and stores in this code and the rest of them are correct (it would be excellent to have an automated test of all the exception cases).
This bug has been present since this code was initially committed in May 2002 to Linux version 2.5.20.
--- arch/powerpc/lib/copyuser_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/lib/copyuser_64.S +1 -1
@@ -359,6 +359,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_ addi r3,r3,8 171: 177: +179: addi r3,r3,8 370: 372:
@@ -373,7 +374,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_ 173: 174: 175: -179: 181: 184: 186:
PATCH 108/306 x86/panic: replace smp_send_stop() with kdump friendly version in panic path
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hidehiro Kawai <[email protected]>
commit 0ee59413c967c35a6dd2dbdab605b4cd42025ee5 upstream.
Daniel Walker reported problems which happens when crash_kexec_post_notifiers kernel option is enabled
(https://lkml.org/lkml/2015/6/24/44).
In that case, smp_send_stop() is called before entering kdump routines which assume other CPUs are still online. As the result, for x86, kdump routines fail to save other CPUs' registers and disable virtualization extensions.
To fix this problem, call a new kdump friendly function, crash_smp_send_stop(), instead of the smp_send_stop() when crash_kexec_post_notifiers is enabled. crash_smp_send_stop() is a weak function, and it just call smp_send_stop(). Architecture codes should override it so that kdump can work appropriately. This patch only provides x86-specific version.
For Xen's PV kernel, just keep the current behavior.
NOTES:
- Right solution would be to place crash_smp_send_stop() before __crash_kexec() invocation in all cases and remove smp_send_stop(), but we can't do that until all architectures implement own crash_smp_send_stop()
- crash_smp_send_stop()-like work is still needed by machine_crash_shutdown() because crash_kexec() can be called without entering panic()
--- arch/x86/include/asm/kexec.h | 1 + arch/x86/include/asm/smp.h | 1 + arch/x86/kernel/crash.c | 22 ++++++++++++++++++--- arch/x86/kernel/smp.c | 5 +++++ kernel/panic.c | 47 +++++++++++++++++++++++++++++++++++++------- 5 files changed, 66 insertions(+), 10 deletions(-)
arch/x86/include/asm/kexec.h +1 -0
@@ -165,6 +165,7 @@ struct kimage_arch {typedef void crash_vmclear_fn (void );extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss; +extern void kdump_nmi_shootdown_cpus (void );#endif /* __ASSEMBLY__ */
arch/x86/include/asm/smp.h +1 -0
@@ -69,6 +69,7 @@ struct smp_ops {void (*smp_cpus_done)(unsigned max_cpus);void (*stop_other_cpus)(int wait); +void (*crash_stop_other_cpus)(void );void (*smp_send_reschedule)(int cpu);int (*cpu_up)(unsigned cpu,struct task_struct *tidle);
arch/x86/kernel/crash.c +19 -3
@@ -82,7 +82,7 @@ static void kdump_nmi_callback(int cpu,disable_local_APIC (); } -static void kdump_nmi_shootdown_cpus (void ) +void kdump_nmi_shootdown_cpus (void ) { in_crash_kexec =1 ;nmi_shootdown_cpus (kdump_nmi_callback);
@@ -90,8 +90,24 @@ static void kdump_nmi_shootdown_cpus(voi disable_local_APIC(); } +/* Override the weak function in kernel/panic.c */ +void crash_smp_send_stop (void ) +{ +static int cpus_stopped; + +if (cpus_stopped) +return ; + +if (smp_ops.crash_stop_other_cpus) + smp_ops.crash_stop_other_cpus (); +else +smp_send_stop (); + + cpus_stopped =1 ; +} +#else -static void kdump_nmi_shootdown_cpus (void ) +void crash_smp_send_stop (void ) {/* There are no cpus to shootdown */ }
@@ -110,7 +126,7 @@ void native_machine_crash_shutdown(struc/* The kernel is broken so disable interrupts */ local_irq_disable (); -kdump_nmi_shootdown_cpus (); +crash_smp_send_stop ();/* * VMCLEAR VMCSs loaded on this cpu if needed.
arch/x86/kernel/smp.c +5 -0
@@ -31,6 +31,8 @@#include <asm/apic.h> #include <asm/nmi.h> #include <asm/trace/irq_vectors.h> +#include <asm/kexec.h> +/* * Some notes on x86 processor bugs affecting SMP operation: *
@@ -347,6 +349,9 @@ struct smp_ops smp_ops = { .smp_cpus_done = native_smp_cpus_done, .stop_other_cpus = native_stop_other_cpus, +#if defined(CONFIG_KEXEC_CORE) + .crash_stop_other_cpus = kdump_nmi_shootdown_cpus, +#endif .smp_send_reschedule = native_smp_send_reschedule, .cpu_up = native_cpu_up,
kernel/panic.c +41 -7
62 lines not on this page · raw message
PATCH 109/306 mips/panic: replace smp_send_stop() with kdump friendly version in panic path
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hidehiro Kawai <[email protected]>
commit 54c721b857fd45f3ad3bda695ee4f472518db02a upstream.
Daniel Walker reported problems which happens when crash_kexec_post_notifiers kernel option is enabled
(https://lkml.org/lkml/2015/6/24/44).
In that case, smp_send_stop() is called before entering kdump routines which assume other CPUs are still online. As the result, kdump routines fail to save other CPUs' registers. Additionally for MIPS OCTEON, it misses to stop the watchdog timer.
To fix this problem, call a new kdump friendly function, crash_smp_send_stop(), instead of the smp_send_stop() when crash_kexec_post_notifiers is enabled. crash_smp_send_stop() is a weak function, and it just call smp_send_stop(). Architecture codes should override it so that kdump can work appropriately. This patch provides MIPS version.
--- arch/mips/cavium-octeon/setup.c | 14 ++++++++++++++ arch/mips/include/asm/kexec.h | 1 + arch/mips/kernel/crash.c | 18 +++++++++++++++++- arch/mips/kernel/machine_kexec.c | 1 + 4 files changed, 33 insertions(+), 1 deletion(-)
arch/mips/cavium-octeon/setup.c +14 -0
@@ -247,6 +247,17 @@ static void octeon_crash_shutdown(struct default_machine_crash_shutdown(regs); } +#ifdef CONFIG_SMP +void octeon_crash_smp_send_stop (void ) +{ +int cpu; + +/* disable watchdogs */ +for_each_online_cpu (cpu) +cvmx_write_csr (CVMX_CIU_WDOGX (cpu_logical_map (cpu)),0 ); +} +#endif +#endif /* CONFIG_KEXEC */ #ifdef CONFIG_CAVIUM_RESERVE32
@@ -827,6 +838,9 @@ void __init prom_init(void) _machine_kexec_shutdown = octeon_shutdown; _machine_crash_shutdown = octeon_crash_shutdown; _machine_kexec_prepare = octeon_kexec_prepare; +#ifdef CONFIG_SMP + _crash_smp_send_stop = octeon_crash_smp_send_stop; +#endif #endif octeon_user_io_init ();
arch/mips/include/asm/kexec.h +1 -0
@@ -45,6 +45,7 @@ extern const unsigned char kexec_smp_waiextern unsigned long secondary_kexec_args[4 ];extern void (*relocated_kexec_smp_wait) (void *);extern atomic_t kexec_ready_to_reboot; +extern void (*_crash_smp_send_stop)(void );#endif #endif
arch/mips/kernel/crash.c +17 -1
@@ -37,9 +37,14 @@ static void crash_shutdown_secondary(voistatic void crash_kexec_prepare_cpus (void ) { +static int cpus_stopped;unsigned int msecs; +unsigned int ncpus; -unsigned int ncpus =num_online_cpus () -1 ;/* Excluding the panic cpu */ +if (cpus_stopped) +return ; + + ncpus =num_online_cpus () -1 ;/* Excluding the panic cpu */ dump_send_ipi (crash_shutdown_secondary);smp_wmb ();
@@ -54,6 +59,17 @@ static void crash_kexec_prepare_cpus(voicpu_relax (); mdelay(1); } + + cpus_stopped =1 ; +} + +/* Override the weak function in kernel/panic.c */ +void crash_smp_send_stop (void ) +{ +if (_crash_smp_send_stop) +_crash_smp_send_stop (); + +crash_kexec_prepare_cpus (); }#else /* !defined(CONFIG_SMP) */
arch/mips/kernel/machine_kexec.c +1 -0
@@ -25,6 +25,7 @@ void (*_machine_crash_shutdown)(struct p#ifdef CONFIG_SMP void (*relocated_kexec_smp_wait) (void *);atomic_t kexec_ready_to_reboot =ATOMIC_INIT (0 ); +void (*_crash_smp_send_stop)(void ) =NULL ;#endif int
PATCH 110/306 compiler: Allow 1- and 2-byte smp_load_acquire() and smp_store_release()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Paul E. McKenney" <[email protected]>
commit 536fa402221f09633e7c5801b327055ab716a363 upstream.
CPUs without single-byte and double-byte loads and stores place some "interesting" requirements on concurrent code. For example (adapted from Peter Hurley's test code), suppose we have the following structure:
struct foo {
spinlock_t lock1;
spinlock_t lock2;
char a; /* Protected by lock1. */
char b; /* Protected by lock2. */
};
struct foo *foop;Of course, it is common (and good) practice to place data protected by different locks in separate cache lines. However, if the locks are rarely acquired (for example, only in rare error cases), and there are a great many instances of the data structure, then memory footprint can trump false-sharing concerns, so that it can be better to place them in the same cache cache line as above.
But if the CPU does not support single-byte loads and stores, a store to foop->a will do a non-atomic read-modify-write operation on foop->b, which will come as a nasty surprise to someone holding foop->lock2. So we now require CPUs to support single-byte and double-byte loads and stores. Therefore, this commit adjusts the definition of __native_word() to allow these sizes to be used by smp_load_acquire() and smp_store_release().
--- include/linux/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler.h +1 -1
@@ -311,7 +311,7 @@ void ftrace_likely_update(struct ftrace_/* Is this type a native word size -- useful for atomic operations */ #ifndef __native_word -# define __native_word (t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) +# define __native_word (t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))#endif /* Compile time object size, -1 for unknown */
PATCH 111/306 ipc: remove use of seq_printf return value
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
commit 7f032d6ef6154868a2a5d5f6b2c3f8587292196c upstream.
The seq_printf return value, because it's frequently misused, will eventually be converted to void.
See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
seq_has_overflowed() and make public")
--- ipc/msg.c | 34 ++++++++++++++++++---------------- ipc/sem.c | 26 ++++++++++++++------------ ipc/shm.c | 42 ++++++++++++++++++++++-------------------- ipc/util.c | 6 ++++-- 4 files changed, 58 insertions(+), 50 deletions(-)
ipc/msg.c +18 -16
@@ -1046,22 +1046,24 @@ static int sysvipc_msg_proc_show(structstruct user_namespace *user_ns =seq_user_ns (s);struct msg_queue *msq = it; -return seq_printf (s, -"%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n" , - msq->q_perm.key, - msq->q_perm.id, - msq->q_perm.mode, - msq->q_cbytes, - msq->q_qnum, - msq->q_lspid, - msq->q_lrpid, -from_kuid_munged (user_ns, msq->q_perm.uid), -from_kgid_munged (user_ns, msq->q_perm.gid), -from_kuid_munged (user_ns, msq->q_perm.cuid), -from_kgid_munged (user_ns, msq->q_perm.cgid), - msq->q_stime, - msq->q_rtime, - msq->q_ctime); +seq_printf (s, +"%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n" , + msq->q_perm.key, + msq->q_perm.id, + msq->q_perm.mode, + msq->q_cbytes, + msq->q_qnum, + msq->q_lspid, + msq->q_lrpid, +from_kuid_munged (user_ns, msq->q_perm.uid), +from_kgid_munged (user_ns, msq->q_perm.gid), +from_kuid_munged (user_ns, msq->q_perm.cuid), +from_kgid_munged (user_ns, msq->q_perm.cgid), + msq->q_stime, + msq->q_rtime, + msq->q_ctime); + + return 0; }#endif
ipc/sem.c +14 -12
@@ -2191,17 +2191,19 @@ static int sysvipc_sem_proc_show(struct sem_otime =get_semotime (sma); -return seq_printf (s, -"%10d %10d %4o %10u %5u %5u %5u %5u %10lu %10lu\n" , - sma->sem_perm.key, - sma->sem_perm.id, - sma->sem_perm.mode, - sma->sem_nsems, -from_kuid_munged (user_ns, sma->sem_perm.uid), -from_kgid_munged (user_ns, sma->sem_perm.gid), -from_kuid_munged (user_ns, sma->sem_perm.cuid), -from_kgid_munged (user_ns, sma->sem_perm.cgid), - sem_otime, - sma->sem_ctime); +seq_printf (s, +"%10d %10d %4o %10u %5u %5u %5u %5u %10lu %10lu\n" , + sma->sem_perm.key, + sma->sem_perm.id, + sma->sem_perm.mode, + sma->sem_nsems, +from_kuid_munged (user_ns, sma->sem_perm.uid), +from_kgid_munged (user_ns, sma->sem_perm.gid), +from_kuid_munged (user_ns, sma->sem_perm.cuid), +from_kgid_munged (user_ns, sma->sem_perm.cgid), + sem_otime, + sma->sem_ctime); + + return 0; }#endif
ipc/shm.c +22 -20
47 lines not on this page · raw message
ipc/util.c +4 -2
@@ -877,8 +877,10 @@ static int sysvipc_proc_show(struct seq_struct ipc_proc_iter *iter = s->private;struct ipc_proc_iface *iface = iter->iface; -if (it ==SEQ_START_TOKEN ) -return seq_puts (s, iface->header); +if (it ==SEQ_START_TOKEN ) { +seq_puts (s, iface->header); +return 0 ; + }return iface->show (s, it); }
PATCH 112/306 ipc/sem.c: fix complex_count vs. simple op race
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Manfred Spraul <[email protected]>
commit 5864a2fd3088db73d47942370d0f7210a807b9bc upstream.
Commit 6d07b68ce16a ("ipc/sem.c: optimize sem_lock()") introduced a race:
sem_lock has a fast path that allows parallel simple operations. There are two reasons why a simple operation cannot run in parallel:
- a non-simple operations is ongoing (sma->sem_perm.lock held)
- a complex operation is sleeping (sma->complex_count != 0)
As both facts are stored independently, a thread can bypass the current checks by sleeping in the right positions. See below for more details (or kernel bugzilla 105651).
The patch fixes that by creating one variable (complex_mode) that tracks both reasons why parallel operations are not possible.
The patch also updates stale documentation regarding the locking.
With regards to stable kernels:
The patch is required for all kernels that include the commit 6d07b68ce16a ("ipc/sem.c: optimize sem_lock()") (3.10?)
The alternative is to revert the patch that introduced the race.
The patch is safe for backporting, i.e. it makes no assumptions about memory barriers in spin_unlock_wait().
Background:
Here is the race of the current implementation:
Thread A: (simple op)
- does the first "sma->complex_count == 0" test
Thread B: (complex op)
- does sem_lock(): This includes an array scan. But the scan can't find Thread A, because Thread A does not own sem->lock yet.
- the thread does the operation, increases complex_count, drops sem_lock, sleeps
Thread A:
- spin_lock(&sem->lock), spin_is_locked(sma->sem_perm.lock)
- sleeps before the complex_count test
Thread C: (complex op)
- does sem_lock (no array scan, complex_count==1)
- wakes up Thread B.
- decrements complex_count
Thread A:
- does the complex_count test
Bug:
Now both thread A and thread C operate on the same array, without any synchronization.
[bwh: Backported to 3.16:
- We missed out on some earlier memory barrier changes
- Use set_mb instead of smp_store_mb]
---
include/linux/sem.h +1 -0
@@ -21,6 +21,7 @@ struct sem_array {struct list_head list_id;/* undo requests on this array */ int sem_nsems;/* no. of semaphores in array */ int complex_count;/* pending complex operations */ +bool complex_mode;/* no parallel simple ops */ };#ifdef CONFIG_SYSVIPC
ipc/sem.c +83 -56
221 lines not on this page · raw message
PATCH 113/306 MIPS: ptrace: Fix regs_return_value for kernel context
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marcin Nowakowski <[email protected]>
commit 74f1077b5b783e7bf4fa3007cefdc8dbd6c07518 upstream.
Currently regs_return_value always negates reg[2] if it determines the syscall has failed, but when called in kernel context this check is invalid and may result in returning a wrong value.
This fixes errors reported by CONFIG_KPROBES_SANITY_TEST
Patchwork: https://patchwork.linux-mips.org/patch/14381/
--- arch/mips/include/asm/ptrace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/ptrace.h +1 -1
@@ -70,7 +70,7 @@ static inline int is_syscall_success(strstatic inline long regs_return_value (struct pt_regs *regs) { -if (is_syscall_success (regs)) +if (is_syscall_success (regs) || !user_mode (regs))return regs->regs[2 ];else return -regs->regs[2 ];
PATCH 114/306 Display number of credits available
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 9742805d6b1bfb45d7f267648c34fb5bcd347397 upstream.
In debugging smb3, it is useful to display the number
of credits available, so we can see when the server has not granted sufficient operations for the client to make progress, or alternatively the client has requested too many credits (as we saw in a recent bug) so we can compare with the number of credits the server thinks we have.
Add a /proc/fs/cifs/DebugData line to display the client view on how many credits are available.
--- fs/cifs/cifs_debug.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/cifs_debug.c +1 -0
@@ -170,6 +170,7 @@ static int cifs_debug_data_proc_show(strlist_for_each (tmp1, &cifs_tcp_ses_list) { server = list_entry(tmp1, struct TCP_Server_Info, tcp_ses_list); +seq_printf (m,"\nNumber of credits: %d" , server->credits); i++;list_for_each (tmp2, &server->smb_ses_list) { ses = list_entry(tmp2, struct cifs_ses,
PATCH 115/306 cifs: Limit the overall credit acquired
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
commit 7d414f396c91a3382e51cf628c1cf0709ad0188b upstream.
The kernel client requests 2 credits for many operations even though they only use 1 credit (presumably to build up a buffer of credit). Some servers seem to give the client as much credit as is requested. In this case, the amount of credit the client has continues increasing to the point where (server->credits * MAX_BUFFER_SIZE) overflows in smb2_wait_mtu_credits().
Fix this by throttling the credit requests if an set limit is reached. For async requests where the credit charge may be > 1, request as much credit as what is charged.
The limit is chosen somewhat arbitrarily. The Windows client defaults to 128 credits, the Windows server allows clients up to 512 credits (or 8192 for Windows 2016), and the NetApp server (and at least one other) does not limit clients at all. Choose a high enough value such that the client shouldn't limit performance.
This behavior was seen with a NetApp filer (NetApp Release 9.0RC2).
---
fs/cifs/smb2glob.h +10 -0
@@ -61,4 +61,14 @@/* Maximum buffer size value we can send with 1 credit */ #define SMB2_MAX_BUFFER_SIZE 65536 +/* +* Maximum number of credits to keep available. +* This value is chosen somewhat arbitrarily. The Windows client +* defaults to 128 credits, the Windows server allows clients up to +* 512 credits, and the NetApp server does not limit clients at all. +* Choose a high enough value such that the client shouldn't limit +* performance. +*/ +#define SMB2_MAX_CREDITS_AVAILABLE 32000 +#endif /* _SMB2_GLOB_H */
fs/cifs/smb2pdu.c +15 -1
@@ -102,7 +102,21 @@ smb2_hdr_assemble(struct smb2_hdr *hdr, hdr->ProtocolId[3 ] ='B' ; hdr->StructureSize =cpu_to_le16 (64 ); hdr->Command = smb2_cmd; - hdr->CreditRequest =cpu_to_le16 (2 );/* BB make this dynamic */ +if (tcon && tcon->ses && tcon->ses->server) { +struct TCP_Server_Info *server = tcon->ses->server; + +spin_lock (&server->req_lock); +/* Request up to 2 credits but don't go over the limit. */ +if (server->credits >=SMB2_MAX_CREDITS_AVAILABLE ) + hdr->CreditRequest =cpu_to_le16 (0 ); +else + hdr->CreditRequest =cpu_to_le16 ( +min_t (int,SMB2_MAX_CREDITS_AVAILABLE - + server->credits,2 )); +spin_unlock (&server->req_lock); + }else { + hdr->CreditRequest =cpu_to_le16 (2 ); + } hdr->ProcessId =cpu_to_le32 ((__u16 )current->tgid);if (!tcon)
PATCH 116/306 Set previous session id correctly on SMB3 reconnect
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit c2afb8147e69819885493edf3a7c1ce03aaf2d4e upstream.
--- fs/cifs/smb2pdu.c | 5 +++++ fs/cifs/smb2pdu.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
fs/cifs/smb2pdu.c +5 -0
@@ -566,6 +566,7 @@ SMB2_sess_setup(const unsigned int xid,char *security_blob;unsigned char *ntlmssp_blob =NULL ;bool use_spnego = false;/* else use raw ntlmssp */ +u64 previous_session = ses->Suid;cifs_dbg (FYI ,"Session Setup\n" );
@@ -602,6 +603,10 @@ ssetup_ntlmssp_authenticate:return rc; req->hdr.SessionId =0 ;/* First session, not a reauthenticate */ + +/* if reconnect, we need to send previous sess id, otherwise it is 0 */ + req->PreviousSessionId = previous_session; + req->VcNumber =0 ;/* MBZ */ /* to enable echos and oplocks */ req->hdr.CreditRequest =cpu_to_le16 (3 );
fs/cifs/smb2pdu.h +1 -1
@@ -245,7 +245,7 @@ struct smb2_sess_setup_req {__le32 Channel;__le16 SecurityBufferOffset;__le16 SecurityBufferLength; -__le64 PreviousSessionId; +__u64 PreviousSessionId;__u8 Buffer[1 ];/* variable length GSS security buffer */ } __packed;
PATCH 117/306 SMB3: GUIDs should be constructed as random but valid uuids
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit fa70b87cc6641978b20e12cc5d517e9ffc0086d4 upstream.
GUIDs although random, and 16 bytes, need to be generated as proper uuids.
---
fs/cifs/cifsfs.c +1 -1
@@ -256,7 +256,7 @@ cifs_alloc_inode(struct super_block *sb) cifs_inode->createtime =0 ; cifs_inode->epoch =0 ;#ifdef CONFIG_CIFS_SMB2 -get_random_bytes (cifs_inode->lease_key,SMB2_LEASE_KEY_SIZE ); +generate_random_uuid (cifs_inode->lease_key);#endif /* * Can not set i_flags here - they get immediately overwritten to zero
fs/cifs/connect.c +1 -1
@@ -2147,7 +2147,7 @@ cifs_get_tcp_session(struct smb_vol *volmemcpy (&tcp_ses->dstaddr, &volume_info->dstaddr,sizeof (tcp_ses->dstaddr));#ifdef CONFIG_CIFS_SMB2 -get_random_bytes (tcp_ses->client_guid,SMB2_CLIENT_GUID_SIZE ); +generate_random_uuid (tcp_ses->client_guid);#endif /* * at this point we are the only ones with the pointer
fs/cifs/smb2ops.c +1 -1
@@ -855,7 +855,7 @@ smb2_set_lease_key(struct inode *inode,static void smb2_new_lease_key (struct cifs_fid *fid) { -get_random_bytes (fid->lease_key,SMB2_LEASE_KEY_SIZE ); +generate_random_uuid (fid->lease_key); }#define SMB2_SYMLINK_STRUCT_SIZE \
PATCH 118/306 Clarify locking of cifs file and tcon structures and make more granular
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 3afca265b5f53a0b15b79531c13858049505582d upstream.
Remove the global file_list_lock to simplify cifs/smb3 locking and have spinlocks that more closely match the information they are protecting.
Add new tcon->open_file_lock and file->file_info_lock spinlocks. Locks continue to follow a heirachy,
cifs_socket --> cifs_ses --> cifs_tcon --> cifs_file
where global tcp_ses_lock still protects socket and cifs_ses, while the the newer locks protect the lower level structure's information (tcon and cifs_file respectively).
--- fs/cifs/cifsfs.c | 1 - fs/cifs/cifsglob.h | 30 ++++++++++++------------- fs/cifs/cifssmb.c | 4 ++-- fs/cifs/file.c | 66 ++++++++++++++++++++++++++++++++---------------------- fs/cifs/misc.c | 15 +++++++------ fs/cifs/readdir.c | 6 ++--- fs/cifs/smb2misc.c | 16 ++++++------- 7 files changed, 75 insertions(+), 63 deletions(-)
fs/cifs/cifsfs.c +0 -1
@@ -1193,7 +1193,6 @@ init_cifs(void) GlobalTotalActiveXid =0 ; GlobalMaxActiveXid =0 ;spin_lock_init (&cifs_tcp_ses_lock); -spin_lock_init (&cifs_file_list_lock);spin_lock_init (&GlobalMid_Lock);if (cifs_max_pending <2 ) {
fs/cifs/cifsglob.h +15 -15
@@ -796,6 +796,7 @@ struct cifs_tcon {struct list_head tcon_list;int tc_count;struct list_head openFileList; +spinlock_t open_file_lock;/* protects list above */ struct cifs_ses *ses;/* pointer to session associated with */ char treeName[MAX_TREE_SIZE +1 ];/* UNC name of resource in ASCII */ char *nativeFileSystem;
@@ -852,7 +853,7 @@ struct cifs_tcon {#endif /* CONFIG_CIFS_STATS2 */ __u64 bytes_read;__u64 bytes_written; -spinlock_t stat_lock; +spinlock_t stat_lock;/* protects the two fields above */ #endif /* CONFIG_CIFS_STATS */ FILE_SYSTEM_DEVICE_INFO fsDevInfo;FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo;/* ok if fs name truncated */
@@ -999,8 +1000,10 @@ struct cifs_fid_locks { };struct cifsFileInfo { +/* following two lists are protected by tcon->open_file_lock */ struct list_head tlist;/* pointer to next fid owned by tcon */ struct list_head flist;/* next fid (file instance) for this inode */ +/* lock list below protected by cifsi->lock_sem */ struct cifs_fid_locks *llist;/* brlocks held by this fid */ kuid_t uid;/* allows finding which FileInfo structure */ __u32 pid;/* process id who opened file */
@@ -1008,11 +1011,12 @@ struct cifsFileInfo {/* BB add lock scope info here if needed */ ;/* lock scope id (0 if none) */ struct dentry *dentry; -unsigned int f_flags;struct tcon_link *tlink; +unsigned int f_flags; bool invalidHandle:1; /* file closed via session abend */ bool oplock_break_cancelled:1; -int count;/* refcount protected by cifs_file_list_lock */ +int count; +spinlock_t file_info_lock;/* protects four flag/count fields above */ struct mutex fh_mutex;/* prevents reopen race after dead ses*/ struct cifs_search_info srch_inf;struct work_struct oplock_break;/* work for oplock breaks */
@@ -1076,7 +1080,7 @@ struct cifs_writedata {/* * Take a reference on the file private data. Must be called with -* cifs_file_list_lock held. +* cfile->file_info_lock held. */ static inline void cifsFileInfo_get_locked (struct cifsFileInfo *cifs_file)
@@ -1463,8 +1467,10 @@ require use of the stronger protocol */* GlobalMid_Lock protects: * list operations on pending_mid_q and oplockQ * updates to XID counters, multiplex id and SMB sequence numbers -* cifs_file_list_lock protects: -* list operations on tcp and SMB session lists and tCon lists +* tcp_ses_lock protects: +* list operations on tcp and SMB session lists +* tcon->open_file_lock protects the list of open files hanging off the tcon +* cfile->file_info_lock protects counters and fields in cifs file struct * f_owner.lock protects certain per file struct operations * mapping->page_lock protects certain per page operations *
@@ -1496,18 +1502,12 @@ GLOBAL_EXTERN struct list_head cifs_tcp* tcp session, and the list of tcon's per smb session. It also protects * the reference counters for the server, smb session, and tcon. Finally, * changes to the tcon->tidStatus should be done while holding this lock. +* generally the locks should be taken in order tcp_ses_lock before +* tcon->open_file_lock and that before file->file_info_lock since the +* structure order is cifs_socket-->cifs_ses-->cifs_tcon-->cifs_file */ GLOBAL_EXTERN spinlock_t cifs_tcp_ses_lock; -/* -* This lock protects the cifs_file->llist and cifs_file->flist -* list operations, and updates to some flags (cifs_file->invalidHandle) -* It will be moved to either use the tcon->stat_lock or equivalent later. -* If cifs_tcp_ses_lock and the lock below are both needed to be held, then -* the cifs_tcp_ses_lock must be grabbed first and released last. -*/ -GLOBAL_EXTERN spinlock_t cifs_file_list_lock; -#ifdef CONFIG_CIFS_DNOTIFY_EXPERIMENTAL /* unused temporarily */ /* Outstanding dir notify requests */ GLOBAL_EXTERN struct list_head GlobalDnotifyReqList;
fs/cifs/cifssmb.c +2 -2
@@ -98,13 +98,13 @@ cifs_mark_open_files_invalid(struct cifsstruct list_head *tmp1;/* list all files open on tree connection and mark them invalid */ -spin_lock (&cifs_file_list_lock); +spin_lock (&tcon->open_file_lock);list_for_each_safe (tmp, tmp1, &tcon->openFileList) { open_file = list_entry(tmp, struct cifsFileInfo, tlist); open_file->invalidHandle = true; open_file->oplock_break_cancelled = true; } -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tcon->open_file_lock);/* * BB Add call to invalidate_inodes(sb) for all superblocks mounted * to this tcon.
fs/cifs/file.c +39 -27
210 lines not on this page · raw message
fs/cifs/misc.c +8 -7
@@ -120,6 +120,7 @@ tconInfoAlloc(void) ++ret_buf->tc_count;INIT_LIST_HEAD (&ret_buf->openFileList);INIT_LIST_HEAD (&ret_buf->tcon_list); +spin_lock_init (&ret_buf->open_file_lock);#ifdef CONFIG_CIFS_STATS spin_lock_init (&ret_buf->stat_lock);#endif
@@ -456,7 +457,7 @@ is_valid_oplock_break(char *buffer, strucontinue ;cifs_stats_inc (&tcon->stats.cifs_stats.num_oplock_brks); -spin_lock (&cifs_file_list_lock); +spin_lock (&tcon->open_file_lock);list_for_each (tmp2, &tcon->openFileList) { netfile = list_entry(tmp2, struct cifsFileInfo, tlist);
@@ -486,11 +487,11 @@ is_valid_oplock_break(char *buffer, stru &netfile->oplock_break); netfile->oplock_break_cancelled = false; -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tcon->open_file_lock);spin_unlock (&cifs_tcp_ses_lock);return true; } -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tcon->open_file_lock);spin_unlock (&cifs_tcp_ses_lock);cifs_dbg (FYI ,"No matching file for oplock break\n" );return true;
@@ -639,9 +640,9 @@ backup_cred(struct cifs_sb_info *cifs_sbvoid cifs_del_pending_open (struct cifs_pending_open *open) { -spin_lock (&cifs_file_list_lock); +spin_lock (&tlink_tcon (open->tlink)->open_file_lock);list_del (&open->olist); -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tlink_tcon (open->tlink)->open_file_lock); }void
@@ -661,7 +662,7 @@ void cifs_add_pending_open(struct cifs_fid *fid, struct tcon_link *tlink, struct cifs_pending_open *open) { - spin_lock(&cifs_file_list_lock); + spin_lock(&tlink_tcon(tlink)->open_file_lock);cifs_add_pending_open_locked (fid, tlink, open); -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tlink_tcon (open->tlink)->open_file_lock); }
fs/cifs/readdir.c +3 -3
@@ -592,14 +592,14 @@ find_cifs_entry(const unsigned int xid, is_dir_changed(file)) || (index_to_find < first_entry_in_buffer)) {/* close and restart search */ cifs_dbg (FYI ,"search backing up - close and restart search\n" ); -spin_lock (&cifs_file_list_lock); +spin_lock (&cfile->file_info_lock);if (server->ops->dir_needs_close (cfile)) { cfile->invalidHandle = true; -spin_unlock (&cifs_file_list_lock); +spin_unlock (&cfile->file_info_lock);if (server->ops->close_dir) server->ops->close_dir (xid, tcon, &cfile->fid); }else -spin_unlock (&cifs_file_list_lock); +spin_unlock (&cfile->file_info_lock);if (cfile->srch_inf.ntwrk_buf_start) {cifs_dbg (FYI ,"freeing SMB ff cache buf on search rewind\n" );if (cfile->srch_inf.smallBuf)
fs/cifs/smb2misc.c +8 -8
@@ -502,19 +502,19 @@ smb2_is_valid_lease_break(char *buffer)list_for_each (tmp1, &server->smb_ses_list) { ses = list_entry(tmp1, struct cifs_ses, smb_ses_list); -spin_lock (&cifs_file_list_lock);list_for_each (tmp2, &ses->tcon_list) { tcon = list_entry(tmp2, struct cifs_tcon, tcon_list); +spin_lock (&tcon->open_file_lock);cifs_stats_inc ( &tcon->stats.cifs_stats.num_oplock_brks);if (smb2_tcon_has_lease (tcon, rsp, lw)) { -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tcon->open_file_lock);spin_unlock (&cifs_tcp_ses_lock);return true; } +spin_unlock (&tcon->open_file_lock); } -spin_unlock (&cifs_file_list_lock); } }spin_unlock (&cifs_tcp_ses_lock);
@@ -556,7 +556,7 @@ smb2_is_valid_oplock_break(char *buffer, tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);cifs_stats_inc (&tcon->stats.cifs_stats.num_oplock_brks); -spin_lock (&cifs_file_list_lock); +spin_lock (&tcon->open_file_lock);list_for_each (tmp2, &tcon->openFileList) { cfile = list_entry(tmp2, struct cifsFileInfo, tlist);
@@ -568,7 +568,7 @@ smb2_is_valid_oplock_break(char *buffer,cifs_dbg (FYI ,"file id match, oplock break\n" ); cinode =CIFS_I (cfile->dentry->d_inode); - +spin_lock (&cfile->file_info_lock);if (!CIFS_CACHE_WRITE (cinode) && rsp->OplockLevel ==SMB2_OPLOCK_LEVEL_NONE ) cfile->oplock_break_cancelled = true;
@@ -590,14 +590,14 @@ smb2_is_valid_oplock_break(char *buffer,clear_bit (CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2 , &cinode->flags); - +spin_unlock (&cfile->file_info_lock);queue_work (cifsiod_wq, &cfile->oplock_break); -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tcon->open_file_lock);spin_unlock (&cifs_tcp_ses_lock);return true; } -spin_unlock (&cifs_file_list_lock); +spin_unlock (&tcon->open_file_lock);spin_unlock (&cifs_tcp_ses_lock);cifs_dbg (FYI ,"No matching file for oplock break\n" );return true;
PATCH 119/306 Do not send SMB3 SET_INFO request if nothing is changing
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 18dd8e1a65ddae2351d0f0d6dd4a334f441fc5fa upstream.
[CIFS] We had cases where we sent a SMB2/SMB3 setinfo request with all timestamp (and DOS attribute) fields marked as 0 (ie do not change) e.g. on chmod or chown.
--- fs/cifs/smb2inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/cifs/smb2inode.c +6 -0
@@ -266,9 +266,15 @@ smb2_set_file_info(struct inode *inode,struct tcon_link *tlink;int rc; +if ((buf->CreationTime ==0 ) && (buf->LastAccessTime ==0 ) && + (buf->LastWriteTime ==0 ) && (buf->ChangeTime) && + (buf->Attributes ==0 )) +return 0 ;/* would be a no op, no sense sending this */ + tlink =cifs_sb_tlink (cifs_sb);if (IS_ERR (tlink))return PTR_ERR (tlink); + rc =smb2_open_op_close (xid,tlink_tcon (tlink), cifs_sb, full_path,FILE_WRITE_ATTRIBUTES ,FILE_OPEN ,0 , buf,SMB2_OP_SET_INFO );
PATCH 120/306 Cleanup missing frees on some ioctls
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 24df1483c272c99ed88b0cba135d0e1dfdee3930 upstream.
Cleanup some missing mem frees on some cifs ioctls, and clarify others to make more obvious that no data is returned.
[bwh: Backported to 3.16:
- Drop changes to smb2_duplicate_extents(), smb3_set_integrity()
- Adjust context]
---
fs/cifs/smb2ops.c +2 -1
@@ -228,7 +228,7 @@ SMB3_request_interfaces(const unsigned i le64_to_cpu(out_buf->LinkSpeed)); }else cifs_dbg (VFS ,"error %d on ioctl to get interface list\n" , rc); - +kfree (out_buf);return rc; }#endif /* STATS2 */
@@ -640,6 +640,7 @@ smb2_clone_range(const unsigned int xid, cchunk_out:kfree (pcchunk); +kfree (retbuf);return rc; }
PATCH 121/306 fs/super.c: fix race between freeze_super() and thaw_super()
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 89f39af129382a40d7cd1f6914617282cfeee28e upstream.
Change thaw_super() to check frozen != SB_FREEZE_COMPLETE rather than frozen == SB_UNFROZEN, otherwise it can race with freeze_super() which drops sb->s_umount after SB_FREEZE_WRITE to preserve the lock ordering.
In this case thaw_super() will wrongly call s_op->unfreeze_fs() before it was actually frozen, and call sb_freeze_unlock() which leads to the unbalanced percpu_up_write(). Unfortunately lockdep can't detect this, so this triggers misc BUG_ON()'s in kernel/rcu/sync.c.
--- fs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/super.c +3 -3
@@ -1337,8 +1337,8 @@ int freeze_super(struct super_block *sb) } }/* -* This is just for debugging purposes so that fs can warn if it -* sees write activity when frozen is set to SB_FREEZE_COMPLETE. +* For debugging purposes so that fs can warn if it sees write activity +* when frozen is set to SB_FREEZE_COMPLETE, and for thaw_super(). */ sb->s_writers.frozen =SB_FREEZE_COMPLETE ;up_write (&sb->s_umount);
@@ -1357,7 +1357,7 @@ int thaw_super(struct super_block *sb)int error;down_write (&sb->s_umount); -if (sb->s_writers.frozen ==SB_UNFROZEN ) { +if (sb->s_writers.frozen !=SB_FREEZE_COMPLETE ) {up_write (&sb->s_umount);return -EINVAL ; }
PATCH 122/306 mmc: core: Annotate cmd_hdr as __le32
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit 3f2d26643595973e835e8356ea90c7c15cb1b0f1 upstream.
Commit f68381a70bb2 (mmc: block: fix packed command header endianness) correctly fixed endianness handling of packed_cmd_hdr in mmc_blk_packed_hdr_wrq_prep.
But now, sparse complains about incorrect types:drivers/mmc/card/block.c:1613:27: sparse: incorrect type in assignment (different base types)drivers/mmc/card/block.c:1613:27: expected unsigned int [unsigned] [usertype] <noident>drivers/mmc/card/block.c:1613:27: got restricted __le32 [usertype] <noident>
...
So annotate cmd_hdr properly using __le32 to make everyone happy.
--- drivers/mmc/card/block.c | 2 +- drivers/mmc/card/queue.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/card/block.c +1 -1
@@ -1647,7 +1647,7 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_blk_data *md = mq->data;struct mmc_packed *packed = mqrq->packed;bool do_rel_wr, do_data_tag; -u32 *packed_cmd_hdr; +__le32 *packed_cmd_hdr;u8 hdr_blocks;u8 i =1 ;
drivers/mmc/card/queue.h +1 -1
@@ -24,7 +24,7 @@ enum mmc_packed_type {struct mmc_packed {struct list_head list; -u32 cmd_hdr[1024 ]; +__le32 cmd_hdr[1024 ];unsigned int blocks;u8 nr_entries;u8 retries;
PATCH 123/306 ASoC: cs4270: fix DAPM stream name mismatch
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: murray foster <[email protected]>
commit aa5f920993bda2095952177eea79bc8e58ae6065 upstream.
Mismatching stream names in DAPM route and widget definitions are causing compilation errors. Fixing these names allows the cs4270 driver to compile and function.
[Errors must be at probe time not compile time -- broonie]
--- sound/soc/codecs/cs4270.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/cs4270.c +4 -4
@@ -148,11 +148,11 @@ SND_SOC_DAPM_OUTPUT("AOUTR"), };static const struct snd_soc_dapm_route cs4270_dapm_routes[] = { - {"Capture" ,NULL ,"AINA" }, - {"Capture" ,NULL ,"AINB" }, + {"Capture" ,NULL ,"AINL" }, + {"Capture" ,NULL ,"AINR" }, - {"AOUTA" ,NULL ,"Playback" }, - {"AOUTB" ,NULL ,"Playback" }, + {"AOUTL" ,NULL ,"Playback" }, + {"AOUTR" ,NULL ,"Playback" }, };/**
PATCH 124/306 scsi: Fix use-after-free
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit bcd8f2e94808fcddf6ef3af5f060a36820dcc432 upstream.
This patch fixes one use-after-free report[1] by KASAN.
In __scsi_scan_target(), when a type 31 device is probed, SCSI_SCAN_TARGET_PRESENT is returned and the target will be scanned again.
Inside the following scsi_report_lun_scan(), one new scsi_device instance is allocated, and scsi_probe_and_add_lun() is called again to probe the target and still see type 31 device, finally __scsi_remove_device() is called to remove & free the device at the end of scsi_probe_and_add_lun(), so cause use-after-free in scsi_report_lun_scan().
And the following SCSI log can be observed:
scsi 0:0:2:0: scsi scan: INQUIRY pass 1 length 36
scsi 0:0:2:0: scsi scan: INQUIRY successful with code 0x0
scsi 0:0:2:0: scsi scan: peripheral device type of 31, no device added scsi 0:0:2:0: scsi scan: Sending REPORT LUNS to (try 0)
scsi 0:0:2:0: scsi scan: REPORT LUNS successful (try 0) result 0x0 scsi 0:0:2:0: scsi scan: REPORT LUN scan
scsi 0:0:2:0: scsi scan: INQUIRY pass 1 length 36
scsi 0:0:2:0: scsi scan: INQUIRY successful with code 0x0
scsi 0:0:2:0: scsi scan: peripheral device type of 31, no device added
BUG: KASAN: use-after-free in __scsi_scan_target+0xbf8/0xe40 at addr ffff88007b44a104
This patch fixes the issue by moving the putting reference at the end of scsi_report_lun_scan().
[1] KASAN report
==================================================================
[ 3.274597] PM: Adding info for serio:serio1 [ 3.275127] BUG: KASAN: use-after-free in __scsi_scan_target+0xd87/0xdf0 at addr ffff880254d8c304 [ 3.275653] Read of size 4 by task kworker/u10:0/27 [ 3.275903] CPU: 3 PID: 27 Comm: kworker/u10:0 Not tainted 4.8.0 #2121 [ 3.276258] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 [ 3.276797] Workqueue: events_unbound async_run_entry_fn [ 3.277083] ffff880254d8c380 ffff880259a37870 ffffffff94bbc6c1 ffff880078402d80 [ 3.277532] ffff880254d8bb80 ffff880259a37898 ffffffff9459fec1 ffff880259a37930 [ 3.277989] ffff880254d8bb80 ffff880078402d80 ffff880259a37920 ffffffff945a0165 [ 3.278436] Call Trace: [ 3.278528] [<ffffffff94bbc6c1>] dump_stack+0x65/0x84 [ 3.278797] [<ffffffff9459fec1>] kasan_object_err+0x21/0x70 [ 3.279063] device: 'psaux': device_add [ 3.279616] [<ffffffff945a0165>] kasan_report_error+0x205/0x500 [ 3.279651] PM: Adding info for No Bus:psaux [ 3.280202] [<ffffffff944ecd22>] ? kfree_const+0x22/0x30 [ 3.280486] [<ffffffff94bc2dc9>] ? kobject_release+0x119/0x370 [ 3.280805] [<ffffffff945a0543>] __asan_report_load4_noabort+0x43/0x50 [ 3.281170] [<ffffffff9507e1f7>] ? __scsi_scan_target+0xd87/0xdf0 [ 3.281506] [<ffffffff9507e1f7>] __scsi_scan_target+0xd87/0xdf0 [ 3.281848] [<ffffffff9507d470>] ? scsi_add_device+0x30/0x30 [ 3.282156] [<ffffffff94f7f660>] ? pm_runtime_autosuspend_expiration+0x60/0x60 [ 3.282570] [<ffffffff956ddb07>] ? _raw_spin_lock+0x17/0x40 [ 3.282880] [<ffffffff9507e505>] scsi_scan_channel+0x105/0x160 [ 3.283200] [<ffffffff9507e8a2>] scsi_scan_host_selected+0x212/0x2f0 [ 3.283563] [<ffffffff9507eb3c>] do_scsi_scan_host+0x1bc/0x250 [ 3.283882] [<ffffffff9507efc1>] do_scan_async+0x41/0x450 [ 3.284173] [<ffffffff941c1fee>] async_run_entry_fn+0xfe/0x610 [ 3.284492] [<ffffffff941a8954>] ? pwq_dec_nr_in_flight+0x124/0x2a0 [ 3.284876] [<ffffffff941d1770>] ? preempt_count_add+0x130/0x160 [ 3.285207] [<ffffffff941a9a84>] process_one_work+0x544/0x12d0 [ 3.285526] [<ffffffff941aa8e9>] worker_thread+0xd9/0x12f0 [ 3.285844] [<ffffffff941aa810>] ? process_one_work+0x12d0/0x12d0 [ 3.286182] [<ffffffff941bb365>] kthread+0x1c5/0x260 [ 3.286443] [<ffffffff940855cd>] ? __switch_to+0x88d/0x1430 [ 3.286745] [<ffffffff941bb1a0>] ? kthread_worker_fn+0x5a0/0x5a0 [ 3.287085] [<ffffffff956dde9f>] ret_from_fork+0x1f/0x40 [ 3.287368] [<ffffffff941bb1a0>] ? kthread_worker_fn+0x5a0/0x5a0 [ 3.287697] Object at ffff880254d8bb80, in cache kmalloc-2048 size: 2048 [ 3.288064] Allocated: [ 3.288147] PID = 27 [ 3.288218] [<ffffffff940b27ab>] save_stack_trace+0x2b/0x50 [ 3.288531] [<ffffffff9459f246>] save_stack+0x46/0xd0 [ 3.288806] [<ffffffff9459f4bd>] kasan_kmalloc+0xad/0xe0 [ 3.289098] [<ffffffff9459c07e>] __kmalloc+0x13e/0x250 [ 3.289378] [<ffffffff95078e5a>] scsi_alloc_sdev+0xea/0xcf0 [ 3.289701] [<ffffffff9507de76>] __scsi_scan_target+0xa06/0xdf0 [ 3.290034] [<ffffffff9507e505>] scsi_scan_channel+0x105/0x160 [ 3.290362] [<ffffffff9507e8a2>] scsi_scan_host_selected+0x212/0x2f0 [ 3.290724] [<ffffffff9507eb3c>] do_scsi_scan_host+0x1bc/0x250 [ 3.291055] [<ffffffff9507efc1>] do_scan_async+0x41/0x450 [ 3.291354] [<ffffffff941c1fee>] async_run_entry_fn+0xfe/0x610 [ 3.291695] [<ffffffff941a9a84>] process_one_work+0x544/0x12d0 [ 3.292022] [<ffffffff941aa8e9>] worker_thread+0xd9/0x12f0 [ 3.292325] [<ffffffff941bb365>] kthread+0x1c5/0x260 [ 3.292594] [<ffffffff956dde9f>] ret_from_fork+0x1f/0x40 [ 3.292886] Freed: [ 3.292945] PID = 27 [ 3.293016] [<ffffffff940b27ab>] save_stack_trace+0x2b/0x50 [ 3.293327] [<ffffffff9459f246>] save_stack+0x46/0xd0 [ 3.293600] [<ffffffff9459fa61>] kasan_slab_free+0x71/0xb0 [ 3.293916] [<ffffffff9459bac2>] kfree+0xa2/0x1f0 [ 3.294168] [<ffffffff9508158a>] scsi_device_dev_release_usercontext+0x50a/0x730 [ 3.294598] [<ffffffff941ace9a>] execute_in_process_context+0xda/0x130 [ 3.294974] [<ffffffff9508107c>] scsi_device_dev_release+0x1c/0x20 [ 3.295322] [<ffffffff94f566f6>] device_release+0x76/0x1e0 [ 3.295626] [<ffffffff94bc2db7>] kobject_release+0x107/0x370 [ 3.295942] [<ffffffff94bc29ce>] kobject_put+0x4e/0xa0 [ 3.296222] [<ffffffff94f56e17>] put_device+0x17/0x20 [ 3.296497] [<ffffffff9505201c>] scsi_device_put+0x7c/0xa0 [ 3.296801] [<ffffffff9507e1bc>] __scsi_scan_target+0xd4c/0xdf0 [ 3.297132] [<ffffffff9507e505>] scsi_scan_channel+0x105/0x160 [ 3.297458] [<ffffffff9507e8a2>] scsi_scan_host_selected+0x212/0x2f0 [ 3.297829] [<ffffffff9507eb3c>] do_scsi_scan_host+0x1bc/0x250 [ 3.298156] [<ffffffff9507efc1>] do_scan_async+0x41/0x450 [ 3.298453] [<ffffffff941c1fee>] async_run_entry_fn+0xfe/0x610 [ 3.298777] [<ffffffff941a9a84>] process_one_work+0x544/0x12d0 [ 3.299105] [<ffffffff941aa8e9>] worker_thread+0xd9/0x12f0 [ 3.299408] [<ffffffff941bb365>] kthread+0x1c5/0x260 [ 3.299676] [<ffffffff956dde9f>] ret_from_fork+0x1f/0x40 [ 3.299967] Memory state around the buggy address: [ 3.300209] ffff880254d8c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 3.300608] ffff880254d8c280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 3.300986] >ffff880254d8c300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 3.301408] ^ [ 3.301550] ffff880254d8c380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 3.301987] ffff880254d8c400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 3.302396]
==================================================================
--- drivers/scsi/scsi_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_scan.c +1 -1
@@ -1546,12 +1546,12 @@ static int scsi_report_lun_scan(struct s out_err:kfree (lun_data); out: -scsi_device_put (sdev);if (scsi_device_created (sdev))/* * the sdev we used didn't appear in the report luns scan */ __scsi_remove_device (sdev); +scsi_device_put (sdev);return ret; }
PATCH 125/306 mac80211: discard multicast and 4-addr A-MSDUs
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit ea720935cf6686f72def9d322298bf7e9bd53377 upstream.
In mac80211, multicast A-MSDUs are accepted in many cases that they shouldn't be accepted in:
* drop A-MSDUs with a multicast A1 (RA), as required by the spec in 9.11 (802.11-2012 version)
* drop A-MSDUs with a 4-addr header, since the fourth address can't actually be useful for them; unless 4-address frame format is actually requested, even though the fourth address is still not useful in this case, but ignored
Accepting the first case, in particular, is very problematic since it allows anyone else with possession of a GTK to send unicast frames encapsulated in a multicast A-MSDU, even when the AP has client isolation enabled.
--- net/mac80211/rx.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
net/mac80211/rx.c +15 -9
@@ -2008,16 +2008,22 @@ ieee80211_rx_h_amsdu(struct ieee80211_rxif (!(status->rx_flags &IEEE80211_RX_AMSDU ))return RX_CONTINUE ; -if (ieee80211_has_a4 (hdr->frame_control) && - rx->sdata->vif.type ==NL80211_IFTYPE_AP_VLAN && - !rx->sdata->u.vlan.sta) -return RX_DROP_UNUSABLE ; +if (unlikely (ieee80211_has_a4 (hdr->frame_control))) { +switch (rx->sdata->vif.type) { +case NL80211_IFTYPE_AP_VLAN : +if (!rx->sdata->u.vlan.sta) +return RX_DROP_UNUSABLE ; +break ; +case NL80211_IFTYPE_STATION : +if (!rx->sdata->u.mgd.use_4addr) +return RX_DROP_UNUSABLE ; +break ; +default : +return RX_DROP_UNUSABLE ; + } + } -if (is_multicast_ether_addr (hdr->addr1) && - ((rx->sdata->vif.type ==NL80211_IFTYPE_AP_VLAN && - rx->sdata->u.vlan.sta) || - (rx->sdata->vif.type ==NL80211_IFTYPE_STATION && - rx->sdata->u.mgd.use_4addr))) +if (is_multicast_ether_addr (hdr->addr1))return RX_DROP_UNUSABLE ; skb->dev = dev;
PATCH 126/306 jbd2: fix incorrect unlock on j_list_lock
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Taesoo Kim <[email protected]>
commit 559cce698eaf4ccecb2213b2519ea3a0413e5155 upstream.
When 'jh->b_transaction == transaction' (asserted by below)
J_ASSERT_JH(jh, (jh->b_transaction == transaction || ...
'journal->j_list_lock' will be incorrectly unlocked, since the the lock is aquired only at the end of if / else-if statements (missing the else case).
--- fs/jbd2/transaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jbd2/transaction.c +2 -1
@@ -1093,6 +1093,7 @@ int jbd2_journal_get_create_access(handlJBUFFER_TRACE (jh,"file as BJ_Reserved" );spin_lock (&journal->j_list_lock);__jbd2_journal_file_buffer (jh, transaction, BJ_Reserved); +spin_unlock (&journal->j_list_lock); }else if (jh->b_transaction == journal->j_committing_transaction) {/* first access by this transaction */ jh->b_modified =0 ;
@@ -1100,8 +1101,8 @@ int jbd2_journal_get_create_access(handlJBUFFER_TRACE (jh,"set next transaction" );spin_lock (&journal->j_list_lock); jh->b_next_transaction = transaction; +spin_unlock (&journal->j_list_lock); } -spin_unlock (&journal->j_list_lock);jbd_unlock_bh_state (bh);/*
PATCH 127/306 drm/radeon: change vblank_time's calculation method to reduce computational error.
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 02cfb5fccb0f9f968f0e208d89d9769aa16267bc upstream.
Ported from Rex's amdgpu change.
--- drivers/gpu/drm/radeon/r600_dpm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/radeon/r600_dpm.c +8 -7
@@ -155,19 +155,20 @@ u32 r600_dpm_get_vblank_time(struct radestruct drm_device *dev = rdev->ddev;struct drm_crtc *crtc;struct radeon_crtc *radeon_crtc; -u32 line_time_us, vblank_lines; +u32 vblank_in_pixels;u32 vblank_time_us =0xffffffff ;/* if the displays are off, vblank time is max */ if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) {list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { radeon_crtc =to_radeon_crtc (crtc);if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { - line_time_us = (radeon_crtc->hw_mode.crtc_htotal *1000 ) / - radeon_crtc->hw_mode.clock; - vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - - radeon_crtc->hw_mode.crtc_vdisplay + - (radeon_crtc->v_border *2 ); - vblank_time_us = vblank_lines * line_time_us; + vblank_in_pixels = + radeon_crtc->hw_mode.crtc_htotal * + (radeon_crtc->hw_mode.crtc_vblank_end - + radeon_crtc->hw_mode.crtc_vdisplay + + (radeon_crtc->v_border *2 )); + + vblank_time_us = vblank_in_pixels *1000 / radeon_crtc->hw_mode.clock;break ; } }
PATCH 128/306 ipv6: correctly add local routes when lo goes up
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
commit a220445f9f4382c36a53d8ef3e08165fa27f7e2c upstream.
The goal of the patch is to fix this scenario:
ip link add dummy1 type dummy
ip link set dummy1 up
ip link set lo down ; ip link set lo up
After that sequence, the local route to the link layer address of dummy1 is not there anymore.
When the loopback is set down, all local routes are deleted by addrconf_ifdown()/rt6_ifdown(). At this time, the rt6_info entry still exists, because the corresponding idev has a reference on it. After the rcu grace period, dst_rcu_free() is called, and thus ___dst_free(), which will set obsolete to DST_OBSOLETE_DEAD.
In this case, init_loopback() is called before dst_rcu_free(), thus obsolete is still sets to something <= 0. So, the function doesn't add the route again. To avoid that race, let's check the rt6 refcnt instead.
--- net/ipv6/addrconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/addrconf.c +1 -1
@@ -2692,7 +2692,7 @@ static void init_loopback(struct net_dev* lo device down, release this obsolete dst and * reallocate a new router for ifa. */ -if (sp_ifa->rt->dst.obsolete >0 ) { +if (!atomic_read (&sp_ifa->rt->rt6i_ref)) {ip6_rt_put (sp_ifa->rt); sp_ifa->rt =NULL ; }else {
PATCH 129/306 scsi: zfcp: spin_lock_irqsave() is not nestable
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit e7cb08e894a0b876443ef8fdb0706575dc00a5d2 upstream.
We accidentally overwrite the original saved value of "flags" so that we can't re-enable IRQs at the end of the function. Presumably this function is mostly called with IRQs disabled or it would be obvious in testing.
--- drivers/s390/scsi/zfcp_dbf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/scsi/zfcp_dbf.c +1 -1
@@ -384,7 +384,7 @@ void zfcp_dbf_san(char *tag, struct zfcp/* if (len > rec_len): * dump data up to cap_len ignoring small duplicate in rec->payload */ -spin_lock_irqsave (&dbf->pay_lock, flags); +spin_lock (&dbf->pay_lock);memset (payload,0 ,sizeof (*payload));memcpy (payload->area, paytag,ZFCP_DBF_TAG_LEN ); payload->fsf_req_id = req_id;
PATCH 130/306 mmc: sdhci: cast unsigned int to unsigned long long to avoid unexpeted error
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Chen <[email protected]>
commit 02265cd60335a2c1417abae4192611e1fc05a6e5 upstream.
Potentially overflowing expression 1000000 * data->timeout_clks with type unsigned int is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type unsigned long long.
To avoid overflow, cast 1000000U to type unsigned long long. Special thanks to Coverity.
--- drivers/mmc/host/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
@@ -669,7 +669,7 @@ static u8 sdhci_calc_timeout(struct sdhc* host->clock is in Hz. target_timeout is in us. * Hence, us = 1000000 * cycles / Hz. Round up. */ - val =1000000 * data->timeout_clks; + val =1000000ULL * data->timeout_clks;if (do_div (val, host->clock)) target_timeout++; target_timeout += val;
PATCH 131/306 mmc: rtsx_usb_sdmmc: Avoid keeping the device runtime resumed when unused
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit 31cf742f515c275d22843c4c756e048d2b6d716c upstream.
The rtsx_usb_sdmmc driver may bail out in its ->set_ios() callback when no SD card is inserted. This is wrong, as it could cause the device to remain runtime resumed when it's unused. Fix this behaviour.
--- drivers/mmc/host/rtsx_usb_sdmmc.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/mmc/host/rtsx_usb_sdmmc.c +0 -5
@@ -1138,11 +1138,6 @@ static void sdmmc_set_ios(struct mmc_hosdev_dbg (sdmmc_dev (host),"%s\n" , __func__);mutex_lock (&ucr->dev_mutex); -if (rtsx_usb_card_exclusive_check (ucr,RTSX_USB_SD_CARD )) { -mutex_unlock (&ucr->dev_mutex); -return ; - } -sd_set_power_mode (host, ios->power_mode);sd_set_bus_width (host, ios->bus_width);sd_set_timing (host, ios->timing, &host->ddr_mode);