linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.19 00/50] 4.19.177-rc1 review
@ 2021-02-22 12:12 Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 01/50] tracing: Do not count ftrace events in top level enable output Greg Kroah-Hartman
                   ` (54 more replies)
  0 siblings, 55 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah, patches,
	lkft-triage, pavel, jonathanh, stable

This is the start of the stable review cycle for the 4.19.177 release.
There are 50 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 Wed, 24 Feb 2021 12:07:46 +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.177-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.19.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.19.177-rc1

Lai Jiangshan <laijs@linux.alibaba.com>
    kvm: check tlbs_dirty directly

Arun Easi <aeasi@marvell.com>
    scsi: qla2xxx: Fix crash during driver load on big endian machines

Jan Beulich <jbeulich@suse.com>
    xen-blkback: fix error handling in xen_blkbk_map()

Jan Beulich <jbeulich@suse.com>
    xen-scsiback: don't "handle" error by BUG()

Jan Beulich <jbeulich@suse.com>
    xen-netback: don't "handle" error by BUG()

Jan Beulich <jbeulich@suse.com>
    xen-blkback: don't "handle" error by BUG()

Stefano Stabellini <stefano.stabellini@xilinx.com>
    xen/arm: don't ignore return errors from set_phys_to_machine

Jan Beulich <jbeulich@suse.com>
    Xen/gntdev: correct error checking in gntdev_map_grant_pages()

Jan Beulich <jbeulich@suse.com>
    Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages()

Jan Beulich <jbeulich@suse.com>
    Xen/x86: also check kernel mapping in set_foreign_p2m_mapping()

Jan Beulich <jbeulich@suse.com>
    Xen/x86: don't bail early from clear_foreign_p2m_mapping()

Loic Poulain <loic.poulain@linaro.org>
    net: qrtr: Fix port ID for control messages

Paolo Bonzini <pbonzini@redhat.com>
    KVM: SEV: fix double locking due to incorrect backport

Borislav Petkov <bp@suse.de>
    x86/build: Disable CET instrumentation in the kernel for 32-bit too

Miklos Szeredi <mszeredi@redhat.com>
    ovl: expand warning in ovl_d_real()

Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    net/qrtr: restrict user-controlled length in qrtr_tun_write_iter()

Sabyrzhan Tasbolatov <snovitoll@gmail.com>
    net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS

Stefano Garzarella <sgarzare@redhat.com>
    vsock: fix locking in vsock_shutdown()

Stefano Garzarella <sgarzare@redhat.com>
    vsock/virtio: update credit only if socket is not closed

Edwin Peer <edwin.peer@broadcom.com>
    net: watchdog: hold device global xmit lock during tx disable

Norbert Slusarek <nslusarek@gmx.net>
    net/vmw_vsock: improve locking in vsock_connect_timeout()

NeilBrown <neilb@suse.de>
    net: fix iteration for sctp transport seq_files

Serge Semin <Sergey.Semin@baikalelectronics.ru>
    usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one

Felipe Balbi <balbi@kernel.org>
    usb: dwc3: ulpi: fix checkpatch warning

Randy Dunlap <rdunlap@infradead.org>
    h8300: fix PREEMPTION build, TI_PRE_COUNT undefined

Alain Volmat <alain.volmat@foss.st.com>
    i2c: stm32f7: fix configuration of the digital filter

Fangrui Song <maskray@google.com>
    firmware_loader: align .builtin_fw to 8

Yufeng Mo <moyufeng@huawei.com>
    net: hns3: add a check for queue_id in hclge_reset_vf_queue()

Florian Westphal <fw@strlen.de>
    netfilter: conntrack: skip identical origin tuple in same zone only

Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
    net: stmmac: set TxQ mode back to DCB after disabling CBS

Juergen Gross <jgross@suse.com>
    xen/netback: avoid race in xenvif_rx_ring_slots_available()

Sven Auhagen <sven.auhagen@voleatech.de>
    netfilter: flowtable: fix tcp and udp header checksum update

Jozsef Kadlecsik <kadlec@mail.kfki.hu>
    netfilter: xt_recent: Fix attempt to update deleted entry

Bui Quang Minh <minhquangbui99@gmail.com>
    bpf: Check for integer overflow when using roundup_pow_of_two()

Lorenzo Bianconi <lorenzo@kernel.org>
    mt76: dma: fix a possible memory leak in mt76_add_fragment()

Russell King <rmk+kernel@armlinux.org.uk>
    ARM: kexec: fix oops after TLB are invalidated

Russell King <rmk+kernel@armlinux.org.uk>
    ARM: ensure the signal page contains defined contents

Alexandre Belloni <alexandre.belloni@bootlin.com>
    ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL

Lin Feng <linf@wangsu.com>
    bfq-iosched: Revert "bfq: Fix computation of shallow depth"

Alexandre Ghiti <alex@ghiti.fr>
    riscv: virt_addr_valid must check the address belongs to linear mapping

Victor Lu <victorchengchi.lu@amd.com>
    drm/amd/display: Free atomic state after drm_atomic_commit

Victor Lu <victorchengchi.lu@amd.com>
    drm/amd/display: Fix dc_sink kref count in emulated_link_detect

Amir Goldstein <amir73il@gmail.com>
    ovl: skip getxattr of security labels

Miklos Szeredi <mszeredi@redhat.com>
    cap: fix conversions on getxattr

Miklos Szeredi <mszeredi@redhat.com>
    ovl: perform vfs_getxattr() with mounter creds

Hans de Goede <hdegoede@redhat.com>
    platform/x86: hp-wmi: Disable tablet-mode reporting by default

Marc Zyngier <maz@kernel.org>
    arm64: dts: rockchip: Fix PCIe DT properties on rk3399

Julien Grall <jgrall@amazon.com>
    arm/xen: Don't probe xenbus as part of an early initcall

Steven Rostedt (VMware) <rostedt@goodmis.org>
    tracing: Check length before giving out the filter buffer

Steven Rostedt (VMware) <rostedt@goodmis.org>
    tracing: Do not count ftrace events in top level enable output


-------------

Diffstat:

 Makefile                                           |  4 +-
 arch/arm/boot/dts/lpc32xx.dtsi                     |  3 -
 arch/arm/include/asm/kexec-internal.h              | 12 ++++
 arch/arm/kernel/asm-offsets.c                      |  5 ++
 arch/arm/kernel/machine_kexec.c                    | 20 +++----
 arch/arm/kernel/relocate_kernel.S                  | 38 ++++--------
 arch/arm/kernel/signal.c                           | 14 +++--
 arch/arm/xen/enlighten.c                           |  2 -
 arch/arm/xen/p2m.c                                 |  6 +-
 arch/arm64/boot/dts/rockchip/rk3399.dtsi           |  2 +-
 arch/h8300/kernel/asm-offsets.c                    |  3 +
 arch/riscv/include/asm/page.h                      |  5 +-
 arch/x86/Makefile                                  |  6 +-
 arch/x86/kvm/svm.c                                 |  1 -
 arch/x86/xen/p2m.c                                 | 15 +++--
 block/bfq-iosched.c                                |  8 +--
 drivers/block/xen-blkback/blkback.c                | 30 +++++-----
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 18 +++---
 drivers/i2c/busses/i2c-stm32f7.c                   | 11 +++-
 .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c    |  7 +++
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c    |  7 ++-
 drivers/net/wireless/mediatek/mt76/dma.c           |  8 ++-
 drivers/net/xen-netback/netback.c                  |  4 +-
 drivers/net/xen-netback/rx.c                       |  9 ++-
 drivers/platform/x86/hp-wmi.c                      | 14 +++--
 drivers/scsi/qla2xxx/qla_tmpl.c                    |  9 +--
 drivers/scsi/qla2xxx/qla_tmpl.h                    |  2 +-
 drivers/usb/dwc3/ulpi.c                            | 20 +++++--
 drivers/xen/gntdev.c                               | 37 ++++++------
 drivers/xen/xen-scsiback.c                         |  4 +-
 drivers/xen/xenbus/xenbus.h                        |  1 -
 drivers/xen/xenbus/xenbus_probe.c                  |  2 +-
 fs/overlayfs/copy_up.c                             | 15 ++---
 fs/overlayfs/inode.c                               |  2 +
 fs/overlayfs/super.c                               | 13 +++--
 include/asm-generic/vmlinux.lds.h                  |  2 +-
 include/linux/netdevice.h                          |  2 +
 include/xen/grant_table.h                          |  1 +
 include/xen/xenbus.h                               |  2 -
 kernel/bpf/stackmap.c                              |  2 +
 kernel/trace/trace.c                               |  2 +-
 kernel/trace/trace_events.c                        |  3 +-
 net/netfilter/nf_conntrack_core.c                  |  3 +-
 net/netfilter/nf_flow_table_core.c                 |  4 +-
 net/netfilter/xt_recent.c                          | 12 +++-
 net/qrtr/qrtr.c                                    |  2 +-
 net/qrtr/tun.c                                     |  6 ++
 net/rds/rdma.c                                     |  3 +
 net/sctp/proc.c                                    | 16 ++++--
 net/vmw_vsock/af_vsock.c                           | 13 ++---
 net/vmw_vsock/hyperv_transport.c                   |  4 --
 net/vmw_vsock/virtio_transport_common.c            |  4 +-
 security/commoncap.c                               | 67 ++++++++++++++--------
 virt/kvm/kvm_main.c                                |  3 +-
 54 files changed, 303 insertions(+), 205 deletions(-)



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 01/50] tracing: Do not count ftrace events in top level enable output
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 02/50] tracing: Check length before giving out the filter buffer Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yordan Karadzhov (VMware),
	Steven Rostedt (VMware)

From: Steven Rostedt (VMware) <rostedt@goodmis.org>

commit 256cfdd6fdf70c6fcf0f7c8ddb0ebd73ce8f3bc9 upstream.

The file /sys/kernel/tracing/events/enable is used to enable all events by
echoing in "1", or disabling all events when echoing in "0". To know if all
events are enabled, disabled, or some are enabled but not all of them,
cating the file should show either "1" (all enabled), "0" (all disabled), or
"X" (some enabled but not all of them). This works the same as the "enable"
files in the individule system directories (like tracing/events/sched/enable).

But when all events are enabled, the top level "enable" file shows "X". The
reason is that its checking the "ftrace" events, which are special events
that only exist for their format files. These include the format for the
function tracer events, that are enabled when the function tracer is
enabled, but not by the "enable" file. The check includes these events,
which will always be disabled, and even though all true events are enabled,
the top level "enable" file will show "X" instead of "1".

To fix this, have the check test the event's flags to see if it has the
"IGNORE_ENABLE" flag set, and if so, not test it.

Cc: stable@vger.kernel.org
Fixes: 553552ce1796c ("tracing: Combine event filter_active and enable into single flags field")
Reported-by: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/trace/trace_events.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1113,7 +1113,8 @@ system_enable_read(struct file *filp, ch
 	mutex_lock(&event_mutex);
 	list_for_each_entry(file, &tr->events, list) {
 		call = file->event_call;
-		if (!trace_event_name(call) || !call->class || !call->class->reg)
+		if ((call->flags & TRACE_EVENT_FL_IGNORE_ENABLE) ||
+		    !trace_event_name(call) || !call->class || !call->class->reg)
 			continue;
 
 		if (system && strcmp(call->class->system, system->name) != 0)



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 02/50] tracing: Check length before giving out the filter buffer
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 01/50] tracing: Do not count ftrace events in top level enable output Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 03/50] arm/xen: Dont probe xenbus as part of an early initcall Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Wen Gong, Steven Rostedt (VMware)

From: Steven Rostedt (VMware) <rostedt@goodmis.org>

commit b220c049d5196dd94d992dd2dc8cba1a5e6123bf upstream.

When filters are used by trace events, a page is allocated on each CPU and
used to copy the trace event fields to this page before writing to the ring
buffer. The reason to use the filter and not write directly into the ring
buffer is because a filter may discard the event and there's more overhead
on discarding from the ring buffer than the extra copy.

The problem here is that there is no check against the size being allocated
when using this page. If an event asks for more than a page size while being
filtered, it will get only a page, leading to the caller writing more that
what was allocated.

Check the length of the request, and if it is more than PAGE_SIZE minus the
header default back to allocating from the ring buffer directly. The ring
buffer may reject the event if its too big anyway, but it wont overflow.

Link: https://lore.kernel.org/ath10k/1612839593-2308-1-git-send-email-wgong@codeaurora.org/

Cc: stable@vger.kernel.org
Fixes: 0fc1b09ff1ff4 ("tracing: Use temp buffer when filtering events")
Reported-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/trace/trace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2292,7 +2292,7 @@ trace_event_buffer_lock_reserve(struct r
 	    (entry = this_cpu_read(trace_buffered_event))) {
 		/* Try to use the per cpu buffer first */
 		val = this_cpu_inc_return(trace_buffered_event_cnt);
-		if (val == 1) {
+		if ((len < (PAGE_SIZE - sizeof(*entry))) && val == 1) {
 			trace_event_setup(entry, type, flags, pc);
 			entry->array[0] = len;
 			return entry;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 03/50] arm/xen: Dont probe xenbus as part of an early initcall
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 01/50] tracing: Do not count ftrace events in top level enable output Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 02/50] tracing: Check length before giving out the filter buffer Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 04/50] arm64: dts: rockchip: Fix PCIe DT properties on rk3399 Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ian Jackson, Julien Grall,
	David Woodhouse, Stefano Stabellini, Juergen Gross

From: Julien Grall <jgrall@amazon.com>

commit c4295ab0b485b8bc50d2264bcae2acd06f25caaf upstream.

After Commit 3499ba8198cad ("xen: Fix event channel callback via
INTX/GSI"), xenbus_probe() will be called too early on Arm. This will
recent to a guest hang during boot.

If the hang wasn't there, we would have ended up to call
xenbus_probe() twice (the second time is in xenbus_probe_initcall()).

We don't need to initialize xenbus_probe() early for Arm guest.
Therefore, the call in xen_guest_init() is now removed.

After this change, there is no more external caller for xenbus_probe().
So the function is turned to a static one. Interestingly there were two
prototypes for it.

Cc: stable@vger.kernel.org
Fixes: 3499ba8198cad ("xen: Fix event channel callback via INTX/GSI")
Reported-by: Ian Jackson <iwj@xenproject.org>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Link: https://lore.kernel.org/r/20210210170654.5377-1-julien@xen.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm/xen/enlighten.c          |    2 --
 drivers/xen/xenbus/xenbus.h       |    1 -
 drivers/xen/xenbus/xenbus_probe.c |    2 +-
 include/xen/xenbus.h              |    2 --
 4 files changed, 1 insertion(+), 6 deletions(-)

--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -404,8 +404,6 @@ static int __init xen_guest_init(void)
 		return -ENOMEM;
 	}
 	gnttab_init();
-	if (!xen_initial_domain())
-		xenbus_probe();
 
 	/*
 	 * Making sure board specific code will not set up ops for
--- a/drivers/xen/xenbus/xenbus.h
+++ b/drivers/xen/xenbus/xenbus.h
@@ -115,7 +115,6 @@ int xenbus_probe_node(struct xen_bus_typ
 		      const char *type,
 		      const char *nodename);
 int xenbus_probe_devices(struct xen_bus_type *bus);
-void xenbus_probe(void);
 
 void xenbus_dev_changed(const char *node, struct xen_bus_type *bus);
 
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -683,7 +683,7 @@ void unregister_xenstore_notifier(struct
 }
 EXPORT_SYMBOL_GPL(unregister_xenstore_notifier);
 
-void xenbus_probe(void)
+static void xenbus_probe(void)
 {
 	xenstored_ready = 1;
 
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -187,8 +187,6 @@ void xs_suspend_cancel(void);
 
 struct work_struct;
 
-void xenbus_probe(void);
-
 #define XENBUS_IS_ERR_READ(str) ({			\
 	if (!IS_ERR(str) && strlen(str) == 0) {		\
 		kfree(str);				\



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 04/50] arm64: dts: rockchip: Fix PCIe DT properties on rk3399
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2021-02-22 12:12 ` [PATCH 4.19 03/50] arm/xen: Dont probe xenbus as part of an early initcall Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 05/50] platform/x86: hp-wmi: Disable tablet-mode reporting by default Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Zyngier, Heiko Stuebner, Sasha Levin

From: Marc Zyngier <maz@kernel.org>

[ Upstream commit 43f20b1c6140896916f4e91aacc166830a7ba849 ]

It recently became apparent that the lack of a 'device_type = "pci"'
in the PCIe root complex node for rk3399 is a violation of the PCI
binding, as documented in IEEE Std 1275-1994. Changes to the kernel's
parsing of the DT made such violation fatal, as drivers cannot
probe the controller anymore.

