5.13.14-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 5.13.14-rc1 review
This is the start of the stable review cycle for the 5.13.14 release. There are 113 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 03 Sep 2021 12:22:41 +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/v5.x/stable-review/patch-5.13.14-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-5.13.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.13.14-rc1
Richard Guy Briggs <[email protected]>
audit: move put_tree() to avoid trim_trees refcount underflow and UAF
Peter Collingbourne <[email protected]>
net: don't unconditionally copy_from_user a struct ifreq for socket ioctls
Helge Deller <[email protected]>
Revert "parisc: Add assembly implementations for memset, strlen, strcpy, strncpy and strcat"
Eric Biggers <[email protected]>
ubifs: report correct st_size for encrypted symlinks
Eric Biggers <[email protected]>
f2fs: report correct st_size for encrypted symlinks
Eric Biggers <[email protected]>
ext4: report correct st_size for encrypted symlinks
Eric Biggers <[email protected]>
fscrypt: add fscrypt_symlink_getattr() for computing st_size
Denis Efremov <[email protected]>
Revert "floppy: reintroduce O_NDELAY fix"
Qu Wenruo <[email protected]>
btrfs: fix NULL pointer dereference when deleting device by invalid id
Petr Vorel <[email protected]>
arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
DENG Qingfang <[email protected]>
net: dsa: mt7530: fix VLAN traffic leaks again
Pauli Virtanen <[email protected]>
Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS
Linus Torvalds <[email protected]>
vt_kdsetmode: extend console locking
Xin Long <[email protected]>
tipc: call tipc_wait_for_connect only when dlen is not 0
Linus Torvalds <[email protected]>
pipe: do FASYNC notifications for every pipe IO, not just state changes
Linus Torvalds <[email protected]>
pipe: avoid unnecessary EPOLLET wakeups under normal loads
Mark Rutland <[email protected]>
arm64: initialize all of CNTHCTL_EL2
Gerd Rausch <[email protected]>
net/rds: dma_map_sg is entitled to merge entries
Thomas Weißschuh <[email protected]>
platform/x86: gigabyte-wmi: add support for B450M S2H V2
Ben Skeggs <[email protected]>
drm/nouveau/kms/nv50: workaround EFI GOP window channel format differences
Ben Skeggs <[email protected]>
drm/nouveau/disp: power down unused DP links during init
Ben Skeggs <[email protected]>
drm/nouveau: recognise GA107
Thomas Weißschuh <[email protected]>
platform/x86: gigabyte-wmi: add support for X570 GAMING X
Mark Yacoub <[email protected]>
drm: Copy drm_wait_vblank to user before returning
Ming Lei <[email protected]>
blk-mq: don't grab rq's refcount in blk_mq_check_expired()
Kenneth Feng <[email protected]>
drm/amd/pm: change the workload type for some cards
Kenneth Feng <[email protected]>
Revert "drm/amd/pm: fix workload mismatch on vega10"
Shai Malin <[email protected]>
qed: Fix null-pointer dereference in qed_rdma_create_qp()
Shai Malin <[email protected]>
qed: qed ll2 race condition fixes
Hans de Goede <[email protected]>
platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s
Hans de Goede <[email protected]>
platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option
Michael S. Tsirkin <[email protected]>
tools/virtio: fix build
Neeraj Upadhyay <[email protected]>
vringh: Use wiov->used to check for read/write desc order
Vincent Whitchurch <[email protected]>
virtio_vdpa: reject invalid vq indices
Parav Pandit <[email protected]>
virtio_pci: Support surprise removal of virtio pci device
Parav Pandit <[email protected]>
virtio: Improve vq->broken access to avoid any compiler optimization
Thara Gopinath <[email protected]>
cpufreq: blocklist Qualcomm sm8150 in cpufreq-dt-platdev
Michał Mirosław <[email protected]>
opp: remove WARN when no valid OPPs remain
Yaara Baruch <[email protected]>
iwlwifi: add new so-jf devices
Yaara Baruch <[email protected]>
iwlwifi: add new SoF with JF devices
Johannes Berg <[email protected]>
iwlwifi: pnvm: accept multiple HW-type TLVs
Adam Ford <[email protected]>
clk: renesas: rcar-usb2-clock-sel: Fix kernel NULL pointer dereference
Sebastian Andrzej Siewior <[email protected]>
sched: Fix get_push_task() vs migrate_disable()
Colin Ian King <[email protected]>
perf/x86/intel/uncore: Fix integer overflow on 23 bit left shift of a u32
Jerome Brunet <[email protected]>
usb: gadget: u_audio: fix race condition on endpoint stop
Wong Vee Khee <[email protected]>
net: stmmac: fix kernel panic due to NULL pointer dereference of plat->est
Xiaoliang Yang <[email protected]>
net: stmmac: add mutex lock to protect est parameters
Ulf Hansson <[email protected]>
Revert "mmc: sdhci-iproc: Set SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN on BCM2711"
Andy Shevchenko <[email protected]>
media: ipu3-cio2: Drop reference on error path in cio2_bridge_connect_sensor()
Guangbin Huang <[email protected]>
net: hns3: fix get wrong pfc_en when query PFC configuration
Guojia Liao <[email protected]>
net: hns3: fix duplicate node in VLAN list
Yonglong Liu <[email protected]>
net: hns3: fix speed unknown issue in bond 4
Yufeng Mo <[email protected]>
net: hns3: add waiting time before cmdq memory is released
Yufeng Mo <[email protected]>
net: hns3: clear hardware resource when loading driver
Andrey Ignatov <[email protected]>
rtnetlink: Return correct error on changing device netns
Kurt Kanzenbach <[email protected]>
net: dsa: hellcreek: Adjust schedule look ahead window
Kurt Kanzenbach <[email protected]>
net: dsa: hellcreek: Fix incorrect setting of GCL
Rahul Lakkireddy <[email protected]>
cxgb4: dont touch blocked freelist bitmap after free
Eric Dumazet <[email protected]>
ipv4: use siphash instead of Jenkins in fnhe_hashfun()
Eric Dumazet <[email protected]>
ipv6: use siphash in rt6_exception_hash()
Trond Myklebust <[email protected]>
SUNRPC: Fix XPT_BUSY flag leakage in svc_handle_xprt()...
Davide Caratti <[email protected]>
net/sched: ets: fix crash when flipping from 'strict' to 'quantum'
Alexey Gladkov <[email protected]>
ucounts: Increase ucounts reference counter before the security hook
Maxim Kiselev <[email protected]>
net: marvell: fix MVNETA_TX_IN_PRGRS bit number
Christophe JAILLET <[email protected]>
xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()'
Shreyansh Chouhan <[email protected]>
ip_gre: add validation for csum_start
Gal Pressman <[email protected]>
RDMA/efa: Free IRQ vectors on error flow
Sasha Neftin <[email protected]>
e1000e: Do not take care about recovery NVM checksum
Sasha Neftin <[email protected]>
e1000e: Fix the max snoop/no-snoop latency for 10M
Toshiki Nishioka <[email protected]>
igc: Use num_tx_queues when iterating over tx_ring queue
Aaron Ma <[email protected]>
igc: fix page fault when thunderbolt is unplugged
Petko Manolov <[email protected]>
net: usb: pegasus: fixes of set_register(s) return value evaluation;
Jacob Keller <[email protected]>
ice: do not abort devlink info if board identifier can't be found
Bob Pearson <[email protected]>
RDMA/rxe: Fix memory allocation while in a spin lock
Dinghao Liu <[email protected]>
RDMA/bnxt_re: Remove unpaired rtnl unlock in bnxt_re_dev_init()
Tuo Li <[email protected]>
IB/hfi1: Fix possible null-pointer dereference in _extend_sdma_tx_descs()
Naresh Kumar PBS <[email protected]>
RDMA/bnxt_re: Add missing spin lock initialization
Gal Pressman <[email protected]>
RDMA/uverbs: Track dmabuf memory regions
Maor Gottlieb <[email protected]>
RDMA/mlx5: Fix crash when unbind multiport slave
Li Jinlin <[email protected]>
scsi: core: Fix hang of freezing queue between blocking and running device
Wesley Cheng <[email protected]>
usb: dwc3: gadget: Stop EP0 transfers during pullup disable
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Fix dwc3_calc_trbs_left()
Kyle Tso <[email protected]>
usb: typec: tcpm: Raise vdm_sm_running flag only when VDM SM is running
Takashi Iwai <[email protected]>
usb: renesas-xhci: Prefer firmware loading on unknown ROM state
Zhengjun Zhang <[email protected]>
USB: serial: option: add new VID/PID to support Fibocom FG150
Johan Hovold <[email protected]>
Revert "USB: serial: ch341: fix character loss at high transfer rates"
Borislav Petkov <[email protected]>
drm/amdgpu: Fix build with missing pm_suspend_target_state module export
Christian König <[email protected]>
drm/amdgpu: use the preferred pin domain after the check
Michel Dänzer <[email protected]>
drm/amdgpu: Cancel delayed work when GFXOFF is disabled
Swati Sharma <[email protected]>
drm/i915/dp: Drop redundant debug print
Matthew Brost <[email protected]>
drm/i915: Fix syncmap memory leak
Song Yoong Siang <[email protected]>
net: stmmac: fix kernel panic due to NULL pointer dereference of buf->xdp
Song Yoong Siang <[email protected]>
net: stmmac: fix kernel panic due to NULL pointer dereference of xsk_pool
Qu Wenruo <[email protected]>
Revert "btrfs: compression: don't try to compress if we don't have enough pages"
Miaohe Lin <[email protected]>
mm/memory_hotplug: fix potential permanent lru cache disable
Lukas Bulwahn <[email protected]>
powerpc: Re-enable ARCH_ENABLE_SPLIT_PMD_PTLOCK
Vincent Chen <[email protected]>
riscv: Ensure the value of FP registers in the core dump file is up to date
Rob Herring <[email protected]>
dt-bindings: sifive-l2-cache: Fix 'select' matching
Xiubo Li <[email protected]>
ceph: correctly handle releasing an embedded cap flush
Stefan Mätje <[email protected]>
can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error counters
Mark Brown <[email protected]>
net: mscc: Fix non-GPL export of regmap APIs
Miklos Szeredi <[email protected]>
ovl: fix uninitialized pointer read in ovl_lookup_real_one()
Ming Lei <[email protected]>
blk-iocost: fix lockdep warning on blkcg->lock
Jens Axboe <[email protected]>
io_uring: rsrc ref lock needs to be IRQ safe
Kefeng Wang <[email protected]>
once: Fix panic when module unload
Florian Westphal <[email protected]>
netfilter: conntrack: collect all entries in one cycle
Jozsef Kadlecsik <[email protected]>
netfilter: ipset: Limit the maximal range of consecutive elements to add/delete
Guenter Roeck <[email protected]>
ARC: Fix CONFIG_STACKDEPOT
Hans de Goede <[email protected]>
platform/x86: Add and use a dual_accel_detect() helper
Mark Brown <[email protected]>
ASoC: component: Remove misplaced prefix handling in pin control functions
Derek Fang <[email protected]>
ASoC: rt5682: Adjust headset volume button threshold
Daniel Borkmann <[email protected]>
bpf: Fix ringbuf helper function compatibility
Xiaolong Huang <[email protected]>
net: qrtr: fix another OOB Read in qrtr_endpoint_post
-------------
Diffstat:
.../devicetree/bindings/riscv/sifive-l2-cache.yaml | 8 +- Makefile | 4 +- arch/arc/kernel/vmlinux.lds.S | 2 + .../arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 + arch/arm64/include/asm/el2_setup.h | 3 +- arch/parisc/include/asm/string.h | 15 --- arch/parisc/kernel/parisc_ksyms.c | 4 - arch/parisc/lib/Makefile | 4 +- arch/parisc/lib/memset.c | 72 +++++++++++ arch/parisc/lib/string.S | 136 --------------------- arch/powerpc/platforms/Kconfig.cputype | 2 +- arch/riscv/kernel/ptrace.c | 4 + arch/x86/events/intel/uncore_snbep.c | 2 +- block/blk-iocost.c | 8 +- block/blk-mq.c | 30 +---- drivers/block/floppy.c | 30 ++--- drivers/bluetooth/btusb.c | 22 ++-- drivers/clk/renesas/rcar-usb2-clock-sel.c | 2 +- drivers/cpufreq/cpufreq-dt-platdev.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 36 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 10 +- .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 15 ++- drivers/gpu/drm/drm_ioc32.c | 4 +- drivers/gpu/drm/i915/display/intel_dp.c | 9 +- drivers/gpu/drm/i915/gt/intel_timeline.c | 9 ++ drivers/gpu/drm/nouveau/dispnv50/disp.c | 27 ++++ drivers/gpu/drm/nouveau/dispnv50/head.c | 13 +- drivers/gpu/drm/nouveau/dispnv50/head.h | 1 + drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | 21 ++++ drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h | 1 + drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c | 9 ++ drivers/infiniband/core/uverbs_std_types_mr.c | 3 + drivers/infiniband/hw/bnxt_re/ib_verbs.c | 1 + drivers/infiniband/hw/bnxt_re/main.c | 1 - drivers/infiniband/hw/efa/efa_main.c | 1 + drivers/infiniband/hw/hfi1/sdma.c | 9 +- drivers/infiniband/hw/mlx5/main.c | 3 +- drivers/infiniband/sw/rxe/rxe_mcast.c | 2 +- drivers/media/pci/intel/ipu3/cio2-bridge.c | 2 +- drivers/mmc/host/sdhci-iproc.c | 3 +- drivers/net/can/usb/esd_usb2.c | 4 +- drivers/net/dsa/hirschmann/hellcreek.c | 8 +- drivers/net/dsa/mt7530.c | 5 +- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 7 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 6 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 4 + .../net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 13 +- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 34 +++++- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c | 7 +- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h | 1 + .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +- .../ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 2 +- drivers/net/ethernet/intel/e1000e/ich8lan.c | 32 +++-- drivers/net/ethernet/intel/e1000e/ich8lan.h | 3 + drivers/net/ethernet/intel/ice/ice_devlink.c | 4 +- drivers/net/ethernet/intel/igc/igc_main.c | 36 +++--- drivers/net/ethernet/intel/igc/igc_ptp.c | 3 +- drivers/net/ethernet/marvell/mvneta.c | 2 +- drivers/net/ethernet/mscc/ocelot_io.c | 16 +-- drivers/net/ethernet/qlogic/qed/qed_ll2.c | 20 +++ drivers/net/ethernet/qlogic/qed/qed_rdma.c | 3 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 +- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 20 ++- drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c | 12 +- drivers/net/usb/pegasus.c | 4 +- drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 25 ++-- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 70 ++++++++++- drivers/opp/of.c | 5 +- drivers/platform/x86/Kconfig | 3 + drivers/platform/x86/asus-nb-wmi.c | 28 +++++ drivers/platform/x86/dual_accel_detect.h | 75 ++++++++++++ drivers/platform/x86/gigabyte-wmi.c | 2 + drivers/platform/x86/intel-hid.c | 21 +--- drivers/platform/x86/intel-vbtn.c | 18 ++- drivers/platform/x86/thinkpad_acpi.c | 3 +- drivers/scsi/scsi_sysfs.c | 9 +- drivers/tty/vt/vt_ioctl.c | 10 +- drivers/usb/dwc3/gadget.c | 23 ++-- drivers/usb/gadget/function/u_audio.c | 5 +- drivers/usb/host/xhci-pci-renesas.c | 35 ++++-- drivers/usb/serial/ch341.c | 1 - drivers/usb/serial/option.c | 2 + drivers/usb/typec/tcpm/tcpm.c | 81 ++++++------ drivers/vhost/vringh.c | 2 +- drivers/virtio/virtio_pci_common.c | 7 ++ drivers/virtio/virtio_ring.c | 6 +- drivers/virtio/virtio_vdpa.c | 3 + fs/btrfs/inode.c | 2 +- fs/btrfs/volumes.c | 2 +- fs/ceph/caps.c | 21 ++-- fs/ceph/mds_client.c | 7 +- fs/ceph/snap.c | 3 + fs/ceph/super.h | 3 +- fs/crypto/hooks.c | 44 +++++++ fs/ext4/symlink.c | 12 +- fs/f2fs/namei.c | 12 +- fs/io_uring.c | 19 +-- fs/overlayfs/export.c | 2 +- fs/pipe.c | 33 +++-- fs/ubifs/file.c | 13 +- include/linux/fscrypt.h | 7 ++ include/linux/netdevice.h | 4 + include/linux/netfilter/ipset/ip_set.h | 3 + include/linux/once.h | 4 +- include/linux/pipe_fs_i.h | 2 + include/linux/stmmac.h | 1 + kernel/audit_tree.c | 2 +- kernel/bpf/verifier.c | 8 +- kernel/cred.c | 12 +- kernel/sched/sched.h | 3 + lib/once.c | 11 +- mm/memory_hotplug.c | 1 + net/core/rtnetlink.c | 3 +- net/ipv4/ip_gre.c | 2 + net/ipv4/route.c | 12 +- net/ipv6/route.c | 20 ++- net/netfilter/ipset/ip_set_hash_ip.c | 9 +- net/netfilter/ipset/ip_set_hash_ipmark.c | 10 +- net/netfilter/ipset/ip_set_hash_ipport.c | 3 + net/netfilter/ipset/ip_set_hash_ipportip.c | 3 + net/netfilter/ipset/ip_set_hash_ipportnet.c | 3 + net/netfilter/ipset/ip_set_hash_net.c | 11 +- net/netfilter/ipset/ip_set_hash_netiface.c | 10 +- net/netfilter/ipset/ip_set_hash_netnet.c | 16 ++- net/netfilter/ipset/ip_set_hash_netport.c | 11 +- net/netfilter/ipset/ip_set_hash_netportnet.c | 16 ++- net/netfilter/nf_conntrack_core.c | 71 ++++------- net/qrtr/qrtr.c | 2 +- net/rds/ib_frmr.c | 4 +- net/sched/sch_ets.c | 7 ++ net/socket.c | 6 +- net/sunrpc/svc_xprt.c | 3 +- net/tipc/socket.c | 2 +- sound/soc/codecs/rt5682.c | 1 + sound/soc/soc-component.c | 63 ++++------ tools/virtio/Makefile | 3 +- tools/virtio/linux/spinlock.h | 56 +++++++++ tools/virtio/linux/virtio.h | 2 + 142 files changed, 1181 insertions(+), 641 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/113 net: qrtr: fix another OOB Read in qrtr_endpoint_post
From: Xiaolong Huang <[email protected]>
commit 7e78c597c3ebfd0cb329aa09a838734147e4f117 upstream.
This check was incomplete, did not consider size is 0:
if (len != ALIGN(size, 4) + hdrlen)
goto err;if size from qrtr_hdr is 0, the result of ALIGN(size, 4) will be 0, In case of len == hdrlen and size == 0 in header this check won't fail and
if (cb->type == QRTR_TYPE_NEW_SERVER) {
/* Remote node endpoint can bridge other distant nodes */
const struct qrtr_ctrl_pkt *pkt = data + hdrlen;
qrtr_node_assign(node, le32_to_cpu(pkt->server.node));
}will also read out of bound from data, which is hdrlen allocated block.
--- net/qrtr/qrtr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/qrtr/qrtr.c +1 -1
@@ -493,7 +493,7 @@ int qrtr_endpoint_post(struct qrtr_endpo goto err; } -if (len !=ALIGN (size,4 ) + hdrlen) +if (!size || len !=ALIGN (size,4 ) + hdrlen) goto err; if (cb->dst_port != QRTR_PORT_CTRL && cb->type != QRTR_TYPE_DATA &&
Greg Kroah-Hartman
maintainerPATCH 2/113 bpf: Fix ringbuf helper function compatibility
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit 5b029a32cfe4600f5e10e36b41778506b90fd4de upstream.
Commit 457f44363a88 ("bpf: Implement BPF ring buffer and verifier support for it") extended check_map_func_compatibility() by enforcing map -> helper function match, but not helper -> map type match.
Due to this all of the bpf_ringbuf_*() helper functions could be used with a wrong map type such as array or hash map, leading to invalid access due to type confusion.
Also, both BPF_FUNC_ringbuf_{submit,discard} have ARG_PTR_TO_ALLOC_MEM as argument and not a BPF map. Therefore, their check_map_func_compatibility() presence is incorrect since it's only for map type checking.
--- kernel/bpf/verifier.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/bpf/verifier.c +6 -2
@@ -5148,8 +5148,6 @@ static int check_map_func_compatibility(case BPF_MAP_TYPE_RINGBUF :if (func_id != BPF_FUNC_ringbuf_output && func_id != BPF_FUNC_ringbuf_reserve && - func_id != BPF_FUNC_ringbuf_submit && - func_id != BPF_FUNC_ringbuf_discard && func_id != BPF_FUNC_ringbuf_query) goto error;break ;
@@ -5258,6 +5256,12 @@ static int check_map_func_compatibility(if (map->map_type !=BPF_MAP_TYPE_PERF_EVENT_ARRAY ) goto error;break ; +case BPF_FUNC_ringbuf_output: +case BPF_FUNC_ringbuf_reserve: +case BPF_FUNC_ringbuf_query: +if (map->map_type !=BPF_MAP_TYPE_RINGBUF ) + goto error; +break ;case BPF_FUNC_get_stackid:if (map->map_type !=BPF_MAP_TYPE_STACK_TRACE ) goto error;
Greg Kroah-Hartman
maintainerPATCH 3/113 ASoC: rt5682: Adjust headset volume button threshold
In reply to Greg Kroah-HartmanFrom: Derek Fang <[email protected]>
[ Upstream commit 6d20bf7c020f417fdef1810a22da17c126603472 ]
Adjust the threshold of headset button volume+ to fix the wrong button detection issue with some brand headsets.
--- sound/soc/codecs/rt5682.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt5682.c +1 -0
@@ -44,6 +44,7 @@ static const struct reg_sequence patch_list[] = { {RT5682_I2C_CTRL, 0x000f}, {RT5682_PLL2_INTERNAL, 0x8266}, {RT5682_SAR_IL_CMD_3, 0x8365}, + {RT5682_SAR_IL_CMD_6, 0x0180}, };void rt5682_apply_patch_list (struct rt5682_priv *rt5682,struct device *dev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 4/113 ASoC: component: Remove misplaced prefix handling in pin control functions
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 31428c78748cafdd9352e1f622eb89bf453d9700 ]
When the component level pin control functions were added they for some no longer obvious reason handled adding prefixing of widget names. This meant that when the lack of prefix handling in the DAPM level pin operations was fixed by ae4fc532244b3bb4d (ASoC: dapm: use component prefix when checking widget names) the one device using the component level API ended up with the prefix being applied twice, causing all lookups to fail.
Fix this by removing the redundant prefixing from the component code, which has the nice side effect of also making that code much simpler.
--- sound/soc/soc-component.c | 63 +++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 36 deletions(-)
sound/soc/soc-component.c +27 -36
@@ -148,86 +148,75 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,return soc_component_ret (component, ret); } -static int soc_component_pin (struct snd_soc_component *component, -const char *pin, -int (*pin_func)(struct snd_soc_dapm_context *dapm, -const char *pin)) -{ -struct snd_soc_dapm_context *dapm = -snd_soc_component_get_dapm (component); -char *full_name; -int ret; - -if (!component->name_prefix) { - ret =pin_func (dapm, pin); - goto end; - } - - full_name =kasprintf (GFP_KERNEL ,"%s %s" , component->name_prefix, pin); -if (!full_name) { - ret = -ENOMEM ; - goto end; - } - - ret =pin_func (dapm, full_name); -kfree (full_name); -end: -return soc_component_ret (component, ret); -} -int snd_soc_component_enable_pin (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_enable_pin); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_enable_pin (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_enable_pin);int snd_soc_component_enable_pin_unlocked (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_enable_pin_unlocked); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_enable_pin_unlocked (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_enable_pin_unlocked);int snd_soc_component_disable_pin (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_disable_pin); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_disable_pin (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_disable_pin);int snd_soc_component_disable_pin_unlocked (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_disable_pin_unlocked); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_disable_pin_unlocked (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_disable_pin_unlocked);int snd_soc_component_nc_pin (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_nc_pin); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_nc_pin (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_nc_pin);int snd_soc_component_nc_pin_unlocked (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_nc_pin_unlocked); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_nc_pin_unlocked (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_nc_pin_unlocked);int snd_soc_component_get_pin_status (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_get_pin_status); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_get_pin_status (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_get_pin_status);int snd_soc_component_force_enable_pin (struct snd_soc_component *component,const char *pin) { -return soc_component_pin (component, pin, snd_soc_dapm_force_enable_pin); +struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_force_enable_pin (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_force_enable_pin);
@@ -235,7 +224,9 @@ int snd_soc_component_force_enable_pin_unlocked(struct snd_soc_component *component, const char *pin) { - return soc_component_pin(component, pin, snd_soc_dapm_force_enable_pin_unlocked); + struct snd_soc_dapm_context *dapm = +snd_soc_component_get_dapm (component); +return snd_soc_dapm_force_enable_pin_unlocked (dapm, pin); }EXPORT_SYMBOL_GPL (snd_soc_component_force_enable_pin_unlocked);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 5/113 platform/x86: Add and use a dual_accel_detect() helper
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 153cca9caa81ca8912a70528daca4b9a523c6898 ]
Various 360 degree hinges (yoga) style 2-in-1 devices use 2 accelerometers to allow the OS to determine the angle between the display and the base of the device.
On Windows these are read by a special HingeAngleService process which calls undocumented ACPI methods, to let the firmware know if the 2-in-1 is in tablet- or laptop-mode. The firmware may use this to disable the kbd and touchpad to avoid spurious input in tablet-mode as well as to report SW_TABLET_MODE info to the OS.
Since Linux does not call these undocumented methods, the SW_TABLET_MODE info reported by various pdx86 drivers is incorrect on these devices.
Before this commit the intel-hid and thinkpad_acpi code already had 2 hardcoded checks for ACPI hardware-ids of dual-accel sensors to avoid reporting broken info.
And now we also have a bug-report about the same problem in the intel-vbtn code. Since there are at least 3 different ACPI hardware-ids in play, add a new dual_accel_detect() helper which checks for all 3, rather then adding different hardware-ids to the drivers as bug-reports trickle in. Having shared code which checks all known hardware-ids is esp. important for the intel-hid and intel-vbtn drivers as these are generic drivers which are used on a lot of devices.
The BOSC0200 hardware-id requires special handling, because often it is used for a single-accelerometer setup. Only in a few cases it refers to a dual-accel setup, in which case there will be 2 I2cSerialBus resources in the device's resource-list, so the helper checks for this.
--- drivers/platform/x86/Kconfig | 3 + drivers/platform/x86/dual_accel_detect.h | 75 ++++++++++++++++++++++++ drivers/platform/x86/intel-hid.c | 21 ++----- drivers/platform/x86/intel-vbtn.c | 18 +++++- drivers/platform/x86/thinkpad_acpi.c | 3 +- 5 files changed, 101 insertions(+), 19 deletions(-) create mode 100644 drivers/platform/x86/dual_accel_detect.h
drivers/platform/x86/Kconfig +3 -0
@@ -507,6 +507,7 @@ config THINKPAD_ACPI depends on RFKILL || RFKILL = n depends on ACPI_VIDEO || ACPI_VIDEO = n depends on BACKLIGHT_CLASS_DEVICE + depends on I2C select ACPI_PLATFORM_PROFILE select HWMON select NVRAM
@@ -701,6 +702,7 @@ config INTEL_HID_EVENT tristate "INTEL HID Event" depends on ACPI depends on INPUT + depends on I2C select INPUT_SPARSEKMAP help This driver provides support for the Intel HID Event hotkey interface.
@@ -752,6 +754,7 @@ config INTEL_VBTN tristate "INTEL VIRTUAL BUTTON" depends on ACPI depends on INPUT + depends on I2C select INPUT_SPARSEKMAP help This driver provides support for the Intel Virtual Button interface.
drivers/platform/x86/dual_accel_detect.h new file +75 -0
75 lines not on this page · raw message
drivers/platform/x86/intel-hid.c +6 -15
@@ -14,6 +14,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/suspend.h> +#include "dual_accel_detect.h" /* When NOT in tablet mode, VGBS returns with the flag 0x40 */ #define TABLET_MODE_FLAG BIT(6)
@@ -121,6 +122,7 @@ struct intel_hid_priv {struct input_dev *array;struct input_dev *switches;bool wakeup_mode; +bool dual_accel; };#define HID_EVENT_FILTER_UUID "eeec56b3-4442-408f-a792-4edd4d758054"
@@ -450,22 +452,9 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)* SW_TABLET_MODE report, in these cases we enable support when receiving * the first event instead of during driver setup. * -* Some 360 degree hinges (yoga) style 2-in-1 devices use 2 accelerometers -* to allow the OS to determine the angle between the display and the base -* of the device. On Windows these are read by a special HingeAngleService -* process which calls an ACPI DSM (Device Specific Method) on the -* ACPI KIOX010A device node for the sensor in the display, to let the -* firmware know if the 2-in-1 is in tablet- or laptop-mode so that it can -* disable the kbd and touchpad to avoid spurious input in tablet-mode. -* -* The linux kxcjk1013 driver calls the DSM for this once at probe time -* to ensure that the builtin kbd and touchpad work. On some devices this -* causes a "spurious" 0xcd event on the intel-hid ACPI dev. In this case -* there is not a functional tablet-mode switch, so we should not register -* the tablet-mode switch device. +* See dual_accel_detect.h for more info on the dual_accel check. */ -if (!priv->switches && (event ==0xcc || event ==0xcd ) && - !acpi_dev_present ("KIOX010A" ,NULL ,-1 )) { +if (!priv->switches && !priv->dual_accel && (event ==0xcc || event ==0xcd )) {dev_info (&device->dev,"switch event received, enable switches supports\n" ); err =intel_hid_switches_setup (device);if (err)
@@ -606,6 +595,8 @@ static int intel_hid_probe(struct platform_device *device)return -ENOMEM ;dev_set_drvdata (&device->dev, priv); + priv->dual_accel =dual_accel_detect (); + err =intel_hid_input_setup (device);if (err) {pr_err ("Failed to setup Intel HID hotkeys\n" );
drivers/platform/x86/intel-vbtn.c +15 -3
@@ -14,6 +14,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/suspend.h> +#include "dual_accel_detect.h" /* Returned when NOT in tablet mode on some HP Stream x360 11 models */ #define VGBS_TABLET_MODE_FLAG_ALT 0x10
@@ -66,6 +67,7 @@ static const struct key_entry intel_vbtn_switchmap[] = {struct intel_vbtn_priv {struct input_dev *buttons_dev;struct input_dev *switches_dev; +bool dual_accel;bool has_buttons;bool has_switches;bool wakeup_mode;
@@ -160,6 +162,10 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) input_dev = priv->buttons_dev; }else if ((ke =sparse_keymap_entry_from_scancode (priv->switches_dev, event))) {if (!priv->has_switches) { +/* See dual_accel_detect.h for more info */ +if (priv->dual_accel) +return ; +dev_info (&device->dev,"Registering Intel Virtual Switches input-dev after receiving a switch event\n" ); ret =input_register_device (priv->switches_dev);if (ret)
@@ -248,11 +254,15 @@ static const struct dmi_system_id dmi_switches_allow_list[] = { {}/* Array terminator */ }; -static bool intel_vbtn_has_switches (acpi_handle handle) +static bool intel_vbtn_has_switches (acpi_handle handle,bool dual_accel) {unsigned long long vgbs;acpi_status status; +/* See dual_accel_detect.h for more info */ +if (dual_accel) +return false; +if (!dmi_check_system (dmi_switches_allow_list))return false;
@@ -263,13 +273,14 @@ static bool intel_vbtn_has_switches(acpi_handle handle)static int intel_vbtn_probe (struct platform_device *device) {acpi_handle handle =ACPI_HANDLE (&device->dev); -bool has_buttons, has_switches; +bool dual_accel, has_buttons, has_switches;struct intel_vbtn_priv *priv;acpi_status status;int err; + dual_accel =dual_accel_detect (); has_buttons =acpi_has_method (handle,"VBDL" ); - has_switches =intel_vbtn_has_switches (handle); + has_switches =intel_vbtn_has_switches (handle, dual_accel);if (!has_buttons && !has_switches) {dev_warn (&device->dev,"failed to read Intel Virtual Button driver\n" );
@@ -281,6 +292,7 @@ static int intel_vbtn_probe(struct platform_device *device)return -ENOMEM ;dev_set_drvdata (&device->dev, priv); + priv->dual_accel = dual_accel; priv->has_buttons = has_buttons; priv->has_switches = has_switches;
drivers/platform/x86/thinkpad_acpi.c +2 -1
@@ -73,6 +73,7 @@#include <linux/uaccess.h> #include <acpi/battery.h> #include <acpi/video.h> +#include "dual_accel_detect.h" /* ThinkPad CMOS commands */ #define TP_CMOS_VOLUME_DOWN 0
@@ -3232,7 +3233,7 @@ static int hotkey_init_tablet_mode(void)* the laptop/tent/tablet mode to the EC. The bmc150 iio driver * does not support this, so skip the hotkey on these models. */ -if (has_tablet_mode && !acpi_dev_present ("BOSC0200" ,"1" ,-1 )) +if (has_tablet_mode && !dual_accel_detect ()) tp_features.hotkey_tablet =TP_HOTKEY_TABLET_USES_GMMS ; type ="GMMS" ; }else if (acpi_evalf (hkey_handle, &res,"MHKG" ,"qd" )) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 6/113 ARC: Fix CONFIG_STACKDEPOT
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit bf79167fd86f3b97390fe2e70231d383526bd9cc ]
Enabling CONFIG_STACKDEPOT results in the following build error.
arc-elf-ld: lib/stackdepot.o: in function `filter_irq_stacks':
stackdepot.c:(.text+0x456): undefined reference to `__irqentry_text_start'
arc-elf-ld: stackdepot.c:(.text+0x456): undefined reference to `__irqentry_text_start'
arc-elf-ld: stackdepot.c:(.text+0x476): undefined reference to `__irqentry_text_end'
arc-elf-ld: stackdepot.c:(.text+0x476): undefined reference to `__irqentry_text_end'
arc-elf-ld: stackdepot.c:(.text+0x484): undefined reference to `__softirqentry_text_start'
arc-elf-ld: stackdepot.c:(.text+0x484): undefined reference to `__softirqentry_text_start'
arc-elf-ld: stackdepot.c:(.text+0x48c): undefined reference to `__softirqentry_text_end'
arc-elf-ld: stackdepot.c:(.text+0x48c): undefined reference to `__softirqentry_text_end'
Other architectures address this problem by adding IRQENTRY_TEXT and SOFTIRQENTRY_TEXT to the text segment, so do the same here.
--- arch/arc/kernel/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/arc/kernel/vmlinux.lds.S +2 -0
@@ -88,6 +88,8 @@ SECTIONS CPUIDLE_TEXT LOCK_TEXT KPROBES_TEXT + IRQENTRY_TEXT + SOFTIRQENTRY_TEXT *(.fixup) *(.gnu.warning) }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 7/113 netfilter: ipset: Limit the maximal range of consecutive elements to add/delete
In reply to Greg Kroah-HartmanFrom: Jozsef Kadlecsik <[email protected]>
[ Upstream commit 5f7b51bf09baca8e4f80cbe879536842bafb5f31 ]
The range size of consecutive elements were not limited. Thus one could define a huge range which may result soft lockup errors due to the long execution time. Now the range size is limited to 2^20 entries.
--- include/linux/netfilter/ipset/ip_set.h | 3 +++ net/netfilter/ipset/ip_set_hash_ip.c | 9 ++++++++- net/netfilter/ipset/ip_set_hash_ipmark.c | 10 +++++++++- net/netfilter/ipset/ip_set_hash_ipport.c | 3 +++ net/netfilter/ipset/ip_set_hash_ipportip.c | 3 +++ net/netfilter/ipset/ip_set_hash_ipportnet.c | 3 +++ net/netfilter/ipset/ip_set_hash_net.c | 11 ++++++++++- net/netfilter/ipset/ip_set_hash_netiface.c | 10 +++++++++- net/netfilter/ipset/ip_set_hash_netnet.c | 16 +++++++++++++++- net/netfilter/ipset/ip_set_hash_netport.c | 11 ++++++++++- net/netfilter/ipset/ip_set_hash_netportnet.c | 16 +++++++++++++++- 11 files changed, 88 insertions(+), 7 deletions(-)
include/linux/netfilter/ipset/ip_set.h +3 -0
@@ -196,6 +196,9 @@ struct ip_set_region {u32 elements;/* Number of elements vs timeout */ }; +/* Max range where every element is added/deleted in one step */ +#define IPSET_MAX_RANGE (1<<20) +/* The max revision number supported by any set type + 1 */ #define IPSET_REVISION_MAX 9
net/netfilter/ipset/ip_set_hash_ip.c +8 -1
@@ -132,8 +132,11 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], ret =ip_set_get_hostipaddr4 (tb[IPSET_ATTR_IP_TO ], &ip_to);if (ret)return ret; -if (ip > ip_to) +if (ip > ip_to) { +if (ip_to ==0 ) +return -IPSET_ERR_HASH_ELEM ;swap (ip, ip_to); + } }else if (tb[IPSET_ATTR_CIDR ]) {u8 cidr =nla_get_u8 (tb[IPSET_ATTR_CIDR ]);
@@ -144,6 +147,10 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], hosts = h->netmask ==32 ?1 :2 << (32 - h->netmask -1 ); +/* 64bit division is not allowed on 32bit */ +if (((u64 )ip_to - ip +1 ) >> (32 - h->netmask) >IPSET_MAX_RANGE ) +return -ERANGE ; +if (retried) { ip =ntohl (h->next.ip); e.ip =htonl (ip);
net/netfilter/ipset/ip_set_hash_ipmark.c +9 -1
@@ -121,6 +121,8 @@ hash_ipmark4_uadt(struct ip_set *set, struct nlattr *tb[], e.mark =ntohl (nla_get_be32 (tb[IPSET_ATTR_MARK ])); e.mark &= h->markmask; +if (e.mark ==0 && e.ip ==0 ) +return -IPSET_ERR_HASH_ELEM ;if (adt ==IPSET_TEST || !(tb[IPSET_ATTR_IP_TO ] || tb[IPSET_ATTR_CIDR ])) {
@@ -133,8 +135,11 @@ hash_ipmark4_uadt(struct ip_set *set, struct nlattr *tb[], ret =ip_set_get_hostipaddr4 (tb[IPSET_ATTR_IP_TO ], &ip_to);if (ret)return ret; -if (ip > ip_to) +if (ip > ip_to) { +if (e.mark ==0 && ip_to ==0 ) +return -IPSET_ERR_HASH_ELEM ;swap (ip, ip_to); + } }else if (tb[IPSET_ATTR_CIDR ]) {u8 cidr =nla_get_u8 (tb[IPSET_ATTR_CIDR ]);
@@ -143,6 +148,9 @@ hash_ipmark4_uadt(struct ip_set *set, struct nlattr *tb[],ip_set_mask_from_to (ip, ip_to, cidr); } +if (((u64 )ip_to - ip +1 ) >IPSET_MAX_RANGE ) +return -ERANGE ; +if (retried) ip =ntohl (h->next.ip);for (; ip <= ip_to; ip++) {
net/netfilter/ipset/ip_set_hash_ipport.c +3 -0
@@ -173,6 +173,9 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],swap (port, port_to); } +if (((u64 )ip_to - ip +1 )*(port_to - port +1 ) >IPSET_MAX_RANGE ) +return -ERANGE ; +if (retried) ip =ntohl (h->next.ip);for (; ip <= ip_to; ip++) {
net/netfilter/ipset/ip_set_hash_ipportip.c +3 -0
@@ -180,6 +180,9 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],swap (port, port_to); } +if (((u64 )ip_to - ip +1 )*(port_to - port +1 ) >IPSET_MAX_RANGE ) +return -ERANGE ; +if (retried) ip =ntohl (h->next.ip);for (; ip <= ip_to; ip++) {
net/netfilter/ipset/ip_set_hash_ipportnet.c +3 -0
@@ -253,6 +253,9 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],swap (port, port_to); } +if (((u64 )ip_to - ip +1 )*(port_to - port +1 ) >IPSET_MAX_RANGE ) +return -ERANGE ; + ip2_to = ip2_from;if (tb[IPSET_ATTR_IP2_TO ]) { ret =ip_set_get_hostipaddr4 (tb[IPSET_ATTR_IP2_TO ], &ip2_to);
net/netfilter/ipset/ip_set_hash_net.c +10 -1
@@ -140,7 +140,7 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *tb[],ipset_adtfn adtfn = set->variant->adt[adt];struct hash_net4_elem e = { .cidr =HOST_MASK };struct ip_set_ext ext =IP_SET_INIT_UEXT (set); -u32 ip =0 , ip_to =0 ; +u32 ip =0 , ip_to =0 , ipn, n =0 ;int ret;if (tb[IPSET_ATTR_LINENO ])
@@ -188,6 +188,15 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *tb[],if (ip +UINT_MAX == ip_to)return -IPSET_ERR_HASH_RANGE ; } + ipn = ip; +do { + ipn =ip_set_range_to_cidr (ipn, ip_to, &e.cidr); + n++; + }while (ipn++ < ip_to); + +if (n >IPSET_MAX_RANGE ) +return -ERANGE ; +if (retried) ip =ntohl (h->next.ip); do {
net/netfilter/ipset/ip_set_hash_netiface.c +9 -1
@@ -202,7 +202,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[],ipset_adtfn adtfn = set->variant->adt[adt];struct hash_netiface4_elem e = { .cidr =HOST_MASK , .elem =1 };struct ip_set_ext ext =IP_SET_INIT_UEXT (set); -u32 ip =0 , ip_to =0 ; +u32 ip =0 , ip_to =0 , ipn, n =0 ;int ret;if (tb[IPSET_ATTR_LINENO ])
@@ -256,6 +256,14 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[], }else {ip_set_mask_from_to (ip, ip_to, e.cidr); } + ipn = ip; +do { + ipn =ip_set_range_to_cidr (ipn, ip_to, &e.cidr); + n++; + }while (ipn++ < ip_to); + +if (n >IPSET_MAX_RANGE ) +return -ERANGE ;if (retried) ip =ntohl (h->next.ip);
net/netfilter/ipset/ip_set_hash_netnet.c +15 -1
@@ -168,7 +168,8 @@ hash_netnet4_uadt(struct ip_set *set, struct nlattr *tb[],struct hash_netnet4_elem e = { };struct ip_set_ext ext =IP_SET_INIT_UEXT (set);u32 ip =0 , ip_to =0 ; -u32 ip2 =0 , ip2_from =0 , ip2_to =0 ; +u32 ip2 =0 , ip2_from =0 , ip2_to =0 , ipn; +u64 n =0 , m =0 ;int ret;if (tb[IPSET_ATTR_LINENO ])
@@ -244,6 +245,19 @@ hash_netnet4_uadt(struct ip_set *set, struct nlattr *tb[], }else {ip_set_mask_from_to (ip2_from, ip2_to, e.cidr[1 ]); } + ipn = ip; +do { + ipn =ip_set_range_to_cidr (ipn, ip_to, &e.cidr[0 ]); + n++; + }while (ipn++ < ip_to); + ipn = ip2_from; +do { + ipn =ip_set_range_to_cidr (ipn, ip2_to, &e.cidr[1 ]); + m++; + }while (ipn++ < ip2_to); + +if (n*m >IPSET_MAX_RANGE ) +return -ERANGE ;if (retried) { ip =ntohl (h->next.ip[0 ]);
net/netfilter/ipset/ip_set_hash_netport.c +10 -1
@@ -158,7 +158,8 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[],ipset_adtfn adtfn = set->variant->adt[adt];struct hash_netport4_elem e = { .cidr =HOST_MASK -1 };struct ip_set_ext ext =IP_SET_INIT_UEXT (set); -u32 port, port_to, p =0 , ip =0 , ip_to =0 ; +u32 port, port_to, p =0 , ip =0 , ip_to =0 , ipn; +u64 n =0 ;bool with_ports = false;u8 cidr;int ret;
@@ -235,6 +236,14 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[], }else {ip_set_mask_from_to (ip, ip_to, e.cidr +1 ); } + ipn = ip; +do { + ipn =ip_set_range_to_cidr (ipn, ip_to, &cidr); + n++; + }while (ipn++ < ip_to); + +if (n*(port_to - port +1 ) >IPSET_MAX_RANGE ) +return -ERANGE ;if (retried) { ip =ntohl (h->next.ip);
net/netfilter/ipset/ip_set_hash_netportnet.c +15 -1
@@ -182,7 +182,8 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[],struct hash_netportnet4_elem e = { };struct ip_set_ext ext =IP_SET_INIT_UEXT (set);u32 ip =0 , ip_to =0 , p =0 , port, port_to; -u32 ip2_from =0 , ip2_to =0 , ip2; +u32 ip2_from =0 , ip2_to =0 , ip2, ipn; +u64 n =0 , m =0 ;bool with_ports = false;int ret;
@@ -284,6 +285,19 @@ hash_netportnet4_uadt(struct ip_set *set, struct nlattr *tb[], }else {ip_set_mask_from_to (ip2_from, ip2_to, e.cidr[1 ]); } + ipn = ip; +do { + ipn =ip_set_range_to_cidr (ipn, ip_to, &e.cidr[0 ]); + n++; + }while (ipn++ < ip_to); + ipn = ip2_from; +do { + ipn =ip_set_range_to_cidr (ipn, ip2_to, &e.cidr[1 ]); + m++; + }while (ipn++ < ip2_to); + +if (n*m*(port_to - port +1 ) >IPSET_MAX_RANGE ) +return -ERANGE ;if (retried) { ip =ntohl (h->next.ip[0 ]);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 8/113 netfilter: conntrack: collect all entries in one cycle
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 4608fdfc07e116f9fc0895beb40abad7cdb5ee3d ]
Michal Kubecek reports that conntrack gc is responsible for frequent wakeups (every 125ms) on idle systems.
On busy systems, timed out entries are evicted during lookup. The gc worker is only needed to remove entries after system becomes idle after a busy period.
To resolve this, always scan the entire table.
If the scan is taking too long, reschedule so other work_structs can run and resume from next bucket.
After a completed scan, wait for 2 minutes before the next cycle. Heuristics for faster re-schedule are removed.
GC_SCAN_INTERVAL could be exposed as a sysctl in the future to allow tuning this as-needed or even turn the gc worker off.
--- net/netfilter/nf_conntrack_core.c | 71 ++++++++++--------------------- 1 file changed, 22 insertions(+), 49 deletions(-)
net/netfilter/nf_conntrack_core.c +22 -49
@@ -68,22 +68,17 @@ EXPORT_SYMBOL_GPL(nf_conntrack_hash);struct conntrack_gc_work {struct delayed_work dwork; -u32 last_bucket; +u32 next_bucket;bool exiting;bool early_drop; -long next_gc_run; };static __read_mostly struct kmem_cache *nf_conntrack_cachep;static DEFINE_SPINLOCK (nf_conntrack_locks_all_lock);static __read_mostly bool nf_conntrack_locks_all; -/* every gc cycle scans at most 1/GC_MAX_BUCKETS_DIV part of table */ -#define GC_MAX_BUCKETS_DIV 128u -/* upper bound of full table scan */ -#define GC_MAX_SCAN_JIFFIES (16u * HZ) -/* desired ratio of entries found to be expired */ -#define GC_EVICT_RATIO 50u +#define GC_SCAN_INTERVAL (120u * HZ) +#define GC_SCAN_MAX_DURATION msecs_to_jiffies(10)static struct conntrack_gc_work conntrack_gc_work;
@@ -1359,17 +1354,13 @@ static bool gc_worker_can_early_drop(const struct nf_conn *ct)static void gc_worker (struct work_struct *work) { -unsigned int min_interval =max (HZ /GC_MAX_BUCKETS_DIV ,1u ); -unsigned int i, goal, buckets =0 , expired_count =0 ; -unsigned int nf_conntrack_max95 =0 ; +unsigned long end_time = jiffies +GC_SCAN_MAX_DURATION ; +unsigned int i, hashsz, nf_conntrack_max95 =0 ; +unsigned long next_run =GC_SCAN_INTERVAL ;struct conntrack_gc_work *gc_work; -unsigned int ratio, scanned =0 ; -unsigned long next_run; - gc_work = container_of(work, struct conntrack_gc_work, dwork.work); - goal = nf_conntrack_htable_size /GC_MAX_BUCKETS_DIV ; - i = gc_work->last_bucket; + i = gc_work->next_bucket;if (gc_work->early_drop) nf_conntrack_max95 = nf_conntrack_max /100u *95u ;
@@ -1377,15 +1368,15 @@ static void gc_worker(struct work_struct *work)struct nf_conntrack_tuple_hash *h;struct hlist_nulls_head *ct_hash;struct hlist_nulls_node *n; -unsigned int hashsz;struct nf_conn *tmp; - i++;rcu_read_lock ();nf_conntrack_get_ht (&ct_hash, &hashsz); -if (i >= hashsz) - i =0 ; +if (i >= hashsz) { +rcu_read_unlock (); +break ; + }hlist_nulls_for_each_entry_rcu (h, n, &ct_hash[i], hnnode) {struct nf_conntrack_net *cnet;
@@ -1393,7 +1384,6 @@ static void gc_worker(struct work_struct *work) tmp =nf_ct_tuplehash_to_ctrack (h); - scanned++;if (test_bit (IPS_OFFLOAD_BIT , &tmp->status)) {nf_ct_offload_timeout (tmp);continue ;
@@ -1401,7 +1391,6 @@ static void gc_worker(struct work_struct *work)if (nf_ct_is_expired (tmp)) {nf_ct_gc_expired (tmp); - expired_count++;continue ; }
@@ -1434,7 +1423,14 @@ static void gc_worker(struct work_struct *work)*/ rcu_read_unlock ();cond_resched (); - }while (++buckets < goal); + i++; + +if (time_after (jiffies, end_time) && i < hashsz) { + gc_work->next_bucket = i; + next_run =0 ; +break ; + } + }while (i < hashsz);if (gc_work->exiting)return ;
@@ -1445,40 +1441,17 @@ static void gc_worker(struct work_struct *work)* * This worker is only here to reap expired entries when system went * idle after a busy period. -* -* The heuristics below are supposed to balance conflicting goals: -* -* 1. Minimize time until we notice a stale entry -* 2. Maximize scan intervals to not waste cycles -* -* Normally, expire ratio will be close to 0. -* -* As soon as a sizeable fraction of the entries have expired -* increase scan frequency. */ - ratio = scanned ? expired_count *100 / scanned :0 ; -if (ratio >GC_EVICT_RATIO ) { - gc_work->next_gc_run = min_interval; - }else { -unsigned int max =GC_MAX_SCAN_JIFFIES /GC_MAX_BUCKETS_DIV ; - -BUILD_BUG_ON ((GC_MAX_SCAN_JIFFIES /GC_MAX_BUCKETS_DIV ) ==0 ); - - gc_work->next_gc_run += min_interval; -if (gc_work->next_gc_run > max) - gc_work->next_gc_run = max; +if (next_run) { + gc_work->early_drop = false; + gc_work->next_bucket =0 ; } - - next_run = gc_work->next_gc_run; - gc_work->last_bucket = i; - gc_work->early_drop = false;queue_delayed_work (system_power_efficient_wq, &gc_work->dwork, next_run); }static void conntrack_gc_work_init (struct conntrack_gc_work *gc_work) {INIT_DEFERRABLE_WORK (&gc_work->dwork, gc_worker); - gc_work->next_gc_run =HZ ; gc_work->exiting = false; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 9/113 once: Fix panic when module unload
In reply to Greg Kroah-HartmanFrom: Kefeng Wang <[email protected]>
[ Upstream commit 1027b96ec9d34f9abab69bc1a4dc5b1ad8ab1349 ]
DO_ONCEDEFINE_STATIC_KEY_TRUE(___once_key);__do_once_done
once_disable_jump(once_key);
INIT_WORK(&w->work, once_deferred);
struct once_work *w;
w->key = key;
schedule_work(&w->work); module unload
//*the key isdestroy*process_one_work
once_deferred
BUG_ON(!static_key_enabled(work->key));
static_key_count((struct static_key *)x) //*access key, crash*
When module uses DO_ONCE mechanism, it could crash due to the above concurrency problem, we could reproduce it with link[1].
Fix it by add/put module refcount in the once work process.
[1] https://lore.kernel.org/netdev/[email protected]/
--- include/linux/once.h | 4 ++-- lib/once.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-)
include/linux/once.h +2 -2
@@ -7,7 +7,7 @@bool __do_once_start (bool *done,unsigned long *flags);void __do_once_done (bool *done,struct static_key_true *once_key, -unsigned long *flags); +unsigned long *flags,struct module *mod);/* Call a function exactly once. The idea of DO_ONCE() is to perform * a function call such as initialization of random seeds, etc, only
@@ -46,7 +46,7 @@ void __do_once_done(bool *done, struct static_key_true *once_key,if (unlikely (___ret)) { \func (__VA_ARGS__); \__do_once_done (&___done, &___once_key, \ - &___flags); \ + &___flags,THIS_MODULE ); \ } \ } \ ___ret; \
lib/once.c +8 -3
@@ -3,10 +3,12 @@#include <linux/spinlock.h> #include <linux/once.h> #include <linux/random.h> +#include <linux/module.h> struct once_work {struct work_struct work;struct static_key_true *key; +struct module *module; };static void once_deferred (struct work_struct *w)
@@ -16,10 +18,11 @@ static void once_deferred(struct work_struct *w) work = container_of(w, struct once_work, work);BUG_ON (!static_key_enabled (work->key));static_branch_disable (work->key); +module_put (work->module);kfree (work); } -static void once_disable_jump (struct static_key_true *key) +static void once_disable_jump (struct static_key_true *key,struct module *mod) {struct once_work *w;
@@ -29,6 +32,8 @@ static void once_disable_jump(struct static_key_true *key)INIT_WORK (&w->work, once_deferred); w->key = key; + w->module = mod; +__module_get (mod);schedule_work (&w->work); }
@@ -53,11 +58,11 @@ bool __do_once_start(bool *done, unsigned long *flags)EXPORT_SYMBOL (__do_once_start);void __do_once_done (bool *done,struct static_key_true *once_key, -unsigned long *flags) +unsigned long *flags,struct module *mod)__releases (once_lock) { *done = true;spin_unlock_irqrestore (&once_lock, *flags); -once_disable_jump (once_key); +once_disable_jump (once_key, mod); }EXPORT_SYMBOL (__do_once_done);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 10/113 io_uring: rsrc ref lock needs to be IRQ safe
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 4956b9eaad456a88b0d56947bef036e086250beb ]
Nadav reports running into the below splat on re-enabling softirqs:
WARNING: CPU: 2 PID: 1777 at kernel/softirq.c:364 __local_bh_enable_ip+0xaa/0xe0 Modules linked in: CPU: 2 PID: 1777 Comm: umem Not tainted 5.13.1+ #161 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/22/2020 RIP: 0010:__local_bh_enable_ip+0xaa/0xe0 Code: a9 00 ff ff 00 74 38 65 ff 0d a2 21 8c 7a e8 ed 1a 20 00 fb 66 0f 1f 44 00 00 5b 41 5c 5d c3 65 8b 05 e6 2d 8c 7a 85 c0 75 9a <0f> 0b eb 96 e8 2d 1f 20 00 eb a5 4c 89 e7 e8 73 4f 0c 00 eb ae 65 RSP: 0018:ffff88812e58fcc8 EFLAGS: 00010046 RAX: 0000000000000000 RBX: 0000000000000201 RCX: dffffc0000000000 RDX: 0000000000000007 RSI: 0000000000000201 RDI: ffffffff8898c5ac RBP: ffff88812e58fcd8 R08: ffffffff8575dbbf R09: ffffed1028ef14f9 R10: ffff88814778a7c3 R11: ffffed1028ef14f8 R12: ffffffff85c9e9ae R13: ffff88814778a000 R14: ffff88814778a7b0 R15: ffff8881086db890 FS: 00007fbcfee17700(0000) GS:ffff8881e0300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000c0402a5008 CR3: 000000011c1ac003 CR4: 00000000003706e0 Call Trace: _raw_spin_unlock_bh+0x31/0x40 io_rsrc_node_ref_zero+0x13e/0x190 io_dismantle_req+0x215/0x220 io_req_complete_post+0x1b8/0x720 __io_complete_rw.isra.0+0x16b/0x1f0 io_complete_rw+0x10/0x20
where it's clear we end up calling the percpu count release directly from the completion path, as it's in atomic mode and we drop the last ref. For file/block IO, this can be from IRQ context already, and the softirq locking for rsrc isn't enough.
Just make the lock fully IRQ safe, and ensure we correctly safe state from the release path as we don't know the full context there.
--- fs/io_uring.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
fs/io_uring.c +5 -14
@@ -7105,16 +7105,6 @@ static void io_free_file_tables(struct io_file_table *table, unsigned nr_files) table->files =NULL ; } -static inline void io_rsrc_ref_lock (struct io_ring_ctx *ctx) -{ -spin_lock_bh (&ctx->rsrc_ref_lock); -} - -static inline void io_rsrc_ref_unlock (struct io_ring_ctx *ctx) -{ -spin_unlock_bh (&ctx->rsrc_ref_lock); -} -static void io_rsrc_node_destroy (struct io_rsrc_node *ref_node) {percpu_ref_exit (&ref_node->refs);
@@ -7131,9 +7121,9 @@ static void io_rsrc_node_switch(struct io_ring_ctx *ctx,struct io_rsrc_node *rsrc_node = ctx->rsrc_node; rsrc_node->rsrc_data = data_to_kill; -io_rsrc_ref_lock (ctx); +spin_lock_irq (&ctx->rsrc_ref_lock);list_add_tail (&rsrc_node->node, &ctx->rsrc_ref_list); -io_rsrc_ref_unlock (ctx); +spin_unlock_irq (&ctx->rsrc_ref_lock);atomic_inc (&data_to_kill->refs);percpu_ref_kill (&rsrc_node->refs);
@@ -7625,9 +7615,10 @@ static void io_rsrc_node_ref_zero(struct percpu_ref *ref) { struct io_rsrc_node *node = container_of(ref, struct io_rsrc_node, refs);struct io_ring_ctx *ctx = node->rsrc_data->ctx; +unsigned long flags;bool first_add = false; -io_rsrc_ref_lock (ctx); +spin_lock_irqsave (&ctx->rsrc_ref_lock, flags); node->done = true;while (!list_empty (&ctx->rsrc_ref_list)) {
@@ -7639,7 +7630,7 @@ static void io_rsrc_node_ref_zero(struct percpu_ref *ref)list_del (&node->node); first_add |=llist_add (&node->llist, &ctx->rsrc_put_llist); } -io_rsrc_ref_unlock (ctx); +spin_unlock_irqrestore (&ctx->rsrc_ref_lock, flags);if (first_add)mod_delayed_work (system_wq, &ctx->rsrc_put_work,HZ );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 11/113 blk-iocost: fix lockdep warning on blkcg->lock
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 11431e26c9c43fa26f6b33ee1a90989f57b86024 ]
blkcg->lock depends on q->queue_lock which may depend on another driver lock required in irq context, one example is dm-thin:
Chain exists of: &pool->lock#3 --> &q->queue_lock --> &blkcg->lock
Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&blkcg->lock); local_irq_disable(); lock(&pool->lock#3); lock(&q->queue_lock); <Interrupt> lock(&pool->lock#3);
Fix the issue by using spin_lock_irq(&blkcg->lock) in ioc_weight_write().
--- block/blk-iocost.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
block/blk-iocost.c +4 -4
@@ -3061,19 +3061,19 @@ static ssize_t ioc_weight_write(struct kernfs_open_file *of, char *buf,if (v <CGROUP_WEIGHT_MIN || v >CGROUP_WEIGHT_MAX )return -EINVAL ; -spin_lock (&blkcg->lock); +spin_lock_irq (&blkcg->lock); iocc->dfl_weight = v *WEIGHT_ONE ;hlist_for_each_entry (blkg, &blkcg->blkg_list, blkcg_node) {struct ioc_gq *iocg =blkg_to_iocg (blkg);if (iocg) { -spin_lock_irq (&iocg->ioc->lock); +spin_lock (&iocg->ioc->lock);ioc_now (iocg->ioc, &now);weight_updated (iocg, &now); -spin_unlock_irq (&iocg->ioc->lock); +spin_unlock (&iocg->ioc->lock); } } -spin_unlock (&blkcg->lock); +spin_unlock_irq (&blkcg->lock);return nbytes; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 12/113 ovl: fix uninitialized pointer read in ovl_lookup_real_one()
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
[ Upstream commit 580c610429b3994e8db24418927747cf28443cde ]
One error path can result in release_dentry_name_snapshot() being called before "name" was initialized by take_dentry_name_snapshot().
Fix by moving the release_dentry_name_snapshot() to immediately after the only use.
--- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/export.c +1 -1
@@ -392,6 +392,7 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected,*/ take_dentry_name_snapshot (&name, real); this =lookup_one_len (name.name.name, connected, name.name.len); +release_dentry_name_snapshot (&name); err =PTR_ERR (this);if (IS_ERR (this)) { goto fail;
@@ -406,7 +407,6 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected, } out: -release_dentry_name_snapshot (&name);dput (parent);inode_unlock (dir);return this;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 13/113 net: mscc: Fix non-GPL export of regmap APIs
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 48c812e0327744b4965296f65c23fe2405692afc ]
The ocelot driver makes use of regmap, wrapping it with driver specific operations that are thin wrappers around the core regmap APIs. These are exported with EXPORT_SYMBOL, dropping the _GPL from the core regmap exports which is frowned upon. Add _GPL suffixes to at least the APIs that are doing register I/O.
--- drivers/net/ethernet/mscc/ocelot_io.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/mscc/ocelot_io.c +8 -8
@@ -21,7 +21,7 @@ u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset) ocelot->map[target][reg & REG_MASK] + offset, &val);return val; } -EXPORT_SYMBOL (__ocelot_read_ix); +EXPORT_SYMBOL_GPL (__ocelot_read_ix);void __ocelot_write_ix (struct ocelot *ocelot,u32 val,u32 reg,u32 offset) {
@@ -32,7 +32,7 @@ void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset)regmap_write (ocelot->targets[target], ocelot->map[target][reg ®_MASK ] + offset, val); } -EXPORT_SYMBOL (__ocelot_write_ix); +EXPORT_SYMBOL_GPL (__ocelot_write_ix);void __ocelot_rmw_ix (struct ocelot *ocelot,u32 val,u32 mask,u32 reg,u32 offset)
@@ -45,7 +45,7 @@ void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg, ocelot->map[target][reg ®_MASK ] + offset, mask, val); } -EXPORT_SYMBOL (__ocelot_rmw_ix); +EXPORT_SYMBOL_GPL (__ocelot_rmw_ix);u32 ocelot_port_readl (struct ocelot_port *port,u32 reg) {
@@ -58,7 +58,7 @@ u32 ocelot_port_readl(struct ocelot_port *port, u32 reg)regmap_read (port->target, ocelot->map[target][reg ®_MASK ], &val);return val; } -EXPORT_SYMBOL (ocelot_port_readl); +EXPORT_SYMBOL_GPL (ocelot_port_readl);void ocelot_port_writel (struct ocelot_port *port,u32 val,u32 reg) {
@@ -69,7 +69,7 @@ void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg)regmap_write (port->target, ocelot->map[target][reg ®_MASK ], val); } -EXPORT_SYMBOL (ocelot_port_writel); +EXPORT_SYMBOL_GPL (ocelot_port_writel);void ocelot_port_rmwl (struct ocelot_port *port,u32 val,u32 mask,u32 reg) {
@@ -77,7 +77,7 @@ void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, u32 reg)ocelot_port_writel (port, (cur & (~mask)) | val, reg); } -EXPORT_SYMBOL (ocelot_port_rmwl); +EXPORT_SYMBOL_GPL (ocelot_port_rmwl);u32 __ocelot_target_read_ix (struct ocelot *ocelot,enum ocelot_target target,u32 reg,u32 offset)
@@ -128,7 +128,7 @@ int ocelot_regfields_init(struct ocelot *ocelot,return 0 ; } -EXPORT_SYMBOL (ocelot_regfields_init); +EXPORT_SYMBOL_GPL (ocelot_regfields_init);static struct regmap_config ocelot_regmap_config = { .reg_bits =32 ,
@@ -148,4 +148,4 @@ struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res)return devm_regmap_init_mmio (ocelot->dev, regs, &ocelot_regmap_config); } -EXPORT_SYMBOL (ocelot_regmap_init); +EXPORT_SYMBOL_GPL (ocelot_regmap_init);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 14/113 can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error counters
In reply to Greg Kroah-HartmanFrom: Stefan Mätje <[email protected]>
commit 044012b52029204900af9e4230263418427f4ba4 upstream.
This patch fixes the interchanged fetch of the CAN RX and TX error counters from the ESD_EV_CAN_ERROR_EXT message. The RX error counter is really in struct rx_msg::data[2] and the TX error counter is in struct rx_msg::data[3].
--- drivers/net/can/usb/esd_usb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/usb/esd_usb2.c +2 -2
@@ -224,8 +224,8 @@ static void esd_usb2_rx_event(struct esdif (id ==ESD_EV_CAN_ERROR_EXT ) {u8 state = msg->msg.rx.data[0 ];u8 ecc = msg->msg.rx.data[1 ]; -u8 txerr = msg->msg.rx.data[2 ]; -u8 rxerr = msg->msg.rx.data[3 ]; +u8 rxerr = msg->msg.rx.data[2 ]; +u8 txerr = msg->msg.rx.data[3 ]; skb =alloc_can_err_skb (priv->netdev, &cf);if (skb ==NULL ) {
Greg Kroah-Hartman
maintainerPATCH 15/113 ceph: correctly handle releasing an embedded cap flush
In reply to Greg Kroah-HartmanFrom: Xiubo Li <[email protected]>
commit b2f9fa1f3bd8846f50b355fc2168236975c4d264 upstream.
The ceph_cap_flush structures are usually dynamically allocated, but the ceph_cap_snap has an embedded one.
When force umounting, the client will try to remove all the session caps. During this, it will free them, but that should not be done with the ones embedded in a capsnap.
Fix this by adding a new boolean that indicates that the cap flush is embedded in a capsnap, and skip freeing it if that's set.
At the same time, switch to using list_del_init() when detaching the i_list and g_list heads. It's possible for a forced umount to remove these objects but then handle_cap_flushsnap_ack() races in and does the list_del_init() again, corrupting memory.
Cc: [email protected]
URL: https://tracker.ceph.com/issues/52283
--- fs/ceph/caps.c | 21 +++++++++++++-------- fs/ceph/mds_client.c | 7 ++++--- fs/ceph/snap.c | 3 +++ fs/ceph/super.h | 3 ++- 4 files changed, 22 insertions(+), 12 deletions(-)
fs/ceph/caps.c +13 -8
@@ -1753,7 +1753,11 @@ int __ceph_mark_dirty_caps(struct ceph_istruct ceph_cap_flush *ceph_alloc_cap_flush (void ) { -return kmem_cache_alloc (ceph_cap_flush_cachep,GFP_KERNEL ); +struct ceph_cap_flush *cf; + + cf =kmem_cache_alloc (ceph_cap_flush_cachep,GFP_KERNEL ); + cf->is_capsnap = false; +return cf; }void ceph_free_cap_flush (struct ceph_cap_flush *cf)
@@ -1788,7 +1792,7 @@ static bool __detach_cap_flush_from_mdsc prev->wake = true; wake = false; } -list_del (&cf->g_list); +list_del_init (&cf->g_list);return wake; }
@@ -1803,7 +1807,7 @@ static bool __detach_cap_flush_from_ci(s prev->wake = true; wake = false; } -list_del (&cf->i_list); +list_del_init (&cf->i_list);return wake; }
@@ -2423,7 +2427,7 @@ static void __kick_flushing_caps(struct ci->i_ceph_flags &= ~CEPH_I_KICK_FLUSH ;list_for_each_entry_reverse (cf, &ci->i_cap_flush_list, i_list) { -if (!cf->caps) { +if (cf->is_capsnap) { last_snap_flush = cf->tid;break ; }
@@ -2442,7 +2446,7 @@ static void __kick_flushing_caps(struct first_tid = cf->tid +1 ; -if (cf->caps) { +if (!cf->is_capsnap) {struct cap_msg_args arg; dout("kick_flushing_caps %p cap %p tid %llu %s\n",
@@ -3589,7 +3593,7 @@ static void handle_cap_flush_ack(struct cleaned = cf->caps;/* Is this a capsnap? */ -if (cf->caps ==0 ) +if (cf->is_capsnap)continue ;if (cf->tid <= flush_tid) {
@@ -3662,8 +3666,9 @@ out:while (!list_empty (&to_remove)) { cf =list_first_entry (&to_remove, struct ceph_cap_flush, i_list); -list_del (&cf->i_list); -ceph_free_cap_flush (cf); +list_del_init (&cf->i_list); +if (!cf->is_capsnap) +ceph_free_cap_flush (cf); }if (wake_ci)
fs/ceph/mds_client.c +4 -3
@@ -1621,7 +1621,7 @@ static int remove_session_caps_cb(structspin_lock (&mdsc->cap_dirty_lock);list_for_each_entry (cf, &to_remove, i_list) -list_del (&cf->g_list); +list_del_init (&cf->g_list);if (!list_empty (&ci->i_dirty_item)) { pr_warn_ratelimited(
@@ -1673,8 +1673,9 @@ static int remove_session_caps_cb(structstruct ceph_cap_flush *cf; cf =list_first_entry (&to_remove, struct ceph_cap_flush, i_list); -list_del (&cf->i_list); -ceph_free_cap_flush (cf); +list_del_init (&cf->i_list); +if (!cf->is_capsnap) +ceph_free_cap_flush (cf); }wake_up_all (&ci->i_cap_wq);
fs/ceph/snap.c +3 -0
@@ -487,6 +487,9 @@ void ceph_queue_cap_snap(struct ceph_inopr_err ("ENOMEM allocating ceph_cap_snap on %p\n" , inode);return ; } + capsnap->cap_flush.is_capsnap = true; +INIT_LIST_HEAD (&capsnap->cap_flush.i_list); +INIT_LIST_HEAD (&capsnap->cap_flush.g_list);spin_lock (&ci->i_ceph_lock); used =__ceph_caps_used (ci);
fs/ceph/super.h +2 -1
@@ -182,8 +182,9 @@ struct ceph_cap {struct ceph_cap_flush {u64 tid; -int caps;/* 0 means capsnap */ +int caps;bool wake;/* wake up flush waiters when finish ? */ +bool is_capsnap;/* true means capsnap */ struct list_head g_list;// global struct list_head i_list;// per inode };
Greg Kroah-Hartman
maintainerPATCH 16/113 dt-bindings: sifive-l2-cache: Fix select matching
In reply to Greg Kroah-HartmanFrom: Rob Herring <[email protected]>
commit 1c8094e394bceb4f1880f9d539bdd255c130826e upstream.
When the schema fixups are applied to 'select' the result is a single entry is required for a match, but that will never match as there should be 2 entries. Also, a 'select' schema should have the widest possible match, so use 'contains' which matches the compatible string(s) in any position and not just the first position.
--- Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml +4 -4
@@ -24,10 +24,10 @@ allOf: select: properties: compatible: - items: - - enum: - - sifive,fu540-c000-ccache - - sifive,fu740-c000-ccache + contains: + enum: + - sifive,fu540-c000-ccache + - sifive,fu740-c000-ccache required: - compatible
Greg Kroah-Hartman
maintainerPATCH 17/113 riscv: Ensure the value of FP registers in the core dump file is up to date
In reply to Greg Kroah-HartmanFrom: Vincent Chen <[email protected]>
commit 379eb01c21795edb4ca8d342503bd2183a19ec3a upstream.
The value of FP registers in the core dump file comes from the thread.fstate. However, kernel saves the FP registers to the thread.fstate only before scheduling out the process. If no process switch happens during the exception handling process, kernel will not have a chance to save the latest value of FP registers to thread.fstate. It will cause the value of FP registers in the core dump file may be incorrect. To solve this problem, this patch force lets kernel save the FP register into the thread.fstate if the target task_struct equals the current.
--- arch/riscv/kernel/ptrace.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/riscv/kernel/ptrace.c +4 -0
@@ -10,6 +10,7 @@#include <asm/ptrace.h> #include <asm/syscall.h> #include <asm/thread_info.h> +#include <asm/switch_to.h> #include <linux/audit.h> #include <linux/ptrace.h> #include <linux/elf.h>
@@ -56,6 +57,9 @@ static int riscv_fpr_get(struct task_str {struct __riscv_d_ext_state *fstate = &target->thread.fstate; +if (target == current) +fstate_save (current,task_pt_regs (current)); +membuf_write (&to, fstate, offsetof(struct __riscv_d_ext_state , fcsr));membuf_store (&to, fstate->fcsr);return membuf_zero (&to,4 );// explicitly pad
Greg Kroah-Hartman
maintainerPATCH 18/113 powerpc: Re-enable ARCH_ENABLE_SPLIT_PMD_PTLOCK
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
commit 310d2e83cb9b7f1e7232319880e3fcb57592fa10 upstream.
Commit 66f24fa766e3 ("mm: drop redundant ARCH_ENABLE_SPLIT_PMD_PTLOCK") broke PMD split page table lock for powerpc.
It selects the non-existent config ARCH_ENABLE_PMD_SPLIT_PTLOCK in arch/powerpc/platforms/Kconfig.cputype, but clearly intended to select ARCH_ENABLE_SPLIT_PMD_PTLOCK (notice the word swapping!), as that commit did for all other architectures.
Fix it by selecting the correct symbol ARCH_ENABLE_SPLIT_PMD_PTLOCK.
--- arch/powerpc/platforms/Kconfig.cputype | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/Kconfig.cputype +1 -1
@@ -97,7 +97,7 @@ config PPC_BOOK3S_64 select PPC_HAVE_PMU_SUPPORT select HAVE_ARCH_TRANSPARENT_HUGEPAGE select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION - select ARCH_ENABLE_PMD_SPLIT_PTLOCK + select ARCH_ENABLE_SPLIT_PMD_PTLOCK select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE select ARCH_SUPPORTS_HUGETLBFS select ARCH_SUPPORTS_NUMA_BALANCING
Greg Kroah-Hartman
maintainerPATCH 19/113 mm/memory_hotplug: fix potential permanent lru cache disable
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
commit 946746d1ad921e5f493b536533dda02ea22ca609 upstream.
If offline_pages failed after lru_cache_disable(), it forgot to do lru_cache_enable() in error path. So we would have lru cache disabled permanently in this case.
--- mm/memory_hotplug.c | 1 + 1 file changed, 1 insertion(+)
mm/memory_hotplug.c +1 -0
@@ -1854,6 +1854,7 @@ failed_removal_isolated:undo_isolate_page_range (start_pfn, end_pfn,MIGRATE_MOVABLE );memory_notify (MEM_CANCEL_OFFLINE , &arg); failed_removal_pcplists_disabled: +lru_cache_enable ();zone_pcp_enable (zone); failed_removal: pr_debug("memory offlining [mem %#010llx-%#010llx] failed due to %s\n",
Greg Kroah-Hartman
maintainerPATCH 20/113 Revert "btrfs: compression: dont try to compress if we dont have enough pages"
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit 4e9655763b82a91e4c341835bb504a2b1590f984 upstream.
This reverts commit f2165627319ffd33a6217275e5690b1ab5c45763.
[BUG]
It's no longer possible to create compressed inline extent after commit f2165627319f ("btrfs: compression: don't try to compress if we don't have enough pages").
[CAUSE]
For compression code, there are several possible reasons we have a range that needs to be compressed while it's no more than one page.
- Compressed inline write
The data is always smaller than one sector and the test lacks the condition to properly recognize a non-inline extent.
- Compressed subpage write
For the incoming subpage compressed write support, we require page alignment of the delalloc range.
And for 64K page size, we can compress just one page into smaller sectors.
For those reasons, the requirement for the data to be more than one page is not correct, and is already causing regression for compressed inline data writeback. The idea of skipping one page to avoid wasting CPU time could be revisited in the future.
[FIX]
Fix it by reverting the offending commit.
--- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/inode.c +1 -1
@@ -603,7 +603,7 @@ again:* inode has not been flagged as nocompress. This flag can * change at any time if we discover bad compression ratios. */ -if (nr_pages >1 &&inode_need_compress (BTRFS_I (inode), start, end)) { +if (inode_need_compress (BTRFS_I (inode), start, end)) {WARN_ON (pages); pages =kcalloc (nr_pages,sizeof (struct page *),GFP_NOFS );if (!pages) {
Greg Kroah-Hartman
maintainerPATCH 21/113 net: stmmac: fix kernel panic due to NULL pointer dereference of xsk_pool
In reply to Greg Kroah-HartmanFrom: Song Yoong Siang <[email protected]>
commit a6451192da2691dcf39507bd758dde35d4606ee1 upstream.
After free xsk_pool, there is possibility that napi polling is still running in the middle, thus causes a kernel crash due to kernel NULL pointer dereference of rx_q->xsk_pool and tx_q->xsk_pool.
Fix this by changing the XDP pool setup sequence to:
1. disable napi before free xsk_pool
2. enable napi after init xsk_pool
The following kernel panic is observed without this patch:
RIP: 0010:xsk_uses_need_wakeup+0x5/0x10 Call Trace: stmmac_napi_poll_rxtx+0x3a9/0xae0 [stmmac] __napi_poll+0x27/0x130 net_rx_action+0x233/0x280 __do_softirq+0xe2/0x2b6 run_ksoftirqd+0x1a/0x20 smpboot_thread_fn+0xac/0x140 ? sort_range+0x20/0x20 kthread+0x124/0x150 ? set_kthread_struct+0x40/0x40 ret_from_fork+0x1f/0x30 ---[ end trace a77c8956b79ac107 ]---
--- drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c +6 -6
@@ -34,18 +34,18 @@ static int stmmac_xdp_enable_pool(struct need_update =netif_running (priv->dev) &&stmmac_xdp_is_enabled (priv);if (need_update) { -stmmac_disable_rx_queue (priv, queue); -stmmac_disable_tx_queue (priv, queue);napi_disable (&ch->rx_napi);napi_disable (&ch->tx_napi); +stmmac_disable_rx_queue (priv, queue); +stmmac_disable_tx_queue (priv, queue); }set_bit (queue, priv->af_xdp_zc_qps);if (need_update) { -napi_enable (&ch->rxtx_napi);stmmac_enable_rx_queue (priv, queue);stmmac_enable_tx_queue (priv, queue); +napi_enable (&ch->rxtx_napi); err =stmmac_xsk_wakeup (priv->dev, queue,XDP_WAKEUP_RX );if (err)
@@ -72,10 +72,10 @@ static int stmmac_xdp_disable_pool(struc need_update =netif_running (priv->dev) &&stmmac_xdp_is_enabled (priv);if (need_update) { +napi_disable (&ch->rxtx_napi);stmmac_disable_rx_queue (priv, queue);stmmac_disable_tx_queue (priv, queue);synchronize_rcu (); -napi_disable (&ch->rxtx_napi); }xsk_pool_dma_unmap (pool,STMMAC_RX_DMA_ATTR );
@@ -83,10 +83,10 @@ static int stmmac_xdp_disable_pool(strucclear_bit (queue, priv->af_xdp_zc_qps);if (need_update) { -napi_enable (&ch->rx_napi); -napi_enable (&ch->tx_napi);stmmac_enable_rx_queue (priv, queue);stmmac_enable_tx_queue (priv, queue); +napi_enable (&ch->rx_napi); +napi_enable (&ch->tx_napi); }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 22/113 net: stmmac: fix kernel panic due to NULL pointer dereference of buf->xdp
In reply to Greg Kroah-HartmanFrom: Song Yoong Siang <[email protected]>
commit 2b9fff64f03219d78044d1ab40dde8e3d42e968a upstream.
Ensure a valid XSK buffer before proceed to free the xdp buffer.
The following kernel panic is observed without this patch:
RIP: 0010:xp_free+0x5/0x40 Call Trace: stmmac_napi_poll_rxtx+0x332/0xb30 [stmmac] ? stmmac_tx_timer+0x3c/0xb0 [stmmac] net_rx_action+0x13d/0x3d0 __do_softirq+0xfc/0x2fb ? smpboot_register_percpu_thread+0xe0/0xe0 run_ksoftirqd+0x32/0x70 smpboot_thread_fn+0x1d8/0x2c0 kthread+0x169/0x1a0 ? kthread_park+0x90/0x90 ret_from_fork+0x1f/0x30 ---[ end trace 0000000000000002 ]---
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -4
@@ -4925,6 +4925,10 @@ read_again:prefetch (np); +/* Ensure a valid XSK buffer before proceed */ +if (!buf->xdp) +break ; +if (priv->extend_desc) stmmac_rx_extended_status(priv, &priv->dev->stats, &priv->xstats,
@@ -4945,10 +4949,6 @@ read_again:continue ; } -/* Ensure a valid XSK buffer before proceed */ -if (!buf->xdp) -break ; -/* XSK pool expects RX frame 1:1 mapped to XSK buffer */ if (likely (status & rx_not_ls)) {xsk_buff_free (buf->xdp);
Greg Kroah-Hartman
maintainerPATCH 23/113 drm/i915: Fix syncmap memory leak
In reply to Greg Kroah-HartmanFrom: Matthew Brost <[email protected]>
commit a63bcf08f0efb5348105bb8e0e1e8c6671077753 upstream.
A small race exists between intel_gt_retire_requests_timeout and intel_timeline_exit which could result in the syncmap not getting free'd. Rather than work to hard to seal this race, simply cleanup the syncmap on fini.
unreferenced object 0xffff88813bc53b18 (size 96):
comm "gem_close_race", pid 5410, jiffies 4294917818 (age 1105.600s) hex dump (first 32 bytes):
01 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 00 ................
00 00 00 00 00 00 00 00 6b 6b 6b 6b 06 00 00 00 ........kkkk....
backtrace:
[<00000000120b863a>] __sync_alloc_leaf+0x1e/0x40 [i915]
[<00000000042f6959>] __sync_set+0x1bb/0x240 [i915]
[<0000000090f0e90f>] i915_request_await_dma_fence+0x1c7/0x400 [i915]
[<0000000056a48219>] i915_request_await_object+0x222/0x360 [i915]
[<00000000aaac4ee3>] i915_gem_do_execbuffer+0x1bd0/0x2250 [i915]
[<000000003c9d830f>] i915_gem_execbuffer2_ioctl+0x405/0xce0 [i915]
[<00000000fd7a8e68>] drm_ioctl_kernel+0xb0/0xf0 [drm]
[<00000000e721ee87>] drm_ioctl+0x305/0x3c0 [drm]
[<000000008b0d8986>] __x64_sys_ioctl+0x71/0xb0
[<0000000076c362a4>] do_syscall_64+0x33/0x80
[<00000000eb7a4831>] entry_SYSCALL_64_after_hwframe+0x44/0xa9--- drivers/gpu/drm/i915/gt/intel_timeline.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/gt/intel_timeline.c +9 -0
@@ -127,6 +127,15 @@ static void intel_timeline_fini(struct ri915_vma_put (timeline->hwsp_ggtt);i915_active_fini (&timeline->active); + +/* +* A small race exists between intel_gt_retire_requests_timeout and +* intel_timeline_exit which could result in the syncmap not getting +* free'd. Rather than work to hard to seal this race, simply cleanup +* the syncmap on fini. +*/ +i915_syncmap_free (&timeline->sync); +kfree (timeline); }
Greg Kroah-Hartman
maintainerPATCH 24/113 drm/i915/dp: Drop redundant debug print
In reply to Greg Kroah-HartmanFrom: Swati Sharma <[email protected]>
commit 71de496cc489b6bae2f51f89da7f28849bf2836e upstream.
drm_dp_dpcd_read/write already has debug error message. Drop redundant error messages which gives false status even if correct value is read in drm_dp_dpcd_read().
v2: -Added fixes tag (Ankit)
v3: -Fixed build error (CI)
--- drivers/gpu/drm/i915/display/intel_dp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +2 -7
@@ -3833,23 +3833,18 @@ static void intel_dp_check_device_servicstatic void intel_dp_check_link_service_irq (struct intel_dp *intel_dp) { -struct drm_i915_private *i915 =dp_to_i915 (intel_dp);u8 val;if (intel_dp->dpcd[DP_DPCD_REV ] <0x11 )return ;if (drm_dp_dpcd_readb (&intel_dp->aux, -DP_LINK_SERVICE_IRQ_VECTOR_ESI0 , &val) !=1 || !val) { -drm_dbg_kms (&i915->drm,"Error in reading link service irq vector\n" ); +DP_LINK_SERVICE_IRQ_VECTOR_ESI0 , &val) !=1 || !val)return ; - }if (drm_dp_dpcd_writeb (&intel_dp->aux, -DP_LINK_SERVICE_IRQ_VECTOR_ESI0 , val) !=1 ) { -drm_dbg_kms (&i915->drm,"Error in writing link service irq vector\n" ); +DP_LINK_SERVICE_IRQ_VECTOR_ESI0 , val) !=1 )return ; - }if (val &HDMI_LINK_STATUS_CHANGED )intel_dp_handle_hdmi_link_status_change (intel_dp);
Greg Kroah-Hartman
maintainerPATCH 25/113 drm/amdgpu: Cancel delayed work when GFXOFF is disabled
In reply to Greg Kroah-HartmanFrom: Michel Dänzer <[email protected]>
commit 32bc8f8373d2d6a681c96e4b25dca60d4d1c6016 upstream.
schedule_delayed_work does not push back the work if it was already scheduled before, so amdgpu_device_delay_enable_gfx_off ran ~100 ms after the first time GFXOFF was disabled and re-enabled, even if GFXOFF was disabled and re-enabled again during those 100 ms.
This resulted in frame drops / stutter with the upcoming mutter 41 release on Navi 14, due to constantly enabling GFXOFF in the HW and disabling it again (for getting the GPU clock counter).
To fix this, call cancel_delayed_work_sync when the disable count transitions from 0 to 1, and only schedule the delayed work on the reverse transition, not if the disable count was already 0. This makes sure the delayed work doesn't run at unexpected times, and allows it to be lock-free.
v2:
* Use cancel_delayed_work_sync & mutex_trylock instead of mod_delayed_work.
v3:
* Make amdgpu_device_delay_enable_gfx_off lock-free (Christian König) v4:
* Fix race condition between amdgpu_gfx_off_ctrl incrementing adev->gfx.gfx_off_req_count and amdgpu_device_delay_enable_gfx_off checking for it to be 0 (Evan Quan)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 38 +++++++++++++++++++---------- 2 files changed, 31 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -6
@@ -2690,12 +2690,11 @@ static void amdgpu_device_delay_enable_gstruct amdgpu_device *adev = container_of(work, struct amdgpu_device, gfx.gfx_off_delay_work.work); -mutex_lock (&adev->gfx.gfx_off_mutex); -if (!adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) { -if (!amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_GFX , true)) - adev->gfx.gfx_off_state = true; - } -mutex_unlock (&adev->gfx.gfx_off_mutex); +WARN_ON_ONCE (adev->gfx.gfx_off_state); +WARN_ON_ONCE (adev->gfx.gfx_off_req_count); + +if (!amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_GFX , true)) + adev->gfx.gfx_off_state = true; }/**
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +26 -12
@@ -563,24 +563,38 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_dmutex_lock (&adev->gfx.gfx_off_mutex); -if (!enable) - adev->gfx.gfx_off_req_count++; -else if (adev->gfx.gfx_off_req_count >0 ) +if (enable) { +/* If the count is already 0, it means there's an imbalance bug somewhere. +* Note that the bug may be in a different caller than the one which triggers the +* WARN_ON_ONCE. +*/ +if (WARN_ON_ONCE (adev->gfx.gfx_off_req_count ==0 )) + goto unlock; + adev->gfx.gfx_off_req_count--; -if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) { -schedule_delayed_work (&adev->gfx.gfx_off_delay_work,GFX_OFF_DELAY_ENABLE ); - }else if (!enable && adev->gfx.gfx_off_state) { -if (!amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_GFX , false)) { - adev->gfx.gfx_off_state = false; - -if (adev->gfx.funcs->init_spm_golden) { -dev_dbg (adev->dev,"GFXOFF is disabled, re-init SPM golden settings\n" ); -amdgpu_gfx_init_spm_golden (adev); +if (adev->gfx.gfx_off_req_count ==0 && !adev->gfx.gfx_off_state) +schedule_delayed_work (&adev->gfx.gfx_off_delay_work,GFX_OFF_DELAY_ENABLE ); + }else { +if (adev->gfx.gfx_off_req_count ==0 ) { +cancel_delayed_work_sync (&adev->gfx.gfx_off_delay_work); + +if (adev->gfx.gfx_off_state && + !amdgpu_dpm_set_powergating_by_smu (adev,AMD_IP_BLOCK_TYPE_GFX , false)) { + adev->gfx.gfx_off_state = false; + +if (adev->gfx.funcs->init_spm_golden) { +dev_dbg (adev->dev, +"GFXOFF is disabled, re-init SPM golden settings\n" ); +amdgpu_gfx_init_spm_golden (adev); + } } } + + adev->gfx.gfx_off_req_count++; } +unlock:mutex_unlock (&adev->gfx.gfx_off_mutex); }
Greg Kroah-Hartman
maintainerPATCH 26/113 drm/amdgpu: use the preferred pin domain after the check
In reply to Greg Kroah-HartmanFrom: Christian König <[email protected]>
commit 2a7b9a8437130fd328001f4edfac8eec98dfe298 upstream.
For some reason we run into an use case where a BO is already pinned into GTT, but should be pinned into VRAM|GTT again.
Handle that case gracefully as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5 -5
@@ -937,11 +937,6 @@ int amdgpu_bo_pin_restricted(struct amdgreturn -EINVAL ; } -/* This assumes only APU display buffers are pinned with (VRAM|GTT). -* See function amdgpu_display_supported_domains() -*/ - domain =amdgpu_bo_get_preferred_pin_domain (adev, domain); -if (bo->tbo.pin_count) {uint32_t mem_type = bo->tbo.mem.mem_type;uint32_t mem_flags = bo->tbo.mem.placement;
@@ -966,6 +961,11 @@ int amdgpu_bo_pin_restricted(struct amdgreturn 0 ; } +/* This assumes only APU display buffers are pinned with (VRAM|GTT). +* See function amdgpu_display_supported_domains() +*/ + domain =amdgpu_bo_get_preferred_pin_domain (adev, domain); +if (bo->tbo.base.import_attach)dma_buf_pin (bo->tbo.base.import_attach);
Greg Kroah-Hartman
maintainerPATCH 27/113 drm/amdgpu: Fix build with missing pm_suspend_target_state module export
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
commit c41a4e877a185241d8e83501453326fb98f67354 upstream.
Building a randconfig here triggered:
ERROR: modpost: "pm_suspend_target_state" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
because the module export of that symbol happens in kernel/power/suspend.c which is enabled with CONFIG_SUSPEND.
The ifdef guards in amdgpu_acpi_is_s0ix_supported(), however, test for CONFIG_PM_SLEEP which is defined like this:
config PM_SLEEP
def_bool y
depends on SUSPEND || HIBERNATE_CALLBACKSand that randconfig has:
# CONFIG_SUSPEND is not set
CONFIG_HIBERNATE_CALLBACKS=y
leading to the module export missing.
Change the ifdeffery to depend directly on CONFIG_SUSPEND.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +1 -1
@@ -904,7 +904,7 @@ void amdgpu_acpi_fini(struct amdgpu_devi*/ bool amdgpu_acpi_is_s0ix_supported (struct amdgpu_device *adev) { -#if IS_ENABLED (CONFIG_AMD_PMC ) &&IS_ENABLED (CONFIG_PM_SLEEP ) +#if IS_ENABLED (CONFIG_AMD_PMC ) &&IS_ENABLED (CONFIG_SUSPEND )if (acpi_gbl_FADT.flags &ACPI_FADT_LOW_POWER_S0 ) {if (adev->flags &AMD_IS_APU )return pm_suspend_target_state ==PM_SUSPEND_TO_IDLE ;
Greg Kroah-Hartman
maintainerPATCH 28/113 Revert "USB: serial: ch341: fix character loss at high transfer rates"
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit df7b16d1c00ecb3da3a30c999cdb39f273c99a2f upstream.
This reverts commit 3c18e9baee0ef97510dcda78c82285f52626764b.
These devices do not appear to send a zero-length packet when the transfer size is a multiple of the bulk-endpoint max-packet size. This means that incoming data may not be processed by the driver until a short packet is received or the receive buffer is full.
Revert back to using endpoint-sized receive buffers to avoid stalled reads.
--- drivers/usb/serial/ch341.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/serial/ch341.c +0 -1
@@ -851,7 +851,6 @@ static struct usb_serial_driver ch341_de .owner = THIS_MODULE, .name = "ch341-uart", }, - .bulk_in_size = 512, .id_table = id_table, .num_ports = 1, .open = ch341_open,
Greg Kroah-Hartman
maintainerPATCH 29/113 USB: serial: option: add new VID/PID to support Fibocom FG150
In reply to Greg Kroah-HartmanFrom: Zhengjun Zhang <[email protected]>
commit 2829a4e3cf3a6ac2fa3cdb681b37574630fb9c1a upstream.
Fibocom FG150 is a 5G module based on Qualcomm SDX55 platform, support Sub-6G band.
Here are the outputs of lsusb -v and usb-devices:
Quoted 236 lines
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 P: Vendor=2cb7 ProdID=010b Rev=04.14 S: Manufacturer=Fibocom S: Product=Fibocom Modem_SN:XXXXXXXX S: SerialNumber=XXXXXXXX C: #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA I: If#=0x0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host I: If#=0x1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) I: If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none) I: If#=0x4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)Bus 002 Device 002: ID 2cb7:010b Fibocom Fibocom Modem_SN:XXXXXXXX Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.20bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 9 idVendor 0x2cb7 Fibocom idProduct 0x010b bcdDevice 4.14 iManufacturer 1 Fibocom iProduct 2 Fibocom Modem_SN:XXXXXXXX iSerial 3 XXXXXXXX bNumConfigurations 1Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength0x00e6
bNumInterfaces 5
bConfigurationValue 1
iConfiguration 4RNDIS_DUN_DIAG_ADB
bmAttributes0xa0
(Bus Powered)
Remote Wakeup
MaxPower 896mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 239 Miscellaneous Device
bFunctionSubClass 4
bFunctionProtocol 1
iFunction 7 RNDIS
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 239 Miscellaneous Device
bInterfaceSubClass 4
bInterfaceProtocol 1
iInterface 0
** UNRECOGNIZED: 05 24 00 10 01
** UNRECOGNIZED: 05 24 01 00 01
** UNRECOGNIZED: 04 24 02 00
** UNRECOGNIZED: 05 24 06 00 01
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x81EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize0x00081x 8 bytes
bInterval 9
bMaxBurst 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x8eEP 14 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 6
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x0fEP 15 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 6
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
** UNRECOGNIZED: 05 24 00 10 01
** UNRECOGNIZED: 05 24 01 00 00
** UNRECOGNIZED: 04 24 02 02
** UNRECOGNIZED: 05 24 06 00 00
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x83EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize0x000a1x 10 bytes
bInterval 9
bMaxBurst 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x82EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x01EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 48
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x84EP 4 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x02EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 4
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 66
bInterfaceProtocol 1
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x03EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress0x85EP 5 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize0x04001x 1024 bytes
bInterval 0
bMaxBurst 0
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength0x0016
bNumDeviceCaps 2
USB 2.0 Extension Device Capability:
bLength 7
bDescriptorType 16
bDevCapabilityType 2
bmAttributes0x00000006
BESL Link Power Management (LPM) Supported
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes0x00
wSpeedsSupported0x000f
Device can operate at Low Speed (1Mbps)
Device can operate at Full Speed (12Mbps)
Quoted 8 lines
Device can operate at High Speed (480Mbps)
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 1
Lowest fully-functional device speed is Full Speed (12Mbps)
bU1DevExitLat 1 micro seconds
bU2DevExitLat 500 micro seconds
Device Status:0x0000
(Bus Powered)
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -2074,6 +2074,8 @@ static const struct usb_device_id option .driver_info = RSVD(4) | RSVD(5) }, { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0105, 0xff), /* Fibocom NL678 series */ .driver_info = RSVD(6) }, + { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0xff, 0x30) }, /* Fibocom FG150 Diag */ + { USB_DEVICE_AND_INTERFACE_INFO(0x2cb7, 0x010b, 0xff, 0, 0) }, /* Fibocom FG150 AT */ { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x01a0, 0xff) }, /* Fibocom NL668-AM/NL652-EU (laptop MBIM) */ { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */ { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */
Greg Kroah-Hartman
maintainerPATCH 30/113 usb: renesas-xhci: Prefer firmware loading on unknown ROM state
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit c82cacd2f1e622a461a77d275a75d7e19e7635a3 upstream.
The recent attempt to handle an unknown ROM state in the commit d143825baf15 ("usb: renesas-xhci: Fix handling of unknown ROM state") resulted in a regression and reverted later by the commit 44cf53602f5a ("Revert "usb: renesas-xhci: Fix handling of unknown ROM state""). The problem of the former fix was that it treated the failure of firmware loading as a fatal error. Since the firmware files aren't included in the standard linux-firmware tree, most users don't have them, hence they got the non-working system after that. The revert fixed the regression, but also it didn't make the firmware loading triggered even on the devices that do need it. So we need still a fix for them.
This is another attempt to handle the unknown ROM state. Like the previous fix, this also tries to load the firmware when ROM shows unknown state. In this patch, however, the failure of a firmware loading (such as a missing firmware file) isn't handled as a fatal error any longer when ROM has been already detected, but it falls back to the ROM mode like before. The error is returned only when no ROM is detected and the firmware loading failed.
Along with it, for simplifying the code flow, the detection and the check of ROM is factored out from renesas_fw_check_running() and done in the caller side, renesas_xhci_check_request_fw(). It avoids the redundant ROM checks.
The patch was tested on Lenovo Thinkpad T14 gen (BIOS 1.34). Also it was confirmed that no regression is seen on another Thinkpad T14 machine that has worked without the patch, too.
--- drivers/usb/host/xhci-pci-renesas.c | 35 +++++++++++++++++++---------- 1 file changed, 23 insertions(+), 12 deletions(-)
drivers/usb/host/xhci-pci-renesas.c +23 -12
@@ -207,7 +207,8 @@ static int renesas_check_rom_state(struct pci_dev *pdev)return 0 ;case RENESAS_ROM_STATUS_NO_RESULT :/* No result yet */ -return 0 ; +dev_dbg (&pdev->dev,"Unknown ROM status ...\n" ); +return -ENOENT ;case RENESAS_ROM_STATUS_ERROR :/* Error State */ default :/* All other states are marked as "Reserved states" */
@@ -224,14 +225,6 @@ static int renesas_fw_check_running(struct pci_dev *pdev)u8 fw_state;int err; -/* Check if device has ROM and loaded, if so skip everything */ - err =renesas_check_rom (pdev); -if (err) {/* we have rom */ - err =renesas_check_rom_state (pdev); -if (!err) -return err; - } -/* * Test if the device is actually needing the firmware. As most * BIOSes will initialize the device for us. If the device is
@@ -591,21 +584,39 @@ int renesas_xhci_check_request_fw(struct pci_dev *pdev, (struct xhci_driver_data *)id->driver_data;const char *fw_name = driver_data->firmware;const struct firmware *fw; +bool has_rom;int err; +/* Check if device has ROM and loaded, if so skip everything */ + has_rom =renesas_check_rom (pdev); +if (has_rom) { + err =renesas_check_rom_state (pdev); +if (!err) +return 0 ; +else if (err != -ENOENT ) + has_rom = false; + } + err =renesas_fw_check_running (pdev);/* Continue ahead, if the firmware is already running. */ if (err ==0 )return 0 ; +/* no firmware interface available */ if (err !=1 ) -return err; +return has_rom ?0 : err;pci_dev_get (pdev); - err =request_firmware (&fw, fw_name, &pdev->dev); + err =firmware_request_nowarn (&fw, fw_name, &pdev->dev);pci_dev_put (pdev);if (err) { -dev_err (&pdev->dev,"request_firmware failed: %d\n" , err); +if (has_rom) { +dev_info (&pdev->dev,"failed to load firmware %s, fallback to ROM\n" , + fw_name); +return 0 ; + } +dev_err (&pdev->dev,"failed to load firmware %s: %d\n" , + fw_name, err);return err; }
Signature · 1 line
2.32.0
Greg Kroah-Hartman
maintainerPATCH 31/113 usb: typec: tcpm: Raise vdm_sm_running flag only when VDM SM is running
In reply to Greg Kroah-HartmanFrom: Kyle Tso <[email protected]>
commit ef52b4a9fcc24e17e81cc60357e6107ae4e9c48e upstream.
If the port is going to send Discover_Identity Message, vdm_sm_running flag was intentionally set before entering Ready States in order to avoid the conflict because the port and the port partner might start AMS at almost the same time after entering Ready States.
However, the original design has a problem. When the port is doing DR_SWAP from Device to Host, it raises the flag. Later in the tcpm_send_discover_work, the flag blocks the procedure of sending the Discover_Identity and it might never be cleared until disconnection.
Since there exists another flag send_discover representing that the port is going to send Discover_Identity or not, it is enough to use that flag to prevent the conflict. Also change the timing of the set/clear of vdm_sm_running to indicate whether the VDM SM is actually running or not.
--- drivers/usb/typec/tcpm/tcpm.c | 81 +++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 43 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +38 -43
@@ -341,6 +341,7 @@ struct tcpm_port {bool vbus_source;bool vbus_charge; +/* Set to true when Discover_Identity Command is expected to be sent in Ready states. */ bool send_discover;bool op_vsafe5v;
@@ -370,6 +371,7 @@ struct tcpm_port {struct hrtimer send_discover_timer;struct kthread_work send_discover_work;bool state_machine_running; +/* Set to true when VDM State Machine has following actions. */ bool vdm_sm_running;struct completion tx_complete;
@@ -1403,6 +1405,7 @@ static void tcpm_queue_vdm(struct tcpm_p/* Set ready, vdm state machine will actually send */ port->vdm_retries =0 ; port->vdm_state =VDM_STATE_READY ; + port->vdm_sm_running = true;mod_vdm_delayed_work (port,0 ); }
@@ -1645,7 +1648,6 @@ static int tcpm_pd_svdm(struct tcpm_port rlen =1 ; }else {tcpm_register_partner_altmodes (port); - port->vdm_sm_running = false; }break ;case CMD_ENTER_MODE :
@@ -1693,14 +1695,12 @@ static int tcpm_pd_svdm(struct tcpm_port (VDO_SVDM_VERS (svdm_version));break ; } - port->vdm_sm_running = false;break ;default : response[0 ] = p[0 ] |VDO_CMDT (CMDT_RSP_NAK ); rlen =1 ; response[0 ] = (response[0 ] & ~VDO_SVDM_VERS_MASK ) | (VDO_SVDM_VERS (svdm_version)); - port->vdm_sm_running = false;break ; }
@@ -1741,6 +1741,20 @@ static void tcpm_handle_vdm_request(stru }if (PD_VDO_SVDM (p[0 ]) && (adev ||tcpm_vdm_ams (port) || port->nr_snk_vdo)) { +/* +* Here a SVDM is received (INIT or RSP or unknown). Set the vdm_sm_running in +* advance because we are dropping the lock but may send VDMs soon. +* For the cases of INIT received: +* - If no response to send, it will be cleared later in this function. +* - If there are responses to send, it will be cleared in the state machine. +* For the cases of RSP received: +* - If no further INIT to send, it will be cleared later in this function. +* - Otherwise, it will be cleared in the state machine if timeout or it will go +* back here until no further INIT to send. +* For the cases of unknown type received: +* - We will send NAK and the flag will be cleared in the state machine. +*/ + port->vdm_sm_running = true; rlen =tcpm_pd_svdm (port, adev, p, cnt, response, &adev_action); }else {if (port->negotiated_rev >=PD_REV30 )
@@ -1809,6 +1823,8 @@ static void tcpm_handle_vdm_request(struif (rlen >0 )tcpm_queue_vdm (port, response[0 ], &response[1 ], rlen -1 ); +else + port->vdm_sm_running = false; } static void tcpm_send_vdm(struct tcpm_port *port, u32 vid, int cmd,
@@ -1874,8 +1890,10 @@ static void vdm_run_state_machine(struct* if there's traffic or we're not in PDO ready state don't send * a VDM. */ -if (port->state !=SRC_READY && port->state !=SNK_READY ) +if (port->state !=SRC_READY && port->state !=SNK_READY ) { + port->vdm_sm_running = false;break ; + }/* TODO: AMS operation for Unstructured VDM */ if (PD_VDO_SVDM (vdo_hdr) &&PD_VDO_CMDT (vdo_hdr) ==CMDT_INIT ) {
@@ -2528,10 +2546,6 @@ static void tcpm_pd_ctrl_request(structTYPEC_PWR_MODE_PD , port->pps_data.active, port->supply_voltage); -/* Set VDM running flag ASAP */ -if (port->data_role ==TYPEC_HOST && - port->send_discover) - port->vdm_sm_running = true;tcpm_set_state (port,SNK_READY ,0 ); }else {/*
@@ -2569,14 +2583,10 @@ static void tcpm_pd_ctrl_request(structswitch (port->state) {case SNK_NEGOTIATE_CAPABILITIES :/* USB PD specification, Figure 8-43 */ -if (port->explicit_contract) { +if (port->explicit_contract) next_state =SNK_READY ; -if (port->data_role ==TYPEC_HOST && - port->send_discover) - port->vdm_sm_running = true; - }else { +else next_state =SNK_WAIT_CAPABILITIES ; - }/* Threshold was relaxed before sending Request. Restore it back. */ tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_PD,
@@ -2591,10 +2601,6 @@ static void tcpm_pd_ctrl_request(struct port->pps_status = (type ==PD_CTRL_WAIT ? -EAGAIN : -EOPNOTSUPP ); -if (port->data_role ==TYPEC_HOST && - port->send_discover) - port->vdm_sm_running = true; -/* Threshold was relaxed before sending Request. Restore it back. */ tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_PD, port->pps_data.active,
@@ -2670,10 +2676,6 @@ static void tcpm_pd_ctrl_request(struct }break ;case DR_SWAP_SEND : -if (port->data_role ==TYPEC_DEVICE && - port->send_discover) - port->vdm_sm_running = true; -tcpm_set_state (port,DR_SWAP_CHANGE_DR ,0 );break ;case PR_SWAP_SEND :
@@ -2711,7 +2713,7 @@ static void tcpm_pd_ctrl_request(structPD_MSG_CTRL_NOT_SUPP , NONE_AMS); }else { -if (port->vdm_sm_running) { +if (port->send_discover) {tcpm_queue_message (port,PD_MSG_CTRL_WAIT );break ; }
@@ -2727,7 +2729,7 @@ static void tcpm_pd_ctrl_request(structPD_MSG_CTRL_NOT_SUPP , NONE_AMS); }else { -if (port->vdm_sm_running) { +if (port->send_discover) {tcpm_queue_message (port,PD_MSG_CTRL_WAIT );break ; }
@@ -2736,7 +2738,7 @@ static void tcpm_pd_ctrl_request(struct }break ;case PD_CTRL_VCONN_SWAP : -if (port->vdm_sm_running) { +if (port->send_discover) {tcpm_queue_message (port,PD_MSG_CTRL_WAIT );break ; }
@@ -4470,18 +4472,20 @@ static void run_state_machine(struct tcp/* DR_Swap states */ case DR_SWAP_SEND :tcpm_pd_send_control (port,PD_CTRL_DR_SWAP ); +if (port->data_role ==TYPEC_DEVICE || port->negotiated_rev >PD_REV20 ) + port->send_discover = true;tcpm_set_state_cond (port,DR_SWAP_SEND_TIMEOUT ,PD_T_SENDER_RESPONSE );break ;case DR_SWAP_ACCEPT :tcpm_pd_send_control (port,PD_CTRL_ACCEPT ); -/* Set VDM state machine running flag ASAP */ -if (port->data_role ==TYPEC_DEVICE && port->send_discover) - port->vdm_sm_running = true; +if (port->data_role ==TYPEC_DEVICE || port->negotiated_rev >PD_REV20 ) + port->send_discover = true;tcpm_set_state_cond (port,DR_SWAP_CHANGE_DR ,0 );break ;case DR_SWAP_SEND_TIMEOUT :tcpm_swap_complete (port, -ETIMEDOUT ); + port->send_discover = false;tcpm_ams_finish (port);tcpm_set_state (port,ready_state (port),0 );break ;
@@ -4493,7 +4497,6 @@ static void run_state_machine(struct tcp }else {tcpm_set_roles (port, true, port->pwr_role,TYPEC_HOST ); - port->send_discover = true; }tcpm_ams_finish (port);tcpm_set_state (port,ready_state (port),0 );
@@ -4633,8 +4636,6 @@ static void run_state_machine(struct tcpbreak ;case VCONN_SWAP_SEND_TIMEOUT :tcpm_swap_complete (port, -ETIMEDOUT ); -if (port->data_role ==TYPEC_HOST && port->send_discover) - port->vdm_sm_running = true;tcpm_set_state (port,ready_state (port),0 );break ;case VCONN_SWAP_START :
@@ -4650,14 +4651,10 @@ static void run_state_machine(struct tcpcase VCONN_SWAP_TURN_ON_VCONN :tcpm_set_vconn (port, true);tcpm_pd_send_control (port,PD_CTRL_PS_RDY ); -if (port->data_role ==TYPEC_HOST && port->send_discover) - port->vdm_sm_running = true;tcpm_set_state (port,ready_state (port),0 );break ;case VCONN_SWAP_TURN_OFF_VCONN :tcpm_set_vconn (port, false); -if (port->data_role ==TYPEC_HOST && port->send_discover) - port->vdm_sm_running = true;tcpm_set_state (port,ready_state (port),0 );break ;
@@ -4665,8 +4662,6 @@ static void run_state_machine(struct tcpcase PR_SWAP_CANCEL :case VCONN_SWAP_CANCEL :tcpm_swap_complete (port, port->swap_status); -if (port->data_role ==TYPEC_HOST && port->send_discover) - port->vdm_sm_running = true;if (port->pwr_role ==TYPEC_SOURCE )tcpm_set_state (port,SRC_READY ,0 );else
@@ -5016,9 +5011,6 @@ static void _tcpm_pd_vbus_on(struct tcpmswitch (port->state) {case SNK_TRANSITION_SINK_VBUS : port->explicit_contract = true; -/* Set the VDM flag ASAP */ -if (port->data_role ==TYPEC_HOST && port->send_discover) - port->vdm_sm_running = true;tcpm_set_state (port,SNK_READY ,0 );break ;case SNK_DISCOVERY :
@@ -5412,15 +5404,18 @@ static void tcpm_send_discover_work(struif (!port->send_discover) goto unlock; +if (port->data_role ==TYPEC_DEVICE && port->negotiated_rev <PD_REV30 ) { + port->send_discover = false; + goto unlock; + } +/* Retry if the port is not idle */ if ((port->state !=SRC_READY && port->state !=SNK_READY ) || port->vdm_sm_running) {mod_send_discover_delayed_work (port,SEND_DISCOVER_RETRY_MS ); goto unlock; } -/* Only send the Message if the port is host for PD rev2.0 */ -if (port->data_role ==TYPEC_HOST || port->negotiated_rev >PD_REV20 ) -tcpm_send_vdm (port,USB_SID_PD ,CMD_DISCOVER_IDENT ,NULL ,0 ); +tcpm_send_vdm (port,USB_SID_PD ,CMD_DISCOVER_IDENT ,NULL ,0 ); unlock:mutex_unlock (&port->lock);
Greg Kroah-Hartman
maintainerPATCH 32/113 usb: dwc3: gadget: Fix dwc3_calc_trbs_left()
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit 51f1954ad853d01ba4dc2b35dee14d8490ee05a1 upstream.
We can't depend on the TRB's HWO bit to determine if the TRB ring is "full". A TRB is only available when the driver had processed it, not when the controller consumed and relinquished the TRB's ownership to the driver. Otherwise, the driver may overwrite unprocessed TRBs. This can happen when many transfer events accumulate and the system is slow to process them and/or when there are too many small requests.
If a request is in the started_list, that means there is one or more unprocessed TRBs remained. Check this instead of the TRB's HWO bit whether the TRB ring is full.
--- drivers/usb/dwc3/gadget.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/usb/dwc3/gadget.c +8 -8
@@ -940,19 +940,19 @@ static struct dwc3_trb *dwc3_ep_prev_trbstatic u32 dwc3_calc_trbs_left (struct dwc3_ep *dep) { -struct dwc3_trb *tmp;u8 trbs_left;/* -* If enqueue & dequeue are equal than it is either full or empty. -* -* One way to know for sure is if the TRB right before us has HWO bit -* set or not. If it has, then we're definitely full and can't fit any -* more transfers in our ring. +* If the enqueue & dequeue are equal then the TRB ring is either full +* or empty. It's considered full when there are DWC3_TRB_NUM-1 of TRBs +* pending to be processed by the driver. */ if (dep->trb_enqueue == dep->trb_dequeue) { - tmp =dwc3_ep_prev_trb (dep, dep->trb_enqueue); -if (tmp->ctrl &DWC3_TRB_CTRL_HWO ) +/* +* If there is any request remained in the started_list at +* this point, that means there is no TRB available. +*/ +if (!list_empty (&dep->started_list))return 0 ;return DWC3_TRB_NUM -1 ;
Greg Kroah-Hartman
maintainerPATCH 33/113 usb: dwc3: gadget: Stop EP0 transfers during pullup disable
In reply to Greg Kroah-HartmanFrom: Wesley Cheng <[email protected]>
commit 4a1e25c0a029b97ea4a3d423a6392bfacc3b2e39 upstream.
During a USB cable disconnect, or soft disconnect scenario, a pending SETUP transaction may not be completed, leading to the following error:
dwc3 a600000.dwc3: timed out waiting for SETUP phase
If this occurs, then the entire pullup disable routine is skipped and proper cleanup and halting of the controller does not complete.
Instead of returning an error (which is ignored from the UDC perspective), allow the pullup disable routine to continue, which will also handle disabling of EP0/1. This will end any active transfers as well. Ensure to clear any delayed_status also, as the timeout could happen within the STATUS stage.
--- drivers/usb/dwc3/gadget.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/usb/dwc3/gadget.c +3 -4
@@ -2243,10 +2243,8 @@ static int dwc3_gadget_pullup(struct usb ret =wait_for_completion_timeout (&dwc->ep0_in_setup,msecs_to_jiffies (DWC3_PULL_UP_TIMEOUT )); -if (ret ==0 ) { -dev_err (dwc->dev,"timed out waiting for SETUP phase\n" ); -return -ETIMEDOUT ; - } +if (ret ==0 ) +dev_warn (dwc->dev,"timed out waiting for SETUP phase\n" ); }/*
@@ -2458,6 +2456,7 @@ static int __dwc3_gadget_start(struct dw/* begin to receive SETUP packets */ dwc->ep0state =EP0_SETUP_PHASE ; dwc->link_state =DWC3_LINK_STATE_SS_DIS ; + dwc->delayed_status = false;dwc3_ep0_out_start (dwc);dwc3_gadget_enable_irq (dwc);
Greg Kroah-Hartman
maintainerPATCH 34/113 scsi: core: Fix hang of freezing queue between blocking and running device
In reply to Greg Kroah-HartmanFrom: Li Jinlin <[email protected]>
commit 02c6dcd543f8f051973ee18bfbc4dc3bd595c558 upstream.
We found a hang, the steps to reproduce are as follows:
1. blocking device via scsi_device_set_state()
2. dd if=/dev/sda of=/mnt/t.log bs=1M count=10
3. echo none > /sys/block/sda/queue/scheduler
4. echo "running" >/sys/block/sda/device/state
Step 3 and 4 should complete after step 4, but they hang.
CPU#0 CPU#1 CPU#2 --------------- ---------------- ----------------
Step 1: blocking device
Step 2: dd xxxx
^^^^^^ get request
q_usage_counter++
Step 3: switching scheculer elv_iosched_store
elevator_switch
blk_mq_freeze_queue
blk_freeze_queue
> blk_freeze_queue_start
^^^^^^ mq_freeze_depth++
> blk_mq_run_hw_queues
^^^^^^ can't run queue when dev blocked
> blk_mq_freeze_queue_wait
^^^^^^ Hang here!!!
wait q_usage_counter==0
Step 4: running device
store_state_field
scsi_rescan_device
scsi_attach_vpd
scsi_vpd_inquiry
__scsi_execute
blk_get_request
blk_mq_alloc_request
blk_queue_enter
^^^^^^ Hang here!!!
wait mq_freeze_depth==0
blk_mq_run_hw_queues
^^^^^^ dispatch IO, q_usage_counter will reduce to zero
blk_mq_unfreeze_queue
^^^^^ mq_freeze_depth--To fix this, we need to run queue before rescanning device when the device state changes to SDEV_RUNNING.
--- drivers/scsi/scsi_sysfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/scsi/scsi_sysfs.c +6 -3
@@ -808,12 +808,15 @@ store_state_field(struct device *dev, st ret =scsi_device_set_state (sdev, state);/* * If the device state changes to SDEV_RUNNING, we need to -* rescan the device to revalidate it, and run the queue to -* avoid I/O hang. +* run the queue to avoid I/O hang, and rescan the device +* to revalidate it. Running the queue first is necessary +* because another thread may be waiting inside +* blk_mq_freeze_queue_wait() and because that call may be +* waiting for pending I/O to finish. */ if (ret ==0 && state ==SDEV_RUNNING ) { -scsi_rescan_device (dev);blk_mq_run_hw_queues (sdev->request_queue, true); +scsi_rescan_device (dev); }mutex_unlock (&sdev->state_mutex);
Greg Kroah-Hartman
maintainerPATCH 35/113 RDMA/mlx5: Fix crash when unbind multiport slave
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit da78fe5fb35737058de52364484ffed74e7d329b ]
Fix the below crash when deleting a slave from the unaffiliated list twice. First time when the slave is bound to the master and the second when the slave is unloaded.
Fix it by checking if slave is unaffiliated (doesn't have ib device) before removing from the list.
RIP: 0010:mlx5r_mp_remove+0x4e/0xa0 [mlx5_ib] Call Trace: auxiliary_bus_remove+0x18/0x30 __device_release_driver+0x177/x220 device_release_driver+0x24/0x30 bus_remove_device+0xd8/0x140 device_del+0x18a/0x3e0 mlx5_rescan_drivers_locked+0xa9/0x210 [mlx5_core] mlx5_unregister_device+0x34/0x60 [mlx5_core] mlx5_uninit_one+0x32/0x100 [mlx5_core] remove_one+0x6e/0xe0 [mlx5_core] pci_device_remove+0x36/0xa0 __device_release_driver+0x177/0x220 device_driver_detach+0x3c/0xa0 unbind_store+0x113/0x130 kernfs_fop_write_iter+0x110/0x1a0 new_sync_write+0x116/0x1a0 vfs_write+0x1ba/0x260 ksys_write+0x5f/0xe0 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- drivers/infiniband/hw/mlx5/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/main.c +2 -1
@@ -4444,7 +4444,8 @@ static void mlx5r_mp_remove(struct auxiliary_device *adev)mutex_lock (&mlx5_ib_multiport_mutex);if (mpi->ibdev)mlx5_ib_unbind_slave_port (mpi->ibdev, mpi); -list_del (&mpi->list); +else +list_del (&mpi->list);mutex_unlock (&mlx5_ib_multiport_mutex);kfree (mpi); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 36/113 RDMA/uverbs: Track dmabuf memory regions
In reply to Greg Kroah-HartmanFrom: Gal Pressman <[email protected]>
[ Upstream commit f6018cc4602659e0e608849529704f3f41276c28 ]
The dmabuf memory registrations are missing the restrack handling and hence do not appear in rdma tool.
--- drivers/infiniband/core/uverbs_std_types_mr.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/core/uverbs_std_types_mr.c +3 -0
@@ -249,6 +249,9 @@ static int UVERBS_HANDLER(UVERBS_METHOD_REG_DMABUF_MR)( mr->uobject = uobj;atomic_inc (&pd->usecnt); +rdma_restrack_new (&mr->res,RDMA_RESTRACK_MR ); +rdma_restrack_set_name (&mr->res,NULL ); +rdma_restrack_add (&mr->res); uobj->object = mr;uverbs_finalize_uobj_create (attrs,UVERBS_ATTR_REG_DMABUF_MR_HANDLE );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 37/113 RDMA/bnxt_re: Add missing spin lock initialization
In reply to Greg Kroah-HartmanFrom: Naresh Kumar PBS <[email protected]>
[ Upstream commit 17f2569dce1848080825b8336e6b7c6900193b44 ]
Add the missing initialization of srq lock.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -0
@@ -1691,6 +1691,7 @@ int bnxt_re_create_srq(struct ib_srq *ib_srq,if (nq) nq->budget++;atomic_inc (&rdev->srq_count); +spin_lock_init (&srq->lock);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 38/113 IB/hfi1: Fix possible null-pointer dereference in _extend_sdma_tx_descs()
In reply to Greg Kroah-HartmanFrom: Tuo Li <[email protected]>
[ Upstream commit cbe71c61992c38f72c2b625b2ef25916b9f0d060 ]
kmalloc_array() is called to allocate memory for tx->descp. If it fails, the function __sdma_txclean() is called:
__sdma_txclean(dd, tx);
However, in the function __sdma_txclean(), tx-descp is dereferenced if tx->num_desc is not zero:
sdma_unmap_desc(dd, &tx->descp[0]);
To fix this possible null-pointer dereference, assign the return value of kmalloc_array() to a local variable descp, and then assign it to tx->descp if it is not NULL. Otherwise, go to enomem.
--- drivers/infiniband/hw/hfi1/sdma.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/infiniband/hw/hfi1/sdma.c +4 -5
@@ -3055,6 +3055,7 @@ static void __sdma_process_event(struct sdma_engine *sde,static int _extend_sdma_tx_descs (struct hfi1_devdata *dd,struct sdma_txreq *tx) {int i; +struct sdma_desc *descp;/* Handle last descriptor */ if (unlikely ((tx->num_desc == (MAX_DESC -1 )))) {
@@ -3075,12 +3076,10 @@ static int _extend_sdma_tx_descs(struct hfi1_devdata *dd, struct sdma_txreq *tx)if (unlikely (tx->num_desc ==MAX_DESC )) goto enomem; - tx->descp =kmalloc_array ( -MAX_DESC , -sizeof (struct sdma_desc ), -GFP_ATOMIC ); -if (!tx->descp) + descp =kmalloc_array (MAX_DESC ,sizeof (struct sdma_desc ),GFP_ATOMIC ); +if (!descp) goto enomem; + tx->descp = descp;/* reserve last descriptor for coalescing */ tx->desc_limit =MAX_DESC -1 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 39/113 RDMA/bnxt_re: Remove unpaired rtnl unlock in bnxt_re_dev_init()
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit a036ad088306a88de87e973981f2b9224e466c3f ]
The fixed commit removes all rtnl_lock() and rtnl_unlock() calls in function bnxt_re_dev_init(), but forgets to remove a rtnl_unlock() in the error handling path of bnxt_re_register_netdev(), which may cause a deadlock. This bug is suggested by a static analysis tool.
--- drivers/infiniband/hw/bnxt_re/main.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/bnxt_re/main.c +0 -1
@@ -1406,7 +1406,6 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode)memset (&rattr,0 ,sizeof (rattr)); rc =bnxt_re_register_netdev (rdev);if (rc) { -rtnl_unlock ();ibdev_err (&rdev->ibdev,"Failed to register with netedev: %#x\n" , rc);return -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 40/113 RDMA/rxe: Fix memory allocation while in a spin lock
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 65a81b61d8c5e96748671824cc46339afbd831d0 ]
rxe_mcast_add_grp_elem() in rxe_mcast.c calls rxe_alloc() while holding spinlocks which in turn calls kzalloc(size, GFP_KERNEL) which is incorrect. This patch replaces rxe_alloc() by rxe_alloc_locked() which uses GFP_ATOMIC. This bug was caused by the below mentioned commit and failing to handle the need for the atomic allocate.
--- drivers/infiniband/sw/rxe/rxe_mcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_mcast.c +1 -1
@@ -85,7 +85,7 @@ int rxe_mcast_add_grp_elem(struct rxe_dev *rxe, struct rxe_qp *qp, goto out; } - elem =rxe_alloc (&rxe->mc_elem_pool); + elem =rxe_alloc_locked (&rxe->mc_elem_pool);if (!elem) { err = -ENOMEM ; goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 41/113 ice: do not abort devlink info if board identifier cant be found
In reply to Greg Kroah-HartmanFrom: Jacob Keller <[email protected]>
[ Upstream commit a8f89fa27773a8c96fd09fb4e2f4892d794f21f6 ]
The devlink dev info command reports version information about the device and firmware running on the board. This includes the "board.id" field which is supposed to represent an identifier of the board design. The ice driver uses the Product Board Assembly identifier for this.
In some cases, the PBA is not present in the NVM. If this happens, devlink dev info will fail with an error. Instead, modify the ice_info_pba function to just exit without filling in the context buffer. This will cause the board.id field to be skipped. Log a dev_dbg message in case someone wants to confirm why board.id is not showing up for them.
--- drivers/net/ethernet/intel/ice/ice_devlink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_devlink.c +3 -1
@@ -42,7 +42,9 @@ static int ice_info_pba(struct ice_pf *pf, struct ice_info_ctx *ctx) status =ice_read_pba_string (hw, (u8 *)ctx->buf,sizeof (ctx->buf));if (status) -return -EIO ; +/* We failed to locate the PBA, so just skip this entry */ +dev_dbg (ice_pf_to_dev (pf),"Failed to read Product Board Assembly string, status %s\n" , +ice_stat_str (status));return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 42/113 net: usb: pegasus: fixes of set_register(s) return value evaluation;
In reply to Greg Kroah-HartmanFrom: Petko Manolov <[email protected]>
[ Upstream commit ffc9c3ebb4af870a121da99826e9ccb63dc8b3d7 ]
- restore the behavior in enable_net_traffic() to avoid regressions - Jakub
Kicinski;
- hurried up and removed redundant assignment in pegasus_open() before yet
another checker complains;--- drivers/net/usb/pegasus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/pegasus.c +2 -2
@@ -471,7 +471,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)write_mii_word (pegasus,0 ,0x1b , &auxmode); } -return 0 ; +return ret; fail:netif_dbg (pegasus, drv, pegasus->net,"%s failed\n" , __func__);return ret;
@@ -860,7 +860,7 @@ static int pegasus_open(struct net_device *net)if (!pegasus->rx_skb) goto exit; - res =set_registers (pegasus, EthID,6 , net->dev_addr); +set_registers (pegasus, EthID,6 , net->dev_addr); usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, usb_rcvbulkpipe(pegasus->usb, 1),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 43/113 igc: fix page fault when thunderbolt is unplugged
In reply to Greg Kroah-HartmanFrom: Aaron Ma <[email protected]>
[ Upstream commit 4b79959510e6612d80f8d86022e0cb44eee6f4a2 ]
After unplug thunderbolt dock with i225, pciehp interrupt is triggered, remove call will read/write mmio address which is already disconnected, then cause page fault and make system hang.
Check PCI state to remove device safely.
Trace:
BUG: unable to handle page fault for address: 000000000000b604 Oops: 0000 [#1] SMP NOPTI RIP: 0010:igc_rd32+0x1c/0x90 [igc] Call Trace: igc_ptp_suspend+0x6c/0xa0 [igc] igc_ptp_stop+0x12/0x50 [igc] igc_remove+0x7f/0x1c0 [igc] pci_device_remove+0x3e/0xb0 __device_release_driver+0x181/0x240
--- drivers/net/ethernet/intel/igc/igc_main.c | 32 ++++++++++++++--------- drivers/net/ethernet/intel/igc/igc_ptp.c | 3 ++- 2 files changed, 21 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +19 -13
@@ -146,6 +146,9 @@ static void igc_release_hw_control(struct igc_adapter *adapter)struct igc_hw *hw = &adapter->hw;u32 ctrl_ext; +if (!pci_device_is_present (adapter->pdev)) +return ; +/* Let firmware take over control of h/w */ ctrl_ext =rd32 (IGC_CTRL_EXT ); wr32(IGC_CTRL_EXT,
@@ -4037,26 +4040,29 @@ void igc_down(struct igc_adapter *adapter)igc_ptp_suspend (adapter); -/* disable receives in the hardware */ - rctl =rd32 (IGC_RCTL ); -wr32 (IGC_RCTL , rctl & ~IGC_RCTL_EN ); -/* flush and sleep below */ - +if (pci_device_is_present (adapter->pdev)) { +/* disable receives in the hardware */ + rctl =rd32 (IGC_RCTL ); +wr32 (IGC_RCTL , rctl & ~IGC_RCTL_EN ); +/* flush and sleep below */ + }/* set trans_start so we don't get spurious watchdogs during reset */ netif_trans_update (netdev);netif_carrier_off (netdev);netif_tx_stop_all_queues (netdev); -/* disable transmits in the hardware */ - tctl =rd32 (IGC_TCTL ); - tctl &= ~IGC_TCTL_EN ; -wr32 (IGC_TCTL , tctl); -/* flush both disables and wait for them to finish */ -wrfl (); -usleep_range (10000 ,20000 ); +if (pci_device_is_present (adapter->pdev)) { +/* disable transmits in the hardware */ + tctl =rd32 (IGC_TCTL ); + tctl &= ~IGC_TCTL_EN ; +wr32 (IGC_TCTL , tctl); +/* flush both disables and wait for them to finish */ +wrfl (); +usleep_range (10000 ,20000 ); -igc_irq_disable (adapter); +igc_irq_disable (adapter); + } adapter->flags &= ~IGC_FLAG_NEED_LINK_UPDATE ;
drivers/net/ethernet/intel/igc/igc_ptp.c +2 -1
@@ -849,7 +849,8 @@ void igc_ptp_suspend(struct igc_adapter *adapter) adapter->ptp_tx_skb =NULL ;clear_bit_unlock (__IGC_PTP_TX_IN_PROGRESS, &adapter->state); -igc_ptp_time_save (adapter); +if (pci_device_is_present (adapter->pdev)) +igc_ptp_time_save (adapter); }/**
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 44/113 igc: Use num_tx_queues when iterating over tx_ring queue
In reply to Greg Kroah-HartmanFrom: Toshiki Nishioka <[email protected]>
[ Upstream commit 691bd4d7761992914a0e83c27a4ce57d01474cda ]
Use num_tx_queues rather than the IGC_MAX_TX_QUEUES fixed number 4 when iterating over tx_ring queue since instantiated queue count could be less than 4 where on-line cpu count is less than 4.
--- drivers/net/ethernet/intel/igc/igc_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +2 -2
@@ -5080,7 +5080,7 @@ static bool validate_schedule(struct igc_adapter *adapter,if (e->command !=TC_TAPRIO_CMD_SET_GATES )return false; -for (i =0 ; i <IGC_MAX_TX_QUEUES ; i++) { +for (i =0 ; i < adapter->num_tx_queues; i++) {if (e->gate_mask &BIT (i)) queue_uses[i]++;
@@ -5137,7 +5137,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter, end_time += e->interval; -for (i =0 ; i <IGC_MAX_TX_QUEUES ; i++) { +for (i =0 ; i < adapter->num_tx_queues; i++) {struct igc_ring *ring = adapter->tx_ring[i];if (!(e->gate_mask &BIT (i)))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 45/113 e1000e: Fix the max snoop/no-snoop latency for 10M
In reply to Greg Kroah-HartmanFrom: Sasha Neftin <[email protected]>
[ Upstream commit 44a13a5d99c71bf9e1676d9e51679daf4d7b3d73 ]
We should decode the latency and the max_latency before directly compare. The latency should be presented as lat_enc = scale x value:lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00)
Quoted 1 line
Quoted 1 line
10)))
--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 14 +++++++++++++- drivers/net/ethernet/intel/e1000e/ich8lan.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/e1000e/ich8lan.c +13 -1
@@ -1006,6 +1006,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) {u32 reg = link << (E1000_LTRV_REQ_SHIFT +E1000_LTRV_NOSNOOP_SHIFT ) | link <<E1000_LTRV_REQ_SHIFT |E1000_LTRV_SEND ; +u16 max_ltr_enc_d =0 ;/* maximum LTR decoded by platform */ +u16 lat_enc_d =0 ;/* latency decoded */ u16 lat_enc =0 ;/* latency encoded */ if (link) {
@@ -1059,7 +1061,17 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) E1000_PCI_LTR_CAP_LPT + 2, &max_nosnoop); max_ltr_enc =max_t (u16, max_snoop, max_nosnoop); -if (lat_enc > max_ltr_enc) + lat_enc_d = (lat_enc &E1000_LTRV_VALUE_MASK ) * + (1U << (E1000_LTRV_SCALE_FACTOR * + ((lat_enc &E1000_LTRV_SCALE_MASK ) + >>E1000_LTRV_SCALE_SHIFT ))); + + max_ltr_enc_d = (max_ltr_enc &E1000_LTRV_VALUE_MASK ) * + (1U << (E1000_LTRV_SCALE_FACTOR * + ((max_ltr_enc &E1000_LTRV_SCALE_MASK ) + >>E1000_LTRV_SCALE_SHIFT ))); + +if (lat_enc_d > max_ltr_enc_d) lat_enc = max_ltr_enc; }
drivers/net/ethernet/intel/e1000e/ich8lan.h +3 -0
@@ -274,8 +274,11 @@/* Latency Tolerance Reporting */ #define E1000_LTRV 0x000F8 +#define E1000_LTRV_VALUE_MASK 0x000003FF#define E1000_LTRV_SCALE_MAX 5#define E1000_LTRV_SCALE_FACTOR 5 +#define E1000_LTRV_SCALE_SHIFT 10 +#define E1000_LTRV_SCALE_MASK 0x00001C00#define E1000_LTRV_REQ_SHIFT 15#define E1000_LTRV_NOSNOOP_SHIFT 16#define E1000_LTRV_SEND (1 << 30)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 46/113 e1000e: Do not take care about recovery NVM checksum
In reply to Greg Kroah-HartmanFrom: Sasha Neftin <[email protected]>
[ Upstream commit 4051f68318ca9f3d3becef3b54e70ad2c146df97 ]
On new platforms, the NVM is read-only. Attempting to update the NVM is causing a lockup to occur. Do not attempt to write to the NVM on platforms where it's not supported.
Emit an error message when the NVM checksum is invalid.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=213667
--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/e1000e/ich8lan.c +11 -7
@@ -4127,13 +4127,17 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)return ret_val;if (!(data & valid_csum_mask)) { - data |= valid_csum_mask; - ret_val =e1000_write_nvm (hw, word,1 , &data); -if (ret_val) -return ret_val; - ret_val =e1000e_update_nvm_checksum (hw); -if (ret_val) -return ret_val; +e_dbg ("NVM Checksum Invalid\n" ); + +if (hw->mac.type < e1000_pch_cnp) { + data |= valid_csum_mask; + ret_val =e1000_write_nvm (hw, word,1 , &data); +if (ret_val) +return ret_val; + ret_val =e1000e_update_nvm_checksum (hw); +if (ret_val) +return ret_val; + } }return e1000e_validate_nvm_checksum_generic (hw);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 47/113 RDMA/efa: Free IRQ vectors on error flow
In reply to Greg Kroah-HartmanFrom: Gal Pressman <[email protected]>
[ Upstream commit dbe986bdfd6dfe6ef24b833767fff4151e024357 ]
Make sure to free the IRQ vectors in case the allocation doesn't return the expected number of IRQs.
--- drivers/infiniband/hw/efa/efa_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/efa/efa_main.c +1 -0
@@ -356,6 +356,7 @@ static int efa_enable_msix(struct efa_dev *dev) }if (irq_num != msix_vecs) { +efa_disable_msix (dev);dev_err (&dev->pdev->dev,"Allocated %d MSI-X (out of %d requested)\n" , irq_num, msix_vecs);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 48/113 ip_gre: add validation for csum_start
In reply to Greg Kroah-HartmanFrom: Shreyansh Chouhan <[email protected]>
[ Upstream commit 1d011c4803c72f3907eccfc1ec63caefb852fcbf ]
Validate csum_start in gre_handle_offloads before we call _gre_xmit so that we do not crash later when the csum_start value is used in the lco_csum function call.
This patch deals with ipv4 code.
--- net/ipv4/ip_gre.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/ip_gre.c +2 -0
@@ -468,6 +468,8 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,static int gre_handle_offloads (struct sk_buff *skb,bool csum) { +if (csum &&skb_checksum_start (skb) < skb->data) +return -EINVAL ;return iptunnel_handle_offloads (skb, csum ?SKB_GSO_GRE_CSUM :SKB_GSO_GRE ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 49/113 xgene-v2: Fix a resource leak in the error handling path of xge_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5ed74b03eb4d08f5dd281dcb5f1c9bb92b363a8d ]
A successful 'xge_mdio_config()' call should be balanced by a corresponding 'xge_mdio_remove()' call in the error handling path of the probe, as already done in the remove function.
Update the error handling path accordingly.
--- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/apm/xgene-v2/main.c +3 -1
@@ -677,11 +677,13 @@ static int xge_probe(struct platform_device *pdev) ret =register_netdev (ndev);if (ret) {netdev_err (ndev,"Failed to register netdev\n" ); - goto err; + goto err_mdio_remove; }return 0 ; +err_mdio_remove: +xge_mdio_remove (ndev); err:free_netdev (ndev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 50/113 net: marvell: fix MVNETA_TX_IN_PRGRS bit number
In reply to Greg Kroah-HartmanFrom: Maxim Kiselev <[email protected]>
[ Upstream commit 359f4cdd7d78fdf8c098713b05fee950a730f131 ]
According to Armada XP datasheet bit at 0 position is corresponding for TxInProg indication.
--- drivers/net/ethernet/marvell/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvneta.c +1 -1
@@ -105,7 +105,7 @@#define MVNETA_VLAN_PRIO_TO_RXQ 0x2440#define MVNETA_VLAN_PRIO_RXQ_MAP (prio, rxq) ((rxq) << ((prio) * 3))#define MVNETA_PORT_STATUS 0x2444 -#define MVNETA_TX_IN_PRGRS BIT(1) +#define MVNETA_TX_IN_PRGRS BIT(0)#define MVNETA_TX_FIFO_EMPTY BIT(8)#define MVNETA_RX_MIN_FRAME_SIZE 0x247c/* Only exists on Armada XP and Armada 370 */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 51/113 ucounts: Increase ucounts reference counter before the security hook
In reply to Greg Kroah-HartmanFrom: Alexey Gladkov <[email protected]>
[ Upstream commit bbb6d0f3e1feb43d663af089c7dedb23be6a04fb ]
We need to increment the ucounts reference counter befor security_prepare_creds() because this function may fail and abort_creds() will try to decrement this reference.
[ 96.465056][ T8641] FAULT_INJECTION: forcing a failure. [ 96.465056][ T8641] name fail_page_alloc, interval 1, probability 0, space 0, times 0 [ 96.478453][ T8641] CPU: 1 PID: 8641 Comm: syz-executor668 Not tainted 5.14.0-rc6-syzkaller #0 [ 96.487215][ T8641] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 [ 96.497254][ T8641] Call Trace: [ 96.500517][ T8641] dump_stack_lvl+0x1d3/0x29f [ 96.505758][ T8641] ? show_regs_print_info+0x12/0x12 [ 96.510944][ T8641] ? log_buf_vmcoreinfo_setup+0x498/0x498 [ 96.516652][ T8641] should_fail+0x384/0x4b0 [ 96.521141][ T8641] prepare_alloc_pages+0x1d1/0x5a0 [ 96.526236][ T8641] __alloc_pages+0x14d/0x5f0 [ 96.530808][ T8641] ? __rmqueue_pcplist+0x2030/0x2030 [ 96.536073][ T8641] ? lockdep_hardirqs_on_prepare+0x3e2/0x750 [ 96.542056][ T8641] ? alloc_pages+0x3f3/0x500 [ 96.546635][ T8641] allocate_slab+0xf1/0x540 [ 96.551120][ T8641] ___slab_alloc+0x1cf/0x350 [ 96.555689][ T8641] ? kzalloc+0x1d/0x30 [ 96.559740][ T8641] __kmalloc+0x2e7/0x390 [ 96.563980][ T8641] ? kzalloc+0x1d/0x30 [ 96.568029][ T8641] kzalloc+0x1d/0x30 [ 96.571903][ T8641] security_prepare_creds+0x46/0x220 [ 96.577174][ T8641] prepare_creds+0x411/0x640 [ 96.581747][ T8641] __sys_setfsuid+0xe2/0x3a0 [ 96.586333][ T8641] do_syscall_64+0x3d/0xb0 [ 96.590739][ T8641] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 96.596611][ T8641] RIP: 0033:0x445a69 [ 96.600483][ T8641] Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 [ 96.620152][ T8641] RSP: 002b:00007f1054173318 EFLAGS: 00000246 ORIG_RAX: 000000000000007a [ 96.628543][ T8641] RAX: ffffffffffffffda RBX: 00000000004ca4c8 RCX: 0000000000445a69 [ 96.636600][ T8641] RDX: 0000000000000010 RSI: 00007f10541732f0 RDI: 0000000000000000 [ 96.644550][ T8641] RBP: 00000000004ca4c0 R08: 0000000000000001 R09: 0000000000000000 [ 96.652500][ T8641] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004ca4cc [ 96.660631][ T8641] R13: 00007fffffe0b62f R14: 00007f1054173400 R15: 0000000000022000
--- kernel/cred.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/cred.c +6 -6
@@ -286,13 +286,13 @@ struct cred *prepare_creds(void) new->security =NULL ;#endif -if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) - goto error; - new->ucounts =get_ucounts (new->ucounts);if (!new->ucounts) goto error; +if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) + goto error; +validate_creds (new);return new;
@@ -753,13 +753,13 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon)#ifdef CONFIG_SECURITY new->security =NULL ;#endif -if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) - goto error; - new->ucounts =get_ucounts (new->ucounts);if (!new->ucounts) goto error; +if (security_prepare_creds (new, old,GFP_KERNEL_ACCOUNT ) <0 ) + goto error; +put_cred (old);validate_creds (new);return new;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 52/113 net/sched: ets: fix crash when flipping from strict to quantum
In reply to Greg Kroah-HartmanFrom: Davide Caratti <[email protected]>
[ Upstream commit cd9b50adc6bb9ad3f7d244590a389522215865c4 ]
While running kselftests, Hangbin observed that sch_ets.sh often crashes, and splats like the following one are seen in the output of 'dmesg':
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 159f12067 P4D 159f12067 PUD 159f13067 PMD 0 Oops: 0000 [#1] SMP NOPTI CPU: 2 PID: 921 Comm: tc Not tainted 5.14.0-rc6+ #458 Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014 RIP: 0010:__list_del_entry_valid+0x2d/0x50 Code: 48 8b 57 08 48 b9 00 01 00 00 00 00 ad de 48 39 c8 0f 84 ac 6e 5b 00 48 b9 22 01 00 00 00 00 ad de 48 39 ca 0f 84 cf 6e 5b 00 <48> 8b 32 48 39 fe 0f 85 af 6e 5b 00 48 8b 50 08 48 39 f2 0f 85 94 RSP: 0018:ffffb2da005c3890 EFLAGS: 00010217 RAX: 0000000000000000 RBX: ffff9073ba23f800 RCX: dead000000000122 RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff9073ba23fbc8 RBP: ffff9073ba23f890 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000001 R12: dead000000000100 R13: ffff9073ba23fb00 R14: 0000000000000002 R15: 0000000000000002 FS: 00007f93e5564e40(0000) GS:ffff9073bba00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000014ad34000 CR4: 0000000000350ee0 Call Trace: ets_qdisc_reset+0x6e/0x100 [sch_ets] qdisc_reset+0x49/0x1d0 tbf_reset+0x15/0x60 [sch_tbf] qdisc_reset+0x49/0x1d0 dev_reset_queue.constprop.42+0x2f/0x90 dev_deactivate_many+0x1d3/0x3d0 dev_deactivate+0x56/0x90 qdisc_graft+0x47e/0x5a0 tc_get_qdisc+0x1db/0x3e0 rtnetlink_rcv_msg+0x164/0x4c0 netlink_rcv_skb+0x50/0x100 netlink_unicast+0x1a5/0x280 netlink_sendmsg+0x242/0x480 sock_sendmsg+0x5b/0x60 ____sys_sendmsg+0x1f2/0x260 ___sys_sendmsg+0x7c/0xc0 __sys_sendmsg+0x57/0xa0 do_syscall_64+0x3a/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f93e44b8338 Code: 89 02 48 c7 c0 ff ff ff ff eb b5 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 25 43 2c 00 8b 00 85 c0 75 17 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 41 89 d4 55 RSP: 002b:00007ffc0db737a8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000061255c06 RCX: 00007f93e44b8338 RDX: 0000000000000000 RSI: 00007ffc0db73810 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000 R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000001 R13: 0000000000687880 R14: 0000000000000000 R15: 0000000000000000 Modules linked in: sch_ets sch_tbf dummy rfkill iTCO_wdt iTCO_vendor_support intel_rapl_msr intel_rapl_common joydev i2c_i801 pcspkr i2c_smbus lpc_ich virtio_balloon ip_tables xfs libcrc32c crct10dif_pclmul crc32_pclmul crc32c_intel ahci libahci ghash_clmulni_intel libata serio_raw virtio_blk virtio_console virtio_net net_failover failover sunrpc dm_mirror dm_region_hash dm_log dm_mod CR2: 0000000000000000
When the change() function decreases the value of 'nstrict', we must take into account that packets might be already enqueued on a class that flips from 'strict' to 'quantum': otherwise that class will not be added to the bandwidth-sharing list. Then, a call to ets_qdisc_reset() will attempt to do list_del(&alist) with 'alist' filled with zero, hence the NULL pointer dereference.
For classes flipping from 'strict' to 'quantum', initialize an empty list and eventually add it to the bandwidth-sharing list, if there are packets already enqueued. In this way, the kernel will:
a) prevent crashing as described above.
b) avoid retaining the backlog packets (for an arbitrarily long time) in case no packet is enqueued after a change from 'strict' to 'quantum'.
--- net/sched/sch_ets.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/sched/sch_ets.c +7 -0
@@ -660,6 +660,13 @@ static int ets_qdisc_change(struct Qdisc *sch, struct nlattr *opt,sch_tree_lock (sch); q->nbands = nbands; +for (i = nstrict; i < q->nstrict; i++) { +INIT_LIST_HEAD (&q->classes[i].alist); +if (q->classes[i].qdisc->q.qlen) { +list_add_tail (&q->classes[i].alist, &q->active); + q->classes[i].deficit = quanta[i]; + } + } q->nstrict = nstrict;memcpy (q->prio2band, priomap,sizeof (priomap));
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 53/113 SUNRPC: Fix XPT_BUSY flag leakage in svc_handle_xprt()...
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 062b829c52ef4ed5df14f4850fc07651bb7c3b33 ]
If the attempt to reserve a slot fails, we currently leak the XPT_BUSY flag on the socket. Among other things, this make it impossible to close the socket.
--- net/sunrpc/svc_xprt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/svc_xprt.c +2 -1
@@ -835,7 +835,8 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt) rqstp->rq_stime =ktime_get (); rqstp->rq_reserved = serv->sv_max_mesg;atomic_add (rqstp->rq_reserved, &xprt->xpt_reserved); - } + }else +svc_xprt_received (xprt); out:trace_svc_handle_xprt (xprt, len);return len;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 54/113 ipv6: use siphash in rt6_exception_hash()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 4785305c05b25a242e5314cc821f54ade4c18810 ]
A group of security researchers brought to our attention the weakness of hash function used in rt6_exception_hash()
Lets use siphash instead of Jenkins Hash, to considerably reduce security risks.
Following patch deals with IPv4.
--- net/ipv6/route.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
net/ipv6/route.c +14 -6
@@ -41,6 +41,7 @@#include <linux/nsproxy.h> #include <linux/slab.h> #include <linux/jhash.h> +#include <linux/siphash.h> #include <net/net_namespace.h> #include <net/snmp.h> #include <net/ipv6.h>
@@ -1484,17 +1485,24 @@ static void rt6_exception_remove_oldest(struct rt6_exception_bucket *bucket)static u32 rt6_exception_hash (const struct in6_addr *dst,const struct in6_addr *src) { -static u32 seed__read_mostly ; -u32 val; +static siphash_key_t rt6_exception_key__read_mostly ; +struct { +struct in6_addr dst; +struct in6_addr src; + }__aligned(SIPHASH_ALIGNMENT) combined = { + .dst = *dst, + }; +u64 val; -net_get_random_once (&seed,sizeof (seed)); - val =jhash2 ((const u32 *)dst,sizeof (*dst)/sizeof (u32), seed); +net_get_random_once (&rt6_exception_key,sizeof (rt6_exception_key));#ifdef CONFIG_IPV6_SUBTREES if (src) - val =jhash2 ((const u32 *)src,sizeof (*src)/sizeof (u32), val); + combined.src = *src;#endif -return hash_32 (val,FIB6_EXCEPTION_BUCKET_SIZE_SHIFT ); + val =siphash (&combined,sizeof (combined), &rt6_exception_key); + +return hash_64 (val,FIB6_EXCEPTION_BUCKET_SIZE_SHIFT ); }/* Helper function to find the cached rt in the hash table
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 55/113 ipv4: use siphash instead of Jenkins in fnhe_hashfun()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 6457378fe796815c973f631a1904e147d6ee33b1 ]
A group of security researchers brought to our attention the weakness of hash function used in fnhe_hashfun().
Lets use siphash instead of Jenkins Hash, to considerably reduce security risks.
Also remove the inline keyword, this really is distracting.
--- net/ipv4/route.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/ipv4/route.c +6 -6
@@ -600,14 +600,14 @@ static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)return oldest; } -static inline u32 fnhe_hashfun (__be32 daddr) +static u32 fnhe_hashfun (__be32 daddr) { -static u32 fnhe_hashrnd__read_mostly ; -u32 hval; +static siphash_key_t fnhe_hash_key__read_mostly ; +u64 hval; -net_get_random_once (&fnhe_hashrnd,sizeof (fnhe_hashrnd)); - hval =jhash_1word ((__force u32 )daddr, fnhe_hashrnd); -return hash_32 (hval,FNHE_HASH_SHIFT ); +net_get_random_once (&fnhe_hash_key,sizeof (fnhe_hash_key)); + hval =siphash_1u32 ((__force u32 )daddr, &fnhe_hash_key); +return hash_64 (hval,FNHE_HASH_SHIFT ); }static void fill_route_from_fnhe (struct rtable *rt,struct fib_nh_exception *fnhe)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 56/113 cxgb4: dont touch blocked freelist bitmap after free
In reply to Greg Kroah-HartmanFrom: Rahul Lakkireddy <[email protected]>
[ Upstream commit 43fed4d48d325e0a61dc2638a84da972fbb1087b ]
When adapter init fails, the blocked freelist bitmap is already freed up and should not be touched. So, move the bitmap zeroing closer to where it was successfully allocated. Also handle adapter init failure unwind path immediately and avoid setting up RDMA memory windows.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +3 -4
@@ -5068,6 +5068,7 @@ static int adap_init0(struct adapter *adap, int vpd_skip) ret = -ENOMEM ; goto bye; } +bitmap_zero (adap->sge.blocked_fl, adap->sge.egr_sz);#endif params[0 ] =FW_PARAM_PFVF (CLIP_START );
@@ -6788,13 +6789,11 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)setup_memwin (adapter); err =adap_init0 (adapter,0 ); -#ifdef CONFIG_DEBUG_FS -bitmap_zero (adapter->sge.blocked_fl, adapter->sge.egr_sz); -#endif -setup_memwin_rdma (adapter);if (err) goto out_unmap_bar; +setup_memwin_rdma (adapter); +/* configure SGE_STAT_CFG_A to read WC stats */ if (!is_t4 (adapter->params.chip)) t4_write_reg(adapter, SGE_STAT_CFG_A, STATSOURCE_T5_V(7) |
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 57/113 net: dsa: hellcreek: Fix incorrect setting of GCL
In reply to Greg Kroah-HartmanFrom: Kurt Kanzenbach <[email protected]>
[ Upstream commit a7db5ed8632c88c029254d5d74765d52614af3fd ]
Currently the gate control list which is programmed into the hardware is incorrect resulting in wrong traffic schedules. The problem is the loop variables are incremented before they are referenced. Therefore, move the increment to the end of the loop.
--- drivers/net/dsa/hirschmann/hellcreek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/dsa/hirschmann/hellcreek.c +3 -3
@@ -1473,9 +1473,6 @@ static void hellcreek_setup_gcl(struct hellcreek *hellcreek, int port,u16 data;u8 gates; - cur++; - next++; -if (i == schedule->num_entries) gates = initial->gate_mask ^ cur->gate_mask;
@@ -1504,6 +1501,9 @@ static void hellcreek_setup_gcl(struct hellcreek *hellcreek, int port, (initial->gate_mask <<TR_GCLCMD_INIT_GATE_STATES_SHIFT );hellcreek_write (hellcreek, data,TR_GCLCMD ); + + cur++; + next++; } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 58/113 net: dsa: hellcreek: Adjust schedule look ahead window
In reply to Greg Kroah-HartmanFrom: Kurt Kanzenbach <[email protected]>
[ Upstream commit b7658ed35a5f5900f0f658e375f366513f3eb781 ]
Traffic schedules can only be started up to eight seconds within the future. Therefore, the driver periodically checks every two seconds whether the admin base time provided by the user is inside that window. If so the schedule is started. Otherwise the check is deferred.
However, according to the programming manual the look ahead window size should be four - not eight - seconds. By using the proposed value of four seconds starting a schedule at a specified admin base time actually works as expected.
--- drivers/net/dsa/hirschmann/hellcreek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/hirschmann/hellcreek.c +1 -1
@@ -1551,7 +1551,7 @@ static bool hellcreek_schedule_startable(struct hellcreek *hellcreek, int port)/* Calculate difference to admin base time */ base_time_ns =ktime_to_ns (hellcreek_port->current_schedule->base_time); -return base_time_ns - current_ns < (s64 )8 *NSEC_PER_SEC ; +return base_time_ns - current_ns < (s64 )4 *NSEC_PER_SEC ; }static void hellcreek_start_schedule (struct hellcreek *hellcreek,int port)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 59/113 rtnetlink: Return correct error on changing device netns
In reply to Greg Kroah-HartmanFrom: Andrey Ignatov <[email protected]>
[ Upstream commit 96a6b93b69880b2c978e1b2be9cae6970b605008 ]
Currently when device is moved between network namespaces using RTM_NEWLINK message type and one of netns attributes (FLA_NET_NS_PID, IFLA_NET_NS_FD, IFLA_TARGET_NETNSID) but w/o specifying IFLA_IFNAME, and target namespace already has device with same name, userspace will get EINVAL what is confusing and makes debugging harder.
Fix it so that userspace gets more appropriate EEXIST instead what makes debugging much easier.
Before:
# ./ifname.sh
+ ip netns add ns0
+ ip netns exec ns0 ip link add l0 type dummy
+ ip netns exec ns0 ip link show l0
8: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 66:90:b5:d5:78:69 brd ff:ff:ff:ff:ff:ff
+ ip link add l0 type dummy
+ ip link show l0
10: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 6e:c6:1f:15:20:8d brd ff:ff:ff:ff:ff:ff
+ ip link set l0 netns ns0
RTNETLINK answers: Invalid argumentAfter:
# ./ifname.sh
+ ip netns add ns0
+ ip netns exec ns0 ip link add l0 type dummy
+ ip netns exec ns0 ip link show l0
8: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 1e:4a:72:e3:e3:8f brd ff:ff:ff:ff:ff:ff
+ ip link add l0 type dummy
+ ip link show l0
10: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether f2:fc:fe:2b:7d:a6 brd ff:ff:ff:ff:ff:ff
+ ip link set l0 netns ns0
RTNETLINK answers: File existsThe problem is that do_setlink() passes its char *ifname argument, that it gets from a caller, to __dev_change_net_namespace() as is (as const char *pat), but semantics of ifname and pat can be different.
For example, __rtnl_newlink() does this:
net/core/rtnetlink.c
3270 char ifname[IFNAMSIZ];
...
3286 if (tb[IFLA_IFNAME])
3287 nla_strscpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
3288 else
3289 ifname[0] = '\0';
...
3364 if (dev) {
...
3394 return do_setlink(skb, dev, ifm, extack, tb, ifname, status);
3395 }, i.e. do_setlink() gets ifname pointer that is always valid no matter if user specified IFLA_IFNAME or not and then do_setlink() passes this ifname pointer as is to __dev_change_net_namespace() as pat argument.
But the pat (pattern) in __dev_change_net_namespace() is used as:
net/core/dev.c
11198 err = -EEXIST;
11199 if (__dev_get_by_name(net, dev->name)) {
11200 /* We get here if we can't use the current device name */
11201 if (!pat)
11202 goto out;
11203 err = dev_get_valid_name(net, dev, pat);
11204 if (err < 0)
11205 goto out;
11206 }
As the result the goto out path on line 11202 is neven taken and instead of returning EEXIST defined on line 11198, __dev_change_net_namespace() returns an error from dev_get_valid_name() and this, in turn, will be EINVAL for ifname[0] = '\0' set earlier.
--- net/core/rtnetlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/rtnetlink.c +2 -1
@@ -2597,6 +2597,7 @@ static int do_setlink(const struct sk_buff *skb,return err;if (tb[IFLA_NET_NS_PID ] || tb[IFLA_NET_NS_FD ] || tb[IFLA_TARGET_NETNSID ]) { +const char *pat = ifname && ifname[0 ] ? ifname :NULL ;struct net *net;int new_ifindex;
@@ -2612,7 +2613,7 @@ static int do_setlink(const struct sk_buff *skb,else new_ifindex =0 ; - err =__dev_change_net_namespace (dev, net, ifname, new_ifindex); + err =__dev_change_net_namespace (dev, net, pat, new_ifindex);put_net (net);if (err) goto errout;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 60/113 net: hns3: clear hardware resource when loading driver
In reply to Greg Kroah-HartmanFrom: Yufeng Mo <[email protected]>
[ Upstream commit 1a6d281946c330cee2855f6d0cd796616e54601f ]
If a PF is bonded to a virtual machine and the virtual machine exits unexpectedly, some hardware resource cannot be cleared. In this case, loading driver may cause exceptions. Therefore, the hardware resource needs to be cleared when the driver is loaded.
--- .../hisilicon/hns3/hns3pf/hclge_cmd.h | 3 +++ .../hisilicon/hns3/hns3pf/hclge_main.c | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +3 -0
@@ -264,6 +264,9 @@ enum hclge_opcode_type {/* Led command */ HCLGE_OPC_LED_STATUS_CFG =0xB000 , +/* clear hardware resource command */ +HCLGE_OPC_CLEAR_HW_RESOURCE =0x700B , +/* NCL config command */ HCLGE_OPC_QUERY_NCL_CONFIG = 0x7011,
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +26 -0
@@ -11167,6 +11167,28 @@ static void hclge_clear_resetting_state(struct hclge_dev *hdev) } } +static int hclge_clear_hw_resource (struct hclge_dev *hdev) +{ +struct hclge_desc desc; +int ret; + +hclge_cmd_setup_basic_desc (&desc,HCLGE_OPC_CLEAR_HW_RESOURCE , false); + + ret =hclge_cmd_send (&hdev->hw, &desc,1 ); +/* This new command is only supported by new firmware, it will +* fail with older firmware. Error value -EOPNOSUPP can only be +* returned by older firmware running this command, to keep code +* backward compatible we will override this value and return +* success. +*/ +if (ret && ret != -EOPNOTSUPP ) { +dev_err (&hdev->pdev->dev, +"failed to clear hw resource, ret = %d\n" , ret); +return ret; + } +return 0 ; +} +static int hclge_init_ae_dev (struct hnae3_ae_dev *ae_dev) {struct pci_dev *pdev = ae_dev->pdev;
@@ -11204,6 +11226,10 @@ static int hclge_init_ae_dev(struct hnae3_ae_dev *ae_dev)if (ret) goto err_cmd_uninit; + ret =hclge_clear_hw_resource (hdev); +if (ret) + goto err_cmd_uninit; + ret =hclge_get_cap (hdev);if (ret) goto err_cmd_uninit;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 61/113 net: hns3: add waiting time before cmdq memory is released
In reply to Greg Kroah-HartmanFrom: Yufeng Mo <[email protected]>
[ Upstream commit a96d9330b02a3d051ae689bc2c5e7d3a2ba25594 ]
After the cmdq registers are cleared, the firmware may take time to clear out possible left over commands in the cmdq. Driver must release cmdq memory only after firmware has completed processing of left over commands.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 6 +++++- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c | 7 ++++++- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h | 1 + 4 files changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +5 -1
@@ -564,9 +564,13 @@ static void hclge_cmd_uninit_regs(struct hclge_hw *hw)void hclge_cmd_uninit (struct hclge_dev *hdev) { +set_bit (HCLGE_STATE_CMD_DISABLE , &hdev->state); +/* wait to ensure that the firmware completes the possible left +* over commands. +*/ +msleep (HCLGE_CMDQ_CLEAR_WAIT_TIME );spin_lock_bh (&hdev->hw.cmq.csq.lock);spin_lock (&hdev->hw.cmq.crq.lock); -set_bit (HCLGE_STATE_CMD_DISABLE , &hdev->state);hclge_cmd_uninit_regs (&hdev->hw);spin_unlock (&hdev->hw.cmq.crq.lock);spin_unlock_bh (&hdev->hw.cmq.csq.lock);
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +1 -0
@@ -9,6 +9,7 @@#include "hnae3.h" #define HCLGE_CMDQ_TX_TIMEOUT 30000 +#define HCLGE_CMDQ_CLEAR_WAIT_TIME 200#define HCLGE_DESC_DATA_LEN 6struct hclge_dev ;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c +6 -1
@@ -505,12 +505,17 @@ static void hclgevf_cmd_uninit_regs(struct hclgevf_hw *hw)void hclgevf_cmd_uninit (struct hclgevf_dev *hdev) { +set_bit (HCLGEVF_STATE_CMD_DISABLE , &hdev->state); +/* wait to ensure that the firmware completes the possible left +* over commands. +*/ +msleep (HCLGEVF_CMDQ_CLEAR_WAIT_TIME );spin_lock_bh (&hdev->hw.cmq.csq.lock);spin_lock (&hdev->hw.cmq.crq.lock); -set_bit (HCLGEVF_STATE_CMD_DISABLE , &hdev->state);hclgevf_cmd_uninit_regs (&hdev->hw);spin_unlock (&hdev->hw.cmq.crq.lock);spin_unlock_bh (&hdev->hw.cmq.csq.lock); +hclgevf_free_cmd_desc (&hdev->hw.cmq.csq);hclgevf_free_cmd_desc (&hdev->hw.cmq.crq); }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.h +1 -0
@@ -8,6 +8,7 @@#include "hnae3.h" #define HCLGEVF_CMDQ_TX_TIMEOUT 30000 +#define HCLGEVF_CMDQ_CLEAR_WAIT_TIME 200#define HCLGEVF_CMDQ_RX_INVLD_B 0#define HCLGEVF_CMDQ_RX_OUTVLD_B 1
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 62/113 net: hns3: fix speed unknown issue in bond 4
In reply to Greg Kroah-HartmanFrom: Yonglong Liu <[email protected]>
[ Upstream commit b15c072a9f4a404c09ad589477f4389034742a8b ]
In bond 4, when the link goes down and up repeatedly, the bond may get an unknown speed, and then this port can not work.
The driver notify netif_carrier_on() before update the link state, when the bond receive carrier on, will query the speed of the port, if the query operation happens before updating the link state, will get an unknown speed. So need to notify netif_carrier_on() after update the link state.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +1 -1
@@ -2924,12 +2924,12 @@ static void hclge_update_link_status(struct hclge_dev *hdev) }if (state != hdev->hw.mac.link) { + hdev->hw.mac.link = state; client->ops->link_status_change (handle, state);hclge_config_mac_tnl_int (hdev, state);if (rclient && rclient->ops->link_status_change) rclient->ops->link_status_change (rhandle, state); - hdev->hw.mac.link = state;hclge_push_link_status (hdev); }
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +1 -1
@@ -498,10 +498,10 @@ void hclgevf_update_link_status(struct hclgevf_dev *hdev, int link_state) link_state =test_bit (HCLGEVF_STATE_DOWN , &hdev->state) ?0 : link_state;if (link_state != hdev->hw.mac.link) { + hdev->hw.mac.link = link_state; client->ops->link_status_change (handle, !!link_state);if (rclient && rclient->ops->link_status_change) rclient->ops->link_status_change (rhandle, !!link_state); - hdev->hw.mac.link = link_state; }clear_bit (HCLGEVF_STATE_LINK_UPDATING , &hdev->state);
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_mbx.c +1 -1
@@ -304,8 +304,8 @@ void hclgevf_mbx_async_handler(struct hclgevf_dev *hdev) flag = (u8 )msg_q[5 ];/* update upper layer with new link link status */ -hclgevf_update_link_status (hdev, link_status);hclgevf_update_speed_duplex (hdev, speed, duplex); +hclgevf_update_link_status (hdev, link_status);if (flag &HCLGE_MBX_PUSH_LINK_STATUS_EN ) set_bit(HCLGEVF_STATE_PF_PUSH_LINK_STATUS,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 63/113 net: hns3: fix duplicate node in VLAN list
In reply to Greg Kroah-HartmanFrom: Guojia Liao <[email protected]>
[ Upstream commit 94391fae82f71c98ecc7716a32611fcca73c74eb ]
VLAN list should not be added duplicate VLAN node, otherwise it would cause "add failed" when restore VLAN from VLAN list, so this patch adds VLAN ID check before adding node into VLAN list.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +5 -1
@@ -9869,7 +9869,11 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev)static void hclge_add_vport_vlan_table (struct hclge_vport *vport,u16 vlan_id,bool writen_to_tbl) { -struct hclge_vport_vlan_cfg *vlan; +struct hclge_vport_vlan_cfg *vlan, *tmp; + +list_for_each_entry_safe (vlan, tmp, &vport->vlan_list, node) +if (vlan->vlan_id == vlan_id) +return ; vlan =kzalloc (sizeof (*vlan),GFP_KERNEL );if (!vlan)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 64/113 net: hns3: fix get wrong pfc_en when query PFC configuration
In reply to Greg Kroah-HartmanFrom: Guangbin Huang <[email protected]>
[ Upstream commit 8c1671e0d13d4a0ba4fb3a0da932bf3736d7ff73 ]
Currently, when query PFC configuration by dcbtool, driver will return PFC enable status based on TC. As all priorities are mapped to TC0 by default, if TC0 is enabled, then all priorities mapped to TC0 will be shown as enabled status when query PFC setting, even though some priorities have never been set.
for example:
$ dcb pfc show dev eth0 pfc-cap 4 macsec-bypass off delay 0 prio-pfc 0:off 1:off 2:off 3:off 4:off 5:off 6:off 7:off $ dcb pfc set dev eth0 prio-pfc 0:on 1:on 2:on 3:on $ dcb pfc show dev eth0 pfc-cap 4 macsec-bypass off delay 0 prio-pfc 0:on 1:on 2:on 3:on 4:on 5:on 6:on 7:on
To fix this problem, just returns user's PFC config parameter saved in driver.
--- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +2 -11
@@ -255,21 +255,12 @@ static int hclge_ieee_getpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)u64 requests[HNAE3_MAX_TC ], indications[HNAE3_MAX_TC ];struct hclge_vport *vport =hclge_get_vport (h);struct hclge_dev *hdev = vport->back; -u8 i, j, pfc_map, *prio_tc;int ret; +u8 i;memset (pfc,0 ,sizeof (*pfc)); pfc->pfc_cap = hdev->pfc_max; - prio_tc = hdev->tm_info.prio_tc; - pfc_map = hdev->tm_info.hw_pfc_map; - -/* Pfc setting is based on TC */ -for (i =0 ; i < hdev->tm_info.num_tc; i++) { -for (j =0 ; j <HNAE3_MAX_USER_PRIO ; j++) { -if ((prio_tc[j] == i) && (pfc_map &BIT (i))) - pfc->pfc_en |=BIT (j); - } - } + pfc->pfc_en = hdev->tm_info.pfc_en; ret =hclge_pfc_tx_stats_get (hdev, requests);if (ret)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 65/113 media: ipu3-cio2: Drop reference on error path in cio2_bridge_connect_sensor()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 294c34e704e78d641b039064ce72d4531afe0088 ]
The commit 71f642833284 ("ACPI: utils: Fix reference counting in for_each_acpi_dev_match()") moved adev assignment outside of error path and hence made acpi_dev_put(sensor->adev) a no-op. We still need to drop reference count on error path, and to achieve that, replace sensor->adev by locally assigned adev.
Depends-on: fc68f42aa737 ("ACPI: fix NULL pointer dereference")
--- drivers/media/pci/intel/ipu3/cio2-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ipu3/cio2-bridge.c +1 -1
@@ -226,7 +226,7 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, err_free_swnodes:software_node_unregister_nodes (sensor->swnodes); err_put_adev: -acpi_dev_put (sensor->adev); +acpi_dev_put (adev);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 66/113 Revert "mmc: sdhci-iproc: Set SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN on BCM2711"
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
[ Upstream commit 885814a97f5a1a2daf66bde5f2076f0bf632c174 ]
This reverts commit 419dd626e357e89fc9c4e3863592c8b38cfe1571.
It turned out that the change from the reverted commit breaks the ACPI based rpi's because it causes the 100Mhz max clock to be overridden to the return from sdhci_iproc_get_max_clock(), which is 0 because there isn't a OF/DT based clock device.
--- drivers/mmc/host/sdhci-iproc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/sdhci-iproc.c +1 -2
@@ -295,8 +295,7 @@ static const struct sdhci_ops sdhci_iproc_bcm2711_ops = { };static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = { - .quirks =SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 | -SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN , + .quirks =SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 , .ops = &sdhci_iproc_bcm2711_ops, };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 67/113 net: stmmac: add mutex lock to protect est parameters
In reply to Greg Kroah-HartmanFrom: Xiaoliang Yang <[email protected]>
[ Upstream commit b2aae654a4794ef898ad33a179f341eb610f6b85 ]
Add a mutex lock to protect est structure parameters so that the EST parameters can be updated by other threads.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 12 +++++++++++- include/linux/stmmac.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +11 -1
@@ -775,14 +775,18 @@ static int tc_setup_taprio(struct stmmac_priv *priv, GFP_KERNEL);if (!plat->est)return -ENOMEM ; + +mutex_init (&priv->plat->est->lock); }else {memset (plat->est,0 ,sizeof (*plat->est)); } size = qopt->num_entries; +mutex_lock (&priv->plat->est->lock); priv->plat->est->gcl_size = size; priv->plat->est->enable = qopt->enable; +mutex_unlock (&priv->plat->est->lock);for (i =0 ; i < size; i++) {s64 delta_ns = qopt->entries[i].interval;
@@ -813,6 +817,7 @@ static int tc_setup_taprio(struct stmmac_priv *priv, priv->plat->est->gcl[i] = delta_ns | (gates << wid); } +mutex_lock (&priv->plat->est->lock);/* Adjust for real system time */ priv->ptp_clock_ops.gettime64 (&priv->ptp_clock_ops, ¤t_time); current_time_ns =timespec64_to_ktime (current_time);
@@ -837,8 +842,10 @@ static int tc_setup_taprio(struct stmmac_priv *priv, priv->plat->est->ctr[0 ] =do_div (ctr,NSEC_PER_SEC ); priv->plat->est->ctr[1 ] = (u32 )ctr; -if (fpe && !priv->dma_cap.fpesel) +if (fpe && !priv->dma_cap.fpesel) { +mutex_unlock (&priv->plat->est->lock);return -EOPNOTSUPP ; + }/* Actual FPE register configuration will be done after FPE handshake * is success.
@@ -847,6 +854,7 @@ static int tc_setup_taprio(struct stmmac_priv *priv, ret =stmmac_est_configure (priv, priv->ioaddr, priv->plat->est, priv->plat->clk_ptp_rate); +mutex_unlock (&priv->plat->est->lock);if (ret) {netdev_err (priv->dev,"failed to configure EST\n" ); goto disable;
@@ -862,9 +870,11 @@ static int tc_setup_taprio(struct stmmac_priv *priv,return 0 ; disable: +mutex_lock (&priv->plat->est->lock); priv->plat->est->enable = false;stmmac_est_configure (priv, priv->ioaddr, priv->plat->est, priv->plat->clk_ptp_rate); +mutex_unlock (&priv->plat->est->lock); priv->plat->fpe_cfg->enable = false; stmmac_fpe_configure(priv, priv->ioaddr,
include/linux/stmmac.h +1 -0
@@ -115,6 +115,7 @@ struct stmmac_axi {#define EST_GCL 1024struct stmmac_est { +struct mutex lock;int enable;u32 btr_offset[2 ];u32 btr[2 ];
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 68/113 net: stmmac: fix kernel panic due to NULL pointer dereference of plat->est
In reply to Greg Kroah-HartmanFrom: Wong Vee Khee <[email protected]>
[ Upstream commit 82a44ae113b7b35850f4542f0443fcab221e376a ]
In the case of taprio offload is not enabled, the error handling path causes a kernel crash due to kernel NULL pointer deference.
Fix this by adding check for NULL before attempt to access 'plat->est' on the mutex_lock() call.
The following kernel panic is observed without this patch:
RIP: 0010:mutex_lock+0x10/0x20 Call Trace: tc_setup_taprio+0x482/0x560 [stmmac] kmem_cache_alloc_trace+0x13f/0x490 taprio_disable_offload.isra.0+0x9d/0x180 [sch_taprio] taprio_destroy+0x6c/0x100 [sch_taprio] qdisc_create+0x2e5/0x4f0 tc_modify_qdisc+0x126/0x740 rtnetlink_rcv_msg+0x12b/0x380 _raw_spin_lock_irqsave+0x19/0x40 _raw_spin_unlock_irqrestore+0x18/0x30 create_object+0x212/0x340 rtnl_calcit.isra.0+0x110/0x110 netlink_rcv_skb+0x50/0x100 netlink_unicast+0x191/0x230 netlink_sendmsg+0x243/0x470 sock_sendmsg+0x5e/0x60 ____sys_sendmsg+0x20b/0x280 copy_msghdr_from_user+0x5c/0x90 __mod_memcg_state+0x87/0xf0 ___sys_sendmsg+0x7c/0xc0 lru_cache_add+0x7f/0xa0 _raw_spin_unlock+0x16/0x30 wp_page_copy+0x449/0x890 handle_mm_fault+0x921/0xfc0 __sys_sendmsg+0x59/0xa0 do_syscall_64+0x33/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 ---[ end trace b1f19b24368a96aa ]---
--- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +7 -5
@@ -870,11 +870,13 @@ static int tc_setup_taprio(struct stmmac_priv *priv,return 0 ; disable: -mutex_lock (&priv->plat->est->lock); - priv->plat->est->enable = false; -stmmac_est_configure (priv, priv->ioaddr, priv->plat->est, - priv->plat->clk_ptp_rate); -mutex_unlock (&priv->plat->est->lock); +if (priv->plat->est) { +mutex_lock (&priv->plat->est->lock); + priv->plat->est->enable = false; +stmmac_est_configure (priv, priv->ioaddr, priv->plat->est, + priv->plat->clk_ptp_rate); +mutex_unlock (&priv->plat->est->lock); + } priv->plat->fpe_cfg->enable = false; stmmac_fpe_configure(priv, priv->ioaddr,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 69/113 usb: gadget: u_audio: fix race condition on endpoint stop
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 068fdad20454f815e61e6f6eb9f051a8b3120e88 ]
If the endpoint completion callback is call right after the ep_enabled flag is cleared and before usb_ep_dequeue() is call, we could do a double free on the request and the associated buffer.
Fix this by clearing ep_enabled after all the endpoint requests have been dequeued.
--- drivers/usb/gadget/function/u_audio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/u_audio.c +2 -3
@@ -312,8 +312,6 @@ static inline void free_ep(struct uac_rtd_params *prm, struct usb_ep *ep)if (!prm->ep_enabled)return ; - prm->ep_enabled = false; - audio_dev = uac->audio_dev; params = &audio_dev->params;
@@ -331,11 +329,12 @@ static inline void free_ep(struct uac_rtd_params *prm, struct usb_ep *ep) } } + prm->ep_enabled = false; +if (usb_ep_disable (ep))dev_err (uac->card->dev,"%s:%d Error!\n" , __func__, __LINE__); } -int u_audio_start_capture (struct g_audio *audio_dev) {struct snd_uac_chip *uac = audio_dev->uac;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 70/113 perf/x86/intel/uncore: Fix integer overflow on 23 bit left shift of a u32
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 0b3a8738b76fe2087f7bc2bd59f4c78504c79180 ]
The u32 variable pci_dword is being masked with 0x1fffffff and then left shifted 23 places. The shift is a u32 operation,so a value of 0x200 or more in pci_dword will overflow the u32 and only the bottow 32 bits are assigned to addr. I don't believe this was the original intent. Fix this by casting pci_dword to a resource_size_t to ensure no overflow occurs.
Note that the mask and 12 bit left shift operation does not need this because the mask SNR_IMC_MMIO_MEM0_MASK and shift is always a 32 bit value.
Addresses-Coverity: ("Unintentional integer overflow")
--- arch/x86/events/intel/uncore_snbep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/intel/uncore_snbep.c +1 -1
@@ -4701,7 +4701,7 @@ static void __snr_uncore_mmio_init_box(struct intel_uncore_box *box,return ;pci_read_config_dword (pdev,SNR_IMC_MMIO_BASE_OFFSET , &pci_dword); - addr = (pci_dword &SNR_IMC_MMIO_BASE_MASK ) <<23 ; + addr = ((resource_size_t )pci_dword &SNR_IMC_MMIO_BASE_MASK ) <<23 ;pci_read_config_dword (pdev, mem_offset, &pci_dword); addr |= (pci_dword &SNR_IMC_MMIO_MEM0_MASK ) <<12 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 71/113 sched: Fix get_push_task() vs migrate_disable()
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit e681dcbaa4b284454fecd09617f8b24231448446 ]
push_rt_task() attempts to move the currently running task away if the next runnable task has migration disabled and therefore is pinned on the current CPU.
The current task is retrieved via get_push_task() which only checks for nr_cpus_allowed == 1, but does not check whether the task has migration disabled and therefore cannot be moved either. The consequence is a pointless invocation of the migration thread which correctly observes that the task cannot be moved.
Return NULL if the task has migration disabled and cannot be moved to another CPU.
--- kernel/sched/sched.h | 3 +++ 1 file changed, 3 insertions(+)
kernel/sched/sched.h +3 -0
@@ -1977,6 +1977,9 @@ static inline struct task_struct *get_push_task(struct rq *rq)if (p->nr_cpus_allowed ==1 )return NULL ; +if (p->migration_disabled) +return NULL ; + rq->push_busy = true;return get_task_struct (p); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 72/113 clk: renesas: rcar-usb2-clock-sel: Fix kernel NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit 1669a941f7c4844ae808cf441db51dde9e94db07 ]
The probe was manually passing NULL instead of dev to devm_clk_hw_register. This caused a Unable to handle kernel NULL pointer dereference error. Fix this by passing 'dev'.
--- drivers/clk/renesas/rcar-usb2-clock-sel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/rcar-usb2-clock-sel.c +1 -1
@@ -187,7 +187,7 @@ static int rcar_usb2_clock_sel_probe(struct platform_device *pdev) init.ops = &usb2_clock_sel_clock_ops; priv->hw.init = &init; - ret =devm_clk_hw_register (NULL , &priv->hw); + ret =devm_clk_hw_register (dev, &priv->hw);if (ret) goto pm_put;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 73/113 iwlwifi: pnvm: accept multiple HW-type TLVs
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 0f673c16c850250db386537a422c11d248fb123c ]
Some products (So) may have two different types of products with different mac-type that are otherwise equivalent, and have the same PNVM data, so the PNVM file will contain two (or perhaps later more) HW-type TLVs. Accept the file and use the data section that contains any matching entry.
--- drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 25 +++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +16 -9
@@ -37,6 +37,7 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,u32 sha1 =0 ;u16 mac_type =0 , rf_id =0 ;u8 *pnvm_data =NULL , *tmp; +bool hw_match = false;u32 size =0 ;int ret;
@@ -83,6 +84,9 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,break ; } +if (hw_match) +break ; + mac_type =le16_to_cpup ((__le16 *)data); rf_id =le16_to_cpup ((__le16 *)(data +sizeof (__le16)));
@@ -90,15 +94,9 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,"Got IWL_UCODE_TLV_HW_TYPE mac_type 0x%0x rf_id 0x%0x\n" , mac_type, rf_id); -if (mac_type !=CSR_HW_REV_TYPE (trans->hw_rev) || - rf_id !=CSR_HW_RFID_TYPE (trans->hw_rf_id)) { -IWL_DEBUG_FW (trans, -"HW mismatch, skipping PNVM section, mac_type 0x%0x, rf_id 0x%0x.\n" , -CSR_HW_REV_TYPE (trans->hw_rev), trans->hw_rf_id); - ret = -ENOENT ; - goto out; - } - +if (mac_type ==CSR_HW_REV_TYPE (trans->hw_rev) && + rf_id ==CSR_HW_RFID_TYPE (trans->hw_rf_id)) + hw_match = true;break ;case IWL_UCODE_TLV_SEC_RT : {struct iwl_pnvm_section *section = (void *)data;
@@ -149,6 +147,15 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data, } done: +if (!hw_match) { +IWL_DEBUG_FW (trans, +"HW mismatch, skipping PNVM section (need mac_type 0x%x rf_id 0x%x)\n" , +CSR_HW_REV_TYPE (trans->hw_rev), +CSR_HW_RFID_TYPE (trans->hw_rf_id)); + ret = -ENOENT ; + goto out; + } +if (!size) {IWL_DEBUG_FW (trans,"Empty PNVM, skipping.\n" ); ret = -ENOENT ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 74/113 iwlwifi: add new SoF with JF devices
In reply to Greg Kroah-HartmanFrom: Yaara Baruch <[email protected]>
[ Upstream commit a5bf1d4434b93394fa37494d78fe9f3513557185 ]
Add new SoF JF devices to the driver.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +34 -0
@@ -1103,6 +1103,40 @@ static const struct iwl_dev_info iwl_dev_info_table[] = { IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, iwl_cfg_bz_a0_mr_a0, iwl_ax211_name), +/* SoF with JF2 */ +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SOF ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF2 ,IWL_CFG_RF_ID_JF , +IWL_CFG_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9560_160_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SOF ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF2 ,IWL_CFG_RF_ID_JF , +IWL_CFG_NO_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9560_name), + +/* SoF with JF */ +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SOF ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1 , +IWL_CFG_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9461_160_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SOF ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1_DIV , +IWL_CFG_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9462_160_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SOF ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1 , +IWL_CFG_NO_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9461_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SOF ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1_DIV , +IWL_CFG_NO_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9462_name), +/* So with GF */ _IWL_DEV_INFO(IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 75/113 iwlwifi: add new so-jf devices
In reply to Greg Kroah-HartmanFrom: Yaara Baruch <[email protected]>
[ Upstream commit 891332f697e14bfb2002f56e21d9bbd4800a7098 ]
Add new so-jf devices to the driver.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +35 -1
@@ -1142,7 +1142,41 @@ static const struct iwl_dev_info iwl_dev_info_table[] = { IWL_CFG_MAC_TYPE_SO, IWL_CFG_ANY, IWL_CFG_RF_TYPE_GF, IWL_CFG_ANY, IWL_CFG_160, IWL_CFG_ANY, IWL_CFG_NO_CDB, - iwlax211_2ax_cfg_so_gf_a0, iwl_ax211_name) + iwlax211_2ax_cfg_so_gf_a0, iwl_ax211_name), + +/* So with JF2 */ +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SO ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF2 ,IWL_CFG_RF_ID_JF , +IWL_CFG_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9560_160_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SO ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF2 ,IWL_CFG_RF_ID_JF , +IWL_CFG_NO_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9560_name), + +/* So with JF */ +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SO ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1 , +IWL_CFG_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9461_160_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SO ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1_DIV , +IWL_CFG_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9462_160_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SO ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1 , +IWL_CFG_NO_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9461_name), +_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , +IWL_CFG_MAC_TYPE_SO ,IWL_CFG_ANY , +IWL_CFG_RF_TYPE_JF1 ,IWL_CFG_RF_ID_JF1_DIV , +IWL_CFG_NO_160 ,IWL_CFG_CORES_BT ,IWL_CFG_NO_CDB , + iwlax210_2ax_cfg_so_jf_b0, iwl9462_name)#endif /* CONFIG_IWLMVM */ };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 76/113 opp: remove WARN when no valid OPPs remain
In reply to Greg Kroah-HartmanFrom: Michał Mirosław <[email protected]>
[ Upstream commit 335ffab3ef864539e814b9a2903b0ae420c1c067 ]
This WARN can be triggered per-core and the stack trace is not useful. Replace it with plain dev_err(). Fix a comment while at it.
--- drivers/opp/of.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/opp/of.c +3 -2
@@ -985,8 +985,9 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table) } } -/* There should be one of more OPP defined */ -if (WARN_ON (!count)) { +/* There should be one or more OPPs defined */ +if (!count) { +dev_err (dev,"%s: no supported OPPs" , __func__); ret = -ENOENT ; goto remove_static_opp; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 77/113 cpufreq: blocklist Qualcomm sm8150 in cpufreq-dt-platdev
In reply to Greg Kroah-HartmanFrom: Thara Gopinath <[email protected]>
[ Upstream commit 5d79e5ce5489b489cbc4c327305be9dfca0fc9ce ]
The Qualcomm sm8150 platform uses the qcom-cpufreq-hw driver, so add it to the cpufreq-dt-platdev driver's blocklist.
--- drivers/cpufreq/cpufreq-dt-platdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/cpufreq-dt-platdev.c +1 -0
@@ -138,6 +138,7 @@ static const struct of_device_id blacklist[] __initconst = { { .compatible = "qcom,qcs404", }, { .compatible = "qcom,sc7180", }, { .compatible = "qcom,sdm845", }, + { .compatible = "qcom,sm8150", }, { .compatible = "st,stih407", }, { .compatible = "st,stih410", },
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 78/113 virtio: Improve vq->broken access to avoid any compiler optimization
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 60f0779862e4ab943810187752c462e85f5fa371 ]
Currently vq->broken field is read by virtqueue_is_broken() in busy loop in one context by virtnet_send_command().
vq->broken is set to true in other process context by virtio_break_device(). Reader and writer are accessing it without any synchronization. This may lead to a compiler optimization which may result to optimize reading vq->broken only once.
Hence, force reading vq->broken on each invocation of virtqueue_is_broken() and also force writing it so that such update is visible to the readers.
It is a theoretical fix that isn't yet encountered in the field.
--- drivers/virtio/virtio_ring.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/virtio/virtio_ring.c +4 -2
@@ -2268,7 +2268,7 @@ bool virtqueue_is_broken(struct virtqueue *_vq) {struct vring_virtqueue *vq =to_vvq (_vq); -return vq->broken; +return READ_ONCE (vq->broken); }EXPORT_SYMBOL_GPL (virtqueue_is_broken);
@@ -2283,7 +2283,9 @@ void virtio_break_device(struct virtio_device *dev)spin_lock (&dev->vqs_list_lock);list_for_each_entry (_vq, &dev->vqs, list) {struct vring_virtqueue *vq =to_vvq (_vq); - vq->broken = true; + +/* Pairs with READ_ONCE() in virtqueue_is_broken(). */ +WRITE_ONCE (vq->broken, true); }spin_unlock (&dev->vqs_list_lock); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 79/113 virtio_pci: Support surprise removal of virtio pci device
In reply to Greg Kroah-HartmanFrom: Parav Pandit <[email protected]>
[ Upstream commit 43bb40c5b92659966bdf4bfe584fde0a3575a049 ]
When a virtio pci device undergo surprise removal (aka async removal in PCIe spec), mark the device as broken so that any upper layer drivers can abort any outstanding operation.
When a virtio net pci device undergo surprise removal which is used by a NetworkManager, a below call trace was observed.
kernel:watchdog: BUG: soft lockup - CPU#1 stuck for 26s! [kworker/1:1:27059]
watchdog: BUG: soft lockup - CPU#1 stuck for 52s! [kworker/1:1:27059] CPU: 1 PID: 27059 Comm: kworker/1:1 Tainted: G S W I L 5.13.0-hotplug+ #8 Hardware name: Dell Inc. PowerEdge R640/0H28RR, BIOS 2.9.4 11/06/2020 Workqueue: events linkwatch_event RIP: 0010:virtnet_send_command+0xfc/0x150 [virtio_net] Call Trace: virtnet_set_rx_mode+0xcf/0x2a7 [virtio_net] ? __hw_addr_create_ex+0x85/0xc0 __dev_mc_add+0x72/0x80 igmp6_group_added+0xa7/0xd0 ipv6_mc_up+0x3c/0x60 ipv6_find_idev+0x36/0x80 addrconf_add_dev+0x1e/0xa0 addrconf_dev_config+0x71/0x130 addrconf_notify+0x1f5/0xb40 ? rtnl_is_locked+0x11/0x20 ? __switch_to_asm+0x42/0x70 ? finish_task_switch+0xaf/0x2c0 ? raw_notifier_call_chain+0x3e/0x50 raw_notifier_call_chain+0x3e/0x50 netdev_state_change+0x67/0x90 linkwatch_do_dev+0x3c/0x50 __linkwatch_run_queue+0xd2/0x220 linkwatch_event+0x21/0x30 process_one_work+0x1c8/0x370 worker_thread+0x30/0x380 ? process_one_work+0x370/0x370 kthread+0x118/0x140 ? set_kthread_struct+0x40/0x40 ret_from_fork+0x1f/0x30
Hence, add the ability to abort the command on surprise removal which prevents infinite loop and system lockup.
--- drivers/virtio/virtio_pci_common.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/virtio/virtio_pci_common.c +7 -0
@@ -576,6 +576,13 @@ static void virtio_pci_remove(struct pci_dev *pci_dev)struct virtio_pci_device *vp_dev =pci_get_drvdata (pci_dev);struct device *dev =get_device (&vp_dev->vdev.dev); +/* +* Device is marked broken on surprise removal so that virtio upper +* layers can abort any ongoing operation. +*/ +if (!pci_device_is_present (pci_dev)) +virtio_break_device (&vp_dev->vdev); +pci_disable_sriov (pci_dev);unregister_virtio_device (&vp_dev->vdev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 80/113 virtio_vdpa: reject invalid vq indices
In reply to Greg Kroah-HartmanFrom: Vincent Whitchurch <[email protected]>
[ Upstream commit cb5d2c1f6cc0e5769099a7d44b9d08cf58cae206 ]
Do not call vDPA drivers' callbacks with vq indicies larger than what the drivers indicate that they support. vDPA drivers do not bounds check the indices.
--- drivers/virtio/virtio_vdpa.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/virtio/virtio_vdpa.c +3 -0
@@ -149,6 +149,9 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,if (!name)return NULL ; +if (index >= vdpa->nvqs) +return ERR_PTR (-ENOENT ); +/* Queue shouldn't already be set up. */ if (ops->get_vq_ready (vdpa, index))return ERR_PTR (-ENOENT );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 81/113 vringh: Use wiov->used to check for read/write desc order
In reply to Greg Kroah-HartmanFrom: Neeraj Upadhyay <[email protected]>
[ Upstream commit e74cfa91f42c50f7f649b0eca46aa049754ccdbd ]
As __vringh_iov() traverses a descriptor chain, it populates each descriptor entry into either read or write vring iov and increments that iov's ->used member. So, as we iterate over a descriptor chain, at any point, (riov/wriov)->used value gives the number of descriptor enteries available, which are to be read or written by the device. As all read iovs must precede the write iovs, wiov->used should be zero when we are traversing a read descriptor. Current code checks for wiov->i, to figure out whether any previous entry in the current descriptor chain was a write descriptor. However, iov->i is only incremented, when these vring iovs are consumed, at a later point, and remain 0 in __vringh_iov(). So, correct the check for read and write descriptor order, to use wiov->used.
--- drivers/vhost/vringh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vringh.c +1 -1
@@ -359,7 +359,7 @@ __vringh_iov(struct vringh *vrh, u16 i, iov = wiov; else { iov = riov; -if (unlikely (wiov && wiov->i)) { +if (unlikely (wiov && wiov->used)) {vringh_bad ("Readable desc %p after writable" , &descs[i]); err = -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 82/113 tools/virtio: fix build
In reply to Greg Kroah-HartmanFrom: Michael S. Tsirkin <[email protected]>
[ Upstream commit a24ce06c70fe7df795a846ad713ccaa9b56a7666 ]
We use a spinlock now so add a stub.
Ignore bogus uninitialized variable warnings.
--- tools/virtio/Makefile | 3 +- tools/virtio/linux/spinlock.h | 56 +++++++++++++++++++++++++++++++++++ tools/virtio/linux/virtio.h | 2 ++ 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 tools/virtio/linux/spinlock.h
tools/virtio/Makefile +2 -1
@@ -4,7 +4,8 @@ test: virtio_test vringh_test virtio_test: virtio_ring.o virtio_test.o vringh_test: vringh_test.o vringh.o virtio_ring.o -CFLAGS += -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h +CFLAGS += -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h +LDFLAGS += -lpthread vpath %.c ../../drivers/virtio ../../drivers/vhost mod: ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V}
tools/virtio/linux/spinlock.h new file +56 -0
56 lines not on this page · raw message
tools/virtio/linux/virtio.h +2 -0
@@ -3,6 +3,7 @@#define LINUX_VIRTIO_H #include <linux/scatterlist.h> #include <linux/kernel.h> +#include <linux/spinlock.h> struct device {void *parent;
@@ -12,6 +13,7 @@ struct virtio_device {struct device dev;u64 features;struct list_head vqs; +spinlock_t vqs_list_lock; };struct virtqueue {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 83/113 platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 7f45621c14a209b986cd636447bb53b7f6f881c3 ]
Unfortunately we have been unable to find a reliable way to detect if and how SW_TABLET_MODE reporting is supported, so we are relying on DMI quirks for this.
Add a module-option to specify the SW_TABLET_MODE method so that this can be easily tested without needing to rebuild the kernel.
--- drivers/platform/x86/asus-nb-wmi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +19 -0
@@ -41,6 +41,10 @@ static int wapf = -1;module_param (wapf, uint,0444 );MODULE_PARM_DESC (wapf,"WAPF value" ); +static int tablet_mode_sw =-1 ; +module_param (tablet_mode_sw, uint,0444 ); +MODULE_PARM_DESC (tablet_mode_sw,"Tablet mode detect: -1:auto 0:disable 1:kbd-dock 2:lid-flip" ); +static struct quirk_entry *quirks; static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
@@ -477,6 +481,21 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)else wapf = quirks->wapf; +switch (tablet_mode_sw) { +case 0 : + quirks->use_kbd_dock_devid = false; + quirks->use_lid_flip_devid = false; +break ; +case 1 : + quirks->use_kbd_dock_devid = true; + quirks->use_lid_flip_devid = false; +break ; +case 2 : + quirks->use_kbd_dock_devid = false; + quirks->use_lid_flip_devid = true; +break ; + } +if (quirks->i8042_filter) { ret =i8042_install_filter (quirks->i8042_filter);if (ret) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 84/113 platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 73fcbad691110ece47a487c9e584822070e3626f ]
The Asus TP200s / E205SA 360 degree hinges 2-in-1 supports reporting SW_TABLET_MODE info through the ASUS_WMI_DEVID_LID_FLIP WMI device-id. Add a quirk to enable this.
--- drivers/platform/x86/asus-nb-wmi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +9 -0
@@ -462,6 +462,15 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_use_lid_flip_devid, }, + { + .callback = dmi_matched, + .ident = "ASUS TP200s / E205SA", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "E205SA"), + }, + .driver_data = &quirk_asus_use_lid_flip_devid, + }, {}, };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 85/113 qed: qed ll2 race condition fixes
In reply to Greg Kroah-HartmanFrom: Shai Malin <[email protected]>
[ Upstream commit 37110237f31105d679fc0aa7b11cdec867750ea7 ]
Avoiding qed ll2 race condition and NULL pointer dereference as part of the remove and recovery flows.
Changes form V1:
- Change (!p_rx->set_prod_addr).
- qed_ll2.c checkpatch fixes.
Change from V2:
- Revert "qed_ll2.c checkpatch fixes".
--- drivers/net/ethernet/qlogic/qed/qed_ll2.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/net/ethernet/qlogic/qed/qed_ll2.c +20 -0
@@ -327,6 +327,9 @@ static int qed_ll2_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)unsigned long flags;int rc = -EINVAL ; +if (!p_ll2_conn) +return rc; +spin_lock_irqsave (&p_tx->lock, flags);if (p_tx->b_completing_packet) { rc = -EBUSY ;
@@ -500,7 +503,16 @@ static int qed_ll2_rxq_completion(struct qed_hwfn *p_hwfn, void *cookie)unsigned long flags =0 ;int rc =0 ; +if (!p_ll2_conn) +return rc; +spin_lock_irqsave (&p_rx->lock, flags); + +if (!QED_LL2_RX_REGISTERED (p_ll2_conn)) { +spin_unlock_irqrestore (&p_rx->lock, flags); +return 0 ; + } + cq_new_idx =le16_to_cpu (*p_rx->p_fw_cons); cq_old_idx =qed_chain_get_cons_idx (&p_rx->rcq_chain);
@@ -821,6 +833,9 @@ static int qed_ll2_lb_rxq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)struct qed_ll2_info *p_ll2_conn = (struct qed_ll2_info *)p_cookie;int rc; +if (!p_ll2_conn) +return 0 ; +if (!QED_LL2_RX_REGISTERED (p_ll2_conn))return 0 ;
@@ -844,6 +859,9 @@ static int qed_ll2_lb_txq_completion(struct qed_hwfn *p_hwfn, void *p_cookie)u16 new_idx =0 , num_bds =0 ;int rc; +if (!p_ll2_conn) +return 0 ; +if (!QED_LL2_TX_REGISTERED (p_ll2_conn))return 0 ;
@@ -1725,6 +1743,8 @@ int qed_ll2_post_rx_buffer(void *cxt,if (!p_ll2_conn)return -EINVAL ; p_rx = &p_ll2_conn->rx_queue; +if (!p_rx->set_prod_addr) +return -EIO ;spin_lock_irqsave (&p_rx->lock, flags);if (!list_empty (&p_rx->free_descq))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 86/113 qed: Fix null-pointer dereference in qed_rdma_create_qp()
In reply to Greg Kroah-HartmanFrom: Shai Malin <[email protected]>
[ Upstream commit d33d19d313d3466abdf8b0428be7837aff767802 ]
Fix a possible null-pointer dereference in qed_rdma_create_qp().
Changes from V2:
- Revert checkpatch fixes.
--- drivers/net/ethernet/qlogic/qed/qed_rdma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_rdma.c +1 -2
@@ -1285,8 +1285,7 @@ qed_rdma_create_qp(void *rdma_cxt,if (!rdma_cxt || !in_params || !out_params || !p_hwfn->p_rdma_info->active) { -DP_ERR (p_hwfn->cdev, -"qed roce create qp failed due to NULL entry (rdma_cxt=%p, in=%p, out=%p, roce_info=?\n" , +pr_err ("qed roce create qp failed due to NULL entry (rdma_cxt=%p, in=%p, out=%p, roce_info=?\n" , rdma_cxt, in_params, out_params);return NULL ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 87/113 Revert "drm/amd/pm: fix workload mismatch on vega10"
In reply to Greg Kroah-HartmanFrom: Kenneth Feng <[email protected]>
[ Upstream commit 2fd31689f9e44af949f60ff4f8aca013e628ab81 ]
This reverts commit 0979d43259e13846d86ba17e451e17fec185d240. Revert this because it does not apply to all the cards.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +1 -1
@@ -5160,7 +5160,7 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui out:smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetWorkloadMask, - (!power_profile_mode) ?0 :1 << (power_profile_mode -1 ), +1 << power_profile_mode,NULL ); hwmgr->power_profile_mode = power_profile_mode;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 88/113 drm/amd/pm: change the workload type for some cards
In reply to Greg Kroah-HartmanFrom: Kenneth Feng <[email protected]>
[ Upstream commit 93c5701b00d50d192ce2247cb10d6c0b3fe25cd8 ]
change the workload type for some cards as it is needed.
--- .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +14 -1
@@ -5123,6 +5123,13 @@ static int vega10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)return size; } +static bool vega10_get_power_profile_mode_quirks (struct pp_hwmgr *hwmgr) +{ +struct amdgpu_device *adev = hwmgr->adev; + +return (adev->pdev->device ==0x6860 ); +} +static int vega10_set_power_profile_mode (struct pp_hwmgr *hwmgr,long *input,uint32_t size) {struct vega10_hwmgr *data = hwmgr->backend;
@@ -5159,9 +5166,15 @@ static int vega10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, ui } out: -smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetWorkloadMask, +if (vega10_get_power_profile_mode_quirks (hwmgr)) +smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetWorkloadMask,1 << power_profile_mode,NULL ); +else +smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_SetWorkloadMask, + (!power_profile_mode) ?0 :1 << (power_profile_mode -1 ), +NULL ); + hwmgr->power_profile_mode = power_profile_mode;return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 89/113 blk-mq: dont grab rqs refcount in blk_mq_check_expired()
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit c797b40ccc340b8a66f7a7842aecc90bf749f087 ]
Inside blk_mq_queue_tag_busy_iter() we already grabbed request's refcount before calling ->fn(), so needn't to grab it one more time in blk_mq_check_expired().
Meantime remove extra request expire check in blk_mq_check_expired().
--- block/blk-mq.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-)
block/blk-mq.c +5 -25
@@ -923,34 +923,14 @@ static bool blk_mq_check_expired(struct blk_mq_hw_ctx *hctx,unsigned long *next = priv;/* -* Just do a quick check if it is expired before locking the request in -* so we're not unnecessarilly synchronizing across CPUs. -*/ -if (!blk_mq_req_expired (rq, next)) -return true; - -/* -* We have reason to believe the request may be expired. Take a -* reference on the request to lock this request lifetime into its -* currently allocated context to prevent it from being reallocated in -* the event the completion by-passes this timeout handler. -* -* If the reference was already released, then the driver beat the -* timeout handler to posting a natural completion. -*/ -if (!refcount_inc_not_zero (&rq->ref)) -return true; - -/* -* The request is now locked and cannot be reallocated underneath the -* timeout handler's processing. Re-verify this exact request is truly -* expired; if it is not expired, then the request was completed and -* reallocated as a new request. +* blk_mq_queue_tag_busy_iter() has locked the request, so it cannot +* be reallocated underneath the timeout handler's processing, then +* the expire check is reliable. If the request is not expired, then +* it was completed and reallocated as a new request after returning +* from blk_mq_check_expired(). */ if (blk_mq_req_expired (rq, next))blk_mq_rq_timed_out (rq, reserved); - -blk_mq_put_rq_ref (rq);return true; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 90/113 drm: Copy drm_wait_vblank to user before returning
In reply to Greg Kroah-HartmanFrom: Mark Yacoub <[email protected]>
[ Upstream commit fa0b1ef5f7a694f48e00804a391245f3471aa155 ]
[Why]
Userspace should get back a copy of drm_wait_vblank that's been modified even when drm_wait_vblank_ioctl returns a failure.
Rationale:drm_wait_vblank_ioctl modifies the request and expects the user to read it back. When the type is RELATIVE, it modifies it to ABSOLUTE and updates the sequence to become current_vblank_count + sequence (which was RELATIVE), but now it became ABSOLUTE.
drmWaitVBlank (in libdrm) expects this to be the case as it modifies the request to be Absolute so it expects the sequence to would have been updated.
The change is in compat_drm_wait_vblank, which is called by drm_compat_ioctl. This change of copying the data back regardless of the return number makes it en par with drm_ioctl, which always copies the data before returning.
[How]
Return from the function after everything has been copied to user.
Fixes IGT:kms_flip::modeset-vs-vblank-race-interruptible Tested on ChromeOS Trogdor(msm)
--- drivers/gpu/drm/drm_ioc32.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/drm_ioc32.c +1 -3
@@ -856,8 +856,6 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, req.request.sequence = req32.request.sequence; req.request.signal = req32.request.signal; err =drm_ioctl_kernel (file, drm_wait_vblank_ioctl, &req,DRM_UNLOCKED ); -if (err) -return err; req32.reply.type = req.reply.type; req32.reply.sequence = req.reply.sequence;
@@ -866,7 +864,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,if (copy_to_user (argp, &req32,sizeof (req32)))return -EFAULT ; -return 0 ; +return err; }#if defined(CONFIG_X86 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 91/113 platform/x86: gigabyte-wmi: add support for X570 GAMING X
In reply to Greg Kroah-HartmanFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit b9570f5c9240cadf87fb5f9313e8f425aa9e788f ]
Reported as working here:
https://github.com/t-8ch/linux-gigabyte-wmi-driver/issues/1#issuecomment-900263115
--- drivers/platform/x86/gigabyte-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/gigabyte-wmi.c +1 -0
@@ -147,6 +147,7 @@ static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = {DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B550M DS3H" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("Z390 I AORUS PRO WIFI-CF" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("X570 AORUS ELITE" ), +DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("X570 GAMING X" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("X570 I AORUS PRO WIFI" ), DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("X570 UD"), { }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 92/113 drm/nouveau: recognise GA107
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit fa25f28ef2cef19bc9ffeb827b8ecbf48af7f892 ]
Still no GA106 as I don't have HW to verif.
--- .../gpu/drm/nouveau/nvkm/engine/device/base.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +21 -0
@@ -2624,6 +2624,26 @@ nv174_chipset = { .dma = { 0x00000001, gv100_dma_new }, }; +static const struct nvkm_device_chip +nv177_chipset = { + .name ="GA107" , + .bar = {0x00000001 , tu102_bar_new }, + .bios = {0x00000001 , nvkm_bios_new }, + .devinit = {0x00000001 , ga100_devinit_new }, + .fb = {0x00000001 , ga102_fb_new }, + .gpio = {0x00000001 , ga102_gpio_new }, + .i2c = {0x00000001 , gm200_i2c_new }, + .imem = {0x00000001 , nv50_instmem_new }, + .mc = {0x00000001 , ga100_mc_new }, + .mmu = {0x00000001 , tu102_mmu_new }, + .pci = {0x00000001 , gp100_pci_new }, + .privring = {0x00000001 , gm200_privring_new }, + .timer = {0x00000001 , gk20a_timer_new }, + .top = {0x00000001 , ga100_top_new }, + .disp = {0x00000001 , ga102_disp_new }, + .dma = {0x00000001 , gv100_dma_new }, +}; +static int nvkm_device_event_ctor (struct nvkm_object *object,void *data,u32 size,struct nvkm_notify *notify)
@@ -3049,6 +3069,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func,case 0x168 : device->chip = &nv168_chipset;break ;case 0x172 : device->chip = &nv172_chipset;break ;case 0x174 : device->chip = &nv174_chipset;break ; +case 0x177 : device->chip = &nv177_chipset;break ;default :if (nvkm_boolopt (device->cfgopt,"NvEnableUnsupportedChipsets" , false)) {switch (device->chipset) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 93/113 drm/nouveau/disp: power down unused DP links during init
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit 6eaa1f3c59a707332e921e32782ffcad49915c5e ]
When booted with multiple displays attached, the EFI GOP driver on (at least) Ampere, can leave DP links powered up that aren't being used to display anything. This confuses our tracking of SOR routing, with the likely result being a failed modeset and display engine hang.
Fix this by (ab?)using the DisableLT IED script to power-down the link, restoring HW to a state the driver expects.
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h | 1 + drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c +1 -1
@@ -440,7 +440,7 @@ nvkm_dp_train(struct nvkm_dp *dp, u32 dataKBps)return ret; } -static void +void nvkm_dp_disable (struct nvkm_outp *outp,struct nvkm_ior *ior) {struct nvkm_dp *dp =nvkm_dp (outp);
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h +1 -0
@@ -32,6 +32,7 @@ struct nvkm_dp {int nvkm_dp_new (struct nvkm_disp *,int index,struct dcb_output *,struct nvkm_outp **); +void nvkm_dp_disable (struct nvkm_outp *,struct nvkm_ior *);/* DPCD Receiver Capabilities */ #define DPCD_RC00_DPCD_REV 0x00000
drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c +9 -0
@@ -22,6 +22,7 @@* Authors: Ben Skeggs */ #include "outp.h" +#include "dp.h" #include "ior.h" #include <subdev/bios.h>
@@ -257,6 +258,14 @@ nvkm_outp_init_route(struct nvkm_outp *outp)if (!ior->arm.head || ior->arm.proto != proto) {OUTP_DBG (outp,"no heads (%x %d %d)" , ior->arm.head, ior->arm.proto, proto); + +/* The EFI GOP driver on Ampere can leave unused DP links routed, +* which we don't expect. The DisableLT IED script *should* get +* us back to where we need to be. +*/ +if (ior->func->route.get && !ior->arm.head && outp->info.type ==DCB_OUTPUT_DP ) +nvkm_dp_disable (outp, ior); +return ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 94/113 drm/nouveau/kms/nv50: workaround EFI GOP window channel format differences
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit e78b1b545c6cfe9f87fc577128e00026fff230ba ]
Should fix some initial modeset failures on (at least) Ampere boards.
--- drivers/gpu/drm/nouveau/dispnv50/disp.c | 27 +++++++++++++++++++++++++ drivers/gpu/drm/nouveau/dispnv50/head.c | 13 ++++++++---- drivers/gpu/drm/nouveau/dispnv50/head.h | 1 + 3 files changed, 37 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/disp.c +27 -0
@@ -2235,6 +2235,33 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) interlock[NV50_DISP_INTERLOCK_CORE ] =0 ; } +/* Finish updating head(s)... +* +* NVD is rather picky about both where window assignments can change, +* *and* about certain core and window channel states matching. +* +* The EFI GOP driver on newer GPUs configures window channels with a +* different output format to what we do, and the core channel update +* in the assign_windows case above would result in a state mismatch. +* +* Delay some of the head update until after that point to workaround +* the issue. This only affects the initial modeset. +* +* TODO: handle this better when adding flexible window mapping +*/ +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +struct nv50_head_atom *asyh =nv50_head_atom (new_crtc_state); +struct nv50_head *head =nv50_head (crtc); + +NV_ATOMIC (drm,"%s: set %04x (clr %04x)\n" , crtc->name, + asyh->set.mask, asyh->clr.mask); + +if (asyh->set.mask) { +nv50_head_flush_set_wndw (head, asyh); + interlock[NV50_DISP_INTERLOCK_CORE ] =1 ; + } + } +/* Update plane(s). */ for_each_new_plane_in_state (state, plane, new_plane_state, i) {struct nv50_wndw_atom *asyw =nv50_wndw_atom (new_plane_state);
drivers/gpu/drm/nouveau/dispnv50/head.c +9 -4
@@ -50,11 +50,8 @@ nv50_head_flush_clr(struct nv50_head *head, }void -nv50_head_flush_set (struct nv50_head *head,struct nv50_head_atom *asyh) +nv50_head_flush_set_wndw (struct nv50_head *head,struct nv50_head_atom *asyh) { -if (asyh->set.view ) head->func->view (head, asyh); -if (asyh->set.mode ) head->func->mode (head, asyh); -if (asyh->set.core ) head->func->core_set (head, asyh);if (asyh->set.olut ) { asyh->olut.offset = nv50_lut_load(&head->olut, asyh->olut.buffer,
@@ -62,6 +59,14 @@ nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh) asyh->olut.load); head->func->olut_set (head, asyh); } +} + +void +nv50_head_flush_set (struct nv50_head *head,struct nv50_head_atom *asyh) +{ +if (asyh->set.view ) head->func->view (head, asyh); +if (asyh->set.mode ) head->func->mode (head, asyh); +if (asyh->set.core ) head->func->core_set (head, asyh);if (asyh->set.curs ) head->func->curs_set (head, asyh);if (asyh->set.base ) head->func->base (head, asyh);if (asyh->set.ovly ) head->func->ovly (head, asyh);
drivers/gpu/drm/nouveau/dispnv50/head.h +1 -0
@@ -21,6 +21,7 @@ struct nv50_head {struct nv50_head *nv50_head_create (struct drm_device *,int index);void nv50_head_flush_set (struct nv50_head *head,struct nv50_head_atom *asyh); +void nv50_head_flush_set_wndw (struct nv50_head *head,struct nv50_head_atom *asyh);void nv50_head_flush_clr (struct nv50_head *head,struct nv50_head_atom *asyh,bool flush);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 95/113 platform/x86: gigabyte-wmi: add support for B450M S2H V2
In reply to Greg Kroah-HartmanFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit 1e35b8a7780a0c043cc5389420f069b69343f5d9 ]
Reported as working here:
https://github.com/t-8ch/linux-gigabyte-wmi-driver/issues/1#issuecomment-901207693
--- drivers/platform/x86/gigabyte-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/gigabyte-wmi.c +1 -0
@@ -140,6 +140,7 @@ static u8 gigabyte_wmi_detect_sensor_usability(struct wmi_device *wdev) }}static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = { +DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B450M S2H V2" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B550 AORUS ELITE" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B550 AORUS ELITE V2" ),DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME ("B550 GAMING X V2" ),
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 96/113 net/rds: dma_map_sg is entitled to merge entries
In reply to Greg Kroah-HartmanFrom: Gerd Rausch <[email protected]>
[ Upstream commit fb4b1373dcab086d0619c29310f0466a0b2ceb8a ]
Function "dma_map_sg" is entitled to merge adjacent entries and return a value smaller than what was passed as "nents".
Subsequently "ib_map_mr_sg" needs to work with this value ("sg_dma_len") rather than the original "nents" parameter ("sg_len").
This old RDS bug was exposed and reliably causes kernel panics (using RDMA operations "rds-stress -D") on x86_64 starting with:
commit c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")
Simply put: Linux 5.11 and later.
--- net/rds/ib_frmr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/rds/ib_frmr.c +2 -2
@@ -131,9 +131,9 @@ static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr)cpu_relax (); } - ret =ib_map_mr_sg_zbva (frmr->mr, ibmr->sg, ibmr->sg_len, + ret =ib_map_mr_sg_zbva (frmr->mr, ibmr->sg, ibmr->sg_dma_len, &off,PAGE_SIZE ); -if (unlikely (ret != ibmr->sg_len)) +if (unlikely (ret != ibmr->sg_dma_len))return ret <0 ? ret : -EINVAL ; if (cmpxchg(&frmr->fr_state,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 97/113 arm64: initialize all of CNTHCTL_EL2
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit bde8fff82e4a4b0f000dbf4d5eadab2079be0b56 ]
In __init_el2_timers we initialize CNTHCTL_EL2.{EL1PCEN,EL1PCTEN} with a RMW sequence, leaving all other bits UNKNOWN.
In general, we should initialize all bits in a register rather than using an RMW sequence, since most bits are UNKNOWN out of reset, and as new bits are added to the reigster their reset value might not result in expected behaviour.
In the case of CNTHCTL_EL2, FEAT_ECV added a number of new control bits in previously RES0 bits, which reset to UNKNOWN values, and may cause issues for EL1 and EL0:
* CNTHCTL_EL2.ECV enables the CNTPOFF_EL2 offset (which itself resets to an UNKNOWN value) at EL0 and EL1. Since the offset could reset to distinct values across CPUs, when the control bit resets to 1 this could break timekeeping generally.
* CNTHCTL_EL2.{EL1TVT,EL1TVCT} trap EL0 and EL1 accesses to the EL1 virtual timer/counter registers to EL2. When reset to 1, this could cause unexpected traps to EL2.
Initializing these bits to zero avoids these problems, and all other bits in CNTHCTL_EL2 other than EL1PCEN and EL1PCTEN can safely be reset to zero.
This patch ensures we initialize CNTHCTL_EL2 accordingly, only setting EL1PCEN and EL1PCTEN, and setting all other bits to zero.
--- arch/arm64/include/asm/el2_setup.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/include/asm/el2_setup.h +1 -2
@@ -33,8 +33,7 @@* EL2. */ .macro __init_el2_timers -mrs x0, cnthctl_el2 - orr x0, x0, #3 // Enable EL1 physical timers + mov x0, #3 // Enable EL1 physical timersmsr cnthctl_el2, x0 msr cntvoff_el2, xzr // Clear virtual offset .endm
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 98/113 pipe: avoid unnecessary EPOLLET wakeups under normal loads
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit 3b844826b6c6affa80755254da322b017358a2f4 upstream.
I had forgotten just how sensitive hackbench is to extra pipe wakeups, and commit 3a34b13a88ca ("pipe: make pipe writes always wake up readers") ended up causing a quite noticeable regression on larger machines.
Now, hackbench isn't necessarily a hugely meaningful benchmark, and it's not clear that this matters in real life all that much, but as Mel points out, it's used often enough when comparing kernels and so the performance regression shows up like a sore thumb.
It's easy enough to fix at least for the common cases where pipes are used purely for data transfer, and you never have any exciting poll usage at all. So set a special 'poll_usage' flag when there is polling activity, and make the ugly "EPOLLET has crazy legacy expectations" semantics explicit to only that case.
I would love to limit it to just the broken EPOLLET case, but the pipe code can't see the difference between epoll and regular select/poll, so any non-read/write waiting will trigger the extra wakeup behavior. That is sufficient for at least the hackbench case.
Apart from making the odd extra wakeup cases more explicitly about EPOLLET, this also makes the extra wakeup be at the _end_ of the pipe write, not at the first write chunk. That is actually much saner semantics (as much as you can call any of the legacy edge-triggered expectations for EPOLLET "sane") since it means that you know the wakeup will happen once the write is done, rather than possibly in the middle of one.
[ For stable people: I'm putting a "Fixes" tag on this, but I leave it
up to you to decide whether you actually want to backport it or not. It likely has no impact outside of synthetic benchmarks - Linus ]
--- fs/pipe.c | 15 +++++++++------ include/linux/pipe_fs_i.h | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-)
fs/pipe.c +9 -6
@@ -444,9 +444,6 @@ pipe_write(struct kiocb *iocb, struct io#endif /* -* Epoll nonsensically wants a wakeup whether the pipe -* was already empty or not. -* * If it wasn't empty we try to merge new data into * the last buffer. *
@@ -455,9 +452,9 @@ pipe_write(struct kiocb *iocb, struct io* spanning multiple pages. */ head = pipe->head; - was_empty = true; + was_empty =pipe_empty (head, pipe->tail); chars = total_len & (PAGE_SIZE -1 ); -if (chars && !pipe_empty (head, pipe->tail)) { +if (chars && !was_empty) {unsigned int mask = pipe->ring_size -1 ;struct pipe_buffer *buf = &pipe->bufs[(head -1 ) & mask];int offset = buf->offset + buf->len;
@@ -590,8 +587,11 @@ out:* This is particularly important for small writes, because of * how (for example) the GNU make jobserver uses small writes to * wake up pending jobs +* +* Epoll nonsensically wants a wakeup whether the pipe +* was already empty or not. */ -if (was_empty) { +if (was_empty || pipe->poll_usage) {wake_up_interruptible_sync_poll (&pipe->rd_wait,EPOLLIN |EPOLLRDNORM );kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN ); }
@@ -654,6 +654,9 @@ pipe_poll(struct file *filp, poll_tablestruct pipe_inode_info *pipe = filp->private_data;unsigned int head, tail; +/* Epoll has some historical nasty semantics, this enables them */ + pipe->poll_usage =1 ; +/* * Reading pipe state only -- no need for acquiring the semaphore. *
include/linux/pipe_fs_i.h +2 -0
@@ -48,6 +48,7 @@ struct pipe_buffer {* @files: number of struct file referring this pipe (protected by ->i_lock) * @r_counter: reader counter * @w_counter: writer counter +* @poll_usage: is this pipe used for epoll, which has crazy wakeups? * @fasync_readers: reader side fasync * @fasync_writers: writer side fasync * @bufs: the circular array of pipe buffers
@@ -70,6 +71,7 @@ struct pipe_inode_info {unsigned int files;unsigned int r_counter;unsigned int w_counter; +unsigned int poll_usage;struct page *tmp_page;struct fasync_struct *fasync_readers;struct fasync_struct *fasync_writers;
Greg Kroah-Hartman
maintainerPATCH 99/113 pipe: do FASYNC notifications for every pipe IO, not just state changes
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit fe67f4dd8daa252eb9aa7acb61555f3cc3c1ce4c upstream.
It turns out that the SIGIO/FASYNC situation is almost exactly the same as the EPOLLET case was: user space really wants to be notified after every operation.
Now, in a perfect world it should be sufficient to only notify user space on "state transitions" when the IO state changes (ie when a pipe goes from unreadable to readable, or from unwritable to writable). User space should then do as much as possible - fully emptying the buffer or what not - and we'll notify it again the next time the state changes.
But as with EPOLLET, we have at least one case (stress-ng) where the kernel sent SIGIO due to the pipe being marked for asynchronous notification, but the user space signal handler then didn't actually necessarily read it all before returning (it read more than what was written, but since there could be multiple writes, it could leave data pending).
The user space code then expected to get another SIGIO for subsequent writes - even though the pipe had been readable the whole time - and would only then read more.
This is arguably a user space bug - and Colin King already fixed the stress-ng code in question - but the kernel regression rules are clear:
it doesn't matter if kernel people think that user space did something silly and wrong. What matters is that it used to work.
So if user space depends on specific historical kernel behavior, it's a regression when that behavior changes. It's on us: we were silly to have that non-optimal historical behavior, and our old kernel behavior was what user space was tested against.
Because of how the FASYNC notification was tied to wakeup behavior, this was first broken by commits f467a6a66419 and 1b6b26ae7053 ("pipe: fix and clarify pipe read/write wakeup logic"), but at the time it seems nobody noticed. Probably because the stress-ng problem case ends up being timing-dependent too.
It was then unwittingly fixed by commit 3a34b13a88ca ("pipe: make pipe writes always wake up readers") only to be broken again when by commit 3b844826b6c6 ("pipe: avoid unnecessary EPOLLET wakeups under normal loads").
And at that point the kernel test robot noticed the performance refression in the stress-ng.sigio.ops_per_sec case. So the "Fixes" tag below is somewhat ad hoc, but it matches when the issue was noticed.
Fix it for good (knock wood) by simply making the kill_fasync() case separate from the wakeup case. FASYNC is quite rare, and we clearly shouldn't even try to use the "avoid unnecessary wakeups" logic for it.
--- fs/pipe.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
fs/pipe.c +8 -12
@@ -363,10 +363,9 @@ pipe_read(struct kiocb *iocb, struct iov* _very_ unlikely case that the pipe was full, but we got * no data. */ -if (unlikely (was_full)) { +if (unlikely (was_full))wake_up_interruptible_sync_poll (&pipe->wr_wait,EPOLLOUT |EPOLLWRNORM ); -kill_fasync (&pipe->fasync_writers,SIGIO ,POLL_OUT ); - } +kill_fasync (&pipe->fasync_writers,SIGIO ,POLL_OUT );/* * But because we didn't read anything, at this point we can
@@ -385,12 +384,11 @@ pipe_read(struct kiocb *iocb, struct iov wake_next_reader = false;__pipe_unlock (pipe); -if (was_full) { +if (was_full)wake_up_interruptible_sync_poll (&pipe->wr_wait,EPOLLOUT |EPOLLWRNORM ); -kill_fasync (&pipe->fasync_writers,SIGIO ,POLL_OUT ); - }if (wake_next_reader)wake_up_interruptible_sync_poll (&pipe->rd_wait,EPOLLIN |EPOLLRDNORM ); +kill_fasync (&pipe->fasync_writers,SIGIO ,POLL_OUT );if (ret >0 )file_accessed (filp);return ret;
@@ -565,10 +563,9 @@ pipe_write(struct kiocb *iocb, struct io* become empty while we dropped the lock. */ __pipe_unlock (pipe); -if (was_empty) { +if (was_empty)wake_up_interruptible_sync_poll (&pipe->rd_wait,EPOLLIN |EPOLLRDNORM ); -kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN ); - } +kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN );wait_event_interruptible_exclusive (pipe->wr_wait,pipe_writable (pipe));__pipe_lock (pipe); was_empty =pipe_empty (pipe->head, pipe->tail);
@@ -591,10 +588,9 @@ out:* Epoll nonsensically wants a wakeup whether the pipe * was already empty or not. */ -if (was_empty || pipe->poll_usage) { +if (was_empty || pipe->poll_usage)wake_up_interruptible_sync_poll (&pipe->rd_wait,EPOLLIN |EPOLLRDNORM ); -kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN ); - } +kill_fasync (&pipe->fasync_readers,SIGIO ,POLL_IN );if (wake_next_writer)wake_up_interruptible_sync_poll (&pipe->wr_wait,EPOLLOUT |EPOLLWRNORM );if (ret >0 &&sb_start_write_trylock (file_inode (filp)->i_sb)) {
Greg Kroah-Hartman
maintainerPATCH 100/113 tipc: call tipc_wait_for_connect only when dlen is not 0
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
commit 7387a72c5f84f0dfb57618f9e4770672c0d2e4c9 upstream.
__tipc_sendmsg() is called to send SYN packet by either tipc_sendmsg() or tipc_connect(). The difference is in tipc_connect(), it will call tipc_wait_for_connect() after __tipc_sendmsg() to wait until connecting is done. So there's no need to wait in __tipc_sendmsg() for this case.
This patch is to fix it by calling tipc_wait_for_connect() only when dlen is not 0 in __tipc_sendmsg(), which means it's called by tipc_connect().
Note this also fixes the failure in tipcutils/test/ptts/:
# ./tipcTS &
# ./tipcTC 9
(hang)
--- net/tipc/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/socket.c +1 -1
@@ -1528,7 +1528,7 @@ static int __tipc_sendmsg(struct socketif (unlikely (syn && !rc)) {tipc_set_sk_state (sk,TIPC_CONNECTING ); -if (timeout) { +if (dlen && timeout) { timeout =msecs_to_jiffies (timeout);tipc_wait_for_connect (sock, &timeout); }
Greg Kroah-Hartman
maintainerPATCH 101/113 vt_kdsetmode: extend console locking
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
commit 2287a51ba822384834dafc1c798453375d1107c7 upstream.
As per the long-suffering comment.
--- drivers/tty/vt/vt_ioctl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/tty/vt/vt_ioctl.c +6 -4
@@ -246,6 +246,8 @@ int vt_waitactive(int n)* * XXX It should at least call into the driver, fbdev's definitely need to * restore their engine state. --BenH +* +* Called with the console lock held. */ static int vt_kdsetmode (struct vc_data *vc,unsigned long mode) {
@@ -262,7 +264,6 @@ static int vt_kdsetmode(struct vc_data *return -EINVAL ; } -/* FIXME: this needs the console lock extending */ if (vc->vc_mode == mode)return 0 ;
@@ -271,12 +272,10 @@ static int vt_kdsetmode(struct vc_data *return 0 ;/* explicitly blank/unblank the screen if switching modes */ -console_lock ();if (mode ==KD_TEXT )do_unblank_screen (1 );else do_blank_screen (1 ); -console_unlock ();return 0 ; }
@@ -378,7 +377,10 @@ static int vt_k_ioctl(struct tty_structif (!perm)return -EPERM ; -return vt_kdsetmode (vc, arg); +console_lock (); + ret =vt_kdsetmode (vc, arg); +console_unlock (); +return ret;case KDGETMODE :return put_user (vc->vc_mode, (int __user *)arg);
Greg Kroah-Hartman
maintainerPATCH 102/113 Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS
In reply to Greg Kroah-HartmanFrom: Pauli Virtanen <[email protected]>
commit 55981d3541812234e687062926ff199c83f79a39 upstream.
Some USB BT adapters don't satisfy the MTU requirement mentioned in commit e848dbd364ac ("Bluetooth: btusb: Add support USB ALT 3 for WBS") and have ALT 3 setting that produces no/garbled audio. Some adapters with larger MTU were also reported to have problems with ALT 3.
Add a flag and check it and MTU before selecting ALT 3, falling back to ALT 1. Enable the flag for Realtek, restoring the previous behavior for non-Realtek devices.
Tested with USB adapters (mtu<72, no/garbled sound with ALT3, ALT1 works) BCM20702A1 0b05:17cb, CSR8510A10 0a12:0001, and (mtu>=72, ALT3 works) RTL8761BU 0bda:8771, Intel AX200 8087:0029 (after disabling ALT6). Also got reports for (mtu>=72, ALT 3 reported to produce bad audio) Intel 8087:0a2b.
--- drivers/bluetooth/btusb.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/bluetooth/btusb.c +14 -8
@@ -516,6 +516,7 @@ static const struct dmi_system_id btusb_#define BTUSB_HW_RESET_ACTIVE 12#define BTUSB_TX_WAIT_VND_EVT 13#define BTUSB_WAKEUP_DISABLE 14 +#define BTUSB_USE_ALT3_FOR_WBS 15struct btusb_data {struct hci_dev *hdev;
@@ -1748,16 +1749,20 @@ static void btusb_work(struct work_struc/* Bluetooth USB spec recommends alt 6 (63 bytes), but * many adapters do not support it. Alt 1 appears to * work for all adapters that do not have alt 6, and -* which work with WBS at all. +* which work with WBS at all. Some devices prefer +* alt 3 (HCI payload >= 60 Bytes let air packet +* data satisfy 60 bytes), requiring +* MTU >= 3 (packets) * 25 (size) - 3 (headers) = 72 +* see also Core spec 5, vol 4, B 2.1.1 & Table 2.1. */ - new_alts =btusb_find_altsetting (data,6 ) ?6 :1 ; -/* Because mSBC frames do not need to be aligned to the -* SCO packet boundary. If support the Alt 3, use the -* Alt 3 for HCI payload >= 60 Bytes let air packet -* data satisfy 60 bytes. -*/ -if (new_alts ==1 &&btusb_find_altsetting (data,3 )) +if (btusb_find_altsetting (data,6 )) + new_alts =6 ; +else if (btusb_find_altsetting (data,3 ) && + hdev->sco_mtu >=72 && +test_bit (BTUSB_USE_ALT3_FOR_WBS , &data->flags)) new_alts =3 ; +else + new_alts =1 ; }if (btusb_switch_alt_setting (hdev, new_alts) <0 )
@@ -4733,6 +4738,7 @@ static int btusb_probe(struct usb_interf* (DEVICE_REMOTE_WAKEUP) */ set_bit (BTUSB_WAKEUP_DISABLE , &data->flags); +set_bit (BTUSB_USE_ALT3_FOR_WBS , &data->flags); }if (!reset)
Greg Kroah-Hartman
maintainerPATCH 103/113 net: dsa: mt7530: fix VLAN traffic leaks again
In reply to Greg Kroah-HartmanFrom: DENG Qingfang <[email protected]>
commit 7428022b50d0fbb4846dd0f00639ea09d36dff02 upstream.
When a port leaves a VLAN-aware bridge, the current code does not clear other ports' matrix field bit. If the bridge is later set to VLAN-unaware mode, traffic in the bridge may leak to that port.
Remove the VLAN filtering check in mt7530_port_bridge_leave.
--- drivers/net/dsa/mt7530.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/dsa/mt7530.c +1 -4
@@ -1295,11 +1295,8 @@ mt7530_port_bridge_leave(struct dsa_swit/* Remove this port from the port matrix of the other ports * in the same bridge. If the port is disabled, port matrix * is kept and not being setup until the port becomes enabled. -* And the other port's port matrix cannot be broken when the -* other port is still a VLAN-aware port. */ -if (dsa_is_user_port (ds, i) && i != port && - !dsa_port_is_vlan_filtering (dsa_to_port (ds, i))) { +if (dsa_is_user_port (ds, i) && i != port) {if (dsa_to_port (ds, i)->bridge_dev != bridge)continue ;if (priv->ports[i].enable)
Greg Kroah-Hartman
maintainerPATCH 104/113 arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
In reply to Greg Kroah-HartmanFrom: Petr Vorel <[email protected]>
commit f890f89d9a80fffbfa7ca791b78927e5b8aba869 upstream.
Reserve GPIO pins 85-88 as these aren't meant to be accessible from the application CPUs (causes reboot). Yet another fix similar to 9134586715e3, 5f8d3ab136d0, which is needed to allow angler to boot after 3edfb7bd76bd ("gpiolib: Show correct direction from the beginning").
--- arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +4 -0
@@ -36,3 +36,7 @@ }; }; }; + +&tlmm { + gpio-reserved-ranges = <85 4>; +};
Greg Kroah-Hartman
maintainerPATCH 105/113 btrfs: fix NULL pointer dereference when deleting device by invalid id
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit e4571b8c5e9ffa1e85c0c671995bd4dcc5c75091 upstream.
[BUG]
It's easy to trigger NULL pointer dereference, just by removing a non-existing device id:
# mkfs.btrfs -f -m single -d single /dev/test/scratch1 \ /dev/test/scratch2 # mount /dev/test/scratch1 /mnt/btrfs # btrfs device remove 3 /mnt/btrfs
Then we have the following kernel NULL pointer dereference:
BUG: kernel NULL pointer dereference, address: 0000000000000000 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 9 PID: 649 Comm: btrfs Not tainted 5.14.0-rc3-custom+ #35 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:btrfs_rm_device+0x4de/0x6b0 [btrfs] btrfs_ioctl+0x18bb/0x3190 [btrfs] ? lock_is_held_type+0xa5/0x120 ? find_held_lock.constprop.0+0x2b/0x80 ? do_user_addr_fault+0x201/0x6a0 ? lock_release+0xd2/0x2d0 ? __x64_sys_ioctl+0x83/0xb0 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
[CAUSE]
Commit a27a94c2b0c7 ("btrfs: Make btrfs_find_device_by_devspec return btrfs_device directly") moves the "missing" device path check into btrfs_rm_device().
But btrfs_rm_device() itself can have case where it only receives @devid, with NULL as @device_path.
In that case, calling strcmp() on NULL will trigger the NULL pointer dereference.
Before that commit, we handle the "missing" case inside btrfs_find_device_by_devspec(), which will not check @device_path at all if @devid is provided, thus no way to trigger the bug.
[FIX]
Before calling strcmp(), also make sure @device_path is not NULL.
--- fs/btrfs/volumes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/volumes.c +1 -1
@@ -2137,7 +2137,7 @@ int btrfs_rm_device(struct btrfs_fs_infoif (IS_ERR (device)) {if (PTR_ERR (device) == -ENOENT && -strcmp (device_path,"missing" ) ==0 ) + device_path &&strcmp (device_path,"missing" ) ==0 ) ret =BTRFS_ERROR_DEV_MISSING_NOT_FOUND ;else ret =PTR_ERR (device);
Greg Kroah-Hartman
maintainerPATCH 106/113 Revert "floppy: reintroduce O_NDELAY fix"
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
commit c7e9d0020361f4308a70cdfd6d5335e273eb8717 upstream.
The patch breaks userspace implementations (e.g. fdutils) and introduces regressions in behaviour. Previously, it was possible to O_NDELAY open a floppy device with no media inserted or with write protected media without an error. Some userspace tools use this particular behavior for probing.
It's not the first time when we revert this patch. Previous revert is in commit f2791e7eadf4 (Revert "floppy: refactor open() flags handling").
This reverts commit 8a0c014cd20516ade9654fc13b51345ec58e7be8.
--- drivers/block/floppy.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/block/floppy.c +15 -15
@@ -4029,23 +4029,23 @@ static int floppy_open(struct block_deviif (fdc_state[FDC (drive)].rawcmd ==1 ) fdc_state[FDC (drive)].rawcmd =2 ; -if (mode & (FMODE_READ |FMODE_WRITE )) { - drive_state[drive].last_checked =0 ; -clear_bit (FD_OPEN_SHOULD_FAIL_BIT , &drive_state[drive].flags); -if (bdev_check_media_change (bdev)) -floppy_revalidate (bdev->bd_disk); -if (test_bit (FD_DISK_CHANGED_BIT , &drive_state[drive].flags)) - goto out; -if (test_bit (FD_OPEN_SHOULD_FAIL_BIT , &drive_state[drive].flags)) +if (!(mode &FMODE_NDELAY )) { +if (mode & (FMODE_READ |FMODE_WRITE )) { + drive_state[drive].last_checked =0 ; +clear_bit (FD_OPEN_SHOULD_FAIL_BIT , + &drive_state[drive].flags); +if (bdev_check_media_change (bdev)) +floppy_revalidate (bdev->bd_disk); +if (test_bit (FD_DISK_CHANGED_BIT , &drive_state[drive].flags)) + goto out; +if (test_bit (FD_OPEN_SHOULD_FAIL_BIT , &drive_state[drive].flags)) + goto out; + } + res = -EROFS ; +if ((mode &FMODE_WRITE ) && + !test_bit (FD_DISK_WRITABLE_BIT , &drive_state[drive].flags)) goto out; } - - res = -EROFS ; - -if ((mode &FMODE_WRITE ) && - !test_bit (FD_DISK_WRITABLE_BIT , &drive_state[drive].flags)) - goto out; -mutex_unlock (&open_lock);mutex_unlock (&floppy_mutex);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 107/113 fscrypt: add fscrypt_symlink_getattr() for computing st_size
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit d18760560593e5af921f51a8c9b64b6109d634c2 upstream.
Add a helper function fscrypt_symlink_getattr() which will be called from the various filesystems' ->getattr() methods to read and decrypt the target of encrypted symlinks in order to report the correct st_size.
Detailed explanation:
As required by POSIX and as documented in various man pages, st_size for a symlink is supposed to be the length of the symlink target. Unfortunately, st_size has always been wrong for encrypted symlinks because st_size is populated from i_size from disk, which intentionally contains the length of the encrypted symlink target. That's slightly greater than the length of the decrypted symlink target (which is the symlink target that userspace usually sees), and usually won't match the length of the no-key encoded symlink target either.
This hadn't been fixed yet because reporting the correct st_size would require reading the symlink target from disk and decrypting or encoding it, which historically has been considered too heavyweight to do in ->getattr(). Also historically, the wrong st_size had only broken a test (LTP lstat03) and there were no known complaints from real users. (This is probably because the st_size of symlinks isn't used too often, and when it is, typically it's for a hint for what buffer size to pass to readlink() -- which a slightly-too-large size still works for.)
However, a couple things have changed now. First, there have recently been complaints about the current behavior from real users:
- Breakage in rpmbuild:
https://github.com/rpm-software-management/rpm/issues/1682
https://github.com/google/fscrypt/issues/305
- Breakage in toybox cpio:
https://www.mail-archive.com/[email protected]/msg07193.html
- Breakage in libgit2: https://issuetracker.google.com/issues/189629152
(on Android public issue tracker, requires login)
Second, we now cache decrypted symlink targets in ->i_link. Therefore, taking the performance hit of reading and decrypting the symlink target in ->getattr() wouldn't be as big a deal as it used to be, since usually it will just save having to do the same thing later.
Also note that eCryptfs ended up having to read and decrypt symlink targets in ->getattr() as well, to fix this same issue; see commit 3a60a1686f0d ("eCryptfs: Decrypt symlink target for stat size").
So, let's just bite the bullet, and read and decrypt the symlink target in ->getattr() in order to report the correct st_size. Add a function fscrypt_symlink_getattr() which the filesystems will call to do this.
(Alternatively, we could store the decrypted size of symlinks on-disk. But there isn't a great place to do so, and encryption is meant to hide the original size to some extent; that property would be lost.)
--- fs/crypto/hooks.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ include/linux/fscrypt.h | 7 +++++++ 2 files changed, 51 insertions(+)
fs/crypto/hooks.c +44 -0
@@ -384,3 +384,47 @@ err_kfree:return ERR_PTR (err); }EXPORT_SYMBOL_GPL (fscrypt_get_symlink); + +/** +* fscrypt_symlink_getattr() - set the correct st_size for encrypted symlinks +* @path: the path for the encrypted symlink being queried +* @stat: the struct being filled with the symlink's attributes +* +* Override st_size of encrypted symlinks to be the length of the decrypted +* symlink target (or the no-key encoded symlink target, if the key is +* unavailable) rather than the length of the encrypted symlink target. This is +* necessary for st_size to match the symlink target that userspace actually +* sees. POSIX requires this, and some userspace programs depend on it. +* +* This requires reading the symlink target from disk if needed, setting up the +* inode's encryption key if possible, and then decrypting or encoding the +* symlink target. This makes lstat() more heavyweight than is normally the +* case. However, decrypted symlink targets will be cached in ->i_link, so +* usually the symlink won't have to be read and decrypted again later if/when +* it is actually followed, readlink() is called, or lstat() is called again. +* +* Return: 0 on success, -errno on failure +*/ +int fscrypt_symlink_getattr (const struct path *path,struct kstat *stat) +{ +struct dentry *dentry = path->dentry; +struct inode *inode =d_inode (dentry); +const char *link; +DEFINE_DELAYED_CALL (done); + +/* +* To get the symlink target that userspace will see (whether it's the +* decrypted target or the no-key encoded target), we can just get it in +* the same way the VFS does during path resolution and readlink(). +*/ + link =READ_ONCE (inode->i_link); +if (!link) { + link = inode->i_op->get_link (dentry, inode, &done); +if (IS_ERR (link)) +return PTR_ERR (link); + } + stat->size =strlen (link); +do_delayed_call (&done); +return 0 ; +} +EXPORT_SYMBOL_GPL (fscrypt_symlink_getattr);
include/linux/fscrypt.h +7 -0
@@ -253,6 +253,7 @@ int __fscrypt_encrypt_symlink(struct inoconst char *fscrypt_get_symlink (struct inode *inode,const void *caddr,unsigned int max_size,struct delayed_call *done); +int fscrypt_symlink_getattr (const struct path *path,struct kstat *stat);static inline void fscrypt_set_ops (struct super_block *sb,const struct fscrypt_operations *s_cop) {
@@ -583,6 +584,12 @@ static inline const char *fscrypt_get_syreturn ERR_PTR (-EOPNOTSUPP ); } +static inline int fscrypt_symlink_getattr (const struct path *path, +struct kstat *stat) +{ +return -EOPNOTSUPP ; +} +static inline void fscrypt_set_ops (struct super_block *sb,const struct fscrypt_operations *s_cop) {
Greg Kroah-Hartman
maintainerPATCH 108/113 ext4: report correct st_size for encrypted symlinks
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 8c4bca10ceafc43b1ca0a9fab5fa27e13cbce99e upstream.
The stat() family of syscalls report the wrong size for encrypted symlinks, which has caused breakage in several userspace programs.
Fix this by calling fscrypt_symlink_getattr() after ext4_getattr() for encrypted symlinks. This function computes the correct size by reading and decrypting the symlink target (if it's not already cached).
For more details, see the commit which added fscrypt_symlink_getattr().
--- fs/ext4/symlink.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/ext4/symlink.c +11 -1
@@ -52,10 +52,20 @@ static const char *ext4_encrypted_get_lireturn paddr; } +static int ext4_encrypted_symlink_getattr (struct user_namespace *mnt_userns, +const struct path *path, +struct kstat *stat,u32 request_mask, +unsigned int query_flags) +{ +ext4_getattr (mnt_userns, path, stat, request_mask, query_flags); + +return fscrypt_symlink_getattr (path, stat); +} +const struct inode_operations ext4_encrypted_symlink_inode_operations = { .get_link = ext4_encrypted_get_link, .setattr = ext4_setattr, - .getattr = ext4_getattr, + .getattr = ext4_encrypted_symlink_getattr, .listxattr = ext4_listxattr, };
Greg Kroah-Hartman
maintainerPATCH 109/113 f2fs: report correct st_size for encrypted symlinks
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 461b43a8f92e68e96c4424b31e15f2b35f1bbfa9 upstream.
The stat() family of syscalls report the wrong size for encrypted symlinks, which has caused breakage in several userspace programs.
Fix this by calling fscrypt_symlink_getattr() after f2fs_getattr() for encrypted symlinks. This function computes the correct size by reading and decrypting the symlink target (if it's not already cached).
For more details, see the commit which added fscrypt_symlink_getattr().
--- fs/f2fs/namei.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/f2fs/namei.c +11 -1
@@ -1313,9 +1313,19 @@ static const char *f2fs_encrypted_get_lireturn target; } +static int f2fs_encrypted_symlink_getattr (struct user_namespace *mnt_userns, +const struct path *path, +struct kstat *stat,u32 request_mask, +unsigned int query_flags) +{ +f2fs_getattr (mnt_userns, path, stat, request_mask, query_flags); + +return fscrypt_symlink_getattr (path, stat); +} +const struct inode_operations f2fs_encrypted_symlink_inode_operations = { .get_link = f2fs_encrypted_get_link, - .getattr = f2fs_getattr, + .getattr = f2fs_encrypted_symlink_getattr, .setattr = f2fs_setattr, .listxattr = f2fs_listxattr, };
Greg Kroah-Hartman
maintainerPATCH 110/113 ubifs: report correct st_size for encrypted symlinks
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 064c734986011390b4d111f1a99372b7f26c3850 upstream.
The stat() family of syscalls report the wrong size for encrypted symlinks, which has caused breakage in several userspace programs.
Fix this by calling fscrypt_symlink_getattr() after ubifs_getattr() for encrypted symlinks. This function computes the correct size by reading and decrypting the symlink target (if it's not already cached).
For more details, see the commit which added fscrypt_symlink_getattr().
--- fs/ubifs/file.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/ubifs/file.c +12 -1
@@ -1630,6 +1630,17 @@ static const char *ubifs_get_link(structreturn fscrypt_get_symlink (inode, ui->data, ui->data_len, done); } +static int ubifs_symlink_getattr (struct user_namespace *mnt_userns, +const struct path *path,struct kstat *stat, +u32 request_mask,unsigned int query_flags) +{ +ubifs_getattr (mnt_userns, path, stat, request_mask, query_flags); + +if (IS_ENCRYPTED (d_inode (path->dentry))) +return fscrypt_symlink_getattr (path, stat); +return 0 ; +} +const struct address_space_operations ubifs_file_address_operations = { .readpage = ubifs_readpage, .writepage = ubifs_writepage,
@@ -1655,7 +1666,7 @@ const struct inode_operations ubifs_fileconst struct inode_operations ubifs_symlink_inode_operations = { .get_link = ubifs_get_link, .setattr = ubifs_setattr, - .getattr = ubifs_getattr, + .getattr = ubifs_symlink_getattr, .listxattr = ubifs_listxattr, .update_time = ubifs_update_time, };
Greg Kroah-Hartman
maintainerPATCH 111/113 Revert "parisc: Add assembly implementations for memset, strlen, strcpy, strncpy and strcat"
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit f6a3308d6feb351d9854eb8b3f6289a1ac163125 upstream.
This reverts commit 83af58f8068ea3f7b3c537c37a30887bfa585069.
It turns out that at least the assembly implementation for strncpy() was buggy. Revert the whole commit and return back to the default coding.
--- arch/parisc/include/asm/string.h | 15 ---- arch/parisc/kernel/parisc_ksyms.c | 4 - arch/parisc/lib/Makefile | 4 - arch/parisc/lib/memset.c | 72 ++++++++++++++++++++ arch/parisc/lib/string.S | 136 -------------------------------------- 5 files changed, 74 insertions(+), 157 deletions(-) create mode 100644 arch/parisc/lib/memset.c delete mode 100644 arch/parisc/lib/string.S
arch/parisc/include/asm/string.h +0 -15
@@ -8,19 +8,4 @@ extern void * memset(void *, int, size_t#define __HAVE_ARCH_MEMCPYvoid *memcpy (void * dest,const void *src,size_t count); -#define __HAVE_ARCH_STRLEN -extern size_t strlen (const char *s); - -#define __HAVE_ARCH_STRCPY -extern char *strcpy (char *dest,const char *src); - -#define __HAVE_ARCH_STRNCPY -extern char *strncpy (char *dest,const char *src,size_t count); - -#define __HAVE_ARCH_STRCAT -extern char *strcat (char *dest,const char *src); - -#define __HAVE_ARCH_MEMSET -extern void *memset (void *,int ,size_t ); -#endif
arch/parisc/kernel/parisc_ksyms.c +0 -4
@@ -17,10 +17,6 @@#include <linux/string.h> EXPORT_SYMBOL (memset); -EXPORT_SYMBOL (strlen); -EXPORT_SYMBOL (strcpy); -EXPORT_SYMBOL (strncpy); -EXPORT_SYMBOL (strcat);#include <linux/atomic.h> EXPORT_SYMBOL (__xchg8);
arch/parisc/lib/Makefile +2 -2
@@ -3,7 +3,7 @@ # Makefile for parisc-specific library files # -lib-y := lusercopy.o bitops.o checksum.o io.o memcpy.o \ - ucmpdi2.o delay.o string.o +lib-y := lusercopy.o bitops.o checksum.o io.o memset.o memcpy.o \ + ucmpdi2.o delay.o obj-y := iomap.o
arch/parisc/lib/memset.c new file +72 -0
72 lines not on this page · raw message
arch/parisc/lib/string.S deleted +0 -136
136 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 112/113 net: dont unconditionally copy_from_user a struct ifreq for socket ioctls
In reply to Greg Kroah-HartmanFrom: Peter Collingbourne <[email protected]>
commit d0efb16294d145d157432feda83877ae9d7cdf37 upstream.
A common implementation of isatty(3) involves calling a ioctl passing a dummy struct argument and checking whether the syscall failed -- bionic and glibc use TCGETS (passing a struct termios), and musl uses TIOCGWINSZ (passing a struct winsize). If the FD is a socket, we will copy sizeof(struct ifreq) bytes of data from the argument and return -EFAULT if that fails. The result is that the isatty implementations may return a non-POSIX-compliant value in errno in the case where part of the dummy struct argument is inaccessible, as both struct termios and struct winsize are smaller than struct ifreq (at least on arm64).
Although there is usually enough stack space following the argument on the stack that this did not present a practical problem up to now, with MTE stack instrumentation it's more likely for the copy to fail, as the memory following the struct may have a different tag.
Fix the problem by adding an early check for whether the ioctl is a valid socket ioctl, and return -ENOTTY if it isn't.
--- include/linux/netdevice.h | 4 ++++ net/socket.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-)
include/linux/netdevice.h +4 -0
@@ -4012,6 +4012,10 @@ int netdev_rx_handler_register(struct nevoid netdev_rx_handler_unregister (struct net_device *dev);bool dev_valid_name (const char *name); +static inline bool is_socket_ioctl_cmd (unsigned int cmd) +{ +return _IOC_TYPE (cmd) ==SOCK_IOC_TYPE ; +}int dev_ioctl (struct net *net,unsigned int cmd,struct ifreq *ifr,bool *need_copyout);int dev_ifconf (struct net *net,struct ifconf *,int );
net/socket.c +5 -1
@@ -1054,7 +1054,7 @@ static long sock_do_ioctl(struct net *nertnl_unlock ();if (!err &©_to_user (argp, &ifc,sizeof (struct ifconf ))) err = -EFAULT ; - }else { + }else if (is_socket_ioctl_cmd (cmd)) {struct ifreq ifr;bool need_copyout;if (copy_from_user (&ifr, argp,sizeof (struct ifreq )))
@@ -1063,6 +1063,8 @@ static long sock_do_ioctl(struct net *neif (!err && need_copyout)if (copy_to_user (argp, &ifr,sizeof (struct ifreq )))return -EFAULT ; + }else { + err = -ENOTTY ; }return err; }
@@ -3251,6 +3253,8 @@ static int compat_ifr_data_ioctl(structstruct ifreq ifreq;u32 data32; +if (!is_socket_ioctl_cmd (cmd)) +return -ENOTTY ;if (copy_from_user (ifreq.ifr_name, u_ifreq32->ifr_name,IFNAMSIZ ))return -EFAULT ;if (get_user (data32, &u_ifreq32->ifr_data))
Greg Kroah-Hartman
maintainerPATCH 113/113 audit: move put_tree() to avoid trim_trees refcount underflow and UAF
In reply to Greg Kroah-HartmanFrom: Richard Guy Briggs <[email protected]>
commit 67d69e9d1a6c889d98951c1d74b19332ce0565af upstream.
AUDIT_TRIM is expected to be idempotent, but multiple executions resulted in a refcount underflow and use-after-free.
git bisect fingered commit fb041bb7c0a9 ("locking/refcount: Consolidate
implementations of refcount_t") but this patch with its more thorough checking that wasn't in the x86 assembly code merely exposed a previously existing tree refcount imbalance in the case of tree trimming code that was refactored with prune_one() to remove a tree introduced in commit 8432c7006297 ("audit: Simplify locking around untag_chunk()")
Move the put_tree() to cover only the prune_one() case.
Passes audit-testsuite and 3 passes of "auditctl -t" with at least one directory watch.
--- kernel/audit_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/audit_tree.c +1 -1
@@ -593,7 +593,6 @@ static void prune_tree_chunks(struct audspin_lock (&hash_lock); }spin_unlock (&hash_lock); -put_tree (victim); }/*
@@ -602,6 +601,7 @@ static void prune_tree_chunks(struct audstatic void prune_one (struct audit_tree *victim) {prune_tree_chunks (victim, false); +put_tree (victim); }/* trim the uncommitted chunks from tree */
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.14 release. There are 113 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 03 Sep 2021 12:22:41 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
5.13.14-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.14 release. There are 113 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 03 Sep 2021 12:22:41 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.14 release. There are 113 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 03 Sep 2021 12:22:41 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.13:
10 builds: 10 pass, 0 fail
28 boots: 28 pass, 0 fail
110 tests: 110 pass, 0 failLinux version: 5.13.14-rc1-gd049bfc3077d
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.14 release. There are 113 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.
Quoted 9 lines
Responses should be made by Fri, 03 Sep 2021 12:22:41 +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/v5.x/stable-review/patch-5.13.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.14 release. There are 113 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 03 Sep 2021 12:22:41 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.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.
## Build
* kernel: 5.13.14-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.13.y
* git commit: d049bfc3077d9ae46a73c99a7e1db0efe01d55c0
* git describe: v5.13.13-114-gd049bfc3077d
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.13.y/build/v5.13.13-114-gd049bfc3077d
## No regressions (compared to v5.13.13-74-g5a5b2e290019)
## No fixes (compared to v5.13.13-74-g5a5b2e290019)
## Test result summary
total: 90478, pass: 75396, fail: 1134, skip: 13017, xfail: 931
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 258 total, 258 passed, 0 failed
* arm64: 36 total, 36 passed, 0 failed
* dragonboard-410c: 1 total, 1 passed, 0 failed
* hi6220-hikey: 1 total, 1 passed, 0 failed
* i386: 35 total, 35 passed, 0 failed
* juno-r2: 1 total, 1 passed, 0 failed
* mips: 51 total, 51 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 27 total, 27 passed, 0 failed
* s390: 24 total, 24 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x15: 1 total, 0 passed, 1 failed
* x86: 1 total, 1 passed, 0 failed
* x86_64: 36 total, 36 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* install-android-platform-tools-r2600
* kselftest-android
* kselftest-arm64
* kselftest-arm64/arm64.btitest.bti_c_func
* kselftest-arm64/arm64.btitest.bti_j_func
* kselftest-arm64/arm64.btitest.bti_jc_func
* kselftest-arm64/arm64.btitest.bti_none_func
* kselftest-arm64/arm64.btitest.nohint_func
* kselftest-arm64/arm64.btitest.paciasp_func
* kselftest-arm64/arm64.nobtitest.bti_c_func
* kselftest-arm64/arm64.nobtitest.bti_j_func
* kselftest-arm64/arm64.nobtitest.bti_jc_func
* kselftest-arm64/arm64.nobtitest.bti_none_func
* kselftest-arm64/arm64.nobtitest.nohint_func
* kselftest-arm64/arm64.nobtitest.paciasp_func
* kselftest-bpf
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* 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-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.14 release. There are 113 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 03 Sep 2021 12:22:41 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.14-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.13.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.13.14 release. There are 113 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 03 Sep 2021 12:22:41 +0000. Anything received after that time might be too late.
Build results:
total: 154 pass: 154 fail: 0 Qemu test results: total: 479 pass: 479 fail: 0
Guenter