4.4.28-stable review
Subsystems (5)
Greg Kroah-Hartman
maintainercover 4.4.28-stable review
This is the start of the stable review cycle for the 4.4.28 release. There are 112 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Oct 28 12:22:47 UTC 2016. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.28-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.28-rc1
Dinesh Israni <[email protected]>
target: Don't override EXTENDED_COPY xcopy_pt_cmd SCSI status code
Nicholas Bellinger <[email protected]>
target: Make EXTENDED_COPY 0xe4 failure return COPY TARGET DEVICE NOT REACHABLE
Nicholas Bellinger <[email protected]>
target: Re-add missing SCF_ACK_KREF assignment in v4.1.y
Richard Weinberger <[email protected]>
ubifs: Abort readdir upon error
Richard Weinberger <[email protected]>
ubifs: Fix xattr_names length in exit paths
Taesoo Kim <[email protected]>
jbd2: fix incorrect unlock on j_list_lock
Eric Biggers <[email protected]>
ext4: do not advertise encryption support when disabled
Ulf Hansson <[email protected]>
mmc: rtsx_usb_sdmmc: Handle runtime PM while changing the led
Ulf Hansson <[email protected]>
mmc: rtsx_usb_sdmmc: Avoid keeping the device runtime resumed when unused
Jiri Slaby <[email protected]>
mmc: core: Annotate cmd_hdr as __le32
Frederic Barrat <[email protected]>
powerpc/mm: Prevent unlikely crash in copro_calculate_slb()
Nikolay Borisov <[email protected]>
ceph: fix error handling in ceph_read_iter
Marc Zyngier <[email protected]>
arm64: kernel: Init MDCR_EL2 even in the absence of a PMU
Will Deacon <[email protected]>
arm64: percpu: rewrite ll/sc loops in assembly
Ulf Hansson <[email protected]>
memstick: rtsx_usb_ms: Manage runtime PM when accessing the device
Alan Stern <[email protected]>
memstick: rtsx_usb_ms: Runtime resume the device when polling for cards
Jan Kara <[email protected]>
isofs: Do not return EACCES for unknown filesystems
Vladimir Murzin <[email protected]>
irqchip/gic-v3-its: Fix entry size mask for GITS_BASER
David Hildenbrand <[email protected]>
s390/mm: fix gmap tlb flush issues
Linus Torvalds <[email protected]>
Using BUG_ON() as an assert() is _never_ acceptable
Johannes Weiner <[email protected]>
mm: filemap: fix mapping->nrpages double accounting in fuse
Johannes Weiner <[email protected]>
mm: workingset: fix crash in shadow node shrinker caused by replace_page_cache_page()
Vishal Verma <[email protected]>
acpi, nfit: check for the correct event code in notifications
Jack Morgenstein <[email protected]>
net/mlx4_core: Allow resetting VF admin mac to zero
Yuval Mintz <[email protected]>
bnx2x: Prevent false warning for lack of FC NPIV
Peter Jones <[email protected]>
PKCS#7: Don't require SpcSpOpusInfo in Authenticode pkcs7 signatures
Don Brace <[email protected]>
hpsa: correct skipping masked peripherals
Martin K. Petersen <[email protected]>
sd: Fix rw_max for devices that report an optimal xfer size
Dan Carpenter <[email protected]>
irqchip/gicv3: Handle loop timeout proper
Jiri Slaby <[email protected]>
kvm: x86: memset whole irq_eoi
Dan Williams <[email protected]>
x86/e820: Don't merge consecutive E820_PRAM ranges
Bart Van Assche <[email protected]>
blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL
Sachin Prabhu <[email protected]>
Fix regression which breaks DFS mounting
Steve French <[email protected]>
Cleanup missing frees on some ioctls
Steve French <[email protected]>
Do not send SMB3 SET_INFO request if nothing is changing
Steve French <[email protected]>
SMB3: GUIDs should be constructed as random but valid uuids
Steve French <[email protected]>
Set previous session id correctly on SMB3 reconnect
Steve French <[email protected]>
Display number of credits available
Steve French <[email protected]>
Clarify locking of cifs file and tcon structures and make more granular
Aurelien Aptel <[email protected]>
fs/cifs: keep guid when assigning fid to fileinfo
Ross Lagerwall <[email protected]>
cifs: Limit the overall credit acquired
Oleg Nesterov <[email protected]>
fs/super.c: fix race between freeze_super() and thaw_super()
Al Viro <[email protected]>
arc: don't leak bits of kernel stack into coredump
Jens Axboe <[email protected]>
lightnvm: ensure that nvm_dev_ops can be used without CONFIG_NVM
Manfred Spraul <[email protected]>
ipc/sem.c: fix complex_count vs. simple op race
Johannes Weiner <[email protected]>
mm: filemap: don't plant shadow entries without radix tree node
Guenter Roeck <[email protected]>
metag: Only define atomic_dec_if_positive conditionally
Ming Lei <[email protected]>
scsi: Fix use-after-free
Jeff Layton <[email protected]>
NFSv4.2: Fix a reference leak in nfs42_proc_layoutstats_generic
Trond Myklebust <[email protected]>
NFSv4: Open state recovery must account for file permission changes
Trond Myklebust <[email protected]>
NFSv4: nfs4_copy_delegation_stateid() must fail if the delegation is invalid
Trond Myklebust <[email protected]>
NFSv4: Don't report revoked delegations as valid in nfs_have_delegation()
David Vrabel <[email protected]>
sunrpc: fix write space race causing stalls
Dmitry Torokhov <[email protected]>
Input: elantech - add Fujitsu Lifebook E556 to force crc_enabled
Matti Kurkela <[email protected]>
Input: elantech - force needed quirks on Fujitsu H760
Marcos Paulo de Souza <[email protected]>
Input: i8042 - skip selftest on ASUS laptops
Kees Cook <[email protected]>
lib: add "on"/"off" support to kstrtobool
Kees Cook <[email protected]>
lib: update single-char callers of strtobool()
Kees Cook <[email protected]>
lib: move strtobool() to kstrtobool()
Marcin Nowakowski <[email protected]>
MIPS: ptrace: Fix regs_return_value for kernel context
James Hogan <[email protected]>
MIPS: Fix -mabi=64 build of vdso.lds
Hui Wang <[email protected]>
ALSA: hda - Fix a failure of micmute led when having multi adcs
Mauro Carvalho Chehab <[email protected]>
cx231xx: fix GPIOs for Pixelview SBTVD hybrid
Mauro Carvalho Chehab <[email protected]>
cx231xx: don't return error on success
Mauro Carvalho Chehab <[email protected]>
mb86a20s: fix demod settings
Mauro Carvalho Chehab <[email protected]>
mb86a20s: fix the locking logic
Miklos Szeredi <[email protected]>
ovl: copy_up_xattr(): use strnlen
Richard Weinberger <[email protected]>
ovl: Fix info leak in ovl_lookup_temp()
Max Staudt <[email protected]>
fbdev/efifb: Fix 16 color palette entry calculation
Dan Carpenter <[email protected]>
scsi: zfcp: spin_lock_irqsave() is not nestable
Steffen Maier <[email protected]>
zfcp: trace full payload of all SAN records (req,resp,iels)
Steffen Maier <[email protected]>
zfcp: fix payload trace length for SAN request&response
Steffen Maier <[email protected]>
zfcp: fix D_ID field with actual value on tracing SAN responses
Steffen Maier <[email protected]>
zfcp: restore tracing of handle for port and LUN with HBA records
Steffen Maier <[email protected]>
zfcp: trace on request for open and close of WKA port
Steffen Maier <[email protected]>
zfcp: restore: Dont use 0 to indicate invalid LUN in rec trace
Steffen Maier <[email protected]>
zfcp: retain trace level for SCSI and HBA FSF response records
Steffen Maier <[email protected]>
zfcp: close window with unblocked rport during rport gone
Steffen Maier <[email protected]>
zfcp: fix ELS/GS request&response length for hardware data router
Steffen Maier <[email protected]>
zfcp: fix fc_host port_type with NPIV
Richard Weinberger <[email protected]>
ubi: Deal with interrupted erasures in WL
Laurent Dufour <[email protected]>
powerpc/pseries: Fix stack corruption in htpe code
Paul Mackerras <[email protected]>
powerpc/64: Fix incorrect return value from __copy_tofrom_user
Gavin Shan <[email protected]>
powerpc/powernv: Use CPU-endian PEST in pnv_pci_dump_p7ioc_diag_data()
Gavin Shan <[email protected]>
powerpc/powernv: Use CPU-endian hub diag-data type in pnv_eeh_get_and_dump_hub_diag()
Gavin Shan <[email protected]>
powerpc/powernv: Pass CPU-endian PE number to opal_pci_eeh_freeze_clear()
Anton Blanchard <[email protected]>
powerpc/vdso64: Use double word compare on pointers
Rabin Vincent <[email protected]>
dm crypt: fix crash on exit
Mike Snitzer <[email protected]>
dm mpath: check if path's request_queue is dying in activate_path()
Minfei Huang <[email protected]>
dm: return correct error code in dm_resume()'s retry loop
Bart Van Assche <[email protected]>
dm: mark request_queue dead before destroying the DM device
Adrian Hunter <[email protected]>
perf intel-pt: Fix MTC timestamp calculation for large MTC periods
Adrian Hunter <[email protected]>
perf intel-pt: Fix estimated timestamps for cycle-accurate mode
Adrian Hunter <[email protected]>
perf intel-pt: Fix snapshot overlap detection decoder errors
Andrew Bresticker <[email protected]>
pstore/ram: Use memcpy_fromio() to save old buffer
Furquan Shaikh <[email protected]>
pstore/ram: Use memcpy_toio instead of memcpy
Sebastian Andrzej Siewior <[email protected]>
pstore/core: drop cmpxchg based updates
Sebastian Andrzej Siewior <[email protected]>
pstore/ramoops: fixup driver removal
Helge Deller <[email protected]>
parisc: Increase initial kernel mapping size
Helge Deller <[email protected]>
parisc: Fix kernel memory layout regarding position of __gp
Helge Deller <[email protected]>
parisc: Increase KERNEL_INITIAL_SIZE for 32-bit SMP kernels
Srinivas Pandruvada <[email protected]>
cpufreq: intel_pstate: Fix unsafe HWP MSR access
Sergei Shtylyov <[email protected]>
platform: don't return 0 from platform_get_irq[_byname]() on error
Maik Broemme <[email protected]>
PCI: Mark Atheros AR9580 to avoid bus reset
Haibo Chen <[email protected]>
mmc: sdhci: cast unsigned int to unsigned long long to avoid unexpeted error
Daniel Glöckner <[email protected]>
mmc: block: don't use CMD23 with very old MMC cards
Larry Finger <[email protected]>
rtlwifi: Fix missing country code for Great Britain
Lin Huang <[email protected]>
PM / devfreq: event: remove duplicate devfreq_event_get_drvdata()
Lucas Stach <[email protected]>
clk: imx6: initialize GPU clocks
Jan Remmet <[email protected]>
regulator: tps65910: Work around silicon erratum SWCZ010
Alexander Usyskin <[email protected]>
mei: me: add kaby point device ids
Liu Gang <[email protected]>
gpio: mpc8xxx: Correct irq handler function
-------------
Diffstat:
Documentation/kernel-parameters.txt | 9 +- Makefile | 4 +- arch/arc/kernel/signal.c | 8 +- arch/arm64/include/asm/percpu.h | 120 +++++++-------- arch/arm64/kernel/head.S | 3 +- arch/metag/include/asm/atomic.h | 3 +- arch/mips/include/asm/ptrace.h | 2 +- arch/mips/vdso/Makefile | 2 +- arch/parisc/include/asm/pgtable.h | 6 +- arch/parisc/kernel/setup.c | 8 + arch/parisc/kernel/vmlinux.lds.S | 7 +- arch/powerpc/kernel/vdso64/datapage.S | 2 +- arch/powerpc/kernel/vdso64/gettimeofday.S | 2 +- arch/powerpc/lib/copyuser_64.S | 2 +- arch/powerpc/mm/copro_fault.c | 2 + arch/powerpc/platforms/powernv/eeh-powernv.c | 4 +- arch/powerpc/platforms/powernv/pci.c | 4 +- arch/powerpc/platforms/pseries/lpar.c | 4 +- arch/s390/include/asm/tlbflush.h | 3 +- arch/s390/mm/pgtable.c | 4 +- arch/x86/kernel/e820.c | 2 +- arch/x86/kvm/ioapic.c | 2 +- block/blk-cgroup.c | 4 +- crypto/asymmetric_keys/pkcs7_parser.c | 4 +- drivers/acpi/nfit.c | 3 + drivers/acpi/nfit.h | 4 + drivers/base/platform.c | 4 +- drivers/clk/imx/clk-imx6q.c | 18 +++ drivers/cpufreq/intel_pstate.c | 10 +- drivers/gpio/gpio-mpc8xxx.c | 2 +- drivers/input/mouse/elantech.c | 25 +++- drivers/input/serio/i8042-io.h | 2 +- drivers/input/serio/i8042-ip22io.h | 2 +- drivers/input/serio/i8042-ppcio.h | 2 +- drivers/input/serio/i8042-sparcio.h | 2 +- drivers/input/serio/i8042-unicore32io.h | 2 +- drivers/input/serio/i8042-x86ia64io.h | 96 +++++++++++- drivers/input/serio/i8042.c | 55 +++++-- drivers/irqchip/irq-gic-v3.c | 2 +- drivers/md/dm-crypt.c | 24 ++- drivers/md/dm-mpath.c | 6 +- drivers/md/dm.c | 10 +- drivers/media/dvb-frontends/mb86a20s.c | 104 ++++++------- 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/memstick/host/rtsx_usb_ms.c | 6 + drivers/misc/mei/hw-me-regs.h | 3 + drivers/misc/mei/pci-me.c | 3 + drivers/mmc/card/block.c | 5 +- drivers/mmc/card/queue.h | 2 +- drivers/mmc/host/rtsx_usb_sdmmc.c | 7 +- drivers/mmc/host/sdhci.c | 2 +- drivers/mtd/ubi/wl.c | 21 ++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 4 + drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- drivers/net/wireless/realtek/rtlwifi/regd.c | 4 +- drivers/pci/quirks.c | 1 + drivers/regulator/tps65910-regulator.c | 6 + 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/hpsa.c | 78 +++++++++- drivers/scsi/scsi_scan.c | 2 +- drivers/scsi/sd.c | 8 +- drivers/scsi/sd.h | 5 + drivers/target/target_core_transport.c | 11 +- drivers/target/target_core_xcopy.c | 34 ++++- drivers/video/fbdev/efifb.c | 6 +- fs/ceph/file.c | 3 +- fs/cifs/cifs_debug.c | 57 ++------ fs/cifs/cifs_debug.h | 2 +- fs/cifs/cifsfs.c | 9 +- fs/cifs/cifsglob.h | 34 ++--- fs/cifs/cifssmb.c | 4 +- fs/cifs/connect.c | 16 +- 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 | 12 +- fs/cifs/smb2pdu.c | 25 +++- fs/cifs/smb2pdu.h | 2 +- fs/ext4/sysfs.c | 4 + fs/isofs/inode.c | 8 +- fs/jbd2/transaction.c | 3 +- fs/nfs/delegation.c | 16 +- fs/nfs/nfs42proc.c | 1 + fs/nfs/nfs4state.c | 3 + fs/overlayfs/copy_up.c | 12 +- fs/overlayfs/dir.c | 5 +- fs/pstore/ram.c | 17 ++- fs/pstore/ram_core.c | 49 +------ fs/super.c | 6 +- fs/ubifs/dir.c | 8 +- fs/ubifs/xattr.c | 2 + include/linux/devfreq-event.h | 5 - include/linux/irqchip/arm-gic-v3.h | 2 +- include/linux/kernel.h | 2 + include/linux/lightnvm.h | 121 +++++++-------- include/linux/sem.h | 1 + include/linux/string.h | 6 +- include/linux/swap.h | 2 + include/target/target_core_base.h | 1 + ipc/sem.c | 130 ++++++++++------- lib/kstrtox.c | 64 ++++++++ lib/string.c | 29 ---- mm/filemap.c | 95 ++++++------ mm/workingset.c | 10 +- net/sunrpc/xprtsock.c | 11 +- sound/pci/hda/dell_wmi_helper.c | 2 +- sound/pci/hda/thinkpad_helper.c | 2 +- .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 38 +++++ tools/perf/util/intel-pt.c | 15 +- 120 files changed, 1314 insertions(+), 673 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/112 gpio: mpc8xxx: Correct irq handler function
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Gang <[email protected]>
commit d71cf15b865bdd45925f7b094d169aaabd705145 upstream.
Quoted 1 line
Quoted 1 line
From the beginning of the
gpio-mpc8xxx.c, the "handle_level_irq"
has being used to handle GPIO interrupts in the PowerPC/Layerscape platforms. But actually, almost all PowerPC/Layerscape platforms assert an interrupt request upon either a high-to-low change or any change on the state of the signal.
So the "handle_level_irq" is not reasonable for PowerPC/Layerscape GPIO interrupt, it should be "handle_edge_irq". Otherwise the system may lost some interrupts from the PIN's state changes.
--- drivers/gpio/gpio-mpc8xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mpc8xxx.c +1 -1
@@ -329,7 +329,7 @@ static int mpc8xxx_gpio_irq_map(struct i irq_hw_number_t hwirq) {irq_set_chip_data (irq, h->host_data); -irq_set_chip_and_handler (irq, &mpc8xxx_irq_chip, handle_level_irq); +irq_set_chip_and_handler (irq, &mpc8xxx_irq_chip, handle_edge_irq);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 2/112 mei: me: add kaby point device ids
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Usyskin <[email protected]>
commit ac182e8abc6f93c1c4cc12f042af64c9d7be0d1e upstream.
Add device ids for Intel Kabypoint PCH (Kabylake)
--- drivers/misc/mei/hw-me-regs.h | 3 +++ drivers/misc/mei/pci-me.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/misc/mei/hw-me-regs.h +3 -0
@@ -66,6 +66,9 @@#ifndef _MEI_HW_MEI_REGS_H_#define _MEI_HW_MEI_REGS_H_ +#define MEI_DEV_ID_KBP 0xA2BA/* Kaby Point */ +#define MEI_DEV_ID_KBP_2 0xA2BB/* Kaby Point 2 */ +/* * MEI device IDs */
drivers/misc/mei/pci-me.c +3 -0
@@ -87,6 +87,9 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, mei_me_pch8_cfg)}, {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, mei_me_pch8_cfg)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, mei_me_pch8_cfg)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, mei_me_pch8_cfg)}, +/* required last entry */ {0, } };
Greg Kroah-Hartman
maintainerPATCH 3/112 regulator: tps65910: Work around silicon erratum SWCZ010
In reply to Greg Kroah-Hartman4.4-stable 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;
Greg Kroah-Hartman
maintainerPATCH 4/112 clk: imx6: initialize GPU clocks
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Stach <[email protected]>
commit d8846023aed1293e54d33499558fc2aa2b2f393f upstream.
Initialize the GPU clock muxes to sane inputs. Until now they have not been changed from their default values, which means that both GPU3D shader and GPU2D core were fed by clock inputs whose rates exceed the maximium allowed frequency of the cores by as much as 200MHz.
This fixes a severe GPU stability issue on i.MX6DL.
--- drivers/clk/imx/clk-imx6q.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/clk/imx/clk-imx6q.c +18 -0
@@ -550,6 +550,24 @@ static void __init imx6q_clocks_init(strif (IS_ENABLED (CONFIG_PCI_IMX6 ))clk_set_parent (clk[IMX6QDL_CLK_LVDS1_SEL ], clk[IMX6QDL_CLK_SATA_REF_100M ]); +/* +* Initialize the GPU clock muxes, so that the maximum specified clock +* rates for the respective SoC are not exceeded. +*/ +if (clk_on_imx6dl ()) { +clk_set_parent (clk[IMX6QDL_CLK_GPU3D_CORE_SEL ], + clk[IMX6QDL_CLK_PLL2_PFD1_594M ]); +clk_set_parent (clk[IMX6QDL_CLK_GPU2D_CORE_SEL ], + clk[IMX6QDL_CLK_PLL2_PFD1_594M ]); + }else if (clk_on_imx6q ()) { +clk_set_parent (clk[IMX6QDL_CLK_GPU3D_CORE_SEL ], + clk[IMX6QDL_CLK_MMDC_CH0_AXI ]); +clk_set_parent (clk[IMX6QDL_CLK_GPU3D_SHADER_SEL ], + clk[IMX6QDL_CLK_PLL2_PFD1_594M ]); +clk_set_parent (clk[IMX6QDL_CLK_GPU2D_CORE_SEL ], + clk[IMX6QDL_CLK_PLL3_USB_OTG ]); + } +imx_register_uart_clocks (uart_clks); }CLK_OF_DECLARE (imx6q,"fsl,imx6q-ccm" , imx6q_clocks_init);
Greg Kroah-Hartman
maintainerPATCH 5/112 PM / devfreq: event: remove duplicate devfreq_event_get_drvdata()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Huang <[email protected]>
commit c8a9a6daccad495c48d5435d3487956ce01bc6a1 upstream.
there define two devfreq_event_get_drvdata() function in devfreq-event.h when disable CONFIG_PM_DEVFREQ_EVENT, it will lead to build fail. So remove devfreq_event_get_drvdata() function.
--- include/linux/devfreq-event.h | 5 ----- 1 file changed, 5 deletions(-)
include/linux/devfreq-event.h +0 -5
@@ -148,11 +148,6 @@ static inline int devfreq_event_reset_evreturn -EINVAL ; } -static inline void *devfreq_event_get_drvdata (struct devfreq_event_dev *edev) -{ -return ERR_PTR (-EINVAL ); -} -static inline struct devfreq_event_dev *devfreq_event_get_edev_by_phandle (struct device *dev,int index) {
Greg Kroah-Hartman
maintainerPATCH 6/112 rtlwifi: Fix missing country code for Great Britain
In reply to Greg Kroah-Hartman4.4-stable 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/realtek/rtlwifi/regd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/regd.c +3 -1
@@ -345,9 +345,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 :
@@ -406,6 +406,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 :
Greg Kroah-Hartman
maintainerPATCH 8/112 mmc: sdhci: cast unsigned int to unsigned long long to avoid unexpeted error
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -675,7 +675,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;
Greg Kroah-Hartman
maintainerPATCH 9/112 PCI: Mark Atheros AR9580 to avoid bus reset
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -3136,6 +3136,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 quirk_no_pm_reset (struct pci_dev *dev) {
Greg Kroah-Hartman
maintainerPATCH 10/112 platform: dont return 0 from platform_get_irq[_byname]() on error
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -96,7 +96,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; }
@@ -154,7 +154,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; }
Greg Kroah-Hartman
maintainerPATCH 11/112 cpufreq: intel_pstate: Fix unsafe HWP MSR access
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <[email protected]>
commit f9f4872df6e1801572949f8a370c886122d4b6da upstream.
This is a requirement that MSR MSR_PM_ENABLE must be set to 0x01 before reading MSR_HWP_CAPABILITIES on a given CPU. If cpufreq init() is scheduled on a CPU which is not same as policy->cpu or migrates to a different CPU before calling msr read for MSR_HWP_CAPABILITIES, it is possible that MSR_PM_ENABLE was not to set to 0x01 on that CPU. This will cause GP fault. So like other places in this path rdmsrl_on_cpu should be used instead of rdmsrl.
Moreover the scope of MSR_HWP_CAPABILITIES is on per thread basis, so it should be read from the same CPU, for which MSR MSR_HWP_REQUEST is getting set.
dmesg dump or warning:
[ 22.014488] WARNING: CPU: 139 PID: 1 at arch/x86/mm/extable.c:50 ex_handler_rdmsr_unsafe+0x68/0x70 [ 22.014492] unchecked MSR access error: RDMSR from 0x771 [ 22.014493] Modules linked in: [ 22.014507] CPU: 139 PID: 1 Comm: swapper/0 Not tainted 4.7.5+ #1 ... ... [ 22.014516] Call Trace: [ 22.014542] [<ffffffff813d7dd1>] dump_stack+0x63/0x82 [ 22.014558] [<ffffffff8107bc8b>] __warn+0xcb/0xf0 [ 22.014561] [<ffffffff8107bcff>] warn_slowpath_fmt+0x4f/0x60 [ 22.014563] [<ffffffff810676f8>] ex_handler_rdmsr_unsafe+0x68/0x70 [ 22.014564] [<ffffffff810677d9>] fixup_exception+0x39/0x50 [ 22.014604] [<ffffffff8102e400>] do_general_protection+0x80/0x150 [ 22.014610] [<ffffffff817f9ec8>] general_protection+0x28/0x30 [ 22.014635] [<ffffffff81687940>] ? get_target_pstate_use_performance+0xb0/0xb0 [ 22.014642] [<ffffffff810600c7>] ? native_read_msr+0x7/0x40 [ 22.014657] [<ffffffff81688123>] intel_pstate_hwp_set+0x23/0x130 [ 22.014660] [<ffffffff81688406>] intel_pstate_set_policy+0x1b6/0x340 [ 22.014662] [<ffffffff816829bb>] cpufreq_set_policy+0xeb/0x2c0 [ 22.014664] [<ffffffff81682f39>] cpufreq_init_policy+0x79/0xe0 [ 22.014666] [<ffffffff81682cb0>] ? cpufreq_update_policy+0x120/0x120 [ 22.014669] [<ffffffff816833a6>] cpufreq_online+0x406/0x820 [ 22.014671] [<ffffffff8168381f>] cpufreq_add_dev+0x5f/0x90 [ 22.014717] [<ffffffff81530ac8>] subsys_interface_register+0xb8/0x100 [ 22.014719] [<ffffffff816821bc>] cpufreq_register_driver+0x14c/0x210 [ 22.014749] [<ffffffff81fe1d90>] intel_pstate_init+0x39d/0x4d5 [ 22.014751] [<ffffffff81fe13f2>] ? cpufreq_gov_dbs_init+0x12/0x12
--- drivers/cpufreq/intel_pstate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/cpufreq/intel_pstate.c +5 -5
@@ -285,14 +285,14 @@ static void intel_pstate_hwp_set(void)int min, hw_min, max, hw_max, cpu, range, adj_range;u64 value, cap; -rdmsrl (MSR_HWP_CAPABILITIES , cap); - hw_min =HWP_LOWEST_PERF (cap); - hw_max =HWP_HIGHEST_PERF (cap); - range = hw_max - hw_min; -get_online_cpus ();for_each_online_cpu (cpu) { +rdmsrl_on_cpu (cpu,MSR_HWP_CAPABILITIES , &cap); + hw_min =HWP_LOWEST_PERF (cap); + hw_max =HWP_HIGHEST_PERF (cap); + range = hw_max - hw_min; +rdmsrl_on_cpu (cpu,MSR_HWP_REQUEST , &value); adj_range = limits->min_perf_pct * range /100 ; min = hw_min + adj_range;
Greg Kroah-Hartman
maintainerPATCH 12/112 parisc: Increase KERNEL_INITIAL_SIZE for 32-bit SMP kernels
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 690d097c00c88fa9d93d198591e184164b1d8c20 upstream.
Increase the initial kernel default page mapping size for SMP kernels to 32MB and add a runtime check which panics early if the kernel is bigger than the initial mapping size.
This fixes boot crashes of 32bit SMP kernels. Due to the introduction of huge page support in kernel 4.4 and it's required initial kernel layout in memory, a 32bit SMP kernel usually got bigger (in layout, not size) than 16MB.
--- arch/parisc/include/asm/pgtable.h | 2 +- arch/parisc/kernel/setup.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
arch/parisc/include/asm/pgtable.h +1 -1
@@ -83,7 +83,7 @@ static inline void purge_tlb_entries(strprintk ("%s:%d: bad pgd %08lx.\n" , __FILE__, __LINE__, (unsigned long )pgd_val (e)) /* This is the size of the initially mapped kernel memory */ -#ifdef CONFIG_64BIT +#if defined(CONFIG_64BIT ) || defined(CONFIG_SMP )#define KERNEL_INITIAL_ORDER 25/* 1<<25 = 32MB */ #else #define KERNEL_INITIAL_ORDER 24/* 1<<24 = 16MB */
arch/parisc/kernel/setup.c +8 -0
@@ -38,6 +38,7 @@#include <linux/export.h> #include <asm/processor.h> +#include <asm/sections.h> #include <asm/pdc.h> #include <asm/led.h> #include <asm/machdep.h> /* for pa7300lc_init() proto */
@@ -140,6 +141,13 @@ void __init setup_arch(char **cmdline_p)#endif printk (KERN_CONT ".\n" ); +/* +* Check if initial kernel page mappings are sufficient. +* panic early if not, else we may access kernel functions +* and variables which can't be reached. +*/ +if (__pa ((unsigned long ) &_end) >=KERNEL_INITIAL_SIZE ) +panic ("KERNEL_INITIAL_ORDER too small!" );pdc_console_init ();
Greg Kroah-Hartman
maintainerPATCH 13/112 parisc: Fix kernel memory layout regarding position of __gp
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit f8850abb7ba68229838014b3409460e576751c6d upstream.
Architecturally we need to keep __gp below 0x1000000.
But because of ftrace and tracepoint support, the RO_DATA_SECTION now gets much bigger than it was before. By moving the linkage tables before RO_DATA_SECTION we can avoid that __gp gets positioned at a too high address.
--- arch/parisc/kernel/vmlinux.lds.S | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/parisc/kernel/vmlinux.lds.S +5 -2
@@ -88,8 +88,9 @@ SECTIONS /* Start of data section */ _sdata = .; - RO_DATA_SECTION(8) - + /* Architecturally we need to keep __gp below 0x1000000 and thus + * in front of RO_DATA_SECTION() which stores lots of tracepoint + * and ftrace symbols. */ #ifdef CONFIG_64BIT . = ALIGN(16); /* Linkage tables */
@@ -104,6 +105,8 @@ SECTIONS } #endif + RO_DATA_SECTION(8) + /* unwind info */ .PARISC.unwind : { __start___unwind = .;
Greg Kroah-Hartman
maintainerPATCH 14/112 parisc: Increase initial kernel mapping size
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 65bf34f59594c11f13d371c5334a6a0a385cd7ae upstream.
Increase the initial kernel default page mapping size for 64-bit kernels to 64 MB and for 32-bit kernels to 32 MB.
Due to the additional support of ftrace, tracepoint and huge pages the kernel size can exceed the sizes we used up to now.
--- arch/parisc/include/asm/pgtable.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/parisc/include/asm/pgtable.h +3 -3
@@ -83,10 +83,10 @@ static inline void purge_tlb_entries(strprintk ("%s:%d: bad pgd %08lx.\n" , __FILE__, __LINE__, (unsigned long )pgd_val (e)) /* This is the size of the initially mapped kernel memory */ -#if defined(CONFIG_64BIT ) || defined(CONFIG_SMP ) -#define KERNEL_INITIAL_ORDER 25/* 1<<25 = 32MB */ +#if defined(CONFIG_64BIT ) +#define KERNEL_INITIAL_ORDER 26/* 1<<26 = 64MB */ #else -#define KERNEL_INITIAL_ORDER 24/* 1<<24 = 16MB */ +#define KERNEL_INITIAL_ORDER 25/* 1<<25 = 32MB */ #endif #define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER)
Greg Kroah-Hartman
maintainerPATCH 15/112 pstore/ramoops: fixup driver removal
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit 4407de74df18ed405cc5998990004c813ccfdbde upstream.
A basic rmmod ramoops segfaults. Let's see why.
Since commit 34f0ec82e0a9 ("pstore: Correct the max_dump_cnt clearing of ramoops") sets ->max_dump_cnt to zero before looping over ->przs but we didn't use it before that either.
And since commit ee1d267423a1 ("pstore: add pstore unregister") we free that memory on rmmod.
But even then, we looped until a NULL pointer or ERR. I don't see where it is ensured that the last member is NULL. Let's try this instead:
simply error recovery and free. Clean up in error case where resources were allocated. And then, in the free path, rely on ->max_dump_cnt in the free path.
--- fs/pstore/ram.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
fs/pstore/ram.c +12 -5
@@ -375,13 +375,14 @@ static void ramoops_free_przs(struct ram {int i; - cxt->max_dump_cnt =0 ;if (!cxt->przs)return ; -for (i =0 ; !IS_ERR_OR_NULL (cxt->przs[i]); i++) +for (i =0 ; i < cxt->max_dump_cnt; i++)persistent_ram_free (cxt->przs[i]); +kfree (cxt->przs); + cxt->max_dump_cnt =0 ; } static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
@@ -406,7 +407,7 @@ static int ramoops_init_przs(struct devi GFP_KERNEL);if (!cxt->przs) {dev_err (dev,"failed to initialize a prz array for dumps\n" ); - goto fail_prz; + goto fail_mem; }for (i =0 ; i < cxt->max_dump_cnt; i++) {
@@ -417,6 +418,11 @@ static int ramoops_init_przs(struct devi err =PTR_ERR (cxt->przs[i]);dev_err (dev,"failed to request mem region (0x%zx@0x%llx): %d\n" , cxt->record_size, (unsigned long long )*paddr, err); + +while (i >0 ) { + i--; +persistent_ram_free (cxt->przs[i]); + } goto fail_prz; } *paddr += cxt->record_size;
@@ -424,7 +430,9 @@ static int ramoops_init_przs(struct devireturn 0 ; fail_prz: -ramoops_free_przs (cxt); +kfree (cxt->przs); +fail_mem: + cxt->max_dump_cnt =0 ;return err; }
@@ -583,7 +591,6 @@ static int ramoops_remove(struct platforstruct ramoops_context *cxt = &oops_cxt;pstore_unregister (&cxt->pstore); - cxt->max_dump_cnt =0 ;kfree (cxt->pstore.buf); cxt->pstore.bufsize =0 ;
Greg Kroah-Hartman
maintainerPATCH 17/112 pstore/ram: Use memcpy_toio instead of memcpy
In reply to Greg Kroah-Hartman4.4-stable 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); }
Greg Kroah-Hartman
maintainerPATCH 18/112 pstore/ram: Use memcpy_fromio() to save old buffer
In reply to Greg Kroah-Hartman4.4-stable 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,
Greg Kroah-Hartman
maintainerPATCH 19/112 perf intel-pt: Fix snapshot overlap detection decoder errors
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 810c398bc09b2f2dfde52a7d2483a710612c5fb8 upstream.
Fix occasional decoder errors decoding trace data collected in snapshot mode.
Snapshot mode can take successive snapshots of trace which might overlap. The decoder checks whether there is an overlap but only looks at the current and previous buffer. However buffers that do not contain synchronization (i.e. PSB) packets cannot be decoded or used for overlap checking. That means the decoder actually needs to check overlaps between the current buffer and the previous buffer that contained usable data. Make that change.
--- tools/perf/util/intel-pt.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
tools/perf/util/intel-pt.c +11 -4
@@ -238,7 +238,7 @@ static int intel_pt_get_trace(struct int } queue = &ptq->pt->queues.queue_array[ptq->queue_nr]; - +next: buffer =auxtrace_buffer__next (queue, buffer);if (!buffer) {if (old_buffer)
@@ -261,9 +261,6 @@ static int intel_pt_get_trace(struct int intel_pt_do_fix_overlap(ptq->pt, old_buffer, buffer))return -ENOMEM ; -if (old_buffer) -auxtrace_buffer__drop_data (old_buffer); -if (buffer->use_data) { b->len = buffer->use_size; b->buf = buffer->use_data;
@@ -273,6 +270,16 @@ static int intel_pt_get_trace(struct int } b->ref_timestamp = buffer->reference; +/* +* If in snapshot mode and the buffer has no usable data, get next +* buffer and again check overlap against old_buffer. +*/ +if (ptq->pt->snapshot_mode && !b->len) + goto next; + +if (old_buffer) +auxtrace_buffer__drop_data (old_buffer); +if (!old_buffer || ptq->pt->sampling_mode || (ptq->pt->snapshot_mode && !buffer->consecutive)) { b->consecutive = false;
Greg Kroah-Hartman
maintainerPATCH 20/112 perf intel-pt: Fix estimated timestamps for cycle-accurate mode
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 51ee6481fa8e879cc942bcc1b0af713e158b7a98 upstream.
In cycle-accurate mode, timestamps can be calculated from CYC packets. The decoder also estimates timestamps based on the number of instructions since the last timestamp. For that to work in cycle-accurate mode, the instruction count needs to be reset to zero when a timestamp is calculated from a CYC packet, but that wasn't happening, so fix it.
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +2 -0
@@ -1323,6 +1323,8 @@ static void intel_pt_calc_cyc_timestamp( timestamp, decoder->timestamp); else decoder->timestamp = timestamp; + + decoder->timestamp_insn_cnt =0 ; }/* Walk PSB+ packets when already in sync. */
Greg Kroah-Hartman
maintainerPATCH 21/112 perf intel-pt: Fix MTC timestamp calculation for large MTC periods
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 3bccbe20f6d188ce7b00326e776b745cfd35b10a upstream.
The MTC packet provides a 8-bit slice of CTC which is related to TSC by the TMA packet, however the TMA packet only provides the lower 16 bits of CTC. If mtc_shift > 8 then some of the MTC bits are not in the CTC provided by the TMA packet. Fix-up the last_mtc calculated from the TMA packet by copying the missing bits from the current MTC assuming the least difference between the two, and that the current MTC comes after last_mtc.
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +36 -0
@@ -89,6 +89,7 @@ struct intel_pt_decoder {bool pge;bool have_tma;bool have_cyc; +bool fixup_last_mtc;uint64_t pos;uint64_t last_ip;uint64_t ip;
@@ -584,10 +585,31 @@ struct intel_pt_calc_cyc_to_tsc_info {uint64_t tsc_timestamp;uint64_t timestamp;bool have_tma; +bool fixup_last_mtc;bool from_mtc;double cbr_cyc_to_tsc; }; +/* +* MTC provides a 8-bit slice of CTC but the TMA packet only provides the lower +* 16 bits of CTC. If mtc_shift > 8 then some of the MTC bits are not in the CTC +* provided by the TMA packet. Fix-up the last_mtc calculated from the TMA +* packet by copying the missing bits from the current MTC assuming the least +* difference between the two, and that the current MTC comes after last_mtc. +*/ +static void intel_pt_fixup_last_mtc (uint32_t mtc,int mtc_shift, +uint32_t *last_mtc) +{ +uint32_t first_missing_bit =1U << (16 - mtc_shift); +uint32_t mask = ~(first_missing_bit -1 ); + + *last_mtc |= mtc & mask; +if (*last_mtc >= mtc) { + *last_mtc -= first_missing_bit; + *last_mtc &=0xff ; + } +} +static int intel_pt_calc_cyc_cb (struct intel_pt_pkt_info *pkt_info) {struct intel_pt_decoder *decoder = pkt_info->decoder;
@@ -617,6 +639,11 @@ static int intel_pt_calc_cyc_cb(struct ireturn 0 ; mtc = pkt_info->packet.payload; +if (decoder->mtc_shift >8 && data->fixup_last_mtc) { + data->fixup_last_mtc = false; +intel_pt_fixup_last_mtc (mtc, decoder->mtc_shift, + &data->last_mtc); + }if (mtc > data->last_mtc) mtc_delta = mtc - data->last_mtc;else
@@ -685,6 +712,7 @@ static int intel_pt_calc_cyc_cb(struct i data->ctc_delta =0 ; data->have_tma = true; + data->fixup_last_mtc = true;return 0 ;
@@ -751,6 +779,7 @@ static void intel_pt_calc_cyc_to_tsc(str .tsc_timestamp = decoder->tsc_timestamp, .timestamp = decoder->timestamp, .have_tma = decoder->have_tma, + .fixup_last_mtc = decoder->fixup_last_mtc, .from_mtc = from_mtc, .cbr_cyc_to_tsc = 0, };
@@ -1241,6 +1270,7 @@ static void intel_pt_calc_tma(struct int } decoder->ctc_delta =0 ; decoder->have_tma = true; + decoder->fixup_last_mtc = true;intel_pt_log ("CTC timestamp " x64_fmt" last MTC %#x CTC rem %#x\n" , decoder->ctc_timestamp, decoder->last_mtc, ctc_rem); }
@@ -1255,6 +1285,12 @@ static void intel_pt_calc_mtc_timestamp( mtc = decoder->packet.payload; +if (decoder->mtc_shift >8 && decoder->fixup_last_mtc) { + decoder->fixup_last_mtc = false; +intel_pt_fixup_last_mtc (mtc, decoder->mtc_shift, + &decoder->last_mtc); + } +if (mtc > decoder->last_mtc) mtc_delta = mtc - decoder->last_mtc;else
Greg Kroah-Hartman
maintainerPATCH 22/112 dm: mark request_queue dead before destroying the DM device
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -2869,6 +2869,7 @@ EXPORT_SYMBOL_GPL(dm_device_name);static void __dm_destroy (struct mapped_device *md,bool wait) { +struct request_queue *q =dm_get_md_queue (md);struct dm_table *map;int srcu_idx;
@@ -2879,6 +2880,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); +if (dm_request_based (md) && md->kworker_task)flush_kthread_worker (&md->kworker);
Greg Kroah-Hartman
maintainerPATCH 23/112 dm: return correct error code in dm_resume()s retry loop
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minfei Huang <[email protected]>
commit 8dc23658b7aaa8b6b0609c81c8ad75e98b612801 upstream.
dm_resume() will return success (0) rather than -EINVAL if !dm_suspended_md() upon retry within dm_resume().
Reset the error code at the start of dm_resume()'s retry loop. Also, remove a useless assignment at the end of dm_resume().
--- drivers/md/dm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/md/dm.c +2 -3
@@ -3250,10 +3250,11 @@ static int __dm_resume(struct mapped_devint dm_resume (struct mapped_device *md) { -int r = -EINVAL ; +int r;struct dm_table *map =NULL ; retry: + r = -EINVAL ;mutex_lock_nested (&md->suspend_lock,SINGLE_DEPTH_NESTING );if (!dm_suspended_md (md))
@@ -3277,8 +3278,6 @@ retry: goto out;clear_bit (DMF_SUSPENDED , &md->flags); - - r =0 ; out:mutex_unlock (&md->suspend_lock);
Greg Kroah-Hartman
maintainerPATCH 24/112 dm mpath: check if paths request_queue is dying in activate_path()
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1220,10 +1220,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 ); }
Greg Kroah-Hartman
maintainerPATCH 25/112 dm crypt: fix crash on exit
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rabin Vincent <[email protected]>
commit f659b10087daaf4ce0087c3f6aec16746be9628f upstream.
As the documentation for kthread_stop() says, "if threadfn() may call do_exit() itself, the caller must ensure task_struct can't go away". dm-crypt does not ensure this and therefore crashes when crypt_dtr() calls kthread_stop(). The crash is trivially reproducible by adding a delay before the call to kthread_stop() and just opening and closing a dm-crypt device.
general protection fault: 0000 [#1] PREEMPT SMP CPU: 0 PID: 533 Comm: cryptsetup Not tainted 4.8.0-rc7+ #7 task: ffff88003bd0df40 task.stack: ffff8800375b4000 RIP: 0010: kthread_stop+0x52/0x300 Call Trace: crypt_dtr+0x77/0x120 dm_table_destroy+0x6f/0x120 __dm_destroy+0x130/0x250 dm_destroy+0x13/0x20 dev_remove+0xe6/0x120 ? dev_suspend+0x250/0x250 ctl_ioctl+0x1fc/0x530 ? __lock_acquire+0x24f/0x1b10 dm_ctl_ioctl+0x13/0x20 do_vfs_ioctl+0x91/0x6a0 ? ____fput+0xe/0x10 ? entry_SYSCALL_64_fastpath+0x5/0xbd ? trace_hardirqs_on_caller+0x151/0x1e0 SyS_ioctl+0x41/0x70 entry_SYSCALL_64_fastpath+0x1f/0xbd
This problem was introduced by bcbd94ff481e ("dm crypt: fix a possible hang due to race condition on exit").
Looking at the description of that patch (excerpted below), it seems like the problem it addresses can be solved by just using set_current_state instead of __set_current_state, since we obviously need the memory barrier.
| dm crypt: fix a possible hang due to race condition on exit | | A kernel thread executes __set_current_state(TASK_INTERRUPTIBLE), | __add_wait_queue, spin_unlock_irq and then tests kthread_should_stop(). | It is possible that the processor reorders memory accesses so that | kthread_should_stop() is executed before __set_current_state(). If | such reordering happens, there is a possible race on thread | termination: [...]
So this patch just reverts the aforementioned patch and changes the __set_current_state(TASK_INTERRUPTIBLE) to set_current_state(...). This fixes the crash and should also fix the potential hang.
--- drivers/md/dm-crypt.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/md/dm-crypt.c +10 -14
@@ -112,8 +112,7 @@ struct iv_tcw_private {* and encrypts / decrypts at the same time. */ enum flags {DM_CRYPT_SUSPENDED ,DM_CRYPT_KEY_VALID , -DM_CRYPT_SAME_CPU ,DM_CRYPT_NO_OFFLOAD , -DM_CRYPT_EXIT_THREAD }; +DM_CRYPT_SAME_CPU ,DM_CRYPT_NO_OFFLOAD };/* * The fields in here must be read only after initialization.
@@ -1204,18 +1203,20 @@ continue_locked:if (!RB_EMPTY_ROOT (&cc->write_tree)) goto pop_from_list; -if (unlikely (test_bit (DM_CRYPT_EXIT_THREAD , &cc->flags))) { -spin_unlock_irq (&cc->write_thread_wait.lock); -break ; - } - -__set_current_state (TASK_INTERRUPTIBLE ); +set_current_state (TASK_INTERRUPTIBLE );__add_wait_queue (&cc->write_thread_wait, &wait);spin_unlock_irq (&cc->write_thread_wait.lock); +if (unlikely (kthread_should_stop ())) { +set_task_state (current,TASK_RUNNING ); +remove_wait_queue (&cc->write_thread_wait, &wait); +break ; + } +schedule (); +set_task_state (current,TASK_RUNNING );spin_lock_irq (&cc->write_thread_wait.lock);__remove_wait_queue (&cc->write_thread_wait, &wait); goto continue_locked;
@@ -1530,13 +1531,8 @@ static void crypt_dtr(struct dm_target *if (!cc)return ; -if (cc->write_thread) { -spin_lock_irq (&cc->write_thread_wait.lock); -set_bit (DM_CRYPT_EXIT_THREAD , &cc->flags); -wake_up_locked (&cc->write_thread_wait); -spin_unlock_irq (&cc->write_thread_wait.lock); +if (cc->write_thread)kthread_stop (cc->write_thread); - }if (cc->io_queue)destroy_workqueue (cc->io_queue);
Greg Kroah-Hartman
maintainerPATCH 26/112 powerpc/vdso64: Use double word compare on pointers
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -59,7 +59,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
Greg Kroah-Hartman
maintainerPATCH 27/112 powerpc/powernv: Pass CPU-endian PE number to opal_pci_eeh_freeze_clear()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit d63e51b31e0b655ed0f581b8a8fd4c4b4f8d1919 upstream.
The PE number (@frozen_pe_no), filled by opal_pci_next_error() is in big-endian format. It should be converted to CPU-endian before it is passed to opal_pci_eeh_freeze_clear() when clearing the frozen state if the PE is invalid one. As Michael Ellerman pointed out, the issue is also detected by sparse:
eeh-powernv.c:1541:41: warning: incorrect type in argument 2 (different base types)
This passes CPU-endian PE number to opal_pci_eeh_freeze_clear() and it should be part of commit <0f36db77643b> ("powerpc/eeh: Fix wrong printed PE number"), which was merged to 4.3 kernel.
--- arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/eeh-powernv.c +1 -1
@@ -1395,7 +1395,7 @@ static int pnv_eeh_next_error(struct eeh/* Try best to clear it */ opal_pci_eeh_freeze_clear (phb->opal_id, - frozen_pe_no, +be64_to_cpu (frozen_pe_no),OPAL_EEH_ACTION_CLEAR_FREEZE_ALL ); ret =EEH_NEXT_ERR_NONE ; } else if ((*pe)->state & EEH_PE_ISOLATED ||
Greg Kroah-Hartman
maintainerPATCH 28/112 powerpc/powernv: Use CPU-endian hub diag-data type in pnv_eeh_get_and_dump_hub_diag()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gavin Shan <[email protected]>
commit a7032132d7560a8434e1f54b71efd7fa20f073bd upstream.
The hub diag-data type is filled with big-endian data by OPAL call opal_pci_get_hub_diag_data(). We need convert it to CPU-endian value before using it. The issue is reported by sparse as pointed by Michael Ellerman:
eeh-powernv.c:1309:21: warning: restricted __be16 degrades to integer
This converts hub diag-data type to CPU-endian before using it in pnv_eeh_get_and_dump_hub_diag().
--- arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/eeh-powernv.c +1 -1
@@ -1163,7 +1163,7 @@ static void pnv_eeh_get_and_dump_hub_diareturn ; } -switch (data->type) { +switch (be16_to_cpu (data->type)) {case OPAL_P7IOC_DIAG_TYPE_RGC :pr_info ("P7IOC diag-data for RGC\n\n" );pnv_eeh_dump_hub_diag_common (data);
Greg Kroah-Hartman
maintainerPATCH 29/112 powerpc/powernv: Use CPU-endian PEST in pnv_pci_dump_p7ioc_diag_data()
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -197,8 +197,8 @@ static void pnv_pci_dump_p7ioc_diag_data be64_to_cpu(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",
Greg Kroah-Hartman
maintainerPATCH 30/112 powerpc/64: Fix incorrect return value from __copy_tofrom_user
In reply to Greg Kroah-Hartman4.4-stable 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:
Greg Kroah-Hartman
maintainerPATCH 31/112 powerpc/pseries: Fix stack corruption in htpe code
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -406,7 +406,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 );
@@ -523,7 +523,7 @@ static void pSeries_lpar_flush_hash_rangunsigned long flags =0 ;struct ppc64_tlb_batch *batch =this_cpu_ptr (&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;
Greg Kroah-Hartman
maintainerPATCH 32/112 ubi: Deal with interrupted erasures in WL
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -643,7 +643,7 @@ static int wear_leveling_worker(struct u int shutdown) {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
@@ -777,6 +777,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(ubi, "error %d while reading VID header from PEB %d",
@@ -810,6 +820,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; }
@@ -895,7 +906,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 ;
@@ -907,6 +918,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 ;
Greg Kroah-Hartman
maintainerPATCH 33/112 zfcp: fix fc_host port_type with NPIV
In reply to Greg Kroah-Hartman4.4-stable 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;
Greg Kroah-Hartman
maintainerPATCH 34/112 zfcp: fix ELS/GS request&response length for hardware data router
In reply to Greg Kroah-Hartman4.4-stable 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));
Greg Kroah-Hartman
maintainerPATCH 35/112 zfcp: close window with unblocked rport during rport gone
In reply to Greg Kroah-Hartman4.4-stable 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"
@@ -1217,8 +1217,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"
@@ -556,6 +556,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,
@@ -577,6 +580,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 ; }
Greg Kroah-Hartman
maintainerPATCH 36/112 zfcp: retain trace level for SCSI and HBA FSF response records
In reply to Greg Kroah-Hartman4.4-stable 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 ];
@@ -442,7 +443,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 );
Greg Kroah-Hartman
maintainerPATCH 37/112 zfcp: restore: Dont use 0 to indicate invalid LUN in rec trace
In reply to Greg Kroah-Hartman4.4-stable 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 ; }/**
Greg Kroah-Hartman
maintainerPATCH 38/112 zfcp: trace on request for open and close of WKA port
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1581,7 +1581,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);
@@ -1610,6 +1610,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; }
@@ -1634,7 +1636,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);
@@ -1663,6 +1665,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; }
Greg Kroah-Hartman
maintainerPATCH 39/112 zfcp: restore tracing of handle for port and LUN with HBA records
In reply to Greg Kroah-Hartman4.4-stable 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;/**
Greg Kroah-Hartman
maintainerPATCH 40/112 zfcp: fix D_ID field with actual value on tracing SAN responses
In reply to Greg Kroah-Hartman4.4-stable 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 */
Greg Kroah-Hartman
maintainerPATCH 41/112 zfcp: fix payload trace length for SAN request&response
In reply to Greg Kroah-Hartman4.4-stable 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); }
Greg Kroah-Hartman
maintainerPATCH 42/112 zfcp: trace full payload of all SAN records (req,resp,iels)
In reply to Greg Kroah-Hartman4.4-stable 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;/**
Greg Kroah-Hartman
maintainerPATCH 43/112 scsi: zfcp: spin_lock_irqsave() is not nestable
In reply to Greg Kroah-Hartman4.4-stable 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;
Greg Kroah-Hartman
maintainerPATCH 44/112 fbdev/efifb: Fix 16 color palette entry calculation
In reply to Greg Kroah-Hartman4.4-stable 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) |
Greg Kroah-Hartman
maintainerPATCH 45/112 ovl: Fix info leak in ovl_lookup_temp()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 6a45b3628ce4dcf7498b39c87d475bab6e2a9b24 upstream.
The function uses the memory address of a struct dentry as unique id. While the address-based directory entry is only visible to root it is IMHO still worth fixing since the temporary name does not have to be a kernel address. It can be any unique number. Replace it by an atomic integer which is allowed to wrap around.
--- fs/overlayfs/dir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/overlayfs/dir.c +4 -1
@@ -12,6 +12,7 @@#include <linux/xattr.h> #include <linux/security.h> #include <linux/cred.h> +#include <linux/atomic.h> #include "overlayfs.h" void ovl_cleanup (struct inode *wdir,struct dentry *wdentry)
@@ -35,8 +36,10 @@ struct dentry *ovl_lookup_temp(struct de {struct dentry *temp;char name[20 ]; +static atomic_t temp_id =ATOMIC_INIT (0 ); -snprintf (name,sizeof (name),"#%lx" , (unsigned long ) dentry); +/* counter is allowed to wrap, since temp dentries are ephemeral */ +snprintf (name,sizeof (name),"#%x" ,atomic_inc_return (&temp_id)); temp =lookup_one_len (name, workdir,strlen (name));if (!IS_ERR (temp) && temp->d_inode) {
Greg Kroah-Hartman
maintainerPATCH 46/112 ovl: copy_up_xattr(): use strnlen
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 8b326c61de08f5ca4bc454a168f19e7e43c4cc2a upstream.
Be defensive about what underlying fs provides us in the returned xattr list buffer. strlen() may overrun the buffer, so use strnlen() and WARN if the contents are not properly null terminated.
--- fs/overlayfs/copy_up.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/overlayfs/copy_up.c +11 -1
@@ -25,6 +25,7 @@ int ovl_copy_xattr(struct dentry *old, sssize_t list_size, size, value_size =0 ;char *buf, *name, *value =NULL ;int uninitialized_var (error ); +size_t slen;if (!old->d_inode->i_op->getxattr || !new->d_inode->i_op->getxattr)
@@ -47,7 +48,16 @@ int ovl_copy_xattr(struct dentry *old, s goto out; } -for (name = buf; name < (buf + list_size); name +=strlen (name) +1 ) { +for (name = buf; list_size; name += slen) { + slen =strnlen (name, list_size) +1 ; + +/* underlying fs providing us with an broken xattr list? */ +if (WARN_ON (slen > list_size)) { + error = -EIO ; +break ; + } + list_size -= slen; +if (ovl_is_private_xattr (name))continue ; retry:
Greg Kroah-Hartman
maintainerPATCH 47/112 mb86a20s: fix the locking logic
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -317,7 +317,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",
@@ -2067,6 +2071,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,
@@ -2140,6 +2149,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" );
Greg Kroah-Hartman
maintainerPATCH 48/112 mb86a20s: fix demod settings
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -71,25 +71,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 },
@@ -97,8 +99,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,
@@ -152,42 +152,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 },
@@ -196,9 +190,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 }, };
Greg Kroah-Hartman
maintainerPATCH 49/112 cx231xx: dont return error on success
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1264,7 +1264,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)
Greg Kroah-Hartman
maintainerPATCH 50/112 cx231xx: fix GPIOs for Pixelview SBTVD hybrid
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -486,7 +486,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
@@ -712,6 +712,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 :
@@ -738,7 +739,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 ;
Greg Kroah-Hartman
maintainerPATCH 51/112 ALSA: hda - Fix a failure of micmute led when having multi adcs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hui Wang <[email protected]>
commit 4875a5f7218068cdeea5f998330dfa3d118b2fea upstream.
On a Dell laptop, there is no global adcs for all input devices, so the input devices use the different adc, as a result, dyn_adc_switch is set to true.
In this situation, it is safe to control the micmute led according to user's choice of muting/unmuting the current input device, since only current input device path is active, while other input device paths are inactive and powered down.
--- sound/pci/hda/dell_wmi_helper.c | 2 +- sound/pci/hda/thinkpad_helper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/dell_wmi_helper.c +1 -1
@@ -49,7 +49,7 @@ static void alc_fixup_dell_wmi(struct hd removefunc = true;if (dell_led_set_func (DELL_LED_MICMUTE , false) >=0 ) { dell_led_value =0 ; -if (spec->gen.num_adc_nids >1 ) +if (spec->gen.num_adc_nids >1 && !spec->gen.dyn_adc_switch)codec_dbg (codec,"Skipping micmute LED control due to several ADCs" );else { dell_old_cap_hook = spec->gen.cap_sync_hook;
sound/pci/hda/thinkpad_helper.c +1 -1
@@ -75,7 +75,7 @@ static void hda_fixup_thinkpad_acpi(stru removefunc = false; }if (led_set_func (TPACPI_LED_MICMUTE , false) >=0 ) { -if (spec->num_adc_nids >1 ) +if (spec->num_adc_nids >1 && !spec->dyn_adc_switch)codec_dbg (codec,"Skipping micmute LED control due to several ADCs" );else {
Greg Kroah-Hartman
maintainerPATCH 52/112 MIPS: Fix -mabi=64 build of vdso.lds
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit 034827c727f7f3946a18355b63995b402c226c82 upstream.
The native ABI vDSO linker script vdso.lds is built by preprocessing vdso.lds.S, with the native -mabi flag passed in to get the correct ABI definitions. Unfortunately however certain toolchains choke on -mabi=64 without a corresponding compatible -march flag, for example:
cc1: error: ‘-march=mips32r2’ is not compatible with the selected ABI scripts/Makefile.build:338: recipe for target 'arch/mips/vdso/vdso.lds' failed
Fix this by including ccflags-vdso in the KBUILD_CPPFLAGS for vdso.lds, which includes the appropriate -march flag.
Patchwork: https://patchwork.linux-mips.org/patch/14368/
--- arch/mips/vdso/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/vdso/Makefile +1 -1
@@ -75,7 +75,7 @@ obj-vdso := $(obj-vdso-y:%.o=$(obj)/%.o) $(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $(native-abi) $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi) -$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(native-abi) +$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi) $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE $(call if_changed,vdsold)
Greg Kroah-Hartman
maintainerPATCH 53/112 MIPS: ptrace: Fix regs_return_value for kernel context
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -152,7 +152,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 ];
Greg Kroah-Hartman
maintainerPATCH 54/112 lib: move strtobool() to kstrtobool()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit ef951599074ba4fad2d0efa0a977129b41e6d203 upstream.
Create the kstrtobool_from_user() helper and move strtobool() logic into the new kstrtobool() (matching all the other kstrto* functions). Provides an inline wrapper for existing strtobool() callers.
--- include/linux/kernel.h | 2 + include/linux/string.h | 6 ++++- lib/kstrtox.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/string.c | 29 ---------------------------- 4 files changed, 57 insertions(+), 30 deletions(-)
include/linux/kernel.h +2 -0
@@ -356,6 +356,7 @@ int __must_check kstrtou16(const char *sint __must_check kstrtos16 (const char *s,unsigned int base,s16 *res);int __must_check kstrtou8 (const char *s,unsigned int base,u8 *res);int __must_check kstrtos8 (const char *s,unsigned int base,s8 *res); +int __must_check kstrtobool (const char *s,bool *res);int __must_check kstrtoull_from_user (const char __user *s,size_t count,unsigned int base,unsigned long long *res);int __must_check kstrtoll_from_user (const char __user *s,size_t count,unsigned int base,long long *res);
@@ -367,6 +368,7 @@ int __must_check kstrtou16_from_user(conint __must_check kstrtos16_from_user (const char __user *s,size_t count,unsigned int base,s16 *res);int __must_check kstrtou8_from_user (const char __user *s,size_t count,unsigned int base,u8 *res);int __must_check kstrtos8_from_user (const char __user *s,size_t count,unsigned int base,s8 *res); +int __must_check kstrtobool_from_user (const char __user *s,size_t count,bool *res);static inline int __must_check kstrtou64_from_user (const char __user *s,size_t count,unsigned int base,u64 *res) {
include/linux/string.h +5 -1
@@ -127,7 +127,11 @@ extern char **argv_split(gfp_t gfp, consextern void argv_free (char **argv);extern bool sysfs_streq (const char *s1,const char *s2); -extern int strtobool (const char *s,bool *res); +extern int kstrtobool (const char *s,bool *res); +static inline int strtobool (const char *s,bool *res) +{ +return kstrtobool (s, res); +}#ifdef CONFIG_BINARY_PRINTF int vbin_printf (u32 *bin_buf,size_t size,const char *fmt,va_list args);
lib/kstrtox.c +50 -0
56 lines not on this page · raw message
lib/string.c +0 -29
@@ -630,35 +630,6 @@ bool sysfs_streq(const char *s1, const c }EXPORT_SYMBOL (sysfs_streq); -/** -* strtobool - convert common user inputs into boolean values -* @s: input string -* @res: result -* -* This routine returns 0 iff the first character is one of 'Yy1Nn0'. -* Otherwise it will return -EINVAL. Value pointed to by res is -* updated upon finding a match. -*/ -int strtobool (const char *s,bool *res) -{ -switch (s[0 ]) { -case 'y' : -case 'Y' : -case '1' : - *res = true; -break ; -case 'n' : -case 'N' : -case '0' : - *res = false; -break ; -default : -return -EINVAL ; - } -return 0 ; -} -EXPORT_SYMBOL (strtobool); -#ifndef __HAVE_ARCH_MEMSET/** * memset - Fill a region of memory with the given value
Greg Kroah-Hartman
maintainerPATCH 55/112 lib: update single-char callers of strtobool()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 1404297ebf76fd91a41de215fc8c94c2619e5fdb upstream.
Some callers of strtobool() were passing a pointer to unterminated strings. In preparation of adding multi-character processing to kstrtobool(), update the callers to not pass single-character pointers, and switch to using the new kstrtobool_from_user() helper where possible.
--- fs/cifs/cifs_debug.c | 56 ++++++++++++--------------------------------------- fs/cifs/cifs_debug.h | 2 - fs/cifs/cifsfs.c | 6 ++--- fs/cifs/cifsglob.h | 4 +-- 4 files changed, 20 insertions(+), 48 deletions(-)
fs/cifs/cifs_debug.c +14 -42
@@ -255,7 +255,6 @@ static const struct file_operations cifsstatic ssize_t cifs_stats_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) { -char c;bool bv;int rc;struct list_head *tmp1, *tmp2, *tmp3;
@@ -263,11 +262,8 @@ static ssize_t cifs_stats_proc_write(strstruct cifs_ses *ses;struct cifs_tcon *tcon; - rc =get_user (c, buffer); -if (rc) -return rc; - -if (strtobool (&c, &bv) ==0 ) { + rc =kstrtobool_from_user (buffer, count, &bv); +if (rc ==0 ) {#ifdef CONFIG_CIFS_STATS2 atomic_set (&totBufAllocCount,0 );atomic_set (&totSmBufAllocCount,0 );
@@ -290,6 +286,8 @@ static ssize_t cifs_stats_proc_write(str } }spin_unlock (&cifs_tcp_ses_lock); + }else { +return rc; }return count;
@@ -433,17 +431,17 @@ static int cifsFYI_proc_open(struct inodstatic ssize_t cifsFYI_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) { -char c; +char c[2 ] = {'\0' };bool bv;int rc; - rc =get_user (c, buffer); + rc =get_user (c[0 ], buffer);if (rc)return rc; -if (strtobool (&c, &bv) ==0 ) +if (strtobool (c, &bv) ==0 ) cifsFYI = bv; -else if ((c >'1' ) && (c <='9' )) - cifsFYI = (int ) (c -'0' );/* see cifs_debug.h for meanings */ +else if ((c[0 ] >'1' ) && (c[0 ] <='9' )) + cifsFYI = (int ) (c[0 ] -'0' );/* see cifs_debug.h for meanings */ return count; }
@@ -471,20 +469,12 @@ static int cifs_linux_ext_proc_open(strustatic ssize_t cifs_linux_ext_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) { -char c; -bool bv;int rc; - rc =get_user (c, buffer); + rc =kstrtobool_from_user (buffer, count, &linuxExtEnabled);if (rc)return rc; - rc =strtobool (&c, &bv); -if (rc) -return rc; - - linuxExtEnabled = bv; -return count; }
@@ -511,20 +501,12 @@ static int cifs_lookup_cache_proc_open(sstatic ssize_t cifs_lookup_cache_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) { -char c; -bool bv;int rc; - rc =get_user (c, buffer); + rc =kstrtobool_from_user (buffer, count, &lookupCacheEnabled);if (rc)return rc; - rc =strtobool (&c, &bv); -if (rc) -return rc; - - lookupCacheEnabled = bv; -return count; }
@@ -551,20 +533,12 @@ static int traceSMB_proc_open(struct inostatic ssize_t traceSMB_proc_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) { -char c; -bool bv;int rc; - rc =get_user (c, buffer); + rc =kstrtobool_from_user (buffer, count, &traceSMB);if (rc)return rc; - rc =strtobool (&c, &bv); -if (rc) -return rc; - - traceSMB = bv; -return count; }
@@ -622,7 +596,6 @@ static ssize_t cifs_security_flags_proc_int rc;unsigned int flags;char flags_string[12 ]; -char c;bool bv;if ((count <1 ) || (count >11 ))
@@ -635,11 +608,10 @@ static ssize_t cifs_security_flags_proc_if (count <3 ) {/* single char or single char followed by null */ - c = flags_string[0 ]; -if (strtobool (&c, &bv) ==0 ) { +if (strtobool (flags_string, &bv) ==0 ) { global_secflags = bv ?CIFSSEC_MAX :CIFSSEC_DEF ;return count; - }else if (!isdigit (c)) { + }else if (!isdigit (flags_string[0 ])) {cifs_dbg (VFS ,"Invalid SecurityFlags: %s\n" , flags_string);return -EINVAL ;
fs/cifs/cifs_debug.h +1 -1
@@ -25,7 +25,7 @@void cifs_dump_mem (char *label,void *data,int length);void cifs_dump_detail (void *);void cifs_dump_mids (struct TCP_Server_Info *); -extern int traceSMB;/* flag which enables the function below */ +extern bool traceSMB;/* flag which enables the function below */ void dump_smb (void *,int );#define CIFS_INFO 0x01#define CIFS_RC 0x02
fs/cifs/cifsfs.c +3 -3
@@ -54,10 +54,10 @@#endif int cifsFYI =0 ; -int traceSMB =0 ; +bool traceSMB;bool enable_oplocks = true; -unsigned int linuxExtEnabled =1 ; -unsigned int lookupCacheEnabled =1 ; +bool linuxExtEnabled = true; +bool lookupCacheEnabled = true;unsigned int global_secflags =CIFSSEC_DEF ;/* unsigned int ntlmv2_support = 0; */ unsigned int sign_CIFS_PDUs =1 ;
fs/cifs/cifsglob.h +2 -2
@@ -1588,11 +1588,11 @@ GLOBAL_EXTERN atomic_t midCount;/* Misc globals */ GLOBAL_EXTERN bool enable_oplocks; /* enable or disable oplocks */ -GLOBAL_EXTERN unsigned int lookupCacheEnabled; +GLOBAL_EXTERN bool lookupCacheEnabled; GLOBAL_EXTERN unsigned int global_secflags; /* if on, session setup sentwith more secure ntlmssp2 challenge/resp */ GLOBAL_EXTERN unsigned int sign_CIFS_PDUs; /* enable smb packet signing */ -GLOBAL_EXTERN unsigned int linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/ +GLOBAL_EXTERN bool linuxExtEnabled;/*enable Linux/Unix CIFS extensions*/ GLOBAL_EXTERN unsigned int CIFSMaxBufSize; /* max size not including hdr */ GLOBAL_EXTERN unsigned int cifs_min_rcv; /* min size of big ntwrk buf pool */ GLOBAL_EXTERN unsigned int cifs_min_small; /* min size of small buf pool */
Greg Kroah-Hartman
maintainerPATCH 56/112 lib: add "on"/"off" support to kstrtobool
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit a81a5a17d44b26521fb1199f8ccf27f4af337a67 upstream.
Add support for "on" and "off" when converting to boolean.
--- lib/kstrtox.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
lib/kstrtox.c +17 -3
@@ -326,9 +326,9 @@ EXPORT_SYMBOL(kstrtos8);* @s: input string * @res: result * -* This routine returns 0 iff the first character is one of 'Yy1Nn0'. -* Otherwise it will return -EINVAL. Value pointed to by res is -* updated upon finding a match. +* This routine returns 0 iff the first character is one of 'Yy1Nn0', or +* [oO][NnFf] for "on" and "off". Otherwise it will return -EINVAL. Value +* pointed to by res is updated upon finding a match. */ int kstrtobool (const char *s,bool *res) {
@@ -346,6 +346,20 @@ int kstrtobool(const char *s, bool *res)case '0' : *res = false;return 0 ; +case 'o' : +case 'O' : +switch (s[1 ]) { +case 'n' : +case 'N' : + *res = true; +return 0 ; +case 'f' : +case 'F' : + *res = false; +return 0 ; +default : +break ; + }default :break ; }
Greg Kroah-Hartman
maintainerPATCH 57/112 Input: i8042 - skip selftest on ASUS laptops
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcos Paulo de Souza <[email protected]>
commit 930e19248e9b61da36c967687ca79c4d5f977919 upstream.
On suspend/resume cycle, selftest is executed to reset i8042 controller. But when this is done in Asus devices, subsequent calls to detect/init functions to elantech driver fails. Skipping selftest fixes this problem.
An easier step to reproduce this problem is adding i8042.reset=1 as a kernel parameter. On Asus laptops, it'll make the system to start with the touchpad already stuck, since psmouse_probe forcibly calls the selftest function.
This patch was inspired by John Hiesey's change[1], but, since this problem affects a lot of models of Asus, let's avoid running selftests on them.
All models affected by this problem:
A455LD
K401LB
K501LB
K501LX
R409L
V502LX
X302LA
X450LCP
X450LD
X455LAB
X455LDB
X455LF
Z450LA
[1]: https://marc.info/?l=linux-input&m=144312209020616&w=2
Fixes: "ETPS/2 Elantech Touchpad dies after resume from suspend"
(https://bugzilla.kernel.org/show_bug.cgi?id=107971)
--- Documentation/kernel-parameters.txt | 9 ++- drivers/input/serio/i8042-io.h | 2 drivers/input/serio/i8042-ip22io.h | 2 drivers/input/serio/i8042-ppcio.h | 2 drivers/input/serio/i8042-sparcio.h | 2 drivers/input/serio/i8042-unicore32io.h | 2 drivers/input/serio/i8042-x86ia64io.h | 96 +++++++++++++++++++++++++++++++- drivers/input/serio/i8042.c | 55 ++++++++++++++---- 8 files changed, 150 insertions(+), 20 deletions(-)
Documentation/kernel-parameters.txt +8 -1
@@ -1371,7 +1371,14 @@ bytes respectively. Such letter suffixes i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX controllers i8042.notimeout [HW] Ignore timeout condition signalled by controller - i8042.reset [HW] Reset the controller during init and cleanup + i8042.reset [HW] Reset the controller during init, cleanup and + suspend-to-ram transitions, only during s2r + transitions, or never reset + Format: { 1 | Y | y | 0 | N | n } + 1, Y, y: always reset controller + 0, N, n: don't ever reset controller + Default: only on s2r transitions on x86; most other + architectures force reset to be always executed i8042.unlock [HW] Unlock (ignore) the keylock i8042.kbdreset [HW] Reset device connected to KBD port
drivers/input/serio/i8042-io.h +1 -1
@@ -81,7 +81,7 @@ static inline int i8042_platform_init(voreturn -EBUSY ;#endif - i8042_reset =1 ; + i8042_reset =I8042_RESET_ALWAYS ;return 0 ; }
drivers/input/serio/i8042-ip22io.h +1 -1
@@ -61,7 +61,7 @@ static inline int i8042_platform_init(voreturn -EBUSY ;#endif - i8042_reset =1 ; + i8042_reset =I8042_RESET_ALWAYS ;return 0 ; }
drivers/input/serio/i8042-ppcio.h +1 -1
@@ -44,7 +44,7 @@ static inline void i8042_write_command(istatic inline int i8042_platform_init (void ) { - i8042_reset =1 ; + i8042_reset =I8042_RESET_ALWAYS ;return 0 ; }
drivers/input/serio/i8042-sparcio.h +1 -1
@@ -130,7 +130,7 @@ static int __init i8042_platform_init(vo } } - i8042_reset =1 ; + i8042_reset =I8042_RESET_ALWAYS ;return 0 ; }
drivers/input/serio/i8042-unicore32io.h +1 -1
@@ -61,7 +61,7 @@ static inline int i8042_platform_init(voif (!request_mem_region (I8042_REGION_START ,I8042_REGION_SIZE ,"i8042" ))return -EBUSY ; - i8042_reset =1 ; + i8042_reset =I8042_RESET_ALWAYS ;return 0 ; }
drivers/input/serio/i8042-x86ia64io.h +93 -3
111 lines not on this page · raw message
drivers/input/serio/i8042.c +44 -11
105 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 58/112 Input: elantech - force needed quirks on Fujitsu H760
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matti Kurkela <[email protected]>
commit f9a703a54d16ba2470391c4b12236ee56591d50c upstream.
Just like Fujitsu CELSIUS H730, the H760 also has an Elantech touchpad with the same quirks. Without this patch, the touchpad is useless out-of-the-box as the mouse pointer won't move.
This patch makes the driver aware of both the crc_enabled=1 requirement and the middle button, making the touchpad fully functional out-of-the-box.
--- drivers/input/mouse/elantech.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/input/mouse/elantech.c +14 -0
@@ -1163,6 +1163,13 @@ static const struct dmi_system_id elante DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), }, }, + { +/* Fujitsu H760 also has a middle button */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"), + }, + }, #endif { } };
@@ -1507,6 +1514,13 @@ static const struct dmi_system_id elante }, }, { +/* Fujitsu H760 does not work with crc_enabled == 0 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H760"), + }, + }, + {/* Fujitsu LIFEBOOK E554 does not work with crc_enabled == 0 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
Greg Kroah-Hartman
maintainerPATCH 59/112 Input: elantech - add Fujitsu Lifebook E556 to force crc_enabled
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1521,6 +1521,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"),
@@ -1528,10 +1535,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"), }, }, {
Greg Kroah-Hartman
maintainerPATCH 60/112 sunrpc: fix write space race causing stalls
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
commit d48f9ce73c997573e1b512893fa6eddf353a6f69 upstream.
Write space becoming available may race with putting the task to sleep in xprt_wait_for_buffer_space(). The existing mechanism to avoid the race does not work.
This (edited) partial trace illustrates the problem:
[1] rpc_task_run_action: task:43546@5 ... action=call_transmit
[2] xs_write_space <-xs_tcp_write_space
[3] xprt_write_space <-xs_write_space
[4] rpc_task_sleep: task:43546@5 ...
[5] xs_write_space <-xs_tcp_write_space
[1] Task 43546 runs but is out of write space.
[2] Space becomes available, xs_write_space() clears the SOCKWQ_ASYNC_NOSPACE bit.
[3] xprt_write_space() attemts to wake xprt->snd_task (== 43546), but this has not yet been queued and the wake up is lost.
[4] xs_nospace() is called which calls xprt_wait_for_buffer_space() which queues task 43546.
[5] The call to sk->sk_write_space() at the end of xs_nospace() (which is supposed to handle the above race) does not call xprt_write_space() as the SOCKWQ_ASYNC_NOSPACE bit is clear and thus the task is not woken.
Fix the race by resetting the SOCKWQ_ASYNC_NOSPACE bit in xs_nospace() so the second call to sk->sk_write_space() calls xprt_write_space().
--- net/sunrpc/xprtsock.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
net/sunrpc/xprtsock.c +10 -1
@@ -474,7 +474,16 @@ static int xs_nospace(struct rpc_task *tspin_unlock_bh (&xprt->transport_lock);/* Race breaker in case memory is freed before above code is called */ - sk->sk_write_space (sk); +if (ret == -EAGAIN ) { +struct socket_wq *wq; + +rcu_read_lock (); + wq =rcu_dereference (sk->sk_wq); +set_bit (SOCKWQ_ASYNC_NOSPACE , &wq->flags); +rcu_read_unlock (); + + sk->sk_write_space (sk); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 61/112 NFSv4: Dont report revoked delegations as valid in nfs_have_delegation()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit b3f9e7239074613aa6bdafa4caf7c104fe1e7276 upstream.
If the delegation is revoked, then it can't be used for caching.
--- fs/nfs/delegation.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/delegation.c +1 -0
@@ -51,6 +51,7 @@ nfs4_do_check_delegation(struct inode *ircu_read_lock (); delegation =rcu_dereference (NFS_I (inode)->delegation);if (delegation !=NULL && (delegation->type & flags) == flags && + !test_bit (NFS_DELEGATION_REVOKED , &delegation->flags) && !test_bit (NFS_DELEGATION_RETURNING , &delegation->flags)) {if (mark)nfs_mark_delegation_referenced (delegation);
Greg Kroah-Hartman
maintainerPATCH 62/112 NFSv4: nfs4_copy_delegation_stateid() must fail if the delegation is invalid
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit aa05c87f23efe417adc7ff9b4193b7201ec0dd79 upstream.
We must not allow the use of delegations that have been revoked or are being returned.
--- fs/nfs/delegation.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
fs/nfs/delegation.c +13 -4
@@ -41,6 +41,17 @@ void nfs_mark_delegation_referenced(struset_bit (NFS_DELEGATION_REFERENCED , &delegation->flags); } +static bool +nfs4_is_valid_delegation (const struct nfs_delegation *delegation, +fmode_t flags) +{ +if (delegation !=NULL && (delegation->type & flags) == flags && + !test_bit (NFS_DELEGATION_REVOKED , &delegation->flags) && + !test_bit (NFS_DELEGATION_RETURNING , &delegation->flags)) +return true; +return false; +} +static int nfs4_do_check_delegation (struct inode *inode,fmode_t flags,bool mark) {
@@ -50,9 +61,7 @@ nfs4_do_check_delegation(struct inode *i flags &=FMODE_READ |FMODE_WRITE ;rcu_read_lock (); delegation =rcu_dereference (NFS_I (inode)->delegation); -if (delegation !=NULL && (delegation->type & flags) == flags && - !test_bit (NFS_DELEGATION_REVOKED , &delegation->flags) && - !test_bit (NFS_DELEGATION_RETURNING , &delegation->flags)) { +if (nfs4_is_valid_delegation (delegation, flags)) {if (mark)nfs_mark_delegation_referenced (delegation); ret =1 ;
@@ -893,7 +902,7 @@ bool nfs4_copy_delegation_stateid(nfs4_s flags &=FMODE_READ |FMODE_WRITE ;rcu_read_lock (); delegation =rcu_dereference (nfsi->delegation); - ret = (delegation !=NULL && (delegation->type & flags) == flags); + ret =nfs4_is_valid_delegation (delegation, flags);if (ret) {nfs4_stateid_copy (dst, &delegation->stateid);nfs_mark_delegation_referenced (delegation);
Greg Kroah-Hartman
maintainerPATCH 63/112 NFSv4: Open state recovery must account for file permission changes
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1493,6 +1493,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);
Greg Kroah-Hartman
maintainerPATCH 64/112 NFSv4.2: Fix a reference leak in nfs42_proc_layoutstats_generic
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 3f807e5ae5597bd65a6fff684083e8eaa21f3fa7 upstream.
The caller of rpc_run_task also gets a reference that must be put.
--- fs/nfs/nfs42proc.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/nfs42proc.c +1 -0
@@ -269,6 +269,7 @@ int nfs42_proc_layoutstats_generic(struc task =rpc_run_task (&task_setup);if (IS_ERR (task))return PTR_ERR (task); +rpc_put_task (task);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 65/112 scsi: Fix use-after-free
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1459,12 +1459,12 @@ retry: 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; }
Greg Kroah-Hartman
maintainerPATCH 66/112 metag: Only define atomic_dec_if_positive conditionally
In reply to Greg Kroah-Hartman4.4-stable 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 */
Greg Kroah-Hartman
maintainerPATCH 67/112 mm: filemap: dont plant shadow entries without radix tree node
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit d3798ae8c6f3767c726403c2ca6ecc317752c9dd upstream.
When the underflow checks were added to workingset_node_shadow_dec(), they triggered immediately:
kernel BUG at ./include/linux/swap.h:276!
invalid opcode: 0000 [#1] SMP
Modules linked in: isofs usb_storage fuse xt_CHECKSUM ipt_MASQUERADE nf_nat_masquerade_ipv4 tun nf_conntrack_netbios_ns nf_conntrack_broadcast ip6t_REJECT nf_reject_ipv6
soundcore wmi acpi_als pinctrl_sunrisepoint kfifo_buf tpm_tis industrialio acpi_pad pinctrl_intel tpm_tis_core tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc dm_crypt
CPU: 0 PID: 20929 Comm: blkid Not tainted 4.8.0-rc8-00087-gbe67d60ba944 #1
Hardware name: System manufacturer System Product Name/Z170-K, BIOS 1803 05/06/2016
task: ffff8faa93ecd940 task.stack: ffff8faa7f478000
RIP: page_cache_tree_insert+0xf1/0x100
Call Trace:
__add_to_page_cache_locked+0x12e/0x270
add_to_page_cache_lru+0x4e/0xe0
mpage_readpages+0x112/0x1d0
blkdev_readpages+0x1d/0x20
__do_page_cache_readahead+0x1ad/0x290
force_page_cache_readahead+0xaa/0x100
page_cache_sync_readahead+0x3f/0x50
generic_file_read_iter+0x5af/0x740
blkdev_read_iter+0x35/0x40
__vfs_read+0xe1/0x130
vfs_read+0x96/0x130
SyS_read+0x55/0xc0
entry_SYSCALL_64_fastpath+0x13/0x8f
Code: 03 00 48 8b 5d d8 65 48 33 1c 25 28 00 00 00 44 89 e8 75 19 48 83 c4 18 5b 41 5c 41 5d 41 5e 5d c3 0f 0b 41 bd ef ff ff ff eb d7 <0f> 0b e8 88 68 ef ff 0f 1f 84 00
RIP page_cache_tree_insert+0xf1/0x100This is a long-standing bug in the way shadow entries are accounted in the radix tree nodes. The shrinker needs to know when radix tree nodes contain only shadow entries, no pages, so node->count is split in half to count shadows in the upper bits and pages in the lower bits.
Unfortunately, the radix tree implementation doesn't know of this and assumes all entries are in node->count. When there is a shadow entry directly in root->rnode and the tree is later extended, the radix tree implementation will copy that entry into the new node and and bump its node->count, i.e. increases the page count bits. Once the shadow gets removed and we subtract from the upper counter, node->count underflows and triggers the warning. Afterwards, without node->count reaching 0 again, the radix tree node is leaked.
Limit shadow entries to when we have actual radix tree nodes and can count them properly. That means we lose the ability to detect refaults from files that had only the first page faulted in at eviction time.
--- mm/filemap.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/filemap.c +8 -0
@@ -122,6 +122,14 @@ static void page_cache_tree_delete(struc__radix_tree_lookup (&mapping->page_tree, page->index, &node, &slot); +if (!node) { +/* +* We need a node to properly account shadow +* entries. Don't plant any without. XXX +*/ + shadow =NULL ; + } +if (shadow) { mapping->nrshadows++;/*
Greg Kroah-Hartman
maintainerPATCH 68/112 ipc/sem.c: fix complex_count vs. simple op race
In reply to Greg Kroah-Hartman4.4-stable 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.
--- include/linux/sem.h | 1 ipc/sem.c | 130 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 76 insertions(+), 55 deletions(-)
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 +75 -55
212 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 69/112 lightnvm: ensure that nvm_dev_ops can be used without CONFIG_NVM
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit a7fd9a4f3e8179bab31e4637236ebb0e0b7867c6 upstream.
null_blk defines an empty version of this ops structure if CONFIG_NVM isn't set, but it doesn't know the type. Move those bits out of the protection of CONFIG_NVM in the main lightnvm include.
--- include/linux/lightnvm.h | 121 ++++++++++++++++++++++++----------------------- 1 file changed, 64 insertions(+), 57 deletions(-)
include/linux/lightnvm.h +64 -57
@@ -1,6 +1,8 @@#ifndef NVM_H #define NVM_H +#include <linux/types.h> +enum {NVM_IO_OK =0 , NVM_IO_REQUEUE = 1,
@@ -11,10 +13,71 @@ enum { NVM_IOTYPE_GC = 1, }; +#define NVM_BLK_BITS (16) +#define NVM_PG_BITS (16) +#define NVM_SEC_BITS (8) +#define NVM_PL_BITS (8) +#define NVM_LUN_BITS (8) +#define NVM_CH_BITS (8) + +struct ppa_addr { +/* Generic structure for all addresses */ +union { +struct { +u64 blk :NVM_BLK_BITS ; +u64 pg :NVM_PG_BITS ; +u64 sec :NVM_SEC_BITS ; +u64 pl :NVM_PL_BITS ; +u64 lun :NVM_LUN_BITS ; +u64 ch :NVM_CH_BITS ; + } g; + +u64 ppa; + }; +}; + +struct nvm_rq ; +struct nvm_id ; +struct nvm_dev ; + +typedef int (nvm_l2p_update_fn )(u64 ,u32 ,__le64 *,void *); +typedef int (nvm_bb_update_fn )(struct ppa_addr ,int ,u8 *,void *); +typedef int (nvm_id_fn )(struct nvm_dev *,struct nvm_id *); +typedef int (nvm_get_l2p_tbl_fn )(struct nvm_dev *,u64 ,u32 , +nvm_l2p_update_fn *,void *); +typedef int (nvm_op_bb_tbl_fn )(struct nvm_dev *,struct ppa_addr ,int , +nvm_bb_update_fn *,void *); +typedef int (nvm_op_set_bb_fn )(struct nvm_dev *,struct nvm_rq *,int ); +typedef int (nvm_submit_io_fn )(struct nvm_dev *,struct nvm_rq *); +typedef int (nvm_erase_blk_fn )(struct nvm_dev *,struct nvm_rq *); +typedef void *(nvm_create_dma_pool_fn )(struct nvm_dev *,char *); +typedef void (nvm_destroy_dma_pool_fn )(void *); +typedef void *(nvm_dev_dma_alloc_fn )(struct nvm_dev *,void *,gfp_t , +dma_addr_t *); +typedef void (nvm_dev_dma_free_fn )(void *,void *,dma_addr_t ); + +struct nvm_dev_ops { +nvm_id_fn *identity; +nvm_get_l2p_tbl_fn *get_l2p_tbl; +nvm_op_bb_tbl_fn *get_bb_tbl; +nvm_op_set_bb_fn *set_bb_tbl; + +nvm_submit_io_fn *submit_io; +nvm_erase_blk_fn *erase_block; + +nvm_create_dma_pool_fn *create_dma_pool; +nvm_destroy_dma_pool_fn *destroy_dma_pool; +nvm_dev_dma_alloc_fn *dev_dma_alloc; +nvm_dev_dma_free_fn *dev_dma_free; + +unsigned int max_phys_sect; +}; + + +#ifdef CONFIG_NVM #include <linux/blkdev.h> -#include <linux/types.h> #include <linux/file.h> #include <linux/dmapool.h>
@@ -126,29 +189,6 @@ struct nvm_tgt_instance {#define NVM_VERSION_MINOR 0#define NVM_VERSION_PATCH 0 -#define NVM_BLK_BITS (16) -#define NVM_PG_BITS (16) -#define NVM_SEC_BITS (8) -#define NVM_PL_BITS (8) -#define NVM_LUN_BITS (8) -#define NVM_CH_BITS (8) - -struct ppa_addr { -/* Generic structure for all addresses */ -union { -struct { -u64 blk :NVM_BLK_BITS ; -u64 pg :NVM_PG_BITS ; -u64 sec :NVM_SEC_BITS ; -u64 pl :NVM_PL_BITS ; -u64 lun :NVM_LUN_BITS ; -u64 ch :NVM_CH_BITS ; - } g; - -u64 ppa; - }; -}; -struct nvm_rq {struct nvm_tgt_instance *ins;struct nvm_dev *dev;
@@ -182,39 +222,6 @@ static inline void *nvm_rq_to_pdu(structstruct nvm_block ; -typedef int (nvm_l2p_update_fn )(u64 ,u32 ,__le64 *,void *); -typedef int (nvm_bb_update_fn )(struct ppa_addr ,int ,u8 *,void *); -typedef int (nvm_id_fn )(struct nvm_dev *,struct nvm_id *); -typedef int (nvm_get_l2p_tbl_fn )(struct nvm_dev *,u64 ,u32 , -nvm_l2p_update_fn *,void *); -typedef int (nvm_op_bb_tbl_fn )(struct nvm_dev *,struct ppa_addr ,int , -nvm_bb_update_fn *,void *); -typedef int (nvm_op_set_bb_fn )(struct nvm_dev *,struct nvm_rq *,int ); -typedef int (nvm_submit_io_fn )(struct nvm_dev *,struct nvm_rq *); -typedef int (nvm_erase_blk_fn )(struct nvm_dev *,struct nvm_rq *); -typedef void *(nvm_create_dma_pool_fn )(struct nvm_dev *,char *); -typedef void (nvm_destroy_dma_pool_fn )(void *); -typedef void *(nvm_dev_dma_alloc_fn )(struct nvm_dev *,void *,gfp_t , -dma_addr_t *); -typedef void (nvm_dev_dma_free_fn )(void *,void *,dma_addr_t ); - -struct nvm_dev_ops { -nvm_id_fn *identity; -nvm_get_l2p_tbl_fn *get_l2p_tbl; -nvm_op_bb_tbl_fn *get_bb_tbl; -nvm_op_set_bb_fn *set_bb_tbl; - -nvm_submit_io_fn *submit_io; -nvm_erase_blk_fn *erase_block; - -nvm_create_dma_pool_fn *create_dma_pool; -nvm_destroy_dma_pool_fn *destroy_dma_pool; -nvm_dev_dma_alloc_fn *dev_dma_alloc; -nvm_dev_dma_free_fn *dev_dma_free; - -unsigned int max_phys_sect; -}; -struct nvm_lun {int id;
Greg Kroah-Hartman
maintainerPATCH 70/112 arc: dont leak bits of kernel stack into coredump
In reply to Greg Kroah-Hartman4.4-stable 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...
--- arch/arc/kernel/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arc/kernel/signal.c +4 -4
@@ -107,13 +107,13 @@ static int restore_usr_regs(struct pt_restruct user_regs_struct uregs; err =__copy_from_user (&set, &sf->uc.uc_sigmask,sizeof (set)); -if (!err) -set_current_blocked (&set); - err |=__copy_from_user (&uregs.scratch, &(sf->uc.uc_mcontext.regs.scratch),sizeof (sf->uc.uc_mcontext.regs.scratch)); +if (err) +return err; +set_current_blocked (&set); regs->bta = uregs.scratch.bta; regs->lp_start = uregs.scratch.lp_start; regs->lp_end = uregs.scratch.lp_end;
@@ -138,7 +138,7 @@ static int restore_usr_regs(struct pt_re regs->r0 = uregs.scratch.r0; regs->sp = uregs.scratch.sp; -return err; +return 0 ; }static inline int is_do_ss_needed (unsigned int magic)
Greg Kroah-Hartman
maintainerPATCH 71/112 fs/super.c: fix race between freeze_super() and thaw_super()
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1326,8 +1326,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);
@@ -1346,7 +1346,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 ; }
Greg Kroah-Hartman
maintainerPATCH 72/112 cifs: Limit the overall credit acquired
In reply to Greg Kroah-Hartman4.4-stable 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 ++++++++++ fs/cifs/smb2pdu.c | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-)
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 +17 -1
@@ -103,7 +103,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)
@@ -2059,6 +2073,7 @@ smb2_async_readv(struct cifs_readdata *rif (rdata->credits) { buf->CreditCharge =cpu_to_le16 (DIV_ROUND_UP (rdata->bytes,SMB2_MAX_BUFFER_SIZE )); + buf->CreditRequest = buf->CreditCharge;spin_lock (&server->req_lock); server->credits += rdata->credits -le16_to_cpu (buf->CreditCharge);
@@ -2245,6 +2260,7 @@ smb2_async_writev(struct cifs_writedataif (wdata->credits) { req->hdr.CreditCharge =cpu_to_le16 (DIV_ROUND_UP (wdata->bytes,SMB2_MAX_BUFFER_SIZE )); + req->hdr.CreditRequest = req->hdr.CreditCharge;spin_lock (&server->req_lock); server->credits += wdata->credits -le16_to_cpu (req->hdr.CreditCharge);
Greg Kroah-Hartman
maintainerPATCH 73/112 fs/cifs: keep guid when assigning fid to fileinfo
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurelien Aptel <[email protected]>
commit 94f873717571c759b7928399cbbddfa3d569bd01 upstream.
When we open a durable handle we give a Globally Unique Identifier (GUID) to the server which we must keep for later reference e.g. when reopening persistent handles on reconnection.
Without this the GUID generated for a new persistent handle was lost and 16 zero bytes were used instead on re-opening.
--- fs/cifs/smb2ops.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/smb2ops.c +1 -0
@@ -536,6 +536,7 @@ smb2_set_fid(struct cifsFileInfo *cfile, server->ops->set_oplock_level (cinode, oplock, fid->epoch, &fid->purge_cache); cinode->can_cache_brlcks =CIFS_CACHE_WRITE (cinode); +memcpy (cfile->fid.create_guid, fid->create_guid,16 ); } static void
Greg Kroah-Hartman
maintainerPATCH 74/112 Clarify locking of cifs file and tcon structures and make more granular
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1210,7 +1210,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
@@ -827,6 +827,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;
@@ -883,7 +884,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 */
@@ -1034,8 +1035,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 */
@@ -1043,11 +1046,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 */
@@ -1114,7 +1118,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)
@@ -1508,8 +1512,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 *
@@ -1541,18 +1547,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
@@ -465,7 +466,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);
@@ -495,11 +496,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;
@@ -613,9 +614,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
@@ -635,7 +636,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
@@ -594,14 +594,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
@@ -525,19 +525,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);
@@ -579,7 +579,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);
@@ -591,7 +591,7 @@ smb2_is_valid_oplock_break(char *buffer,cifs_dbg (FYI ,"file id match, oplock break\n" ); cinode =CIFS_I (d_inode (cfile->dentry)); - +spin_lock (&cfile->file_info_lock);if (!CIFS_CACHE_WRITE (cinode) && rsp->OplockLevel ==SMB2_OPLOCK_LEVEL_NONE ) cfile->oplock_break_cancelled = true;
@@ -613,14 +613,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;
Greg Kroah-Hartman
maintainerPATCH 75/112 Display number of credits available
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -152,6 +152,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,
Greg Kroah-Hartman
maintainerPATCH 76/112 Set previous session id correctly on SMB3 reconnect
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -607,6 +607,7 @@ SMB2_sess_setup(const unsigned int xid,char *security_blob =NULL ;unsigned char *ntlmssp_blob =NULL ;bool use_spnego = false;/* else use raw ntlmssp */ +u64 previous_session = ses->Suid;cifs_dbg (FYI ,"Session Setup\n" );
@@ -644,6 +645,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->Flags =0 ;/* MBZ */ /* to enable echos and oplocks */ req->hdr.CreditRequest =cpu_to_le16 (3 );
fs/cifs/smb2pdu.h +1 -1
@@ -276,7 +276,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;
Greg Kroah-Hartman
maintainerPATCH 77/112 SMB3: GUIDs should be constructed as random but valid uuids
In reply to Greg Kroah-Hartman4.4-stable 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 | 2 +- fs/cifs/connect.c | 2 +- fs/cifs/smb2ops.c | 2 +- fs/cifs/smb2pdu.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
fs/cifs/cifsfs.c +1 -1
@@ -268,7 +268,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
@@ -2200,7 +2200,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
@@ -1037,7 +1037,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 \
fs/cifs/smb2pdu.c +1 -1
@@ -1186,7 +1186,7 @@ create_durable_v2_buf(struct cifs_fid *p buf->dcontext.Timeout =0 ;/* Should this be configurable by workload */ buf->dcontext.Flags =cpu_to_le32 (SMB2_DHANDLE_FLAG_PERSISTENT ); -get_random_bytes (buf->dcontext.CreateGuid,16 ); +generate_random_uuid (buf->dcontext.CreateGuid);memcpy (pfid->create_guid, buf->dcontext.CreateGuid,16 );/* SMB2_CREATE_DURABLE_HANDLE_REQUEST is "DH2Q" */
Greg Kroah-Hartman
maintainerPATCH 78/112 Do not send SMB3 SET_INFO request if nothing is changing
In reply to Greg Kroah-Hartman4.4-stable 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 );
Greg Kroah-Hartman
maintainerPATCH 79/112 Cleanup missing frees on some ioctls
In reply to Greg Kroah-Hartman4.4-stable 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.
--- fs/cifs/smb2ops.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/cifs/smb2ops.c +4 -5
@@ -282,7 +282,7 @@ SMB3_request_interfaces(const unsigned icifs_dbg (FYI ,"Link Speed %lld\n" , le64_to_cpu(out_buf->LinkSpeed)); } - +kfree (out_buf);return rc; }#endif /* STATS2 */
@@ -695,6 +695,7 @@ smb2_clone_range(const unsigned int xid, cchunk_out:kfree (pcchunk); +kfree (retbuf);return rc; }
@@ -819,7 +820,6 @@ smb2_duplicate_extents(const unsigned in {int rc;unsigned int ret_data_len; -char *retbuf =NULL ;struct duplicate_extents_to_file dup_ext_buf;struct cifs_tcon *tcon =tlink_tcon (trgtfile->tlink);
@@ -845,7 +845,7 @@ smb2_duplicate_extents(const unsigned inFSCTL_DUPLICATE_EXTENTS_TO_FILE , true/* is_fsctl */ , (char *)&dup_ext_buf,sizeof (struct duplicate_extents_to_file ), - (char **)&retbuf, +NULL , &ret_data_len);if (ret_data_len >0 )
@@ -868,7 +868,6 @@ smb3_set_integrity(const unsigned int xi struct cifsFileInfo *cfile) {struct fsctl_set_integrity_information_req integr_info; -char *retbuf =NULL ;unsigned int ret_data_len; integr_info.ChecksumAlgorithm =cpu_to_le16 (CHECKSUM_TYPE_UNCHANGED );
@@ -880,7 +879,7 @@ smb3_set_integrity(const unsigned int xiFSCTL_SET_INTEGRITY_INFORMATION , true/* is_fsctl */ , (char *)&integr_info,sizeof (struct fsctl_set_integrity_information_req ), - (char **)&retbuf, +NULL , &ret_data_len); }
Greg Kroah-Hartman
maintainerPATCH 80/112 Fix regression which breaks DFS mounting
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Prabhu <[email protected]>
commit d171356ff11ab1825e456dfb979755e01b3c54a1 upstream.
Patch a6b5058 results in -EREMOTE returned by is_path_accessible() in cifs_mount() to be ignored which breaks DFS mounting.
--- fs/cifs/connect.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/cifs/connect.c +8 -6
@@ -3693,14 +3693,16 @@ remote_path_check: goto mount_fail_check; } - rc =cifs_are_all_path_components_accessible (server, +if (rc != -EREMOTE ) { + rc =cifs_are_all_path_components_accessible (server, xid, tcon, cifs_sb, full_path); -if (rc !=0 ) { -cifs_dbg (VFS ,"cannot query dirs between root and final path, " -"enabling CIFS_MOUNT_USE_PREFIX_PATH\n" ); - cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_USE_PREFIX_PATH ; - rc =0 ; +if (rc !=0 ) { +cifs_dbg (VFS ,"cannot query dirs between root and final path, " +"enabling CIFS_MOUNT_USE_PREFIX_PATH\n" ); + cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_USE_PREFIX_PATH ; + rc =0 ; + } }kfree (full_path); }
Greg Kroah-Hartman
maintainerPATCH 81/112 blkcg: Unlock blkcg_pol_mutex only once when cpd == NULL
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit bbb427e342495df1cda10051d0566388697499c0 upstream.
Unlocking a mutex twice is wrong. Hence modify blkcg_policy_register() such that blkcg_pol_mutex is unlocked once if cpd == NULL. This patch avoids that smatch reports the following error:
block/blk-cgroup.c:1378: blkcg_policy_register() error: double unlock 'mutex:&blkcg_pol_mutex'
--- block/blk-cgroup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
block/blk-cgroup.c +1 -3
@@ -1331,10 +1331,8 @@ int blkcg_policy_register(struct blkcg_pstruct blkcg_policy_data *cpd; cpd = pol->cpd_alloc_fn (GFP_KERNEL ); -if (!cpd) { -mutex_unlock (&blkcg_pol_mutex); +if (!cpd) goto err_free_cpds; - } blkcg->cpd[pol->plid] = cpd; cpd->blkcg = blkcg;
Greg Kroah-Hartman
maintainerPATCH 82/112 x86/e820: Dont merge consecutive E820_PRAM ranges
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 23446cb66c073b827779e5eb3dec301623299b32 upstream.
Commit:
917db484dc6a ("x86/boot: Fix kdump, cleanup aborted E820_PRAM max_pfn manipulation")
... fixed up the broken manipulations of max_pfn in the presence of E820_PRAM ranges.
However, it also broke the sanitize_e820_map() support for not merging E820_PRAM ranges.
Re-introduce the enabling to keep resource boundaries between consecutive defined ranges. Otherwise, for example, an environment that boots with memmap=2G!8G,2G!10G will end up with a single 4G /dev/pmem0 device instead of a /dev/pmem0 and /dev/pmem1 device 2G in size.
--- arch/x86/kernel/e820.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/e820.c +1 -1
@@ -347,7 +347,7 @@ int __init sanitize_e820_map(struct e820* continue building up new bios map based on this * information */ -if (current_type != last_type) { +if (current_type != last_type || current_type ==E820_PRAM ) {if (last_type !=0 ) { new_bios[new_bios_entry].size = change_point[chgidx]->addr - last_addr;
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Greg Kroah-Hartman
maintainerPATCH 84/112 irqchip/gicv3: Handle loop timeout proper
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit d102eb5c1ac5e6743b1c6d145c06a25d98ad1375 upstream.
The timeout loop terminates when the loop count is zero, but the decrement of the count variable is post check. So count is -1 when we check for the timeout and therefor the error message is supressed.
Change it to predecrement, so the error message is emitted.
[ tglx: Massaged changelog ]
--- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-v3.c +1 -1
@@ -142,7 +142,7 @@ static void gic_enable_redist(bool enablreturn ;/* No PM support in this redistributor */ } -while (count--) { +while (--count) { val =readl_relaxed (rbase +GICR_WAKER );if (enable ^ (val & GICR_WAKER_ChildrenAsleep))break ;
Greg Kroah-Hartman
maintainerPATCH 85/112 sd: Fix rw_max for devices that report an optimal xfer size
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin K. Petersen <[email protected]>
commit 6b7e9cde49691e04314342b7dce90c67ad567fcc upstream.
For historic reasons, io_opt is in bytes and max_sectors in block layer sectors. This interface inconsistency is error prone and should be fixed. But for 4.4--4.7 let's make the unit difference explicit via a wrapper function.
--- drivers/scsi/sd.c | 8 ++++---- drivers/scsi/sd.h | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/scsi/sd.c +4 -4
@@ -2879,10 +2879,10 @@ static int sd_revalidate_disk(struct genif (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max && sdkp->opt_xfer_blocks <=SD_DEF_XFER_BLOCKS && - sdkp->opt_xfer_blocks * sdp->sector_size >=PAGE_CACHE_SIZE ) - rw_max = q->limits.io_opt = - sdkp->opt_xfer_blocks * sdp->sector_size; -else +logical_to_bytes (sdp, sdkp->opt_xfer_blocks) >=PAGE_CACHE_SIZE ) { + q->limits.io_opt =logical_to_bytes (sdp, sdkp->opt_xfer_blocks); + rw_max =logical_to_sectors (sdp, sdkp->opt_xfer_blocks); + }else rw_max =BLK_DEF_MAX_SECTORS ;/* Combine with controller limits */
drivers/scsi/sd.h +5 -0
@@ -151,6 +151,11 @@ static inline sector_t logical_to_sectorreturn blocks << (ilog2 (sdev->sector_size) -9 ); } +static inline unsigned int logical_to_bytes (struct scsi_device *sdev,sector_t blocks) +{ +return blocks * sdev->sector_size; +} +/* * A DIF-capable target device can be formatted with different * protection schemes. Currently 0 through 3 are defined:
Greg Kroah-Hartman
maintainerPATCH 86/112 hpsa: correct skipping masked peripherals
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Don Brace <[email protected]>
commit 64ce60cab24603ac0fcd59c9fbc3be78f4c4d229 upstream.
The SA controller spins down RAID drive spares.
A REGNEWD event causes an inquiry to be sent to all physical drives. This causes the SA controller to spin up the spare.
The controller suspends all I/O to a logical volume until the spare is spun up. The spin-up can take over 50 seconds.
This can result in one or both of the following:
- SML sends down aborts and resets to the logical volume and can cause the logical volume to be off-lined.
- a negative impact on the logical volume's I/O performance each time a REGNEWD is triggered.
--- drivers/scsi/hpsa.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 4 deletions(-)
drivers/scsi/hpsa.c +74 -4
@@ -3930,6 +3930,70 @@ static int hpsa_set_local_logical_count(return rc; } +static bool hpsa_is_disk_spare (struct ctlr_info *h,u8 *lunaddrbytes) +{ +struct bmic_identify_physical_device *id_phys; +bool is_spare = false; +int rc; + + id_phys =kzalloc (sizeof (*id_phys),GFP_KERNEL ); +if (!id_phys) +return false; + + rc =hpsa_bmic_id_physical_device (h, + lunaddrbytes, +GET_BMIC_DRIVE_NUMBER (lunaddrbytes), + id_phys,sizeof (*id_phys)); +if (rc ==0 ) + is_spare = (id_phys->more_flags >>6 ) &0x01 ; + +kfree (id_phys); +return is_spare; +} + +#define RPL_DEV_FLAG_NON_DISK 0x1 +#define RPL_DEV_FLAG_UNCONFIG_DISK_REPORTING_SUPPORTED 0x2 +#define RPL_DEV_FLAG_UNCONFIG_DISK 0x4 + +#define BMIC_DEVICE_TYPE_ENCLOSURE 6 + +static bool hpsa_skip_device (struct ctlr_info *h,u8 *lunaddrbytes, +struct ext_report_lun_entry *rle) +{ +u8 device_flags; +u8 device_type; + +if (!MASKED_DEVICE (lunaddrbytes)) +return false; + + device_flags = rle->device_flags; + device_type = rle->device_type; + +if (device_flags &RPL_DEV_FLAG_NON_DISK ) { +if (device_type ==BMIC_DEVICE_TYPE_ENCLOSURE ) +return false; +return true; + } + +if (!(device_flags &RPL_DEV_FLAG_UNCONFIG_DISK_REPORTING_SUPPORTED )) +return false; + +if (device_flags &RPL_DEV_FLAG_UNCONFIG_DISK ) +return false; + +/* +* Spares may be spun down, we do not want to +* do an Inquiry to a RAID set spare drive as +* that would have them spun up, that is a +* performance hit because I/O to the RAID device +* stops while the spin up occurs which can take +* over 50 seconds. +*/ +if (hpsa_is_disk_spare (h, lunaddrbytes)) +return true; + +return false; +}static void hpsa_update_scsi_devices (struct ctlr_info *h) {
@@ -4023,6 +4087,7 @@ static void hpsa_update_scsi_devices(stru8 *lunaddrbytes, is_OBDR =0 ;int rc =0 ;int phys_dev_index = i - (raid_ctlr_position ==0 ); +bool skip_device = false; physical_device = i < nphysicals + (raid_ctlr_position ==0 );
@@ -4030,10 +4095,15 @@ static void hpsa_update_scsi_devices(str lunaddrbytes =figure_lunaddrbytes (h, raid_ctlr_position, i, nphysicals, nlogicals, physdev_list, logdev_list); -/* skip masked non-disk devices */ -if (MASKED_DEVICE (lunaddrbytes) && physical_device && - (physdev_list->LUN[phys_dev_index].device_flags &0x01 )) -continue ; +/* +* Skip over some devices such as a spare. +*/ +if (!tmpdevice->external && physical_device) { + skip_device =hpsa_skip_device (h, lunaddrbytes, + &physdev_list->LUN[phys_dev_index]); +if (skip_device) +continue ; + }/* Get device type, vendor, model, device id */ rc = hpsa_update_device_info(h, lunaddrbytes, tmpdevice,
Greg Kroah-Hartman
maintainerPATCH 87/112 PKCS#7: Dont require SpcSpOpusInfo in Authenticode pkcs7 signatures
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit 7ee7014d0eb6bcac679c0bd5fe9ce65bc4325648 upstream.
Dave Young reported:
Quoted 17 lines
Hi,
I saw the warning "Missing required AuthAttr" when testing kexec, known issue? Idea about how to fix it?
The kernel is latest linus tree plus sevral patches from Toshi to cleanup io resource structure.
in function
pkcs7_sig_note_set_of_authattrs():if (!test_bit(sinfo_has_content_type, &sinfo->aa_set) || !test_bit(sinfo_has_message_digest, &sinfo->aa_set) || (ctx->msg->data_type == OID_msIndirectData && !test_bit(sinfo_has_ms_opus_info, &sinfo->aa_set))) { pr_warn("Missing required AuthAttr\n"); return -EBADMSG; }
Quoted 6 lines
The third condition below is true:
(ctx->msg->data_type==OID_msIndirectData&&!test_bit(sinfo_has_ms_opus_info, &sinfo->aa_set))I signed the kernel with redhat test key like below:
pesign -c 'Red Hat Test Certificate' -iarch/x86/boot/bzImage-o/boot/vmlinuz-4.4.0-rc8+-s --force
And right he is! The Authenticode specification is a paragon amongst technical documents, and has this pearl of wisdom to offer:
---------------------------------
Authenticode-Specific SignerInfo UnauthenticatedAttributes Structures
The following Authenticode-specific data structures are present in SignerInfo authenticated attributes.
SpcSpOpusInfo
SpcSpOpusInfo is identified by SPC_SP_OPUS_INFO_OBJID (1.3.6.1.4.1.311.2.1.12) and is defined as follows:
SpcSpOpusInfo ::= SEQUENCE {
programName [0] EXPLICIT SpcString OPTIONAL,
moreInfo [1] EXPLICIT SpcLink OPTIONAL,
} --#public--
SpcSpOpusInfo has two fields:
programName
This field contains the program description:
If publisher chooses not to specify a description, the SpcString structure contains a zero-length program name.
If the publisher chooses to specify a
description, the SpcString structure contains a Unicode string.
moreInfo
This field is set to an SPCLink structure that contains a URL for a Web site with more information about the signer. The URL is an ASCII string.
---------------------------------
Which is to say that this is an optional *unauthenticated* field which may be present in the Authenticated Attribute list. This is not how pkcs7 is supposed to work, so when David implemented this, he didn't appreciate the subtlety the original spec author was working with, and missed the part of the sublime prose that says this Authenticated Attribute is an Unauthenticated Attribute. As a result, the code in question simply takes as given that the Authenticated Attributes should be authenticated.
But this one should not, individually. Because it says it's not authenticated.
It still has to hash right so the TBS digest is correct. So it is both authenticated and unauthenticated, all at once. Truly, a wonder of technical accomplishment.
Additionally, pesign's implementation has always attempted to be compatible with the signatures emitted from contemporary versions of Microsoft's signtool.exe. During the initial implementation, Microsoft signatures always produced the same values for SpcSpOpusInfo - {U"Microsoft Windows", "http://www.microsoft.com"} - without regard to who the signer was.
Sometime between Windows 8 and Windows 8.1 they stopped including the field in their signatures altogether, and as such pesign stopped producing them in commits c0c4da6 and d79cb0c, sometime around June of 2012. The theory here is that anything that breaks with pesign signatures would also be breaking with signtool.exe sigs as well, and that'll be a more noticed problem for firmwares parsing it, so it'll get fixed. The fact that we've done exactly this bug in Linux code is first class, grade A irony.
So anyway, we should not be checking this field for presence or any particular value: if the field exists, it should be at the right place, but aside from that, as long as the hash matches the field is good.
--- crypto/asymmetric_keys/pkcs7_parser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
crypto/asymmetric_keys/pkcs7_parser.c +1 -3
@@ -547,9 +547,7 @@ int pkcs7_sig_note_set_of_authattrs(voidstruct pkcs7_signed_info *sinfo = ctx->sinfo;if (!test_bit (sinfo_has_content_type, &sinfo->aa_set) || - !test_bit (sinfo_has_message_digest, &sinfo->aa_set) || - (ctx->msg->data_type == OID_msIndirectData && - !test_bit (sinfo_has_ms_opus_info, &sinfo->aa_set))) { + !test_bit (sinfo_has_message_digest, &sinfo->aa_set)) {pr_warn ("Missing required AuthAttr\n" );return -EBADMSG ; }
Greg Kroah-Hartman
maintainerPATCH 88/112 bnx2x: Prevent false warning for lack of FC NPIV
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuval Mintz <[email protected]>
commit 1e6bb1a3540fec3ef112b9a89dda88e684c3ff59 upstream.
Not all adapters have FC-NPIV configured. If bnx2fc is used with such an adapter, driver would read irrelevant data from the the nvram and log "FC-NPIV table with bad length..." In system logs.
Simply accept that reading '0' as the feature offset in nvram indicates the feature isn't there and return.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +4 -0
@@ -14819,6 +14819,10 @@ static int bnx2x_get_fc_npiv(struct net_ } offset =SHMEM2_RD (bp, fc_npiv_nvram_tbl_addr[BP_PORT (bp)]); +if (!offset) { +DP (BNX2X_MSG_MCP ,"No FC-NPIV in NVRAM\n" ); + goto out; + }DP (BNX2X_MSG_MCP ,"Offset of FC-NPIV in NVRAM: %08x\n" , offset);/* Read the table contents from nvram */
Greg Kroah-Hartman
maintainerPATCH 89/112 net/mlx4_core: Allow resetting VF admin mac to zero
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit 6e5224224faa50ec4c8949dcefadf895e565f0d1 upstream.
The VF administrative mac addresses (stored in the PF driver) are initialized to zero when the PF driver starts up.
These addresses may be modified in the PF driver through ndo calls initiated by iproute2 or libvirt.
While we allow the PF/host to change the VF admin mac address from zero to a valid unicast mac, we do not allow restoring the VF admin mac to zero. We currently only allow changing this mac to a different unicast mac.
This leads to problems when libvirt scripts are used to deal with VF mac addresses, and libvirt attempts to revoke the mac so this host will not use it anymore.
Fix this by allowing resetting a VF administrative MAC back to zero.
--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -2282,7 +2282,7 @@ static int mlx4_en_set_vf_mac(struct netstruct mlx4_en_dev *mdev = en_priv->mdev;u64 mac_u64 =mlx4_mac_to_u64 (mac); -if (!is_valid_ether_addr (mac)) +if (is_multicast_ether_addr (mac))return -EINVAL ;return mlx4_set_vf_mac (mdev->dev, en_priv->port, queue, mac_u64);
Greg Kroah-Hartman
maintainerPATCH 90/112 acpi, nfit: check for the correct event code in notifications
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vishal Verma <[email protected]>
commit c09f12186d6b03b798832d95289af76495990192 upstream.
Commit 209851649dc4 "acpi: nfit: Add support for hot-add" added support for _FIT notifications, but it neglected to verify the notification event code matches the one in the ACPI spec for "NFIT Update". Currently there is only one code in the spec, but once additional codes are added, older kernels (without this fix) will misbehave by assuming all event notifications are for an NFIT Update.
--- drivers/acpi/nfit.c | 3 +++ drivers/acpi/nfit.h | 4 ++++ 2 files changed, 7 insertions(+)
drivers/acpi/nfit.c +3 -0
@@ -1806,6 +1806,9 @@ static void acpi_nfit_notify(struct acpidev_dbg (dev,"%s: event: %d\n" , __func__, event); +if (event !=NFIT_NOTIFY_UPDATE ) +return ; +device_lock (dev);if (!dev->driver) {/* dev->driver may be null if we're being removed */
drivers/acpi/nfit.h +4 -0
@@ -45,6 +45,10 @@ enum { ND_BLK_DCR_LATCH = 2, }; +enum nfit_root_notifiers { +NFIT_NOTIFY_UPDATE =0x80 , +}; +struct nfit_spa {struct acpi_nfit_system_address *spa;struct list_head list;
Greg Kroah-Hartman
maintainerPATCH 91/112 mm: workingset: fix crash in shadow node shrinker caused by replace_page_cache_page()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Weiner <[email protected]>
commit 22f2ac51b6d643666f4db093f13144f773ff3f3a upstream.
Antonio reports the following crash when using fuse under memory pressure:
kernel BUG at /build/linux-a2WvEb/linux-4.4.0/mm/workingset.c:346! invalid opcode: 0000 [#1] SMP
Modules linked in: all of them
CPU: 2 PID: 63 Comm: kswapd0 Not tainted 4.4.0-36-generic #55-Ubuntu
Hardware name: System manufacturer System Product Name/P8H67-M PRO, BIOS 3904 04/27/2013
task: ffff88040cae6040 ti: ffff880407488000 task.ti: ffff880407488000
RIP: shadow_lru_isolate+0x181/0x190
Call Trace:
__list_lru_walk_one.isra.3+0x8f/0x130
list_lru_walk_one+0x23/0x30
scan_shadow_nodes+0x34/0x50
shrink_slab.part.40+0x1ed/0x3d0
shrink_zone+0x2ca/0x2e0
kswapd+0x51e/0x990
kthread+0xd8/0xf0
ret_from_fork+0x3f/0x70which corresponds to the following sanity check in the shadow node tracking:
BUG_ON(node->count & RADIX_TREE_COUNT_MASK);
The workingset code tracks radix tree nodes that exclusively contain shadow entries of evicted pages in them, and this (somewhat obscure) line checks whether there are real pages left that would interfere with reclaim of the radix tree node under memory pressure.
While discussing ways how fuse might sneak pages into the radix tree past the workingset code, Miklos pointed to replace_page_cache_page(), and indeed there is a problem there: it properly accounts for the old page being removed - __delete_from_page_cache() does that - but then does a raw raw radix_tree_insert(), not accounting for the replacement page. Eventually the page count bits in node->count underflow while leaving the node incorrectly linked to the shadow node LRU.
To address this, make sure replace_page_cache_page() uses the tracked page insertion code, page_cache_tree_insert(). This fixes the page accounting and makes sure page-containing nodes are properly unlinked from the shadow node LRU again.
Also, make the sanity checks a bit less obscure by using the helpers for checking the number of pages and shadows in a radix tree node.
--- include/linux/swap.h | 2 + mm/filemap.c | 86 +++++++++++++++++++++++++-------------------------- mm/workingset.c | 10 ++--- 3 files changed, 49 insertions(+), 49 deletions(-)
include/linux/swap.h +2 -0
@@ -266,6 +266,7 @@ static inline void workingset_node_pagesstatic inline void workingset_node_pages_dec (struct radix_tree_node *node) { +VM_BUG_ON (!workingset_node_pages (node)); node->count--; }
@@ -281,6 +282,7 @@ static inline void workingset_node_shadostatic inline void workingset_node_shadows_dec (struct radix_tree_node *node) { +VM_BUG_ON (!workingset_node_shadows (node)); node->count -=1U <<RADIX_TREE_COUNT_SHIFT ; }
mm/filemap.c +43 -43
104 lines not on this page · raw message
mm/workingset.c +4 -6
@@ -341,21 +341,19 @@ static enum lru_status shadow_lru_isolat* no pages, so we expect to be able to remove them all and * delete and free the empty node afterwards. */ - -BUG_ON (!node->count); -BUG_ON (node->count &RADIX_TREE_COUNT_MASK ); +BUG_ON (!workingset_node_shadows (node)); +BUG_ON (workingset_node_pages (node));for (i =0 ; i <RADIX_TREE_MAP_SIZE ; i++) {if (node->slots[i]) {BUG_ON (!radix_tree_exceptional_entry (node->slots[i])); node->slots[i] =NULL ; -BUG_ON (node->count < (1U <<RADIX_TREE_COUNT_SHIFT )); - node->count -=1U <<RADIX_TREE_COUNT_SHIFT ; +workingset_node_shadows_dec (node);BUG_ON (!mapping->nrshadows); mapping->nrshadows--; } } -BUG_ON (node->count); +BUG_ON (workingset_node_shadows (node));inc_zone_state (page_zone (virt_to_page (node)),WORKINGSET_NODERECLAIM );if (!__radix_tree_delete_node (&mapping->page_tree, node))BUG ();
Greg Kroah-Hartman
maintainerPATCH 92/112 mm: filemap: fix mapping->nrpages double accounting in fuse
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -590,7 +590,6 @@ int replace_page_cache_page(struct page__delete_from_page_cache (old,NULL , memcg); error =page_cache_tree_insert (mapping, new,NULL );BUG_ON (error); - mapping->nrpages++;/* * hugetlb pages do not participate in page cache accounting.
Greg Kroah-Hartman
maintainerPATCH 93/112 Using BUG_ON() as an assert() is _never_ acceptable
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 21f54ddae449f4bdd9f1498124901d67202243d9 upstream.
That just generally kills the machine, and makes debugging only much harder, since the traces may long be gone.
Debugging by assert() is a disease. Don't do it. If you can continue, you're much better off doing so with a live machine where you have a much higher chance that the report actually makes it to the system logs, rather than result in a machine that is just completely dead.
The only valid situation for BUG_ON() is when continuing is not an option, because there is massive corruption. But if you are just verifying that something is true, you warn about your broken assumptions (preferably just once), and limp on.
--- include/linux/swap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/swap.h +2 -2
@@ -266,7 +266,7 @@ static inline void workingset_node_pagesstatic inline void workingset_node_pages_dec (struct radix_tree_node *node) { -VM_BUG_ON (!workingset_node_pages (node)); +VM_WARN_ON_ONCE (!workingset_node_pages (node)); node->count--; }
@@ -282,7 +282,7 @@ static inline void workingset_node_shadostatic inline void workingset_node_shadows_dec (struct radix_tree_node *node) { -VM_BUG_ON (!workingset_node_shadows (node)); +VM_WARN_ON_ONCE (!workingset_node_shadows (node)); node->count -=1U <<RADIX_TREE_COUNT_SHIFT ; }
Greg Kroah-Hartman
maintainerPATCH 94/112 s390/mm: fix gmap tlb flush issues
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit f045402984404ddc11016358411e445192919047 upstream.
__tlb_flush_asce() should never be used if multiple asce belong to a mm.
As this function changes mm logic determining if local or global tlb flushes will be neded, we might end up flushing only the gmap asce on all CPUs and a follow up mm asce flushes will only flush on the local CPU, although that asce ran on multiple CPUs.
The missing tlb flushes will provoke strange faults in user space and even low address protections in user space, crashing the kernel.
--- arch/s390/include/asm/tlbflush.h | 3 ++- arch/s390/mm/pgtable.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/s390/include/asm/tlbflush.h +2 -1
@@ -81,7 +81,8 @@ static inline void __tlb_flush_full(stru }/* -* Flush TLB entries for a specific ASCE on all CPUs. +* Flush TLB entries for a specific ASCE on all CPUs. Should never be used +* when more than one asce (e.g. gmap) ran on this mm. */ static inline void __tlb_flush_asce (struct mm_struct *mm,unsigned long asce) {
arch/s390/mm/pgtable.c +2 -2
@@ -166,7 +166,7 @@ EXPORT_SYMBOL_GPL(gmap_alloc);static void gmap_flush_tlb (struct gmap *gmap) {if (MACHINE_HAS_IDTE ) -__tlb_flush_asce (gmap->mm, gmap->asce); +__tlb_flush_idte (gmap->asce);else __tlb_flush_global (); }
@@ -205,7 +205,7 @@ void gmap_free(struct gmap *gmap)/* Flush tlb. */ if (MACHINE_HAS_IDTE ) -__tlb_flush_asce (gmap->mm, gmap->asce); +__tlb_flush_idte (gmap->asce);else __tlb_flush_global ();
Greg Kroah-Hartman
maintainerPATCH 95/112 irqchip/gic-v3-its: Fix entry size mask for GITS_BASER
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Murzin <[email protected]>
commit 9224eb77e63f70f16c0b6b7a20ca7d395f3bc077 upstream.
Entry Size in GITS_BASER<n> occupies 5 bits [52:48], but we mask out 8 bits.
--- include/linux/irqchip/arm-gic-v3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/irqchip/arm-gic-v3.h +1 -1
@@ -218,7 +218,7 @@#define GITS_BASER_TYPE_SHIFT (56)#define GITS_BASER_TYPE (r) (((r) >> GITS_BASER_TYPE_SHIFT) & 7)#define GITS_BASER_ENTRY_SIZE_SHIFT (48) -#define GITS_BASER_ENTRY_SIZE (r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0xff) + 1) +#define GITS_BASER_ENTRY_SIZE (r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1)#define GITS_BASER_NonShareable (0UL << 10)#define GITS_BASER_InnerShareable (1UL << 10)#define GITS_BASER_OuterShareable (2UL << 10)
Greg Kroah-Hartman
maintainerPATCH 96/112 isofs: Do not return EACCES for unknown filesystems
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit a2ed0b391dd9c3ef1d64c7c3e370f4a5ffcd324a upstream.
When isofs_mount() is called to mount a device read-write, it returns EACCES even before it checks that the device actually contains an isofs filesystem. This may confuse mount(8) which then tries to mount all subsequent filesystem types in read-only mode.
Fix the problem by returning EACCES only once we verify that the device indeed contains an iso9660 filesystem.
--- fs/isofs/inode.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/isofs/inode.c +5 -3
@@ -690,6 +690,11 @@ static int isofs_fill_super(struct super pri_bh =NULL ; root_found: +/* We don't support read-write mounts */ +if (!(s->s_flags &MS_RDONLY )) { + error = -EACCES ; + goto out_freebh; + }if (joliet_level && (pri ==NULL || !opt.rock)) {/* This is the case of Joliet with the norock mount flag.
@@ -1503,9 +1508,6 @@ struct inode *__isofs_iget(struct super_static struct dentry *isofs_mount (struct file_system_type *fs_type,int flags,const char *dev_name,void *data) { -/* We don't support read-write mounts */ -if (!(flags &MS_RDONLY )) -return ERR_PTR (-EACCES );return mount_bdev (fs_type, flags, dev_name, data, isofs_fill_super); }
Greg Kroah-Hartman
maintainerPATCH 97/112 memstick: rtsx_usb_ms: Runtime resume the device when polling for cards
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 796aa46adf1d90eab36ae06a42e6d3f10b28a75c upstream.
Accesses to the rtsx usb device, which is the parent of the rtsx memstick device, must not be done unless it's runtime resumed.
Therefore when the rtsx_usb_ms driver polls for inserted memstick cards, let's add pm_runtime_get|put*() to make sure accesses is done when the rtsx usb device is runtime resumed.
--- drivers/memstick/host/rtsx_usb_ms.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/memstick/host/rtsx_usb_ms.c +2 -0
@@ -681,6 +681,7 @@ static int rtsx_usb_detect_ms_card(voidint err;for (;;) { +pm_runtime_get_sync (ms_dev (host));mutex_lock (&ucr->dev_mutex);/* Check pending MS card changes */
@@ -703,6 +704,7 @@ static int rtsx_usb_detect_ms_card(void } poll_again: +pm_runtime_put (ms_dev (host));if (host->eject)break ;
Greg Kroah-Hartman
maintainerPATCH 98/112 memstick: rtsx_usb_ms: Manage runtime PM when accessing the device
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit 9158cb29e7c2f10dd325eb1589f0fe745a271257 upstream.
Accesses to the rtsx usb device, which is the parent of the rtsx memstick device, must not be done unless it's runtime resumed. This is currently not the case and it could trigger various errors.
Fix this by properly deal with runtime PM in this regards. This means making sure the device is runtime resumed, when serving requests via the ->request() callback or changing settings via the ->set_param() callbacks.
--- drivers/memstick/host/rtsx_usb_ms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/memstick/host/rtsx_usb_ms.c +4 -0
@@ -524,6 +524,7 @@ static void rtsx_usb_ms_handle_req(strucint rc;if (!host->req) { +pm_runtime_get_sync (ms_dev (host)); do { rc = memstick_next_req(msh, &host->req); dev_dbg(ms_dev(host), "next req %d\n", rc);
@@ -544,6 +545,7 @@ static void rtsx_usb_ms_handle_req(struc host->req->error); } }while (!rc); +pm_runtime_put (ms_dev (host)); } }
@@ -570,6 +572,7 @@ static int rtsx_usb_ms_set_param(structdev_dbg (ms_dev (host),"%s: param = %d, value = %d\n" , __func__, param, value); +pm_runtime_get_sync (ms_dev (host));mutex_lock (&ucr->dev_mutex); err =rtsx_usb_card_exclusive_check (ucr,RTSX_USB_MS_CARD );
@@ -635,6 +638,7 @@ static int rtsx_usb_ms_set_param(struct } out:mutex_unlock (&ucr->dev_mutex); +pm_runtime_put (ms_dev (host));/* power-on delay */ if (param ==MEMSTICK_POWER && value ==MEMSTICK_POWER_ON )
Greg Kroah-Hartman
maintainerPATCH 99/112 arm64: percpu: rewrite ll/sc loops in assembly
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 1e6e57d9b34a9075d5f9e2048ea7b09756590d11 upstream.
Writing the outer loop of an LL/SC sequence using do {...} while constructs potentially allows the compiler to hoist memory accesses between the STXR and the branch back to the LDXR. On CPUs that do not guarantee forward progress of LL/SC loops when faced with memory accesses to the same ERG (up to 2k) between the failed STXR and the branch back, we may end up livelocking.
This patch avoids this issue in our percpu atomics by rewriting the outer loop as part of the LL/SC inline assembly block.
--- arch/arm64/include/asm/percpu.h | 120 ++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 64 deletions(-)
arch/arm64/include/asm/percpu.h +56 -64
@@ -44,48 +44,44 @@ static inline unsigned long __percpu_##o \switch (size) { \case 1 : \ - do { \ - asm ("//__per_cpu_" #op "_1\n" \ - "ldxrb %w[ret], %[ptr]\n" \ + asm ("//__per_cpu_" #op "_1\n" \ + "1: ldxrb %w[ret], %[ptr]\n" \ #asm_op " %w[ret], %w[ret], %w[val]\n" \ - "stxrb %w[loop], %w[ret], %[ptr]\n" \ - : [loop] "=&r" (loop), [ret] "=&r" (ret), \ - [ptr] "+Q"(*(u8 *)ptr) \ - : [val] "Ir" (val)); \ - } while (loop); \ + " stxrb %w[loop], %w[ret], %[ptr]\n" \ + " cbnz %w[loop], 1b" \ + : [loop] "=&r" (loop), [ret] "=&r" (ret), \ + [ptr] "+Q"(*(u8 *)ptr) \ + : [val] "Ir" (val)); \ break; \ case 2: \ - do { \ - asm ("//__per_cpu_" #op "_2\n" \ - "ldxrh %w[ret], %[ptr]\n" \ + asm ("//__per_cpu_" #op "_2\n" \ + "1: ldxrh %w[ret], %[ptr]\n" \ #asm_op " %w[ret], %w[ret], %w[val]\n" \ - "stxrh %w[loop], %w[ret], %[ptr]\n" \ - : [loop] "=&r" (loop), [ret] "=&r" (ret), \ - [ptr] "+Q"(*(u16 *)ptr) \ - : [val] "Ir" (val)); \ - } while (loop); \ + " stxrh %w[loop], %w[ret], %[ptr]\n" \ + " cbnz %w[loop], 1b" \ + : [loop] "=&r" (loop), [ret] "=&r" (ret), \ + [ptr] "+Q"(*(u16 *)ptr) \ + : [val] "Ir" (val)); \ break; \ case 4: \ - do { \ - asm ("//__per_cpu_" #op "_4\n" \ - "ldxr %w[ret], %[ptr]\n" \ + asm ("//__per_cpu_" #op "_4\n" \ + "1: ldxr %w[ret], %[ptr]\n" \ #asm_op " %w[ret], %w[ret], %w[val]\n" \ - "stxr %w[loop], %w[ret], %[ptr]\n" \ - : [loop] "=&r" (loop), [ret] "=&r" (ret), \ - [ptr] "+Q"(*(u32 *)ptr) \ - : [val] "Ir" (val)); \ - } while (loop); \ + " stxr %w[loop], %w[ret], %[ptr]\n" \ + " cbnz %w[loop], 1b" \ + : [loop] "=&r" (loop), [ret] "=&r" (ret), \ + [ptr] "+Q"(*(u32 *)ptr) \ + : [val] "Ir" (val)); \ break; \ case 8: \ - do { \ - asm ("//__per_cpu_" #op "_8\n" \ - "ldxr %[ret], %[ptr]\n" \ + asm ("//__per_cpu_" #op "_8\n" \ + "1: ldxr %[ret], %[ptr]\n" \ #asm_op " %[ret], %[ret], %[val]\n" \ - "stxr %w[loop], %[ret], %[ptr]\n" \ - : [loop] "=&r" (loop), [ret] "=&r" (ret), \ - [ptr] "+Q"(*(u64 *)ptr) \ - : [val] "Ir" (val)); \ - } while (loop); \ + " stxr %w[loop], %[ret], %[ptr]\n" \ + " cbnz %w[loop], 1b" \ + : [loop] "=&r" (loop), [ret] "=&r" (ret), \ + [ptr] "+Q"(*(u64 *)ptr) \ + : [val] "Ir" (val)); \ break; \ default: \ BUILD_BUG(); \
@@ -150,44 +146,40 @@ static inline unsigned long __percpu_xchswitch (size) {case 1 : -do { - asm ("//__percpu_xchg_1\n" -"ldxrb %w[ret], %[ptr]\n" -"stxrb %w[loop], %w[val], %[ptr]\n" - : [loop]"=&r" (loop), [ret]"=&r" (ret), - [ptr]"+Q" (*(u8 *)ptr) - : [val]"r" (val)); - }while (loop); + asm ("//__percpu_xchg_1\n" +"1: ldxrb %w[ret], %[ptr]\n" +" stxrb %w[loop], %w[val], %[ptr]\n" +" cbnz %w[loop], 1b" + : [loop]"=&r" (loop), [ret]"=&r" (ret), + [ptr]"+Q" (*(u8 *)ptr) + : [val]"r" (val));break ;case 2 : -do { - asm ("//__percpu_xchg_2\n" -"ldxrh %w[ret], %[ptr]\n" -"stxrh %w[loop], %w[val], %[ptr]\n" - : [loop]"=&r" (loop), [ret]"=&r" (ret), - [ptr]"+Q" (*(u16 *)ptr) - : [val]"r" (val)); - }while (loop); + asm ("//__percpu_xchg_2\n" +"1: ldxrh %w[ret], %[ptr]\n" +" stxrh %w[loop], %w[val], %[ptr]\n" +" cbnz %w[loop], 1b" + : [loop]"=&r" (loop), [ret]"=&r" (ret), + [ptr]"+Q" (*(u16 *)ptr) + : [val]"r" (val));break ;case 4 : -do { - asm ("//__percpu_xchg_4\n" -"ldxr %w[ret], %[ptr]\n" -"stxr %w[loop], %w[val], %[ptr]\n" - : [loop]"=&r" (loop), [ret]"=&r" (ret), - [ptr]"+Q" (*(u32 *)ptr) - : [val]"r" (val)); - }while (loop); + asm ("//__percpu_xchg_4\n" +"1: ldxr %w[ret], %[ptr]\n" +" stxr %w[loop], %w[val], %[ptr]\n" +" cbnz %w[loop], 1b" + : [loop]"=&r" (loop), [ret]"=&r" (ret), + [ptr]"+Q" (*(u32 *)ptr) + : [val]"r" (val));break ;case 8 : -do { - asm ("//__percpu_xchg_8\n" -"ldxr %[ret], %[ptr]\n" -"stxr %w[loop], %[val], %[ptr]\n" - : [loop]"=&r" (loop), [ret]"=&r" (ret), - [ptr]"+Q" (*(u64 *)ptr) - : [val]"r" (val)); - }while (loop); + asm ("//__percpu_xchg_8\n" +"1: ldxr %[ret], %[ptr]\n" +" stxr %w[loop], %[val], %[ptr]\n" +" cbnz %w[loop], 1b" + : [loop]"=&r" (loop), [ret]"=&r" (ret), + [ptr]"+Q" (*(u64 *)ptr) + : [val]"r" (val));break ;default :BUILD_BUG ();
Greg Kroah-Hartman
maintainerPATCH 100/112 arm64: kernel: Init MDCR_EL2 even in the absence of a PMU
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 850540351bb1a4fa5f192e5ce55b89928cc57f42 upstream.
Commit f436b2ac90a0 ("arm64: kernel: fix architected PMU registers unconditional access") made sure we wouldn't access unimplemented PMU registers, but also left MDCR_EL2 uninitialized in that case, leading to trap bits being potentially left set.
Make sure we always write something in that register.
--- arch/arm64/kernel/head.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/head.S +2 -1
@@ -518,8 +518,9 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // C b.lt 4f // Skip if no PMU present mrs x0, pmcr_el0 // Disable debug access traps ubfx x0, x0, #11, #5 // to EL2 and allow access to - msr mdcr_el2, x0 // all PMU counters from EL1 4: + csel x0, xzr, x0, lt // all PMU counters from EL1 + msr mdcr_el2, x0 // (if they exist) /* Stage-2 translation */ msr vttbr_el2, xzr
Greg Kroah-Hartman
maintainerPATCH 101/112 ceph: fix error handling in ceph_read_iter
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit 0d7718f666be181fda1ba2d08f137d87c1419347 upstream.
In case __ceph_do_getattr returns an error and the retry_op in ceph_read_iter is not READ_INLINE, then it's possible to invoke __free_page on a page which is NULL, this naturally leads to a crash. This can happen when, for example, a process waiting on a MDS reply receives sigterm.
Fix this by explicitly checking whether the page is set or not.
--- fs/ceph/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ceph/file.c +2 -1
@@ -929,7 +929,8 @@ again: statret =__ceph_do_getattr (inode, page,CEPH_STAT_CAP_INLINE_DATA , !!page);if (statret <0 ) { -__free_page (page); +if (page) +__free_page (page);if (statret == -ENODATA ) {BUG_ON (retry_op !=READ_INLINE ); goto again;
Greg Kroah-Hartman
maintainerPATCH 102/112 powerpc/mm: Prevent unlikely crash in copro_calculate_slb()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Barrat <[email protected]>
commit d2cf909cda5f8c5609cb7ed6cda816c3e15528c7 upstream.
If a cxl adapter faults on an invalid address for a kernel context, we may enter copro_calculate_slb() with a NULL mm pointer (kernel context) and an effective address which looks like a user address. Which will cause a crash when dereferencing mm. It is clearly an AFU bug, but there's no reason to crash either. So return an error, so that cxl can ack the interrupt with an address error.
--- arch/powerpc/mm/copro_fault.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/mm/copro_fault.c +2 -0
@@ -106,6 +106,8 @@ int copro_calculate_slb(struct mm_structswitch (REGION_ID (ea)) {case USER_REGION_ID :pr_devel ("%s: 0x%llx -- USER_REGION_ID\n" , __func__, ea); +if (mm ==NULL ) +return 1 ; psize =get_slice_psize (mm, ea); ssize =user_segment_size (ea); vsid =get_vsid (mm->context.id, ea, ssize);
Greg Kroah-Hartman
maintainerPATCH 103/112 mmc: core: Annotate cmd_hdr as __le32
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1755,7 +1755,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
@@ -25,7 +25,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;
Greg Kroah-Hartman
maintainerPATCH 104/112 mmc: rtsx_usb_sdmmc: Avoid keeping the device runtime resumed when unused
In reply to Greg Kroah-Hartman4.4-stable 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);
Greg Kroah-Hartman
maintainerPATCH 105/112 mmc: rtsx_usb_sdmmc: Handle runtime PM while changing the led
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit 4f48aa7a11bfed9502a7c85a5b68cd40ea827f73 upstream.
Accesses of the rtsx sdmmc's parent device, which is the rtsx usb device, must be done when it's runtime resumed. Currently this isn't case when changing the led, so let's fix this by adding a pm_runtime_get_sync() and a pm_runtime_put() around those operations.
--- drivers/mmc/host/rtsx_usb_sdmmc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -0
@@ -1309,6 +1309,7 @@ static void rtsx_usb_update_led(struct w container_of(work, struct rtsx_usb_sdmmc, led_work);struct rtsx_ucr *ucr = host->ucr; +pm_runtime_get_sync (sdmmc_dev (host));mutex_lock (&ucr->dev_mutex);if (host->led.brightness ==LED_OFF )
@@ -1317,6 +1318,7 @@ static void rtsx_usb_update_led(struct wrtsx_usb_turn_on_led (ucr);mutex_unlock (&ucr->dev_mutex); + pm_runtime_put(sdmmc_dev(host)); }#endif
Greg Kroah-Hartman
maintainerPATCH 106/112 ext4: do not advertise encryption support when disabled
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit c4704a4fbe834eee4109ca064131d440941f6235 upstream.
The sysfs file /sys/fs/ext4/features/encryption was present on kernels compiled with CONFIG_EXT4_FS_ENCRYPTION=n. This was misleading because such kernels do not actually support ext4 encryption. Therefore, only provide this file on kernels compiled with CONFIG_EXT4_FS_ENCRYPTION=y.
Note: since the ext4 feature files are all hardcoded to have a contents of "supported", it really is the presence or absence of the file that is significant, not the contents (and this change reflects that).
--- fs/ext4/sysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ext4/sysfs.c +4 -0
@@ -223,14 +223,18 @@ static struct attribute *ext4_attrs[] =EXT4_ATTR_FEATURE (lazy_itable_init);EXT4_ATTR_FEATURE (batched_discard);EXT4_ATTR_FEATURE (meta_bg_resize); +#ifdef CONFIG_EXT4_FS_ENCRYPTION EXT4_ATTR_FEATURE (encryption); +#endif EXT4_ATTR_FEATURE (metadata_csum_seed);static struct attribute *ext4_feat_attrs[] = {ATTR_LIST (lazy_itable_init),ATTR_LIST (batched_discard),ATTR_LIST (meta_bg_resize), +#ifdef CONFIG_EXT4_FS_ENCRYPTIONATTR_LIST (encryption), +#endifATTR_LIST (metadata_csum_seed),NULL , };
Greg Kroah-Hartman
maintainerPATCH 107/112 jbd2: fix incorrect unlock on j_list_lock
In reply to Greg Kroah-Hartman4.4-stable 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
@@ -1156,6 +1156,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 ;
@@ -1163,8 +1164,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);/*
Greg Kroah-Hartman
maintainerPATCH 108/112 ubifs: Fix xattr_names length in exit paths
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 843741c5778398ea67055067f4cc65ae6c80ca0e upstream.
When the operation fails we also have to undo the changes we made to ->xattr_names. Otherwise listxattr() will report wrong lengths.
--- fs/ubifs/xattr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ubifs/xattr.c +2 -0
@@ -173,6 +173,7 @@ out_cancel: host_ui->xattr_cnt -=1 ; host_ui->xattr_size -=CALC_DENT_SIZE (nm->len); host_ui->xattr_size -=CALC_XATTR_BYTES (size); + host_ui->xattr_names -= nm->len;mutex_unlock (&host_ui->ui_mutex); out_free:make_bad_inode (inode);
@@ -533,6 +534,7 @@ out_cancel: host_ui->xattr_cnt +=1 ; host_ui->xattr_size +=CALC_DENT_SIZE (nm->len); host_ui->xattr_size +=CALC_XATTR_BYTES (ui->data_len); + host_ui->xattr_names += nm->len;mutex_unlock (&host_ui->ui_mutex);ubifs_release_budget (c, &req);make_bad_inode (inode);
Greg Kroah-Hartman
maintainerPATCH 109/112 ubifs: Abort readdir upon error
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit c83ed4c9dbb358b9e7707486e167e940d48bfeed upstream.
If UBIFS is facing an error while walking a directory, it reports this error and ubifs_readdir() returns the error code. But the VFS readdir logic does not make the getdents system call fail in all cases. When the readdir cursor indicates that more entries are present, the system call will just return and the libc wrapper will try again since it also knows that more entries are present.
This causes the libc wrapper to busy loop for ever when a directory is corrupted on UBIFS.
A common approach do deal with corrupted directory entries is skipping them by setting the cursor to the next entry. On UBIFS this approach is not possible since we cannot compute the next directory entry cursor position without reading the current entry. So all we can do is setting the cursor to the "no more entries" position and make getdents exit.
--- fs/ubifs/dir.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
fs/ubifs/dir.c +3 -5
@@ -350,7 +350,7 @@ static unsigned int vfs_dent_type(uint8_*/ static int ubifs_readdir (struct file *file,struct dir_context *ctx) { -int err; +int err =0 ;struct qstr nm;union ubifs_key key;struct ubifs_dent_node *dent;
@@ -452,14 +452,12 @@ out:kfree (file->private_data); file->private_data =NULL ; -if (err != -ENOENT ) { +if (err != -ENOENT )ubifs_err (c,"cannot find next direntry, error %d" , err); -return err; - }/* 2 is a special value indicating that there are no more direntries */ ctx->pos =2 ; -return 0 ; +return err; }/* Free saved readdir() state when the directory is closed */
Greg Kroah-Hartman
maintainerPATCH 110/112 target: Re-add missing SCF_ACK_KREF assignment in v4.1.y
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 527268df31e57cf2b6d417198717c6d6afdb1e3e upstream.
This patch fixes a regression in >= v4.1.y code where the original SCF_ACK_KREF assignment in target_get_sess_cmd() was dropped upstream in commit 054922bb, but the series for addressing TMR ABORT_TASK + LUN_RESET with fabric session reinstatement in commit febe562c20 still depends on this code in transport_cmd_finish_abort().
The regression manifests itself as a se_cmd->cmd_kref +1 leak, where ABORT_TASK + LUN_RESET can hang indefinately for a specific I_T session for drivers using SCF_ACK_KREF, resulting in hung kthreads.
This patch has been verified with v4.1.y code.
--- drivers/target/target_core_transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/target/target_core_transport.c +3 -1
@@ -2509,8 +2509,10 @@ int target_get_sess_cmd(struct se_cmd *s* fabric acknowledgement that requires two target_put_sess_cmd() * invocations before se_cmd descriptor release. */ -if (ack_kref) +if (ack_kref) {kref_get (&se_cmd->cmd_kref); + se_cmd->se_cmd_flags |=SCF_ACK_KREF ; + }spin_lock_irqsave (&se_sess->sess_cmd_lock, flags);if (se_sess->sess_tearing_down) {
Greg Kroah-Hartman
maintainerPATCH 111/112 target: Make EXTENDED_COPY 0xe4 failure return COPY TARGET DEVICE NOT REACHABLE
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 449a137846c84829a328757cd21fd9ca65c08519 upstream.
This patch addresses a bug where EXTENDED_COPY across multiple LUNs results in a CHECK_CONDITION when the source + destination are not located on the same physical node.
ESX Host environments expect sense COPY_ABORTED w/ COPY TARGET DEVICE NOT REACHABLE to be returned when this occurs, in order to signal fallback to local copy method.
As described in section 6.3.3 of spc4r22:
"If it is not possible to complete processing of a segment because the
copy manager is unable to establish communications with a copy target device, because the copy target device does not respond to INQUIRY, or because the data returned in response to INQUIRY indicates an unsupported logical unit, then the EXTENDED COPY command shall be terminated with CHECK CONDITION status, with the sense key set to COPY ABORTED, and the additional sense code set to COPY TARGET DEVICE NOT REACHABLE."
Tested on v4.1.y with ESX v5.5u2+ with BlockCopy across multiple nodes.
--- drivers/target/target_core_transport.c | 7 +++++++ drivers/target/target_core_xcopy.c | 22 ++++++++++++++++------ include/target/target_core_base.h | 1 + 3 files changed, 24 insertions(+), 6 deletions(-)
drivers/target/target_core_transport.c +7 -0
@@ -1680,6 +1680,7 @@ void transport_generic_request_failure(scase TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED :case TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED :case TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED : +case TCM_COPY_TARGET_DEVICE_NOT_REACHABLE :break ;case TCM_OUT_OF_RESOURCES : sense_reason =TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
@@ -2835,6 +2836,12 @@ static const struct sense_info sense_inf .ascq = 0x03, /* LOGICAL BLOCK REFERENCE TAG CHECK FAILED */ .add_sector_info = true, }, + [TCM_COPY_TARGET_DEVICE_NOT_REACHABLE] = { + .key = COPY_ABORTED, + .asc = 0x0d, + .ascq = 0x02, /* COPY TARGET DEVICE NOT REACHABLE */ + + }, [TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE] = {/* * Returning ILLEGAL REQUEST would cause immediate IO errors on
drivers/target/target_core_xcopy.c +16 -6
@@ -104,7 +104,7 @@ static int target_xcopy_locate_se_dev_e4 }mutex_unlock (&g_device_mutex); -pr_err ("Unable to locate 0xe4 descriptor for EXTENDED_COPY\n" ); +pr_debug_ratelimited ("Unable to locate 0xe4 descriptor for EXTENDED_COPY\n" );return -EINVAL ; }
@@ -185,7 +185,7 @@ static int target_xcopy_parse_tiddesc_e4static int target_xcopy_parse_target_descriptors (struct se_cmd *se_cmd,struct xcopy_op *xop,unsigned char *p, -unsigned short tdll) +unsigned short tdll,sense_reason_t *sense_ret) {struct se_device *local_dev = se_cmd->se_dev;unsigned char *desc = p;
@@ -193,6 +193,8 @@ static int target_xcopy_parse_target_desunsigned short start =0 ;bool src = true; + *sense_ret =TCM_INVALID_PARAMETER_LIST ; +if (offset !=0 ) {pr_err ("XCOPY target descriptor list length is not" " multiple of %d\n" ,XCOPY_TARGET_DESC_LEN );
@@ -243,9 +245,16 @@ static int target_xcopy_parse_target_des rc =target_xcopy_locate_se_dev_e4 (se_cmd, xop, true); else rc =target_xcopy_locate_se_dev_e4 (se_cmd, xop, false); - -if (rc <0 ) +/* +* If a matching IEEE NAA 0x83 descriptor for the requested device +* is not located on this node, return COPY_ABORTED with ASQ/ASQC +* 0x0d/0x02 - COPY_TARGET_DEVICE_NOT_REACHABLE to request the +* initiator to fall back to normal copy method. +*/ +if (rc <0 ) { + *sense_ret =TCM_COPY_TARGET_DEVICE_NOT_REACHABLE ; goto out; + }pr_debug ("XCOPY TGT desc: Source dev: %p NAA IEEE WWN: 0x%16phN\n" , xop->src_dev, &xop->src_tid_wwn[0 ]);
@@ -816,7 +825,8 @@ out:xcopy_pt_undepend_remotedev (xop);kfree (xop); -pr_warn ("target_xcopy_do_work: Setting X-COPY CHECK_CONDITION -> sending response\n" ); +pr_warn_ratelimited ("target_xcopy_do_work: rc: %d, Setting X-COPY CHECK_CONDITION" +" -> sending response\n" , rc); ec_cmd->scsi_status =SAM_STAT_CHECK_CONDITION ;target_complete_cmd (ec_cmd,SAM_STAT_CHECK_CONDITION ); }
@@ -875,7 +885,7 @@ sense_reason_t target_do_xcopy(struct se" tdll: %hu sdll: %u inline_dl: %u\n" , list_id, list_id_usage, tdll, sdll, inline_dl); - rc =target_xcopy_parse_target_descriptors (se_cmd, xop, &p[16 ], tdll); + rc =target_xcopy_parse_target_descriptors (se_cmd, xop, &p[16 ], tdll, &ret);if (rc <=0 ) goto out;
include/target/target_core_base.h +1 -0
@@ -180,6 +180,7 @@ enum tcm_sense_reason_table {TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED =R (0x15 ),TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED =R (0x16 ),TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED =R (0x17 ), +TCM_COPY_TARGET_DEVICE_NOT_REACHABLE =R (0x18 ), #undef R };
Greg Kroah-Hartman
maintainerPATCH 112/112 target: Dont override EXTENDED_COPY xcopy_pt_cmd SCSI status code
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dinesh Israni <[email protected]>
commit 926317de33998c112c5510301868ea9aa34097e2 upstream.
This patch addresses a bug where a local EXTENDED_COPY WRITE or READ backend I/O request would always return SAM_STAT_CHECK_CONDITION, even if underlying xcopy_pt_cmd->se_cmd generated a different SCSI status code.
ESX host environments expect to hit SAM_STAT_RESERVATION_CONFLICT for certain scenarios, and SAM_STAT_CHECK_CONDITION results in non-retriable status for these cases.
Tested on v4.1.y with ESX v5.5u2+ with local IBLOCK backend copy.
--- drivers/target/target_core_xcopy.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/target/target_core_xcopy.c +12 -4
@@ -662,6 +662,7 @@ static int target_xcopy_read_source( rc =target_xcopy_setup_pt_cmd (xpt_cmd, xop, src_dev, &cdb[0 ], remote_port, true);if (rc <0 ) { + ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status;transport_generic_free_cmd (se_cmd,0 );return rc; }
@@ -673,6 +674,7 @@ static int target_xcopy_read_source( rc =target_xcopy_issue_pt_cmd (xpt_cmd);if (rc <0 ) { + ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status;transport_generic_free_cmd (se_cmd,0 );return rc; }
@@ -723,6 +725,7 @@ static int target_xcopy_write_destinatio remote_port, false);if (rc <0 ) {struct se_cmd *src_cmd = &xop->src_pt_cmd->se_cmd; + ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status;/* * If the failure happened before the t_mem_list hand-off in * target_xcopy_setup_pt_cmd(), Reset memory + clear flag so that
@@ -738,6 +741,7 @@ static int target_xcopy_write_destinatio rc =target_xcopy_issue_pt_cmd (xpt_cmd);if (rc <0 ) { + ec_cmd->scsi_status = xpt_cmd->se_cmd.scsi_status; se_cmd->se_cmd_flags &= ~SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC ;transport_generic_free_cmd (se_cmd,0 );return rc;
@@ -824,10 +828,14 @@ static void target_xcopy_do_work(struct out:xcopy_pt_undepend_remotedev (xop);kfree (xop); - -pr_warn_ratelimited ("target_xcopy_do_work: rc: %d, Setting X-COPY CHECK_CONDITION" -" -> sending response\n" , rc); - ec_cmd->scsi_status =SAM_STAT_CHECK_CONDITION ; +/* +* Don't override an error scsi status if it has already been set +*/ +if (ec_cmd->scsi_status ==SAM_STAT_GOOD ) { +pr_warn_ratelimited ("target_xcopy_do_work: rc: %d, Setting X-COPY" +" CHECK_CONDITION -> sending response\n" , rc); + ec_cmd->scsi_status =SAM_STAT_CHECK_CONDITION ; + }target_complete_cmd (ec_cmd,SAM_STAT_CHECK_CONDITION ); }
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.28 release. There are 112 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Oct 28 12:22:47 UTC 2016. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.28-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America(Silicon Valley) [email protected]
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.28 release. There are 112 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Oct 28 12:22:47 UTC 2016. Anything received after that time might be too late.
Build results:
total: 149 pass: 149 fail: 0 Qemu test results: total: 106 pass: 106 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 3 lines · Kevin Hilman
These are QEMU jobs that the test framework (LAVA) is not waiting long enough to finish. When run standalone, the QEMU tests are passing. Lab owner is looking into it.
I *think* the timeouts come from the LAVA jobs rather than my instance - Tyler?