Add the missing property makes the PCIe node compliant. While we
are at it, drop the pointless linux,pci-domain property, which only
makes sense when there are multiple host bridges.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200815125112.462652-3-maz@kernel.org
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index f4ee7c4f83b8b..b1c1a88a1c20c 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -198,6 +198,7 @@
 		reg = <0x0 0xf8000000 0x0 0x2000000>,
 		      <0x0 0xfd000000 0x0 0x1000000>;
 		reg-names = "axi-base", "apb-base";
+		device_type = "pci";
 		#address-cells = <3>;
 		#size-cells = <2>;
 		#interrupt-cells = <1>;
@@ -216,7 +217,6 @@
 				<0 0 0 2 &pcie0_intc 1>,
 				<0 0 0 3 &pcie0_intc 2>,
 				<0 0 0 4 &pcie0_intc 3>;
-		linux,pci-domain = <0>;
 		max-link-speed = <1>;
 		msi-map = <0x0 &its 0x0 0x1000>;
 		phys = <&pcie_phy 0>, <&pcie_phy 1>,
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 05/50] platform/x86: hp-wmi: Disable tablet-mode reporting by default
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2021-02-22 12:12 ` [PATCH 4.19 04/50] arm64: dts: rockchip: Fix PCIe DT properties on rk3399 Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 06/50] ovl: perform vfs_getxattr() with mounter creds Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stefan Brüns, Hans de Goede,
	Mark Gross, Sasha Levin

From: Hans de Goede <hdegoede@redhat.com>

[ Upstream commit 67fbe02a5cebc3c653610f12e3c0424e58450153 ]

Recently userspace has started making more use of SW_TABLET_MODE
(when an input-dev reports this).

Specifically recent GNOME3 versions will:

1.  When SW_TABLET_MODE is reported and is reporting 0:
1.1 Disable accelerometer-based screen auto-rotation
1.2 Disable automatically showing the on-screen keyboard when a
    text-input field is focussed

2.  When SW_TABLET_MODE is reported and is reporting 1:
2.1 Ignore input-events from the builtin keyboard and touchpad
    (this is for 360° hinges style 2-in-1s where the keyboard and
     touchpads are accessible on the back of the tablet when folded
     into tablet-mode)

This means that claiming to support SW_TABLET_MODE when it does not
actually work / reports correct values has bad side-effects.

The check in the hp-wmi code which is used to decide if the input-dev
should claim SW_TABLET_MODE support, only checks if the
HPWMI_HARDWARE_QUERY is supported. It does *not* check if the hardware
actually is capable of reporting SW_TABLET_MODE.

This leads to the hp-wmi input-dev claiming SW_TABLET_MODE support,
while in reality it will always report 0 as SW_TABLET_MODE value.
This has been seen on a "HP ENVY x360 Convertible 15-cp0xxx" and
this likely is the case on a whole lot of other HP models.

This problem causes both auto-rotation and on-screen keyboard
support to not work on affected x360 models.

There is no easy fix for this, but since userspace expects
SW_TABLET_MODE reporting to be reliable when advertised it is
better to not claim/report SW_TABLET_MODE support at all, then
to claim to support it while it does not work.

To avoid the mentioned problems, add a new enable_tablet_mode_sw
module-parameter which defaults to false.

Note I've made this an int using the standard -1=auto, 0=off, 1=on
triplett, with the hope that in the future we can come up with a
better way to detect SW_TABLET_MODE support. ATM the default
auto option just does the same as off.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1918255
Cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mark Gross <mgross@linux.intel.com>
Link: https://lore.kernel.org/r/20210120124941.73409-1-hdegoede@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/platform/x86/hp-wmi.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 952544ca0d84d..93fadd4abf14d 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -45,6 +45,10 @@ MODULE_LICENSE("GPL");
 MODULE_ALIAS("wmi:95F24279-4D7B-4334-9387-ACCDC67EF61C");
 MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
 
+static int enable_tablet_mode_sw = -1;
+module_param(enable_tablet_mode_sw, int, 0444);
+MODULE_PARM_DESC(enable_tablet_mode_sw, "Enable SW_TABLET_MODE reporting (-1=auto, 0=no, 1=yes)");
+
 #define HPWMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
 #define HPWMI_BIOS_GUID "5FB7F034-2C63-45e9-BE91-3D44E2C707E4"
 
@@ -656,10 +660,12 @@ static int __init hp_wmi_input_setup(void)
 	}
 
 	/* Tablet mode */
-	val = hp_wmi_hw_state(HPWMI_TABLET_MASK);
-	if (!(val < 0)) {
-		__set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
-		input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, val);
+	if (enable_tablet_mode_sw > 0) {
+		val = hp_wmi_hw_state(HPWMI_TABLET_MASK);
+		if (val >= 0) {
+			__set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
+			input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE, val);
+		}
 	}
 
 	err = sparse_keymap_setup(hp_wmi_input_dev, hp_wmi_keymap, NULL);
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 06/50] ovl: perform vfs_getxattr() with mounter creds
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2021-02-22 12:12 ` [PATCH 4.19 05/50] platform/x86: hp-wmi: Disable tablet-mode reporting by default Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 07/50] cap: fix conversions on getxattr Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric W. Biederman, Miklos Szeredi,
	Sasha Levin

From: Miklos Szeredi <mszeredi@redhat.com>

[ Upstream commit 554677b97257b0b69378bd74e521edb7e94769ff ]

The vfs_getxattr() in ovl_xattr_set() is used to check whether an xattr
exist on a lower layer file that is to be removed.  If the xattr does not
exist, then no need to copy up the file.

This call of vfs_getxattr() wasn't wrapped in credential override, and this
is probably okay.  But for consitency wrap this instance as well.

Reported-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/overlayfs/inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 8b3c284ce92ea..08e60a6df77c3 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -340,7 +340,9 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
 		goto out;
 
 	if (!value && !upperdentry) {
+		old_cred = ovl_override_creds(dentry->d_sb);
 		err = vfs_getxattr(realdentry, name, NULL, 0);
+		revert_creds(old_cred);
 		if (err < 0)
 			goto out_drop_write;
 	}
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 07/50] cap: fix conversions on getxattr
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2021-02-22 12:12 ` [PATCH 4.19 06/50] ovl: perform vfs_getxattr() with mounter creds Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:12 ` [PATCH 4.19 08/50] ovl: skip getxattr of security labels Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Miklos Szeredi, Eric W. Biederman,
	Sasha Levin

From: Miklos Szeredi <mszeredi@redhat.com>

[ Upstream commit f2b00be488730522d0fb7a8a5de663febdcefe0a ]

If a capability is stored on disk in v2 format cap_inode_getsecurity() will
currently return in v2 format unconditionally.

This is wrong: v2 cap should be equivalent to a v3 cap with zero rootid,
and so the same conversions performed on it.

If the rootid cannot be mapped, v3 is returned unconverted.  Fix this so
that both v2 and v3 return -EOVERFLOW if the rootid (or the owner of the fs
user namespace in case of v2) cannot be mapped into the current user
namespace.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 security/commoncap.c | 67 ++++++++++++++++++++++++++++----------------
 1 file changed, 43 insertions(+), 24 deletions(-)

diff --git a/security/commoncap.c b/security/commoncap.c
index f86557a8e43f6..a1dee0ab345a2 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -377,10 +377,11 @@ int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer,
 {
 	int size, ret;
 	kuid_t kroot;
+	u32 nsmagic, magic;
 	uid_t root, mappedroot;
 	char *tmpbuf = NULL;
 	struct vfs_cap_data *cap;
-	struct vfs_ns_cap_data *nscap;
+	struct vfs_ns_cap_data *nscap = NULL;
 	struct dentry *dentry;
 	struct user_namespace *fs_ns;
 
@@ -402,46 +403,61 @@ int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer,
 	fs_ns = inode->i_sb->s_user_ns;
 	cap = (struct vfs_cap_data *) tmpbuf;
 	if (is_v2header((size_t) ret, cap)) {
-		/* If this is sizeof(vfs_cap_data) then we're ok with the
-		 * on-disk value, so return that.  */
-		if (alloc)
-			*buffer = tmpbuf;
-		else
-			kfree(tmpbuf);
-		return ret;
-	} else if (!is_v3header((size_t) ret, cap)) {
-		kfree(tmpbuf);
-		return -EINVAL;
+		root = 0;
+	} else if (is_v3header((size_t) ret, cap)) {
+		nscap = (struct vfs_ns_cap_data *) tmpbuf;
+		root = le32_to_cpu(nscap->rootid);
+	} else {
+		size = -EINVAL;
+		goto out_free;
 	}
 
-	nscap = (struct vfs_ns_cap_data *) tmpbuf;
-	root = le32_to_cpu(nscap->rootid);
 	kroot = make_kuid(fs_ns, root);
 
 	/* If the root kuid maps to a valid uid in current ns, then return
 	 * this as a nscap. */
 	mappedroot = from_kuid(current_user_ns(), kroot);
 	if (mappedroot != (uid_t)-1 && mappedroot != (uid_t)0) {
+		size = sizeof(struct vfs_ns_cap_data);
 		if (alloc) {
-			*buffer = tmpbuf;
+			if (!nscap) {
+				/* v2 -> v3 conversion */
+				nscap = kzalloc(size, GFP_ATOMIC);
+				if (!nscap) {
+					size = -ENOMEM;
+					goto out_free;
+				}
+				nsmagic = VFS_CAP_REVISION_3;
+				magic = le32_to_cpu(cap->magic_etc);
+				if (magic & VFS_CAP_FLAGS_EFFECTIVE)
+					nsmagic |= VFS_CAP_FLAGS_EFFECTIVE;
+				memcpy(&nscap->data, &cap->data, sizeof(__le32) * 2 * VFS_CAP_U32);
+				nscap->magic_etc = cpu_to_le32(nsmagic);
+			} else {
+				/* use allocated v3 buffer */
+				tmpbuf = NULL;
+			}
 			nscap->rootid = cpu_to_le32(mappedroot);
-		} else
-			kfree(tmpbuf);
-		return size;
+			*buffer = nscap;
+		}
+		goto out_free;
 	}
 
 	if (!rootid_owns_currentns(kroot)) {
-		kfree(tmpbuf);
-		return -EOPNOTSUPP;
+		size = -EOVERFLOW;
+		goto out_free;
 	}
 
 	/* This comes from a parent namespace.  Return as a v2 capability */
 	size = sizeof(struct vfs_cap_data);
 	if (alloc) {
-		*buffer = kmalloc(size, GFP_ATOMIC);
-		if (*buffer) {
-			struct vfs_cap_data *cap = *buffer;
-			__le32 nsmagic, magic;
+		if (nscap) {
+			/* v3 -> v2 conversion */
+			cap = kzalloc(size, GFP_ATOMIC);
+			if (!cap) {
+				size = -ENOMEM;
+				goto out_free;
+			}
 			magic = VFS_CAP_REVISION_2;
 			nsmagic = le32_to_cpu(nscap->magic_etc);
 			if (nsmagic & VFS_CAP_FLAGS_EFFECTIVE)
@@ -449,9 +465,12 @@ int cap_inode_getsecurity(struct inode *inode, const char *name, void **buffer,
 			memcpy(&cap->data, &nscap->data, sizeof(__le32) * 2 * VFS_CAP_U32);
 			cap->magic_etc = cpu_to_le32(magic);
 		} else {
-			size = -ENOMEM;
+			/* use unconverted v2 */
+			tmpbuf = NULL;
 		}
+		*buffer = cap;
 	}
+out_free:
 	kfree(tmpbuf);
 	return size;
 }
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 08/50] ovl: skip getxattr of security labels
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2021-02-22 12:12 ` [PATCH 4.19 07/50] cap: fix conversions on getxattr Greg Kroah-Hartman
@ 2021-02-22 12:12 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 09/50] drm/amd/display: Fix dc_sink kref count in emulated_link_detect Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Michael Labriola, Amir Goldstein,
	Miklos Szeredi, Sasha Levin

From: Amir Goldstein <amir73il@gmail.com>

[ Upstream commit 03fedf93593c82538b18476d8c4f0e8f8435ea70 ]

When inode has no listxattr op of its own (e.g. squashfs) vfs_listxattr
calls the LSM inode_listsecurity hooks to list the xattrs that LSMs will
intercept in inode_getxattr hooks.

When selinux LSM is installed but not initialized, it will list the
security.selinux xattr in inode_listsecurity, but will not intercept it
in inode_getxattr.  This results in -ENODATA for a getxattr call for an
xattr returned by listxattr.

This situation was manifested as overlayfs failure to copy up lower
files from squashfs when selinux is built-in but not initialized,
because ovl_copy_xattr() iterates the lower inode xattrs by
vfs_listxattr() and vfs_getxattr().

ovl_copy_xattr() skips copy up of security labels that are indentified by
inode_copy_up_xattr LSM hooks, but it does that after vfs_getxattr().
Since we are not going to copy them, skip vfs_getxattr() of the security
labels.

Reported-by: Michael Labriola <michael.d.labriola@gmail.com>
Tested-by: Michael Labriola <michael.d.labriola@gmail.com>
Link: https://lore.kernel.org/linux-unionfs/2nv9d47zt7.fsf@aldarion.sourceruckus.org/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/overlayfs/copy_up.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 6eb0b882ad231..e164f489d01d9 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -79,6 +79,14 @@ int ovl_copy_xattr(struct dentry *old, struct dentry *new)
 
 		if (ovl_is_private_xattr(name))
 			continue;
+
+		error = security_inode_copy_up_xattr(name);
+		if (error < 0 && error != -EOPNOTSUPP)
+			break;
+		if (error == 1) {
+			error = 0;
+			continue; /* Discard */
+		}
 retry:
 		size = vfs_getxattr(old, name, value, value_size);
 		if (size == -ERANGE)
@@ -102,13 +110,6 @@ retry:
 			goto retry;
 		}
 
-		error = security_inode_copy_up_xattr(name);
-		if (error < 0 && error != -EOPNOTSUPP)
-			break;
-		if (error == 1) {
-			error = 0;
-			continue; /* Discard */
-		}
 		error = vfs_setxattr(new, name, value, size, 0);
 		if (error)
 			break;
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 09/50] drm/amd/display: Fix dc_sink kref count in emulated_link_detect
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2021-02-22 12:12 ` [PATCH 4.19 08/50] ovl: skip getxattr of security labels Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 10/50] drm/amd/display: Free atomic state after drm_atomic_commit Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Victor Lu, Nicholas Kazlauskas,
	Anson Jacob, Daniel Wheeler, Alex Deucher, Sasha Levin

From: Victor Lu <victorchengchi.lu@amd.com>

[ Upstream commit 3ddc818d9bb877c64f5c649beab97af86c403702 ]

[why]
prev_sink is not used anywhere else in the function and the reference to
it from dc_link is replaced with a new dc_sink.

[how]
Change dc_sink_retain(prev_sink) to dc_sink_release(prev_sink).

Signed-off-by: Victor Lu <victorchengchi.lu@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Anson Jacob <Anson.Jacob@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 3b07a316680c2..7b00e96705b6d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -668,8 +668,8 @@ static void emulated_link_detect(struct dc_link *link)
 	link->type = dc_connection_none;
 	prev_sink = link->local_sink;
 
-	if (prev_sink != NULL)
-		dc_sink_retain(prev_sink);
+	if (prev_sink)
+		dc_sink_release(prev_sink);
 
 	switch (link->connector_signal) {
 	case SIGNAL_TYPE_HDMI_TYPE_A: {
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 10/50] drm/amd/display: Free atomic state after drm_atomic_commit
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 09/50] drm/amd/display: Fix dc_sink kref count in emulated_link_detect Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 11/50] riscv: virt_addr_valid must check the address belongs to linear mapping Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Victor Lu, Roman Li, Anson Jacob,
	Daniel Wheeler, Alex Deucher, Sasha Levin

From: Victor Lu <victorchengchi.lu@amd.com>

[ Upstream commit 2abaa323d744011982b20b8f3886184d56d23946 ]

[why]
drm_atomic_commit was changed so that the caller must free their
drm_atomic_state reference on successes.

[how]
Add drm_atomic_commit_put after drm_atomic_commit call in
dm_force_atomic_commit.

Signed-off-by: Victor Lu <victorchengchi.lu@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Anson Jacob <Anson.Jacob@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 7b00e96705b6d..62a2f0491117d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4732,14 +4732,14 @@ static int dm_force_atomic_commit(struct drm_connector *connector)
 
 	ret = PTR_ERR_OR_ZERO(conn_state);
 	if (ret)
-		goto err;
+		goto out;
 
 	/* Attach crtc to drm_atomic_state*/
 	crtc_state = drm_atomic_get_crtc_state(state, &disconnected_acrtc->base);
 
 	ret = PTR_ERR_OR_ZERO(crtc_state);
 	if (ret)
