The UDC core uses req->num_sgs to judge if scatter buffer list is used.
Eg: usb_gadget_map_request_by_dev. For f_fs sync io mode, the request
is re-used for each request, so if the 1st request->length > PAGE_SIZE,
and the 2nd request->length is < PAGE_SIZE, the f_fs uses the 1st
req->num_sgs for the 2nd request, it causes the UDC core get the wrong
req->num_sgs value (The 2nd request doesn't use sg).
We set req->num_sgs as 0 for each request at non-sg transfer case to
fix it.
Cc: Jun Li <jun.li(a)nxp.com>
Cc: stable <stable(a)vger.kernel.org>
Fixes: 772a7a724f69 ("usb: gadget: f_fs: Allow scatter-gather buffers")
Signed-off-by: Peter Chen <peter.chen(a)nxp.com>
---
drivers/usb/gadget/function/f_fs.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index eedd926cc578..b5a1bfc2fc7e 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1106,7 +1106,6 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
req->num_sgs = io_data->sgt.nents;
} else {
req->buf = data;
- req->num_sgs = 0;
}
req->length = data_len;
--
2.17.1
From: Chen-Yu Tsai <wens(a)csie.org>
max_pfn, as set in arch/arm/mm/init.c:
static void __init find_limits(unsigned long *min,
unsigned long *max_low,
unsigned long *max_high)
{
*max_low = PFN_DOWN(memblock_get_current_limit());
*min = PFN_UP(memblock_start_of_DRAM());
*max_high = PFN_DOWN(memblock_end_of_DRAM());
}
with memblock_end_of_DRAM() pointing to the next byte after DRAM. As
such, max_pfn points to the PFN after the end of DRAM.
Thus when using max_pfn to check DMA masks, we should subtract one
when checking DMA ranges against it.
Commit 8bf1268f48ad ("ARM: dma-api: fix off-by-one error in
__dma_supported()") fixed the same issue, but missed this spot.
This issue was found while working on the sun4i-csi v4l2 driver on the
Allwinner R40 SoC. On Allwinner SoCs, DRAM is offset at 0x40000000,
and we are starting to use of_dma_configure() with the "dma-ranges"
property in the device tree to have the DMA API handle the offset.
In this particular instance, dma-ranges was set to the same range as
the actual available (2 GiB) DRAM. The following error appeared when
the driver attempted to allocate a buffer:
sun4i-csi 1c09000.csi: Coherent DMA mask 0x7fffffff (pfn 0x40000-0xc0000)
covers a smaller range of system memory than the DMA zone pfn 0x0-0xc0001
sun4i-csi 1c09000.csi: dma_alloc_coherent of size 307200 failed
Fixing the off-by-one error makes things work.
Fixes: 11a5aa32562e ("ARM: dma-mapping: check DMA mask against available memory")
Fixes: 9f28cde0bc64 ("ARM: another fix for the DMA mapping checks")
Fixes: ab746573c405 ("ARM: dma-mapping: allow larger DMA mask than supported")
Cc: <stable(a)vger.kernel.org>
Signed-off-by: Chen-Yu Tsai <wens(a)csie.org>
---
Changes since v1:
- correct max_pfn offset in the correct place.
---
arch/arm/mm/dma-mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e822af0d9219..9414d72f664b 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -221,7 +221,7 @@ EXPORT_SYMBOL(arm_coherent_dma_ops);
static int __dma_supported(struct device *dev, u64 mask, bool warn)
{
- unsigned long max_dma_pfn = min(max_pfn, arm_dma_pfn_limit);
+ unsigned long max_dma_pfn = min(max_pfn - 1, arm_dma_pfn_limit);
/*
* Translate the device's DMA mask to a PFN limit. This
--
2.24.0
From: James Smart <jsmart2021(a)gmail.com>
[ Upstream commit 3f97aed6117c7677eb16756c4ec8b86000fd5822 ]
An issue was seen discovering all SCSI Luns when a target device undergoes
link bounce.
The driver currently does not qualify the FC4 support on the target.
Therefore it will send a SCSI PRLI and an NVMe PRLI. The expectation is
that the target will reject the PRLI if it is not supported. If a PRLI
times out, the driver will retry. The driver will not proceed with the
device until both SCSI and NVMe PRLIs are resolved. In the failure case,
the device is FCP only and does not respond to the NVMe PRLI, thus
initiating the wait/retry loop in the driver. During that time, a RSCN is
received (device bounced) causing the driver to issue a GID_FT. The GID_FT
response comes back before the PRLI mess is resolved and it prematurely
cancels the PRLI retry logic and leaves the device in a STE_PRLI_ISSUE
state. Discovery with the target never completes or resets.
Fix by resetting the node state back to STE_NPR_NODE when GID_FT completes,
thereby restarting the discovery process for the node.
Link: https://lore.kernel.org/r/20190922035906.10977-10-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy(a)broadcom.com>
Signed-off-by: James Smart <jsmart2021(a)gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen(a)oracle.com>
Signed-off-by: Sasha Levin <sashal(a)kernel.org>
---
drivers/scsi/lpfc/lpfc_hbadisc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 3f88f3d796227..4a0889dd4c1d0 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -5220,9 +5220,14 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
/* If we've already received a PLOGI from this NPort
* we don't need to try to discover it again.
*/
- if (ndlp->nlp_flag & NLP_RCV_PLOGI)
+ if (ndlp->nlp_flag & NLP_RCV_PLOGI &&
+ !(ndlp->nlp_type &
+ (NLP_FCP_TARGET | NLP_NVME_TARGET)))
return NULL;
+ ndlp->nlp_prev_state = ndlp->nlp_state;
+ lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
+
spin_lock_irq(shost->host_lock);
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
spin_unlock_irq(shost->host_lock);
--
2.20.1
These were added to blkdev_ioctl() but not blkdev_compat_ioctl,
so add them now.
Cc: <stable(a)vger.kernel.org> # v4.10+
Fixes: 3ed05a987e0f ("blk-zoned: implement ioctls")
Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
---
block/compat_ioctl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index 6ca015f92766..830f91e05fe3 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -354,6 +354,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
* but we call blkdev_ioctl, which gets the lock for us
*/
case BLKRRPART:
+ case BLKREPORTZONE:
+ case BLKRESETZONE:
return blkdev_ioctl(bdev, mode, cmd,
(unsigned long)compat_ptr(arg));
case BLKBSZSET_32:
--
2.20.0
This is the start of the stable review cycle for the 4.9.206 release.
There are 125 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, 06 Dec 2019 17:50:36 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.206-rc…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 4.9.206-rc1
Chuhong Yuan <hslester96(a)gmail.com>
net: fec: fix clock count mis-match
Hans de Goede <hdegoede(a)redhat.com>
platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer
Lionel Debieve <lionel.debieve(a)st.com>
hwrng: stm32 - fix unbalanced pm_runtime_enable
Candle Sun <candle.sun(a)unisoc.com>
HID: core: check whether Usage Page item is after Usage ID items
Dust Li <dust.li(a)linux.alibaba.com>
net: sched: fix `tc -s class show` no bstats on class with nolock subqueues
Xin Long <lucien.xin(a)gmail.com>
sctp: cache netns in sctp_ep_common
John Rutherford <john.rutherford(a)dektech.com.au>
tipc: fix link name length check
Paolo Abeni <pabeni(a)redhat.com>
openvswitch: remove another BUG_ON()
Paolo Abeni <pabeni(a)redhat.com>
openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info()
Jouni Hogander <jouni.hogander(a)unikie.com>
slip: Fix use-after-free Read in slip_open
Paolo Abeni <pabeni(a)redhat.com>
openvswitch: fix flow command message size
Menglong Dong <dong.menglong(a)zte.com.cn>
macvlan: schedule bc_work even if error
Eugen Hristev <eugen.hristev(a)microchip.com>
media: atmel: atmel-isc: fix asd memory allocation
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
pwm: Clear chip_data in pwm_put()
Luca Ceresoli <luca(a)lucaceresoli.net>
net: macb: fix error format in dev_err()
Eugen Hristev <eugen.hristev(a)microchip.com>
media: v4l2-ctrl: fix flags for DO_WHITE_BALANCE
Alexander Usyskin <alexander.usyskin(a)intel.com>
mei: bus: prefix device names on bus with the bus name
Fabio D'Urso <fabiodurso(a)hotmail.it>
USB: serial: ftdi_sio: add device IDs for U-Blox C099-F9P
Pan Bian <bianpan2016(a)163.com>
staging: rtl8192e: fix potential use after free
Eugen Hristev <eugen.hristev(a)microchip.com>
clk: at91: fix update bit maps on CFG_MOR write
Vlastimil Babka <vbabka(a)suse.cz>
mm, gup: add missing refcount overflow checks on x86 and s390
Boris Brezillon <bbrezillon(a)kernel.org>
mtd: Remove a debug trace in mtdpart.c
Gen Zhang <blackgod016574(a)gmail.com>
powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()
John Garry <john.garry(a)huawei.com>
scsi: libsas: Check SMP PHY control function result
James Morse <james.morse(a)arm.com>
ACPI / APEI: Switch estatus pool to use vmalloc memory
John Garry <john.garry(a)huawei.com>
scsi: libsas: Support SATA PHY connection rate unmatch fixing during discovery
Aaron Ma <aaron.ma(a)canonical.com>
iommu/amd: Fix NULL dereference bug in match_hid_uid
Andy Shevchenko <andriy.shevchenko(a)linux.intel.com>
net: dev: Use unsigned integer as an argument to left-shift
Maciej Kwiecien <maciej.kwiecien(a)nokia.com>
sctp: don't compare hb_timer expire date before starting it
Eric Dumazet <edumazet(a)google.com>
net: fix possible overflow in __sk_mem_raise_allocated()
Bert Kenward <bkenward(a)solarflare.com>
sfc: initialise found bitmap in efx_ef10_mtd_probe
Hoang Le <hoang.h.le(a)dektech.com.au>
tipc: fix skb may be leaky in tipc_link_input
Johannes Berg <johannes.berg(a)intel.com>
decnet: fix DN_IFREQ_SIZE
wenxu <wenxu(a)ucloud.cn>
ip_tunnel: Make none-tunnel-dst tunnel port work with lwtunnel
Edward Cree <ecree(a)solarflare.com>
sfc: suppress duplicate nvmem partition types in efx_ef10_mtd_probe
Konstantin Khlebnikov <khlebnikov(a)yandex-team.ru>
net/core/neighbour: fix kmemleak minimal reference count for hash tables
Konstantin Khlebnikov <khlebnikov(a)yandex-team.ru>
net/core/neighbour: tell kmemleak about hash tables
Gustavo A. R. Silva <gustavo(a)embeddedor.com>
tipc: fix memory leak in tipc_nl_compat_publ_dump
Boris Brezillon <bbrezillon(a)kernel.org>
mtd: Check add_mtd_device() ret code
Olof Johansson <olof(a)lixom.net>
lib/genalloc.c: include vmalloc.h
Qian Cai <cai(a)gmx.us>
drivers/base/platform.c: kmemleak ignore a known leak
Huang Shijie <sjhuang(a)iluvatar.ai>
lib/genalloc.c: use vzalloc_node() to allocate the bitmap
Alexey Skidanov <alexey.skidanov(a)intel.com>
lib/genalloc.c: fix allocation of aligned buffer from non-aligned chunk
Wei Yang <richard.weiyang(a)gmail.com>
vmscan: return NODE_RECLAIM_NOSCAN in node_reclaim() when CONFIG_NUMA is n
Junxiao Bi <junxiao.bi(a)oracle.com>
ocfs2: clear journal dirty flag after shutdown journal
Wen Yang <wen.yang99(a)zte.com.cn>
net/wan/fsl_ucc_hdlc: Avoid double free in ucc_hdlc_probe()
Kangjie Lu <kjlu(a)umn.edu>
tipc: fix a missing check of genlmsg_put
Kangjie Lu <kjlu(a)umn.edu>
atl1e: checking the status of atl1e_write_phy_reg
Kangjie Lu <kjlu(a)umn.edu>
net: dsa: bcm_sf2: Propagate error value from mdio_write
Kangjie Lu <kjlu(a)umn.edu>
net: stmicro: fix a missing check of clk_prepare
Richard Weinberger <richard(a)nod.at>
um: Make GCOV depend on !KCOV
Aditya Pakki <pakki001(a)umn.edu>
net/net_namespace: Check the return value of register_pernet_subsys()
Alexander Shiyan <shc_work(a)mail.ru>
pwm: clps711x: Fix period calculation
Fabio Estevam <festevam(a)gmail.com>
crypto: mxc-scc - fix build warnings on ARM64
Michael Ellerman <mpe(a)ellerman.id.au>
powerpc/pseries: Fix node leak in update_lmb_associativity_index()
Christophe Leroy <christophe.leroy(a)c-s.fr>
powerpc/83xx: handle machine check caused by watchdog timer
Kangjie Lu <kjlu(a)umn.edu>
regulator: tps65910: fix a missing check of return value
Luc Van Oostenryck <luc.vanoostenryck(a)gmail.com>
drbd: fix print_st_err()'s prototype to match the definition
Lars Ellenberg <lars.ellenberg(a)linbit.com>
drbd: do not block when adjusting "disk-options" while IO is frozen
Lars Ellenberg <lars.ellenberg(a)linbit.com>
drbd: reject attach of unsuitable uuids even if connected
Lars Ellenberg <lars.ellenberg(a)linbit.com>
drbd: ignore "all zero" peer volume sizes in handshake
Alexey Kardashevskiy <aik(a)ozlabs.ru>
powerpc/powernv/eeh/npu: Fix uninitialized variables in opal_pci_eeh_freeze_status
Alexey Kardashevskiy <aik(a)ozlabs.ru>
vfio/spapr_tce: Get rid of possible infinite loop
Benjamin Herrenschmidt <benh(a)kernel.crashing.org>
powerpc/44x/bamboo: Fix PCI range
Christophe Leroy <christophe.leroy(a)c-s.fr>
powerpc/mm: Make NULL pointer deferences explicit on bad page faults.
Christophe Leroy <christophe.leroy(a)c-s.fr>
powerpc/prom: fix early DEBUG messages
Kyle Roeschley <kyle.roeschley(a)ni.com>
ath6kl: Fix off by one error in scan completion
Kyle Roeschley <kyle.roeschley(a)ni.com>
ath6kl: Only use match sets when firmware supports it
Varun Prakash <varun(a)chelsio.com>
scsi: csiostor: fix incorrect dma device in case of vport
Anatoliy Glagolev <glagolig(a)gmail.com>
scsi: qla2xxx: deadlock by configfs_depend_item
Bart Van Assche <bvanassche(a)acm.org>
RDMA/srp: Propagate ib_post_send() failures to the SCSI mid-layer
Geert Uytterhoeven <geert(a)linux-m68k.org>
openrisc: Fix broken paths to arch/or32
Alexander Shiyan <shc_work(a)mail.ru>
serial: max310x: Fix tx_empty() callback
Kangjie Lu <kjlu(a)umn.edu>
drivers/regulator: fix a missing check of return value
Christophe Leroy <christophe.leroy(a)c-s.fr>
powerpc/xmon: fix dump_segments()
Christophe Leroy <christophe.leroy(a)c-s.fr>
powerpc/book3s/32: fix number of bats in p/v_block_mapped()
Dan Carpenter <dan.carpenter(a)oracle.com>
IB/qib: Fix an error code in qib_sdma_verbs_send()
Nick Bowler <nbowler(a)draconx.ca>
xfs: Fix bulkstat compat ioctls on x32 userspace.
Nick Bowler <nbowler(a)draconx.ca>
xfs: Align compat attrlist_by_handle with native implementation.
Bob Peterson <rpeterso(a)redhat.com>
gfs2: take jdata unstuff into account in do_grow
Sweet Tea <sweettea(a)redhat.com>
dm flakey: Properly corrupt multi-page bios.
Peter Hutterer <peter.hutterer(a)who-t.net>
HID: doc: fix wrong data structure reference for UHID_OUTPUT
Geert Uytterhoeven <geert+renesas(a)glider.be>
pinctrl: sh-pfc: sh7734: Fix shifted values in IPSR10
Geert Uytterhoeven <geert+renesas(a)glider.be>
pinctrl: sh-pfc: sh7264: Fix PFCR3 and PFCR0 register configuration
Michael Mueller <mimu(a)linux.ibm.com>
KVM: s390: unregister debug feature on failing arch init
Leon Romanovsky <leonro(a)mellanox.com>
net/mlx5: Continue driver initialization despite debugfs failure
Martin Schiller <ms(a)dev.tdt.de>
pinctrl: xway: fix gpio-hog related boot issues
Ross Lagerwall <ross.lagerwall(a)citrix.com>
xen/pciback: Check dev_data before using it
Pan Bian <bianpan2016(a)163.com>
HID: intel-ish-hid: fixes incorrect error handling
Josef Bacik <jbacik(a)fb.com>
btrfs: only track ref_heads in delayed_ref_updates
Boris Brezillon <boris.brezillon(a)bootlin.com>
mtd: rawnand: sunxi: Write pageprog related opcodes to WCMD_SET
Lepton Wu <ytht.net(a)gmail.com>
VSOCK: bind to random port for VMADDR_PORT_ANY
Krzysztof Kozlowski <krzk(a)kernel.org>
gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIB
Masahiro Yamada <yamada.masahiro(a)socionext.com>
microblaze: move "... is ready" messages to arch/microblaze/Makefile
Masahiro Yamada <yamada.masahiro(a)socionext.com>
microblaze: adjust the help to the real behavior
Pan Bian <bianpan2016(a)163.com>
ubi: Do not drop UBI device reference before using
Pan Bian <bianpan2016(a)163.com>
ubi: Put MTD device after it is not used
Darrick J. Wong <darrick.wong(a)oracle.com>
xfs: require both realtime inodes to mount
Pan Bian <bianpan2016(a)163.com>
rtl818x: fix potential use after free
Brian Norris <briannorris(a)chromium.org>
mwifiex: debugfs: correct histogram spacing, formatting
Pan Bian <bianpan2016(a)163.com>
mwifiex: fix potential NULL dereference and use after free
Eric Biggers <ebiggers(a)google.com>
crypto: user - support incremental algorithm dumps
Hans de Goede <hdegoede(a)redhat.com>
ACPI / LPSS: Ignore acpi_device_fix_up_power() return value
Arnd Bergmann <arnd(a)arndb.de>
ARM: ks8695: fix section mismatch warning
Thomas Meyer <thomas(a)m3y3r.de>
PM / AVS: SmartReflex: NULL check before some freeing functions is not needed
Suzuki K Poulose <Suzuki.Poulose(a)arm.com>
arm64: smp: Handle errors reported by the firmware
Steve Capper <steve.capper(a)arm.com>
arm64: mm: Prevent mismatched 52-bit VA support
Helge Deller <deller(a)gmx.de>
parisc: Fix HP SDC hpa address output
Helge Deller <deller(a)gmx.de>
parisc: Fix serio address output
Fabio Estevam <festevam(a)gmail.com>
ARM: dts: imx53-voipac-dmm-668: Fix memory node duplication
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
ARM: debug-imx: only define DEBUG_IMX_UART_PORT if needed
James Smart <jsmart2021(a)gmail.com>
scsi: lpfc: Fix dif and first burst use in write commands
Uwe Kleine-König <u.kleine-koenig(a)pengutronix.de>
pwm: bcm-iproc: Prevent unloading the driver module while in use
Dan Carpenter <dan.carpenter(a)oracle.com>
block: drbd: remove a stray unlock in __drbd_send_protocol()
Ahmed Zaki <anzaki(a)gmail.com>
mac80211: fix station inactive_time shortly after boot
Ilya Leoshkevich <iii(a)linux.ibm.com>
scripts/gdb: fix debugging modules compiled with hot/cold partitioning
Xingyu Chen <xingyu.chen(a)amlogic.com>
watchdog: meson: Fix the wrong value of left time
Jeroen Hofstee <jhofstee(a)victronenergy.com>
can: c_can: D_CAN: c_can_chip_config(): perform a sofware reset on open
Jeroen Hofstee <jhofstee(a)victronenergy.com>
can: peak_usb: report bus recovery as well
Chuhong Yuan <hslester96(a)gmail.com>
net: fec: add missed clk_disable_unprepare in remove
Alexandre Belloni <alexandre.belloni(a)bootlin.com>
clk: at91: avoid sleeping early
Randy Dunlap <rdunlap(a)infradead.org>
reset: fix reset_control_ops kerneldoc comment
Marek Szyprowski <m.szyprowski(a)samsung.com>
clk: samsung: exynos5420: Preserve PLL configuration during suspend/resume
Russell King <rmk+kernel(a)armlinux.org.uk>
ASoC: kirkwood: fix external clock probe defer
Xiaojun Sang <xsang(a)codeaurora.org>
ASoC: compress: fix unsigned integer overflow check
-------------
Diffstat:
Documentation/hid/uhid.txt | 2 +-
Makefile | 4 +-
arch/arm/Kconfig.debug | 28 ++++++------
arch/arm/boot/dts/imx53-voipac-dmm-668.dtsi | 8 +---
arch/arm/mach-ks8695/board-acs5k.c | 2 +-
arch/arm64/kernel/head.S | 26 +++++++++++
arch/arm64/kernel/smp.c | 6 +++
arch/microblaze/Makefile | 12 ++---
arch/microblaze/boot/Makefile | 4 --
arch/openrisc/kernel/entry.S | 2 +-
arch/openrisc/kernel/head.S | 2 +-
arch/powerpc/boot/dts/bamboo.dts | 4 +-
arch/powerpc/include/asm/cputable.h | 1 +
arch/powerpc/include/asm/reg.h | 2 +
arch/powerpc/kernel/cputable.c | 10 +++--
arch/powerpc/kernel/prom.c | 6 +--
arch/powerpc/mm/fault.c | 17 +++----
arch/powerpc/mm/ppc_mmu_32.c | 4 +-
arch/powerpc/platforms/83xx/misc.c | 17 +++++++
arch/powerpc/platforms/powernv/eeh-powernv.c | 8 ++--
arch/powerpc/platforms/powernv/pci-ioda.c | 4 +-
arch/powerpc/platforms/powernv/pci.c | 4 +-
arch/powerpc/platforms/pseries/dlpar.c | 4 ++
arch/powerpc/platforms/pseries/hotplug-memory.c | 1 +
arch/powerpc/xmon/xmon.c | 2 +-
arch/s390/kvm/kvm-s390.c | 17 +++++--
arch/s390/mm/gup.c | 9 ++--
arch/um/Kconfig.debug | 1 +
arch/x86/mm/gup.c | 10 ++++-
crypto/crypto_user.c | 37 ++++++++-------
drivers/acpi/acpi_lpss.c | 7 +--
drivers/acpi/apei/ghes.c | 30 ++++++-------
drivers/base/platform.c | 3 ++
drivers/block/drbd/drbd_main.c | 1 -
drivers/block/drbd/drbd_nl.c | 43 +++++++++++++-----
drivers/block/drbd/drbd_receiver.c | 52 ++++++++++++++++++++--
drivers/block/drbd/drbd_state.h | 2 +-
drivers/char/hw_random/stm32-rng.c | 8 ++++
drivers/clk/at91/clk-main.c | 7 ++-
drivers/clk/at91/sckc.c | 20 +++++++--
drivers/clk/samsung/clk-exynos5420.c | 6 +++
drivers/crypto/mxc-scc.c | 12 ++---
drivers/hid/hid-core.c | 51 ++++++++++++++++++---
drivers/hid/intel-ish-hid/ishtp-hid.c | 2 +-
drivers/infiniband/hw/qib/qib_sdma.c | 4 +-
drivers/infiniband/ulp/srp/ib_srp.c | 1 +
drivers/input/serio/gscps2.c | 4 +-
drivers/input/serio/hp_sdc.c | 4 +-
drivers/iommu/amd_iommu.c | 8 +++-
drivers/md/dm-flakey.c | 33 +++++++++-----
drivers/media/platform/atmel/atmel-isc.c | 8 +++-
drivers/media/v4l2-core/v4l2-ctrls.c | 1 +
drivers/misc/mei/bus.c | 9 ++--
drivers/mtd/mtdcore.h | 2 +-
drivers/mtd/mtdpart.c | 35 ++++++++++++---
drivers/mtd/nand/sunxi_nand.c | 2 +-
drivers/mtd/ubi/build.c | 2 +-
drivers/mtd/ubi/kapi.c | 2 +-
drivers/net/can/c_can/c_can.c | 26 +++++++++++
drivers/net/can/usb/peak_usb/pcan_usb.c | 15 ++++---
drivers/net/dsa/bcm_sf2.c | 7 ++-
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 4 +-
drivers/net/ethernet/cadence/macb.c | 14 +++---
drivers/net/ethernet/freescale/fec_main.c | 13 +++++-
drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 ++--
drivers/net/ethernet/sfc/ef10.c | 29 ++++++++----
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 4 +-
drivers/net/macvlan.c | 3 +-
drivers/net/slip/slip.c | 1 +
drivers/net/wan/fsl_ucc_hdlc.c | 1 -
drivers/net/wireless/ath/ath6kl/cfg80211.c | 4 +-
drivers/net/wireless/marvell/mwifiex/debugfs.c | 14 +++---
drivers/net/wireless/marvell/mwifiex/scan.c | 18 ++++----
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c | 3 +-
drivers/pinctrl/pinctrl-xway.c | 39 +++++++++++-----
drivers/pinctrl/sh-pfc/pfc-sh7264.c | 9 +++-
drivers/pinctrl/sh-pfc/pfc-sh7734.c | 16 +++----
drivers/platform/x86/hp-wmi.c | 6 +--
drivers/power/avs/smartreflex.c | 3 +-
drivers/pwm/core.c | 1 +
drivers/pwm/pwm-bcm-iproc.c | 1 +
drivers/pwm/pwm-berlin.c | 1 -
drivers/pwm/pwm-clps711x.c | 4 +-
drivers/pwm/pwm-samsung.c | 1 -
drivers/regulator/palmas-regulator.c | 5 ++-
drivers/regulator/tps65910-regulator.c | 4 +-
drivers/scsi/csiostor/csio_init.c | 2 +-
drivers/scsi/libsas/sas_expander.c | 29 +++++++++++-
drivers/scsi/lpfc/lpfc_scsi.c | 18 ++++++++
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 48 ++++----------------
drivers/scsi/qla2xxx/tcm_qla2xxx.h | 3 --
drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 ++-
drivers/tty/serial/max310x.c | 7 +--
drivers/usb/serial/ftdi_sio.c | 3 ++
drivers/usb/serial/ftdi_sio_ids.h | 7 +++
drivers/vfio/vfio_iommu_spapr_tce.c | 10 ++---
drivers/watchdog/meson_gxbb_wdt.c | 4 +-
drivers/xen/xen-pciback/pci_stub.c | 3 +-
fs/btrfs/delayed-ref.c | 3 --
fs/gfs2/bmap.c | 2 +
fs/ocfs2/journal.c | 6 +--
fs/xfs/xfs_ioctl32.c | 40 +++++++++++++++--
fs/xfs/xfs_rtalloc.c | 4 +-
include/linux/genalloc.h | 13 +++---
include/linux/gpio/consumer.h | 2 +-
include/linux/netdevice.h | 2 +-
include/linux/reset-controller.h | 2 +-
include/linux/swap.h | 6 ---
include/net/sctp/structs.h | 3 ++
include/net/sock.h | 2 +-
lib/genalloc.c | 25 ++++++-----
mm/internal.h | 10 +++++
net/core/neighbour.c | 13 ++++--
net/core/net_namespace.c | 3 +-
net/core/sock.c | 2 +-
net/decnet/dn_dev.c | 2 +-
net/ipv4/ip_tunnel.c | 8 +++-
net/mac80211/sta_info.c | 3 +-
net/openvswitch/datapath.c | 17 +++++--
net/sched/sch_mq.c | 3 +-
net/sched/sch_mqprio.c | 4 +-
net/sched/sch_multiq.c | 2 +-
net/sched/sch_prio.c | 2 +-
net/sctp/associola.c | 1 +
net/sctp/endpointola.c | 1 +
net/sctp/input.c | 4 +-
net/sctp/transport.c | 3 +-
net/tipc/link.c | 2 +-
net/tipc/netlink_compat.c | 8 +++-
net/vmw_vsock/af_vsock.c | 7 ++-
scripts/gdb/linux/symbols.py | 3 +-
sound/core/compress_offload.c | 2 +-
sound/soc/kirkwood/kirkwood-i2s.c | 8 ++--
133 files changed, 829 insertions(+), 395 deletions(-)
The comment in kvm_get_shadow_phys_bits refers to MKTME, but the same is actually
true of SME and SEV. Just use CPUID[0x8000_0008].EAX[7:0] unconditionally if
available, it is simplest and works even if memory is not encrypted.
Cc: stable(a)vger.kernel.org
Reported-by: Tom Lendacky <thomas.lendacky(a)amd.com>
Signed-off-by: Paolo Bonzini <pbonzini(a)redhat.com>
---
arch/x86/kvm/mmu/mmu.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 6f92b40d798c..1e4ee4f8de5f 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -538,16 +538,20 @@ void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
static u8 kvm_get_shadow_phys_bits(void)
{
/*
- * boot_cpu_data.x86_phys_bits is reduced when MKTME is detected
- * in CPU detection code, but MKTME treats those reduced bits as
- * 'keyID' thus they are not reserved bits. Therefore for MKTME
- * we should still return physical address bits reported by CPUID.
+ * boot_cpu_data.x86_phys_bits is reduced when MKTME or SME are detected
+ * in CPU detection code, but the processor treats those reduced bits as
+ * 'keyID' thus they are not reserved bits. Therefore KVM needs to look at
+ * the physical address bits reported by CPUID.
*/
- if (!boot_cpu_has(X86_FEATURE_TME) ||
- WARN_ON_ONCE(boot_cpu_data.extended_cpuid_level < 0x80000008))
- return boot_cpu_data.x86_phys_bits;
+ if (likely(boot_cpu_data.extended_cpuid_level >= 0x80000008))
+ return cpuid_eax(0x80000008) & 0xff;
- return cpuid_eax(0x80000008) & 0xff;
+ /*
+ * Quite weird to have VMX or SVM but not MAXPHYADDR; probably a VM with
+ * custom CPUID. Proceed with whatever the kernel found since these features
+ * aren't virtualizable (SME/SEV also require CPUIDs higher than 0x80000008).
+ */
+ return boot_cpu_data.x86_phys_bits;
}
static void kvm_mmu_reset_all_pte_masks(void)
--
1.8.3.1