The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 1b3922a8bc74231f9a767d1be6d9a061a4d4eeab Mon Sep 17 00:00:00 2001
From: Qu Wenruo <wqu(a)suse.com>
Date: Tue, 8 Jan 2019 14:08:18 +0800
Subject: [PATCH] btrfs: Use real device structure to verify dev extent
[BUG]
Linux v5.0-rc1 will fail fstests/btrfs/163 with the following kernel
message:
BTRFS error (device dm-6): dev extent devid 1 physical offset 13631488 len 8388608 is beyond device boundary 0
BTRFS error (device dm-6): failed to verify dev extents against chunks: -117
BTRFS error (device dm-6): open_ctree failed
[CAUSE]
Commit cf90d884b347 ("btrfs: Introduce mount time chunk <-> dev extent
mapping check") introduced strict check on dev extents.
We use btrfs_find_device() with dev uuid and fs uuid set to NULL, and
only dependent on @devid to find the real device.
For seed devices, we call clone_fs_devices() in open_seed_devices() to
allow us search seed devices directly.
However clone_fs_devices() just populates devices with devid and dev
uuid, without populating other essential members, like disk_total_bytes.
This makes any device returned by btrfs_find_device(fs_info, devid,
NULL, NULL) is just a dummy, with 0 disk_total_bytes, and any dev
extents on the seed device will not pass the device boundary check.
[FIX]
This patch will try to verify the device returned by btrfs_find_device()
and if it's a dummy then re-search in seed devices.
Fixes: cf90d884b347 ("btrfs: Introduce mount time chunk <-> dev extent mapping check")
CC: stable(a)vger.kernel.org # 4.19+
Reported-by: Filipe Manana <fdmanana(a)suse.com>
Signed-off-by: Qu Wenruo <wqu(a)suse.com>
Signed-off-by: David Sterba <dsterba(a)suse.com>
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 2576b1a379c9..3e4f8f88353e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7825,6 +7825,18 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
ret = -EUCLEAN;
goto out;
}
+
+ /* It's possible this device is a dummy for seed device */
+ if (dev->disk_total_bytes == 0) {
+ dev = find_device(fs_info->fs_devices->seed, devid, NULL);
+ if (!dev) {
+ btrfs_err(fs_info, "failed to find seed devid %llu",
+ devid);
+ ret = -EUCLEAN;
+ goto out;
+ }
+ }
+
if (physical_offset + physical_len > dev->disk_total_bytes) {
btrfs_err(fs_info,
"dev extent devid %llu physical offset %llu len %llu is beyond device boundary %llu",
Commit e1c3743e1a20 ("powerpc/tm: Set MSR[TS] just prior to recheckpoint")
moved a code block around and this block uses a 'msr' variable outside of
the CONFIG_PPC_TRANSACTIONAL_MEM, however the 'msr' variable is declared
inside a CONFIG_PPC_TRANSACTIONAL_MEM block, causing a possible error when
CONFIG_PPC_TRANSACTION_MEM is not defined.
error: 'msr' undeclared (first use in this function)
This is not causing a compilation error in the mainline kernel, because
'msr' is being used as an argument of MSR_TM_ACTIVE(), which is defined as
the following when CONFIG_PPC_TRANSACTIONAL_MEM is *not* set:
#define MSR_TM_ACTIVE(x) 0
This patch just fixes this issue avoiding the 'msr' variable usage outside
the CONFIG_PPC_TRANSACTIONAL_MEM block, avoiding trusting in the
MSR_TM_ACTIVE() definition.
Cc: stable(a)vger.kernel.org
Reported-by: Christoph Biedl <linux-kernel.bfrz(a)manchmal.in-ulm.de>
Fixes: e1c3743e1a20 ("powerpc/tm: Set MSR[TS] just prior to recheckpoint")
Signed-off-by: Breno Leitao <leitao(a)debian.org>
---
NB: Since stable kernels didn't cherry picked 5c784c8414fba ('powerpc/tm:
Remove msr_tm_active()), MSR_TM_ACTIVE() is not defined as 0 for
CONFIG_PPC_TRANSACTIONAL_MEM=n case, thus triggering the compilation error
above.
Tested against stable kernel 4.19.13-rc2 and problem is now fixed when
CONFIG_PPC_TRANSACTIONAL_MEM=n
arch/powerpc/kernel/signal_64.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index daa28cb72272..8fe698162ab9 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -739,11 +739,12 @@ SYSCALL_DEFINE0(rt_sigreturn)
if (restore_tm_sigcontexts(current, &uc->uc_mcontext,
&uc_transact->uc_mcontext))
goto badframe;
- }
+ } else
#endif
- /* Fall through, for non-TM restore */
- if (!MSR_TM_ACTIVE(msr)) {
+ {
/*
+ * Fall through, for non-TM restore
+ *
* Unset MSR[TS] on the thread regs since MSR from user
* context does not have MSR active, and recheckpoint was
* not called since restore_tm_sigcontexts() was not called
--
2.19.0
The patch below does not apply to the 4.20-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 1b3922a8bc74231f9a767d1be6d9a061a4d4eeab Mon Sep 17 00:00:00 2001
From: Qu Wenruo <wqu(a)suse.com>
Date: Tue, 8 Jan 2019 14:08:18 +0800
Subject: [PATCH] btrfs: Use real device structure to verify dev extent
[BUG]
Linux v5.0-rc1 will fail fstests/btrfs/163 with the following kernel
message:
BTRFS error (device dm-6): dev extent devid 1 physical offset 13631488 len 8388608 is beyond device boundary 0
BTRFS error (device dm-6): failed to verify dev extents against chunks: -117
BTRFS error (device dm-6): open_ctree failed
[CAUSE]
Commit cf90d884b347 ("btrfs: Introduce mount time chunk <-> dev extent
mapping check") introduced strict check on dev extents.
We use btrfs_find_device() with dev uuid and fs uuid set to NULL, and
only dependent on @devid to find the real device.
For seed devices, we call clone_fs_devices() in open_seed_devices() to
allow us search seed devices directly.
However clone_fs_devices() just populates devices with devid and dev
uuid, without populating other essential members, like disk_total_bytes.
This makes any device returned by btrfs_find_device(fs_info, devid,
NULL, NULL) is just a dummy, with 0 disk_total_bytes, and any dev
extents on the seed device will not pass the device boundary check.
[FIX]
This patch will try to verify the device returned by btrfs_find_device()
and if it's a dummy then re-search in seed devices.
Fixes: cf90d884b347 ("btrfs: Introduce mount time chunk <-> dev extent mapping check")
CC: stable(a)vger.kernel.org # 4.19+
Reported-by: Filipe Manana <fdmanana(a)suse.com>
Signed-off-by: Qu Wenruo <wqu(a)suse.com>
Signed-off-by: David Sterba <dsterba(a)suse.com>
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 2576b1a379c9..3e4f8f88353e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7825,6 +7825,18 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
ret = -EUCLEAN;
goto out;
}
+
+ /* It's possible this device is a dummy for seed device */
+ if (dev->disk_total_bytes == 0) {
+ dev = find_device(fs_info->fs_devices->seed, devid, NULL);
+ if (!dev) {
+ btrfs_err(fs_info, "failed to find seed devid %llu",
+ devid);
+ ret = -EUCLEAN;
+ goto out;
+ }
+ }
+
if (physical_offset + physical_len > dev->disk_total_bytes) {
btrfs_err(fs_info,
"dev extent devid %llu physical offset %llu len %llu is beyond device boundary %llu",
This is the start of the stable review cycle for the 4.20.2 release.
There are 65 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 Sun Jan 13 13:10:14 UTC 2019.
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.20.2-rc1…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.20.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.20.2-rc1
Enric Balletbo i Serra <enric.balletbo(a)collabora.com>
drm/rockchip: psr: do not dereference encoder before it is null checked.
Boris Brezillon <boris.brezillon(a)bootlin.com>
drm/vc4: Set ->is_yuv to false when num_planes == 1
Lyude Paul <lyude(a)redhat.com>
drm/nouveau/drm/nouveau: Check rc from drm_dp_mst_topology_mgr_resume()
Christophe Leroy <christophe.leroy(a)c-s.fr>
lib: fix build failure in CONFIG_DEBUG_VIRTUAL test
Frank Rowand <frank.rowand(a)sony.com>
of: __of_detach_node() - remove node from phandle cache
Frank Rowand <frank.rowand(a)sony.com>
of: of_node_get()/of_node_put() nodes held in phandle cache
Lubomir Rintel <lkundrak(a)v3.sk>
power: supply: olpc_battery: correct the temperature units
Alexander Shishkin <alexander.shishkin(a)linux.intel.com>
intel_th: msu: Fix an off-by-one in attribute store
Christian Borntraeger <borntraeger(a)de.ibm.com>
genwqe: Fix size check
Shuah Khan <shuah(a)kernel.org>
selftests: Fix test errors related to lib.mk khdr target
Christian Lamparter <chunkeey(a)gmail.com>
powerpc/4xx/ocm: Fix compilation error due to PAGE_KERNEL usage
Shaokun Zhang <zhangshaokun(a)hisilicon.com>
drivers/perf: hisi: Fixup one DDRC PMU register offset
YueHaibing <yuehaibing(a)huawei.com>
video: fbdev: pxafb: Fix "WARNING: invalid free of devm_ allocated data"
Yan, Zheng <zyan(a)redhat.com>
ceph: don't update importing cap's mseq when handing cap export
Linus Torvalds <torvalds(a)linux-foundation.org>
sched/fair: Fix infinite loop in update_blocked_averages() by reverting a9e7f6544b9c
Sohil Mehta <sohil.mehta(a)intel.com>
iommu/vt-d: Handle domain agaw being less than iommu agaw
Steve Wise <swise(a)opengridcomputing.com>
RDMA/iwcm: Don't copy past the end of dev_name() string
Bart Van Assche <bvanassche(a)acm.org>
RDMA/srpt: Fix a use-after-free in the channel release code
Alexander Shishkin <alexander.shishkin(a)linux.intel.com>
stm class: Fix a module refcount leak in policy creation error path
Sagi Grimberg <sagi(a)grimberg.me>
rxe: fix error completion wr_id and qp_num
Dominique Martinet <dominique.martinet(a)cea.fr>
9p/net: put a lower bound on msize
Mircea Caprioru <mircea.caprioru(a)analog.com>
iio: dac: ad5686: fix bit shift read register
Evan Green <evgreen(a)chromium.org>
iio: adc: qcom-spmi-adc5: Initialize prescale properly
Breno Leitao <leitao(a)debian.org>
powerpc/tm: Set MSR[TS] just prior to recheckpoint
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Revert "powerpc/tm: Unset MSR[TS] if not recheckpointing"
J. Bruce Fields <bfields(a)redhat.com>
nfsd4: zero-length WRITE should succeed
Chuck Lever <chuck.lever(a)oracle.com>
xprtrdma: Yet another double DMA-unmap
Benjamin Coddington <bcodding(a)redhat.com>
lockd: Show pid of lockd for remote locks
Jarkko Nikula <jarkko.nikula(a)linux.intel.com>
PCI / PM: Allow runtime PM without callback functions
Ondrej Mosnacek <omosnace(a)redhat.com>
selinux: policydb - fix byte order and alignment issues
Larry Finger <Larry.Finger(a)lwfinger.net>
b43: Fix error in cordic routine
Andreas Gruenbacher <agruenba(a)redhat.com>
gfs2: Fix loop in gfs2_rbm_find
Andreas Gruenbacher <agruenba(a)redhat.com>
gfs2: Get rid of potential double-freeing in gfs2_create_inode
Vasily Averin <vvs(a)virtuozzo.com>
dlm: memory leaks on error path in dlm_user_request()
Vasily Averin <vvs(a)virtuozzo.com>
dlm: lost put_lkb on error path in receive_convert() and receive_unlock()
Vasily Averin <vvs(a)virtuozzo.com>
dlm: possible memory leak on error path in create_lkb()
Vasily Averin <vvs(a)virtuozzo.com>
dlm: fixed memory leaks after failed ls_remove_names allocation
Jaegeuk Kim <jaegeuk(a)kernel.org>
dm: do not allow readahead to limit IO size
Damien Le Moal <damien.lemoal(a)wdc.com>
block: mq-deadline: Fix write completion handling
Ming Lei <ming.lei(a)redhat.com>
block: deactivate blk_stat timer in wbt_disable_default()
Matthew Wilcox <willy(a)infradead.org>
Fix failure path in alloc_pid()
Rafael J. Wysocki <rafael.j.wysocki(a)intel.com>
driver core: Add missing dev->bus->need_parent_lock checks
Dennis Krein <Dennis.Krein(a)netapp.com>
srcu: Lock srcu_data structure in srcu_gp_start()
Takashi Iwai <tiwai(a)suse.de>
ALSA: usb-audio: Always check descriptor sizes in parser code
Hui Peng <benquike(a)163.com>
ALSA: usb-audio: Fix an out-of-bound read in create_composite_quirks
Takashi Iwai <tiwai(a)suse.de>
ALSA: usb-audio: Check mixer unit descriptors more strictly
Takashi Iwai <tiwai(a)suse.de>
ALSA: usb-audio: Avoid access before bLength check in build_audio_procunit()
Dan Carpenter <dan.carpenter(a)oracle.com>
ALSA: cs46xx: Potential NULL dereference in probe
Brad Love <brad(a)nextdimension.cc>
media: cx23885: only reset DMA on problematic CPUs
Huang Ying <ying.huang(a)intel.com>
mm, swap: fix swapoff with KSM pages
Dan Williams <dan.j.williams(a)intel.com>
mm, hmm: mark hmm_devmem_{add, add_resource} EXPORT_SYMBOL_GPL
Dan Williams <dan.j.williams(a)intel.com>
mm, hmm: replace hmm_devmem_pages_create() with devm_memremap_pages()
Dan Williams <dan.j.williams(a)intel.com>
mm, hmm: use devm semantics for hmm_devmem_{add, remove}
Dan Williams <dan.j.williams(a)intel.com>
mm, devm_memremap_pages: add MEMORY_DEVICE_PRIVATE support
Vasily Averin <vvs(a)virtuozzo.com>
sunrpc: use SVC_NET() in svcauth_gss_* functions
Vasily Averin <vvs(a)virtuozzo.com>
sunrpc: fix cache_head leak due to queued request
Michal Hocko <mhocko(a)suse.com>
memcg, oom: notify on oom killer invocation from the charge path
Dan Williams <dan.j.williams(a)intel.com>
mm, devm_memremap_pages: fix shutdown handling
Dan Williams <dan.j.williams(a)intel.com>
mm, devm_memremap_pages: kill mapping "System RAM" support
Dan Williams <dan.j.williams(a)intel.com>
mm, devm_memremap_pages: mark devm_memremap_pages() EXPORT_SYMBOL_GPL
Michal Hocko <mhocko(a)suse.com>
hwpoison, memory_hotplug: allow hwpoisoned pages to be offlined
Minchan Kim <minchan(a)kernel.org>
zram: fix double free backing device
David Herrmann <dh.herrmann(a)gmail.com>
fork: record start_time late
Ewan D. Milne <emilne(a)redhat.com>
scsi: lpfc: do not set queue->page_count to 0 if pc_sli4_params.wqpcnt is invalid
Steffen Maier <maier(a)linux.ibm.com>
scsi: zfcp: fix posting too many status read buffers leading to adapter shutdown
-------------
Diffstat:
Makefile | 4 +-
arch/powerpc/kernel/signal_32.c | 38 ++-
arch/powerpc/kernel/signal_64.c | 64 +++--
arch/powerpc/platforms/4xx/ocm.c | 4 +-
block/blk-mq-sched.c | 3 +-
block/blk-mq-sched.h | 1 +
block/blk-stat.h | 5 +
block/blk-wbt.c | 4 +-
block/mq-deadline.c | 12 +-
drivers/base/dd.c | 4 +-
drivers/block/zram/zram_drv.c | 4 +-
drivers/dax/pmem.c | 14 +-
drivers/gpu/drm/nouveau/dispnv50/disp.c | 12 +-
drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 4 +-
drivers/gpu/drm/vc4/vc4_plane.c | 1 +
drivers/hwtracing/intel_th/msu.c | 3 +-
drivers/hwtracing/stm/policy.c | 12 +-
drivers/iio/adc/qcom-spmi-adc5.c | 58 ++--
drivers/iio/dac/ad5686.c | 3 +-
drivers/infiniband/core/iwcm.c | 12 +-
drivers/infiniband/sw/rxe/rxe_resp.c | 13 +-
drivers/infiniband/ulp/srpt/ib_srpt.c | 18 +-
drivers/iommu/intel-iommu.c | 4 +-
drivers/md/dm-table.c | 3 +
drivers/media/pci/cx23885/cx23885-core.c | 55 +++-
drivers/media/pci/cx23885/cx23885.h | 2 +
drivers/misc/genwqe/card_utils.c | 2 +-
drivers/net/wireless/broadcom/b43/phy_common.c | 2 +-
drivers/nvdimm/pmem.c | 13 +-
drivers/of/base.c | 101 +++++--
drivers/of/dynamic.c | 3 +
drivers/of/of_private.h | 4 +
drivers/pci/p2pdma.c | 10 +-
drivers/pci/pci-driver.c | 27 +-
drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 4 +-
drivers/power/supply/olpc_battery.c | 4 +-
drivers/s390/scsi/zfcp_aux.c | 6 +-
drivers/scsi/lpfc/lpfc_sli.c | 3 +-
drivers/video/fbdev/pxafb.c | 4 +-
fs/ceph/caps.c | 1 -
fs/dlm/lock.c | 17 +-
fs/dlm/lockspace.c | 2 +-
fs/gfs2/inode.c | 18 +-
fs/gfs2/rgrp.c | 2 +-
fs/lockd/clntproc.c | 2 +-
fs/lockd/xdr.c | 4 +-
fs/lockd/xdr4.c | 4 +-
fs/nfsd/nfs4proc.c | 2 -
include/linux/hmm.h | 4 +-
include/linux/memremap.h | 2 +
kernel/fork.c | 13 +-
kernel/memremap.c | 94 ++++---
kernel/pid.c | 6 +-
kernel/rcu/srcutree.c | 2 +
kernel/sched/fair.c | 43 +--
lib/test_debug_virtual.c | 1 +
mm/hmm.c | 305 +++------------------
mm/memcontrol.c | 20 +-
mm/memory_hotplug.c | 16 ++
mm/swapfile.c | 3 +-
net/9p/client.c | 21 ++
net/sunrpc/auth_gss/svcauth_gss.c | 8 +-
net/sunrpc/cache.c | 10 +-
net/sunrpc/xprtrdma/frwr_ops.c | 6 +-
net/sunrpc/xprtrdma/verbs.c | 9 +-
security/selinux/ss/policydb.c | 51 +++-
sound/pci/cs46xx/dsp_spos.c | 3 +
sound/usb/card.c | 2 +-
sound/usb/mixer.c | 29 +-
sound/usb/quirks-table.h | 6 +
sound/usb/stream.c | 36 ++-
tools/testing/nvdimm/test/iomap.c | 17 +-
tools/testing/selftests/android/Makefile | 2 +-
tools/testing/selftests/futex/functional/Makefile | 1 +
tools/testing/selftests/gpio/Makefile | 6 +-
tools/testing/selftests/kvm/Makefile | 2 +-
tools/testing/selftests/lib.mk | 8 +-
.../selftests/networking/timestamping/Makefile | 1 +
tools/testing/selftests/tc-testing/bpf/Makefile | 1 +
tools/testing/selftests/vm/Makefile | 1 +
80 files changed, 710 insertions(+), 611 deletions(-)