-		goto err;
+		goto out;
 
 	/* force a restore */
 	crtc_state->mode_changed = true;
@@ -4749,17 +4749,15 @@ static int dm_force_atomic_commit(struct drm_connector *connector)
 
 	ret = PTR_ERR_OR_ZERO(plane_state);
 	if (ret)
-		goto err;
-
+		goto out;
 
 	/* Call commit internally with the state we just constructed */
 	ret = drm_atomic_commit(state);
-	if (!ret)
-		return 0;
 
-err:
-	DRM_ERROR("Restoring old state failed with %i\n", ret);
+out:
 	drm_atomic_state_put(state);
+	if (ret)
+		DRM_ERROR("Restoring old state failed with %i\n", ret);
 
 	return ret;
 }
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 11/50] riscv: virt_addr_valid must check the address belongs to linear mapping
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 10/50] drm/amd/display: Free atomic state after drm_atomic_commit Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 12/50] bfq-iosched: Revert "bfq: Fix computation of shallow depth" Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexandre Ghiti, Atish Patra,
	Palmer Dabbelt, Sasha Levin

From: Alexandre Ghiti <alex@ghiti.fr>

[ Upstream commit 2ab543823322b564f205cb15d0f0302803c87d11 ]

virt_addr_valid macro checks that a virtual address is valid, ie that
the address belongs to the linear mapping and that the corresponding
 physical page exists.

Add the missing check that ensures the virtual address belongs to the
linear mapping, otherwise __virt_to_phys, when compiled with
CONFIG_DEBUG_VIRTUAL enabled, raises a WARN that is interpreted as a
kernel bug by syzbot.

Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/riscv/include/asm/page.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 06cfbb3aacbb0..abc147aeff8b0 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -115,7 +115,10 @@ extern unsigned long min_low_pfn;
 
 #endif /* __ASSEMBLY__ */
 
-#define virt_addr_valid(vaddr)	(pfn_valid(virt_to_pfn(vaddr)))
+#define virt_addr_valid(vaddr)	({						\
+	unsigned long _addr = (unsigned long)vaddr;				\
+	(unsigned long)(_addr) >= PAGE_OFFSET && pfn_valid(virt_to_pfn(_addr));	\
+})
 
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 12/50] bfq-iosched: Revert "bfq: Fix computation of shallow depth"
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 11/50] riscv: virt_addr_valid must check the address belongs to linear mapping Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 13/50] ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lin Feng, Jan Kara, Jens Axboe, Sasha Levin

From: Lin Feng <linf@wangsu.com>

[ Upstream commit 388c705b95f23f317fa43e6abf9ff07b583b721a ]

This reverts commit 6d4d273588378c65915acaf7b2ee74e9dd9c130a.

bfq.limit_depth passes word_depths[] as shallow_depth down to sbitmap core
sbitmap_get_shallow, which uses just the number to limit the scan depth of
each bitmap word, formula:
scan_percentage_for_each_word = shallow_depth / (1 << sbimap->shift) * 100%

That means the comments's percentiles 50%, 75%, 18%, 37% of bfq are correct.
But after commit patch 'bfq: Fix computation of shallow depth', we use
sbitmap.depth instead, as a example in following case:

sbitmap.depth = 256, map_nr = 4, shift = 6; sbitmap_word.depth = 64.
The resulsts of computed bfqd->word_depths[] are {128, 192, 48, 96}, and
three of the numbers exceed core dirver's 'sbitmap_word.depth=64' limit
nothing.

Signed-off-by: Lin Feng <linf@wangsu.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 block/bfq-iosched.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index b7ad8ac6bb41e..5198ed1b36690 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -5280,13 +5280,13 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
 	 * limit 'something'.
 	 */
 	/* no more than 50% of tags for async I/O */
-	bfqd->word_depths[0][0] = max(bt->sb.depth >> 1, 1U);
+	bfqd->word_depths[0][0] = max((1U << bt->sb.shift) >> 1, 1U);
 	/*
 	 * no more than 75% of tags for sync writes (25% extra tags
 	 * w.r.t. async I/O, to prevent async I/O from starving sync
 	 * writes)
 	 */
-	bfqd->word_depths[0][1] = max((bt->sb.depth * 3) >> 2, 1U);
+	bfqd->word_depths[0][1] = max(((1U << bt->sb.shift) * 3) >> 2, 1U);
 
 	/*
 	 * In-word depths in case some bfq_queue is being weight-
@@ -5296,9 +5296,9 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
 	 * shortage.
 	 */
 	/* no more than ~18% of tags for async I/O */
-	bfqd->word_depths[1][0] = max((bt->sb.depth * 3) >> 4, 1U);
+	bfqd->word_depths[1][0] = max(((1U << bt->sb.shift) * 3) >> 4, 1U);
 	/* no more than ~37% of tags for sync writes (~20% extra tags) */
-	bfqd->word_depths[1][1] = max((bt->sb.depth * 6) >> 4, 1U);
+	bfqd->word_depths[1][1] = max(((1U << bt->sb.shift) * 6) >> 4, 1U);
 
 	for (i = 0; i < 2; i++)
 		for (j = 0; j < 2; j++)
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 13/50] ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 12/50] bfq-iosched: Revert "bfq: Fix computation of shallow depth" Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 14/50] ARM: ensure the signal page contains defined contents Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alexandre Belloni, Gregory CLEMENT,
	Arnd Bergmann, Sasha Levin

From: Alexandre Belloni <alexandre.belloni@bootlin.com>

[ Upstream commit 5638159f6d93b99ec9743ac7f65563fca3cf413d ]

This reverts commit c17e9377aa81664d94b4f2102559fcf2a01ec8e7.

The lpc32xx clock driver is not able to actually change the PLL rate as
this would require reparenting ARM_CLK, DDRAM_CLK, PERIPH_CLK to SYSCLK,
then stop the PLL, update the register, restart the PLL and wait for the
PLL to lock and finally reparent ARM_CLK, DDRAM_CLK, PERIPH_CLK to HCLK
PLL.

Currently, the HCLK driver simply updates the registers but this has no
real effect and all the clock rate calculation end up being wrong. This is
especially annoying for the peripheral (e.g. UARTs, I2C, SPI).

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Tested-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20210203090320.GA3760268@piout.net'
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/dts/lpc32xx.dtsi | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi
index 9ad3df11db0d8..abef034987a27 100644
--- a/arch/arm/boot/dts/lpc32xx.dtsi
+++ b/arch/arm/boot/dts/lpc32xx.dtsi
@@ -323,9 +323,6 @@
 
 					clocks = <&xtal_32k>, <&xtal>;
 					clock-names = "xtal_32k", "xtal";
-
-					assigned-clocks = <&clk LPC32XX_CLK_HCLK_PLL>;
-					assigned-clock-rates = <208000000>;
 				};
 			};
 
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 14/50] ARM: ensure the signal page contains defined contents
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 13/50] ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 15/50] ARM: kexec: fix oops after TLB are invalidated Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Will Deacon, Russell King, Sasha Levin

From: Russell King <rmk+kernel@armlinux.org.uk>

[ Upstream commit 9c698bff66ab4914bb3d71da7dc6112519bde23e ]

Ensure that the signal page contains our poison instruction to increase
the protection against ROP attacks and also contains well defined
contents.

Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/kernel/signal.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index b908382b69ff5..1c01358b9b6db 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -697,18 +697,20 @@ struct page *get_signal_page(void)
 
 	addr = page_address(page);
 
+	/* Poison the entire page */
+	memset32(addr, __opcode_to_mem_arm(0xe7fddef1),
+		 PAGE_SIZE / sizeof(u32));
+
 	/* Give the signal return code some randomness */
 	offset = 0x200 + (get_random_int() & 0x7fc);
 	signal_return_offset = offset;
 
-	/*
-	 * Copy signal return handlers into the vector page, and
-	 * set sigreturn to be a pointer to these.
-	 */
+	/* Copy signal return handlers into the page */
 	memcpy(addr + offset, sigreturn_codes, sizeof(sigreturn_codes));
 
-	ptr = (unsigned long)addr + offset;
-	flush_icache_range(ptr, ptr + sizeof(sigreturn_codes));
+	/* Flush out all instructions in this page */
+	ptr = (unsigned long)addr;
+	flush_icache_range(ptr, ptr + PAGE_SIZE);
 
 	return page;
 }
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 15/50] ARM: kexec: fix oops after TLB are invalidated
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 14/50] ARM: ensure the signal page contains defined contents Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 16/50] mt76: dma: fix a possible memory leak in mt76_add_fragment() Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Giancarlo Ferrari, Russell King, Sasha Levin

From: Russell King <rmk+kernel@armlinux.org.uk>

[ Upstream commit 4d62e81b60d4025e2dfcd5ea531cc1394ce9226f ]

Giancarlo Ferrari reports the following oops while trying to use kexec:

 Unable to handle kernel paging request at virtual address 80112f38
 pgd = fd7ef03e
 [80112f38] *pgd=0001141e(bad)
 Internal error: Oops: 80d [#1] PREEMPT SMP ARM
 ...

This is caused by machine_kexec() trying to set the kernel text to be
read/write, so it can poke values into the relocation code before
copying it - and an interrupt occuring which changes the page tables.
The subsequent writes then hit read-only sections that trigger a
data abort resulting in the above oops.

Fix this by copying the relocation code, and then writing the variables
into the destination, thereby avoiding the need to make the kernel text
read/write.

Reported-by: Giancarlo Ferrari <giancarlo.ferrari89@gmail.com>
Tested-by: Giancarlo Ferrari <giancarlo.ferrari89@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/include/asm/kexec-internal.h | 12 +++++++++
 arch/arm/kernel/asm-offsets.c         |  5 ++++
 arch/arm/kernel/machine_kexec.c       | 20 ++++++--------
 arch/arm/kernel/relocate_kernel.S     | 38 ++++++++-------------------
 4 files changed, 36 insertions(+), 39 deletions(-)
 create mode 100644 arch/arm/include/asm/kexec-internal.h

diff --git a/arch/arm/include/asm/kexec-internal.h b/arch/arm/include/asm/kexec-internal.h
new file mode 100644
index 0000000000000..ecc2322db7aa1
--- /dev/null
+++ b/arch/arm/include/asm/kexec-internal.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ARM_KEXEC_INTERNAL_H
+#define _ARM_KEXEC_INTERNAL_H
+
+struct kexec_relocate_data {
+	unsigned long kexec_start_address;
+	unsigned long kexec_indirection_page;
+	unsigned long kexec_mach_type;
+	unsigned long kexec_r2;
+};
+
+#endif
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 3968d6c22455b..ae85f67a63520 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -18,6 +18,7 @@
 #include <linux/kvm_host.h>
 #endif
 #include <asm/cacheflush.h>
+#include <asm/kexec-internal.h>
 #include <asm/glue-df.h>
 #include <asm/glue-pf.h>
 #include <asm/mach/arch.h>
@@ -189,5 +190,9 @@ int main(void)
   DEFINE(MPU_RGN_PRBAR,	offsetof(struct mpu_rgn, prbar));
   DEFINE(MPU_RGN_PRLAR,	offsetof(struct mpu_rgn, prlar));
 #endif
+  DEFINE(KEXEC_START_ADDR,	offsetof(struct kexec_relocate_data, kexec_start_address));
+  DEFINE(KEXEC_INDIR_PAGE,	offsetof(struct kexec_relocate_data, kexec_indirection_page));
+  DEFINE(KEXEC_MACH_TYPE,	offsetof(struct kexec_relocate_data, kexec_mach_type));
+  DEFINE(KEXEC_R2,		offsetof(struct kexec_relocate_data, kexec_r2));
   return 0; 
 }
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 76300f3813e89..734adeb42df87 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -15,6 +15,7 @@
 #include <asm/pgalloc.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
+#include <asm/kexec-internal.h>
 #include <asm/fncpy.h>
 #include <asm/mach-types.h>
 #include <asm/smp_plat.h>
@@ -24,11 +25,6 @@
 extern void relocate_new_kernel(void);
 extern const unsigned int relocate_new_kernel_size;
 
-extern unsigned long kexec_start_address;
-extern unsigned long kexec_indirection_page;
-extern unsigned long kexec_mach_type;
-extern unsigned long kexec_boot_atags;
-
 static atomic_t waiting_for_crash_ipi;
 
 /*
@@ -161,6 +157,7 @@ void (*kexec_reinit)(void);
 void machine_kexec(struct kimage *image)
 {
 	unsigned long page_list, reboot_entry_phys;
+	struct kexec_relocate_data *data;
 	void (*reboot_entry)(void);
 	void *reboot_code_buffer;
 
@@ -176,18 +173,17 @@ void machine_kexec(struct kimage *image)
 
 	reboot_code_buffer = page_address(image->control_code_page);
 
-	/* Prepare parameters for reboot_code_buffer*/
-	set_kernel_text_rw();
-	kexec_start_address = image->start;
-	kexec_indirection_page = page_list;
-	kexec_mach_type = machine_arch_type;
-	kexec_boot_atags = image->arch.kernel_r2;
-
 	/* copy our kernel relocation code to the control code page */
 	reboot_entry = fncpy(reboot_code_buffer,
 			     &relocate_new_kernel,
 			     relocate_new_kernel_size);
 
+	data = reboot_code_buffer + relocate_new_kernel_size;
+	data->kexec_start_address = image->start;
+	data->kexec_indirection_page = page_list;
+	data->kexec_mach_type = machine_arch_type;
+	data->kexec_r2 = image->arch.kernel_r2;
+
 	/* get the identity mapping physical address for the reboot code */
 	reboot_entry_phys = virt_to_idmap(reboot_entry);
 
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index 7eaa2ae7aff58..5e15b5912cb05 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -5,14 +5,16 @@
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include <asm/asm-offsets.h>
 #include <asm/kexec.h>
 
 	.align	3	/* not needed for this code, but keeps fncpy() happy */
 
 ENTRY(relocate_new_kernel)
 
-	ldr	r0,kexec_indirection_page
-	ldr	r1,kexec_start_address
+	adr	r7, relocate_new_kernel_end
+	ldr	r0, [r7, #KEXEC_INDIR_PAGE]
+	ldr	r1, [r7, #KEXEC_START_ADDR]
 
 	/*
 	 * If there is no indirection page (we are doing crashdumps)
@@ -57,34 +59,16 @@ ENTRY(relocate_new_kernel)
 
 2:
 	/* Jump to relocated kernel */
-	mov lr,r1
-	mov r0,#0
-	ldr r1,kexec_mach_type
-	ldr r2,kexec_boot_atags
- ARM(	ret lr	)
- THUMB(	bx lr		)
-
-	.align
-
-	.globl kexec_start_address
-kexec_start_address:
-	.long	0x0
-
-	.globl kexec_indirection_page
-kexec_indirection_page:
-	.long	0x0
-
-	.globl kexec_mach_type
-kexec_mach_type:
-	.long	0x0
-
-	/* phy addr of the atags for the new kernel */
-	.globl kexec_boot_atags
-kexec_boot_atags:
-	.long	0x0
+	mov	lr, r1
+	mov	r0, #0
+	ldr	r1, [r7, #KEXEC_MACH_TYPE]
+	ldr	r2, [r7, #KEXEC_R2]
+ ARM(	ret	lr	)
+ THUMB(	bx	lr	)
 
 ENDPROC(relocate_new_kernel)
 
+	.align	3
 relocate_new_kernel_end:
 
 	.globl relocate_new_kernel_size
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 16/50] mt76: dma: fix a possible memory leak in mt76_add_fragment()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 15/50] ARM: kexec: fix oops after TLB are invalidated Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 17/50] bpf: Check for integer overflow when using roundup_pow_of_two() Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lorenzo Bianconi, Felix Fietkau,
	Kalle Valo, Sasha Levin

From: Lorenzo Bianconi <lorenzo@kernel.org>

[ Upstream commit 93a1d4791c10d443bc67044def7efee2991d48b7 ]

Fix a memory leak in mt76_add_fragment routine returning the buffer
to the page_frag_cache when we receive a new fragment and the
skb_shared_info frag array is full.

Fixes: b102f0c522cf6 ("mt76: fix array overflow on receiving too many fragments for a packet")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/4f9dd73407da88b2a552517ce8db242d86bf4d5c.1611616130.git.lorenzo@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/dma.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index cc6840377bc27..8ce6a167dd2cc 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -393,15 +393,17 @@ static void
 mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
 		  int len, bool more)
 {
-	struct page *page = virt_to_head_page(data);
-	int offset = data - page_address(page);
 	struct sk_buff *skb = q->rx_head;
 	struct skb_shared_info *shinfo = skb_shinfo(skb);
 
 	if (shinfo->nr_frags < ARRAY_SIZE(shinfo->frags)) {
-		offset += q->buf_offset;
+		struct page *page = virt_to_head_page(data);
+		int offset = data - page_address(page) + q->buf_offset;
+
 		skb_add_rx_frag(skb, shinfo->nr_frags, page, offset, len,
 				q->buf_size);
+	} else {
+		skb_free_frag(data);
 	}
 
 	if (more)
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 17/50] bpf: Check for integer overflow when using roundup_pow_of_two()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 16/50] mt76: dma: fix a possible memory leak in mt76_add_fragment() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 18/50] netfilter: xt_recent: Fix attempt to update deleted entry Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bui Quang Minh, Daniel Borkmann, Sasha Levin

