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 1402d17dfd9657be0da8458b2079d03c2d61c86a Mon Sep 17 00:00:00 2001
From: Xiyu Yang <xiyuyang19(a)fudan.edu.cn>
Date: Mon, 20 Apr 2020 13:39:39 +0800
Subject: [PATCH] btrfs: fix transaction leak in btrfs_recover_relocation
btrfs_recover_relocation() invokes btrfs_join_transaction(), which joins
a btrfs_trans_handle object into transactions and returns a reference of
it with increased refcount to "trans".
When btrfs_recover_relocation() returns, "trans" becomes invalid, so the
refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of
btrfs_recover_relocation(). When read_fs_root() failed, the refcnt
increased by btrfs_join_transaction() is not decreased, causing a refcnt
leak.
Fix this issue by calling btrfs_end_transaction() on this error path
when read_fs_root() failed.
Fixes: 79787eaab461 ("btrfs: replace many BUG_ONs with proper error handling")
CC: stable(a)vger.kernel.org # 4.4+
Reviewed-by: Filipe Manana <fdmanana(a)suse.com>
Signed-off-by: Xiyu Yang <xiyuyang19(a)fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf(a)gmail.com>
Signed-off-by: David Sterba <dsterba(a)suse.com>
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index d35936c934ab..03bc7134e8cb 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4559,6 +4559,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
if (IS_ERR(fs_root)) {
err = PTR_ERR(fs_root);
list_add_tail(&reloc_root->root_list, &reloc_roots);
+ btrfs_end_transaction(trans);
goto out_unset;
}
The patch below does not apply to the 4.4-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 85e9b88af1e6164f19ec71381efd5e2bcfc17620 Mon Sep 17 00:00:00 2001
From: Vasily Averin <vvs(a)virtuozzo.com>
Date: Mon, 27 Apr 2020 08:32:46 +0300
Subject: [PATCH] drm/qxl: qxl_release leak in qxl_draw_dirty_fb()
ret should be changed to release allocated struct qxl_release
Cc: stable(a)vger.kernel.org
Fixes: 8002db6336dd ("qxl: convert qxl driver to proper use for reservations")
Signed-off-by: Vasily Averin <vvs(a)virtuozzo.com>
Link: http://patchwork.freedesktop.org/patch/msgid/22cfd55f-07c8-95d0-a2f7-191b71…
Signed-off-by: Gerd Hoffmann <kraxel(a)redhat.com>
diff --git a/drivers/gpu/drm/qxl/qxl_draw.c b/drivers/gpu/drm/qxl/qxl_draw.c
index 5bebf1ea1c5d..f8776d60d08e 100644
--- a/drivers/gpu/drm/qxl/qxl_draw.c
+++ b/drivers/gpu/drm/qxl/qxl_draw.c
@@ -209,9 +209,10 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev,
goto out_release_backoff;
rects = drawable_set_clipping(qdev, num_clips, clips_bo);
- if (!rects)
+ if (!rects) {
+ ret = -EINVAL;
goto out_release_backoff;
-
+ }
drawable = (struct qxl_drawable *)qxl_release_map(qdev, release);
drawable->clip.type = SPICE_CLIP_TYPE_RECTS;
Avi Kivity reports that on fuse filesystems running in a user namespace
asyncronous fsync fails with EOVERFLOW.
The reason is that f_ops->fsync() is called with the creds of the kthread
performing aio work instead of the creds of the process originally
submitting IOCB_CMD_FSYNC.
Fuse sends the creds of the caller in the request header and it needs to
translate the uid and gid into the server's user namespace. Since the
kthread is running in init_user_ns, the translation will fail and the
operation returns an error.
It can be argued that fsync doesn't actually need any creds, but just
zeroing out those fields in the header (as with requests that currently
don't take creds) is a backward compatibility risk.
Instead of working around this issue in fuse, solve the core of the problem
by calling the filesystem with the proper creds.
Reported-by: Avi Kivity <avi(a)scylladb.com>
Tested-by: Giuseppe Scrivano <gscrivan(a)redhat.com>
Fixes: c9582eb0ff7d ("fuse: Fail all requests with invalid uids or gids")
Cc: stable(a)vger.kernel.org # 4.18+
Signed-off-by: Miklos Szeredi <mszeredi(a)redhat.com>
---
fs/aio.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/aio.c b/fs/aio.c
index 0d9a559d488c..37828773e2fe 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -176,6 +176,7 @@ struct fsync_iocb {
struct file *file;
struct work_struct work;
bool datasync;
+ struct cred *creds;
};
struct poll_iocb {
@@ -1589,8 +1590,11 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb,
static void aio_fsync_work(struct work_struct *work)
{
struct aio_kiocb *iocb = container_of(work, struct aio_kiocb, fsync.work);
+ const struct cred *old_cred = override_creds(iocb->fsync.creds);
iocb->ki_res.res = vfs_fsync(iocb->fsync.file, iocb->fsync.datasync);
+ revert_creds(old_cred);
+ put_cred(iocb->fsync.creds);
iocb_put(iocb);
}
@@ -1604,6 +1608,10 @@ static int aio_fsync(struct fsync_iocb *req, const struct iocb *iocb,
if (unlikely(!req->file->f_op->fsync))
return -EINVAL;
+ req->creds = prepare_creds();
+ if (!req->creds)
+ return -ENOMEM;
+
req->datasync = datasync;
INIT_WORK(&req->work, aio_fsync_work);
schedule_work(&req->work);
--
2.21.0
See
https://bugzilla.kernel.org/show_bug.cgi?id=207561
and the fix seems to be to back-port commit 8623b5255ae7
("drm/scheduler: fix drm_sched_get_cleanup_job").
I think Artem will (has?) make a report too, but I thought I'd just
mention it to make sure since I was on the bugzilla.
Linus
This is the start of the stable review cycle for the 4.19.120 release.
There are 47 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 Mon, 04 May 2020 06:40:34 +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.19.120-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.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.19.120-rc2
Al Viro <viro(a)zeniv.linux.org.uk>
propagate_one(): mnt_set_mountpoint() needs mount_lock
Ritesh Harjani <riteshh(a)linux.ibm.com>
ext4: check for non-zero journal inum in ext4_calculate_overhead
Yuval Basson <ybason(a)marvell.com>
qed: Fix use after free in qed_chain_free
Luke Nelson <lukenels(a)cs.washington.edu>
bpf, x86_32: Fix clobbering of dst for BPF_JSET
Sascha Hauer <s.hauer(a)pengutronix.de>
hwmon: (jc42) Fix name to have no illegal characters
Theodore Ts'o <tytso(a)mit.edu>
ext4: convert BUG_ON's to WARN_ON's in mballoc.c
Theodore Ts'o <tytso(a)mit.edu>
ext4: increase wait time needed before reuse of deleted inode numbers
yangerkun <yangerkun(a)huawei.com>
ext4: use matching invalidatepage in ext4_writepage
Fangrui Song <maskray(a)google.com>
arm64: Delete the space separator in __emit_inst
Hui Wang <hui.wang(a)canonical.com>
ALSA: hda: call runtime_allow() for all hda controllers
Juergen Gross <jgross(a)suse.com>
xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status
Josh Poimboeuf <jpoimboe(a)redhat.com>
objtool: Support Clang non-section symbols in ORC dump
Josh Poimboeuf <jpoimboe(a)redhat.com>
objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings
Bodo Stroesser <bstroesser(a)ts.fujitsu.com>
scsi: target: tcmu: reset_ring should reset TCMU_DEV_BIT_BROKEN
Bodo Stroesser <bstroesser(a)ts.fujitsu.com>
scsi: target: fix PR IN / READ FULL STATUS for FC
Roy Spliet <nouveau(a)spliet.org>
ALSA: hda: Explicitly permit using autosuspend if runtime PM is supported
Takashi Iwai <tiwai(a)suse.de>
ALSA: hda: Keep the controller initialization even if no codecs found
Darrick J. Wong <darrick.wong(a)oracle.com>
xfs: fix partially uninitialized structure in xfs_reflink_remap_extent
Olaf Hering <olaf(a)aepfle.de>
x86: hyperv: report value of misc_features
Martin Fuzzey <martin.fuzzey(a)flowbird.group>
net: fec: set GPR bit on suspend by DT configuration.
Luke Nelson <lukenels(a)cs.washington.edu>
bpf, x86: Fix encoding for lower 8-bit registers in BPF_STX BPF_B
Eric Biggers <ebiggers(a)google.com>
xfs: clear PF_MEMALLOC before exiting xfsaild thread
Yang Shi <yang.shi(a)linux.alibaba.com>
mm: shmem: disable interrupt when acquiring info->lock in userfaultfd_copy path
Luke Nelson <lukenels(a)cs.washington.edu>
bpf, x86_32: Fix incorrect encoding in BPF_LDX zero-extension
Ian Rogers <irogers(a)google.com>
perf/core: fix parent pid/tid in task exit events
Niklas Schnelle <schnelle(a)linux.ibm.com>
net/mlx5: Fix failing fw tracer allocation on s390
Toke Høiland-Jørgensen <toke(a)redhat.com>
cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled
Nicolas Saenz Julienne <nsaenzjulienne(a)suse.de>
ARM: dts: bcm283x: Disable dsi0 node
Bjorn Helgaas <bhelgaas(a)google.com>
PCI: Move Apex Edge TPU class quirk to fix BAR assignment
Kai-Heng Feng <kai.heng.feng(a)canonical.com>
PCI: Avoid ASMedia XHCI USB PME# from D0 defect
Chuck Lever <chuck.lever(a)oracle.com>
svcrdma: Fix leak of svc_rdma_recv_ctxt objects
Chuck Lever <chuck.lever(a)oracle.com>
svcrdma: Fix trace point use-after-free race
Brian Foster <bfoster(a)redhat.com>
xfs: acquire superblock freeze protection on eofblocks scans
Jason Gunthorpe <jgg(a)ziepe.ca>
net/cxgb4: Check the return from t4_query_params properly
David Howells <dhowells(a)redhat.com>
rxrpc: Fix DATA Tx to disable nofrag for UDP on AF_INET6 socket
Wolfram Sang <wsa+renesas(a)sang-engineering.com>
i2c: altera: use proper variable to hold errno
Vasily Averin <vvs(a)virtuozzo.com>
nfsd: memory corruption in nfsd4_lock()
Shengjiu Wang <shengjiu.wang(a)nxp.com>
ASoC: wm8960: Fix wrong clock after suspend & resume
Philipp Puschmann <p.puschmann(a)pironex.de>
ASoC: tas571x: disable regulators on failed probe
Stephan Gerhold <stephan(a)gerhold.net>
ASoC: q6dsp6: q6afe-dai: add missing channels to MI2S DAIs
YueHaibing <yuehaibing(a)huawei.com>
iio:ad7797: Use correct attribute_group
Nathan Chancellor <natechancellor(a)gmail.com>
usb: gadget: udc: bdc: Remove unnecessary NULL checks in bdc_req_complete
Thinh Nguyen <Thinh.Nguyen(a)synopsys.com>
usb: dwc3: gadget: Do link recovery for SS and SSP
Tyler Hicks <tyhicks(a)canonical.com>
binder: take read mode of mmap_sem in binder_alloc_free_page()
Christian Borntraeger <borntraeger(a)de.ibm.com>
include/uapi/linux/swab.h: fix userspace breakage, use __BITS_PER_LONG for swap
Liu Jian <liujian56(a)huawei.com>
mtd: cfi: fix deadloop in cfi_cmdset_0002.c do_write_buffer
Clement Leger <cleger(a)kalray.eu>
remoteproc: Fix wrong rvring index computation
-------------
Diffstat:
Makefile | 4 +-
arch/arm/boot/dts/bcm283x.dtsi | 1 +
arch/arm64/include/asm/sysreg.h | 4 +-
arch/x86/kernel/cpu/mshyperv.c | 4 +-
arch/x86/net/bpf_jit_comp.c | 18 ++-
arch/x86/net/bpf_jit_comp32.c | 24 +++-
drivers/android/binder_alloc.c | 8 +-
drivers/hwmon/jc42.c | 2 +-
drivers/i2c/busses/i2c-altera.c | 9 +-
drivers/iio/adc/ad7793.c | 2 +-
drivers/mtd/chips/cfi_cmdset_0002.c | 6 +-
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +-
drivers/net/ethernet/freescale/fec.h | 7 +
drivers/net/ethernet/freescale/fec_main.c | 149 +++++++++++++++++----
.../ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 6 +-
drivers/net/ethernet/qlogic/qed/qed_dev.c | 38 +++---
drivers/pci/quirks.c | 18 +++
drivers/remoteproc/remoteproc_core.c | 2 +-
drivers/staging/gasket/apex_driver.c | 7 -
drivers/target/target_core_fabric_lib.c | 2 +-
drivers/target/target_core_user.c | 1 +
drivers/usb/dwc3/gadget.c | 8 +-
drivers/usb/gadget/udc/bdc/bdc_ep.c | 2 +-
drivers/xen/xenbus/xenbus_client.c | 9 +-
fs/ext4/ialloc.c | 2 +-
fs/ext4/inode.c | 2 +-
fs/ext4/mballoc.c | 6 +-
fs/ext4/super.c | 3 +-
fs/nfsd/nfs4state.c | 2 +
fs/pnode.c | 9 +-
fs/xfs/xfs_icache.c | 10 ++
fs/xfs/xfs_ioctl.c | 5 +-
fs/xfs/xfs_reflink.c | 1 +
fs/xfs/xfs_trans_ail.c | 4 +-
include/linux/qed/qed_chain.h | 24 ++--
include/linux/sunrpc/svc_rdma.h | 1 +
include/trace/events/rpcrdma.h | 50 +++++--
include/uapi/linux/swab.h | 4 +-
kernel/bpf/cpumap.c | 2 +-
kernel/events/core.c | 13 +-
mm/shmem.c | 4 +-
net/rxrpc/local_object.c | 9 --
net/rxrpc/output.c | 44 ++----
net/sunrpc/svc_xprt.c | 3 -
net/sunrpc/svcsock.c | 4 +
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 22 +++
net/sunrpc/xprtrdma/svc_rdma_rw.c | 3 +-
net/sunrpc/xprtrdma/svc_rdma_sendto.c | 29 ++--
net/sunrpc/xprtrdma/svc_rdma_transport.c | 5 -
sound/pci/hda/hda_intel.c | 17 ++-
sound/soc/codecs/tas571x.c | 20 ++-
sound/soc/codecs/wm8960.c | 3 +-
sound/soc/qcom/qdsp6/q6afe-dai.c | 16 +++
tools/objtool/check.c | 17 ++-
tools/objtool/orc_dump.c | 44 +++---
55 files changed, 471 insertions(+), 240 deletions(-)
We recorded the dependencies for WAIT_FOR_SUBMIT in order that we could
correctly perform priority inheritance from the parallel branches to the
common trunk. However, for the purpose of timeslicing and reset
handling, the dependency is weak -- as we the pair of requests are
allowed to run in parallel and not in strict succession. So for example
we do need to suspend one if the other hangs.
The real significance though is that this allows us to rearrange
groups of WAIT_FOR_SUBMIT linked requests along the single engine, and
so can resolve user level inter-batch scheduling dependencies from user
semaphores.
Fixes: c81471f5e95c ("drm/i915: Copy across scheduler behaviour flags across submit fences")
Signed-off-by: Chris Wilson <chris(a)chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin(a)intel.com>
Cc: <stable(a)vger.kernel.org> # v5.6+
---
drivers/gpu/drm/i915/gt/intel_lrc.c | 9 +++++++++
drivers/gpu/drm/i915/i915_request.c | 8 ++++++--
drivers/gpu/drm/i915/i915_scheduler.c | 4 +++-
drivers/gpu/drm/i915/i915_scheduler.h | 3 ++-
drivers/gpu/drm/i915/i915_scheduler_types.h | 1 +
5 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index c00366387b54..508661cf61d9 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -1883,6 +1883,9 @@ static void defer_request(struct i915_request *rq, struct list_head * const pl)
struct i915_request *w =
container_of(p->waiter, typeof(*w), sched);
+ if (p->flags & I915_DEPENDENCY_WEAK)
+ continue;
+
/* Leave semaphores spinning on the other engines */
if (w->engine != rq->engine)
continue;
@@ -2729,6 +2732,9 @@ static void __execlists_hold(struct i915_request *rq)
struct i915_request *w =
container_of(p->waiter, typeof(*w), sched);
+ if (p->flags & I915_DEPENDENCY_WEAK)
+ continue;
+
/* Leave semaphores spinning on the other engines */
if (w->engine != rq->engine)
continue;
@@ -2853,6 +2859,9 @@ static void __execlists_unhold(struct i915_request *rq)
struct i915_request *w =
container_of(p->waiter, typeof(*w), sched);
+ if (p->flags & I915_DEPENDENCY_WEAK)
+ continue;
+
/* Propagate any change in error status */
if (rq->fence.error)
i915_request_set_error_once(w, rq->fence.error);
diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 22635bbabf06..95edc5523a01 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -1038,7 +1038,9 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from)
return 0;
if (to->engine->schedule) {
- ret = i915_sched_node_add_dependency(&to->sched, &from->sched);
+ ret = i915_sched_node_add_dependency(&to->sched,
+ &from->sched,
+ 0);
if (ret < 0)
return ret;
}
@@ -1200,7 +1202,9 @@ __i915_request_await_execution(struct i915_request *to,
/* Couple the dependency tree for PI on this exposed to->fence */
if (to->engine->schedule) {
- err = i915_sched_node_add_dependency(&to->sched, &from->sched);
+ err = i915_sched_node_add_dependency(&to->sched,
+ &from->sched,
+ I915_DEPENDENCY_WEAK);
if (err < 0)
return err;
}
diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c
index 37cfcf5b321b..5f4c1e49e974 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.c
+++ b/drivers/gpu/drm/i915/i915_scheduler.c
@@ -462,7 +462,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
}
int i915_sched_node_add_dependency(struct i915_sched_node *node,
- struct i915_sched_node *signal)
+ struct i915_sched_node *signal,
+ unsigned long flags)
{
struct i915_dependency *dep;
@@ -473,6 +474,7 @@ int i915_sched_node_add_dependency(struct i915_sched_node *node,
local_bh_disable();
if (!__i915_sched_node_add_dependency(node, signal, dep,
+ flags |
I915_DEPENDENCY_EXTERNAL |
I915_DEPENDENCY_ALLOC))
i915_dependency_free(dep);
diff --git a/drivers/gpu/drm/i915/i915_scheduler.h b/drivers/gpu/drm/i915/i915_scheduler.h
index d1dc4efef77b..6f0bf00fc569 100644
--- a/drivers/gpu/drm/i915/i915_scheduler.h
+++ b/drivers/gpu/drm/i915/i915_scheduler.h
@@ -34,7 +34,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
unsigned long flags);
int i915_sched_node_add_dependency(struct i915_sched_node *node,
- struct i915_sched_node *signal);
+ struct i915_sched_node *signal,
+ unsigned long flags);
void i915_sched_node_fini(struct i915_sched_node *node);
diff --git a/drivers/gpu/drm/i915/i915_scheduler_types.h b/drivers/gpu/drm/i915/i915_scheduler_types.h
index d18e70550054..7186875088a0 100644
--- a/drivers/gpu/drm/i915/i915_scheduler_types.h
+++ b/drivers/gpu/drm/i915/i915_scheduler_types.h
@@ -78,6 +78,7 @@ struct i915_dependency {
unsigned long flags;
#define I915_DEPENDENCY_ALLOC BIT(0)
#define I915_DEPENDENCY_EXTERNAL BIT(1)
+#define I915_DEPENDENCY_WEAK BIT(2)
};
#endif /* _I915_SCHEDULER_TYPES_H_ */
--
2.20.1