From: Bui Quang Minh <minhquangbui99@gmail.com>

[ Upstream commit 6183f4d3a0a2ad230511987c6c362ca43ec0055f ]

On 32-bit architecture, roundup_pow_of_two() can return 0 when the argument
has upper most bit set due to resulting 1UL << 32. Add a check for this case.

Fixes: d5a3b1f69186 ("bpf: introduce BPF_MAP_TYPE_STACK_TRACE")
Signed-off-by: Bui Quang Minh <minhquangbui99@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210127063653.3576-1-minhquangbui99@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/bpf/stackmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 55fff5e6d9831..a47d623f59fe7 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -114,6 +114,8 @@ static struct bpf_map *stack_map_alloc(union bpf_attr *attr)
 
 	/* hash table size must be power of 2 */
 	n_buckets = roundup_pow_of_two(attr->max_entries);
+	if (!n_buckets)
+		return ERR_PTR(-E2BIG);
 
 	cost = n_buckets * sizeof(struct stack_map_bucket *) + sizeof(*smap);
 	if (cost >= U32_MAX - PAGE_SIZE)
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 18/50] netfilter: xt_recent: Fix attempt to update deleted entry
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 17/50] bpf: Check for integer overflow when using roundup_pow_of_two() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 19/50] netfilter: flowtable: fix tcp and udp header checksum update Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Reindl Harald, Jozsef Kadlecsik,
	Pablo Neira Ayuso, Sasha Levin

From: Jozsef Kadlecsik <kadlec@mail.kfki.hu>

[ Upstream commit b1bdde33b72366da20d10770ab7a49fe87b5e190 ]

When both --reap and --update flag are specified, there's a code
path at which the entry to be updated is reaped beforehand,
which then leads to kernel crash. Reap only entries which won't be
updated.

Fixes kernel bugzilla #207773.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=207773
Reported-by: Reindl Harald <h.reindl@thelounge.net>
Fixes: 0079c5aee348 ("netfilter: xt_recent: add an entry reaper")
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/xt_recent.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 570144507df11..cb58bc7ae30d3 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -155,7 +155,8 @@ static void recent_entry_remove(struct recent_table *t, struct recent_entry *e)
 /*
  * Drop entries with timestamps older then 'time'.
  */
-static void recent_entry_reap(struct recent_table *t, unsigned long time)
+static void recent_entry_reap(struct recent_table *t, unsigned long time,
+			      struct recent_entry *working, bool update)
 {
 	struct recent_entry *e;
 
@@ -164,6 +165,12 @@ static void recent_entry_reap(struct recent_table *t, unsigned long time)
 	 */
 	e = list_entry(t->lru_list.next, struct recent_entry, lru_list);
 
+	/*
+	 * Do not reap the entry which are going to be updated.
+	 */
+	if (e == working && update)
+		return;
+
 	/*
 	 * The last time stamp is the most recent.
 	 */
@@ -306,7 +313,8 @@ recent_mt(const struct sk_buff *skb, struct xt_action_param *par)
 
 		/* info->seconds must be non-zero */
 		if (info->check_set & XT_RECENT_REAP)
-			recent_entry_reap(t, time);
+			recent_entry_reap(t, time, e,
+				info->check_set & XT_RECENT_UPDATE && ret);
 	}
 
 	if (info->check_set & XT_RECENT_SET ||
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 19/50] netfilter: flowtable: fix tcp and udp header checksum update
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 18/50] netfilter: xt_recent: Fix attempt to update deleted entry Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 20/50] xen/netback: avoid race in xenvif_rx_ring_slots_available() Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sven Auhagen, Pablo Neira Ayuso, Sasha Levin

From: Sven Auhagen <sven.auhagen@voleatech.de>

[ Upstream commit 8d6bca156e47d68551750a384b3ff49384c67be3 ]

When updating the tcp or udp header checksum on port nat the function
inet_proto_csum_replace2 with the last parameter pseudohdr as true.
This leads to an error in the case that GRO is used and packets are
split up in GSO. The tcp or udp checksum of all packets is incorrect.

The error is probably masked due to the fact the most network driver
implement tcp/udp checksum offloading. It also only happens when GRO is
applied and not on single packets.

The error is most visible when using a pppoe connection which is not
triggering the tcp/udp checksum offload.

Fixes: ac2a66665e23 ("netfilter: add generic flow table infrastructure")
Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nf_flow_table_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 890799c16aa41..b3957fe7eced2 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -360,7 +360,7 @@ static int nf_flow_nat_port_tcp(struct sk_buff *skb, unsigned int thoff,
 		return -1;
 
 	tcph = (void *)(skb_network_header(skb) + thoff);
-	inet_proto_csum_replace2(&tcph->check, skb, port, new_port, true);
+	inet_proto_csum_replace2(&tcph->check, skb, port, new_port, false);
 
 	return 0;
 }
@@ -377,7 +377,7 @@ static int nf_flow_nat_port_udp(struct sk_buff *skb, unsigned int thoff,
 	udph = (void *)(skb_network_header(skb) + thoff);
 	if (udph->check || skb->ip_summed == CHECKSUM_PARTIAL) {
 		inet_proto_csum_replace2(&udph->check, skb, port,
-					 new_port, true);
+					 new_port, false);
 		if (!udph->check)
 			udph->check = CSUM_MANGLED_0;
 	}
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 20/50] xen/netback: avoid race in xenvif_rx_ring_slots_available()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 19/50] netfilter: flowtable: fix tcp and udp header checksum update Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 21/50] net: stmmac: set TxQ mode back to DCB after disabling CBS Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Igor Druzhinin, Juergen Gross,
	Wei Liu, Jakub Kicinski, Sasha Levin

From: Juergen Gross <jgross@suse.com>

[ Upstream commit ec7d8e7dd3a59528e305a18e93f1cb98f7faf83b ]

Since commit 23025393dbeb3b8b3 ("xen/netback: use lateeoi irq binding")
xenvif_rx_ring_slots_available() is no longer called only from the rx
queue kernel thread, so it needs to access the rx queue with the
associated queue held.

Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Fixes: 23025393dbeb3b8b3 ("xen/netback: use lateeoi irq binding")
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wl@xen.org>
Link: https://lore.kernel.org/r/20210202070938.7863-1-jgross@suse.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/xen-netback/rx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c
index 9b62f65b630e4..48e2006f96ce6 100644
--- a/drivers/net/xen-netback/rx.c
+++ b/drivers/net/xen-netback/rx.c
@@ -38,10 +38,15 @@ static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue)
 	RING_IDX prod, cons;
 	struct sk_buff *skb;
 	int needed;
+	unsigned long flags;
+
+	spin_lock_irqsave(&queue->rx_queue.lock, flags);
 
 	skb = skb_peek(&queue->rx_queue);
-	if (!skb)
+	if (!skb) {
+		spin_unlock_irqrestore(&queue->rx_queue.lock, flags);
 		return false;
+	}
 
 	needed = DIV_ROUND_UP(skb->len, XEN_PAGE_SIZE);
 	if (skb_is_gso(skb))
@@ -49,6 +54,8 @@ static bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue)
 	if (skb->sw_hash)
 		needed++;
 
+	spin_unlock_irqrestore(&queue->rx_queue.lock, flags);
+
 	do {
 		prod = queue->rx.sring->req_prod;
 		cons = queue->rx.req_cons;
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 21/50] net: stmmac: set TxQ mode back to DCB after disabling CBS
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 20/50] xen/netback: avoid race in xenvif_rx_ring_slots_available() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 22/50] netfilter: conntrack: skip identical origin tuple in same zone only Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Vinicius Costa Gomes,
	Mohammad Athari Bin Ismail, Song, Yoong Siang, Jesse Brandeburg,
	Jakub Kicinski, Sasha Levin, Song

From: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>

[ Upstream commit f317e2ea8c88737aa36228167b2292baef3f0430 ]

When disable CBS, mode_to_use parameter is not updated even the operation
mode of Tx Queue is changed to Data Centre Bridging (DCB). Therefore,
when tc_setup_cbs() function is called to re-enable CBS, the operation
mode of Tx Queue remains at DCB, which causing CBS fails to work.

This patch updates the value of mode_to_use parameter to MTL_QUEUE_DCB
after operation mode of Tx Queue is changed to DCB in stmmac_dma_qmode()
callback function.

Fixes: 1f705bc61aee ("net: stmmac: Add support for CBS QDISC")
Suggested-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
Signed-off-by: Song, Yoong Siang <yoong.siang.song@intel.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Link: https://lore.kernel.org/r/1612447396-20351-1-git-send-email-yoong.siang.song@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 37c0bc699cd9c..cc1895a32b9d3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -314,7 +314,12 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
 
 		priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB;
 	} else if (!qopt->enable) {
-		return stmmac_dma_qmode(priv, priv->ioaddr, queue, MTL_QUEUE_DCB);
+		ret = stmmac_dma_qmode(priv, priv->ioaddr, queue,
+				       MTL_QUEUE_DCB);
+		if (ret)
+			return ret;
+
+		priv->plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
 	}
 
 	/* Port Transmit Rate and Speed Divider */
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 22/50] netfilter: conntrack: skip identical origin tuple in same zone only
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 21/50] net: stmmac: set TxQ mode back to DCB after disabling CBS Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 23/50] net: hns3: add a check for queue_id in hclge_reset_vf_queue() Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Florian Westphal, Pablo Neira Ayuso,
	Sasha Levin

From: Florian Westphal <fw@strlen.de>

[ Upstream commit 07998281c268592963e1cd623fe6ab0270b65ae4 ]

The origin skip check needs to re-test the zone. Else, we might skip
a colliding tuple in the reply direction.

This only occurs when using 'directional zones' where origin tuples
reside in different zones but the reply tuples share the same zone.

This causes the new conntrack entry to be dropped at confirmation time
because NAT clash resolution was elided.

Fixes: 4e35c1cb9460240 ("netfilter: nf_nat: skip nat clash resolution for same-origin entries")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/nf_conntrack_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index ad1da6b2fb607..1dceda3c0e759 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1063,7 +1063,8 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
 			 * Let nf_ct_resolve_clash() deal with this later.
 			 */
 			if (nf_ct_tuple_equal(&ignored_conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
-					      &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple))
+					      &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple) &&
+					      nf_ct_zone_equal(ct, zone, IP_CT_DIR_ORIGINAL))
 				continue;
 
 			NF_CT_STAT_INC_ATOMIC(net, found);
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 23/50] net: hns3: add a check for queue_id in hclge_reset_vf_queue()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 22/50] netfilter: conntrack: skip identical origin tuple in same zone only Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 24/50] firmware_loader: align .builtin_fw to 8 Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yufeng Mo, Huazhong Tan,
	David S. Miller, Sasha Levin

From: Yufeng Mo <moyufeng@huawei.com>

[ Upstream commit 67a69f84cab60484f02eb8cbc7a76edffbb28a25 ]

The queue_id is received from vf, if use it directly,
an out-of-bound issue may be caused, so add a check for
this queue_id before using it in hclge_reset_vf_queue().

Fixes: 1a426f8b40fc ("net: hns3: fix the VF queue reset flow error")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index d575dd9a329d9..16ab000454f91 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -5182,12 +5182,19 @@ void hclge_reset_tqp(struct hnae3_handle *handle, u16 queue_id)
 
 void hclge_reset_vf_queue(struct hclge_vport *vport, u16 queue_id)
 {
+	struct hnae3_handle *handle = &vport->nic;
 	struct hclge_dev *hdev = vport->back;
 	int reset_try_times = 0;
 	int reset_status;
 	u16 queue_gid;
 	int ret;
 
+	if (queue_id >= handle->kinfo.num_tqps) {
+		dev_warn(&hdev->pdev->dev, "Invalid vf queue id(%u)\n",
+			 queue_id);
+		return;
+	}
+
 	queue_gid = hclge_covert_handle_qid_global(&vport->nic, queue_id);
 
 	ret = hclge_send_reset_tqp_cmd(hdev, queue_gid, true);
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 24/50] firmware_loader: align .builtin_fw to 8
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 23/50] net: hns3: add a check for queue_id in hclge_reset_vf_queue() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 25/50] i2c: stm32f7: fix configuration of the digital filter Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Fangrui Song, kernel test robot,
	Arnd Bergmann, Nick Desaulniers, Douglas Anderson,
	Nathan Chancellor, Andrew Morton, Linus Torvalds, Sasha Levin

From: Fangrui Song <maskray@google.com>

[ Upstream commit 793f49a87aae24e5bcf92ad98d764153fc936570 ]

arm64 references the start address of .builtin_fw (__start_builtin_fw)
with a pair of R_AARCH64_ADR_PREL_PG_HI21/R_AARCH64_LDST64_ABS_LO12_NC
relocations.  The compiler is allowed to emit the
R_AARCH64_LDST64_ABS_LO12_NC relocation because struct builtin_fw in
include/linux/firmware.h is 8-byte aligned.

The R_AARCH64_LDST64_ABS_LO12_NC relocation requires the address to be a
multiple of 8, which may not be the case if .builtin_fw is empty.
Unconditionally align .builtin_fw to fix the linker error.  32-bit
architectures could use ALIGN(4) but that would add unnecessary
complexity, so just use ALIGN(8).

Link: https://lkml.kernel.org/r/20201208054646.2913063-1-maskray@google.com
Link: https://github.com/ClangBuiltLinux/linux/issues/1204
Fixes: 5658c76 ("firmware: allow firmware files to be built into kernel image")
Signed-off-by: Fangrui Song <maskray@google.com>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/asm-generic/vmlinux.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f65a924a75abd..e71c97c3c25ef 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -363,7 +363,7 @@
 	}								\
 									\
 	/* Built-in firmware blobs */					\
-	.builtin_fw        : AT(ADDR(.builtin_fw) - LOAD_OFFSET) {	\
+	.builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) ALIGN(8) {	\
 		__start_builtin_fw = .;					\
 		KEEP(*(.builtin_fw))					\
 		__end_builtin_fw = .;					\
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 25/50] i2c: stm32f7: fix configuration of the digital filter
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 24/50] firmware_loader: align .builtin_fw to 8 Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 26/50] h8300: fix PREEMPTION build, TI_PRE_COUNT undefined Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alain Volmat, Pierre-Yves MORDRET,
	Wolfram Sang, Sasha Levin

From: Alain Volmat <alain.volmat@foss.st.com>

[ Upstream commit 3d6a3d3a2a7a3a60a824e7c04e95fd50dec57812 ]

The digital filter related computation are present in the driver
however the programming of the filter within the IP is missing.
The maximum value for the DNF is wrong and should be 15 instead of 16.

Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver")

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-stm32f7.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index eb7e533b0dd47..6feafebf85feb 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -49,6 +49,8 @@
 #define STM32F7_I2C_CR1_RXDMAEN			BIT(15)
 #define STM32F7_I2C_CR1_TXDMAEN			BIT(14)
 #define STM32F7_I2C_CR1_ANFOFF			BIT(12)
+#define STM32F7_I2C_CR1_DNF_MASK		GENMASK(11, 8)
+#define STM32F7_I2C_CR1_DNF(n)			(((n) & 0xf) << 8)
 #define STM32F7_I2C_CR1_ERRIE			BIT(7)
 #define STM32F7_I2C_CR1_TCIE			BIT(6)
 #define STM32F7_I2C_CR1_STOPIE			BIT(5)
@@ -147,7 +149,7 @@
 #define STM32F7_I2C_MAX_SLAVE			0x2
 
 #define STM32F7_I2C_DNF_DEFAULT			0
-#define STM32F7_I2C_DNF_MAX			16
+#define STM32F7_I2C_DNF_MAX			15
 
 #define STM32F7_I2C_ANALOG_FILTER_ENABLE	1
 #define STM32F7_I2C_ANALOG_FILTER_DELAY_MIN	50	/* ns */
@@ -645,6 +647,13 @@ static void stm32f7_i2c_hw_config(struct stm32f7_i2c_dev *i2c_dev)
 	else
 		stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1,
 				     STM32F7_I2C_CR1_ANFOFF);
+
+	/* Program the Digital Filter */
+	stm32f7_i2c_clr_bits(i2c_dev->base + STM32F7_I2C_CR1,
+			     STM32F7_I2C_CR1_DNF_MASK);
+	stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1,
+			     STM32F7_I2C_CR1_DNF(i2c_dev->setup.dnf));
+
 	stm32f7_i2c_set_bits(i2c_dev->base + STM32F7_I2C_CR1,
 			     STM32F7_I2C_CR1_PE);
 }
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 26/50] h8300: fix PREEMPTION build, TI_PRE_COUNT undefined
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 25/50] i2c: stm32f7: fix configuration of the digital filter Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 27/50] usb: dwc3: ulpi: fix checkpatch warning Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Randy Dunlap, kernel test robot,
	Yoshinori Sato, Thomas Gleixner, Andrew Morton, Linus Torvalds,
	Sasha Levin

From: Randy Dunlap <rdunlap@infradead.org>

[ Upstream commit ade9679c159d5bbe14fb7e59e97daf6062872e2b ]

Fix a build error for undefined 'TI_PRE_COUNT' by adding it to
asm-offsets.c.

  h8300-linux-ld: arch/h8300/kernel/entry.o: in function `resume_kernel': (.text+0x29a): undefined reference to `TI_PRE_COUNT'

Link: https://lkml.kernel.org/r/20210212021650.22740-1-rdunlap@infradead.org
Fixes: df2078b8daa7 ("h8300: Low level entry")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/h8300/kernel/asm-offsets.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/h8300/kernel/asm-offsets.c b/arch/h8300/kernel/asm-offsets.c
index 85e60509f0a83..d4b53af657c84 100644
--- a/arch/h8300/kernel/asm-offsets.c
+++ b/arch/h8300/kernel/asm-offsets.c
@@ -63,6 +63,9 @@ int main(void)
 	OFFSET(TI_FLAGS, thread_info, flags);
 	OFFSET(TI_CPU, thread_info, cpu);
 	OFFSET(TI_PRE, thread_info, preempt_count);
+#ifdef CONFIG_PREEMPTION
+	DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
+#endif
 
 	return 0;
 }
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 27/50] usb: dwc3: ulpi: fix checkpatch warning
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 26/50] h8300: fix PREEMPTION build, TI_PRE_COUNT undefined Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 28/50] usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Felipe Balbi, Sudip Mukherjee

From: Felipe Balbi <balbi@kernel.org>

commit 2a499b45295206e7f3dc76edadde891c06cc4447 upstream

no functional changes.

Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/dwc3/ulpi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/dwc3/ulpi.c
+++ b/drivers/usb/dwc3/ulpi.c
@@ -19,7 +19,7 @@
 
 static int dwc3_ulpi_busyloop(struct dwc3 *dwc)
 {
-	unsigned count = 1000;
+	unsigned int count = 1000;
 	u32 reg;
 
 	while (count--) {



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 28/50] usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 27/50] usb: dwc3: ulpi: fix checkpatch warning Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 29/50] net: fix iteration for sctp transport seq_files Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Heikki Krogerus, Serge Semin,
	Sudip Mukherjee

From: Serge Semin <Sergey.Semin@baikalelectronics.ru>

commit fca3f138105727c3a22edda32d02f91ce1bf11c9 upstream

Originally the procedure of the ULPI transaction finish detection has been
developed as a simple busy-loop with just decrementing counter and no
delays. It's wrong since on different systems the loop will take a
different time to complete. So if the system bus and CPU are fast enough
to overtake the ULPI bus and the companion PHY reaction, then we'll get to
take a false timeout error. Fix this by converting the busy-loop procedure
to take the standard bus speed, address value and the registers access
mode into account for the busy-loop delay calculation.

Here is the way the fix works. It's known that the ULPI bus is clocked
with 60MHz signal. In accordance with [1] the ULPI bus protocol is created
so to spend 5 and 6 clock periods for immediate register write and read
operations respectively, and 6 and 7 clock periods - for the extended
register writes and reads. Based on that we can easily pre-calculate the
time which will be needed for the controller to perform a requested IO
operation. Note we'll still preserve the attempts counter in case if the
DWC USB3 controller has got some internals delays.

[1] UTMI+ Low Pin Interface (ULPI) Specification, Revision 1.1,
    October 20, 2004, pp. 30 - 36.

Fixes: 88bc9d194ff6 ("usb: dwc3: add ULPI interface support")
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Link: https://lore.kernel.org/r/20201210085008.13264-3-Sergey.Semin@baikalelectronics.ru
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/dwc3/ulpi.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

--- a/drivers/usb/dwc3/ulpi.c
+++ b/drivers/usb/dwc3/ulpi.c
@@ -7,6 +7,8 @@
  * Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
  */
 
+#include <linux/delay.h>
+#include <linux/time64.h>
 #include <linux/ulpi/regs.h>
 
 #include "core.h"
@@ -17,12 +19,22 @@
 		DWC3_GUSB2PHYACC_ADDR(ULPI_ACCESS_EXTENDED) | \
 		DWC3_GUSB2PHYACC_EXTEND_ADDR(a) : DWC3_GUSB2PHYACC_ADDR(a))
 
-static int dwc3_ulpi_busyloop(struct dwc3 *dwc)
+#define DWC3_ULPI_BASE_DELAY	DIV_ROUND_UP(NSEC_PER_SEC, 60000000L)
+
+static int dwc3_ulpi_busyloop(struct dwc3 *dwc, u8 addr, bool read)
 {
+	unsigned long ns = 5L * DWC3_ULPI_BASE_DELAY;
 	unsigned int count = 1000;
 	u32 reg;
 
+	if (addr >= ULPI_EXT_VENDOR_SPECIFIC)
+		ns += DWC3_ULPI_BASE_DELAY;
+
+	if (read)
+		ns += DWC3_ULPI_BASE_DELAY;
+
 	while (count--) {
+		ndelay(ns);
 		reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYACC(0));
 		if (reg & DWC3_GUSB2PHYACC_DONE)
 			return 0;
@@ -47,7 +59,7 @@ static int dwc3_ulpi_read(struct device
 	reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr);
 	dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg);
 
-	ret = dwc3_ulpi_busyloop(dwc);
+	ret = dwc3_ulpi_busyloop(dwc, addr, true);
 	if (ret)
 		return ret;
 
@@ -71,7 +83,7 @@ static int dwc3_ulpi_write(struct device
 	reg |= DWC3_GUSB2PHYACC_WRITE | val;
 	dwc3_writel(dwc->regs, DWC3_GUSB2PHYACC(0), reg);
 
-	return dwc3_ulpi_busyloop(dwc);
+	return dwc3_ulpi_busyloop(dwc, addr, false);
 }
 
 static const struct ulpi_ops dwc3_ulpi_ops = {



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 29/50] net: fix iteration for sctp transport seq_files
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 28/50] usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 30/50] net/vmw_vsock: improve locking in vsock_connect_timeout() Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Xin Long, NeilBrown,
	Marcelo Ricardo Leitner, Jakub Kicinski

From: NeilBrown <neilb@suse.de>

commit af8085f3a4712c57d0dd415ad543bac85780375c upstream.

The sctp transport seq_file iterators take a reference to the transport
in the ->start and ->next functions and releases the reference in the
->show function.  The preferred handling for such resources is to
release them in the subsequent ->next or ->stop function call.

Since Commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration
code and interface") there is no guarantee that ->show will be called
after ->next, so this function can now leak references.

So move the sctp_transport_put() call to ->next and ->stop.

Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
Reported-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sctp/proc.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -230,6 +230,12 @@ static void sctp_transport_seq_stop(stru
 {
 	struct sctp_ht_iter *iter = seq->private;
 
+	if (v && v != SEQ_START_TOKEN) {
+		struct sctp_transport *transport = v;
+
+		sctp_transport_put(transport);
+	}
+
 	sctp_transport_walk_stop(&iter->hti);
 }
 
@@ -237,6 +243,12 @@ static void *sctp_transport_seq_next(str
 {
 	struct sctp_ht_iter *iter = seq->private;
 
+	if (v && v != SEQ_START_TOKEN) {
+		struct sctp_transport *transport = v;
+
+		sctp_transport_put(transport);
+	}
+
 	++*pos;
 
 	return sctp_transport_get_next(seq_file_net(seq), &iter->hti);
@@ -292,8 +304,6 @@ static int sctp_assocs_seq_show(struct s
 		sk->sk_rcvbuf);
 	seq_printf(seq, "\n");
 
-	sctp_transport_put(transport);
-
 	return 0;
 }
 
@@ -369,8 +379,6 @@ static int sctp_remaddr_seq_show(struct
 		seq_printf(seq, "\n");
 	}
 
-	sctp_transport_put(transport);
-
 	return 0;
 }
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 30/50] net/vmw_vsock: improve locking in vsock_connect_timeout()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 29/50] net: fix iteration for sctp transport seq_files Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 31/50] net: watchdog: hold device global xmit lock during tx disable Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric Dumazet, Norbert Slusarek,
	Stefano Garzarella, Jakub Kicinski

From: Norbert Slusarek <nslusarek@gmx.net>

commit 3d0bc44d39bca615b72637e340317b7899b7f911 upstream.

A possible locking issue in vsock_connect_timeout() was recognized by
Eric Dumazet which might cause a null pointer dereference in
vsock_transport_cancel_pkt(). This patch assures that
vsock_transport_cancel_pkt() will be called within the lock, so a race
condition won't occur which could result in vsk->transport to be set to NULL.

Fixes: 380feae0def7 ("vsock: cancel packets when failing to connect")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Norbert Slusarek <nslusarek@gmx.net>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/trinity-f8e0937a-cf0e-4d80-a76e-d9a958ba3ef1-1612535522360@3c-app-gmx-bap12
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/vmw_vsock/af_vsock.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1107,7 +1107,6 @@ static void vsock_connect_timeout(struct
 {
 	struct sock *sk;
 	struct vsock_sock *vsk;
-	int cancel = 0;
 
 	vsk = container_of(work, struct vsock_sock, connect_work.work);
 	sk = sk_vsock(vsk);
@@ -1118,11 +1117,9 @@ static void vsock_connect_timeout(struct
 		sk->sk_state = TCP_CLOSE;
 		sk->sk_err = ETIMEDOUT;
 		sk->sk_error_report(sk);
-		cancel = 1;
+		vsock_transport_cancel_pkt(vsk);
 	}
 	release_sock(sk);
-	if (cancel)
-		vsock_transport_cancel_pkt(vsk);
 
 	sock_put(sk);
 }



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 31/50] net: watchdog: hold device global xmit lock during tx disable
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 30/50] net/vmw_vsock: improve locking in vsock_connect_timeout() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 32/50] vsock/virtio: update credit only if socket is not closed Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Edwin Peer, Jakub Kicinski, David S. Miller

From: Edwin Peer <edwin.peer@broadcom.com>

commit 3aa6bce9af0e25b735c9c1263739a5639a336ae8 upstream.

Prevent netif_tx_disable() running concurrently with dev_watchdog() by
taking the device global xmit lock. Otherwise, the recommended:

	netif_carrier_off(dev);
	netif_tx_disable(dev);

driver shutdown sequence can happen after the watchdog has already
checked carrier, resulting in possible false alarms. This is because
netif_tx_lock() only sets the frozen bit without maintaining the locks
on the individual queues.

Fixes: c3f26a269c24 ("netdev: Fix lockdep warnings in multiqueue configurations.")
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/netdevice.h |    2 ++
 1 file changed, 2 insertions(+)

--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3966,6 +3966,7 @@ static inline void netif_tx_disable(stru
 
 	local_bh_disable();
 	cpu = smp_processor_id();
+	spin_lock(&dev->tx_global_lock);
 	for (i = 0; i < dev->num_tx_queues; i++) {
 		struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
 
@@ -3973,6 +3974,7 @@ static inline void netif_tx_disable(stru
 		netif_tx_stop_queue(txq);
 		__netif_tx_unlock(txq);
 	}
+	spin_unlock(&dev->tx_global_lock);
 	local_bh_enable();
 }
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 32/50] vsock/virtio: update credit only if socket is not closed
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 31/50] net: watchdog: hold device global xmit lock during tx disable Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 33/50] vsock: fix locking in vsock_shutdown() Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stefano Garzarella,
	Michael S. Tsirkin, Jakub Kicinski

From: Stefano Garzarella <sgarzare@redhat.com>

commit ce7536bc7398e2ae552d2fabb7e0e371a9f1fe46 upstream.

If the socket is closed or is being released, some resources used by
virtio_transport_space_update() such as 'vsk->trans' may be released.

To avoid a use after free bug we should only update the available credit
when we are sure the socket is still open and we have the lock held.

Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20210208144454.84438-1-sgarzare@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/vmw_vsock/virtio_transport_common.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -1033,10 +1033,10 @@ void virtio_transport_recv_pkt(struct vi
 
 	vsk = vsock_sk(sk);
 
-	space_available = virtio_transport_space_update(sk, pkt);
-
 	lock_sock(sk);
 
+	space_available = virtio_transport_space_update(sk, pkt);
+
 	/* Update CID in case it has changed after a transport reset event */
 	vsk->local_addr.svm_cid = dst.svm_cid;
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 33/50] vsock: fix locking in vsock_shutdown()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 32/50] vsock/virtio: update credit only if socket is not closed Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 34/50] net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stefano Garzarella, David S. Miller

From: Stefano Garzarella <sgarzare@redhat.com>

commit 1c5fae9c9a092574398a17facc31c533791ef232 upstream.

In vsock_shutdown() we touched some socket fields without holding the
socket lock, such as 'state' and 'sk_flags'.

Also, after the introduction of multi-transport, we are accessing
'vsk->transport' in vsock_send_shutdown() without holding the lock
and this call can be made while the connection is in progress, so
the transport can change in the meantime.

To avoid issues, we hold the socket lock when we enter in
vsock_shutdown() and release it when we leave.

Among the transports that implement the 'shutdown' callback, only
hyperv_transport acquired the lock. Since the caller now holds it,
we no longer take it.

Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/vmw_vsock/af_vsock.c         |    8 +++++---
 net/vmw_vsock/hyperv_transport.c |    4 ----
 2 files changed, 5 insertions(+), 7 deletions(-)

--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -816,10 +816,12 @@ static int vsock_shutdown(struct socket
 	 */
 
 	sk = sock->sk;
+
+	lock_sock(sk);
 	if (sock->state == SS_UNCONNECTED) {
 		err = -ENOTCONN;
 		if (sk->sk_type == SOCK_STREAM)
-			return err;
+			goto out;
 	} else {
 		sock->state = SS_DISCONNECTING;
 		err = 0;
@@ -828,10 +830,8 @@ static int vsock_shutdown(struct socket
 	/* Receive and send shutdowns are treated alike. */
 	mode = mode & (RCV_SHUTDOWN | SEND_SHUTDOWN);
 	if (mode) {
-		lock_sock(sk);
 		sk->sk_shutdown |= mode;
 		sk->sk_state_change(sk);
-		release_sock(sk);
 
 		if (sk->sk_type == SOCK_STREAM) {
 			sock_reset_flag(sk, SOCK_DONE);
@@ -839,6 +839,8 @@ static int vsock_shutdown(struct socket
 		}
 	}
 
+out:
+	release_sock(sk);
 	return err;
 }
 
--- a/net/vmw_vsock/hyperv_transport.c
+++ b/net/vmw_vsock/hyperv_transport.c
@@ -443,14 +443,10 @@ static void hvs_shutdown_lock_held(struc
 
 static int hvs_shutdown(struct vsock_sock *vsk, int mode)
 {
-	struct sock *sk = sk_vsock(vsk);
-
 	if (!(mode & SEND_SHUTDOWN))
 		return 0;
 
-	lock_sock(sk);
 	hvs_shutdown_lock_held(vsk->trans, mode);
-	release_sock(sk);
 	return 0;
 }
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 34/50] net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 33/50] vsock: fix locking in vsock_shutdown() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 35/50] net/qrtr: restrict user-controlled length in qrtr_tun_write_iter() Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+1bd2b07f93745fa38425,
	Sabyrzhan Tasbolatov, Santosh Shilimkar, Jakub Kicinski

From: Sabyrzhan Tasbolatov <snovitoll@gmail.com>

commit a11148e6fcce2ae53f47f0a442d098d860b4f7db upstream.

syzbot found WARNING in rds_rdma_extra_size [1] when RDS_CMSG_RDMA_ARGS
control message is passed with user-controlled
0x40001 bytes of args->nr_local, causing order >= MAX_ORDER condition.

The exact value 0x40001 can be checked with UIO_MAXIOV which is 0x400.
So for kcalloc() 0x400 iovecs with sizeof(struct rds_iovec) = 0x10
is the closest limit, with 0x10 leftover.

Same condition is currently done in rds_cmsg_rdma_args().

[1] WARNING: mm/page_alloc.c:5011
[..]
Call Trace:
 alloc_pages_current+0x18c/0x2a0 mm/mempolicy.c:2267
 alloc_pages include/linux/gfp.h:547 [inline]
 kmalloc_order+0x2e/0xb0 mm/slab_common.c:837
 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:853
 kmalloc_array include/linux/slab.h:592 [inline]
 kcalloc include/linux/slab.h:621 [inline]
 rds_rdma_extra_size+0xb2/0x3b0 net/rds/rdma.c:568
 rds_rm_size net/rds/send.c:928 [inline]

Reported-by: syzbot+1bd2b07f93745fa38425@syzkaller.appspotmail.com
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Link: https://lore.kernel.org/r/20210201203233.1324704-1-snovitoll@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/rds/rdma.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -531,6 +531,9 @@ int rds_rdma_extra_size(struct rds_rdma_
 	if (args->nr_local == 0)
 		return -EINVAL;
 
+	if (args->nr_local > UIO_MAXIOV)
+		return -EMSGSIZE;
+
 	iov->iov = kcalloc(args->nr_local,
 			   sizeof(struct rds_iovec),
 			   GFP_KERNEL);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 35/50] net/qrtr: restrict user-controlled length in qrtr_tun_write_iter()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 34/50] net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 36/50] ovl: expand warning in ovl_d_real() Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, syzbot+c2a7e5c5211605a90865,
	Sabyrzhan Tasbolatov, Jakub Kicinski

From: Sabyrzhan Tasbolatov <snovitoll@gmail.com>

commit 2a80c15812372e554474b1dba0b1d8e467af295d upstream.

syzbot found WARNING in qrtr_tun_write_iter [1] when write_iter length
exceeds KMALLOC_MAX_SIZE causing order >= MAX_ORDER condition.

Additionally, there is no check for 0 length write.

[1]
WARNING: mm/page_alloc.c:5011
[..]
Call Trace:
 alloc_pages_current+0x18c/0x2a0 mm/mempolicy.c:2267
 alloc_pages include/linux/gfp.h:547 [inline]
 kmalloc_order+0x2e/0xb0 mm/slab_common.c:837
 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:853
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:682 [inline]
 qrtr_tun_write_iter+0x8a/0x180 net/qrtr/tun.c:83
 call_write_iter include/linux/fs.h:1901 [inline]

Reported-by: syzbot+c2a7e5c5211605a90865@syzkaller.appspotmail.com
Signed-off-by: Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Link: https://lore.kernel.org/r/20210202092059.1361381-1-snovitoll@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/qrtr/tun.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/net/qrtr/tun.c
+++ b/net/qrtr/tun.c
@@ -80,6 +80,12 @@ static ssize_t qrtr_tun_write_iter(struc
 	ssize_t ret;
 	void *kbuf;
 
+	if (!len)
+		return -EINVAL;
+
+	if (len > KMALLOC_MAX_SIZE)
+		return -ENOMEM;
+
 	kbuf = kzalloc(len, GFP_KERNEL);
 	if (!kbuf)
 		return -ENOMEM;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 36/50] ovl: expand warning in ovl_d_real()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 35/50] net/qrtr: restrict user-controlled length in qrtr_tun_write_iter() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 37/50] x86/build: Disable CET instrumentation in the kernel for 32-bit too Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Miklos Szeredi

From: Miklos Szeredi <mszeredi@redhat.com>

commit cef4cbff06fbc3be54d6d79ee139edecc2ee8598 upstream.

There was a syzbot report with this warning but insufficient information...

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/overlayfs/super.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -82,7 +82,7 @@ static void ovl_dentry_release(struct de
 static struct dentry *ovl_d_real(struct dentry *dentry,
 				 const struct inode *inode)
 {
-	struct dentry *real;
+	struct dentry *real = NULL, *lower;
 
 	/* It's an overlay file */
 	if (inode && d_inode(dentry) == inode)
@@ -101,9 +101,10 @@ static struct dentry *ovl_d_real(struct
 	if (real && !inode && ovl_has_upperdata(d_inode(dentry)))
 		return real;
 
-	real = ovl_dentry_lowerdata(dentry);
-	if (!real)
+	lower = ovl_dentry_lowerdata(dentry);
+	if (!lower)
 		goto bug;
+	real = lower;
 
 	/* Handle recursion */
 	real = d_real(real, inode);
@@ -111,8 +112,10 @@ static struct dentry *ovl_d_real(struct
 	if (!inode || inode == d_inode(real))
 		return real;
 bug:
-	WARN(1, "ovl_d_real(%pd4, %s:%lu): real dentry not found\n", dentry,
-	     inode ? inode->i_sb->s_id : "NULL", inode ? inode->i_ino : 0);
+	WARN(1, "%s(%pd4, %s:%lu): real dentry (%p/%lu) not found\n",
+	     __func__, dentry, inode ? inode->i_sb->s_id : "NULL",
+	     inode ? inode->i_ino : 0, real,
+	     real && d_inode(real) ? d_inode(real)->i_ino : 0);
 	return dentry;
 }
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 37/50] x86/build: Disable CET instrumentation in the kernel for 32-bit too
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 36/50] ovl: expand warning in ovl_d_real() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 38/50] KVM: SEV: fix double locking due to incorrect backport Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, AC, Borislav Petkov, Josh Poimboeuf

From: Borislav Petkov <bp@suse.de>

commit 256b92af784d5043eeb7d559b6d5963dcc2ecb10 upstream.

Commit

  20bf2b378729 ("x86/build: Disable CET instrumentation in the kernel")

disabled CET instrumentation which gets added by default by the Ubuntu
gcc9 and 10 by default, but did that only for 64-bit builds. It would
still fail when building a 32-bit target. So disable CET for all x86
builds.

Fixes: 20bf2b378729 ("x86/build: Disable CET instrumentation in the kernel")
Reported-by: AC <achirvasub@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: AC <achirvasub@gmail.com>
Link: https://lkml.kernel.org/r/YCCIgMHkzh/xT4ex@arch-chirva.localdomain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/Makefile |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -61,6 +61,9 @@ endif
 KBUILD_CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
 KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
 
+# Intel CET isn't enabled in the kernel
+KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
+
 ifeq ($(CONFIG_X86_32),y)
         BITS := 32
         UTS_MACHINE := i386
@@ -132,9 +135,6 @@ else
         KBUILD_CFLAGS += -mno-red-zone
         KBUILD_CFLAGS += -mcmodel=kernel
 
-	# Intel CET isn't enabled in the kernel
-	KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
-
         # -funit-at-a-time shrinks the kernel .text considerably
         # unfortunately it makes reading oopses harder.
         KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 38/50] KVM: SEV: fix double locking due to incorrect backport
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 37/50] x86/build: Disable CET instrumentation in the kernel for 32-bit too Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 39/50] net: qrtr: Fix port ID for control messages Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dov Murik, Paolo Bonzini, Sasha Levin

From: Paolo Bonzini <pbonzini@redhat.com>

Fix an incorrect line in the 5.4.y and 4.19.y backports of commit
19a23da53932bc ("Fix unsynchronized access to sev members through
svm_register_enc_region"), first applied to 5.4.98 and 4.19.176.

Fixes: 1e80fdc09d12 ("KVM: SVM: Pin guest memory when SEV is active")
Reported-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org # 5.4.x
Cc: stable@vger.kernel.org # 4.19.x
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/kvm/svm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index b34d11f22213f..8cb9277aa6ff2 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -7097,7 +7097,6 @@ static int svm_register_enc_region(struct kvm *kvm,
 	region->uaddr = range->addr;
 	region->size = range->size;
 
-	mutex_lock(&kvm->lock);
 	list_add_tail(&region->list, &sev->regions_list);
 	mutex_unlock(&kvm->lock);
 
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 39/50] net: qrtr: Fix port ID for control messages
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 38/50] KVM: SEV: fix double locking due to incorrect backport Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 40/50] Xen/x86: dont bail early from clear_foreign_p2m_mapping() Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Loic Poulain, Jakub Kicinski, Sasha Levin

From: Loic Poulain <loic.poulain@linaro.org>

[ Upstream commit ae068f561baa003d260475c3e441ca454b186726 ]

The port ID for control messages was uncorrectly set with broadcast
node ID value, causing message to be dropped on remote side since
not passing packet filtering (cb->dst_port != QRTR_PORT_CTRL).

Fixes: d27e77a3de28 ("net: qrtr: Reset the node and port ID of broadcast messages")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/qrtr/qrtr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index a05c5cb3429c0..69cf9cbbb05f6 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -194,7 +194,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
 	hdr->src_port_id = cpu_to_le32(from->sq_port);
 	if (to->sq_port == QRTR_PORT_CTRL) {
 		hdr->dst_node_id = cpu_to_le32(node->nid);
-		hdr->dst_port_id = cpu_to_le32(QRTR_NODE_BCAST);
+		hdr->dst_port_id = cpu_to_le32(QRTR_PORT_CTRL);
 	} else {
 		hdr->dst_node_id = cpu_to_le32(to->sq_node);
 		hdr->dst_port_id = cpu_to_le32(to->sq_port);
-- 
2.27.0




^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 4.19 40/50] Xen/x86: dont bail early from clear_foreign_p2m_mapping()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 39/50] net: qrtr: Fix port ID for control messages Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 41/50] Xen/x86: also check kernel mapping in set_foreign_p2m_mapping() Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jan Beulich, Juergen Gross

From: Jan Beulich <jbeulich@suse.com>

commit a35f2ef3b7376bfd0a57f7844bd7454389aae1fc upstream.

Its sibling (set_foreign_p2m_mapping()) as well as the sibling of its
only caller (gnttab_map_refs()) don't clean up after themselves in case
of error. Higher level callers are expected to do so. However, in order
for that to really clean up any partially set up state, the operation
should not terminate upon encountering an entry in unexpected state. It
is particularly relevant to notice here that set_foreign_p2m_mapping()
would skip setting up a p2m entry if its grant mapping failed, but it
would continue to set up further p2m entries as long as their mappings
succeeded.

Arguably down the road set_foreign_p2m_mapping() may want its page state
related WARN_ON() also converted to an error return.

This is part of XSA-361.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/xen/p2m.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -746,17 +746,15 @@ int clear_foreign_p2m_mapping(struct gnt
 		unsigned long mfn = __pfn_to_mfn(page_to_pfn(pages[i]));
 		unsigned long pfn = page_to_pfn(pages[i]);
 
-		if (mfn == INVALID_P2M_ENTRY || !(mfn & FOREIGN_FRAME_BIT)) {
+		if (mfn != INVALID_P2M_ENTRY && (mfn & FOREIGN_FRAME_BIT))
+			set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
+		else
 			ret = -EINVAL;
-			goto out;
-		}
-
-		set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
 	}
 	if (kunmap_ops)
 		ret = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
-						kunmap_ops, count);
-out:
+						kunmap_ops, count) ?: ret;
+
 	return ret;
 }
 EXPORT_SYMBOL_GPL(clear_foreign_p2m_mapping);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 41/50] Xen/x86: also check kernel mapping in set_foreign_p2m_mapping()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 40/50] Xen/x86: dont bail early from clear_foreign_p2m_mapping() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 42/50] Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages() Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jan Beulich, Juergen Gross

From: Jan Beulich <jbeulich@suse.com>

commit b512e1b077e5ccdbd6e225b15d934ab12453b70a upstream.

We should not set up further state if either mapping failed; paying
attention to just the user mapping's status isn't enough.

Also use GNTST_okay instead of implying its value (zero).

This is part of XSA-361.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/xen/p2m.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -708,7 +708,8 @@ int set_foreign_p2m_mapping(struct gntta
 		unsigned long mfn, pfn;
 
 		/* Do not add to override if the map failed. */
-		if (map_ops[i].status)
+		if (map_ops[i].status != GNTST_okay ||
+		    (kmap_ops && kmap_ops[i].status != GNTST_okay))
 			continue;
 
 		if (map_ops[i].flags & GNTMAP_contains_pte) {



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 42/50] Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 41/50] Xen/x86: also check kernel mapping in set_foreign_p2m_mapping() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 43/50] Xen/gntdev: correct error checking " Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jan Beulich, Stefano Stabellini,
	Juergen Gross

From: Jan Beulich <jbeulich@suse.com>

commit dbe5283605b3bc12ca45def09cc721a0a5c853a2 upstream.

We may not skip setting the field in the unmap structure when
GNTMAP_device_map is in use - such an unmap would fail to release the
respective resources (a page ref in the hypervisor). Otoh the field
doesn't need setting at all when GNTMAP_device_map is not in use.

To record the value for unmapping, we also better don't use our local
p2m: In particular after a subsequent change it may not have got updated
for all the batch elements. Instead it can simply be taken from the
respective map's results.

We can additionally avoid playing this game altogether for the kernel
part of the mappings in (x86) PV mode.

This is part of XSA-361.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/xen/gntdev.c |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -323,18 +323,25 @@ int gntdev_map_grant_pages(struct gntdev
 		 * to the kernel linear addresses of the struct pages.
 		 * These ptes are completely different from the user ptes dealt
 		 * with find_grant_ptes.
+		 * Note that GNTMAP_device_map isn't needed here: The
+		 * dev_bus_addr output field gets consumed only from ->map_ops,
+		 * and by not requesting it when mapping we also avoid needing
+		 * to mirror dev_bus_addr into ->unmap_ops (and holding an extra
+		 * reference to the page in the hypervisor).
 		 */
+		unsigned int flags = (map->flags & ~GNTMAP_device_map) |
+				     GNTMAP_host_map;
+
 		for (i = 0; i < map->count; i++) {
 			unsigned long address = (unsigned long)
 				pfn_to_kaddr(page_to_pfn(map->pages[i]));
 			BUG_ON(PageHighMem(map->pages[i]));
 
-			gnttab_set_map_op(&map->kmap_ops[i], address,
-				map->flags | GNTMAP_host_map,
+			gnttab_set_map_op(&map->kmap_ops[i], address, flags,
 				map->grants[i].ref,
 				map->grants[i].domid);
 			gnttab_set_unmap_op(&map->kunmap_ops[i], address,
-				map->flags | GNTMAP_host_map, -1);
+				flags, -1);
 		}
 	}
 
@@ -350,17 +357,12 @@ int gntdev_map_grant_pages(struct gntdev
 			continue;
 		}
 
+		if (map->flags & GNTMAP_device_map)
+			map->unmap_ops[i].dev_bus_addr = map->map_ops[i].dev_bus_addr;
+
 		map->unmap_ops[i].handle = map->map_ops[i].handle;
 		if (use_ptemod)
 			map->kunmap_ops[i].handle = map->kmap_ops[i].handle;
-#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
-		else if (map->dma_vaddr) {
-			unsigned long bfn;
-
-			bfn = pfn_to_bfn(page_to_pfn(map->pages[i]));
-			map->unmap_ops[i].dev_bus_addr = __pfn_to_phys(bfn);
-		}
-#endif
 	}
 	return err;
 }



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 43/50] Xen/gntdev: correct error checking in gntdev_map_grant_pages()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 42/50] Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 44/50] xen/arm: dont ignore return errors from set_phys_to_machine Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jan Beulich, Juergen Gross

From: Jan Beulich <jbeulich@suse.com>

commit ebee0eab08594b2bd5db716288a4f1ae5936e9bc upstream.

Failure of the kernel part of the mapping operation should also be
indicated as an error to the caller, or else it may assume the
respective kernel VA is okay to access.

Furthermore gnttab_map_refs() failing still requires recording
successfully mapped handles, so they can be unmapped subsequently. This
in turn requires there to be a way to tell full hypercall failure from
partial success - preset map_op status fields such that they won't
"happen" to look as if the operation succeeded.

Also again use GNTST_okay instead of implying its value (zero).

This is part of XSA-361.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/xen/gntdev.c      |   17 +++++++++--------
 include/xen/grant_table.h |    1 +
 2 files changed, 10 insertions(+), 8 deletions(-)

--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -348,21 +348,22 @@ int gntdev_map_grant_pages(struct gntdev
 	pr_debug("map %d+%d\n", map->index, map->count);
 	err = gnttab_map_refs(map->map_ops, use_ptemod ? map->kmap_ops : NULL,
 			map->pages, map->count);
-	if (err)
-		return err;
 
 	for (i = 0; i < map->count; i++) {
-		if (map->map_ops[i].status) {
+		if (map->map_ops[i].status == GNTST_okay)
+			map->unmap_ops[i].handle = map->map_ops[i].handle;
+		else if (!err)
 			err = -EINVAL;
-			continue;
-		}
 
 		if (map->flags & GNTMAP_device_map)
 			map->unmap_ops[i].dev_bus_addr = map->map_ops[i].dev_bus_addr;
 
-		map->unmap_ops[i].handle = map->map_ops[i].handle;
-		if (use_ptemod)
-			map->kunmap_ops[i].handle = map->kmap_ops[i].handle;
+		if (use_ptemod) {
+			if (map->kmap_ops[i].status == GNTST_okay)
+				map->kunmap_ops[i].handle = map->kmap_ops[i].handle;
+			else if (!err)
+				err = -EINVAL;
+		}
 	}
 	return err;
 }
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -157,6 +157,7 @@ gnttab_set_map_op(struct gnttab_map_gran
 	map->flags = flags;
 	map->ref = ref;
 	map->dom = domid;
+	map->status = 1; /* arbitrary positive value */
 }
 
 static inline void



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 44/50] xen/arm: dont ignore return errors from set_phys_to_machine
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 43/50] Xen/gntdev: correct error checking " Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 45/50] xen-blkback: dont "handle" error by BUG() Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stefano Stabellini, Julien Grall,
	Juergen Gross

From: Stefano Stabellini <stefano.stabellini@xilinx.com>

commit 36bf1dfb8b266e089afa9b7b984217f17027bf35 upstream.

set_phys_to_machine can fail due to lack of memory, see the kzalloc call
in arch/arm/xen/p2m.c:__set_phys_to_machine_multi.

Don't ignore the potential return error in set_foreign_p2m_mapping,
returning it to the caller instead.

This is part of XSA-361.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Cc: stable@vger.kernel.org
Reviewed-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/xen/p2m.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -93,8 +93,10 @@ int set_foreign_p2m_mapping(struct gntta
 	for (i = 0; i < count; i++) {
 		if (map_ops[i].status)
 			continue;
-		set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
-				    map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT);
+		if (unlikely(!set_phys_to_machine(map_ops[i].host_addr >> XEN_PAGE_SHIFT,
+				    map_ops[i].dev_bus_addr >> XEN_PAGE_SHIFT))) {
+			return -ENOMEM;
+		}
 	}
 
 	return 0;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 45/50] xen-blkback: dont "handle" error by BUG()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 44/50] xen/arm: dont ignore return errors from set_phys_to_machine Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 46/50] xen-netback: " Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jan Beulich, Juergen Gross

From: Jan Beulich <jbeulich@suse.com>

commit 5a264285ed1cd32e26d9de4f3c8c6855e467fd63 upstream.

In particular -ENOMEM may come back here, from set_foreign_p2m_mapping().
Don't make problems worse, the more that handling elsewhere (together
with map's status fields now indicating whether a mapping wasn't even
attempted, and hence has to be considered failed) doesn't require this
odd way of dealing with errors.

This is part of XSA-362.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/block/xen-blkback/blkback.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -867,10 +867,8 @@ again:
 			break;
 	}
 
-	if (segs_to_map) {
+	if (segs_to_map)
 		ret = gnttab_map_refs(map, NULL, pages_to_gnt, segs_to_map);
-		BUG_ON(ret);
-	}
 
 	/*
 	 * Now swizzle the MFN in our domain with the MFN from the other domain
@@ -885,7 +883,7 @@ again:
 				pr_debug("invalid buffer -- could not remap it\n");
 				put_free_pages(ring, &pages[seg_idx]->page, 1);
 				pages[seg_idx]->handle = BLKBACK_INVALID_HANDLE;
-				ret |= 1;
+				ret |= !ret;
 				goto next;
 			}
 			pages[seg_idx]->handle = map[new_map_idx].handle;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 46/50] xen-netback: dont "handle" error by BUG()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 45/50] xen-blkback: dont "handle" error by BUG() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 47/50] xen-scsiback: " Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jan Beulich, Juergen Gross

From: Jan Beulich <jbeulich@suse.com>

commit 3194a1746e8aabe86075fd3c5e7cf1f4632d7f16 upstream.

In particular -ENOMEM may come back here, from set_foreign_p2m_mapping().
Don't make problems worse, the more that handling elsewhere (together
with map's status fields now indicating whether a mapping wasn't even
attempted, and hence has to be considered failed) doesn't require this
odd way of dealing with errors.

This is part of XSA-362.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/xen-netback/netback.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1326,13 +1326,11 @@ int xenvif_tx_action(struct xenvif_queue
 		return 0;
 
 	gnttab_batch_copy(queue->tx_copy_ops, nr_cops);
-	if (nr_mops != 0) {
+	if (nr_mops != 0)
 		ret = gnttab_map_refs(queue->tx_map_ops,
 				      NULL,
 				      queue->pages_to_map,
 				      nr_mops);
-		BUG_ON(ret);
-	}
 
 	work_done = xenvif_tx_submit(queue);
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 47/50] xen-scsiback: dont "handle" error by BUG()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 46/50] xen-netback: " Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 48/50] xen-blkback: fix error handling in xen_blkbk_map() Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jan Beulich, Juergen Gross

From: Jan Beulich <jbeulich@suse.com>

commit 7c77474b2d22176d2bfb592ec74e0f2cb71352c9 upstream.

In particular -ENOMEM may come back here, from set_foreign_p2m_mapping().
Don't make problems worse, the more that handling elsewhere (together
with map's status fields now indicating whether a mapping wasn't even
attempted, and hence has to be considered failed) doesn't require this
odd way of dealing with errors.

This is part of XSA-362.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: stable@vger.kernel.org
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/xen/xen-scsiback.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -422,12 +422,12 @@ static int scsiback_gnttab_data_map_batc
 		return 0;
 
 	err = gnttab_map_refs(map, NULL, pg, cnt);
-	BUG_ON(err);
 	for (i = 0; i < cnt; i++) {
 		if (unlikely(map[i].status != GNTST_okay)) {
 			pr_err("invalid buffer -- could not remap it\n");
 			map[i].handle = SCSIBACK_INVALID_HANDLE;
-			err = -ENOMEM;
+			if (!err)
+				err = -ENOMEM;
 		} else {
 			get_page(pg[i]);
 		}



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 48/50] xen-blkback: fix error handling in xen_blkbk_map()
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 47/50] xen-scsiback: " Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 49/50] scsi: qla2xxx: Fix crash during driver load on big endian machines Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jan Beulich, Juergen Gross, Julien Grall

From: Jan Beulich <jbeulich@suse.com>

commit 871997bc9e423f05c7da7c9178e62dde5df2a7f8 upstream.

The function uses a goto-based loop, which may lead to an earlier error
getting discarded by a later iteration. Exit this ad-hoc loop when an
error was encountered.

The out-of-memory error path additionally fails to fill a structure
field looked at by xen_blkbk_unmap_prepare() before inspecting the
handle which does get properly set (to BLKBACK_INVALID_HANDLE).

Since the earlier exiting from the ad-hoc loop requires the same field
filling (invalidation) as that on the out-of-memory path, fold both
paths. While doing so, drop the pr_alert(), as extra log messages aren't
going to help the situation (the kernel will log oom conditions already
anyway).

This is XSA-365.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <julien@xen.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/block/xen-blkback/blkback.c |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -850,8 +850,11 @@ again:
 			pages[i]->page = persistent_gnt->page;
 			pages[i]->persistent_gnt = persistent_gnt;
 		} else {
-			if (get_free_page(ring, &pages[i]->page))
-				goto out_of_memory;
+			if (get_free_page(ring, &pages[i]->page)) {
+				put_free_pages(ring, pages_to_gnt, segs_to_map);
+				ret = -ENOMEM;
+				goto out;
+			}
 			addr = vaddr(pages[i]->page);
 			pages_to_gnt[segs_to_map] = pages[i]->page;
 			pages[i]->persistent_gnt = NULL;
@@ -935,17 +938,18 @@ next:
 	}
 	segs_to_map = 0;
 	last_map = map_until;
-	if (map_until != num)
+	if (!ret && map_until != num)
 		goto again;
 
-	return ret;
-
-out_of_memory:
-	pr_alert("%s: out of memory\n", __func__);
-	put_free_pages(ring, pages_to_gnt, segs_to_map);
-	for (i = last_map; i < num; i++)
+out:
+	for (i = last_map; i < num; i++) {
+		/* Don't zap current batch's valid persistent grants. */
+		if(i >= last_map + segs_to_map)
+			pages[i]->persistent_gnt = NULL;
 		pages[i]->handle = BLKBACK_INVALID_HANDLE;
-	return -ENOMEM;
+	}
+
+	return ret;
 }
 
 static int xen_blkbk_map_seg(struct pending_req *pending_req)



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 49/50] scsi: qla2xxx: Fix crash during driver load on big endian machines
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 48/50] xen-blkback: fix error handling in xen_blkbk_map() Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 12:13 ` [PATCH 4.19 50/50] kvm: check tlbs_dirty directly Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Himanshu Madhani, Arun Easi,
	Nilesh Javali, Martin K. Petersen, Sudip Mukherjee

From: Arun Easi <aeasi@marvell.com>

commit 8de309e7299a00b3045fb274f82b326f356404f0 upstream

Crash stack:
	[576544.715489] Unable to handle kernel paging request for data at address 0xd00000000f970000
	[576544.715497] Faulting instruction address: 0xd00000000f880f64
	[576544.715503] Oops: Kernel access of bad area, sig: 11 [#1]
	[576544.715506] SMP NR_CPUS=2048 NUMA pSeries
	:
	[576544.715703] NIP [d00000000f880f64] .qla27xx_fwdt_template_valid+0x94/0x100 [qla2xxx]
	[576544.715722] LR [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx]
	[576544.715726] Call Trace:
	[576544.715731] [c0000004d0ffb000] [c0000006fe02c350] 0xc0000006fe02c350 (unreliable)
	[576544.715750] [c0000004d0ffb080] [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx]
	[576544.715770] [c0000004d0ffb170] [d00000000f7aa034] .qla81xx_load_risc+0x84/0x1a0 [qla2xxx]
	[576544.715789] [c0000004d0ffb210] [d00000000f79f7c8] .qla2x00_setup_chip+0xc8/0x910 [qla2xxx]
	[576544.715808] [c0000004d0ffb300] [d00000000f7a631c] .qla2x00_initialize_adapter+0x4dc/0xb00 [qla2xxx]
	[576544.715826] [c0000004d0ffb3e0] [d00000000f78ce28] .qla2x00_probe_one+0xf08/0x2200 [qla2xxx]

Link: https://lore.kernel.org/r/20201202132312.19966-8-njavali@marvell.com
Fixes: f73cb695d3ec ("[SCSI] qla2xxx: Add support for ISP2071.")
Cc: stable@vger.kernel.org
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/qla2xxx/qla_tmpl.c |    9 +++++----
 drivers/scsi/qla2xxx/qla_tmpl.h |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -940,7 +940,8 @@ qla27xx_template_checksum(void *p, ulong
 static inline int
 qla27xx_verify_template_checksum(struct qla27xx_fwdt_template *tmp)
 {
-	return qla27xx_template_checksum(tmp, tmp->template_size) == 0;
+	return qla27xx_template_checksum(tmp,
+		le32_to_cpu(tmp->template_size)) == 0;
 }
 
 static inline int
@@ -956,7 +957,7 @@ qla27xx_execute_fwdt_template(struct scs
 	ulong len;
 
 	if (qla27xx_fwdt_template_valid(tmp)) {
-		len = tmp->template_size;
+		len = le32_to_cpu(tmp->template_size);
 		tmp = memcpy(vha->hw->fw_dump, tmp, len);
 		ql27xx_edit_template(vha, tmp);
 		qla27xx_walk_template(vha, tmp, tmp, &len);
@@ -972,7 +973,7 @@ qla27xx_fwdt_calculate_dump_size(struct
 	ulong len = 0;
 
 	if (qla27xx_fwdt_template_valid(tmp)) {
-		len = tmp->template_size;
+		len = le32_to_cpu(tmp->template_size);
 		qla27xx_walk_template(vha, tmp, NULL, &len);
 	}
 
@@ -984,7 +985,7 @@ qla27xx_fwdt_template_size(void *p)
 {
 	struct qla27xx_fwdt_template *tmp = p;
 
-	return tmp->template_size;
+	return le32_to_cpu(tmp->template_size);
 }
 
 ulong
--- a/drivers/scsi/qla2xxx/qla_tmpl.h
+++ b/drivers/scsi/qla2xxx/qla_tmpl.h
@@ -13,7 +13,7 @@
 struct __packed qla27xx_fwdt_template {
 	uint32_t template_type;
 	uint32_t entry_offset;
-	uint32_t template_size;
+	__le32 template_size;
 	uint32_t reserved_1;
 
 	uint32_t entry_count;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 4.19 50/50] kvm: check tlbs_dirty directly
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 49/50] scsi: qla2xxx: Fix crash during driver load on big endian machines Greg Kroah-Hartman
@ 2021-02-22 12:13 ` Greg Kroah-Hartman
  2021-02-22 18:40 ` [PATCH 4.19 00/50] 4.19.177-rc1 review Pavel Machek
                   ` (4 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-22 12:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lai Jiangshan, Paolo Bonzini,
	Sudip Mukherjee

From: Lai Jiangshan <laijs@linux.alibaba.com>

commit 88bf56d04bc3564542049ec4ec168a8b60d0b48c upstream

In kvm_mmu_notifier_invalidate_range_start(), tlbs_dirty is used as:
        need_tlb_flush |= kvm->tlbs_dirty;
with need_tlb_flush's type being int and tlbs_dirty's type being long.

It means that tlbs_dirty is always used as int and the higher 32 bits
is useless.  We need to check tlbs_dirty in a correct way and this
change checks it directly without propagating it to need_tlb_flush.

Note: it's _extremely_ unlikely this neglecting of higher 32 bits can
cause problems in practice.  It would require encountering tlbs_dirty
on a 4 billion count boundary, and KVM would need to be using shadow
paging or be running a nested guest.

Cc: stable@vger.kernel.org
Fixes: a4ee1ca4a36e ("KVM: MMU: delay flush all tlbs on sync_page path")
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Message-Id: <20201217154118.16497-1-jiangshanlai@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 virt/kvm/kvm_main.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -412,9 +412,8 @@ static int kvm_mmu_notifier_invalidate_r
 	 */
 	kvm->mmu_notifier_count++;
 	need_tlb_flush = kvm_unmap_hva_range(kvm, start, end, blockable);
-	need_tlb_flush |= kvm->tlbs_dirty;
 	/* we've to flush the tlb before the pages can be freed */
-	if (need_tlb_flush)
+	if (need_tlb_flush || kvm->tlbs_dirty)
 		kvm_flush_remote_tlbs(kvm);
 
 	spin_unlock(&kvm->mmu_lock);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 4.19 00/50] 4.19.177-rc1 review
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2021-02-22 12:13 ` [PATCH 4.19 50/50] kvm: check tlbs_dirty directly Greg Kroah-Hartman
@ 2021-02-22 18:40 ` Pavel Machek
  2021-02-22 21:28 ` Guenter Roeck
                   ` (3 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Pavel Machek @ 2021-02-22 18:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, stable

[-- Attachment #1: Type: text/plain, Size: 756 bytes --]

On Mon 2021-02-22 13:12:51, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.19.177 release.
> There are 50 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.

CIP testing has one board failing, but it has problem booting, so it
is not kernel fault.

https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y

Tested-by: Pavel Machek (CIP) <pavel@denx.de>

Best regards,
                                                                Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 4.19 00/50] 4.19.177-rc1 review
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2021-02-22 18:40 ` [PATCH 4.19 00/50] 4.19.177-rc1 review Pavel Machek
@ 2021-02-22 21:28 ` Guenter Roeck
  2021-02-22 21:49 ` Igor
                   ` (2 subsequent siblings)
  54 siblings, 0 replies; 56+ messages in thread
From: Guenter Roeck @ 2021-02-22 21:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuah, patches, lkft-triage, pavel,
	jonathanh, stable

On Mon, Feb 22, 2021 at 01:12:51PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.19.177 release.
> There are 50 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 Wed, 24 Feb 2021 12:07:46 +0000.
> Anything received after that time might be too late.
> 

Build results:
	total: 155 pass: 155 fail: 0
Qemu test results:
	total: 420 pass: 420 fail: 0

Tested-by: Guenter Roeck <linux@roeck-us.net>

Guenter

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 4.19 00/50] 4.19.177-rc1 review
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2021-02-22 21:28 ` Guenter Roeck
@ 2021-02-22 21:49 ` Igor
  2021-02-23 10:10 ` Naresh Kamboju
  2021-02-23 21:17 ` Shuah Khan
  54 siblings, 0 replies; 56+ messages in thread
From: Igor @ 2021-02-22 21:49 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, linux, shuah, patches, lkft-triage,
	pavel, jonathanh, stable, skhan

On Mon, Feb 22, 2021 at 01:12:51PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.19.177 release.
> There are 50 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 Wed, 24 Feb 2021 12:07:46 +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.177-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.19.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my machine(x86_64) without any dmesg regression.
My compilation uses the default Debian 10 .config(From kernel
4.19.0-14-amd64), followed by olddefconfig.

Tested-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>

Best regards,
---
Igor Matheus Andrade Torrente

> -------------
> Pseudo-Shortlog of commits:
> 
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>     Linux 4.19.177-rc1
> 
> Lai Jiangshan <laijs@linux.alibaba.com>
>     kvm: check tlbs_dirty directly
> 
> Arun Easi <aeasi@marvell.com>
>     scsi: qla2xxx: Fix crash during driver load on big endian machines
> 
> Jan Beulich <jbeulich@suse.com>
>     xen-blkback: fix error handling in xen_blkbk_map()
> 
> Jan Beulich <jbeulich@suse.com>
>     xen-scsiback: don't "handle" error by BUG()
> 
> Jan Beulich <jbeulich@suse.com>
>     xen-netback: don't "handle" error by BUG()
> 
> Jan Beulich <jbeulich@suse.com>
>     xen-blkback: don't "handle" error by BUG()
> 
> Stefano Stabellini <stefano.stabellini@xilinx.com>
>     xen/arm: don't ignore return errors from set_phys_to_machine
> 
> Jan Beulich <jbeulich@suse.com>
>     Xen/gntdev: correct error checking in gntdev_map_grant_pages()
> 
> Jan Beulich <jbeulich@suse.com>
>     Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages()
> 
> Jan Beulich <jbeulich@suse.com>
>     Xen/x86: also check kernel mapping in set_foreign_p2m_mapping()
> 
> Jan Beulich <jbeulich@suse.com>
>     Xen/x86: don't bail early from clear_foreign_p2m_mapping()
> 
> Loic Poulain <loic.poulain@linaro.org>
>     net: qrtr: Fix port ID for control messages
> 
> Paolo Bonzini <pbonzini@redhat.com>
>     KVM: SEV: fix double locking due to incorrect backport
> 
> Borislav Petkov <bp@suse.de>
>     x86/build: Disable CET instrumentation in the kernel for 32-bit too
> 
> Miklos Szeredi <mszeredi@redhat.com>
>     ovl: expand warning in ovl_d_real()
> 
> Sabyrzhan Tasbolatov <snovitoll@gmail.com>
>     net/qrtr: restrict user-controlled length in qrtr_tun_write_iter()
> 
> Sabyrzhan Tasbolatov <snovitoll@gmail.com>
>     net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS
> 
> Stefano Garzarella <sgarzare@redhat.com>
>     vsock: fix locking in vsock_shutdown()
> 
> Stefano Garzarella <sgarzare@redhat.com>
>     vsock/virtio: update credit only if socket is not closed
> 
> Edwin Peer <edwin.peer@broadcom.com>
>     net: watchdog: hold device global xmit lock during tx disable
> 
> Norbert Slusarek <nslusarek@gmx.net>
>     net/vmw_vsock: improve locking in vsock_connect_timeout()
> 
> NeilBrown <neilb@suse.de>
>     net: fix iteration for sctp transport seq_files
> 
> Serge Semin <Sergey.Semin@baikalelectronics.ru>
>     usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one
> 
> Felipe Balbi <balbi@kernel.org>
>     usb: dwc3: ulpi: fix checkpatch warning
> 
> Randy Dunlap <rdunlap@infradead.org>
>     h8300: fix PREEMPTION build, TI_PRE_COUNT undefined
> 
> Alain Volmat <alain.volmat@foss.st.com>
>     i2c: stm32f7: fix configuration of the digital filter
> 
> Fangrui Song <maskray@google.com>
>     firmware_loader: align .builtin_fw to 8
> 
> Yufeng Mo <moyufeng@huawei.com>
>     net: hns3: add a check for queue_id in hclge_reset_vf_queue()
> 
> Florian Westphal <fw@strlen.de>
>     netfilter: conntrack: skip identical origin tuple in same zone only
> 
> Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
>     net: stmmac: set TxQ mode back to DCB after disabling CBS
> 
> Juergen Gross <jgross@suse.com>
>     xen/netback: avoid race in xenvif_rx_ring_slots_available()
> 
> Sven Auhagen <sven.auhagen@voleatech.de>
>     netfilter: flowtable: fix tcp and udp header checksum update
> 
> Jozsef Kadlecsik <kadlec@mail.kfki.hu>
>     netfilter: xt_recent: Fix attempt to update deleted entry
> 
> Bui Quang Minh <minhquangbui99@gmail.com>
>     bpf: Check for integer overflow when using roundup_pow_of_two()
> 
> Lorenzo Bianconi <lorenzo@kernel.org>
>     mt76: dma: fix a possible memory leak in mt76_add_fragment()
> 
> Russell King <rmk+kernel@armlinux.org.uk>
>     ARM: kexec: fix oops after TLB are invalidated
> 
> Russell King <rmk+kernel@armlinux.org.uk>
>     ARM: ensure the signal page contains defined contents
> 
> Alexandre Belloni <alexandre.belloni@bootlin.com>
>     ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL
> 
> Lin Feng <linf@wangsu.com>
>     bfq-iosched: Revert "bfq: Fix computation of shallow depth"
> 
> Alexandre Ghiti <alex@ghiti.fr>
>     riscv: virt_addr_valid must check the address belongs to linear mapping
> 
> Victor Lu <victorchengchi.lu@amd.com>
>     drm/amd/display: Free atomic state after drm_atomic_commit
> 
> Victor Lu <victorchengchi.lu@amd.com>
>     drm/amd/display: Fix dc_sink kref count in emulated_link_detect
> 
> Amir Goldstein <amir73il@gmail.com>
>     ovl: skip getxattr of security labels
> 
> Miklos Szeredi <mszeredi@redhat.com>
>     cap: fix conversions on getxattr
> 
> Miklos Szeredi <mszeredi@redhat.com>
>     ovl: perform vfs_getxattr() with mounter creds
> 
> Hans de Goede <hdegoede@redhat.com>
>     platform/x86: hp-wmi: Disable tablet-mode reporting by default
> 
> Marc Zyngier <maz@kernel.org>
>     arm64: dts: rockchip: Fix PCIe DT properties on rk3399
> 
> Julien Grall <jgrall@amazon.com>
>     arm/xen: Don't probe xenbus as part of an early initcall
> 
> Steven Rostedt (VMware) <rostedt@goodmis.org>
>     tracing: Check length before giving out the filter buffer
> 
> Steven Rostedt (VMware) <rostedt@goodmis.org>
>     tracing: Do not count ftrace events in top level enable output
> 
> 
> -------------
> 
> Diffstat:
> 
>  Makefile                                           |  4 +-
>  arch/arm/boot/dts/lpc32xx.dtsi                     |  3 -
>  arch/arm/include/asm/kexec-internal.h              | 12 ++++
>  arch/arm/kernel/asm-offsets.c                      |  5 ++
>  arch/arm/kernel/machine_kexec.c                    | 20 +++----
>  arch/arm/kernel/relocate_kernel.S                  | 38 ++++--------
>  arch/arm/kernel/signal.c                           | 14 +++--
>  arch/arm/xen/enlighten.c                           |  2 -
>  arch/arm/xen/p2m.c                                 |  6 +-
>  arch/arm64/boot/dts/rockchip/rk3399.dtsi           |  2 +-
>  arch/h8300/kernel/asm-offsets.c                    |  3 +
>  arch/riscv/include/asm/page.h                      |  5 +-
>  arch/x86/Makefile                                  |  6 +-
>  arch/x86/kvm/svm.c                                 |  1 -
>  arch/x86/xen/p2m.c                                 | 15 +++--
>  block/bfq-iosched.c                                |  8 +--
>  drivers/block/xen-blkback/blkback.c                | 30 +++++-----
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 18 +++---
>  drivers/i2c/busses/i2c-stm32f7.c                   | 11 +++-
>  .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c    |  7 +++
>  drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c    |  7 ++-
>  drivers/net/wireless/mediatek/mt76/dma.c           |  8 ++-
>  drivers/net/xen-netback/netback.c                  |  4 +-
>  drivers/net/xen-netback/rx.c                       |  9 ++-
>  drivers/platform/x86/hp-wmi.c                      | 14 +++--
>  drivers/scsi/qla2xxx/qla_tmpl.c                    |  9 +--
>  drivers/scsi/qla2xxx/qla_tmpl.h                    |  2 +-
>  drivers/usb/dwc3/ulpi.c                            | 20 +++++--
>  drivers/xen/gntdev.c                               | 37 ++++++------
>  drivers/xen/xen-scsiback.c                         |  4 +-
>  drivers/xen/xenbus/xenbus.h                        |  1 -
>  drivers/xen/xenbus/xenbus_probe.c                  |  2 +-
>  fs/overlayfs/copy_up.c                             | 15 ++---
>  fs/overlayfs/inode.c                               |  2 +
>  fs/overlayfs/super.c                               | 13 +++--
>  include/asm-generic/vmlinux.lds.h                  |  2 +-
>  include/linux/netdevice.h                          |  2 +
>  include/xen/grant_table.h                          |  1 +
>  include/xen/xenbus.h                               |  2 -
>  kernel/bpf/stackmap.c                              |  2 +
>  kernel/trace/trace.c                               |  2 +-
>  kernel/trace/trace_events.c                        |  3 +-
>  net/netfilter/nf_conntrack_core.c                  |  3 +-
>  net/netfilter/nf_flow_table_core.c                 |  4 +-
>  net/netfilter/xt_recent.c                          | 12 +++-
>  net/qrtr/qrtr.c                                    |  2 +-
>  net/qrtr/tun.c                                     |  6 ++
>  net/rds/rdma.c                                     |  3 +
>  net/sctp/proc.c                                    | 16 ++++--
>  net/vmw_vsock/af_vsock.c                           | 13 ++---
>  net/vmw_vsock/hyperv_transport.c                   |  4 --
>  net/vmw_vsock/virtio_transport_common.c            |  4 +-
>  security/commoncap.c                               | 67 ++++++++++++++--------
>  virt/kvm/kvm_main.c                                |  3 +-
>  54 files changed, 303 insertions(+), 205 deletions(-)
> 
> 

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 4.19 00/50] 4.19.177-rc1 review
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2021-02-22 21:49 ` Igor
@ 2021-02-23 10:10 ` Naresh Kamboju
  2021-02-23 21:17 ` Shuah Khan
  54 siblings, 0 replies; 56+ messages in thread
From: Naresh Kamboju @ 2021-02-23 10:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: open list, Shuah Khan, patches, lkft-triage, Jon Hunter,
	linux-stable, pavel, Andrew Morton, Linus Torvalds,
	Guenter Roeck

On Mon, 22 Feb 2021 at 17:47, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> This is the start of the stable review cycle for the 4.19.177 release.
> There are 50 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 Wed, 24 Feb 2021 12:07:46 +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.177-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.19.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h


Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>

Summary
------------------------------------------------------------------------

kernel: 4.19.177-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.19.y
git commit: 413fa3cdbf28627d28d937d9ac27b1d184c24711
git describe: v4.19.176-51-g413fa3cdbf28
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.176-51-g413fa3cdbf28

No regressions (compared to build v4.19.176-37-ga4346d5d945c)

No fixes (compared to build v4.19.176-37-ga4346d5d945c)

Ran 49321 total tests in the following environments and test suites.

Environments
--------------
- arm
- arm64
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- mips
- nxp-ls2088
- nxp-ls2088-64k_page_size
- qemu-arm64-clang
- qemu-arm64-kasan
- qemu-x86_64-clang
- qemu-x86_64-kasan
- qemu_arm
- qemu_arm64
- qemu_arm64-compat
- qemu_i386
- qemu_x86_64
- qemu_x86_64-compat
- s390
- sparc
- x15 - arm
- x86_64
- x86-kasan
- x86_64

Test Suites
-----------
* build
* linux-log-parser
* install-android-platform-tools-r2600
* kvm-unit-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-dio-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-securebits-tests
* ltp-tracing-tests
* perf
* v4l2-compliance
* fwts
* kselftest-bpf
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-sched-tests
* ltp-syscalls-tests
* ltp-cve-tests
* ltp-open-posix-tests
* rcutorture
* ssuite
* network-basic-tests
* kselftest-android
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-zram
* kselftest-
* kselftest-kexec
* kselftest-vm
* kselftest-x86
* kselftest-vsyscall-mode-native-
* kselftest-vsyscall-mode-none-

-- 
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 4.19 00/50] 4.19.177-rc1 review
  2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2021-02-23 10:10 ` Naresh Kamboju
@ 2021-02-23 21:17 ` Shuah Khan
  54 siblings, 0 replies; 56+ messages in thread
From: Shuah Khan @ 2021-02-23 21:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, shuah, patches, lkft-triage, pavel,
	jonathanh, stable, Shuah Khan

On 2/22/21 5:12 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.19.177 release.
> There are 50 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 Wed, 24 Feb 2021 12:07:46 +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.177-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.19.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

Tested-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2021-02-23 21:19 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 12:12 [PATCH 4.19 00/50] 4.19.177-rc1 review Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 01/50] tracing: Do not count ftrace events in top level enable output Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 02/50] tracing: Check length before giving out the filter buffer Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 03/50] arm/xen: Dont probe xenbus as part of an early initcall Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 04/50] arm64: dts: rockchip: Fix PCIe DT properties on rk3399 Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 05/50] platform/x86: hp-wmi: Disable tablet-mode reporting by default Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 06/50] ovl: perform vfs_getxattr() with mounter creds Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 07/50] cap: fix conversions on getxattr Greg Kroah-Hartman
2021-02-22 12:12 ` [PATCH 4.19 08/50] ovl: skip getxattr of security labels Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 09/50] drm/amd/display: Fix dc_sink kref count in emulated_link_detect Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 10/50] drm/amd/display: Free atomic state after drm_atomic_commit Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 11/50] riscv: virt_addr_valid must check the address belongs to linear mapping Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 12/50] bfq-iosched: Revert "bfq: Fix computation of shallow depth" Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 13/50] ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 14/50] ARM: ensure the signal page contains defined contents Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 15/50] ARM: kexec: fix oops after TLB are invalidated Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 16/50] mt76: dma: fix a possible memory leak in mt76_add_fragment() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 17/50] bpf: Check for integer overflow when using roundup_pow_of_two() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 18/50] netfilter: xt_recent: Fix attempt to update deleted entry Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 19/50] netfilter: flowtable: fix tcp and udp header checksum update Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 20/50] xen/netback: avoid race in xenvif_rx_ring_slots_available() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 21/50] net: stmmac: set TxQ mode back to DCB after disabling CBS Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 22/50] netfilter: conntrack: skip identical origin tuple in same zone only Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 23/50] net: hns3: add a check for queue_id in hclge_reset_vf_queue() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 24/50] firmware_loader: align .builtin_fw to 8 Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 25/50] i2c: stm32f7: fix configuration of the digital filter Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 26/50] h8300: fix PREEMPTION build, TI_PRE_COUNT undefined Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 27/50] usb: dwc3: ulpi: fix checkpatch warning Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 28/50] usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 29/50] net: fix iteration for sctp transport seq_files Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 30/50] net/vmw_vsock: improve locking in vsock_connect_timeout() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 31/50] net: watchdog: hold device global xmit lock during tx disable Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 32/50] vsock/virtio: update credit only if socket is not closed Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 33/50] vsock: fix locking in vsock_shutdown() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 34/50] net/rds: restrict iovecs length for RDS_CMSG_RDMA_ARGS Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 35/50] net/qrtr: restrict user-controlled length in qrtr_tun_write_iter() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 36/50] ovl: expand warning in ovl_d_real() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 37/50] x86/build: Disable CET instrumentation in the kernel for 32-bit too Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 38/50] KVM: SEV: fix double locking due to incorrect backport Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 39/50] net: qrtr: Fix port ID for control messages Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 40/50] Xen/x86: dont bail early from clear_foreign_p2m_mapping() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 41/50] Xen/x86: also check kernel mapping in set_foreign_p2m_mapping() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 42/50] Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 43/50] Xen/gntdev: correct error checking " Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 44/50] xen/arm: dont ignore return errors from set_phys_to_machine Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 45/50] xen-blkback: dont "handle" error by BUG() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 46/50] xen-netback: " Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 47/50] xen-scsiback: " Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 48/50] xen-blkback: fix error handling in xen_blkbk_map() Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 49/50] scsi: qla2xxx: Fix crash during driver load on big endian machines Greg Kroah-Hartman
2021-02-22 12:13 ` [PATCH 4.19 50/50] kvm: check tlbs_dirty directly Greg Kroah-Hartman
2021-02-22 18:40 ` [PATCH 4.19 00/50] 4.19.177-rc1 review Pavel Machek
2021-02-22 21:28 ` Guenter Roeck
2021-02-22 21:49 ` Igor
2021-02-23 10:10 ` Naresh Kamboju
2021-02-23 21:17 ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).