mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 11:54:14 -04:00
* refs/heads/tmp-75c93eb: Revert one chunk from37432a83facommit Revert "rpmsg: glink: Use complete_all for open states" ANDROID: Incremental fs: Fix selinux issues ANDROID: Incremental fs: Set credentials before reading/writing ANDROID: Incremental fs: Fix memory leak on closing file ANDROID: GKI: update Sony KMI symbol list ANDROID: ABI updates for db845c (enabling wifi) ANDROID: db845c_gki.fragment: Enable wifi on db845c w/ android-5.4 UPSTREAM: arm64: dts: qcom: sdm845: Add APSS watchdog node UPSTREAM: arm64: dts: qcom: db845c: Move remoteproc firmware to sdm845 UPSTREAM: ath10k: qmi: Sleep for a while before assigning MSA memory UPSTREAM: soc: qcom: qmi: Return EPROBE_DEFER if no address family ANDROID: ABI: Update allowed list for QCOM ANDROID: GKI: update Sony symbol list for texfat ANDROID: GKI: update KMI for db845c with idr_alloc_u32 added ANDROID: ABI: Update allowed list for QCOM ANDROID: ABI: update allowed list for QCOM Revert "media: v4l2-fwnode: Return -EINVAL for invalid bus-type" Revert "seq_buf: Avoid type mismatch for seq_buf_init" Linux 5.4.86 x86/CPU/AMD: Save AMD NodeId as cpu_die_id Revert: "ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS" rtc: ep93xx: Fix NULL pointer dereference in ep93xx_rtc_read_time regulator: axp20x: Fix DLDO2 voltage control register mask for AXP22x PCI: Fix pci_slot_release() NULL pointer dereference platform/x86: intel-vbtn: Allow switch events on Acer Switch Alpha 12 libnvdimm/namespace: Fix reaping of invalidated block-window-namespace labels xenbus/xenbus_backend: Disallow pending watch messages xen/xenbus: Count pending messages for each watch xen/xenbus/xen_bus_type: Support will_handle watch callback xen/xenbus: Add 'will_handle' callback support in xenbus_watch_path() xen/xenbus: Allow watches discard events before queueing xen-blkback: set ring->xenblkd to NULL after kthread_stop() dma-buf/dma-resv: Respect num_fences when initializing the shared fence list. device-dax/core: Fix memory leak when rmmod dax.ko clk: tegra: Do not return 0 on failure clk: mvebu: a3700: fix the XTAL MODE pin to MPP1_9 clk: ingenic: Fix divider calculation with div tables pinctrl: sunxi: Always call chained_irq_{enter, exit} in sunxi_pinctrl_irq_handler md/cluster: fix deadlock when node is doing resync job md/cluster: block reshape with remote resync job iio:adc:ti-ads124s08: Fix alignment and data leak issues. iio:adc:ti-ads124s08: Fix buffer being too long. iio:imu:bmi160: Fix too large a buffer. iio:pressure:mpl3115: Force alignment of buffer iio:magnetometer:mag3110: Fix alignment and data leak issues. iio:light:st_uvis25: Fix timestamp alignment and prevent data leak. iio:light:rpr0521: Fix timestamp alignment and prevent data leak. iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume iio: buffer: Fix demux update scsi: lpfc: Re-fix use after free in lpfc_rq_buf_free() scsi: lpfc: Fix invalid sleeping context in lpfc_sli4_nvmet_alloc() scsi: qla2xxx: Fix crash during driver load on big endian machines mtd: rawnand: meson: fix meson_nfc_dma_buffer_release() arguments mtd: rawnand: qcom: Fix DMA sync on FLASH_STATUS register read mtd: parser: cmdline: Fix parsing of part-names with colons mtd: spinand: Fix OOB read soc: qcom: smp2p: Safely acquire spinlock without IRQs spi: atmel-quadspi: Fix AHB memory accesses spi: atmel-quadspi: Disable clock in probe error path spi: mt7621: Don't leak SPI master in probe error path spi: mt7621: Disable clock in probe error path spi: synquacer: Disable clock in probe error path spi: st-ssc4: Fix unbalanced pm_runtime_disable() in probe error path spi: sc18is602: Don't leak SPI master in probe error path spi: rb4xx: Don't leak SPI master in probe error path spi: pic32: Don't leak DMA channels in probe error path spi: mxic: Don't leak SPI master in probe error path spi: gpio: Don't leak SPI master in probe error path spi: fsl: fix use of spisel_boot signal on MPC8309 spi: davinci: Fix use-after-free on unbind spi: atmel-quadspi: Fix use-after-free on unbind spi: spi-sh: Fix use-after-free on unbind spi: pxa2xx: Fix use-after-free on unbind drm/i915: Fix mismatch between misplaced vma check and vma insert drm/dp_aux_dev: check aux_dev before use in drm_dp_aux_dev_get_by_minor() drm/amd/display: Fix memory leaks in S3 resume platform/x86: mlx-platform: remove an unused variable jfs: Fix array index bounds check in dbAdjTree jffs2: Fix ignoring mounting options problem during remounting jffs2: Fix GC exit abnormally ubifs: wbuf: Don't leak kernel memory to flash SMB3: avoid confusing warning message on mount to Azure ceph: fix race in concurrent __ceph_remove_cap invocations um: Remove use of asprinf in umid.c ima: Don't modify file descriptor mode on the fly powerpc/powernv/memtrace: Fix crashing the kernel when enabling concurrently powerpc/powernv/memtrace: Don't leak kernel memory to user space powerpc/powernv/npu: Do not attempt NPU2 setup on POWER8NVL NPU powerpc/mm: Fix verification of MMU_FTR_TYPE_44x powerpc/8xx: Fix early debug when SMC1 is relocated powerpc/xmon: Change printk() to pr_cont() powerpc/feature: Add CPU_FTR_NOEXECUTE to G2_LE powerpc/rtas: Fix typo of ibm,open-errinjct in RTAS filter powerpc: Fix incorrect stw{, ux, u, x} instructions in __set_pte_at xprtrdma: Fix XDRBUF_SPARSE_PAGES support ARM: dts: at91: sama5d2: fix CAN message ram offset and size ARM: dts: pandaboard: fix pinmux for gpio user button of Pandaboard ES KVM: arm64: Introduce handling of AArch32 TTBCR2 traps ext4: fix deadlock with fs freezing and EA inodes ext4: fix a memory leak of ext4_free_data btrfs: trim: fix underflow in trim length to prevent access beyond device boundary btrfs: do not shorten unpin len for caching block groups USB: serial: keyspan_pda: fix write unthrottling USB: serial: keyspan_pda: fix tx-unthrottle use-after-free USB: serial: keyspan_pda: fix write-wakeup use-after-free USB: serial: keyspan_pda: fix stalled writes USB: serial: keyspan_pda: fix write deadlock USB: serial: keyspan_pda: fix dropped unthrottle interrupts USB: serial: digi_acceleport: fix write-wakeup deadlocks USB: serial: mos7720: fix parallel-port state restore cpuset: fix race between hotplug work and later CPU offline EDAC/amd64: Fix PCI component registration EDAC/i10nm: Use readl() to access MMIO registers crypto: arm/aes-ce - work around Cortex-A57/A72 silion errata crypto: ecdh - avoid unaligned accesses in ecdh_set_secret() powerpc/perf: Exclude kernel samples while counting events in user space. perf/x86/intel: Fix rtm_abort_event encoding on Ice Lake perf/x86/intel: Add event constraint for CYCLE_ACTIVITY.STALLS_MEM_ANY staging: comedi: mf6x4: Fix AI end-of-conversion detection ASoC: cx2072x: Fix doubly definitions of Playback and Capture streams binder: add flag to clear buffer on txn complete s390/dasd: fix list corruption of lcu list s390/dasd: fix list corruption of pavgroup group list s390/dasd: prevent inconsistent LCU device data s390/dasd: fix hanging device offline processing s390/kexec_file: fix diag308 subcode when loading crash kernel s390/smp: perform initial CPU reset also for SMT siblings ALSA: core: memalloc: add page alignment for iram ALSA: usb-audio: Disable sample read check if firmware doesn't give back ALSA: usb-audio: Add VID to support native DSD reproduction on FiiO devices ALSA: hda/realtek: Apply jack fixup for Quanta NL3 ALSA: hda/realtek: Add quirk for MSI-GP73 ALSA/hda: apply jack fixup for the Acer Veriton N4640G/N6640G/N2510G ALSA: pcm: oss: Fix a few more UBSAN fixes ALSA: hda/realtek - Add supported for more Lenovo ALC285 Headset Button ALSA: hda/realtek - Enable headset mic of ASUS Q524UQK with ALC255 ALSA: hda/realtek - Enable headset mic of ASUS X430UN with ALC256 ALSA: hda/realtek: make bass spk volume adjustable on a yoga laptop ALSA: hda/ca0132 - Fix AE-5 rear headphone pincfg. ALSA: hda: Fix regressions on clear and reconfig sysfs ACPI: PNP: compare the string length in the matching_id() Revert "ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks" PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() ALSA: hda/ca0132 - Change Input Source enum strings. Input: cyapa_gen6 - fix out-of-bounds stack access media: ipu3-cio2: Make the field on subdev format V4L2_FIELD_NONE media: ipu3-cio2: Validate mbus format in setting subdev format media: ipu3-cio2: Serialise access to pad format media: ipu3-cio2: Return actual subdev format media: ipu3-cio2: Remove traces of returned buffers media: netup_unidvb: Don't leak SPI master in probe error path media: sunxi-cir: ensure IR is handled when it is continuous media: gspca: Fix memory leak in probe vfio/pci/nvlink2: Do not attempt NPU2 setup on POWER8NVL NPU Input: goodix - add upside-down quirk for Teclast X98 Pro tablet initramfs: fix clang build failure Input: cros_ec_keyb - send 'scancodes' in addition to key events drm/amdkfd: Fix leak in dmabuf import drm/amd/display: Prevent bandwidth overflow lwt: Disable BH too in run_lwt_bpf() fix namespaced fscaps when !CONFIG_SECURITY cfg80211: initialize rekey_data ARM: sunxi: Add machine match for the Allwinner V3 SoC perf probe: Fix memory leak when synthesizing SDT probes kconfig: fix return value of do_error_if() clk: sunxi-ng: Make sure divider tables have sentinel clk: s2mps11: Fix a resource leak in error handling paths in the probe function clk: at91: sam9x60: remove atmel,osc-bypass support virtio_ring: Fix two use after free bugs virtio_net: Fix error code in probe() virtio_ring: Cut and paste bugs in vring_create_virtqueue_packed() qlcnic: Fix error code in probe perf record: Fix memory leak when using '--user-regs=?' to list registers pwm: lp3943: Dynamically allocate PWM chip base pwm: zx: Add missing cleanup in error path clk: ti: Fix memleak in ti_fapll_synth_setup watchdog: coh901327: add COMMON_CLK dependency watchdog: qcom: Avoid context switch in restart handler libnvdimm/label: Return -ENXIO for no slot in __blk_label_update net: korina: fix return value net: allwinner: Fix some resources leak in the error handling path of the probe and in the remove function net: bcmgenet: Fix a resource leak in an error handling path in the probe functin lan743x: fix rx_napi_poll/interrupt ping-pong checkpatch: fix unescaped left brace mm: don't wake kswapd prematurely when watermark boosting is disabled sparc: fix handling of page table constructor failure powerpc/ps3: use dma_mapping_error() nfc: s3fwrn5: Release the nfc firmware RDMA/cma: Don't overwrite sgid_attr after device is released sunrpc: fix xs_read_xdr_buf for partial pages receive um: chan_xterm: Fix fd leak um: tty: Fix handling of close in tty lines um: Monitor error events in IRQ controller ubifs: Fix error return code in ubifs_init_authentication() watchdog: Fix potential dereferencing of null pointer watchdog: sprd: check busy bit before new loading rather than after that watchdog: sprd: remove watchdog disable from resume fail path watchdog: sirfsoc: Add missing dependency on HAS_IOMEM watchdog: armada_37xx: Add missing dependency on HAS_IOMEM irqchip/alpine-msi: Fix freeing of interrupts on allocation error path ASoC: wm_adsp: remove "ctl" from list on error in wm_adsp_create_control() mac80211: don't set set TDLS STA bandwidth wider than possible crypto: atmel-i2c - select CONFIG_BITREVERSE extcon: max77693: Fix modalias string mtd: rawnand: gpmi: Fix the random DMA timeout issue mtd: rawnand: meson: Fix a resource leak in init mtd: rawnand: gpmi: fix reference count leak in gpmi ops clk: tegra: Fix duplicated SE clock entry remoteproc: qcom: Fix potential NULL dereference in adsp_init_mmio() remoteproc: qcom: fix reference leak in adsp_start remoteproc: q6v5-mss: fix error handling in q6v5_pds_enable RDMA/core: Do not indicate device ready when device enablement fails can: m_can: m_can_config_endisable(): remove double clearing of clock stop request bit erofs: avoid using generic_block_bmap iwlwifi: mvm: hook up missing RX handlers s390/cio: fix use-after-free in ccw_device_destroy_console bus: fsl-mc: fix error return code in fsl_mc_object_allocate() platform/chrome: cros_ec_spi: Don't overwrite spi::mode x86/kprobes: Restore BTF if the single-stepping is cancelled nfs_common: need lock during iterate through the list nfsd: Fix message level for normal termination speakup: fix uninitialized flush_lock usb: oxu210hp-hcd: Fix memory leak in oxu_create usb: ehci-omap: Fix PM disable depth umbalance in ehci_hcd_omap_probe powerpc/mm: sanity_check_fault() should work for all, not only BOOK3S ASoC: amd: change clk_get() to devm_clk_get() and add missed checks drm/mediatek: avoid dereferencing a null hdmi_phy on an error message powerpc/pseries/hibernation: remove redundant cacheinfo update powerpc/pseries/hibernation: drop pseries_suspend_begin() from suspend ops platform/x86: mlx-platform: Fix item counter assignment for MSN2700, MSN24xx systems scsi: fnic: Fix error return code in fnic_probe() seq_buf: Avoid type mismatch for seq_buf_init scsi: pm80xx: Fix error return in pm8001_pci_probe() scsi: qedi: Fix missing destroy_workqueue() on error in __qedi_probe arm64: dts: meson: g12a: x96-max: fix PHY deassert timing requirements ARM: dts: meson: fix PHY deassert timing requirements arm64: dts: meson: fix PHY deassert timing requirements Bluetooth: btmtksdio: Add the missed release_firmware() in mtk_setup_firmware() Bluetooth: btusb: Add the missed release_firmware() in btusb_mtk_setup_firmware() cpufreq: scpi: Add missing MODULE_ALIAS cpufreq: loongson1: Add missing MODULE_ALIAS cpufreq: sun50i: Add missing MODULE_DEVICE_TABLE cpufreq: st: Add missing MODULE_DEVICE_TABLE cpufreq: qcom: Add missing MODULE_DEVICE_TABLE cpufreq: mediatek: Add missing MODULE_DEVICE_TABLE cpufreq: highbank: Add missing MODULE_DEVICE_TABLE cpufreq: ap806: Add missing MODULE_DEVICE_TABLE clocksource/drivers/arm_arch_timer: Correct fault programming of CNTKCTL_EL1.EVNTI clocksource/drivers/arm_arch_timer: Use stable count reader in erratum sne phy: renesas: rcar-gen3-usb2: disable runtime pm in case of failure dm ioctl: fix error return code in target_message ASoC: jz4740-i2s: add missed checks for clk_get() net/mlx5: Properly convey driver version to firmware MIPS: Don't round up kernel sections size for memblock_add() memstick: r592: Fix error return in r592_probe() arm64: dts: rockchip: Fix UART pull-ups on rk3328 pinctrl: falcon: add missing put_device() call in pinctrl_falcon_probe() bpf: Fix bpf_put_raw_tracepoint()'s use of __module_address() ARM: dts: at91: sama5d2: map securam as device iio: hrtimer-trigger: Mark hrtimer to expire in hard interrupt context clocksource/drivers/cadence_ttc: Fix memory leak in ttc_setup_clockevent() clocksource/drivers/orion: Add missing clk_disable_unprepare() on error path powerpc/64: Fix an EMIT_BUG_ENTRY in head_64.S powerpc/perf: Fix crash with is_sier_available when pmu is not set media: saa7146: fix array overflow in vidioc_s_audio() hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable vfio-pci: Use io_remap_pfn_range() for PCI IO memory selftests/seccomp: Update kernel config NFS: switch nfsiod to be an UNBOUND workqueue. lockd: don't use interval-based rebinding over TCP net: sunrpc: Fix 'snprintf' return value check in 'do_xprt_debugfs' NFSv4: Fix the alignment of page data in the getdeviceinfo reply SUNRPC: xprt_load_transport() needs to support the netid "rdma6" NFSv4.2: condition READDIR's mask for security label based on LSM state SUNRPC: rpc_wake_up() should wake up tasks in the correct order ath10k: Release some resources in an error handling path ath10k: Fix an error handling path ath10k: Fix the parsing error in service available event platform/x86: dell-smbios-base: Fix error return code in dell_smbios_init ARM: dts: at91: at91sam9rl: fix ADC triggers soc: amlogic: canvas: add missing put_device() call in meson_canvas_get() arm64: dts: meson-sm1: fix typo in opp table arm64: dts: meson: fix spi-max-frequency on Khadas VIM2 PCI: iproc: Fix out-of-bound array accesses PCI: Fix overflow in command-line resource alignment requests PCI: Bounds-check command-line resource alignment requests arm64: dts: qcom: c630: Polish i2c-hid devices arm64: dts: ls1028a: fix ENETC PTP clock input genirq/irqdomain: Don't try to free an interrupt that has no mapping power: supply: bq24190_charger: fix reference leak power: supply: axp288_charger: Fix HP Pavilion x2 10 DMI matching arm64: dts: rockchip: Set dr_mode to "host" for OTG on rk3328-roc-cc arm64: dts: armada-3720-turris-mox: update ethernet-phy handle name ARM: dts: Remove non-existent i2c1 from 98dx3236 HSI: omap_ssi: Don't jump to free ID in ssi_add_controller() slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI media: max2175: fix max2175_set_csm_mode() error code mips: cdmm: fix use-after-free in mips_cdmm_bus_discover media: imx214: Fix stop streaming samples: bpf: Fix lwt_len_hist reusing previous BPF map platform/x86: mlx-platform: Remove PSU EEPROM from MSN274x platform configuration platform/x86: mlx-platform: Remove PSU EEPROM from default platform configuration media: siano: fix memory leak of debugfs members in smsdvb_hotplug arm64: tegra: Fix DT binding for IO High Voltage entry dmaengine: mv_xor_v2: Fix error return code in mv_xor_v2_probe() cw1200: fix missing destroy_workqueue() on error in cw1200_init_common rsi: fix error return code in rsi_reset_card() qtnfmac: fix error return code in qtnf_pcie_probe() orinoco: Move context allocation after processing the skb mmc: pxamci: Fix error return code in pxamci_probe ARM: dts: at91: sama5d3_xplained: add pincontrol for USB Host ARM: dts: at91: sama5d4_xplained: add pincontrol for USB Host memstick: fix a double-free bug in memstick_check RDMA/cxgb4: Validate the number of CQEs clk: meson: Kconfig: fix dependency for G12A Input: omap4-keypad - fix runtime PM error handling drivers: soc: ti: knav_qmss_queue: Fix error return code in knav_queue_probe soc: ti: Fix reference imbalance in knav_dma_probe soc: ti: knav_qmss: fix reference leak in knav_queue_probe spi: fix resource leak for drivers without .remove callback crypto: omap-aes - Fix PM disable depth imbalance in omap_aes_probe crypto: crypto4xx - Replace bitwise OR with logical OR in crypto4xx_build_pd EDAC/mce_amd: Use struct cpuinfo_x86.cpu_die_id for AMD NodeId powerpc/feature: Fix CPU_FTRS_ALWAYS by removing CPU_FTRS_GENERIC_32 powerpc: Avoid broken GCC __attribute__((optimize)) selftests/bpf: Fix broken riscv build spi: mxs: fix reference leak in mxs_spi_probe usb/max3421: fix return error code in max3421_probe() Input: ads7846 - fix unaligned access on 7845 Input: ads7846 - fix integer overflow on Rt calculation Input: ads7846 - fix race that causes missing releases drm/omap: dmm_tiler: fix return error code in omap_dmm_probe() video: fbdev: atmel_lcdfb: fix return error code in atmel_lcdfb_of_init() media: solo6x10: fix missing snd_card_free in error handling case scsi: core: Fix VPD LUN ID designator priorities ASoC: meson: fix COMPILE_TEST error media: v4l2-fwnode: Return -EINVAL for invalid bus-type media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_enc_pm() media: mtk-vcodec: add missing put_device() call in mtk_vcodec_release_dec_pm() media: mtk-vcodec: add missing put_device() call in mtk_vcodec_init_dec_pm() media: tm6000: Fix sizeof() mismatches staging: gasket: interrupt: fix the missed eventfd_ctx_put() in gasket_interrupt.c staging: greybus: codecs: Fix reference counter leak in error handling crypto: qat - fix status check in qat_hal_put_rel_rd_xfer() MIPS: BCM47XX: fix kconfig dependency bug for BCM47XX_BCMA RDMa/mthca: Work around -Wenum-conversion warning ASoC: arizona: Fix a wrong free in wm8997_probe spi: sprd: fix reference leak in sprd_spi_remove ASoC: wm8998: Fix PM disable depth imbalance on error selftest/bpf: Add missed ip6ip6 test back mwifiex: fix mwifiex_shutdown_sw() causing sw reset failure spi: bcm63xx-hsspi: fix missing clk_disable_unprepare() on error in bcm63xx_hsspi_resume spi: tegra114: fix reference leak in tegra spi ops spi: tegra20-sflash: fix reference leak in tegra_sflash_resume spi: tegra20-slink: fix reference leak in slink ops of tegra20 spi: mt7621: fix missing clk_disable_unprepare() on error in mt7621_spi_probe spi: spi-ti-qspi: fix reference leak in ti_qspi_setup Bluetooth: hci_h5: fix memory leak in h5_close Bluetooth: Fix null pointer dereference in hci_event_packet() arm64: dts: exynos: Correct psci compatible used on Exynos7 arm64: dts: exynos: Include common syscon restart/poweroff for Exynos7 brcmfmac: Fix memory leak for unpaired brcmf_{alloc/free} spi: stm32: fix reference leak in stm32_spi_resume selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling ASoC: pcm: DRAIN support reactivation spi: spi-mem: fix reference leak in spi_mem_access_start drm/msm/dsi_pll_10nm: restore VCO rate during restore_state f2fs: call f2fs_get_meta_page_retry for nat page spi: img-spfi: fix reference leak in img_spfi_resume powerpc/64: Set up a kernel stack for secondaries before cpu_restore() drm/amdgpu: fix build_coefficients() argument ARM: dts: aspeed: tiogapass: Remove vuart ASoC: sun4i-i2s: Fix lrck_period computation for I2S justified mode crypto: inside-secure - Fix sizeof() mismatch crypto: talitos - Fix return type of current_desc_hdr() crypto: talitos - Endianess in current_desc_hdr() drm/amdgpu: fix incorrect enum type sched: Reenable interrupts in do_sched_yield() sched/deadline: Fix sched_dl_global_validate() x86/apic: Fix x2apic enablement without interrupt remapping ARM: p2v: fix handling of LPAE translation in BE mode x86/mm/ident_map: Check for errors from ident_pud_init() RDMA/rxe: Compute PSN windows correctly ARM: dts: aspeed: s2600wf: Fix VGA memory region location selinux: fix error initialization in inode_doinit_with_dentry() rtc: pcf2127: fix pcf2127_nvmem_read/write() returns RDMA/bnxt_re: Set queue pair state when being queried Revert "i2c: i2c-qcom-geni: Fix DMA transfer race" soc: qcom: geni: More properly switch to DMA mode soc: mediatek: Check if power domains can be powered on at boot time soc: renesas: rmobile-sysc: Fix some leaks in rmobile_init_pm_domains() arm64: dts: renesas: cat875: Remove rxc-skew-ps from ethernet-phy node arm64: dts: renesas: hihope-rzg2-ex: Drop rxc-skew-ps from ethernet-phy node drm/tve200: Fix handling of platform_get_irq() error drm/mcde: Fix handling of platform_get_irq() error drm/aspeed: Fix Kconfig warning & subsequent build errors drm/gma500: fix double free of gma_connector md: fix a warning caused by a race between concurrent md_ioctl()s crypto: af_alg - avoid undefined behavior accessing salg_name media: msi2500: assign SPI bus number dynamically quota: Sanity-check quota file headers on load Bluetooth: Fix slab-out-of-bounds read in hci_le_direct_adv_report_evt() serial_core: Check for port state when tty is in error state HID: i2c-hid: add Vero K147 to descriptor override scsi: megaraid_sas: Check user-provided offsets coresight: etb10: Fix possible NULL ptr dereference in etb_enable_perf() coresight: tmc-etr: Fix barrier packet insertion for perf buffer coresight: tmc-etr: Check if page is valid before dma_map_page() coresight: tmc-etf: Fix NULL ptr dereference in tmc_enable_etf_sink_perf() ARM: dts: exynos: fix USB 3.0 pins supply being turned off on Odroid XU ARM: dts: exynos: fix USB 3.0 VBUS control and over-current pins on Exynos5410 ARM: dts: exynos: fix roles of USB 3.0 ports on Odroid XU usb: chipidea: ci_hdrc_imx: Pass DISABLE_DEVICE_STREAMING flag to imx6ul USB: gadget: f_rndis: fix bitrate for SuperSpeed and above usb: gadget: f_fs: Re-use SS descriptors for SuperSpeedPlus USB: gadget: f_midi: setup SuperSpeed Plus descriptors USB: gadget: f_acm: add support for SuperSpeed Plus USB: serial: option: add interface-number sanity check to flag handling usb: mtu3: fix memory corruption in mtu3_debugfs_regset() soc/tegra: fuse: Fix index bug in get_process_id kbuild: avoid split lines in .mod files perf/x86/intel: Check PEBS status correctly drm/amd/display: Init clock value by current vbios CLKs iwlwifi: pcie: add one missing entry for AX210 dm table: Remove BUG_ON(in_interrupt()) scsi: mpt3sas: Increase IOCInit request timeout to 30s vxlan: Copy needed_tailroom from lowerdev vxlan: Add needed_headroom for lower device arm64: syscall: exit userspace before unmasking exceptions habanalabs: put devices before driver removal drm/tegra: sor: Disable clocks on error in tegra_sor_init() kernel/cpu: add arch override for clear_tasks_mm_cpumask() mm handling drm/tegra: replace idr_init() by idr_init_base() net: mvpp2: add mvpp2_phylink_to_port() helper selftests: fix poll error in udpgro.sh ixgbe: avoid premature Rx buffer reuse i40e: avoid premature Rx buffer reuse i40e: optimise prefetch page refcount i40e: Refactor rx_bi accesses RDMA/cm: Fix an attempt to use non-valid pointer when cleaning timewait selftests/bpf/test_offload.py: Reset ethtool features after failed setting netfilter: nft_ct: Remove confirmation check for NFT_CT_ID gpio: eic-sprd: break loop when getting NULL device resource Revert "gpio: eic-sprd: Use devm_platform_ioremap_resource()" afs: Fix memory leak when mounting with multiple source parameters netfilter: nft_dynset: fix timeouts later than 23 days netfilter: nft_compat: make sure xtables destructors have run netfilter: x_tables: Switch synchronization to RCU pinctrl: aspeed: Fix GPIO requests on pass-through banks blk-mq: In blk_mq_dispatch_rq_list() "no budget" is a reason to kick block: factor out requeue handling from dispatch code block: Simplify REQ_OP_ZONE_RESET_ALL handling clk: renesas: r9a06g032: Drop __packed for portability can: softing: softing_netdev_open(): fix error handling xsk: Replace datagram_poll by sock_poll_wait xsk: Fix xsk_poll()'s return type scsi: bnx2i: Requires MMU gpio: mvebu: fix potential user-after-free on probe gpio: zynq: fix reference leak in zynq_gpio functions PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter ARM: dts: imx6qdl-kontron-samx6i: fix I2C_PM scl pin ARM: dts: imx6qdl-wandboard-revd1: Remove PAD_GPIO_6 from enetgrp ARM: dts: sun7i: pcduino3-nano: enable RGMII RX/TX delay on PHY ARM: dts: sun8i: v3s: fix GIC node memory range pinctrl: baytrail: Avoid clearing debounce value when turning it off pinctrl: merrifield: Set default bias in case no particular value given ARM: dts: sun8i: v40: bananapi-m2-berry: Fix ethernet node ARM: dts: sun8i: r40: bananapi-m2-berry: Fix dcdc1 regulator ARM: dts: sun7i: bananapi: Enable RGMII RX/TX delay on Ethernet PHY Linux 5.4.85 x86/resctrl: Fix incorrect local bandwidth when mba_sc is enabled x86/resctrl: Remove unused struct mbm_state::chunks_bw membarrier: Explicitly sync remote cores when SYNC_CORE is requested Revert "selftests/ftrace: check for do_sys_openat2 in user-memory test" KVM: mmu: Fix SPTE encoding of MMIO generation upper half serial: 8250_omap: Avoid FIFO corruption caused by MDR1 access ALSA: pcm: oss: Fix potential out-of-bounds shift USB: sisusbvga: Make console support depend on BROKEN USB: UAS: introduce a quirk to set no_write_same xhci-pci: Allow host runtime PM as default for Intel Alpine Ridge LP xhci: Give USB2 ports time to enter U3 in bus suspend ALSA: usb-audio: Fix control 'access overflow' errors from chmap ALSA: usb-audio: Fix potential out-of-bounds shift USB: add RESET_RESUME quirk for Snapscan 1212 USB: dummy-hcd: Fix uninitialized array use in init() ktest.pl: If size of log is too big to email, email error message net: stmmac: delete the eee_ctrl_timer after napi disabled net: stmmac: dwmac-meson8b: fix mask definition of the m250_sel mux net: ll_temac: Fix potential NULL dereference in temac_probe() net/mlx4_en: Handle TX error CQE lan743x: fix for potential NULL pointer dereference with bare card net/mlx4_en: Avoid scheduling restart task if it is already running tcp: fix cwnd-limited bug for TSO deferral where we send nothing tcp: select sane initial rcvq_space.space for big MSS net: stmmac: free tx skb buffer in stmmac_resume() bridge: Fix a deadlock when enabling multicast snooping enetc: Fix reporting of h/w packet counters udp: fix the proto value passed to ip_protocol_deliver_rcu for the segments net: hns3: remove a misused pragma packed vrf: packets with lladdr src needs dst at input with orig_iif when needs strict net: bridge: vlan: fix error return code in __vlan_add() mac80211: mesh: fix mesh_pathtbl_init() error path ipv4: fix error return code in rtm_to_fib_config() ptrace: Prevent kernel-infoleak in ptrace_get_syscall_info() Linux 5.4.84 compiler.h: fix barrier_data() on clang mm/zsmalloc.c: drop ZSMALLOC_PGTABLE_MAPPING x86/apic/vector: Fix ordering in vector assignment x86/membarrier: Get rid of a dubious optimization x86/mm/mem_encrypt: Fix definition of PMD_FLAGS_DEC_WP scsi: be2iscsi: Revert "Fix a theoretical leak in beiscsi_create_eqs()" proc: use untagged_addr() for pagemap_read addresses kbuild: avoid static_assert for genksyms drm/i915/display/dp: Compute the correct slice count for VDSC on DP mmc: block: Fixup condition for CMD13 polling for RPMB requests pinctrl: amd: remove debounce filter setting in IRQ type setting Input: i8042 - add Acer laptops to the i8042 reset list Input: cm109 - do not stomp on control URB ktest.pl: Fix incorrect reboot for grub2bls can: m_can: m_can_dev_setup(): add support for bosch mcan version 3.3.0 platform/x86: touchscreen_dmi: Add info for the Irbis TW118 tablet platform/x86: intel-vbtn: Support for tablet mode on HP Pavilion 13 x360 PC platform/x86: acer-wmi: add automatic keyboard background light toggle key as KEY_LIGHTS_TOGGLE platform/x86: thinkpad_acpi: Add BAT1 is primary battery quirk for Thinkpad Yoga 11e 4th gen platform/x86: thinkpad_acpi: Do not report SW_TABLET_MODE on Yoga 11e arm64: tegra: Disable the ACONNECT for Jetson TX2 soc: fsl: dpio: Get the cpumask through cpumask_of(cpu) spi: spi-nxp-fspi: fix fspi panic by unexpected interrupts irqchip/gic-v3-its: Unconditionally save/restore the ITS state on suspend ibmvnic: skip tx timeout reset while in resetting interconnect: qcom: qcs404: Remove GPU and display RPM IDs scsi: ufs: Make sure clk scaling happens only when HBA is runtime ACTIVE ARC: stack unwinding: don't assume non-current task is sleeping arm64: dts: broadcom: clear the warnings caused by empty dma-ranges powerpc: Drop -me200 addition to build flags iwlwifi: mvm: fix kernel panic in case of assert during CSA iwlwifi: pcie: set LTR to avoid completion timeout arm64: dts: rockchip: Assign a fixed index to mmc devices on rk3399 boards. iwlwifi: pcie: limit memory read spin time x86/lib: Change .weak to SYM_FUNC_START_WEAK for arch/x86/lib/mem*_64.S Kbuild: do not emit debug info for assembly with LLVM_IAS=1 ANDROID: GKI: bring back irq_create_mapping() Linux 5.4.83 Revert "geneve: pull IP header before ECN decapsulation" x86/insn-eval: Use new for_each_insn_prefix() macro to loop over prefixes bytes netfilter: nftables_offload: set address type in control dissector netfilter: nf_tables: avoid false-postive lockdep splat Input: i8042 - fix error return code in i8042_setup_aux() dm writecache: remove BUG() and fail gracefully instead i2c: qup: Fix error return code in qup_i2c_bam_schedule_desc() rtw88: debug: Fix uninitialized memory in debugfs code ASoC: wm_adsp: fix error return code in wm_adsp_load() tipc: fix a deadlock when flushing scheduled work netfilter: ipset: prevent uninit-value in hash_ip6_add gfs2: check for empty rgrp tree in gfs2_ri_update can: af_can: can_rx_unregister(): remove WARN() statement from list operation sanity check lib/syscall: fix syscall registers retrieval on 32-bit platforms tracing: Fix userstacktrace option for instances iommu/amd: Set DTE[IntTabLen] to represent 512 IRTEs spi: bcm2835: Release the DMA channel if probe fails after dma_init i2c: imx: Check for I2SR_IAL after every byte i2c: imx: Fix reset of I2SR_IAL flag speakup: Reject setting the speakup line discipline outside of speakup mm/swapfile: do not sleep with a spin lock held mm: list_lru: set shrinker map bit when child nr_items is not zero coredump: fix core_pattern parse error x86/uprobes: Do not use prefixes.nbytes when looping over prefixes.bytes dm: remove invalid sparse __acquires and __releases annotations dm: fix bug with RCU locking in dm_blk_report_zones powerpc/pseries: Pass MSI affinity to irq_create_mapping() genirq/irqdomain: Add an irq_create_mapping_affinity() function powerpc/64s/powernv: Fix memory corruption when saving SLB entries on MCE dm writecache: fix the maximum number of arguments scsi: mpt3sas: Fix ioctl timeout drm/i915/gt: Program mocs:63 for cache eviction on gen9 thunderbolt: Fix use-after-free in remove_unplugged_switch() i2c: imx: Don't generate STOP condition if arbitration has been lost cifs: fix potential use-after-free in cifs_echo_request() cifs: allow syscalls to be restarted in __smb_send_rqst() ftrace: Fix updating FTRACE_FL_TRAMP ALSA: hda/generic: Add option to enforce preferred_dacs pairs ALSA: hda/realtek - Add new codec supported for ALC897 ALSA: hda/realtek: Enable headset of ASUS UX482EG & B9400CEA with ALC294 ALSA: hda/realtek: Add mute LED quirk to yet another HP x360 model ALSA: hda/realtek: Fix bass speaker DAC assignment on Asus Zephyrus G14 tty: Fix ->session locking tty: Fix ->pgrp locking in tiocspgrp() USB: serial: option: fix Quectel BG96 matching USB: serial: option: add support for Thales Cinterion EXS82 USB: serial: option: add Fibocom NL668 variants USB: serial: ch341: sort device-id entries USB: serial: ch341: add new Product ID for CH341A USB: serial: kl5kusb105: fix memleak on open usb: gadget: f_fs: Use local copy of descriptors for userspace copy Partially revert bpf: Zero-fill re-used per-cpu map element pinctrl: baytrail: Fix pin being driven low for a while on gpiod_get(..., GPIOD_OUT_HIGH) pinctrl: baytrail: Replace WARN with dev_info_once when setting direct-irq pin to output Linux 5.4.82 RDMA/i40iw: Address an mmap handler exploit in i40iw tracing: Remove WARN_ON in start_thread() Input: i8042 - add ByteSpeed touchpad to noloop table Input: xpad - support Ardwiino Controllers ALSA: usb-audio: US16x08: fix value count for level meters net/mlx5: Fix wrong address reclaim when command interface is down net/mlx5: DR, Proper handling of unsupported Connect-X6DX SW steering net/sched: act_mpls: ensure LSE is pullable before reading it net: openvswitch: ensure LSE is pullable before reading it net: skbuff: ensure LSE is pullable before decrementing the MPLS ttl net: mvpp2: Fix error return code in mvpp2_open() chelsio/chtls: fix a double free in chtls_setkey() vxlan: fix error return code in __vxlan_dev_create() net: pasemi: fix error return code in pasemi_mac_open() cxgb3: fix error return code in t3_sge_alloc_qset() net/x25: prevent a couple of overflows net: ip6_gre: set dev->hard_header_len when using header_ops geneve: pull IP header before ECN decapsulation inet_ecn: Fix endianness of checksum update when setting ECT(1) ibmvnic: Fix TX completion error handling ibmvnic: Ensure that SCRQ entry reads are correctly ordered chelsio/chtls: fix panic during unload reload chtls dt-bindings: net: correct interrupt flags in examples ipv4: Fix tos mask in inet_rtm_getroute() netfilter: bridge: reset skb->pkt_type after NF_INET_POST_ROUTING traversal sched/fair: Fix unthrottle_cfs_rq() for leaf_cfs_rq list ima: extend boot_aggregate with kernel measurements staging/octeon: fix up merge error bonding: wait for sysfs kobject destruction before freeing struct slave usbnet: ipheth: fix connectivity with iOS 14 tun: honor IOCB_NOWAIT flag tcp: Set INET_ECN_xmit configuration in tcp_reinit_congestion_control sock: set sk_err to ee_errno on dequeue from errq rose: Fix Null pointer dereference in rose_send_frame() net/tls: Protect from calling tls_dev_del for TLS RX twice net/tls: missing received data after fast remote close net/af_iucv: set correct sk_protocol for child sockets ipv6: addrlabel: fix possible memory leak in ip6addrlbl_net_init devlink: Hold rtnl lock while reading netdev attributes Linux 5.4.81 ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT ASoC: Intel: Multiple I/O PCM format support for pipe ASoC: Intel: Skylake: Await purge request ack on CNL ASoC: Intel: Allow for ROM init retry on CNL platforms ASoC: Intel: Skylake: Shield against no-NHLT configurations ASoC: Intel: Skylake: Enable codec wakeup during chip init ASoC: Intel: Skylake: Select hda configuration permissively ASoC: Intel: Skylake: Remove superfluous chip initialization USB: core: Fix regression in Hercules audio card x86/resctrl: Add necessary kernfs_put() calls to prevent refcount leak x86/resctrl: Remove superfluous kernfs_get() calls to prevent refcount leak x86/speculation: Fix prctl() when spectre_v2_user={seccomp,prctl},ibpb x86/mce: Do not overwrite no_way_out if mce_end() fails irqchip/exiu: Fix the index of fwspec for IRQ type usb: gadget: Fix memleak in gadgetfs_fill_super USB: quirks: Add USB_QUIRK_DISCONNECT_SUSPEND quirk for Lenovo A630Z TIO built-in usb-audio card usb: gadget: f_midi: Fix memleak in f_midi_alloc USB: core: Change %pK for __user pointers to %px spi: bcm2835aux: Restore err assignment in bcm2835aux_spi_probe perf probe: Fix to die_entrypc() returns error correctly perf stat: Use proper cpu for shadow stats can: m_can: fix nominal bitiming tseg2 min for version >= 3.1 can: m_can: m_can_open(): remove IRQF_TRIGGER_FALLING from request_threaded_irq()'s flags RDMA/hns: Bugfix for memory window mtpt configuration RDMA/hns: Fix retry_cnt and rnr_cnt when querying QP platform/x86: toshiba_acpi: Fix the wrong variable assignment platform/x86: thinkpad_acpi: Send tablet mode switch at wakeup time can: gs_usb: fix endianess problem with candleLight firmware efi: EFI_EARLYCON should depend on EFI efivarfs: revert "fix memory leak in efivarfs_create()" arm64: tegra: Wrong AON HSP reg property size optee: add writeback to valid memory type ibmvnic: fix NULL pointer dereference in ibmvic_reset_crq ibmvnic: fix NULL pointer dereference in reset_sub_crq_queues net: ena: set initial DMA width to avoid intel iommu issue nfc: s3fwrn5: use signed integer for parsing GPIO numbers i40e: Fix removing driver while bare-metal VFs pass traffic IB/mthca: fix return value of error branch in mthca_init_cq() powerpc/64s: Fix allnoconfig build since uaccess flush ibmvnic: notify peers when failover and migration happen ibmvnic: fix call_netdevice_notifiers in do_reset s390/qeth: fix tear down of async TX buffers s390/qeth: fix af_iucv notification race s390/qeth: make af_iucv TX notification call more robust cxgb4: fix the panic caused by non smac rewrite bnxt_en: Release PCI regions when DMA mask setup fails during probe. video: hyperv_fb: Fix the cache type when mapping the VRAM bnxt_en: fix error return code in bnxt_init_board() bnxt_en: fix error return code in bnxt_init_one() scsi: ufs: Fix race between shutdown and runtime resume flow ARM: dts: dra76x: m_can: fix order of clocks arch: pgtable: define MAX_POSSIBLE_PHYSMEM_BITS where needed batman-adv: set .owner to THIS_MODULE iwlwifi: mvm: write queue_sync_state only for sync phy: tegra: xusb: Fix dangling pointer on probe failure ARM: OMAP2+: Manage MPU state properly for omap_enter_idle_coupled() bus: ti-sysc: Fix bogus resetdone warning on enable for cpsw net: dsa: mv88e6xxx: Wait for EEPROM done after HW reset xtensa: uaccess: Add missing __user to strncpy_from_user() prototype perf/x86: fix sysfs type mismatches scsi: target: iscsi: Fix cmd abort fabric stop race scsi: libiscsi: Fix NOP race condition dmaengine: pl330: _prep_dma_memcpy: Fix wrong burst size vhost scsi: fix cmd completion race nvme: free sq/cq dbbuf pointers when dbbuf set fails proc: don't allow async path resolution of /proc/self components HID: Add Logitech Dinovo Edge battery quirk HID: logitech-hidpp: Add HIDPP_CONSUMER_VENDOR_KEYS quirk for the Dinovo Edge x86/xen: don't unbind uninitialized lock_kicker_irq dmaengine: xilinx_dma: use readl_poll_timeout_atomic variant HID: add HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE for Gamevice devices staging: ralink-gdma: fix kconfig dependency bug for DMA_RALINK HID: hid-sensor-hub: Fix issue with devices with no report ID Input: i8042 - allow insmod to succeed on devices without an i8042 controller HID: add support for Sega Saturn HID: cypress: Support Varmilo Keyboards' media hotkeys HID: ite: Replace ABS_MISC 120/121 events with touchpad on/off keypresses HID: uclogic: Add ID for Trust Flex Design Tablet arm64: pgtable: Ensure dirty bit is preserved across pte_wrprotect() arm64: pgtable: Fix pte_accessible() trace: fix potenial dangerous pointer KVM: x86: Fix split-irqchip vs interrupt injection window request KVM: x86: handle !lapic_in_kernel case in kvm_cpu_*_extint KVM: arm64: vgic-v3: Drop the reporting of GICR_TYPER.Last for userspace KVM: PPC: Book3S HV: XIVE: Fix possible oops when accessing ESB page cifs: fix a memleak with modefromsid smb3: Handle error case during offload read path smb3: Avoid Mid pending list corruption smb3: Call cifs reconnect from demultiplex thread wireless: Use linux/stddef.h instead of stddef.h btrfs: fix lockdep splat when reading qgroup config on mount btrfs: don't access possibly stale fs_info data for printing duplicate device btrfs: tree-checker: add missing returns after data_ref alignment checks btrfs: tree-checker: add missing return after error in root_item netfilter: clear skb->next in NF_HOOK_LIST() ipv4: use IS_ENABLED instead of ifdef spi: bcm2835: Fix use-after-free on unbind spi: bcm-qspi: Fix use-after-free on unbind Revert "Exempt multicast addresses from five-second neighbor lifetime" Linux 5.4.80 sched/fair: Fix overutilized update in enqueue_task_fair() mm, page_alloc: skip ->waternark_boost for atomic order-0 allocations mm/userfaultfd: do not access vma->vm_mm after calling handle_userfault() mm: memcg/slab: fix root memcg vmstats x86/microcode/intel: Check patch signature before saving microcode for early loading seccomp: Set PF_SUPERPRIV when checking capability ptrace: Set PF_SUPERPRIV when checking capability mmc: sdhci-pci: Prefer SDR25 timing for High Speed mode for BYT-based Intel controllers drm/i915: Handle max_bpc==16 drm/amd/display: Add missing pflip irq for dcn2.0 Drivers: hv: vmbus: Allow cleanup of VMBUS_CONNECT_CPU if disconnected s390/dasd: fix null pointer dereference for ERP requests s390/cpum_sf.c: fix file permission for cpum_sfb_size mac80211: free sta in sta_info_insert_finish() on errors mac80211: minstrel: fix tx status processing corner case mac80211: minstrel: remove deferred sampling code xtensa: disable preemption around cache alias management calls xtensa: fix TLBTEMP area placement regulator: workaround self-referent regulators regulator: avoid resolve_supply() infinite recursion regulator: fix memory leak with repeated set_machine_constraints() regulator: pfuze100: limit pfuze-support-disable-sw to pfuze{100,200} spi: bcm2835aux: Fix use-after-free on unbind spi: npcm-fiu: Don't leak SPI master in probe error path spi: Introduce device-managed SPI controller allocation spi: lpspi: Fix use-after-free on unbind iio: adc: mediatek: fix unset field iio: accel: kxcjk1013: Add support for KIOX010A ACPI DSM for setting tablet-mode iio: accel: kxcjk1013: Replace is_smo8500_device with an acpi_type enum ext4: fix bogus warning in ext4_update_dx_flag() iio: light: fix kconfig dependency bug for VCNL4035 staging: rtl8723bs: Add 024c:0627 to the list of SDIO device-ids efivarfs: fix memory leak in efivarfs_create() HID: logitech-dj: Fix an error in mse_bluetooth_descriptor tty: serial: imx: keep console clocks always on tty: serial: imx: fix potential deadlock ALSA: hda/realtek: Add some Clove SSID in the ALC293(ALC1220) ALSA: hda/realtek - Add supported for Lenovo ThinkPad Headset Button ALSA: mixart: Fix mutex deadlock ALSA: ctl: fix error path at adding user-defined element set ALSA: usb-audio: Add delay quirk for all Logitech USB devices ALSA: firewire: Clean up a locking issue in copy_resp_to_buf() speakup: Do not let the line discipline be used several times HID: logitech-dj: Fix Dinovo Mini when paired with a MX5x00 receiver HID: logitech-dj: Handle quad/bluetooth keyboards with a builtin trackpad HID: logitech-hidpp: Add PID for MX Anywhere 2 libfs: fix error cast of negative value in simple_attr_write() efi/x86: Free efi_pgd with free_pages() bpf, sockmap: Avoid returning unneeded EAGAIN when redirecting to self bpf, sockmap: Use truesize with sk_rmem_schedule() bpf, sockmap: On receive programs try to fast track SK_PASS ingress bpf, sockmap: Skb verdict SK_PASS to self already checked rmem limits xfs: revert "xfs: fix rmap key and record comparison functions" fail_function: Remove a redundant mutex unlock regulator: ti-abb: Fix array out of bound read access on the first transition xfs: return corresponding errcode if xfs_initialize_perag() fail xfs: strengthen rmap record flags checking xfs: fix the minrecs logic when dealing with inode root child blocks can: m_can: process interrupt only when not runtime suspended can: flexcan: flexcan_chip_start(): fix erroneous flexcan_transceiver_enable() during bus-off recovery iommu/vt-d: Avoid panic if iommu init fails in tboot system iommu/vt-d: Move intel_iommu_gfx_mapped to Intel IOMMU header can: kvaser_usb: kvaser_usb_hydra: Fix KCAN bittiming limits can: kvaser_pciefd: Fix KCAN bittiming limits bpf, sockmap: Ensure SO_RCVBUF memory is observed on ingress redirect bpf, sockmap: Fix partial copy_page_to_iter so progress can still be made net/mlx5: E-Switch, Fail mlx5_esw_modify_vport_rate if qos disabled drm/sun4i: dw-hdmi: fix error return code in sun8i_dw_hdmi_bind() MIPS: Alchemy: Fix memleak in alchemy_clk_setup_cpu selftests/bpf: Fix error return code in run_getsockopt_test() ASoC: qcom: lpass-platform: Fix memory leak can: m_can: m_can_stop(): set device to software init mode before closing can: m_can: m_can_class_free_dev(): introduce new function can: m_can: m_can_handle_state_change(): fix state change can: tcan4x5x: tcan4x5x_can_remove(): fix order of deregistration can: tcan4x5x: tcan4x5x_can_probe(): add missing error checking for devm_regmap_init() can: tcan4x5x: replace depends on REGMAP_SPI with depends on SPI can: flexcan: fix failure handling of pm_runtime_get_sync() can: peak_usb: fix potential integer overflow on shift of a int can: mcba_usb: mcba_usb_start_xmit(): first fill skb, then pass to can_put_echo_skb() can: ti_hecc: Fix memleak in ti_hecc_probe can: dev: can_restart(): post buffer from the right context can: af_can: prevent potential access of uninitialized member in canfd_rcv() can: af_can: prevent potential access of uninitialized member in can_rcv() ip_tunnels: Set tunnel option flag when tunnel metadata is present tools, bpftool: Add missing close before bpftool net attach exit perf lock: Don't free "lock_seq_stat" if read_count isn't zero RMDA/sw: Don't allow drivers using dma_virt_ops on highmem configs RDMA/pvrdma: Fix missing kfree() in pvrdma_register_device() rfkill: Fix use-after-free in rfkill_resume() Input: resistive-adc-touch - fix kconfig dependency on IIO_BUFFER ARM: dts: imx50-evk: Fix the chip select 1 IOMUX arm64: dts: imx8mm: fix voltage for 1.6GHz CPU operating point swiotlb: using SIZE_MAX needs limits.h included arm: dts: imx6qdl-udoo: fix rgmii phy-mode for ksz9031 phy arm64: dts imx8mn: Remove non-existent USB OTG2 arm64: dts: allwinner: h5: OrangePi Prime: Fix ethernet node MIPS: export has_transparent_hugepage() for modules Input: adxl34x - clean up a data type in adxl34x_probe() arm64: dts: allwinner: a64: bananapi-m64: Enable RGMII RX/TX delay on PHY ARM: dts: sunxi: bananapi-m2-plus: Enable RGMII RX/TX delay on Ethernet PHY ARM: dts: sun9i: Enable both RGMII RX/TX delay on Ethernet PHY ARM: dts: sun8i: a83t: Enable both RGMII RX/TX delay on Ethernet PHY ARM: dts: sun8i: h3: orangepi-plus2e: Enable RGMII RX/TX delay on Ethernet PHY ARM: dts: sun7i: bananapi-m1-plus: Enable RGMII RX/TX delay on Ethernet PHY ARM: dts: sun7i: cubietruck: Enable RGMII RX/TX delay on Ethernet PHY ARM: dts: sun6i: a31-hummingbird: Enable RGMII RX/TX delay on Ethernet PHY Revert "arm: sun8i: orangepi-pc-plus: Set EMAC activity LEDs to active high" ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix ethernet node arm64: dts: allwinner: h5: OrangePi PC2: Fix ethernet node arm64: dts: allwinner: a64: Pine64 Plus: Fix ethernet node arm64: dts: allwinner: a64: OrangePi Win: Fix ethernet node arm64: dts: allwinner: Pine H64: Enable both RGMII RX/TX delay arm64: dts: allwinner: beelink-gs1: Enable both RGMII RX/TX delay hwmon: (pwm-fan) Fix RPM calculation gfs2: fix possible reference leak in gfs2_check_blk_type vfs: remove lockdep bogosity in __sb_start_write arm64: smp: Tell RCU about CPUs that fail to come online arm64: psci: Avoid printing in cpu_psci_cpu_die() arm64: errata: Fix handling of1418040with late CPU onlining ACPI: button: Add DMI quirk for Medion Akoya E2228T selftests: kvm: Fix the segment descriptor layout to match the actual layout scsi: ufs: Fix unbalanced scsi_block_reqs_cnt caused by ufshcd_hold() pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq net: ftgmac100: Fix crash when removing driver net/ncsi: Fix netlink registration net: usb: qmi_wwan: Set DTR quirk for MR400 net/mlx5: Disable QoS when min_rates on all VFs are zero net/mlx5: Add handling of port type in rule deletion tcp: only postpone PROBE_RTT if RTT is < current min_rtt estimate sctp: change to hold/put transport for proto_unreach_timer qlcnic: fix error return code in qlcnic_83xx_restart_hw() qed: fix error return code in qed_iwarp_ll2_start() page_frag: Recover from memory pressure net: x25: Increase refcnt of "struct x25_neigh" in x25_rx_call_request net/tls: fix corrupted data in recvmsg net/smc: fix direct access to ib_gid_addr->ndev in smc_ib_determine_gid() net: qualcomm: rmnet: Fix incorrect receive packet handling during cleanup net/mlx4_core: Fix init_hca fields offset net: lantiq: Wait for the GPHY firmware to be ready netlabel: fix an uninitialized warning in netlbl_unlabel_staticlist() netlabel: fix our progress tracking in netlbl_unlabel_staticlist() net: Have netpoll bring-up DSA management interface net: ethernet: ti: cpsw: fix error return code in cpsw_probe() net: dsa: mv88e6xxx: Avoid VTU corruption on 6097 net: bridge: add missing counters to ndo_get_stats64 callback net: b44: fix error return code in b44_init_one() mlxsw: core: Use variable timeout for EMAD retries lan743x: prevent entire kernel HANG on open, for some platforms lan743x: fix issue causing intermittent kernel log warnings ipv6: Fix error path to cancel the meseage inet_diag: Fix error path to cancel the meseage in inet_req_diag_fill() Exempt multicast addresses from five-second neighbor lifetime devlink: Add missing genlmsg_cancel() in devlink_nl_sb_port_pool_fill() bnxt_en: read EEPROM A2h address using page 0 atm: nicstar: Unmap DMA on send error ah6: fix error return code in ah6_input() Linux 5.4.79 ACPI: GED: fix -Wformat KVM: x86: clflushopt should be treated as a no-op by emulation can: proc: can_remove_proc(): silence remove_proc_entry warning mac80211: always wind down STA state Input: sunkbd - avoid use-after-free in teardown paths net: lantiq: Add locking for TX DMA channel powerpc/8xx: Always fault when _PAGE_ACCESSED is not set net/mlx5: Add retry mechanism to the command entry index allocation net/mlx5: Fix a race when moving command interface to events mode net/mlx5: poll cmd EQ in case of command timeout net/mlx5: Use async EQ setup cleanup helpers for multiple EQs MIPS: PCI: Fix MIPS build selftests/powerpc: entry flush test powerpc: Only include kup-radix.h for 64-bit Book3S powerpc/64s: flush L1D after user accesses powerpc/64s: flush L1D on kernel entry selftests/powerpc: rfi_flush: disable entry flush if present Linux 5.4.78 Convert trailing spaces and periods in path components net: sch_generic: fix the missing new qdisc assignment bug perf/core: Fix race in the perf_mmap_close() function perf scripting python: Avoid declaring function pointers with a visibility attribute x86/speculation: Allow IBPB to be conditionally enabled on CPUs with always-on STIBP powerpc/603: Always fault when _PAGE_ACCESSED is not set drm/i915: Correctly set SFC capability for video engines r8169: fix potential skb double free in an error path tipc: fix memory leak in tipc_topsrv_start() net/x25: Fix null-ptr-deref in x25_connect net: Update window_clamp if SOCK_RCVBUF is set net: udp: fix UDP header access on Fast/frag0 UDP GRO net/af_iucv: fix null pointer dereference on shutdown IPv6: Set SIT tunnel hard_header_len to zero swiotlb: fix "x86: Don't panic if can not alloc buffer for swiotlb" pinctrl: amd: fix incorrect way to disable debounce filter pinctrl: amd: use higher precision for 512 RtcClk drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[] don't dump the threads that had been already exiting when zapped. mmc: renesas_sdhi_core: Add missing tmio_mmc_host_free() at remove mmc: sdhci-of-esdhc: Handle pulse width detection erratum for more SoCs gpio: pcie-idio-24: Enable PEX8311 interrupts gpio: pcie-idio-24: Fix IRQ Enable Register value gpio: pcie-idio-24: Fix irq mask when masking selinux: Fix error return code in sel_ib_pkey_sid_slow() btrfs: fix potential overflow in cluster_pages_for_defrag on 32bit arch ocfs2: initialize ip_next_orphan reboot: fix overflow parsing reboot cpu number Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint" mm/slub: fix panic in slab_alloc_node() jbd2: fix up sparse warnings in checkpoint code futex: Don't enable IRQs unconditionally in put_pi_state() mei: protect mei_cl_mtu from null dereference virtio: virtio_console: fix DMA memory allocation for rproc serial xhci: hisilicon: fix refercence leak in xhci_histb_probe usb: cdc-acm: Add DISABLE_ECHO for Renesas USB Download mode uio: Fix use-after-free in uio_unregister_device() thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services() KVM: arm64: Don't hide ID registers from userspace btrfs: dev-replace: fail mount if we don't have replace item with target device btrfs: fix min reserved size calculation in merge_reloc_root btrfs: ref-verify: fix memory leak in btrfs_ref_tree_mod ext4: unlock xattr_sem properly in ext4_inline_data_truncate() ext4: correctly report "not supported" for {usr,grp}jquota when !CONFIG_QUOTA erofs: derive atime instead of leaving it empty perf: Fix get_recursion_context() vrf: Fix fast path output packet handling with async Netfilter rules cosa: Add missing kfree in error path of cosa_write of/address: Fix of_node memory leak in of_dma_is_coherent xfs: fix a missing unlock on error in xfs_fs_map_blocks lan743x: fix "BUG: invalid wait context" when setting rx mode xfs: fix brainos in the refcount scrubber's rmap fragment processor xfs: fix rmap key and record comparison functions xfs: set the unwritten bit in rmap lookup flags in xchk_bmap_get_rmapextents xfs: fix flags argument to rmap lookup when converting shared file rmaps igc: Fix returning wrong statistics nbd: fix a block_device refcount leak in nbd_release bpf: Zero-fill re-used per-cpu map element SUNRPC: Fix general protection fault in trace_rpc_xdr_overflow() net/mlx5: Fix deletion of duplicate rules pinctrl: aspeed: Fix GPI only function problem. bpf: Don't rely on GCC __attribute__((optimize)) to disable GCSE ARM: 9019/1: kprobes: Avoid fortify_panic() when copying optprobe template pinctrl: intel: Set default bias in case no particular value given mfd: sprd: Add wakeup capability for PMIC IRQ tick/common: Touch watchdog in tick_unfreeze() on all CPUs spi: bcm2835: remove use of uninitialized gpio flags variable tpm_tis: Disable interrupts on ThinkPad T490s i2c: sh_mobile: implement atomic transfers riscv: Set text_offset correctly for M-Mode selftests: proc: fix warning: _GNU_SOURCE redefined amd/amdgpu: Disable VCN DPG mode for Picasso i2c: mediatek: move dma reset before i2c reset vfio/pci: Bypass IGD init in case of -ENODEV vfio: platform: fix reference leak in vfio_platform_open s390/smp: move rcu_cpu_starting() earlier iommu/amd: Increase interrupt remapping table limit to 512 entries nvme-tcp: avoid repeated request completion nvme-rdma: avoid repeated request completion nvme-tcp: avoid race between time out and tear down nvme-rdma: avoid race between time out and tear down nvme: introduce nvme_sync_io_queues scsi: mpt3sas: Fix timeouts observed while reenabling IRQ scsi: scsi_dh_alua: Avoid crash during alua_bus_detach() tracing: Fix the checking of stackidx in __ftrace_trace_stack cfg80211: regulatory: Fix inconsistent format argument cfg80211: initialize wdev data earlier mac80211: fix use of skb payload instead of header drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running drm/amd/pm: perform SMC reset on suspend/hibernation drm/amdgpu: perform srbm soft reset always on SDMA resume scsi: hpsa: Fix memory leak in hpsa_init_one() gfs2: check for live vs. read-only file system in gfs2_fitrim gfs2: Add missing truncate_inode_pages_final for sd_aspace gfs2: Free rd_bits later in gfs2_clear_rgrpd to fix use-after-free ALSA: hda: Reinstate runtime_allow() for all hda controllers ALSA: hda: Separate runtime and system suspend selftests: pidfd: fix compilation errors due to wait.h selftests/ftrace: check for do_sys_openat2 in user-memory test usb: gadget: goku_udc: fix potential crashes in probe opp: Reduce the size of critical section in _opp_table_kref_release() usb: dwc3: pci: add support for the Intel Alder Lake-S ASoC: cs42l51: manage mclk shutdown delay ASoC: qcom: sdm845: set driver name correctly ath9k_htc: Use appropriate rs_datalen type KVM: x86: don't expose MSR_IA32_UMWAIT_CONTROL unconditionally KVM: arm64: ARM_SMCCC_ARCH_WORKAROUND_1 doesn't return SMCCC_RET_NOT_REQUIRED random32: make prandom_u32() output unpredictable tpm: efi: Don't create binary_bios_measurements file for an empty log xfs: fix scrub flagging rtinherit even if there is no rt device xfs: flush new eof page on truncate to avoid post-eof corruption can: flexcan: flexcan_remove(): disable wakeup completely can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on can: peak_usb: peak_usb_get_ts_time(): fix timestamp wrapping can: peak_usb: add range checking in decode operations can: xilinx_can: handle failure cases of pm_runtime_get_sync can: ti_hecc: ti_hecc_probe(): add missed clk_disable_unprepare() in error path can: j1939: j1939_sk_bind(): return failure if netdev is down can: j1939: swap addr and pgn in the send example can: can_create_echo_skb(): fix echo skb generation: always use skb_clone() can: dev: __can_get_echo_skb(): fix real payload length return value for RTR frames can: dev: can_get_echo_skb(): prevent call to kfree_skb() in hard IRQ context can: rx-offload: don't call kfree_skb() from IRQ context afs: Fix warning due to unadvanced marshalling pointer iommu/vt-d: Fix a bug for PDP check in prq_event_thread ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link() perf tools: Add missing swap for ino_generation perf trace: Fix segfault when trying to trace events by cgroup powerpc/eeh_cache: Fix a possible debugfs deadlock netfilter: ipset: Update byte and packet counters regardless of whether they match netfilter: nf_tables: missing validation from the abort path netfilter: use actual socket sk rather than skb sk when routing harder xfs: set xefi_discard when creating a deferred agfl free log intent item ASoC: codecs: wcd9335: Set digital gain range correctly net: xfrm: fix a race condition during allocing spi hv_balloon: disable warning when floor reached genirq: Let GENERIC_IRQ_IPI select IRQ_DOMAIN_HIERARCHY ASoC: Intel: kbl_rt5663_max98927: Fix kabylake_ssp_fixup function btrfs: reschedule when cloning lots of extents btrfs: sysfs: init devices outside of the chunk_mutex btrfs: tracepoints: output proper root owner for trace_find_free_extent() usb: dwc3: gadget: Reclaim extra TRBs after request completion usb: dwc3: gadget: Continue to process pending requests PCI: qcom: Make sure PCIe is reset before init for rev 2.1.0 KVM: arm64: Force PTE mapping on fault resulting in a device mapping nbd: don't update block size after device is started time: Prevent undefined behaviour in timespec64_to_ns() drm/i915/gem: Flush coherency domains on first set-domain-ioctl Linux 5.4.77 powercap: restrict energy meter to root access Linux 5.4.76 arm64: dts: marvell: espressobin: Add ethernet switch aliases perf/core: Fix a memory leak in perf_event_parse_addr_filter() xfs: flush for older, xfs specific ioctls PM: runtime: Resume the device earlier in __device_release_driver() PM: runtime: Drop pm_runtime_clean_up_links() PM: runtime: Drop runtime PM references to supplier on link removal ARC: stack unwinding: avoid indefinite looping drm/panfrost: Fix a deadlock between the shrinker and madvise path usb: mtu3: fix panic in mtu3_gadget_stop() USB: Add NO_LPM quirk for Kingston flash drive usb: dwc3: ep0: Fix delay status handling tty: serial: fsl_lpuart: LS1021A has a FIFO size of 16 words, like LS1028A tty: serial: fsl_lpuart: add LS1028A support USB: serial: option: add Telit FN980 composition 0x1055 USB: serial: option: add LE910Cx compositions 0x1203, 0x1230, 0x1231 USB: serial: option: add Quectel EC200T module support USB: serial: cyberjack: fix write-URB completion race serial: txx9: add missing platform_driver_unregister() on error in serial_txx9_init serial: 8250_mtk: Fix uart_get_baud_rate warning s390/pkey: fix paes selftest failure with paes and pkey static build fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent vt: Disable KD_FONT_OP_COPY Revert "coresight: Make sysfs functional on topologies with per core sink" arm64/smp: Move rcu_cpu_starting() earlier drm/nouveau/gem: fix "refcount_t: underflow; use-after-free" drm/nouveau/nouveau: fix the start/end range for migration usb: cdns3: gadget: suspicious implicit sign extension ACPI: NFIT: Fix comparison to '-ENXIO' drm/vc4: drv: Add error handding for bind nvmet: fix a NULL pointer dereference when tracing the flush command nvme-rdma: handle unexpected nvme completion data length vsock: use ns_capable_noaudit() on socket create scsi: ibmvscsi: Fix potential race after loss of transport drm/amdgpu: add DID for navi10 blockchain SKU scsi: core: Don't start concurrent async scan on same host blk-cgroup: Pre-allocate tree node on blkg_conf_prep blk-cgroup: Fix memleak on error path drm/sun4i: frontend: Fix the scaler phase on A33 drm/sun4i: frontend: Reuse the ch0 phase for RGB formats drm/sun4i: frontend: Rework a bit the phase data of: Fix reserved-memory overlap detection x86/kexec: Use up-to-dated screen_info copy to fill boot params arm64: dts: meson: add missing g12 rng clock ARM: dts: sun4i-a10: fix cpu_alert temperature futex: Handle transient "ownerless" rtmutex state correctly tracing: Fix out of bounds write in get_trace_buf spi: bcm2835: fix gpio cs level inversion regulator: defer probe when trying to get voltage from unresolved supply ftrace: Handle tracing when switching between context ftrace: Fix recursion check for NMI test mtd: spi-nor: Don't copy self-pointing struct around ring-buffer: Fix recursion protection transitions between interrupt context gfs2: Wake up when sd_glock_disposal becomes zero mm: always have io_remap_pfn_range() set pgprot_decrypted() kthread_worker: prevent queuing delayed work from timer_fn when it is being canceled lib/crc32test: remove extra local_irq_disable/enable mm: mempolicy: fix potential pte_unmap_unlock pte error ALSA: usb-audio: Add implicit feedback quirk for MODX ALSA: usb-audio: Add implicit feedback quirk for Qu-16 ALSA: usb-audio: add usb vendor id as DSD-capable for Khadas devices ALSA: usb-audio: Add implicit feedback quirk for Zoom UAC-2 ALSA: hda/realtek - Enable headphone for ASUS TM420 ALSA: hda/realtek - Fixed HP headset Mic can't be detected Fonts: Replace discarded const qualifier sfp: Fix error handing in sfp_probe() sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms powerpc/vnic: Extend "failover pending" window net: usb: qmi_wwan: add Telit LE910Cx 0x1230 composition ip_tunnel: fix over-mtu packet send fail without TUNNEL_DONT_FRAGMENT flags ionic: check port ptr before use gianfar: Account for Tx PTP timestamp in the skb headroom gianfar: Replace skb_realloc_headroom with skb_cow_head for PTP chelsio/chtls: fix always leaking ctrl_skb chelsio/chtls: fix memory leaks caused by a race cadence: force nonlinear buffers to be cloned ptrace: fix task_join_group_stop() for the case when current is traced tipc: fix use-after-free in tipc_bcast_get_mode arm64: Change .weak to SYM_FUNC_START_WEAK_PI for arch/arm64/lib/mem*.S arm64: lib: Use modern annotations for assembly functions arm64: asm: Add new-style position independent function annotations linkage: Introduce new macros for assembler symbols ASoC: Intel: Skylake: Add alternative topology binary name drm/i915: Drop runtime-pm assert from vgpu io accessors drm/i915/gt: Delay execlist processing for tgl drm/i915: Break up error capture compression loops with cond_resched() Linux 5.4.75 staging: octeon: Drop on uncorrectable alignment or FCS error staging: octeon: repair "fixed-link" support staging: comedi: cb_pcidas: Allow 2-channel commands for AO subdevice staging: fieldbus: anybuss: jump to correct label in an error path KVM: arm64: Fix AArch32 handling of DBGD{CCINT,SCRext} and DBGVCR device property: Don't clear secondary pointer for shared primary firmware node device property: Keep secondary firmware node secondary by type ARM: s3c24xx: fix missing system reset ARM: samsung: fix PM debug build with DEBUG_LL but !MMU arm: dts: mt7623: add missing pause for switchport hil/parisc: Disable HIL driver when it gets stuck cachefiles: Handle readpage error correctly arm64: berlin: Select DW_APB_TIMER_OF tty: make FONTX ioctl use the tty pointer they were actually passed drm/amd/pm: increase mclk switch threshold to 200 us mmc: sdhci: Use Auto CMD Auto Select only when v4_mode is true mmc: sdhci-of-esdhc: set timeout to max before tuning drm/ttm: fix eviction valuable range check. ext4: fix invalid inode checksum ext4: fix error handling code in add_new_gdb ext4: fix leaking sysfs kobject after failed mount vringh: fix __vringh_iov() when riov and wiov are different ring-buffer: Return 0 on success from ring_buffer_resize() 9P: Cast to loff_t before multiplying libceph: clear con->out_msg on Policy::stateful_server faults ceph: promote to unsigned long long before shifting drm/amd/display: Fix kernel panic by dal_gpio_open() error drm/amd/display: Don't invoke kgdb_breakpoint() unconditionally drm/amdgpu: increase the reserved VM size to 2MB drm/amd/display: Avoid MST manager resource leak. drm/amdkfd: Use same SQ prefetch setting as amdgpu drm/amdgpu: correct the gpu reset handling for job != NULL case drm/amd/display: Increase timeout for DP Disable drm/amdgpu: don't map BO in reserved region i2c: imx: Fix external abort on interrupt in exit paths rtc: rx8010: don't modify the global rtc ops ia64: fix build error with !COREDUMP ubi: check kthread_should_stop() after the setting of task state ARC: perf: redo the pct irq missing in device-tree handling perf python scripting: Fix printable strings in python3 scripts ubifs: mount_ubifs: Release authentication resource in error handling path ubifs: Don't parse authentication mount options in remount process ubifs: Fix a memleak after dumping authentication mount options ubifs: journal: Make sure to not dirty twice for auth nodes ubifs: xattr: Fix some potential memory leaks while iterating entries ubifs: dent: Fix some potential memory leaks while iterating entries NFSD: Add missing NFSv2 .pc_func methods NFSv4.2: support EXCHGID4_FLAG_SUPP_FENCE_OPS 4.2 EXCHANGE_ID flag NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation powerpc/powermac: Fix low_sleep_handler with KUAP and KUEP powerpc/powernv/elog: Fix race while processing OPAL error log event. powerpc/memhotplug: Make lmb size 64bit powerpc: Warn about use of smt_snooze_delay powerpc/rtas: Restrict RTAS requests from userspace s390/stp: add locking to sysfs functions MIPS: DEC: Restore bootmem reservation for firmware working memory area powerpc/drmem: Make lmb_size 64 bit iio:gyro:itg3200: Fix timestamp alignment and prevent data leak. iio:adc:ti-adc12138 Fix alignment issue with timestamp iio:adc:ti-adc0832 Fix alignment issue with timestamp iio: adc: gyroadc: fix leak of device node iterator iio:light:si1145: Fix timestamp alignment and prevent data leak. dmaengine: dma-jz4780: Fix race in jz4780_dma_tx_status udf: Fix memory leak when mounting HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery vt: keyboard, extend func_buf_lock to readers vt: keyboard, simplify vt_kdgkbsent drm/i915: Force VT'd workarounds when running as a guest OS usb: host: fsl-mph-dr-of: check return of dma_set_mask() usb: typec: tcpm: reset hard_reset_count for any disconnect usb: cdc-acm: fix cooldown mechanism usb: dwc3: gadget: END_TRANSFER before CLEAR_STALL command usb: dwc3: gadget: Resume pending requests after CLEAR_STALL usb: dwc3: core: don't trigger runtime pm when remove driver usb: dwc3: core: add phy cleanup for probe error handling usb: dwc3: gadget: Check MPS of the request length usb: dwc3: ep0: Fix ZLP for OUT ep0 requests usb: dwc3: pci: Allow Elkhart Lake to utilize DSM method for PM functionality usb: xhci: Workaround for S3 issue on AMD SNPS 3.0 xHC btrfs: fix readahead hang and use-after-free after removing a device btrfs: fix use-after-free on readahead extent after failure to create it btrfs: tree-checker: validate number of chunk stripes and parity btrfs: cleanup cow block on error btrfs: tree-checker: fix false alert caused by legacy btrfs root item btrfs: use kvzalloc() to allocate clone_roots in btrfs_ioctl_send() btrfs: send, recompute reference path after orphanization of a directory btrfs: send, orphanize first all conflicting inodes when processing references btrfs: reschedule if necessary when logging directory items btrfs: improve device scanning messages btrfs: qgroup: fix wrong qgroup metadata reserve for delayed inode PM: runtime: Remove link state checks in rpm_get/put_supplier() scsi: qla2xxx: Fix crash on session cleanup with unload scsi: mptfusion: Fix null pointer dereferences in mptscsih_remove() w1: mxc_w1: Fix timeout resolution problem leading to bus error acpi-cpufreq: Honor _PSD table setting on new AMD CPUs ACPI: EC: PM: Drop ec_no_wakeup check from acpi_ec_dispatch_gpe() ACPI: EC: PM: Flush EC work unconditionally after wakeup PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI ACPI: debug: don't allow debugging when ACPI is disabled ACPI: video: use ACPI backlight for HP 635 Notebook ACPI / extlog: Check for RDMSR failure ACPI: button: fix handling lid state changes when input device closed NFS: fix nfs_path in case of a rename retry fs: Don't invalidate page buffers in block_write_full_page() media: uvcvideo: Fix uvc_ctrl_fixup_xu_info() not having any effect leds: bcm6328, bcm6358: use devres LED registering function extcon: ptn5150: Fix usage of atomic GPIO with sleeping GPIO chips spi: sprd: Release DMA channel also on probe deferral perf/x86/amd/ibs: Fix raw sample data accumulation perf/x86/amd/ibs: Don't include randomized bits in get_ibs_op_count() perf/x86/intel: Fix Ice Lake event constraint table selftests/x86/fsgsbase: Test PTRACE_PEEKUSER for GSBASE with invalid LDT GS seccomp: Make duplicate listener detection non-racy mmc: sdhci-acpi: AMDI0040: Set SDHCI_QUIRK2_PRESET_VALUE_BROKEN mmc: sdhci: Add LTR support for some Intel BYT based controllers md/raid5: fix oops during stripe resizing nvme-rdma: fix crash when connect rejected sgl_alloc_order: fix memory leak nbd: make the config put is called before the notifying the waiter ARM: dts: s5pv210: remove dedicated 'audio-subsystem' node ARM: dts: s5pv210: move PMU node out of clock controller ARM: dts: s5pv210: move fixed clocks under root node ARM: dts: s5pv210: remove DMA controller bus node name to fix dtschema warnings memory: emif: Remove bogus debugfs error handling ARM: dts: omap4: Fix sgx clock rate for 4430 arm64: dts: renesas: ulcb: add full-pwr-cycle-in-suspend into eMMC nodes cifs: handle -EINTR in cifs_setattr gfs2: add validation checks for size of superblock gfs2: use-after-free in sysfs deregistration KVM: PPC: Book3S HV: Do not allocate HPT for a nested guest ext4: Detect already used quota file early drivers: watchdog: rdc321x_wdt: Fix race condition bugs net: 9p: initialize sun_server.sun_path to have addr's value only when addr is valid clk: ti: clockdomain: fix static checker warning rpmsg: glink: Use complete_all for open states bnxt_en: Log unknown link speed appropriately. md/bitmap: md_bitmap_get_counter returns wrong blocks btrfs: fix replace of seed device ARC: [dts] fix the errors detected by dtbs_check drm/amd/display: HDMI remote sink need mode validation for Linux power: supply: test_power: add missing newlines when printing parameters by sysfs ACPI: HMAT: Fix handling of changes from ACPI 6.2 to ACPI 6.3 bus/fsl_mc: Do not rely on caller to provide non NULL mc_io drivers/net/wan/hdlc_fr: Correctly handle special skb->protocol values brcmfmac: Fix warning message after dongle setup failed ACPI: Add out of bounds and numa_off protections to pxm_to_node() xfs: don't free rt blocks when we're doing a REMAP bunmapi call can: flexcan: disable clocks during stop mode arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE SUNRPC: Mitigate cond_resched() in xprt_transmit() usb: xhci: omit duplicate actions when suspending a runtime suspended host. coresight: Make sysfs functional on topologies with per core sink uio: free uio id after uio file node is freed USB: adutux: fix debugging cpufreq: sti-cpufreq: add stih418 support riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO samples/bpf: Fix possible deadlock in xdpsock selftests/bpf: Define string const as global for test_sysctl_prog.c media: uvcvideo: Fix dereference of out-of-bound list iterator bpf: Permit map_ptr arithmetic with opcode add and offset 0 kgdb: Make "kgdbcon" work properly with "kgdb_earlycon" ia64: kprobes: Use generic kretprobe trampoline handler printk: reduce LOG_BUF_SHIFT range for H8300 arm64: topology: Stop using MPIDR for topology information drm/bridge/synopsys: dsi: add support for non-continuous HS clock mmc: via-sdmmc: Fix data race bug media: imx274: fix frame interval handling media: tw5864: check status of tw5864_frameinterval_get usb: typec: tcpm: During PR_SWAP, source caps should be sent only after tSwapSourceStart media: platform: Improve queue set up flow for bug fixing media: videodev2.h: RGB BT2020 and HSV are always full range selftests/x86/fsgsbase: Reap a forgotten child drm/brige/megachips: Add checking if ge_b850v3_lvds_init() is working correctly ath10k: fix VHT NSS calculation when STBC is enabled ath10k: start recovery process when payload length exceeds max htc length for sdio video: fbdev: pvr2fb: initialize variables xfs: fix realtime bitmap/summary file truncation when growing rt volume power: supply: bq27xxx: report "not charging" on all types NFS4: Fix oops when copy_file_range is attempted with NFS4.0 source ARM: 8997/2: hw_breakpoint: Handle inexact watchpoint addresses f2fs: handle errors of f2fs_get_meta_page_nofail um: change sigio_spinlock to a mutex s390/startup: avoid save_area_sync overflow f2fs: fix to check segment boundary during SIT page readahead f2fs: fix uninit-value in f2fs_lookup f2fs: add trace exit in exception path sparc64: remove mm_cpumask clearing to fix kthread_use_mm race powerpc: select ARCH_WANT_IRQS_OFF_ACTIVATE_MM mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race powerpc/powernv/smp: Fix spurious DBG() warning futex: Fix incorrect should_fail_futex() handling ata: sata_nv: Fix retrieving of active qcs RDMA/qedr: Fix memory leak in iWARP CM mlxsw: core: Fix use-after-free in mlxsw_emad_trans_finish() x86/unwind/orc: Fix inactive tasks with stack pointer in %sp on GCC 10 compiled kernels firmware: arm_scmi: Add missing Rx size re-initialisation firmware: arm_scmi: Fix ARCH_COLD_RESET xen/events: block rogue events for some time xen/events: defer eoi in case of excessive number of events xen/events: use a common cpu hotplug hook for event channels xen/events: switch user event channels to lateeoi model xen/pciback: use lateeoi irq binding xen/pvcallsback: use lateeoi irq binding xen/scsiback: use lateeoi irq binding xen/netback: use lateeoi irq binding xen/blkback: use lateeoi irq binding xen/events: add a new "late EOI" evtchn framework xen/events: fix race in evtchn_fifo_unmask() xen/events: add a proper barrier to 2-level uevent unmasking xen/events: avoid removing an event channel while handling it ANDROID: GKI: fix up include/linux/pm.h to handle some abi changes Linux 5.4.74 phy: marvell: comphy: Convert internal SMCC firmware return codes to errno misc: rtsx: do not setting OC_POWER_DOWN reg in rtsx_pci_init_ocp() openrisc: Fix issue with get_user for 64-bit values crypto: x86/crc32c - fix building with clang ias xen/gntdev.c: Mark pages as dirty ata: sata_rcar: Fix DMA boundary mask PM: runtime: Fix timer_expires data type on 32-bit arches serial: pl011: Fix lockdep splat when handling magic-sysrq interrupt serial: qcom_geni_serial: To correct QUP Version detection logic mtd: lpddr: Fix bad logic in print_drs_error RDMA/addr: Fix race with netevent_callback()/rdma_addr_cancel() cxl: Rework error message for incompatible slots p54: avoid accessing the data mapped to streaming DMA evm: Check size of security.evm before using it bpf: Fix comment for helper bpf_current_task_under_cgroup() fuse: fix page dereference after free ata: ahci: mvebu: Make SATA PHY optional for Armada 3720 x86/xen: disable Firmware First mode for correctable memory errors arch/x86/amd/ibs: Fix re-arming IBS Fetch erofs: avoid duplicated permission check for "trusted." xattrs bnxt_en: Invoke cancel_delayed_work_sync() for PFs also. bnxt_en: Fix regression in workqueue cleanup logic in bnxt_remove_one(). bnxt_en: Re-write PCI BARs after PCI fatal error. net: hns3: Clear the CMDQ registers before unmapping BAR region tipc: fix memory leak caused by tipc_buf_append() tcp: Prevent low rmem stalls with SO_RCVLOWAT. ravb: Fix bit fields checking in ravb_hwtstamp_get() r8169: fix issue with forced threading in combination with shared interrupts net/sched: act_mpls: Add softdep on mpls_gso.ko netem: fix zero division in tabledist mlxsw: core: Fix memory leak on module removal ibmvnic: fix ibmvnic_set_mac gtp: fix an use-before-init in gtp_newlink() cxgb4: set up filter action after rewrites chelsio/chtls: fix tls record info to user chelsio/chtls: fix memory leaks in CPL handlers chelsio/chtls: fix deadlock issue bnxt_en: Send HWRM_FUNC_RESET fw command unconditionally. bnxt_en: Check abort error state in bnxt_open_nic(). efivarfs: Replace invalid slashes with exclamation marks in dentries. x86/PCI: Fix intel_mid_pci.c build error when ACPI is not enabled arm64: link with -z norelro regardless of CONFIG_RELOCATABLE arm64: Run ARCH_WORKAROUND_2 enabling code on all CPUs arm64: Run ARCH_WORKAROUND_1 enabling code on all CPUs scripts/setlocalversion: make git describe output more reliable objtool: Support Clang non-section symbols in ORC generation socket: don't clear SOCK_TSTAMP_NEW when SO_TIMESTAMPNS is disabled netfilter: nftables_offload: KASAN slab-out-of-bounds Read in nft_flow_rule_create Revert "PCI/IOV: Mark VFs as not implementing PCI_COMMAND_MEMORY" Revert "vfio/pci: Decouple PCI_COMMAND_MEMORY bit checks from is_virtfn" Linux 5.4.73 usb: gadget: f_ncm: allow using NCM in SuperSpeed Plus gadgets. eeprom: at25: set minimum read/write access stride to 1 usb: cdns3: gadget: free interrupt after gadget has deleted USB: cdc-wdm: Make wdm_flush() interruptible and add wdm_fsync(). usb: cdc-acm: add quirk to blacklist ETAS ES58X devices tty: serial: fsl_lpuart: fix lpuart32_poll_get_char tty: serial: lpuart: fix lpuart32_write usage s390/qeth: don't let HW override the configured port role net: korina: cast KSEG0 address to pointer in kfree ath10k: check idx validity in __ath10k_htt_rx_ring_fill_n() dmaengine: dw: Activate FIFO-mode for memory peripherals only dmaengine: dw: Add DMA-channels mask cell support scsi: ufs: ufs-qcom: Fix race conditions caused by ufs_qcom_testbus_config() usb: core: Solve race condition in anchor cleanup functions brcm80211: fix possible memleak in brcmf_proto_msgbuf_attach scsi: smartpqi: Avoid crashing kernel for controller issues ALSA: hda/ca0132 - Add new quirk ID for SoundBlaster AE-7. ALSA: hda/ca0132 - Add AE-7 microphone selection commands. mwifiex: don't call del_timer_sync() on uninitialized timer reiserfs: Fix memory leak in reiserfs_parse_options() ipvs: Fix uninit-value in do_ip_vs_set_ctl() Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb tty: ipwireless: fix error handling fbmem: add margin check to fb_check_caps() scsi: qedi: Fix list_del corruption while removing active I/O scsi: qedi: Protect active command list to avoid list corruption scsi: qedf: Return SUCCESS if stale rport is encountered HID: ite: Add USB id match for Acer One S1003 keyboard dock Fix use after free in get_capset_info callback. rtl8xxxu: prevent potential memory leak brcmsmac: fix memory leak in wlc_phy_attach_lcnphy selftests/bpf: Fix test_sysctl_loop{1, 2} failure due to clang change scsi: qla2xxx: Warn if done() or free() are called on an already freed srb scsi: ibmvfc: Fix error return in ibmvfc_probe() iomap: fix WARN_ON_ONCE() from unprivileged users drm/msm/a6xx: fix a potential overflow issue Bluetooth: Only mark socket zapped after unlocking usb: ohci: Default to per-port over-current protection xfs: make sure the rt allocator doesn't run off the end opp: Prevent memory leak in dev_pm_opp_attach_genpd() reiserfs: only call unlock_new_inode() if I_NEW misc: rtsx: Fix memory leak in rtsx_pci_probe bpf: Limit caller's stack depth 256 for subprogs with tailcalls drm/panfrost: add amlogic reset quirk callback ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs() can: flexcan: flexcan_chip_stop(): add error handling and propagate error value usb: dwc3: simple: add support for Hikey 970 USB: cdc-acm: handle broken union descriptors rtw88: increse the size of rx buffer size udf: Avoid accessing uninitialized data on failed inode read udf: Limit sparing table size usb: gadget: function: printer: fix use-after-free in __lock_acquire usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc misc: vop: add round_up(x,4) for vring_size to avoid kernel panic mic: vop: copy data to kernel space then write to io memory scsi: target: core: Add CONTROL field for trace events scsi: mvumi: Fix error return in mvumi_io_attach() PM: hibernate: remove the bogus call to get_gendisk() in software_resume() mac80211: handle lack of sband->bitrates in rates ip_gre: set dev->hard_header_len and dev->needed_headroom properly ntfs: add check for mft record size in superblock media: venus: core: Fix runtime PM imbalance in venus_probe fs: dlm: fix configfs memory leak media: venus: fixes for list corruption media: saa7134: avoid a shift overflow mmc: sdio: Check for CISTPL_VERS_1 buffer size media: uvcvideo: Ensure all probed info is returned to v4l2 x86/mce: Make mce_rdmsrl() panic on an inaccessible MSR media: media/pci: prevent memory leak in bttv_probe media: bdisp: Fix runtime PM imbalance on error media: platform: sti: hva: Fix runtime PM imbalance on error media: platform: s3c-camif: Fix runtime PM imbalance on error media: vsp1: Fix runtime PM imbalance on error media: exynos4-is: Fix a reference count leak media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync media: sti: Fix reference count leaks media: st-delta: Fix reference count leak in delta_run_work media: ati_remote: sanity check for both endpoints media: firewire: fix memory leak x86/mce: Add Skylake quirk for patrol scrub reported errors x86/asm: Replace __force_order with a memory clobber crypto: ccp - fix error handling block: ratelimit handle_bad_sector() message md/bitmap: fix memory leak of temporary bitmap i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs perf: correct SNOOPX field offset sched/features: Fix !CONFIG_JUMP_LABEL case NTB: hw: amd: fix an issue about leak system resources nvmet: fix uninitialized work for zero kato powerpc/pseries: Avoid using addr_to_pfn in real mode powerpc/powernv/dump: Fix race while processing OPAL dump lightnvm: fix out-of-bounds write to array devices->info[] ARM: dts: meson8: remove two invalid interrupt lines from the GPU node arm64: dts: zynqmp: Remove additional compatible string for i2c IPs ARM: OMAP2+: Restore MPU power domain if cpu_cluster_pm_enter() fails soc: fsl: qbman: Fix return value on success ARM: dts: owl-s500: Fix incorrect PPI interrupt specifiers arm64: dts: actions: limit address range for pinctrl node arm64: dts: renesas: r8a774c0: Fix MSIOF1 DMA channels arm64: dts: renesas: r8a77990: Fix MSIOF1 DMA channels arm64: dts: qcom: msm8916: Fix MDP/DSI interrupts arm64: dts: qcom: pm8916: Remove invalid reg size from wcd_codec arm64: dts: qcom: msm8916: Remove one more thermal trip point unit name arm64: dts: imx8mq: Add missing interrupts to GPC memory: fsl-corenet-cf: Fix handling of platform_get_irq() error memory: omap-gpmc: Fix build error without CONFIG_OF memory: omap-gpmc: Fix a couple off by ones arm64: dts: allwinner: h5: remove Mali GPU PMU module ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix dcdc1 regulator ARM: s3c24xx: fix mmc gpio lookup tables ARM: at91: pm: of_node_put() after its usage ARM: dts: imx6sl: fix rng node arm64: dts: meson: vim3: correct led polarity netfilter: nf_fwd_netdev: clear timestamp in forwarding path netfilter: ebtables: Fixes dropping of small packets in bridge nat netfilter: conntrack: connection timeout after re-register scsi: bfa: Fix error return in bfad_pci_init() KVM: x86: emulating RDPID failure shall return #UD rather than #GP Input: sun4i-ps2 - fix handling of platform_get_irq() error Input: twl4030_keypad - fix handling of platform_get_irq() error Input: omap4-keypad - fix handling of platform_get_irq() error Input: ep93xx_keypad - fix handling of platform_get_irq() error Input: stmfts - fix a & vs && typo Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume() SUNRPC: fix copying of multiple pages in gss_read_proxy_verf() clk: imx8mq: Fix usdhc parents order vfio iommu type1: Fix memory leak in vfio_iommu_type1_pin_pages vfio/pci: Clear token on bypass registration failure ext4: limit entries returned when counting fsmap records svcrdma: fix bounce buffers for unaligned offsets and multiple pages watchdog: sp5100: Fix definition of EFCH_PM_DECODEEN3 watchdog: Use put_device on error watchdog: Fix memleak in watchdog_cdev_register clk: bcm2835: add missing release if devm_clk_hw_register fails clk: at91: clk-main: update key before writing AT91_CKGR_MOR module: statically initialize init section freeing data clk: mediatek: add UART0 clock support clk: rockchip: Initialize hw to error to avoid undefined behavior pwm: img: Fix null pointer access in probe clk: keystone: sci-clk: fix parsing assigned-clock data during probe clk: qcom: gcc-sdm660: Fix wrong parent_map vfio/pci: Decouple PCI_COMMAND_MEMORY bit checks from is_virtfn PCI/IOV: Mark VFs as not implementing PCI_COMMAND_MEMORY rpmsg: smd: Fix a kobj leak in in qcom_smd_parse_edge() PCI: iproc: Set affinity mask on MSI interrupts PCI: aardvark: Check for errors from pci_bridge_emul_init() call clk: meson: g12a: mark fclk_div2 as critical i2c: rcar: Auto select RESET_CONTROLLER mailbox: avoid timer start from callback rapidio: fix the missed put_device() for rio_mport_add_riodev rapidio: fix error handling path ramfs: fix nommu mmap with gaps in the page cache lib/crc32.c: fix trivial typo in preprocessor condition mm/page_owner: change split_page_owner to take a count RDMA/rxe: Handle skb_clone() failure in rxe_recv.c f2fs: wait for sysfs kobject removal before freeing f2fs_sb_info selftests/powerpc: Fix eeh-basic.sh exit codes maiblox: mediatek: Fix handling of platform_get_irq() error RDMA/rxe: Fix skb lifetime in rxe_rcv_mcast_pkt() IB/rdmavt: Fix sizeof mismatch cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier i3c: master: Fix error return in cdns_i3c_master_probe() powerpc/perf/hv-gpci: Fix starting index value powerpc/perf: Exclude pmc5/6 from the irrelevant PMU group constraints RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces overflow: Include header file with SIZE_MAX declaration kdb: Fix pager search for multi-line strings mtd: spinand: gigadevice: Add QE Bit mtd: spinand: gigadevice: Only one dummy byte in QUADIO mtd: rawnand: vf610: disable clk on error handling path in probe RDMA/hns: Fix missing sq_sig_type when querying QP RDMA/hns: Fix the wrong value of rnr_retry when querying qp perf stat: Skip duration_time in setup_system_wide i40iw: Add support to make destroy QP synchronous RDMA/mlx5: Disable IB_DEVICE_MEM_MGT_EXTENSIONS if IB_WR_REG_MR can't work RDMA/hns: Set the unsupported wr opcode perf intel-pt: Fix "context_switch event has no tid" error RDMA/cma: Consolidate the destruction of a cma_multicast in one place RDMA/cma: Remove dead code for kernel rdmacm multicast powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm powerpc/tau: Disable TAU between measurements powerpc/tau: Check processor type before enabling TAU interrupt powerpc/tau: Remove duplicated set_thresholds() call powerpc/tau: Convert from timer to workqueue powerpc/tau: Use appropriate temperature sample interval powerpc/book3s64/hash/4k: Support large linear mapping range with 4K RDMA/qedr: Fix inline size returned for iWARP RDMA/qedr: Fix return code if accept is called on a destroyed qp RDMA/qedr: Fix use of uninitialized field RDMA/qedr: Fix qp structure memory leak RDMA/umem: Prevent small pages from being returned by ib_umem_find_best_pgsz() RDMA/umem: Fix ib_umem_find_best_pgsz() for mappings that cross a page boundary xfs: fix high key handling in the rt allocator's query_range function xfs: fix deadlock and streamline xfs_getfsmap performance xfs: limit entries returned when counting fsmap records ida: Free allocated bitmap in error path arc: plat-hsdk: fix kconfig dependency warning when !RESET_CONTROLLER ARM: 9007/1: l2c: fix prefetch bits init in L2X0_AUX_CTRL using DT values mtd: mtdoops: Don't write panic data twice RDMA/mlx5: Fix potential race between destroy and CQE poll pseries/drmem: don't cache node id in drmem_lmb struct powerpc/pseries: explicitly reschedule during drmem_lmb list traversal RDMA/umem: Fix signature of stub ib_umem_find_best_pgsz() RDMA/hns: Add a check for current state before modifying QP mtd: lpddr: fix excessive stack usage with clang RDMA/ucma: Add missing locking around rdma_leave_multicast() RDMA/ucma: Fix locking for ctx->events_reported powerpc/icp-hv: Fix missing of_node_put() in success path powerpc/pseries: Fix missing of_node_put() in rng_init() IB/mlx4: Adjust delayed work when a dup is observed IB/mlx4: Fix starvation in paravirt mux/demux i3c: master add i3c_master_attach_boardinfo to preserve boardinfo selftests/ftrace: Change synthetic event name for inter-event-combined test fs: fix NULL dereference due to data race in prepend_path() mm, oom_adj: don't loop through tasks in __set_oom_adj when not necessary mm/memcg: fix device private memcg accounting mm/swapfile.c: fix potential memory leak in sys_swapon netfilter: nf_log: missing vlan offload tag and proto net: korina: fix kfree of rx/tx descriptor array ipvs: clear skb->tstamp in forwarding path mwifiex: fix double free platform/x86: mlx-platform: Remove PSU EEPROM configuration ipmi_si: Fix wrong return value in try_smi_init() scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs() scsi: target: tcmu: Fix warning: 'page' may be used uninitialized usb: dwc2: Fix INTR OUT transfers in DDMA mode. nl80211: fix non-split wiphy information usb: gadget: u_ether: enable qmult on SuperSpeed Plus as well usb: gadget: f_ncm: fix ncm_bitrate for SuperSpeed and above. iwlwifi: mvm: split a print to avoid a WARNING in ROC mfd: sm501: Fix leaks in probe() net: enic: Cure the enic api locking trainwreck iio: adc: stm32-adc: fix runtime autosuspend delay when slow polling qtnfmac: fix resource leaks on unsupported iftype error return path ibmvnic: set up 200GBPS speed coresight: etm: perf: Fix warning caused by etm_setup_aux failure nl80211: fix OBSS PD min and max offset validation nvmem: core: fix possibly memleak when use nvmem_cell_info_to_nvmem_cell() HID: hid-input: fix stylus battery reporting ASoC: fsl_sai: Instantiate snd_soc_dai_driver slimbus: qcom-ngd-ctrl: disable ngd in qmi server down callback slimbus: core: do not enter to clock pause mode in core slimbus: core: check get_addr before removing laddr ida quota: clear padding in v2r1_mem2diskdqb() usb: dwc2: Fix parameter type in function pointer prototype ALSA: seq: oss: Avoid mutex lock for a long-time ioctl misc: mic: scif: Fix error handling path dmaengine: dmatest: Check list for emptiness before access its last entry ath6kl: wmi: prevent a shift wrapping bug in ath6kl_wmi_delete_pstream_cmd() spi: omap2-mcspi: Improve performance waiting for CHSTAT net: dsa: rtl8366rb: Support all 4096 VLANs ASoC: tlv320aic32x4: Fix bdiv clock rate derivation net: wilc1000: clean up resource in error path of init mon interface net: dsa: rtl8366: Skip PVID setting if not requested net: dsa: rtl8366: Refactor VLAN/PVID init net: dsa: rtl8366: Check validity of passed VLANs xhci: don't create endpoint debugfs entry before ring buffer is set. coresight: etm4x: Handle unreachable sink in perf mode drm: mxsfb: check framebuffer pitch cpufreq: armada-37xx: Add missing MODULE_DEVICE_TABLE net: stmmac: use netif_tx_start|stop_all_queues() function scsi: mpt3sas: Fix sync irqs net/mlx5: Don't call timecounter cyc2time directly from 1PPS flow pinctrl: mcp23s08: Fix mcp23x17 precious range pinctrl: mcp23s08: Fix mcp23x17_regmap initialiser iomap: Clear page error before beginning a write drm/panfrost: Ensure GPU quirks are always initialised drm/msm: Avoid div-by-zero in dpu_crtc_atomic_check() HID: roccat: add bounds checking in kone_sysfs_write_settings() ASoC: fsl: imx-es8328: add missing put_device() call in imx_es8328_probe() video: fbdev: radeon: Fix memleak in radeonfb_pci_register video: fbdev: sis: fix null ptr dereference video: fbdev: vga16fb: fix setting of pixclock because a pass-by-value error drivers/virt/fsl_hypervisor: Fix error handling path pwm: lpss: Add range limit check for the base_unit register value pwm: lpss: Fix off by one error in base_unit math in pwm_lpss_prepare() pty: do tty_flip_buffer_push without port->lock in pty_write tty: hvcs: Don't NULL tty->driver_data until hvcs_cleanup() tty: serial: earlycon dependency binder: Remove bogus warning on failed same-process transaction drm/crc-debugfs: Fix memleak in crc_control_write drm: panel: Fix bpc for OrtusTech COM43H4M85ULC panel mm/error_inject: Fix allow_error_inject function signatures. VMCI: check return value of get_user_pages_fast() for errors staging: emxx_udc: Fix passing of NULL to dma_alloc_coherent() backlight: sky81452-backlight: Fix refcount imbalance on error scsi: csiostor: Fix wrong return value in csio_hw_prep_fw() scsi: qla2xxx: Fix wrong return value in qla_nvme_register_hba() scsi: qla2xxx: Fix wrong return value in qlt_chk_unresolv_exchg() scsi: qla4xxx: Fix an error handling path in 'qla4xxx_get_host_stats()' drm/gma500: fix error check staging: rtl8192u: Do not use GFP_KERNEL in atomic context mwifiex: Do not use GFP_KERNEL in atomic context brcmfmac: check ndev pointer ASoC: qcom: lpass-cpu: fix concurrency issue ASoC: qcom: lpass-platform: fix memory leak wcn36xx: Fix reported 802.11n rx_highest rate wcn3660/wcn3680 ath10k: Fix the size used in a 'dma_free_coherent()' call in an error handling path ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb() ath6kl: prevent potential array overflow in ath6kl_add_new_sta() drm: panel: Fix bus format for OrtusTech COM43H4M85ULC panel drm/amd/display: Fix wrong return value in dm_update_plane_state() Bluetooth: hci_uart: Cancel init work before unregistering drm/vkms: fix xrgb on compute crc ath10k: provide survey info as accumulated data blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue spi: spi-s3c64xx: Check return values spi: spi-s3c64xx: swap s3c64xx_spi_set_cs() and s3c64xx_enable_datapath() pinctrl: bcm: fix kconfig dependency warning when !GPIOLIB regulator: resolve supply after creating regulator media: ti-vpe: Fix a missing check and reference count leak media: stm32-dcmi: Fix a reference count leak media: s5p-mfc: Fix a reference count leak media: camss: Fix a reference count leak. media: platform: fcp: Fix a reference count leak. media: rockchip/rga: Fix a reference count leak. media: rcar-vin: Fix a reference count leak. media: tc358743: cleanup tc358743_cec_isr media: tc358743: initialize variable media: mx2_emmaprp: Fix memleak in emmaprp_probe cypto: mediatek - fix leaks in mtk_desc_ring_alloc hwmon: (pmbus/max34440) Fix status register reads for MAX344{51,60,61} crypto: omap-sham - fix digcnt register handling with export/import media: rcar-csi2: Allocate v4l2_async_subdev dynamically media: rcar_drif: Allocate v4l2_async_subdev dynamically media: rcar_drif: Fix fwnode reference leak when parsing DT media: i2c: ov5640: Enable data pins on poweron for DVP mode media: i2c: ov5640: Separate out mipi configuration from s_power media: i2c: ov5640: Remain in power down for DVP mode unless streaming media: omap3isp: Fix memleak in isp_probe media: staging/intel-ipu3: css: Correctly reset some memory media: uvcvideo: Silence shift-out-of-bounds warning media: uvcvideo: Set media controller entity functions media: m5mols: Check function pointer in m5mols_sensor_power media: ov5640: Correct Bit Div register in clock tree diagram media: Revert "media: exynos4-is: Add missed check for pinctrl_lookup_state()" media: tuner-simple: fix regression in simple_set_radio_freq crypto: picoxcell - Fix potential race condition bug crypto: ixp4xx - Fix the size used in a 'dma_free_coherent()' call crypto: mediatek - Fix wrong return value in mtk_desc_ring_alloc() crypto: algif_skcipher - EBUSY on aio should be an error x86/events/amd/iommu: Fix sizeof mismatch x86/nmi: Fix nmi_handle() duration miscalculation perf/x86/intel/uncore: Reduce the number of CBOX counters perf/x86/intel/uncore: Update Ice Lake uncore units sched/fair: Fix wrong cpu selecting from isolated domain drivers/perf: thunderx2_pmu: Fix memory resource error handling drivers/perf: xgene_pmu: Fix uninitialized resource struct x86/fpu: Allow multiple bits in clearcpuid= parameter perf/x86/intel/ds: Fix x86_pmu_stop warning for large PEBS EDAC/ti: Fix handling of platform_get_irq() error EDAC/aspeed: Fix handling of platform_get_irq() error EDAC/i5100: Fix error handling order in i5100_init_one() crypto: caam/qi - add fallback for XTS with more than 8B IV crypto: algif_aead - Do not set MAY_BACKLOG on the async path ima: Don't ignore errors from crypto_shash_update() KVM: SVM: Initialize prev_ga_tag before use KVM: x86/mmu: Commit zap of remaining invalid pages when recovering lpages KVM: nVMX: Reload vmcs01 if getting vmcs12's pages fails KVM: nVMX: Reset the segment cache when stuffing guest segs SMB3: Resolve data corruption of TCP server info fields cifs: Return the error from crypt_message when enc/dec key not found. cifs: remove bogus debug code ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887 ALSA: hda/realtek - Add mute Led support for HP Elitebook 845 G7 ALSA: hda/realtek - set mic to auto detect on a HP AIO machine ALSA: hda/realtek - The front Mic on a HP machine doesn't work icmp: randomize the global rate limiter tcp: fix to update snd_wl1 in bulk receiver fast path selftests: rtnetlink: load fou module for kci_test_encap_fou() test selftests: forwarding: Add missing 'rp_filter' configuration r8169: fix operation under forced interrupt threading nfc: Ensure presence of NFC_ATTR_FIRMWARE_NAME attribute in nfc_genl_fw_download() nexthop: Fix performance regression in nexthop deletion net/sched: act_tunnel_key: fix OOB write in case of IPv6 ERSPAN tunnels net: Properly typecast int values to set sk_max_pacing_rate net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device net: ftgmac100: Fix Aspeed ast2600 TX hang issue ibmvnic: save changed mac address to adapter->mac_addr chelsio/chtls: correct function return and return type chelsio/chtls: correct netdevice for vlan interface chelsio/chtls: fix socket lock nvme-pci: disable the write zeros command for Intel 600P/P3100 ALSA: hda/hdmi: fix incorrect locking in hdmi_pcm_close ALSA: hda: fix jack detection with Realtek codecs when in D3 ALSA: bebob: potential info leak in hwdep_read() binder: fix UAF when releasing todo list cxgb4: handle 4-tuple PEDIT to NAT mode translation r8169: fix data corruption issue on RTL8402 net_sched: remove a redundant goto chain check net/ipv4: always honour route mtu during forwarding net: j1939: j1939_session_fresh_new(): fix missing initialization of skbcnt can: j1935: j1939_tp_tx_dat_new(): fix missing initialization of skbcnt can: m_can_platform: don't call m_can_class_suspend in runtime suspend socket: fix option SO_TIMESTAMPING_NEW tipc: fix the skb_unshare() in tipc_buf_append() net: usb: qmi_wwan: add Cellient MPL200 card net/tls: sendfile fails with ktls offload net/smc: fix valid DMBE buffer sizes net: fix pos incrementment in ipv6_route_seq_next net: fec: Fix PHY init after phy_reset_after_clk_enable() net: fec: Fix phy_device lookup for phy_reset_after_clk_enable() mlx4: handle non-napi callers to napi_poll ipv4: Restore flowi4_oif update before call to xfrm_lookup_route ibmveth: Identify ingress large send packets. ibmveth: Switch order of ibmveth_helper calls. Linux 5.4.72 crypto: qat - check cipher length for aead AES-CBC-HMAC-SHA crypto: bcm - Verify GCM/CCM key length in setkey xen/events: don't use chip_data for legacy IRQs reiserfs: Fix oops during mount reiserfs: Initialize inode keys properly USB: serial: ftdi_sio: add support for FreeCalypso JTAG+UART adapters USB: serial: pl2303: add device-id for HP GC device staging: comedi: check validity of wMaxPacketSize of usb endpoints found USB: serial: option: Add Telit FT980-KS composition USB: serial: option: add Cellient MPL200 card media: usbtv: Fix refcounting mixup Bluetooth: Disconnect if E0 is used for Level 4 Bluetooth: Fix update of connection state in `hci_encrypt_cfm` Bluetooth: Consolidate encryption handling in hci_encrypt_cfm Bluetooth: MGMT: Fix not checking if BT_HS is enabled Bluetooth: L2CAP: Fix calling sk_filter on non-socket based channel Bluetooth: A2MP: Fix not initializing all members ACPI: Always build evged in ARM: 8939/1: kbuild: use correct nm executable btrfs: take overcommit into account in inc_block_group_ro btrfs: don't pass system_chunk into can_overcommit perf cs-etm: Move definition of 'traceid_list' global variable from header file Linux 5.4.71 net_sched: commit action insertions together net_sched: defer tcf_idr_insert() in tcf_action_init_1() net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails Input: ati_remote2 - add missing newlines when printing module parameters net/mlx5e: Fix driver's declaration to support GRE offload net/tls: race causes kernel panic net/core: check length before updating Ethertype in skb_mpls_{push,pop} tcp: fix receive window update in tcp_add_backlog() mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged mmc: core: don't set limits.discard_granularity as 0 perf: Fix task_function_call() error handling rxrpc: Fix server keyring leak rxrpc: The server keyring isn't network-namespaced rxrpc: Fix some missing _bh annotations on locking conn->state_lock rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read() rxrpc: Fix rxkad token xdr encoding net/mlx5e: Fix VLAN create flow net/mlx5e: Fix VLAN cleanup flow net/mlx5e: Add resiliency in Striding RQ mode for packets larger than MTU net/mlx5: Fix request_irqs error flow net/mlx5: Avoid possible free of command entry while timeout comp handler virtio-net: don't disable guest csum when disable LRO net: usb: ax88179_178a: fix missing stop entry in driver_info r8169: fix RTL8168f/RTL8411 EPHY config mlxsw: spectrum_acl: Fix mlxsw_sp_acl_tcam_group_add()'s error path mdio: fix mdio-thunder.c dependency & build error bonding: set dev->needed_headroom in bond_setup_by_slave() net: ethernet: cavium: octeon_mgmt: use phy_start and phy_stop iavf: Fix incorrect adapter get in iavf_resume iavf: use generic power management xfrm: Use correct address family in xfrm_state_find platform/x86: fix kconfig dependency warning for FUJITSU_LAPTOP net: stmmac: removed enabling eee in EEE set callback xfrm: clone whole liftime_cur structure in xfrm_do_migrate xfrm: clone XFRMA_SEC_CTX in xfrm_do_migrate xfrm: clone XFRMA_REPLAY_ESN_VAL in xfrm_do_migrate xfrm: clone XFRMA_SET_MARK in xfrm_do_migrate iommu/vt-d: Fix lockdep splat in iommu_flush_dev_iotlb() drm/amdgpu: prevent double kfree ttm->sg openvswitch: handle DNAT tuple collision net: team: fix memory leak in __team_options_register team: set dev->needed_headroom in team_setup_by_port() sctp: fix sctp_auth_init_hmacs() error path i2c: owl: Clear NACK and BUS error bits i2c: meson: fixup rate calculation with filter delay i2c: meson: fix clock setting overwrite cifs: Fix incomplete memory allocation on setxattr path xfrmi: drop ignore_df check before updating pmtu nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage() tcp: use sendpage_ok() to detect misused .sendpage net: introduce helper sendpage_ok() in include/linux/net.h mm/khugepaged: fix filemap page_to_pgoff(page) != offset macsec: avoid use-after-free in macsec_handle_frame() nvme-core: put ctrl ref when module ref get fail btrfs: allow btrfs_truncate_block() to fallback to nocow for data space reservation btrfs: fix RWF_NOWAIT write not failling when we need to cow btrfs: Ensure we trim ranges across block group boundary btrfs: volumes: Use more straightforward way to calculate map length Btrfs: send, fix emission of invalid clone operations within the same file Btrfs: send, allow clone operations within the same file arm64: dts: stratix10: add status to qspi dts node i2c: i801: Exclude device from suspend direct complete optimization perf top: Fix stdio interface input handling with glibc 2.28+ perf test session topology: Fix data path driver core: Fix probe_count imbalance in really_probe() platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse platform/x86: intel-vbtn: Switch to an allow-list for SW_TABLET_MODE reporting bpf: Prevent .BTF section elimination bpf: Fix sysfs export of empty BTF section platform/x86: thinkpad_acpi: initialize tp_nvram_state variable platform/x86: intel-vbtn: Fix SW_TABLET_MODE always reporting 1 on the HP Pavilion 11 x360 Platform: OLPC: Fix memleak in olpc_ec_probe usermodehelper: reset umask to default before executing user process vhost: Use vhost_get_used_size() in vhost_vring_set_addr() vhost: Don't call access_ok() when using IOTLB drm/nouveau/mem: guard against NULL pointer access in mem_del net: wireless: nl80211: fix out-of-bounds access in nl80211_del_key() io_uring: Fix double list add in io_queue_async_work() io_uring: Fix remove irrelevant req from the task_list io_uring: Fix missing smp_mb() in io_cancel_async_work() io_uring: Fix resource leaking when kill the process Revert "ravb: Fixed to be able to unload modules" fbcon: Fix global-out-of-bounds read in fbcon_get_font() Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts fbdev, newport_con: Move FONT_EXTRA_WORDS macros into linux/font.h Linux 5.4.70 netfilter: ctnetlink: add a range check for l3/l4 protonum ep_create_wakeup_source(): dentry name can change under you... epoll: EPOLL_CTL_ADD: close the race in decision to take fast path epoll: replace ->visited/visited_list with generation count epoll: do not insert into poll queues until all sanity checks are done nvme: consolidate chunk_sectors settings nvme: Introduce nvme_lba_to_sect() nvme: Cleanup and rename nvme_block_nr() mm: don't rely on system state to detect hot-plug operations mm: replace memmap_context by meminit_context block/diskstats: more accurate approximation of io_ticks for slow disks random32: Restore __latent_entropy attribute on net_rand_state scripts/dtc: only append to HOST_EXTRACFLAGS instead of overwriting Input: trackpoint - enable Synaptics trackpoints i2c: cpm: Fix i2c_ram structure gpio: aspeed: fix ast2600 bank properties gpio/aspeed-sgpio: don't enable all interrupts by default gpio/aspeed-sgpio: enable access to all 80 input & output sgpios iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate() clk: samsung: exynos4: mark 'chipid' clock as CLK_IGNORE_UNUSED clk: tegra: Always program PLL_E when enabled nfs: Fix security label length not being reset pinctrl: mvebu: Fix i2c sda definition for 98DX3236 phy: ti: am654: Fix a leak in serdes_am654_probe() gpio: sprd: Clear interrupt when setting the type as edge nvme-fc: fail new connections to a deleted host or remote port nvme-pci: fix NULL req in completion handler spi: fsl-espi: Only process interrupts for expected events tools/io_uring: fix compile breakage tracing: Make the space reserved for the pid wider mac80211: do not allow bigger VHT MPDUs than the hardware supports mac80211: Fix radiotap header channel flag for 6GHz band drivers/net/wan/hdlc: Set skb->protocol before transmitting drivers/net/wan/lapbether: Make skb->protocol consistent with the header fuse: fix the ->direct_IO() treatment of iov_iter nvme-core: get/put ctrl and transport module in nvme_dev_open/release() rndis_host: increase sleep time in the query-response loop net: dec: de2104x: Increase receive ring size for Tulip drm/sun4i: mixer: Extend regmap max_register drivers/net/wan/hdlc_fr: Add needed_headroom for PVC devices libbpf: Remove arch-specific include path in Makefile clocksource/drivers/timer-gx6605s: Fixup counter reload drm/amdgpu: restore proper ref count in amdgpu_display_crtc_set_config memstick: Skip allocating card when removing host ftrace: Move RCU is watching check after recursion check iio: adc: qcom-spmi-adc5: fix driver name Input: i8042 - add nopnp quirk for Acer Aspire 5 A515 xfs: trim IO to found COW extent limit net: virtio_vsock: Enhance connection semantics vsock/virtio: add transport parameter to the virtio_transport_reset_no_sock() clk: socfpga: stratix10: fix the divider for the emac_ptp_free_clk gpio: tc35894: fix up tc35894 interrupt configuration gpio: mockup: fix resource leak in error path gpio: siox: explicitly support only threaded irqs USB: gadget: f_ncm: Fix NDP16 datagram validation mmc: sdhci: Workaround broken command queuing on Intel GLK based IRBIS models btrfs: fix filesystem corruption after a device replace Revert "opp: Replace list_kref with a local counter" Revert "opp: Increase parsed_static_opps in _of_add_opp_table_v1()" Revert "mmc: core: Fix size overflow for mmc partitions" Revert "exec: Add exec_update_mutex to replace cred_guard_mutex" Revert "exec: Fix a deadlock in strace" Revert "selftests/ptrace: add test cases for dead-locks" Revert "kernel/kcmp.c: Use new infrastructure to fix deadlocks in execve" Revert "proc: Use new infrastructure to fix deadlocks in execve" Revert "proc: io_accounting: Use new infrastructure to fix deadlocks in execve" Revert "perf: Use new infrastructure to fix deadlocks in execve" Linux 5.4.69 ata: sata_mv, avoid trigerrable BUG_ON ata: make qc_prep return ata_completion_errors ata: define AC_ERR_OK kprobes: Fix compiler warning for !CONFIG_KPROBES_ON_FTRACE dm: fix bio splitting and its bio completion order for regular IO KVM: arm64: Assume write fault on S1PTW permission fault on instruction fetch s390/zcrypt: Fix ZCRYPT_PERDEV_REQCNT ioctl mm/gup: fix gup_fast with dynamic page table folding mm, THP, swap: fix allocating cluster for swapfile by mistake dmabuf: fix NULL pointer dereference in dma_buf_release() btrfs: fix overflow when copying corrupt csums for a message kprobes: tracing/kprobes: Fix to kill kprobes on initmem after boot kprobes: Fix to check probe enabled before disarm_kprobe_ftrace() s390/dasd: Fix zero write for FBA devices tracing: fix double free lib/string.c: implement stpcpy ALSA: hda/realtek: Enable front panel headset LED on Lenovo ThinkStation P520 ALSA: hda/realtek - Couldn't detect Mic if booting with headset plugged ALSA: usb-audio: Add delay quirk for H570e USB headsets scsi: lpfc: Fix initial FLOGI failure due to BBSCN not supported x86/ioapic: Unbreak check_timer() arch/x86/lib/usercopy_64.c: fix __copy_user_flushcache() cache writeback mm: validate pmd after splitting KVM: SVM: Add a dedicated INVD intercept routine KVM: x86: Reset MMU context if guest toggles CR4.SMAP or CR4.PKE regulator: axp20x: fix LDO2/4 description MIPS: Add the missing 'CPU_1074K' into __get_cpu_type() regmap: fix page selection for noinc writes regmap: fix page selection for noinc reads ALSA: asihpi: fix iounmap in error handler lib80211: fix unmet direct dependendices config warning when !CRYPTO bpf: Fix a rcu warning for bpffs map pretty-print batman-adv: mcast: fix duplicate mcast packets from BLA backbone to mesh batman-adv: mcast: fix duplicate mcast packets in BLA backbone from mesh batman-adv: mcast: fix duplicate mcast packets in BLA backbone from LAN nvme-tcp: fix kconfig dependency warning when !CRYPTO batman-adv: Add missing include for in_interrupt() drm/sun4i: sun8i-csc: Secondary CSC register correction net: qed: RDMA personality shouldn't fail VF load net: qede: Disable aRFS for NPAR and 100G net: qed: Disable aRFS for NPAR and 100G drm/vc4/vc4_hdmi: fill ASoC card owner bpf: Fix clobbering of r2 in bpf_gen_ld_abs mac802154: tx: fix use-after-free netfilter: conntrack: nf_conncount_init is failing with IPv6 disabled batman-adv: mcast/TT: fix wrongly dropped or rerouted packets atm: eni: fix the missed pci_disable_device() for eni_init_one() batman-adv: bla: fix type misuse for backbone_gw hash indexing mwifiex: Increase AES key storage size to 256 bits clocksource/drivers/h8300_timer8: Fix wrong return value in h8300_8timer_init() ieee802154/adf7242: check status of adf7242_read_reg ieee802154: fix one possible memleak in ca8210_dev_com_init objtool: Fix noreturn detection for ignored functions i2c: core: Call i2c_acpi_install_space_handler() before i2c_acpi_register_devices() drm/amdgpu/dc: Require primary plane to be enabled whenever the CRTC is drm/amd/display: update nv1x stutter latencies drm/amdkfd: fix a memory leak issue EDAC/ghes: Check whether the driver is on the safe list correctly lockdep: fix order in trace_hardirqs_off_caller() s390/init: add missing __init annotations i2c: aspeed: Mask IRQ status to relevant bits RISC-V: Take text_mutex in ftrace_init_nop() ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN Converter9 2-in-1 ASoC: wm8994: Ensure the device is resumed in wm89xx_mic_detect functions ASoC: wm8994: Skip setting of the WM8994_MICBIAS register for WM1811 ASoC: pcm3168a: ignore 0 Hz settings device_cgroup: Fix RCU list debugging warning nvme: explicitly update mpath disk capacity on revalidation net: openvswitch: use div_u64() for 64-by-32 divisions ALSA: hda: Workaround for spurious wakeups on some Intel platforms ALSA: hda: Always use jackpoll helper for jack update after resume perf parse-events: Use strcmp() to compare the PMU name opp: Increase parsed_static_opps in _of_add_opp_table_v1() mt76: fix LED link time failure ubi: fastmap: Free unused fastmap anchor peb during detach scsi: qla2xxx: Retry PLOGI on FC-NVMe PRLI failure perf tests: Fix test 68 zstd compression for s390 btrfs: qgroup: fix data leak caused by race between writeback and truncate vfio/pci: fix racy on error and request eventfd ctx selftests/x86/syscall_nt: Clear weird flags after each test scsi: libfc: Skip additional kref updating work event scsi: libfc: Handling of extra kref mac80211: skip mpath lookup also for control port tx nvme: fix possible deadlock when I/O is blocked cifs: Fix double add page to memcg when cifs_readpages vfio/pci: Clear error and request eventfd ctx after releasing NFS: nfs_xdr_status should record the procedure name x86/speculation/mds: Mark mds_user_clear_cpu_buffers() __always_inline mtd: parser: cmdline: Support MTD names containing one or more colons rapidio: avoid data race between file operation callbacks and mport_cdev_add(). mm: memcontrol: fix stat-corrupting race in charge moving mm/swap_state: fix a data race in swapin_nr_pages ceph: fix potential race in ceph_check_caps PCI: tegra: Fix runtime PM imbalance on error mtd: rawnand: omap_elm: Fix runtime PM imbalance on error mtd: rawnand: gpmi: Fix runtime PM imbalance on error wlcore: fix runtime pm imbalance in wlcore_regdomain_config wlcore: fix runtime pm imbalance in wl1271_tx_work ASoC: img-i2s-out: Fix runtime PM imbalance on error PCI: tegra194: Fix runtime PM imbalance on error perf kcore_copy: Fix module map when there are no modules loaded perf metricgroup: Free metric_events on error perf util: Fix memory leak of prefix_if_not_in perf stat: Fix duration_time value for higher intervals perf trace: Fix the selection for architectures to generate the errno name tables perf evsel: Fix 2 memory leaks KVM: PPC: Book3S HV: Close race with page faults around memslot flushes vfio/pci: fix memory leaks of eventfd ctx gpio: rcar: Fix runtime PM imbalance on error btrfs: fix double __endio_write_update_ordered in direct I/O btrfs: don't force read-only after error in drop snapshot usb: dwc3: Increase timeout for CmdAct cleared by device controller printk: handle blank console arguments passed in. drm/nouveau/dispnv50: fix runtime pm imbalance on error drm/nouveau: fix runtime pm imbalance on error drm/nouveau/debugfs: fix runtime pm imbalance on error e1000: Do not perform reset in reset_task if we are already down drm/amdkfd: fix restore worker race condition arm64/cpufeature: Drop TraceFilt feature exposure from ID_DFR0 register scsi: cxlflash: Fix error return code in cxlflash_probe() arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work coresight: etm4x: Fix use-after-free of per-cpu etm drvdata USB: EHCI: ehci-mv: fix less than zero comparison of an unsigned int fuse: update attr_version counter on fuse_notify_inval_inode() fuse: don't check refcount after stealing page svcrdma: Fix backchannel return code powerpc/traps: Make unrecoverable NMIs die instead of panic ipmi:bt-bmc: Fix error handling and status check drm/exynos: dsi: Remove bridge node reference in error handling path in probe function ALSA: hda: Fix potential race in unsol event handler tty: serial: samsung: Correct clock selection logic tipc: fix memory leak in service subscripting KVM: x86: handle wrap around 32-bit address space USB: EHCI: ehci-mv: fix error handling in mv_ehci_probe() Bluetooth: Handle Inquiry Cancel error after Inquiry Complete phy: samsung: s5pv210-usb2: Add delay after reset power: supply: max17040: Correct voltage reading i2c: tegra: Restore pinmux on system resume mm/slub: fix incorrect interpretation of s->offset perf mem2node: Avoid double free related to realloc media: venus: vdec: Init registered list unconditionally atm: fix a memory leak of vcc->user_back devlink: Fix reporter's recovery condition dt-bindings: sound: wm8994: Correct required supplies based on actual implementaion dpaa2-eth: fix error return code in setup_dpni() sched/fair: Eliminate bandwidth race between throttling and distribution arm64: cpufeature: Relax checks for AArch32 support at EL[0-2] sparc64: vcc: Fix error return code in vcc_probe() staging:r8188eu: avoid skb_clone for amsdu to msdu conversion scsi: aacraid: Fix error handling paths in aac_probe_one() net: openvswitch: use u64 for meter bucket KVM: arm64: vgic-its: Fix memory leak on the error path of vgic_add_lpi() KVM: arm64: vgic-v3: Retire all pending LPIs on vcpu destroy drivers: char: tlclk.c: Avoid data race between init and interrupt handler bdev: Reduce time holding bd_mutex in sync in blkdev_close() perf stat: Force error in fallback on :k events KVM: Remove CREATE_IRQCHIP/SET_PIT2 race btrfs: fix setting last_trans for reloc roots serial: uartps: Wait for tx_empty in console setup scsi: qedi: Fix termination timeouts in session logout ALSA: hda: Skip controller resume if not needed mm/mmap.c: initialize align_offset explicitly for vm_unmapped_area drm/amdgpu/sriov add amdgpu_amdkfd_pre_reset in gpu reset workqueue: Remove the warning in wq_worker_sleeping() nvmet-rdma: fix double free of rdma queue SUNRPC: Don't start a timer on an already queued rpc task mm/vmscan.c: fix data races using kswapd_classzone_idx mm/swapfile: fix data races in try_to_unuse() mm/filemap.c: clear page error before actual read mm/kmemleak.c: use address-of operator on section symbols powerpc/perf: Implement a global lock to avoid races between trace, core and thread imc events. drm/amdgpu/vcn2.0: stall DPG when WPTR/RPTR reset NFS: Fix races nfs_page_group_destroy() vs nfs_destroy_unlinked_subrequests() PCI: pciehp: Fix MSI interrupt race ALSA: usb-audio: Fix case when USB MIDI interface has more than one extra endpoint descriptor ubifs: Fix out-of-bounds memory access caused by abnormal value of node_len ubifs: ubifs_add_orphan: Fix a memory leak bug ubifs: ubifs_jnl_write_inode: Fix a memory leak bug PCI: Use ioremap(), not phys_to_virt() for platform ROM netfilter: nf_tables: silence a RCU-list warning in nft_table_lookup() svcrdma: Fix leak of transport addresses SUNRPC: Fix a potential buffer overflow in 'svc_print_xprts()' scsi: hpsa: correct race condition in offload enabled IB/iser: Always check sig MR before putting it to the free pool RDMA/rxe: Set sys_image_guid to be aligned with HW IB devices xfs: prohibit fs freezing when using empty transactions brcmfmac: Fix double freeing in the fmac usb data path nvme: Fix controller creation races with teardown flow nvme: Fix ctrl use-after-free during sysfs deletion nvme-multipath: do not reset on unknown status perf: Use new infrastructure to fix deadlocks in execve proc: io_accounting: Use new infrastructure to fix deadlocks in execve proc: Use new infrastructure to fix deadlocks in execve kernel/kcmp.c: Use new infrastructure to fix deadlocks in execve selftests/ptrace: add test cases for dead-locks exec: Fix a deadlock in strace exec: Add exec_update_mutex to replace cred_guard_mutex tools: gpio-hammer: Avoid potential overflow in main cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn net: axienet: Propagate failure of DMA descriptor setup net: axienet: Convert DMA error handler to a work queue perf cpumap: Fix snprintf overflow check serial: 8250: 8250_omap: Terminate DMA before pushing data on RX timeout serial: 8250_omap: Fix sleeping function called from invalid context during probe serial: 8250_port: Don't service RX FIFO if throttled r8169: improve RTL8168b FIFO overflow workaround btrfs: free the reloc_control in a consistent way btrfs: do not init a reloc root if we aren't relocating perf parse-events: Fix 3 use after frees found with clang ASAN KVM: LAPIC: Mark hrtimer for period or oneshot mode to expire in hard interrupt context thermal: rcar_thermal: Handle probe error gracefully tracing: Use address-of operator on section symbols drm/msm/a5xx: Always set an OPP supported hardware value drm/msm: fix leaks if initialization fails KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones intel_th: Disallow multi mode on devices where it's broken RDMA/cm: Remove a race freeing timewait_info nfsd: Don't add locks to closed or closing open stateids rtc: ds1374: fix possible race condition rtc: sa1100: fix possible race condition tpm: ibmvtpm: Wait for buffer to be set before proceeding ext4: mark block bitmap corrupted when found instead of BUGON xfs: mark dir corrupt when lookup-by-hash fails xfs: don't ever return a stale pointer from __xfs_dir3_free_read tty: sifive: Finish transmission before changing the clock media: tda10071: fix unsigned sign extension overflow Bluetooth: L2CAP: handle l2cap config request during open state scsi: aacraid: Disabling TM path and only processing IOP reset ath10k: use kzalloc to read for ath10k_sdio_hif_diag_read perf cs-etm: Correct synthesizing instruction samples perf cs-etm: Swap packets for instruction samples s390/irq: replace setup_irq() by request_irq() cpu-topology: Fix the potential data corruption clk: imx: Fix division by zero warning on pfdv2 drm/amd/display: Stop if retimer is not available ARM: OMAP2+: Handle errors for cpu_pm drm/amdgpu: increase atombios cmd timeout mm: avoid data corruption on CoW fault into PFN-mapped VMA perf jevents: Fix leak of mapfile memory ext4: fix a data race at inode->i_disksize drm/amd/display: fix image corruption with ODM 2:1 DSC 2 slice powerpc/book3s64: Fix error handling in mm_iommu_do_alloc() timekeeping: Prevent 32bit truncation in scale64_check_overflow() Bluetooth: guard against controllers sending zero'd events media: go7007: Fix URB type for interrupt handling ASoC: SOF: ipc: check ipc return value before data copy bus: hisi_lpc: Fixup IO ports addresses to avoid use-after-free in host removal random: fix data races at timer_rand_state firmware: arm_sdei: Use cpus_read_lock() to avoid races with cpuhp iavf: use tc_cls_can_offload_and_chain0() instead of chain check drm/omap: dss: Cleanup DSS ports on initialisation failure drm/amd/display: dal_ddc_i2c_payloads_create can fail causing panic soundwire: bus: disable pm_runtime in sdw_slave_delete dmaengine: tegra-apb: Prevent race conditions on channel's freeing dmaengine: stm32-dma: use vchan_terminate_vdesc() in .terminate_all bpf: Remove recursion prevention from rcu free callback x86/pkeys: Add check for pkey "overflow" media: staging/imx: Missing assignment in imx_media_capture_device_register() dmaengine: stm32-mdma: use vchan_terminate_vdesc() in .terminate_all KVM: nVMX: Hold KVM's srcu lock when syncing vmcs12->shadow KVM: x86: fix incorrect comparison in trace event RDMA/rxe: Fix configuration of atomic queue pair attributes perf test: Fix test trace+probe_vfs_getname.sh on s390 ALSA: usb-audio: Don't create a mixer element with bogus volume range mt76: fix handling full tx queues in mt76_dma_tx_queue_skb_raw mt76: clear skb pointers from rx aggregation reorder buffer during cleanup crypto: chelsio - This fixes the kernel panic which occurs during a libkcapi test clk: stratix10: use do_div() for 64-bit calculation locking/lockdep: Decrement IRQ context counters when removing lock chain drm/omap: fix possible object reference leak scsi: lpfc: Fix coverity errors in fmdi attribute handling scsi: lpfc: Fix release of hwq to clear the eq relationship scsi: lpfc: Fix RQ buffer leakage when no IOCBs available selinux: sel_avc_get_stat_idx should increase position index audit: CONFIG_CHANGE don't log internal bookkeeping as an event drm/amd/display: fix workaround for incorrect double buffer register for DLG ADL and TTU nfsd: Fix a perf warning skbuff: fix a data race in skb_queue_len() ALSA: hda: Clear RIRB status before reading WP KVM: fix overflow of zero page refcount with ksm running Bluetooth: prefetch channel before killing sock mm: pagewalk: fix termination condition in walk_pte_range() mm/swapfile.c: swap_next should increase position index Bluetooth: Fix refcount use-after-free issue tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility selftests/ftrace: fix glob selftest ceph: ensure we have a new cap before continuing in fill_inode ar5523: Add USB ID of SMCWUSBT-G2 wireless adapter ARM: 8948/1: Prevent OOB access in stacktrace tracing: Set kernel_stack's caller size properly Bluetooth: btrtl: Use kvmalloc for FW allocations powerpc/eeh: Only dump stack once if an MMIO loop is detected nfsd: Fix a soft lockup race in nfsd_file_mark_find_or_create() s390/cpum_sf: Use kzalloc and minor changes dmaengine: zynqmp_dma: fix burst length configuration btrfs: tree-checker: Check leaf chunk item size i2c: tegra: Prevent interrupt triggering after transfer timeout drm/amd/display: Initialize DSC PPS variables to 0 scsi: ufs: Fix a race condition in the tracing code scsi: ufs: Make ufshcd_add_command_trace() easier to read ACPI: EC: Reference count query handlers under lock sctp: move trace_sctp_probe_path into sctp_outq_sack scsi: lpfc: Fix incomplete NVME discovery when target scsi: qla2xxx: Fix stuck session in GNL opp: Replace list_kref with a local counter media: ti-vpe: cal: Restrict DMA to avoid memory corruption drm/scheduler: Avoid accessing freed bad job. seqlock: Require WRITE_ONCE surrounding raw_seqcount_barrier drm/mcde: Handle pending vblank while disabling display ipv6_route_seq_next should increase position index rt_cpu_seq_next should increase position index neigh_stat_seq_next() should increase position index vcc_seq_next should increase position index tipc: fix link overflow issue at socket shutdown ALSA: hda: enable regmap internal locking xfs: fix log reservation overflows when allocating large rt extents module: Remove accidental change of module_enable_x() KVM: arm/arm64: vgic: Fix potential double free dist->spis in __kvm_vgic_destroy() kernel/sys.c: avoid copying possible padding bytes in copy_to_user kernel/notifier.c: intercept duplicate registrations to avoid infinite loops selftests/bpf: De-flake test_tcpbpf arm64: insn: consistently handle exit text drm/amdgpu: fix calltrace during kmd unload(v3) xfs: fix realtime file data space leak s390: avoid misusing CALL_ON_STACK for task stack setup xtensa: fix system_call interaction with ptrace ASoC: max98090: remove msleep in PLL unlocked workaround f2fs: stop GC when the victim becomes fully valid CIFS: Properly process SMB3 lease breaks CIFS: Use common error handling code in smb2_ioctl_query_info() SUNRPC: Capture completion of all RPC tasks debugfs: Fix !DEBUG_FS debugfs_create_automount mt76: add missing locking around ampdu action mt76: do not use devm API for led classdev scsi: pm80xx: Cleanup command when a reset times out gfs2: clean up iopen glock mess in gfs2_create_inode mmc: core: Fix size overflow for mmc partitions ubi: Fix producing anchor PEBs RDMA/iw_cgxb4: Fix an error handling path in 'c4iw_connect()' xfs: fix attr leaf header freemap.size underflow fix dget_parent() fastpath race PCI: Avoid double hpmemsize MMIO window assignment RDMA/i40iw: Fix potential use after free RDMA/qedr: Fix potential use after free x86/kdump: Always reserve the low 1M when the crashkernel option is specified dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails bcache: fix a lost wake-up problem caused by mca_cannibalize_lock tracing: Adding NULL checks for trace_array descriptor pointer tracing: Verify if trace array exists before destroying it. tpm_crb: fix fTPM on AMD Zen+ CPUs drm/amdgpu/powerplay/smu7: fix AVFS handling with custom powerplay table mfd: mfd-core: Protect against NULL call-back function pointer mtd: cfi_cmdset_0002: don't free cfi->cfiq in error path of cfi_amdstd_setup() ice: Fix to change Rx/Tx ring descriptor size via ethtool with DCBx drm/amdgpu/powerplay: fix AVFS handling with custom powerplay table clk/ti/adpll: allocate room for terminating null f2fs: avoid kernel panic on corruption test iomap: Fix overflow in iomap_page_mkwrite dax: Fix alloc_dax_region() compile warning net: silence data-races on sk_backlog.tail powerpc/64s: Always disable branch profiling for prom_init.o scsi: lpfc: Fix kernel crash at lpfc_nvme_info_show during remote port bounce scsi: fnic: fix use after free PM / devfreq: tegra30: Fix integer overflow on CPU's freq max out dm table: do not allow request-based DM to stack on partitions leds: mlxreg: Fix possible buffer overflow xfs: properly serialise fallocate against AIO+DIO drm/amd/display: Free gamma after calculating legacy transfer function media: smiapp: Fix error handling at NVM reading soundwire: intel/cadence: fix startup sequence ASoC: kirkwood: fix IRQ error handling gma/gma500: fix a memory disclosure bug due to uninitialized bytes xfs: fix inode fork extent count overflow m68k: q40: Fix info-leak in rtc_ioctl scsi: aacraid: fix illegal IO beyond last LBA mm: fix double page fault on arm64 if PTE_AF is cleared PCI/IOV: Serialize sysfs sriov_numvfs reads vs writes ath10k: fix memory leak for tpc_stats_final ath10k: fix array out-of-bounds access scsi: qla2xxx: Add error handling for PLOGI ELS passthrough dma-fence: Serialise signal enabling (dma_fence_enable_sw_signaling) drm/amdkfd: Fix race in gfx10 context restore handler drm/amd/display: Do not double-buffer DTO adjustments media: mc-device.c: fix memleak in media_device_register_entity selinux: allow labeling before policy is loaded scsi: mpt3sas: Free diag buffer without any status check scsi: lpfc: Fix pt2pt discovery on SLI3 HBAs kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec() Linux 5.4.68 iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE mm: memcg: fix memcg reclaim soft lockup net: add __must_check to skb_put_padto() net: qrtr: check skb_put_padto() return value net: phy: Do not warn in phy_stop() on PHY_DOWN net: phy: Avoid NPD upon phy_detach() when driver is unbound net: lantiq: Disable IRQs only if NAPI gets scheduled net: lantiq: Use napi_complete_done() net: lantiq: use netif_tx_napi_add() for TX NAPI net: lantiq: Wake TX queue again bnxt_en: Protect bnxt_set_eee() and bnxt_set_pauseparam() with mutex. bnxt_en: return proper error codes in bnxt_show_temp net/mlx5e: TLS, Do not expose FPGA TLS counter if not supported net/mlx5e: Enable adding peer miss rules only if merged eswitch is supported tipc: use skb_unshare() instead in tipc_buf_append() tipc: fix shutdown() of connection oriented socket tipc: Fix memory leak in tipc_group_create_member() taprio: Fix allowing too small intervals nfp: use correct define to return NONE fec net: sctp: Fix IPv6 ancestor_size calc in sctp_copy_descendant net: sch_generic: aviod concurrent reset and enqueue op for lockless qdisc net/mlx5: Fix FTE cleanup net: ipv6: fix kconfig dependency warning for IPV6_SEG6_HMAC net: Fix bridge enslavement failure net: dsa: rtl8366: Properly clear member config net: DCB: Validate DCB_ATTR_DCB_BUFFER argument net: bridge: br_vlan_get_pvid_rcu() should dereference the VLAN group under RCU ipv6: avoid lockdep issue in fib6_del() ipv4: Update exception handling for multipath routes via same device ipv4: Initialize flowi4_multipath_hash in data path ip: fix tos reflection in ack and reset packets hdlc_ppp: add range checks in ppp_cp_parse_cr() geneve: add transport ports in route lookup for geneve cxgb4: Fix offset when clearing filter byte counters cxgb4: fix memory leak during module unload bnxt_en: Fix NULL ptr dereference crash in bnxt_fw_reset_task() bnxt_en: Avoid sending firmware messages when AER error is detected. act_ife: load meta modules before tcf_idr_check_alloc() mm/thp: fix __split_huge_pmd_locked() for migration PMD kprobes: fix kill kprobe which has been marked as gone ibmvnic: add missing parenthesis in do_reset() ibmvnic fix NULL tx_pools and rx_tools issue at do_reset af_key: pfkey_dump needs parameter validation Revert "ehci-hcd: Move include to keep CRC stable" Linux 5.4.67 dax: Fix compilation for CONFIG_DAX && !CONFIG_FS_DAX dm: Call proper helper to determine dax support mm/memory_hotplug: drain per-cpu pages again during memory offline dm/dax: Fix table reference counts selftests/vm: fix display of page size in map_hugetlb powerpc/dma: Fix dma_map_ops::get_required_mask ehci-hcd: Move include to keep CRC stable s390/zcrypt: fix kmalloc 256k failure x86/boot/compressed: Disable relocation relaxation serial: 8250_pci: Add Realtek 816a and 816b Input: i8042 - add Entroware Proteus EL07R4 to nomux and reset lists Input: trackpoint - add new trackpoint variant IDs percpu: fix first chunk size calculation for populated bitmap ALSA: hda/realtek - The Mic on a RedmiBook doesn't work ALSA: hda: fixup headset for ASUS GX502 laptop Revert "ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO" i2c: i801: Fix resume bug usb: typec: ucsi: Prevent mode overrun usblp: fix race between disconnect() and read() USB: UAS: fix disconnect by unplugging a hub USB: quirks: Add USB_QUIRK_IGNORE_REMOTE_WAKEUP quirk for BYD zhaoxin notebook drm/i915: Filter wake_flags passed to default_wake_function riscv: Add sfence.vma after early page table changes i2c: mxs: use MXS_DMA_CTRL_WAIT4END instead of DMA_CTRL_ACK iommu/amd: Fix potential @entry null deref arm64: bpf: Fix branch offset in JIT drm/mediatek: Add missing put_device() call in mtk_hdmi_dt_parse_pdata() drm/mediatek: Add exception handing in mtk_drm_probe() if component init fail MIPS: SNI: Fix spurious interrupts fbcon: Fix user font detection test at fbcon_resize(). perf test: Free formats for perf pmu parse test perf parse-event: Fix memory leak in evsel->unit perf evlist: Fix cpu/thread map leak MIPS: SNI: Fix MIPS_L1_CACHE_SHIFT perf test: Fix the "signal" test inline assembly Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload arm64: Allow CPUs unffected by ARM erratum1418040to come in late scsi: libsas: Fix error path in sas_notify_lldd_dev_found() Drivers: hv: vmbus: hibernation: do not hang forever in vmbus_bus_resume() ASoC: meson: axg-toddr: fix channel order on g12 platforms powerpc/book3s64/radix: Fix boot failure with large amount of guest memory ASoC: qcom: common: Fix refcount imbalance on error ASoC: qcom: Set card->owner to avoid warnings clk: rockchip: Fix initialization of mux_pll_src_4plls_p clk: davinci: Use the correct size when allocating memory KVM: MIPS: Change the definition of kvm type spi: Fix memory leak on splited transfers i2c: algo: pca: Reapply i2c bus settings after reset f2fs: Return EOF on unaligned end of file DIO read f2fs: fix indefinite loop scanning for free nid block: only call sched requeue_request() for scheduled requests nvme-tcp: cancel async events before freeing event struct nvme-rdma: cancel async events before freeing event struct nvme-fc: cancel async events before freeing event struct openrisc: Fix cache API compile issue when not inlining cifs: fix DFS mount with cifsacl/modefromsid rapidio: Replace 'select' DMAENGINES 'with depends on' SUNRPC: stop printk reading past end of string NFS: Zero-stateid SETATTR should first return delegation spi: spi-loopback-test: Fix out-of-bounds read regulator: pwm: Fix machine constraints application scsi: lpfc: Fix FLOGI/PLOGI receive race condition in pt2pt discovery scsi: libfc: Fix for double free() scsi: pm8001: Fix memleak in pm8001_exec_internal_task_abort NFSv4.1 handle ERR_DELAY error reclaiming locking state on delegation recall firmware_loader: fix memory leak for paged buffer hv_netvsc: Remove "unlikely" from netvsc_select_queue net: handle the return value of pskb_carve_frag_list() correctly dsa: Allow forwarding of redirected IGMP traffic e1000e: Add support for Comet Lake RDMA/bnxt_re: Restrict the max_gids to 256 gfs2: initialize transaction tr_ailX_lists earlier Revert "netfilter: conntrack: allow sctp hearbeat after connection re-use" Linux 5.4.66 gcov: add support for GCC 10.1 drm/msm: Disable the RPTR shadow drm/msm/gpu: make ringbuffer readonly usb: typec: ucsi: acpi: Check the _DEP dependencies usb: Fix out of sync data toggle if a configured device is reconfigured USB: serial: option: add support for SIM7070/SIM7080/SIM7090 modules USB: serial: option: support dynamic Quectel USB compositions USB: serial: ftdi_sio: add IDs for Xsens Mti USB converter usb: core: fix slab-out-of-bounds Read in read_descriptors phy: qcom-qmp: Use correct values for ipq8074 PCIe Gen2 PHY init staging: greybus: audio: fix uninitialized value issue video: fbdev: fix OOB read in vga_8planes_imageblit() ARM: dts: vfxxx: Add syscon compatible with OCOTP debugfs: Fix module state check condition KVM: fix memory leak in kvm_io_bus_unregister_dev() KVM: arm64: Do not try to map PUDs when they are folded into PMD KVM: VMX: Don't freeze guest when event delivery causes an APIC-access exit vgacon: remove software scrollback support fbcon: remove now unusued 'softback_lines' cursor() argument fbcon: remove soft scrollback code RDMA/mlx4: Read pkey table length instead of hardcoded value RDMA/rxe: Fix the parent sysfs read when the interface has 15 chars rbd: require global CAP_SYS_ADMIN for mapping and unmapping mmc: sdhci-of-esdhc: Don't walk device-tree on every interrupt mmc: sdio: Use mmc_pre_req() / mmc_post_req() drm/msm: Disable preemption on all 5xx targets drm/tve200: Stabilize enable/disable drm/i915/gvt: do not check len & max_len for lri scsi: target: iscsi: Fix hang in iscsit_access_np() when getting tpg->np_login_sem scsi: target: iscsi: Fix data digest calculation regulator: core: Fix slab-out-of-bounds in regulator_unlock_recursive() regulator: plug of_node leak in regulator_register()'s error path regulator: push allocation in set_consumer_device_supply() out of lock regulator: push allocations in create_regulator() outside of lock regulator: push allocation in regulator_init_coupling() outside of lock kobject: Restore old behaviour of kobject_del(NULL) btrfs: fix wrong address when faulting in pages in the search ioctl btrfs: fix lockdep splat in add_missing_dev btrfs: require only sector size alignment for parent eb bytenr staging: wlan-ng: fix out of bounds read in prism2sta_probe_usb() iio:accel:mma8452: Fix timestamp alignment and prevent data leak. iio:accel:mma7455: Fix timestamp alignment and prevent data leak. iio: accel: kxsd9: Fix alignment of local buffer. iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. iio:light:max44000 Fix timestamp alignment and prevent data leak. iio:magnetometer:ak8975 Fix alignment and data leak issues. iio:adc:ti-adc081c Fix alignment and data leak issues iio:adc:max1118 Fix alignment of timestamp and data leak issues iio:adc:ina2xx Fix timestamp alignment issue. iio:adc:ti-adc084s021 Fix alignment and data leak issues. iio:accel:bmc150-accel: Fix timestamp alignment and prevent data leak. iio:proximity:mb1232: Fix timestamp alignment and prevent data leak. iio:light:ltr501 Fix timestamp alignment issue. iio: cros_ec: Set Gyroscope default frequency to 25Hz iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set gcov: Disable gcov build with GCC 10 iommu/amd: Do not use IOMMUv2 functionality when SME is active drm/amdgpu: Fix bug in reporting voltage for CIK ALSA: hda: fix a runtime pm issue in SOF when integrated GPU is disabled ALSA: hda: hdmi - add Rocketlake support arm64/module: set trampoline section flags regardless of CONFIG_DYNAMIC_FTRACE cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled cpufreq: intel_pstate: Refuse to turn off with HWP enabled ARC: [plat-hsdk]: Switch ethernet phy-mode to rgmii-id HID: elan: Fix memleak in elan_input_configured drivers/net/wan/hdlc_cisco: Add hard_header_len HID: microsoft: Add rumble support for the 8bitdo SN30 Pro+ controller HID: quirks: Set INCREMENT_USAGE_ON_DUPLICATE for all Saitek X52 devices nvme-pci: cancel nvme device request before disabling nvme-rdma: fix reset hang if controller died in the middle of a reset nvme-rdma: fix timeout handler nvme-rdma: serialize controller teardown sequences nvme-tcp: fix reset hang if controller died in the middle of a reset nvme-tcp: fix timeout handler nvme-tcp: serialize controller teardown sequences nvme: have nvme_wait_freeze_timeout return if it timed out nvme-fabrics: don't check state NVME_CTRL_NEW for request acceptance nvmet-tcp: Fix NULL dereference when a connect data comes in h2cdata pdu irqchip/eznps: Fix build error for !ARC700 builds xfs: initialize the shortform attr header padding entry cfg80211: Adjust 6 GHz frequency to channel conversion drivers/net/wan/lapbether: Set network_header before transmitting xfs: fix off-by-one in inode alloc block reservation calculation net: hns3: Fix for geneve tx checksum bug drivers/dma/dma-jz4780: Fix race condition between probe and irq handler ALSA: hda/tegra: Program WAKEEN register for Tegra ALSA: hda: Fix 2 channel swapping for Tegra firestream: Fix memleak in fs_open NFC: st95hf: Fix memleak in st95hf_in_send_cmd drivers/net/wan/lapbether: Added needed_tailroom netfilter: conntrack: allow sctp hearbeat after connection re-use dmaengine: acpi: Put the CSRT table after using it ARC: HSDK: wireup perf irq arm64: dts: ns2: Fixed QSPI compatible string ARM: dts: BCM5301X: Fixed QSPI compatible string ARM: dts: NSP: Fixed QSPI compatible string ARM: dts: bcm: HR2: Fixed QSPI compatible string IB/isert: Fix unaligned immediate-data handling block: Set same_page to false in __bio_try_merge_page if ret is false spi: stm32: fix pm_runtime_get_sync() error checking nvme-fabrics: allow to queue requests for live queues spi: stm32: Rate-limit the 'Communication suspended' message mmc: sdhci-msm: Add retries when all tuning phases are found valid mmc: sdhci-acpi: Clear amd_sdhci_host on reset drm/sun4i: backend: Disable alpha on the lowest plane on the A20 drm/sun4i: backend: Support alpha property on lowest plane soundwire: fix double free of dangling pointer scsi: mpt3sas: Don't call disable_irq from IRQ poll handler scsi: megaraid_sas: Don't call disable_irq from process IRQ poll RDMA/core: Fix reported speed and width scsi: libsas: Set data_dir as DMA_NONE if libata marks qc as NODATA iio: adc: mcp3422: fix locking scope iio: adc: mcp3422: fix locking on error path drm/sun4i: Fix dsi dcs long write function arm64: dts: imx8mq: Fix TMU interrupt property drm/sun4i: add missing put_device() call in sun8i_r40_tcon_tv_set_mux() RDMA/bnxt_re: Do not report transparent vlan from QP1 RDMA/rxe: Fix panic when calling kmem_cache_create() RDMA/rxe: Drop pointless checks in rxe_init_ports RDMA/rxe: Fix memleak in rxe_mem_init_user ARM: dts: imx7ulp: Correct gpio ranges ARM: dts: ls1021a: fix QuadSPI-memory reg range selftests/timers: Turn off timeout setting ARM: dts: socfpga: fix register entry for timer3 on Arria10 regulator: remove superfluous lock in regulator_resolve_coupling() regulator: push allocation in regulator_ena_gpio_request() out of lock ARM: dts: logicpd-som-lv-baseboard: Fix missing video ARM: dts: logicpd-som-lv-baseboard: Fix broken audio ARM: dts: logicpd-torpedo-baseboard: Fix broken audio Linux 5.4.65 net: disable netpoll on fresh napis tipc: fix shutdown() of connectionless socket taprio: Fix using wrong queues in gate mask sctp: not disable bh in the whole sctp_get_port_local() net: usb: dm9601: Add USB ID of Keenetic Plus DSL netlabel: fix problems with mapping removal ipv6: Fix sysctl max for fib_multipath_hash_policy ipv4: Silence suspicious RCU usage warning Linux 5.4.64 net: usb: Fix uninit-was-stored issue in asix_read_phy_addr() cfg80211: regulatory: reject invalid hints mm/khugepaged.c: fix khugepaged's request size in collapse_file mm/hugetlb: fix a race between hugetlb sysctl handlers checkpatch: fix the usage of capture group ( ... ) sdhci: tegra: Add missing TMCLK for data timeout perf record: Correct the help info of option "--no-bpf-event" vfio/pci: Fix SR-IOV VF handling with MMIO blocking mm: madvise: fix vma user-after-free mm: slub: fix conversion of freelist_corrupted() dm thin metadata: Fix use-after-free in dm_bm_set_read_only dm thin metadata: Avoid returning cmd->bm wild pointer on error dm cache metadata: Avoid returning cmd->bm wild pointer on error dm crypt: Initialize crypto wait structures dm integrity: fix error reporting in bitmap mode after creation dm mpath: fix racey management of PG initialization dm writecache: handle DAX to partitions on persistent memory correctly drm/amd/pm: avoid false alarm due to confusing softwareshutdowntemp setting dmaengine: dw-edma: Fix scatter-gather address calculation blk-iocost: ioc_pd_free() shouldn't assume irq disabled libata: implement ATA_HORKAGE_MAX_TRIM_128M and apply to Sandisks block: ensure bdi->io_pages is always initialized block: allow for_each_bvec to support zero len bvec affs: fix basic permission bits to actually work media: rc: uevent sysfs file races with rc_unregister_device() media: rc: do not access device via sysfs after rc_unregister_device() mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers mmc: cqhci: Add cqhci_deactivate() mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings mmc: mediatek: add optional module reset property arm64: dts: mt7622: add reset node for mmc device ALSA: hda/realtek - Improved routing for Thinkpad X1 7th/8th Gen ALSA: hda/realtek: Add quirk for Samsung Galaxy Book Ion NT950XCJ-X716A ALSA; firewire-tascam: exclude Tascam FE-8 from detection ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO ALSA: firewire-digi00x: exclude Avid Adrenaline from detection ALSA: hda/hdmi: always check pin power status in i915 pin fixup ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check ALSA: usb-audio: Add implicit feedback quirk for UR22C ALSA: ca0106: fix error code handling Revert "ALSA: hda: Add support for Loongson 7A1000 controller" Revert "net: dsa: microchip: set the correct number of ports" btrfs: fix potential deadlock in the search ioctl net: core: use listified Rx for GRO_NORMAL in napi_gro_receive() btrfs: tree-checker: fix the error message for transid error btrfs: set the lockdep class for log tree extent buffers btrfs: set the correct lockdep class for new nodes btrfs: allocate scrub workqueues outside of locks btrfs: drop path before adding new uuid tree entry ARC: perf: don't bail setup if pct irq missing in device-tree xfs: don't update mtime on COW faults ext2: don't update mtime on COW faults tracing/kprobes, x86/ptrace: Fix regs argument order for i386 iommu/vt-d: Handle 36bit addressing for x86-32 vfio-pci: Invalidate mmaps and block MMIO access on disabled memory vfio-pci: Fault mmaps to enable vma tracking vfio/type1: Support faulting PFNMAP vmas include/linux/log2.h: add missing () around n in roundup_pow_of_two() net/packet: fix overflow in tpacket_rcv iommu/amd: Restore IRTE.RemapEn bit after programming IRTE thermal: qcom-spmi-temp-alarm: Don't suppress negative temp thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430 iommu/vt-d: Serialize IOMMU GCMD register modifications x86, fakenuma: Fix invalid starting node ID tg3: Fix soft lockup when tg3_reset_task() fails. perf jevents: Fix suspicious code in fixregex() xfs: fix xfs_bmap_validate_extent_raw when checking attr fork of rt files MIPS: add missing MSACSR and upper MSA initialization net: gemini: Fix another missing clk_disable_unprepare() in probe fix regression in "epoll: Keep a reference on files added to the check list" net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init() perf tools: Correct SNOOPX field offset cxgb4: fix thermal zone device registration nvme: fix controller instance leak nvmet-fc: Fix a missed _irqsave version of spin_lock in 'nvmet_fc_fod_op_done()' netfilter: nfnetlink: nfnetlink_unicast() reports EAGAIN instead of ENOBUFS net: dsa: mt7530: fix advertising unsupported 1000baseT_Half selftests/bpf: Fix massive output from test_maps media: cedrus: Add missing v4l2_ctrl_request_hdl_put() media: vicodec: add missing v4l2_ctrl_request_hdl_put() bnxt: don't enable NAPI until rings are ready xfs: fix boundary test in xfs_attr_shortform_verify bnxt_en: fix HWRM error when querying VF temperature bnxt_en: Fix possible crash in bnxt_fw_reset_task(). bnxt_en: Fix PCI AER error recovery flow bnxt_en: Check for zero dir entries in NVRAM. bnxt_en: Don't query FW when netif_running() is false. net: ethernet: ti: cpsw: fix clean up of vlan mc entries for host port gtp: add GTPA_LINK info to msg sent to userspace dmaengine: pl330: Fix burst length if burst size is smaller than bus width net: arc_emac: Fix memleak in arc_mdio_probe ravb: Fixed to be able to unload modules net: systemport: Fix memleak in bcm_sysport_probe net: hns: Fix memleak in hns_nic_dev_probe netfilter: nf_tables: fix destination register zeroing netfilter: nf_tables: incorrect enum nft_list_attributes definition netfilter: nf_tables: add NFTA_SET_USERDATA if not null mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040 MIPS: BMIPS: Also call bmips_cpu_setup() for secondary cores MIPS: mm: BMIPS5000 has inclusive physical caches rxrpc: Make rxrpc_kernel_get_srtt() indicate validity rxrpc: Keep the ACK serial in a var in rxrpc_input_ack() dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate() batman-adv: bla: use netif_rx_ni when not in interrupt context batman-adv: Fix own OGM check in aggregated OGMs batman-adv: Avoid uninitialized chaddr when handling DHCP dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling fsldma: fix very broken 32-bit ppc ioread64 functionality xen/xenbus: Fix granting of vmalloc'd memory drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init drm/amd/display: Retry AUX write when fail occurs drivers: gpu: amd: Initialize amdgpu_dm_backlight_caps object to 0 in amdgpu_dm_update_backlight_caps drm/amd/display: Reject overlay plane configurations in multi-display scenarios s390: don't trace preemption in percpu macros nbd: restore default timeout when setting it to zero cpuidle: Fixup IRQ state drm/omap: fix incorrect lock state ceph: don't allow setlease on cephfs drm/msm/a6xx: fix gmu start on newer firmware habanalabs: check correct vmalloc return code habanalabs: validate FW file size drm/msm: enable vblank during atomic commits nvmet: Disable keep-alive timer when kato is cleared to 0h hwmon: (applesmc) check status earlier. drm/msm: add shutdown support for display platform_driver tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup drm/msm/dpu: Fix scale params in plane validation HID: quirks: Always poll three more Lenovo PixArt mice Linux 5.4.63 scsi: target: tcmu: Optimize use of flush_dcache_page scsi: target: tcmu: Fix size in calls to tcmu_flush_dcache_range sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra186 sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra210 arm64: tegra: Add missing timeout clock to Tegra210 SDMMC arm64: tegra: Add missing timeout clock to Tegra186 SDMMC nodes arm64: tegra: Add missing timeout clock to Tegra194 SDMMC nodes dt-bindings: mmc: tegra: Add tmclk for Tegra210 and later KVM: arm64: Set HCR_EL2.PTW to prevent AT taking synchronous exception KVM: arm64: Survive synchronous exceptions caused by AT instructions KVM: arm64: Add kvm_extable for vaxorcism code drm/etnaviv: fix TS cache flushing on GPUs with BLT engine drm/sched: Fix passing zero to 'PTR_ERR' warning v2 perf record/stat: Explicitly call out event modifiers in the documentation HID: core: Sanitize event code and type when mapping input HID: core: Correctly handle ReportSize being zero Linux 5.4.62 io_uring: Fix NULL pointer dereference in io_sq_wq_submit_work() ALSA: usb-audio: Update documentation comment for MS2109 quirk HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage() kbuild: fix broken builds because of GZIP,BZIP2,LZOP variables kbuild: add variables for compression tools kheaders: explain why include/config/autoconf.h is excluded from md5sum kheaders: remove the last bashism to allow sh to run it kheaders: optimize header copy for in-tree builds kheaders: optimize md5sum calculation for in-tree builds kheaders: remove unneeded 'cat' command piped to 'head' / 'tail' fbmem: pull fbcon_update_vcs() out of fb_set_var() usb: dwc3: gadget: Handle ZLP for sg requests usb: dwc3: gadget: Fix handling ZLP usb: dwc3: gadget: Don't setup more than requested drm/i915: Fix cmd parser desc matching with masks usb: storage: Add unusual_uas entry for Sony PSZ drives USB: cdc-acm: rework notification_buffer resizing USB: gadget: u_f: Unbreak offset calculation in VLAs USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb() USB: gadget: u_f: add overflow checks to VLA macros usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe() USB: Ignore UAS for JMicron JMS567 ATA/ATAPI Bridge USB: quirks: Ignore duplicate endpoint on Sound Devices MixPre-D USB: quirks: Add no-lpm quirk for another Raydium touchscreen usb: uas: Add quirk for PNY Pro Elite USB: yurex: Fix bad gfp argument drm/amd/pm: correct the thermal alert temperature limit settings drm/amd/pm: correct Vega20 swctf limit setting drm/amd/pm: correct Vega12 swctf limit setting drm/amd/pm: correct Vega10 swctf limit setting drm/amd/powerplay: Fix hardmins not being sent to SMU for RV drm/amdgpu/gfx10: refine mgcg setting drm/amdgpu: Fix buffer overflow in INFO ioctl x86/hotplug: Silence APIC only after all interrupts are migrated irqchip/stm32-exti: Avoid losing interrupts due to clearing pending bits by mistake genirq/matrix: Deal with the sillyness of for_each_cpu() on UP crypto: af_alg - Work around empty control messages without MSG_MORE device property: Fix the secondary firmware node handling in set_primary_fwnode() powerpc/perf: Fix crashes with generic_compat_pmu & BHRB PM: sleep: core: Fix the handling of pending runtime resume requests arm64: vdso32: make vdso32 install conditional xhci: Always restore EP_SOFT_CLEAR_TOGGLE even if ep reset failed xhci: Do warm-reset when both CAS and XDEV_RESUME are set usb: host: xhci: fix ep context print mismatch in debugfs XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information. writeback: Fix sync livelock due to b_dirty_time processing writeback: Avoid skipping inode writeback writeback: Protect inode->i_io_list with inode->i_lock serial: 8250: change lock order in serial8250_do_startup() serial: 8250_exar: Fix number of ports for Commtech PCIe cards serial: stm32: avoid kernel warning on absence of optional IRQ serial: pl011: Don't leak amba_ports entry on driver register error serial: pl011: Fix oops on -EPROBE_DEFER serial: samsung: Removes the IRQ not found warning vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize() vt: defer kfree() of vc_screenbuf in vc_do_resize() USB: lvtest: return proper error code in probe fbcon: prevent user font height or width change from causing potential out-of-bounds access btrfs: detect nocow for swap after snapshot delete btrfs: fix space cache memory leak after transaction abort btrfs: check the right error variable in btrfs_del_dir_entries_in_log btrfs: reset compression level for lzo on remount blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands block: loop: set discard granularity and alignment for block device backed loop block: fix get_max_io_size() arm64: Allow booting of late CPUs affected by erratum1418040arm64: Move handling of erratum1418040into C code powerpc/perf: Fix soft lockups due to missed interrupt accounting net: gianfar: Add of_node_put() before goto statement macvlan: validate setting of multiple remote source MAC addresses Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command" scsi: qla2xxx: Fix null pointer access during disconnect from subsystem scsi: qla2xxx: Check if FW supports MQ before enabling scsi: qla2xxx: Fix login timeout scsi: ufs: Clean up completed request without interrupt notification scsi: ufs: Improve interrupt handling for shared interrupts scsi: ufs: Fix possible infinite loop in ufshcd_hold scsi: fcoe: Fix I/O path allocation selftests: disable rp_filter for icmp_redirect.sh ASoC: wm8994: Avoid attempts to read unreadable registers s390/cio: add cond_resched() in the slow_eval_known_fn() loop ALSA: hda/realtek: Add model alc298-samsung-headphone can: j1939: transport: j1939_xtp_rx_dat_one(): compare own packets to detect corruptions netfilter: avoid ipv6 -> nf_defrag_ipv6 module dependency drm/amd/display: Switch to immediate mode for updating infopackets drm/amd/powerplay: correct UVD/VCE PG state on custom pptable uploading drm/amd/powerplay: correct Vega20 cached smu feature state spi: stm32: always perform registers configuration prior to transfer spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate spi: stm32: fix fifo threshold level in case of short transfer spi: stm32h7: fix race condition at end of transfer fs: prevent BUG_ON in submit_bh_wbc() ext4: correctly restore system zone info when remount fails ext4: handle error of ext4_setup_system_zone() on remount ext4: handle option set by mount flags correctly jbd2: abort journal if free a async write error metadata buffer ext4: handle read only external journal device ext4: don't BUG on inconsistent journal feature jbd2: make sure jh have b_transaction set in refile/unfile_buffer spi: stm32: clear only asserted irq flags on interrupt usb: gadget: f_tcm: Fix some resource leaks in some error paths i2c: rcar: in slave mode, clear NACK earlier i2c: core: Don't fail PRP0001 enumeration when no ID table exist null_blk: fix passing of REQ_FUA flag in null_handle_rq nvme: multipath: round-robin: fix single non-optimized path case nvme-fc: Fix wrong return value in __nvme_fc_init_request() blkcg: fix memleak for iolatency blk-mq: insert request not through ->queue_rq into sw/scheduler queue hwmon: (nct7904) Correct divide by 0 bfq: fix blkio cgroup leakage v4 block: Fix page_is_mergeable() for compound pages drm/msm/adreno: fix updating ring fence block: virtio_blk: fix handling single range discard request block: respect queue limit of max discard segment media: gpio-ir-tx: improve precision of transmitted signal due to scheduling ALSA: usb-audio: Add capture support for Saffire 6 (USB 1.1) cpufreq: intel_pstate: Fix EPP setting via sysfs in active mode PCI: qcom: Add missing reset for ipq806x PCI: qcom: Change duplicate PCI reset to phy reset PCI: qcom: Add missing ipq806x clocks in PCIe driver EDAC/{i7core,sb,pnd2,skx}: Fix error event severity EDAC: skx_common: get rid of unused type var EDAC: sb_edac: get rid of unused vars mm/vunmap: add cond_resched() in vunmap_pmd_range drm/amd/display: Fix dmesg warning from setting abm level drm/amd/display: Add additional config guards for DCN drm/amd/display: Trigger modesets on MST DSC connectors drm/ingenic: Fix incorrect assumption about plane->index gpu/drm: ingenic: Use the plane's src_[x,y] to configure DMA length cma: don't quit at first error when activating reserved areas mm/cma.c: switch to bitmap_zalloc() for cma bitmap allocation mm: fix kthread_use_mm() vs TLB invalidate mm/shuffle: don't move pages between zones and don't read garbage memmaps btrfs: only commit delayed items at fsync if we are logging a directory btrfs: only commit the delayed inode when doing a full fsync btrfs: factor out inode items copy loop from btrfs_log_inode() s390/numa: set node distance to LOCAL_DISTANCE drm/xen-front: Fix misused IS_ERR_OR_NULL checks drm/xen: fix passing zero to 'PTR_ERR' warning PM / devfreq: rk3399_dmc: Fix kernel oops when rockchip,pmu is absent PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails PM / devfreq: rk3399_dmc: Add missing of_node_put() usb: cdns3: gadget: always zeroed TRB buffer when enable endpoint sched/uclamp: Fix a deadlock when enabling uclamp static key sched/uclamp: Protect uclamp fast path code with static key Revert "ath10k: fix DMA related firmware crashes on multiple devices" arm64: Fix __cpu_logical_map undefined issue efi: provide empty efi_enter_virtual_mode implementation brcmfmac: Set timeout value when configuring power save USB: sisusbvga: Fix a potential UB casued by left shifting a negative value powerpc/spufs: add CONFIG_COREDUMP dependency KVM: arm64: Fix symbol dependency in __hyp_call_panic_nvhe media: davinci: vpif_capture: fix potential double free hugetlbfs: prevent filesystem stacking of hugetlbfs EDAC/ie31200: Fallback if host bridge device is already initialized scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del() ceph: do not access the kiocb after aio requests ceph: fix potential mdsc use-after-free crash scsi: iscsi: Do not put host in iscsi_set_flashnode_param() btrfs: make btrfs_qgroup_check_reserved_leak take btrfs_inode btrfs: file: reserve qgroup space after the hole punch range is locked locking/lockdep: Fix overflow in presentation of average lock-time drm/nouveau: Fix reference count leak in nouveau_connector_detect drm/nouveau: fix reference count leak in nv50_disp_atomic_commit drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open f2fs: fix use-after-free issue HID: quirks: add NOGET quirk for Logitech GROUP cec-api: prevent leaking memory through hole in structure ALSA: hda: Add support for Loongson 7A1000 controller mips/vdso: Fix resource leaks in genvdso.c rtlwifi: rtl8192cu: Prevent leaking urb ARM: dts: ls1021a: output PPS signal on FIPER2 PCI: Fix pci_create_slot() reference count leak omapfb: fix multiple reference count leaks due to pm_runtime_get_sync f2fs: fix error path in do_recover_data() selftests/powerpc: Purge extra count_pmc() calls of ebb selftests scsi: target: Fix xcopy sess release leak xfs: Don't allow logging of XFS_ISTALE inodes scsi: lpfc: Fix shost refcount mismatch when deleting vport drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config drm/amd/display: fix ref count leak in amdgpu_drm_ioctl drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms drm/radeon: fix multiple reference count leak drm/amdkfd: Fix reference count leaks. iommu/iova: Don't BUG on invalid PFNs mfd: intel-lpss: Add Intel Tiger Lake PCH-H PCI IDs scsi: target: tcmu: Fix crash on ARM during cmd completion blktrace: ensure our debugfs dir exists media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq() powerpc/xive: Ignore kmemleak false positives arm64: dts: qcom: msm8916: Pull down PDM GPIOs during sleep mfd: intel-lpss: Add Intel Emmitsburg PCH PCI IDs ASoC: tegra: Fix reference count leaks. ASoC: img-parallel-out: Fix a reference count leak ASoC: img: Fix a reference count leak in img_i2s_in_set_fmt ALSA: hda/hdmi: Use force connectivity quirk on another HP desktop ALSA: hda/realtek: Fix pin default on Intel NUC 8 Rugged ALSA: pci: delete repeated words in comments ALSA: hda/hdmi: Add quirk to force connectivity ipvlan: fix device features net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow net: ena: Make missed_tx stat incremental tipc: fix uninit skb->data in tipc_nl_compat_dumpit() net/smc: Prevent kernel-infoleak in __smc_diag_dump() net: sctp: Fix negotiation of the number of data streams. net: qrtr: fix usage of idr in port assignment to socket net: nexthop: don't allow empty NHA_GROUP net: Fix potential wrong skb->protocol in skb_vlan_untag() gre6: Fix reception with IP6_TNL_F_RCV_DSCP_COPY binfmt_flat: revert "binfmt_flat: don't offset the data start" powerpc/64s: Don't init FSCR_DSCR in __init_FSCR() Conflicts: Documentation/devicetree/bindings Documentation/devicetree/bindings/gpio/sgpio-aspeed.txt Documentation/devicetree/bindings/mmc/mtk-sd.txt Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.txt Documentation/devicetree/bindings/net/can/tcan4x5x.txt Documentation/devicetree/bindings/net/nfc/nxp-nci.txt Documentation/devicetree/bindings/net/nfc/pn544.txt Documentation/devicetree/bindings/sound/wm8994.txt block/bio.c block/blk-mq-sysfs.c block/blk-sysfs.c drivers/hid/hid-quirks.c drivers/mailbox/mailbox.c drivers/mmc/host/cqhci.c drivers/scsi/ufs/ufshcd.c drivers/soc/qcom/smp2p.c drivers/usb/dwc3/core.c drivers/usb/dwc3/core.h drivers/usb/dwc3/ep0.c drivers/usb/dwc3/gadget.c drivers/usb/dwc3/gadget.h drivers/usb/gadget/function/f_fs.c drivers/usb/host/xhci.c kernel/sched/cpufreq_schedutil.c mm/cma.c mm/madvise.c mm/memory.c mm/page_alloc.c net/qrtr/qrtr.c Change-Id: I5d64dc5428045e92d5d1ce73dd55f78b36e83371 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
4626 lines
118 KiB
C
4626 lines
118 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
Copyright (C) 2002 Richard Henderson
|
|
Copyright (C) 2001 Rusty Russell, 2002, 2010 Rusty Russell IBM.
|
|
|
|
*/
|
|
#include <linux/export.h>
|
|
#include <linux/extable.h>
|
|
#include <linux/moduleloader.h>
|
|
#include <linux/module_signature.h>
|
|
#include <linux/trace_events.h>
|
|
#include <linux/init.h>
|
|
#include <linux/kallsyms.h>
|
|
#include <linux/file.h>
|
|
#include <linux/fs.h>
|
|
#include <linux/sysfs.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <linux/elf.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/security.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/fcntl.h>
|
|
#include <linux/rcupdate.h>
|
|
#include <linux/capability.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/moduleparam.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/err.h>
|
|
#include <linux/vermagic.h>
|
|
#include <linux/notifier.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/device.h>
|
|
#include <linux/string.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/rculist.h>
|
|
#include <linux/uaccess.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <linux/set_memory.h>
|
|
#include <asm/mmu_context.h>
|
|
#include <linux/license.h>
|
|
#include <asm/sections.h>
|
|
#include <linux/tracepoint.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/livepatch.h>
|
|
#include <linux/async.h>
|
|
#include <linux/percpu.h>
|
|
#include <linux/kmemleak.h>
|
|
#include <linux/jump_label.h>
|
|
#include <linux/pfn.h>
|
|
#include <linux/bsearch.h>
|
|
#include <linux/dynamic_debug.h>
|
|
#include <linux/audit.h>
|
|
#include <uapi/linux/module.h>
|
|
#include "module-internal.h"
|
|
|
|
#define CREATE_TRACE_POINTS
|
|
#include <trace/events/module.h>
|
|
|
|
#ifndef ARCH_SHF_SMALL
|
|
#define ARCH_SHF_SMALL 0
|
|
#endif
|
|
|
|
/*
|
|
* Modules' sections will be aligned on page boundaries
|
|
* to ensure complete separation of code and data, but
|
|
* only when CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
|
|
*/
|
|
#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX
|
|
# define debug_align(X) ALIGN(X, PAGE_SIZE)
|
|
#else
|
|
# define debug_align(X) (X)
|
|
#endif
|
|
|
|
/* If this is set, the section belongs in the init part of the module */
|
|
#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
|
|
|
|
/*
|
|
* Mutex protects:
|
|
* 1) List of modules (also safely readable with preempt_disable),
|
|
* 2) module_use links,
|
|
* 3) module_addr_min/module_addr_max.
|
|
* (delete and add uses RCU list operations). */
|
|
DEFINE_MUTEX(module_mutex);
|
|
EXPORT_SYMBOL_GPL(module_mutex);
|
|
static LIST_HEAD(modules);
|
|
|
|
/* Work queue for freeing init sections in success case */
|
|
static void do_free_init(struct work_struct *w);
|
|
static DECLARE_WORK(init_free_wq, do_free_init);
|
|
static LLIST_HEAD(init_free_list);
|
|
|
|
#ifdef CONFIG_MODULES_TREE_LOOKUP
|
|
|
|
/*
|
|
* Use a latched RB-tree for __module_address(); this allows us to use
|
|
* RCU-sched lookups of the address from any context.
|
|
*
|
|
* This is conditional on PERF_EVENTS || TRACING because those can really hit
|
|
* __module_address() hard by doing a lot of stack unwinding; potentially from
|
|
* NMI context.
|
|
*/
|
|
|
|
static __always_inline unsigned long __mod_tree_val(struct latch_tree_node *n)
|
|
{
|
|
struct module_layout *layout = container_of(n, struct module_layout, mtn.node);
|
|
|
|
return (unsigned long)layout->base;
|
|
}
|
|
|
|
static __always_inline unsigned long __mod_tree_size(struct latch_tree_node *n)
|
|
{
|
|
struct module_layout *layout = container_of(n, struct module_layout, mtn.node);
|
|
|
|
return (unsigned long)layout->size;
|
|
}
|
|
|
|
static __always_inline bool
|
|
mod_tree_less(struct latch_tree_node *a, struct latch_tree_node *b)
|
|
{
|
|
return __mod_tree_val(a) < __mod_tree_val(b);
|
|
}
|
|
|
|
static __always_inline int
|
|
mod_tree_comp(void *key, struct latch_tree_node *n)
|
|
{
|
|
unsigned long val = (unsigned long)key;
|
|
unsigned long start, end;
|
|
|
|
start = __mod_tree_val(n);
|
|
if (val < start)
|
|
return -1;
|
|
|
|
end = start + __mod_tree_size(n);
|
|
if (val >= end)
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct latch_tree_ops mod_tree_ops = {
|
|
.less = mod_tree_less,
|
|
.comp = mod_tree_comp,
|
|
};
|
|
|
|
static struct mod_tree_root {
|
|
struct latch_tree_root root;
|
|
unsigned long addr_min;
|
|
unsigned long addr_max;
|
|
} mod_tree __cacheline_aligned = {
|
|
.addr_min = -1UL,
|
|
};
|
|
|
|
#define module_addr_min mod_tree.addr_min
|
|
#define module_addr_max mod_tree.addr_max
|
|
|
|
static noinline void __mod_tree_insert(struct mod_tree_node *node)
|
|
{
|
|
latch_tree_insert(&node->node, &mod_tree.root, &mod_tree_ops);
|
|
}
|
|
|
|
static void __mod_tree_remove(struct mod_tree_node *node)
|
|
{
|
|
latch_tree_erase(&node->node, &mod_tree.root, &mod_tree_ops);
|
|
}
|
|
|
|
/*
|
|
* These modifications: insert, remove_init and remove; are serialized by the
|
|
* module_mutex.
|
|
*/
|
|
static void mod_tree_insert(struct module *mod)
|
|
{
|
|
mod->core_layout.mtn.mod = mod;
|
|
mod->init_layout.mtn.mod = mod;
|
|
|
|
__mod_tree_insert(&mod->core_layout.mtn);
|
|
if (mod->init_layout.size)
|
|
__mod_tree_insert(&mod->init_layout.mtn);
|
|
}
|
|
|
|
static void mod_tree_remove_init(struct module *mod)
|
|
{
|
|
if (mod->init_layout.size)
|
|
__mod_tree_remove(&mod->init_layout.mtn);
|
|
}
|
|
|
|
static void mod_tree_remove(struct module *mod)
|
|
{
|
|
__mod_tree_remove(&mod->core_layout.mtn);
|
|
mod_tree_remove_init(mod);
|
|
}
|
|
|
|
static struct module *mod_find(unsigned long addr)
|
|
{
|
|
struct latch_tree_node *ltn;
|
|
|
|
ltn = latch_tree_find((void *)addr, &mod_tree.root, &mod_tree_ops);
|
|
if (!ltn)
|
|
return NULL;
|
|
|
|
return container_of(ltn, struct mod_tree_node, node)->mod;
|
|
}
|
|
|
|
#else /* MODULES_TREE_LOOKUP */
|
|
|
|
static unsigned long module_addr_min = -1UL, module_addr_max = 0;
|
|
|
|
static void mod_tree_insert(struct module *mod) { }
|
|
static void mod_tree_remove_init(struct module *mod) { }
|
|
static void mod_tree_remove(struct module *mod) { }
|
|
|
|
static struct module *mod_find(unsigned long addr)
|
|
{
|
|
struct module *mod;
|
|
|
|
list_for_each_entry_rcu(mod, &modules, list,
|
|
lockdep_is_held(&module_mutex)) {
|
|
if (within_module(addr, mod))
|
|
return mod;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
#endif /* MODULES_TREE_LOOKUP */
|
|
|
|
/*
|
|
* Bounds of module text, for speeding up __module_address.
|
|
* Protected by module_mutex.
|
|
*/
|
|
static void __mod_update_bounds(void *base, unsigned int size)
|
|
{
|
|
unsigned long min = (unsigned long)base;
|
|
unsigned long max = min + size;
|
|
|
|
if (min < module_addr_min)
|
|
module_addr_min = min;
|
|
if (max > module_addr_max)
|
|
module_addr_max = max;
|
|
}
|
|
|
|
static void mod_update_bounds(struct module *mod)
|
|
{
|
|
__mod_update_bounds(mod->core_layout.base, mod->core_layout.size);
|
|
if (mod->init_layout.size)
|
|
__mod_update_bounds(mod->init_layout.base, mod->init_layout.size);
|
|
}
|
|
|
|
#ifdef CONFIG_KGDB_KDB
|
|
struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
|
|
#endif /* CONFIG_KGDB_KDB */
|
|
|
|
static void module_assert_mutex(void)
|
|
{
|
|
lockdep_assert_held(&module_mutex);
|
|
}
|
|
|
|
static void module_assert_mutex_or_preempt(void)
|
|
{
|
|
#ifdef CONFIG_LOCKDEP
|
|
if (unlikely(!debug_locks))
|
|
return;
|
|
|
|
WARN_ON_ONCE(!rcu_read_lock_sched_held() &&
|
|
!lockdep_is_held(&module_mutex));
|
|
#endif
|
|
}
|
|
|
|
static bool sig_enforce = IS_ENABLED(CONFIG_MODULE_SIG_FORCE);
|
|
module_param(sig_enforce, bool_enable_only, 0644);
|
|
|
|
/*
|
|
* Export sig_enforce kernel cmdline parameter to allow other subsystems rely
|
|
* on that instead of directly to CONFIG_MODULE_SIG_FORCE config.
|
|
*/
|
|
bool is_module_sig_enforced(void)
|
|
{
|
|
return sig_enforce;
|
|
}
|
|
EXPORT_SYMBOL(is_module_sig_enforced);
|
|
|
|
void set_module_sig_enforced(void)
|
|
{
|
|
sig_enforce = true;
|
|
}
|
|
|
|
/* Block module loading/unloading? */
|
|
int modules_disabled = 0;
|
|
core_param(nomodule, modules_disabled, bint, 0);
|
|
|
|
/* Waiting for a module to finish initializing? */
|
|
static DECLARE_WAIT_QUEUE_HEAD(module_wq);
|
|
|
|
static BLOCKING_NOTIFIER_HEAD(module_notify_list);
|
|
|
|
int register_module_notifier(struct notifier_block *nb)
|
|
{
|
|
return blocking_notifier_chain_register(&module_notify_list, nb);
|
|
}
|
|
EXPORT_SYMBOL(register_module_notifier);
|
|
|
|
int unregister_module_notifier(struct notifier_block *nb)
|
|
{
|
|
return blocking_notifier_chain_unregister(&module_notify_list, nb);
|
|
}
|
|
EXPORT_SYMBOL(unregister_module_notifier);
|
|
|
|
/*
|
|
* We require a truly strong try_module_get(): 0 means success.
|
|
* Otherwise an error is returned due to ongoing or failed
|
|
* initialization etc.
|
|
*/
|
|
static inline int strong_try_module_get(struct module *mod)
|
|
{
|
|
BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED);
|
|
if (mod && mod->state == MODULE_STATE_COMING)
|
|
return -EBUSY;
|
|
if (try_module_get(mod))
|
|
return 0;
|
|
else
|
|
return -ENOENT;
|
|
}
|
|
|
|
static inline void add_taint_module(struct module *mod, unsigned flag,
|
|
enum lockdep_ok lockdep_ok)
|
|
{
|
|
add_taint(flag, lockdep_ok);
|
|
set_bit(flag, &mod->taints);
|
|
}
|
|
|
|
/*
|
|
* A thread that wants to hold a reference to a module only while it
|
|
* is running can call this to safely exit. nfsd and lockd use this.
|
|
*/
|
|
void __noreturn __module_put_and_exit(struct module *mod, long code)
|
|
{
|
|
module_put(mod);
|
|
do_exit(code);
|
|
}
|
|
EXPORT_SYMBOL(__module_put_and_exit);
|
|
|
|
/* Find a module section: 0 means not found. */
|
|
static unsigned int find_sec(const struct load_info *info, const char *name)
|
|
{
|
|
unsigned int i;
|
|
|
|
for (i = 1; i < info->hdr->e_shnum; i++) {
|
|
Elf_Shdr *shdr = &info->sechdrs[i];
|
|
/* Alloc bit cleared means "ignore it." */
|
|
if ((shdr->sh_flags & SHF_ALLOC)
|
|
&& strcmp(info->secstrings + shdr->sh_name, name) == 0)
|
|
return i;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* Find a module section, or NULL. */
|
|
static void *section_addr(const struct load_info *info, const char *name)
|
|
{
|
|
/* Section 0 has sh_addr 0. */
|
|
return (void *)info->sechdrs[find_sec(info, name)].sh_addr;
|
|
}
|
|
|
|
/* Find a module section, or NULL. Fill in number of "objects" in section. */
|
|
static void *section_objs(const struct load_info *info,
|
|
const char *name,
|
|
size_t object_size,
|
|
unsigned int *num)
|
|
{
|
|
unsigned int sec = find_sec(info, name);
|
|
|
|
/* Section 0 has sh_addr 0 and sh_size 0. */
|
|
*num = info->sechdrs[sec].sh_size / object_size;
|
|
return (void *)info->sechdrs[sec].sh_addr;
|
|
}
|
|
|
|
/* Provided by the linker */
|
|
extern const struct kernel_symbol __start___ksymtab[];
|
|
extern const struct kernel_symbol __stop___ksymtab[];
|
|
extern const struct kernel_symbol __start___ksymtab_gpl[];
|
|
extern const struct kernel_symbol __stop___ksymtab_gpl[];
|
|
extern const struct kernel_symbol __start___ksymtab_gpl_future[];
|
|
extern const struct kernel_symbol __stop___ksymtab_gpl_future[];
|
|
extern const s32 __start___kcrctab[];
|
|
extern const s32 __start___kcrctab_gpl[];
|
|
extern const s32 __start___kcrctab_gpl_future[];
|
|
#ifdef CONFIG_UNUSED_SYMBOLS
|
|
extern const struct kernel_symbol __start___ksymtab_unused[];
|
|
extern const struct kernel_symbol __stop___ksymtab_unused[];
|
|
extern const struct kernel_symbol __start___ksymtab_unused_gpl[];
|
|
extern const struct kernel_symbol __stop___ksymtab_unused_gpl[];
|
|
extern const s32 __start___kcrctab_unused[];
|
|
extern const s32 __start___kcrctab_unused_gpl[];
|
|
#endif
|
|
|
|
#ifndef CONFIG_MODVERSIONS
|
|
#define symversion(base, idx) NULL
|
|
#else
|
|
#define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL)
|
|
#endif
|
|
|
|
static bool each_symbol_in_section(const struct symsearch *arr,
|
|
unsigned int arrsize,
|
|
struct module *owner,
|
|
bool (*fn)(const struct symsearch *syms,
|
|
struct module *owner,
|
|
void *data),
|
|
void *data)
|
|
{
|
|
unsigned int j;
|
|
|
|
for (j = 0; j < arrsize; j++) {
|
|
if (fn(&arr[j], owner, data))
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/* Returns true as soon as fn returns true, otherwise false. */
|
|
static bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
|
|
struct module *owner,
|
|
void *data),
|
|
void *data)
|
|
{
|
|
struct module *mod;
|
|
static const struct symsearch arr[] = {
|
|
{ __start___ksymtab, __stop___ksymtab, __start___kcrctab,
|
|
NOT_GPL_ONLY, false },
|
|
{ __start___ksymtab_gpl, __stop___ksymtab_gpl,
|
|
__start___kcrctab_gpl,
|
|
GPL_ONLY, false },
|
|
{ __start___ksymtab_gpl_future, __stop___ksymtab_gpl_future,
|
|
__start___kcrctab_gpl_future,
|
|
WILL_BE_GPL_ONLY, false },
|
|
#ifdef CONFIG_UNUSED_SYMBOLS
|
|
{ __start___ksymtab_unused, __stop___ksymtab_unused,
|
|
__start___kcrctab_unused,
|
|
NOT_GPL_ONLY, true },
|
|
{ __start___ksymtab_unused_gpl, __stop___ksymtab_unused_gpl,
|
|
__start___kcrctab_unused_gpl,
|
|
GPL_ONLY, true },
|
|
#endif
|
|
};
|
|
|
|
module_assert_mutex_or_preempt();
|
|
|
|
if (each_symbol_in_section(arr, ARRAY_SIZE(arr), NULL, fn, data))
|
|
return true;
|
|
|
|
list_for_each_entry_rcu(mod, &modules, list,
|
|
lockdep_is_held(&module_mutex)) {
|
|
struct symsearch arr[] = {
|
|
{ mod->syms, mod->syms + mod->num_syms, mod->crcs,
|
|
NOT_GPL_ONLY, false },
|
|
{ mod->gpl_syms, mod->gpl_syms + mod->num_gpl_syms,
|
|
mod->gpl_crcs,
|
|
GPL_ONLY, false },
|
|
{ mod->gpl_future_syms,
|
|
mod->gpl_future_syms + mod->num_gpl_future_syms,
|
|
mod->gpl_future_crcs,
|
|
WILL_BE_GPL_ONLY, false },
|
|
#ifdef CONFIG_UNUSED_SYMBOLS
|
|
{ mod->unused_syms,
|
|
mod->unused_syms + mod->num_unused_syms,
|
|
mod->unused_crcs,
|
|
NOT_GPL_ONLY, true },
|
|
{ mod->unused_gpl_syms,
|
|
mod->unused_gpl_syms + mod->num_unused_gpl_syms,
|
|
mod->unused_gpl_crcs,
|
|
GPL_ONLY, true },
|
|
#endif
|
|
};
|
|
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
|
|
if (each_symbol_in_section(arr, ARRAY_SIZE(arr), mod, fn, data))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
struct find_symbol_arg {
|
|
/* Input */
|
|
const char *name;
|
|
bool gplok;
|
|
bool warn;
|
|
|
|
/* Output */
|
|
struct module *owner;
|
|
const s32 *crc;
|
|
const struct kernel_symbol *sym;
|
|
enum mod_license license;
|
|
};
|
|
|
|
static bool check_exported_symbol(const struct symsearch *syms,
|
|
struct module *owner,
|
|
unsigned int symnum, void *data)
|
|
{
|
|
struct find_symbol_arg *fsa = data;
|
|
|
|
if (!fsa->gplok) {
|
|
if (syms->license == GPL_ONLY)
|
|
return false;
|
|
if (syms->license == WILL_BE_GPL_ONLY && fsa->warn) {
|
|
pr_warn("Symbol %s is being used by a non-GPL module, "
|
|
"which will not be allowed in the future\n",
|
|
fsa->name);
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_UNUSED_SYMBOLS
|
|
if (syms->unused && fsa->warn) {
|
|
pr_warn("Symbol %s is marked as UNUSED, however this module is "
|
|
"using it.\n", fsa->name);
|
|
pr_warn("This symbol will go away in the future.\n");
|
|
pr_warn("Please evaluate if this is the right api to use and "
|
|
"if it really is, submit a report to the linux kernel "
|
|
"mailing list together with submitting your code for "
|
|
"inclusion.\n");
|
|
}
|
|
#endif
|
|
|
|
fsa->owner = owner;
|
|
fsa->crc = symversion(syms->crcs, symnum);
|
|
fsa->sym = &syms->start[symnum];
|
|
fsa->license = syms->license;
|
|
return true;
|
|
}
|
|
|
|
static unsigned long kernel_symbol_value(const struct kernel_symbol *sym)
|
|
{
|
|
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
|
|
return (unsigned long)offset_to_ptr(&sym->value_offset);
|
|
#else
|
|
return sym->value;
|
|
#endif
|
|
}
|
|
|
|
static const char *kernel_symbol_name(const struct kernel_symbol *sym)
|
|
{
|
|
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
|
|
return offset_to_ptr(&sym->name_offset);
|
|
#else
|
|
return sym->name;
|
|
#endif
|
|
}
|
|
|
|
static const char *kernel_symbol_namespace(const struct kernel_symbol *sym)
|
|
{
|
|
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
|
|
if (!sym->namespace_offset)
|
|
return NULL;
|
|
return offset_to_ptr(&sym->namespace_offset);
|
|
#else
|
|
return sym->namespace;
|
|
#endif
|
|
}
|
|
|
|
static int cmp_name(const void *name, const void *sym)
|
|
{
|
|
return strcmp(name, kernel_symbol_name(sym));
|
|
}
|
|
|
|
static bool find_exported_symbol_in_section(const struct symsearch *syms,
|
|
struct module *owner,
|
|
void *data)
|
|
{
|
|
struct find_symbol_arg *fsa = data;
|
|
struct kernel_symbol *sym;
|
|
|
|
sym = bsearch(fsa->name, syms->start, syms->stop - syms->start,
|
|
sizeof(struct kernel_symbol), cmp_name);
|
|
|
|
if (sym != NULL && check_exported_symbol(syms, owner,
|
|
sym - syms->start, data))
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
/* Find an exported symbol and return it, along with, (optional) crc and
|
|
* (optional) module which owns it. Needs preempt disabled or module_mutex. */
|
|
static const struct kernel_symbol *find_symbol(const char *name,
|
|
struct module **owner,
|
|
const s32 **crc,
|
|
enum mod_license *license,
|
|
bool gplok,
|
|
bool warn)
|
|
{
|
|
struct find_symbol_arg fsa;
|
|
|
|
fsa.name = name;
|
|
fsa.gplok = gplok;
|
|
fsa.warn = warn;
|
|
|
|
if (each_symbol_section(find_exported_symbol_in_section, &fsa)) {
|
|
if (owner)
|
|
*owner = fsa.owner;
|
|
if (crc)
|
|
*crc = fsa.crc;
|
|
if (license)
|
|
*license = fsa.license;
|
|
return fsa.sym;
|
|
}
|
|
|
|
pr_debug("Failed to find symbol %s\n", name);
|
|
return NULL;
|
|
}
|
|
|
|
/*
|
|
* Search for module by name: must hold module_mutex (or preempt disabled
|
|
* for read-only access).
|
|
*/
|
|
static struct module *find_module_all(const char *name, size_t len,
|
|
bool even_unformed)
|
|
{
|
|
struct module *mod;
|
|
|
|
module_assert_mutex_or_preempt();
|
|
|
|
list_for_each_entry_rcu(mod, &modules, list,
|
|
lockdep_is_held(&module_mutex)) {
|
|
if (!even_unformed && mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
if (strlen(mod->name) == len && !memcmp(mod->name, name, len))
|
|
return mod;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
struct module *find_module(const char *name)
|
|
{
|
|
module_assert_mutex();
|
|
return find_module_all(name, strlen(name), false);
|
|
}
|
|
EXPORT_SYMBOL_GPL(find_module);
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
static inline void __percpu *mod_percpu(struct module *mod)
|
|
{
|
|
return mod->percpu;
|
|
}
|
|
|
|
static int percpu_modalloc(struct module *mod, struct load_info *info)
|
|
{
|
|
Elf_Shdr *pcpusec = &info->sechdrs[info->index.pcpu];
|
|
unsigned long align = pcpusec->sh_addralign;
|
|
|
|
if (!pcpusec->sh_size)
|
|
return 0;
|
|
|
|
if (align > PAGE_SIZE) {
|
|
pr_warn("%s: per-cpu alignment %li > %li\n",
|
|
mod->name, align, PAGE_SIZE);
|
|
align = PAGE_SIZE;
|
|
}
|
|
|
|
mod->percpu = __alloc_reserved_percpu(pcpusec->sh_size, align);
|
|
if (!mod->percpu) {
|
|
pr_warn("%s: Could not allocate %lu bytes percpu data\n",
|
|
mod->name, (unsigned long)pcpusec->sh_size);
|
|
return -ENOMEM;
|
|
}
|
|
mod->percpu_size = pcpusec->sh_size;
|
|
return 0;
|
|
}
|
|
|
|
static void percpu_modfree(struct module *mod)
|
|
{
|
|
free_percpu(mod->percpu);
|
|
}
|
|
|
|
static unsigned int find_pcpusec(struct load_info *info)
|
|
{
|
|
return find_sec(info, ".data..percpu");
|
|
}
|
|
|
|
static void percpu_modcopy(struct module *mod,
|
|
const void *from, unsigned long size)
|
|
{
|
|
int cpu;
|
|
|
|
for_each_possible_cpu(cpu)
|
|
memcpy(per_cpu_ptr(mod->percpu, cpu), from, size);
|
|
}
|
|
|
|
bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr)
|
|
{
|
|
struct module *mod;
|
|
unsigned int cpu;
|
|
|
|
preempt_disable();
|
|
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
if (!mod->percpu_size)
|
|
continue;
|
|
for_each_possible_cpu(cpu) {
|
|
void *start = per_cpu_ptr(mod->percpu, cpu);
|
|
void *va = (void *)addr;
|
|
|
|
if (va >= start && va < start + mod->percpu_size) {
|
|
if (can_addr) {
|
|
*can_addr = (unsigned long) (va - start);
|
|
*can_addr += (unsigned long)
|
|
per_cpu_ptr(mod->percpu,
|
|
get_boot_cpu_id());
|
|
}
|
|
preempt_enable();
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
preempt_enable();
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* is_module_percpu_address - test whether address is from module static percpu
|
|
* @addr: address to test
|
|
*
|
|
* Test whether @addr belongs to module static percpu area.
|
|
*
|
|
* RETURNS:
|
|
* %true if @addr is from module static percpu area
|
|
*/
|
|
bool is_module_percpu_address(unsigned long addr)
|
|
{
|
|
return __is_module_percpu_address(addr, NULL);
|
|
}
|
|
|
|
#else /* ... !CONFIG_SMP */
|
|
|
|
static inline void __percpu *mod_percpu(struct module *mod)
|
|
{
|
|
return NULL;
|
|
}
|
|
static int percpu_modalloc(struct module *mod, struct load_info *info)
|
|
{
|
|
/* UP modules shouldn't have this section: ENOMEM isn't quite right */
|
|
if (info->sechdrs[info->index.pcpu].sh_size != 0)
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
static inline void percpu_modfree(struct module *mod)
|
|
{
|
|
}
|
|
static unsigned int find_pcpusec(struct load_info *info)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline void percpu_modcopy(struct module *mod,
|
|
const void *from, unsigned long size)
|
|
{
|
|
/* pcpusec should be 0, and size of that section should be 0. */
|
|
BUG_ON(size != 0);
|
|
}
|
|
bool is_module_percpu_address(unsigned long addr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool __is_module_percpu_address(unsigned long addr, unsigned long *can_addr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
#define MODINFO_ATTR(field) \
|
|
static void setup_modinfo_##field(struct module *mod, const char *s) \
|
|
{ \
|
|
mod->field = kstrdup(s, GFP_KERNEL); \
|
|
} \
|
|
static ssize_t show_modinfo_##field(struct module_attribute *mattr, \
|
|
struct module_kobject *mk, char *buffer) \
|
|
{ \
|
|
return scnprintf(buffer, PAGE_SIZE, "%s\n", mk->mod->field); \
|
|
} \
|
|
static int modinfo_##field##_exists(struct module *mod) \
|
|
{ \
|
|
return mod->field != NULL; \
|
|
} \
|
|
static void free_modinfo_##field(struct module *mod) \
|
|
{ \
|
|
kfree(mod->field); \
|
|
mod->field = NULL; \
|
|
} \
|
|
static struct module_attribute modinfo_##field = { \
|
|
.attr = { .name = __stringify(field), .mode = 0444 }, \
|
|
.show = show_modinfo_##field, \
|
|
.setup = setup_modinfo_##field, \
|
|
.test = modinfo_##field##_exists, \
|
|
.free = free_modinfo_##field, \
|
|
};
|
|
|
|
MODINFO_ATTR(version);
|
|
MODINFO_ATTR(srcversion);
|
|
|
|
static char last_unloaded_module[MODULE_NAME_LEN+1];
|
|
|
|
#ifdef CONFIG_MODULE_UNLOAD
|
|
|
|
EXPORT_TRACEPOINT_SYMBOL(module_get);
|
|
|
|
/* MODULE_REF_BASE is the base reference count by kmodule loader. */
|
|
#define MODULE_REF_BASE 1
|
|
|
|
/* Init the unload section of the module. */
|
|
static int module_unload_init(struct module *mod)
|
|
{
|
|
/*
|
|
* Initialize reference counter to MODULE_REF_BASE.
|
|
* refcnt == 0 means module is going.
|
|
*/
|
|
atomic_set(&mod->refcnt, MODULE_REF_BASE);
|
|
|
|
INIT_LIST_HEAD(&mod->source_list);
|
|
INIT_LIST_HEAD(&mod->target_list);
|
|
|
|
/* Hold reference count during initialization. */
|
|
atomic_inc(&mod->refcnt);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* Does a already use b? */
|
|
static int already_uses(struct module *a, struct module *b)
|
|
{
|
|
struct module_use *use;
|
|
|
|
list_for_each_entry(use, &b->source_list, source_list) {
|
|
if (use->source == a) {
|
|
pr_debug("%s uses %s!\n", a->name, b->name);
|
|
return 1;
|
|
}
|
|
}
|
|
pr_debug("%s does not use %s!\n", a->name, b->name);
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Module a uses b
|
|
* - we add 'a' as a "source", 'b' as a "target" of module use
|
|
* - the module_use is added to the list of 'b' sources (so
|
|
* 'b' can walk the list to see who sourced them), and of 'a'
|
|
* targets (so 'a' can see what modules it targets).
|
|
*/
|
|
static int add_module_usage(struct module *a, struct module *b)
|
|
{
|
|
struct module_use *use;
|
|
|
|
pr_debug("Allocating new usage for %s.\n", a->name);
|
|
use = kmalloc(sizeof(*use), GFP_ATOMIC);
|
|
if (!use)
|
|
return -ENOMEM;
|
|
|
|
use->source = a;
|
|
use->target = b;
|
|
list_add(&use->source_list, &b->source_list);
|
|
list_add(&use->target_list, &a->target_list);
|
|
return 0;
|
|
}
|
|
|
|
/* Module a uses b: caller needs module_mutex() */
|
|
static int ref_module(struct module *a, struct module *b)
|
|
{
|
|
int err;
|
|
|
|
if (b == NULL || already_uses(a, b))
|
|
return 0;
|
|
|
|
/* If module isn't available, we fail. */
|
|
err = strong_try_module_get(b);
|
|
if (err)
|
|
return err;
|
|
|
|
err = add_module_usage(a, b);
|
|
if (err) {
|
|
module_put(b);
|
|
return err;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* Clear the unload stuff of the module. */
|
|
static void module_unload_free(struct module *mod)
|
|
{
|
|
struct module_use *use, *tmp;
|
|
|
|
mutex_lock(&module_mutex);
|
|
list_for_each_entry_safe(use, tmp, &mod->target_list, target_list) {
|
|
struct module *i = use->target;
|
|
pr_debug("%s unusing %s\n", mod->name, i->name);
|
|
module_put(i);
|
|
list_del(&use->source_list);
|
|
list_del(&use->target_list);
|
|
kfree(use);
|
|
}
|
|
mutex_unlock(&module_mutex);
|
|
}
|
|
|
|
#ifdef CONFIG_MODULE_FORCE_UNLOAD
|
|
static inline int try_force_unload(unsigned int flags)
|
|
{
|
|
int ret = (flags & O_TRUNC);
|
|
if (ret)
|
|
add_taint(TAINT_FORCED_RMMOD, LOCKDEP_NOW_UNRELIABLE);
|
|
return ret;
|
|
}
|
|
#else
|
|
static inline int try_force_unload(unsigned int flags)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_MODULE_FORCE_UNLOAD */
|
|
|
|
/* Try to release refcount of module, 0 means success. */
|
|
static int try_release_module_ref(struct module *mod)
|
|
{
|
|
int ret;
|
|
|
|
/* Try to decrement refcnt which we set at loading */
|
|
ret = atomic_sub_return(MODULE_REF_BASE, &mod->refcnt);
|
|
BUG_ON(ret < 0);
|
|
if (ret)
|
|
/* Someone can put this right now, recover with checking */
|
|
ret = atomic_add_unless(&mod->refcnt, MODULE_REF_BASE, 0);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int try_stop_module(struct module *mod, int flags, int *forced)
|
|
{
|
|
/* If it's not unused, quit unless we're forcing. */
|
|
if (try_release_module_ref(mod) != 0) {
|
|
*forced = try_force_unload(flags);
|
|
if (!(*forced))
|
|
return -EWOULDBLOCK;
|
|
}
|
|
|
|
/* Mark it as dying. */
|
|
mod->state = MODULE_STATE_GOING;
|
|
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* module_refcount - return the refcount or -1 if unloading
|
|
*
|
|
* @mod: the module we're checking
|
|
*
|
|
* Returns:
|
|
* -1 if the module is in the process of unloading
|
|
* otherwise the number of references in the kernel to the module
|
|
*/
|
|
int module_refcount(struct module *mod)
|
|
{
|
|
return atomic_read(&mod->refcnt) - MODULE_REF_BASE;
|
|
}
|
|
EXPORT_SYMBOL(module_refcount);
|
|
|
|
/* This exists whether we can unload or not */
|
|
static void free_module(struct module *mod);
|
|
|
|
SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
|
|
unsigned int, flags)
|
|
{
|
|
struct module *mod;
|
|
char name[MODULE_NAME_LEN];
|
|
int ret, forced = 0;
|
|
|
|
if (!capable(CAP_SYS_MODULE) || modules_disabled)
|
|
return -EPERM;
|
|
|
|
if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0)
|
|
return -EFAULT;
|
|
name[MODULE_NAME_LEN-1] = '\0';
|
|
|
|
audit_log_kern_module(name);
|
|
|
|
if (mutex_lock_interruptible(&module_mutex) != 0)
|
|
return -EINTR;
|
|
|
|
mod = find_module(name);
|
|
if (!mod) {
|
|
ret = -ENOENT;
|
|
goto out;
|
|
}
|
|
|
|
if (!list_empty(&mod->source_list)) {
|
|
/* Other modules depend on us: get rid of them first. */
|
|
ret = -EWOULDBLOCK;
|
|
goto out;
|
|
}
|
|
|
|
/* Doing init or already dying? */
|
|
if (mod->state != MODULE_STATE_LIVE) {
|
|
/* FIXME: if (force), slam module count damn the torpedoes */
|
|
pr_debug("%s already dying\n", mod->name);
|
|
ret = -EBUSY;
|
|
goto out;
|
|
}
|
|
|
|
/* If it has an init func, it must have an exit func to unload */
|
|
if (mod->init && !mod->exit) {
|
|
forced = try_force_unload(flags);
|
|
if (!forced) {
|
|
/* This module can't be removed */
|
|
ret = -EBUSY;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
/* Stop the machine so refcounts can't move and disable module. */
|
|
ret = try_stop_module(mod, flags, &forced);
|
|
if (ret != 0)
|
|
goto out;
|
|
|
|
mutex_unlock(&module_mutex);
|
|
/* Final destruction now no one is using it. */
|
|
if (mod->exit != NULL)
|
|
mod->exit();
|
|
blocking_notifier_call_chain(&module_notify_list,
|
|
MODULE_STATE_GOING, mod);
|
|
klp_module_going(mod);
|
|
ftrace_release_mod(mod);
|
|
|
|
async_synchronize_full();
|
|
|
|
/* Store the name of the last unloaded module for diagnostic purposes */
|
|
strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
|
|
|
|
free_module(mod);
|
|
/* someone could wait for the module in add_unformed_module() */
|
|
wake_up_all(&module_wq);
|
|
return 0;
|
|
out:
|
|
mutex_unlock(&module_mutex);
|
|
return ret;
|
|
}
|
|
|
|
static inline void print_unload_info(struct seq_file *m, struct module *mod)
|
|
{
|
|
struct module_use *use;
|
|
int printed_something = 0;
|
|
|
|
seq_printf(m, " %i ", module_refcount(mod));
|
|
|
|
/*
|
|
* Always include a trailing , so userspace can differentiate
|
|
* between this and the old multi-field proc format.
|
|
*/
|
|
list_for_each_entry(use, &mod->source_list, source_list) {
|
|
printed_something = 1;
|
|
seq_printf(m, "%s,", use->source->name);
|
|
}
|
|
|
|
if (mod->init != NULL && mod->exit == NULL) {
|
|
printed_something = 1;
|
|
seq_puts(m, "[permanent],");
|
|
}
|
|
|
|
if (!printed_something)
|
|
seq_puts(m, "-");
|
|
}
|
|
|
|
void __symbol_put(const char *symbol)
|
|
{
|
|
struct module *owner;
|
|
|
|
preempt_disable();
|
|
if (!find_symbol(symbol, &owner, NULL, NULL, true, false))
|
|
BUG();
|
|
module_put(owner);
|
|
preempt_enable();
|
|
}
|
|
|
|
/* Note this assumes addr is a function, which it currently always is. */
|
|
void symbol_put_addr(void *addr)
|
|
{
|
|
struct module *modaddr;
|
|
unsigned long a = (unsigned long)dereference_function_descriptor(addr);
|
|
|
|
if (core_kernel_text(a))
|
|
return;
|
|
|
|
/*
|
|
* Even though we hold a reference on the module; we still need to
|
|
* disable preemption in order to safely traverse the data structure.
|
|
*/
|
|
preempt_disable();
|
|
modaddr = __module_text_address(a);
|
|
BUG_ON(!modaddr);
|
|
module_put(modaddr);
|
|
preempt_enable();
|
|
}
|
|
EXPORT_SYMBOL_GPL(symbol_put_addr);
|
|
|
|
static ssize_t show_refcnt(struct module_attribute *mattr,
|
|
struct module_kobject *mk, char *buffer)
|
|
{
|
|
return sprintf(buffer, "%i\n", module_refcount(mk->mod));
|
|
}
|
|
|
|
static struct module_attribute modinfo_refcnt =
|
|
__ATTR(refcnt, 0444, show_refcnt, NULL);
|
|
|
|
void __module_get(struct module *module)
|
|
{
|
|
if (module) {
|
|
preempt_disable();
|
|
atomic_inc(&module->refcnt);
|
|
trace_module_get(module, _RET_IP_);
|
|
preempt_enable();
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(__module_get);
|
|
|
|
bool try_module_get(struct module *module)
|
|
{
|
|
bool ret = true;
|
|
|
|
if (module) {
|
|
preempt_disable();
|
|
/* Note: here, we can fail to get a reference */
|
|
if (likely(module_is_live(module) &&
|
|
atomic_inc_not_zero(&module->refcnt) != 0))
|
|
trace_module_get(module, _RET_IP_);
|
|
else
|
|
ret = false;
|
|
|
|
preempt_enable();
|
|
}
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL(try_module_get);
|
|
|
|
void module_put(struct module *module)
|
|
{
|
|
int ret;
|
|
|
|
if (module) {
|
|
preempt_disable();
|
|
ret = atomic_dec_if_positive(&module->refcnt);
|
|
WARN_ON(ret < 0); /* Failed to put refcount */
|
|
trace_module_put(module, _RET_IP_);
|
|
preempt_enable();
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(module_put);
|
|
|
|
#else /* !CONFIG_MODULE_UNLOAD */
|
|
static inline void print_unload_info(struct seq_file *m, struct module *mod)
|
|
{
|
|
/* We don't know the usage count, or what modules are using. */
|
|
seq_puts(m, " - -");
|
|
}
|
|
|
|
static inline void module_unload_free(struct module *mod)
|
|
{
|
|
}
|
|
|
|
static int ref_module(struct module *a, struct module *b)
|
|
{
|
|
return strong_try_module_get(b);
|
|
}
|
|
|
|
static inline int module_unload_init(struct module *mod)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_MODULE_UNLOAD */
|
|
|
|
static size_t module_flags_taint(struct module *mod, char *buf)
|
|
{
|
|
size_t l = 0;
|
|
int i;
|
|
|
|
for (i = 0; i < TAINT_FLAGS_COUNT; i++) {
|
|
if (taint_flags[i].module && test_bit(i, &mod->taints))
|
|
buf[l++] = taint_flags[i].c_true;
|
|
}
|
|
|
|
return l;
|
|
}
|
|
|
|
static ssize_t show_initstate(struct module_attribute *mattr,
|
|
struct module_kobject *mk, char *buffer)
|
|
{
|
|
const char *state = "unknown";
|
|
|
|
switch (mk->mod->state) {
|
|
case MODULE_STATE_LIVE:
|
|
state = "live";
|
|
break;
|
|
case MODULE_STATE_COMING:
|
|
state = "coming";
|
|
break;
|
|
case MODULE_STATE_GOING:
|
|
state = "going";
|
|
break;
|
|
default:
|
|
BUG();
|
|
}
|
|
return sprintf(buffer, "%s\n", state);
|
|
}
|
|
|
|
static struct module_attribute modinfo_initstate =
|
|
__ATTR(initstate, 0444, show_initstate, NULL);
|
|
|
|
static ssize_t store_uevent(struct module_attribute *mattr,
|
|
struct module_kobject *mk,
|
|
const char *buffer, size_t count)
|
|
{
|
|
int rc;
|
|
|
|
rc = kobject_synth_uevent(&mk->kobj, buffer, count);
|
|
return rc ? rc : count;
|
|
}
|
|
|
|
struct module_attribute module_uevent =
|
|
__ATTR(uevent, 0200, NULL, store_uevent);
|
|
|
|
static ssize_t show_coresize(struct module_attribute *mattr,
|
|
struct module_kobject *mk, char *buffer)
|
|
{
|
|
return sprintf(buffer, "%u\n", mk->mod->core_layout.size);
|
|
}
|
|
|
|
static struct module_attribute modinfo_coresize =
|
|
__ATTR(coresize, 0444, show_coresize, NULL);
|
|
|
|
static ssize_t show_initsize(struct module_attribute *mattr,
|
|
struct module_kobject *mk, char *buffer)
|
|
{
|
|
return sprintf(buffer, "%u\n", mk->mod->init_layout.size);
|
|
}
|
|
|
|
static struct module_attribute modinfo_initsize =
|
|
__ATTR(initsize, 0444, show_initsize, NULL);
|
|
|
|
static ssize_t show_taint(struct module_attribute *mattr,
|
|
struct module_kobject *mk, char *buffer)
|
|
{
|
|
size_t l;
|
|
|
|
l = module_flags_taint(mk->mod, buffer);
|
|
buffer[l++] = '\n';
|
|
return l;
|
|
}
|
|
|
|
static struct module_attribute modinfo_taint =
|
|
__ATTR(taint, 0444, show_taint, NULL);
|
|
|
|
static struct module_attribute *modinfo_attrs[] = {
|
|
&module_uevent,
|
|
&modinfo_version,
|
|
&modinfo_srcversion,
|
|
&modinfo_initstate,
|
|
&modinfo_coresize,
|
|
&modinfo_initsize,
|
|
&modinfo_taint,
|
|
#ifdef CONFIG_MODULE_UNLOAD
|
|
&modinfo_refcnt,
|
|
#endif
|
|
NULL,
|
|
};
|
|
|
|
static const char vermagic[] = VERMAGIC_STRING;
|
|
|
|
static int try_to_force_load(struct module *mod, const char *reason)
|
|
{
|
|
#ifdef CONFIG_MODULE_FORCE_LOAD
|
|
if (!test_taint(TAINT_FORCED_MODULE))
|
|
pr_warn("%s: %s: kernel tainted.\n", mod->name, reason);
|
|
add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_NOW_UNRELIABLE);
|
|
return 0;
|
|
#else
|
|
return -ENOEXEC;
|
|
#endif
|
|
}
|
|
|
|
#ifdef CONFIG_MODVERSIONS
|
|
|
|
static u32 resolve_rel_crc(const s32 *crc)
|
|
{
|
|
return *(u32 *)((void *)crc + *crc);
|
|
}
|
|
|
|
static int check_version(const struct load_info *info,
|
|
const char *symname,
|
|
struct module *mod,
|
|
const s32 *crc)
|
|
{
|
|
Elf_Shdr *sechdrs = info->sechdrs;
|
|
unsigned int versindex = info->index.vers;
|
|
unsigned int i, num_versions;
|
|
struct modversion_info *versions;
|
|
|
|
/* Exporting module didn't supply crcs? OK, we're already tainted. */
|
|
if (!crc)
|
|
return 1;
|
|
|
|
/* No versions at all? modprobe --force does this. */
|
|
if (versindex == 0)
|
|
return try_to_force_load(mod, symname) == 0;
|
|
|
|
versions = (void *) sechdrs[versindex].sh_addr;
|
|
num_versions = sechdrs[versindex].sh_size
|
|
/ sizeof(struct modversion_info);
|
|
|
|
for (i = 0; i < num_versions; i++) {
|
|
u32 crcval;
|
|
|
|
if (strcmp(versions[i].name, symname) != 0)
|
|
continue;
|
|
|
|
if (IS_ENABLED(CONFIG_MODULE_REL_CRCS))
|
|
crcval = resolve_rel_crc(crc);
|
|
else
|
|
crcval = *crc;
|
|
if (versions[i].crc == crcval)
|
|
return 1;
|
|
pr_debug("Found checksum %X vs module %lX\n",
|
|
crcval, versions[i].crc);
|
|
goto bad_version;
|
|
}
|
|
|
|
/* Broken toolchain. Warn once, then let it go.. */
|
|
pr_warn_once("%s: no symbol version for %s\n", info->name, symname);
|
|
return 1;
|
|
|
|
bad_version:
|
|
pr_warn("%s: disagrees about version of symbol %s\n",
|
|
info->name, symname);
|
|
return 0;
|
|
}
|
|
|
|
static inline int check_modstruct_version(const struct load_info *info,
|
|
struct module *mod)
|
|
{
|
|
const s32 *crc;
|
|
|
|
/*
|
|
* Since this should be found in kernel (which can't be removed), no
|
|
* locking is necessary -- use preempt_disable() to placate lockdep.
|
|
*/
|
|
preempt_disable();
|
|
if (!find_symbol("module_layout", NULL, &crc, NULL, true, false)) {
|
|
preempt_enable();
|
|
BUG();
|
|
}
|
|
preempt_enable();
|
|
return check_version(info, "module_layout", mod, crc);
|
|
}
|
|
|
|
/* First part is kernel version, which we ignore if module has crcs. */
|
|
static inline int same_magic(const char *amagic, const char *bmagic,
|
|
bool has_crcs)
|
|
{
|
|
if (has_crcs) {
|
|
amagic += strcspn(amagic, " ");
|
|
bmagic += strcspn(bmagic, " ");
|
|
}
|
|
return strcmp(amagic, bmagic) == 0;
|
|
}
|
|
#else
|
|
static inline int check_version(const struct load_info *info,
|
|
const char *symname,
|
|
struct module *mod,
|
|
const s32 *crc)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
static inline int check_modstruct_version(const struct load_info *info,
|
|
struct module *mod)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
static inline int same_magic(const char *amagic, const char *bmagic,
|
|
bool has_crcs)
|
|
{
|
|
return strcmp(amagic, bmagic) == 0;
|
|
}
|
|
#endif /* CONFIG_MODVERSIONS */
|
|
|
|
static char *get_modinfo(const struct load_info *info, const char *tag);
|
|
static char *get_next_modinfo(const struct load_info *info, const char *tag,
|
|
char *prev);
|
|
|
|
static int verify_namespace_is_imported(const struct load_info *info,
|
|
const struct kernel_symbol *sym,
|
|
struct module *mod)
|
|
{
|
|
const char *namespace;
|
|
char *imported_namespace;
|
|
|
|
namespace = kernel_symbol_namespace(sym);
|
|
if (namespace) {
|
|
imported_namespace = get_modinfo(info, "import_ns");
|
|
while (imported_namespace) {
|
|
if (strcmp(namespace, imported_namespace) == 0)
|
|
return 0;
|
|
imported_namespace = get_next_modinfo(
|
|
info, "import_ns", imported_namespace);
|
|
}
|
|
#ifdef CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
|
|
pr_warn(
|
|
#else
|
|
pr_err(
|
|
#endif
|
|
"%s: module uses symbol (%s) from namespace %s, but does not import it.\n",
|
|
mod->name, kernel_symbol_name(sym), namespace);
|
|
#ifndef CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
|
|
return -EINVAL;
|
|
#endif
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static bool inherit_taint(struct module *mod, struct module *owner)
|
|
{
|
|
if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
|
|
return true;
|
|
|
|
if (mod->using_gplonly_symbols) {
|
|
pr_err("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n",
|
|
mod->name, owner->name);
|
|
return false;
|
|
}
|
|
|
|
if (!test_bit(TAINT_PROPRIETARY_MODULE, &mod->taints)) {
|
|
pr_warn("%s: module uses symbols from proprietary module %s, inheriting taint.\n",
|
|
mod->name, owner->name);
|
|
set_bit(TAINT_PROPRIETARY_MODULE, &mod->taints);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/* Resolve a symbol for this module. I.e. if we find one, record usage. */
|
|
static const struct kernel_symbol *resolve_symbol(struct module *mod,
|
|
const struct load_info *info,
|
|
const char *name,
|
|
char ownername[])
|
|
{
|
|
struct module *owner;
|
|
const struct kernel_symbol *sym;
|
|
const s32 *crc;
|
|
enum mod_license license;
|
|
int err;
|
|
|
|
/*
|
|
* The module_mutex should not be a heavily contended lock;
|
|
* if we get the occasional sleep here, we'll go an extra iteration
|
|
* in the wait_event_interruptible(), which is harmless.
|
|
*/
|
|
sched_annotate_sleep();
|
|
mutex_lock(&module_mutex);
|
|
sym = find_symbol(name, &owner, &crc, &license,
|
|
!(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
|
|
if (!sym)
|
|
goto unlock;
|
|
|
|
if (license == GPL_ONLY)
|
|
mod->using_gplonly_symbols = true;
|
|
|
|
if (!inherit_taint(mod, owner)) {
|
|
sym = NULL;
|
|
goto getname;
|
|
}
|
|
|
|
if (!check_version(info, name, mod, crc)) {
|
|
sym = ERR_PTR(-EINVAL);
|
|
goto getname;
|
|
}
|
|
|
|
err = verify_namespace_is_imported(info, sym, mod);
|
|
if (err) {
|
|
sym = ERR_PTR(err);
|
|
goto getname;
|
|
}
|
|
|
|
err = ref_module(mod, owner);
|
|
if (err) {
|
|
sym = ERR_PTR(err);
|
|
goto getname;
|
|
}
|
|
|
|
getname:
|
|
/* We must make copy under the lock if we failed to get ref. */
|
|
strncpy(ownername, module_name(owner), MODULE_NAME_LEN);
|
|
unlock:
|
|
mutex_unlock(&module_mutex);
|
|
return sym;
|
|
}
|
|
|
|
static const struct kernel_symbol *
|
|
resolve_symbol_wait(struct module *mod,
|
|
const struct load_info *info,
|
|
const char *name)
|
|
{
|
|
const struct kernel_symbol *ksym;
|
|
char owner[MODULE_NAME_LEN];
|
|
|
|
if (wait_event_interruptible_timeout(module_wq,
|
|
!IS_ERR(ksym = resolve_symbol(mod, info, name, owner))
|
|
|| PTR_ERR(ksym) != -EBUSY,
|
|
30 * HZ) <= 0) {
|
|
pr_warn("%s: gave up waiting for init of module %s.\n",
|
|
mod->name, owner);
|
|
}
|
|
return ksym;
|
|
}
|
|
|
|
/*
|
|
* /sys/module/foo/sections stuff
|
|
* J. Corbet <corbet@lwn.net>
|
|
*/
|
|
#ifdef CONFIG_SYSFS
|
|
|
|
#ifdef CONFIG_KALLSYMS
|
|
static inline bool sect_empty(const Elf_Shdr *sect)
|
|
{
|
|
return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
|
|
}
|
|
|
|
struct module_sect_attr {
|
|
struct bin_attribute battr;
|
|
unsigned long address;
|
|
};
|
|
|
|
struct module_sect_attrs {
|
|
struct attribute_group grp;
|
|
unsigned int nsections;
|
|
struct module_sect_attr attrs[0];
|
|
};
|
|
|
|
#define MODULE_SECT_READ_SIZE (3 /* "0x", "\n" */ + (BITS_PER_LONG / 4))
|
|
static ssize_t module_sect_read(struct file *file, struct kobject *kobj,
|
|
struct bin_attribute *battr,
|
|
char *buf, loff_t pos, size_t count)
|
|
{
|
|
struct module_sect_attr *sattr =
|
|
container_of(battr, struct module_sect_attr, battr);
|
|
char bounce[MODULE_SECT_READ_SIZE + 1];
|
|
size_t wrote;
|
|
|
|
if (pos != 0)
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* Since we're a binary read handler, we must account for the
|
|
* trailing NUL byte that sprintf will write: if "buf" is
|
|
* too small to hold the NUL, or the NUL is exactly the last
|
|
* byte, the read will look like it got truncated by one byte.
|
|
* Since there is no way to ask sprintf nicely to not write
|
|
* the NUL, we have to use a bounce buffer.
|
|
*/
|
|
wrote = scnprintf(bounce, sizeof(bounce), "0x%px\n",
|
|
kallsyms_show_value(file->f_cred)
|
|
? (void *)sattr->address : NULL);
|
|
count = min(count, wrote);
|
|
memcpy(buf, bounce, count);
|
|
|
|
return count;
|
|
}
|
|
|
|
static void free_sect_attrs(struct module_sect_attrs *sect_attrs)
|
|
{
|
|
unsigned int section;
|
|
|
|
for (section = 0; section < sect_attrs->nsections; section++)
|
|
kfree(sect_attrs->attrs[section].battr.attr.name);
|
|
kfree(sect_attrs);
|
|
}
|
|
|
|
static void add_sect_attrs(struct module *mod, const struct load_info *info)
|
|
{
|
|
unsigned int nloaded = 0, i, size[2];
|
|
struct module_sect_attrs *sect_attrs;
|
|
struct module_sect_attr *sattr;
|
|
struct bin_attribute **gattr;
|
|
|
|
/* Count loaded sections and allocate structures */
|
|
for (i = 0; i < info->hdr->e_shnum; i++)
|
|
if (!sect_empty(&info->sechdrs[i]))
|
|
nloaded++;
|
|
size[0] = ALIGN(struct_size(sect_attrs, attrs, nloaded),
|
|
sizeof(sect_attrs->grp.bin_attrs[0]));
|
|
size[1] = (nloaded + 1) * sizeof(sect_attrs->grp.bin_attrs[0]);
|
|
sect_attrs = kzalloc(size[0] + size[1], GFP_KERNEL);
|
|
if (sect_attrs == NULL)
|
|
return;
|
|
|
|
/* Setup section attributes. */
|
|
sect_attrs->grp.name = "sections";
|
|
sect_attrs->grp.bin_attrs = (void *)sect_attrs + size[0];
|
|
|
|
sect_attrs->nsections = 0;
|
|
sattr = §_attrs->attrs[0];
|
|
gattr = §_attrs->grp.bin_attrs[0];
|
|
for (i = 0; i < info->hdr->e_shnum; i++) {
|
|
Elf_Shdr *sec = &info->sechdrs[i];
|
|
if (sect_empty(sec))
|
|
continue;
|
|
sysfs_bin_attr_init(&sattr->battr);
|
|
sattr->address = sec->sh_addr;
|
|
sattr->battr.attr.name =
|
|
kstrdup(info->secstrings + sec->sh_name, GFP_KERNEL);
|
|
if (sattr->battr.attr.name == NULL)
|
|
goto out;
|
|
sect_attrs->nsections++;
|
|
sattr->battr.read = module_sect_read;
|
|
sattr->battr.size = MODULE_SECT_READ_SIZE;
|
|
sattr->battr.attr.mode = 0400;
|
|
*(gattr++) = &(sattr++)->battr;
|
|
}
|
|
*gattr = NULL;
|
|
|
|
if (sysfs_create_group(&mod->mkobj.kobj, §_attrs->grp))
|
|
goto out;
|
|
|
|
mod->sect_attrs = sect_attrs;
|
|
return;
|
|
out:
|
|
free_sect_attrs(sect_attrs);
|
|
}
|
|
|
|
static void remove_sect_attrs(struct module *mod)
|
|
{
|
|
if (mod->sect_attrs) {
|
|
sysfs_remove_group(&mod->mkobj.kobj,
|
|
&mod->sect_attrs->grp);
|
|
/* We are positive that no one is using any sect attrs
|
|
* at this point. Deallocate immediately. */
|
|
free_sect_attrs(mod->sect_attrs);
|
|
mod->sect_attrs = NULL;
|
|
}
|
|
}
|
|
|
|
/*
|
|
* /sys/module/foo/notes/.section.name gives contents of SHT_NOTE sections.
|
|
*/
|
|
|
|
struct module_notes_attrs {
|
|
struct kobject *dir;
|
|
unsigned int notes;
|
|
struct bin_attribute attrs[0];
|
|
};
|
|
|
|
static ssize_t module_notes_read(struct file *filp, struct kobject *kobj,
|
|
struct bin_attribute *bin_attr,
|
|
char *buf, loff_t pos, size_t count)
|
|
{
|
|
/*
|
|
* The caller checked the pos and count against our size.
|
|
*/
|
|
memcpy(buf, bin_attr->private + pos, count);
|
|
return count;
|
|
}
|
|
|
|
static void free_notes_attrs(struct module_notes_attrs *notes_attrs,
|
|
unsigned int i)
|
|
{
|
|
if (notes_attrs->dir) {
|
|
while (i-- > 0)
|
|
sysfs_remove_bin_file(notes_attrs->dir,
|
|
¬es_attrs->attrs[i]);
|
|
kobject_put(notes_attrs->dir);
|
|
}
|
|
kfree(notes_attrs);
|
|
}
|
|
|
|
static void add_notes_attrs(struct module *mod, const struct load_info *info)
|
|
{
|
|
unsigned int notes, loaded, i;
|
|
struct module_notes_attrs *notes_attrs;
|
|
struct bin_attribute *nattr;
|
|
|
|
/* failed to create section attributes, so can't create notes */
|
|
if (!mod->sect_attrs)
|
|
return;
|
|
|
|
/* Count notes sections and allocate structures. */
|
|
notes = 0;
|
|
for (i = 0; i < info->hdr->e_shnum; i++)
|
|
if (!sect_empty(&info->sechdrs[i]) &&
|
|
(info->sechdrs[i].sh_type == SHT_NOTE))
|
|
++notes;
|
|
|
|
if (notes == 0)
|
|
return;
|
|
|
|
notes_attrs = kzalloc(struct_size(notes_attrs, attrs, notes),
|
|
GFP_KERNEL);
|
|
if (notes_attrs == NULL)
|
|
return;
|
|
|
|
notes_attrs->notes = notes;
|
|
nattr = ¬es_attrs->attrs[0];
|
|
for (loaded = i = 0; i < info->hdr->e_shnum; ++i) {
|
|
if (sect_empty(&info->sechdrs[i]))
|
|
continue;
|
|
if (info->sechdrs[i].sh_type == SHT_NOTE) {
|
|
sysfs_bin_attr_init(nattr);
|
|
nattr->attr.name = mod->sect_attrs->attrs[loaded].battr.attr.name;
|
|
nattr->attr.mode = S_IRUGO;
|
|
nattr->size = info->sechdrs[i].sh_size;
|
|
nattr->private = (void *) info->sechdrs[i].sh_addr;
|
|
nattr->read = module_notes_read;
|
|
++nattr;
|
|
}
|
|
++loaded;
|
|
}
|
|
|
|
notes_attrs->dir = kobject_create_and_add("notes", &mod->mkobj.kobj);
|
|
if (!notes_attrs->dir)
|
|
goto out;
|
|
|
|
for (i = 0; i < notes; ++i)
|
|
if (sysfs_create_bin_file(notes_attrs->dir,
|
|
¬es_attrs->attrs[i]))
|
|
goto out;
|
|
|
|
mod->notes_attrs = notes_attrs;
|
|
return;
|
|
|
|
out:
|
|
free_notes_attrs(notes_attrs, i);
|
|
}
|
|
|
|
static void remove_notes_attrs(struct module *mod)
|
|
{
|
|
if (mod->notes_attrs)
|
|
free_notes_attrs(mod->notes_attrs, mod->notes_attrs->notes);
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void add_sect_attrs(struct module *mod,
|
|
const struct load_info *info)
|
|
{
|
|
}
|
|
|
|
static inline void remove_sect_attrs(struct module *mod)
|
|
{
|
|
}
|
|
|
|
static inline void add_notes_attrs(struct module *mod,
|
|
const struct load_info *info)
|
|
{
|
|
}
|
|
|
|
static inline void remove_notes_attrs(struct module *mod)
|
|
{
|
|
}
|
|
#endif /* CONFIG_KALLSYMS */
|
|
|
|
static void del_usage_links(struct module *mod)
|
|
{
|
|
#ifdef CONFIG_MODULE_UNLOAD
|
|
struct module_use *use;
|
|
|
|
mutex_lock(&module_mutex);
|
|
list_for_each_entry(use, &mod->target_list, target_list)
|
|
sysfs_remove_link(use->target->holders_dir, mod->name);
|
|
mutex_unlock(&module_mutex);
|
|
#endif
|
|
}
|
|
|
|
static int add_usage_links(struct module *mod)
|
|
{
|
|
int ret = 0;
|
|
#ifdef CONFIG_MODULE_UNLOAD
|
|
struct module_use *use;
|
|
|
|
mutex_lock(&module_mutex);
|
|
list_for_each_entry(use, &mod->target_list, target_list) {
|
|
ret = sysfs_create_link(use->target->holders_dir,
|
|
&mod->mkobj.kobj, mod->name);
|
|
if (ret)
|
|
break;
|
|
}
|
|
mutex_unlock(&module_mutex);
|
|
if (ret)
|
|
del_usage_links(mod);
|
|
#endif
|
|
return ret;
|
|
}
|
|
|
|
static void module_remove_modinfo_attrs(struct module *mod, int end);
|
|
|
|
static int module_add_modinfo_attrs(struct module *mod)
|
|
{
|
|
struct module_attribute *attr;
|
|
struct module_attribute *temp_attr;
|
|
int error = 0;
|
|
int i;
|
|
|
|
mod->modinfo_attrs = kzalloc((sizeof(struct module_attribute) *
|
|
(ARRAY_SIZE(modinfo_attrs) + 1)),
|
|
GFP_KERNEL);
|
|
if (!mod->modinfo_attrs)
|
|
return -ENOMEM;
|
|
|
|
temp_attr = mod->modinfo_attrs;
|
|
for (i = 0; (attr = modinfo_attrs[i]); i++) {
|
|
if (!attr->test || attr->test(mod)) {
|
|
memcpy(temp_attr, attr, sizeof(*temp_attr));
|
|
sysfs_attr_init(&temp_attr->attr);
|
|
error = sysfs_create_file(&mod->mkobj.kobj,
|
|
&temp_attr->attr);
|
|
if (error)
|
|
goto error_out;
|
|
++temp_attr;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
|
|
error_out:
|
|
if (i > 0)
|
|
module_remove_modinfo_attrs(mod, --i);
|
|
else
|
|
kfree(mod->modinfo_attrs);
|
|
return error;
|
|
}
|
|
|
|
static void module_remove_modinfo_attrs(struct module *mod, int end)
|
|
{
|
|
struct module_attribute *attr;
|
|
int i;
|
|
|
|
for (i = 0; (attr = &mod->modinfo_attrs[i]); i++) {
|
|
if (end >= 0 && i > end)
|
|
break;
|
|
/* pick a field to test for end of list */
|
|
if (!attr->attr.name)
|
|
break;
|
|
sysfs_remove_file(&mod->mkobj.kobj, &attr->attr);
|
|
if (attr->free)
|
|
attr->free(mod);
|
|
}
|
|
kfree(mod->modinfo_attrs);
|
|
}
|
|
|
|
static void mod_kobject_put(struct module *mod)
|
|
{
|
|
DECLARE_COMPLETION_ONSTACK(c);
|
|
mod->mkobj.kobj_completion = &c;
|
|
kobject_put(&mod->mkobj.kobj);
|
|
wait_for_completion(&c);
|
|
}
|
|
|
|
static int mod_sysfs_init(struct module *mod)
|
|
{
|
|
int err;
|
|
struct kobject *kobj;
|
|
|
|
if (!module_sysfs_initialized) {
|
|
pr_err("%s: module sysfs not initialized\n", mod->name);
|
|
err = -EINVAL;
|
|
goto out;
|
|
}
|
|
|
|
kobj = kset_find_obj(module_kset, mod->name);
|
|
if (kobj) {
|
|
pr_err("%s: module is already loaded\n", mod->name);
|
|
kobject_put(kobj);
|
|
err = -EINVAL;
|
|
goto out;
|
|
}
|
|
|
|
mod->mkobj.mod = mod;
|
|
|
|
memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));
|
|
mod->mkobj.kobj.kset = module_kset;
|
|
err = kobject_init_and_add(&mod->mkobj.kobj, &module_ktype, NULL,
|
|
"%s", mod->name);
|
|
if (err)
|
|
mod_kobject_put(mod);
|
|
|
|
/* delay uevent until full sysfs population */
|
|
out:
|
|
return err;
|
|
}
|
|
|
|
static int mod_sysfs_setup(struct module *mod,
|
|
const struct load_info *info,
|
|
struct kernel_param *kparam,
|
|
unsigned int num_params)
|
|
{
|
|
int err;
|
|
|
|
err = mod_sysfs_init(mod);
|
|
if (err)
|
|
goto out;
|
|
|
|
mod->holders_dir = kobject_create_and_add("holders", &mod->mkobj.kobj);
|
|
if (!mod->holders_dir) {
|
|
err = -ENOMEM;
|
|
goto out_unreg;
|
|
}
|
|
|
|
err = module_param_sysfs_setup(mod, kparam, num_params);
|
|
if (err)
|
|
goto out_unreg_holders;
|
|
|
|
err = module_add_modinfo_attrs(mod);
|
|
if (err)
|
|
goto out_unreg_param;
|
|
|
|
err = add_usage_links(mod);
|
|
if (err)
|
|
goto out_unreg_modinfo_attrs;
|
|
|
|
add_sect_attrs(mod, info);
|
|
add_notes_attrs(mod, info);
|
|
|
|
kobject_uevent(&mod->mkobj.kobj, KOBJ_ADD);
|
|
return 0;
|
|
|
|
out_unreg_modinfo_attrs:
|
|
module_remove_modinfo_attrs(mod, -1);
|
|
out_unreg_param:
|
|
module_param_sysfs_remove(mod);
|
|
out_unreg_holders:
|
|
kobject_put(mod->holders_dir);
|
|
out_unreg:
|
|
mod_kobject_put(mod);
|
|
out:
|
|
return err;
|
|
}
|
|
|
|
static void mod_sysfs_fini(struct module *mod)
|
|
{
|
|
remove_notes_attrs(mod);
|
|
remove_sect_attrs(mod);
|
|
mod_kobject_put(mod);
|
|
}
|
|
|
|
static void init_param_lock(struct module *mod)
|
|
{
|
|
mutex_init(&mod->param_lock);
|
|
}
|
|
#else /* !CONFIG_SYSFS */
|
|
|
|
static int mod_sysfs_setup(struct module *mod,
|
|
const struct load_info *info,
|
|
struct kernel_param *kparam,
|
|
unsigned int num_params)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static void mod_sysfs_fini(struct module *mod)
|
|
{
|
|
}
|
|
|
|
static void module_remove_modinfo_attrs(struct module *mod, int end)
|
|
{
|
|
}
|
|
|
|
static void del_usage_links(struct module *mod)
|
|
{
|
|
}
|
|
|
|
static void init_param_lock(struct module *mod)
|
|
{
|
|
}
|
|
#endif /* CONFIG_SYSFS */
|
|
|
|
static void mod_sysfs_teardown(struct module *mod)
|
|
{
|
|
del_usage_links(mod);
|
|
module_remove_modinfo_attrs(mod, -1);
|
|
module_param_sysfs_remove(mod);
|
|
kobject_put(mod->mkobj.drivers_dir);
|
|
kobject_put(mod->holders_dir);
|
|
mod_sysfs_fini(mod);
|
|
}
|
|
|
|
#ifdef CONFIG_ARCH_HAS_STRICT_MODULE_RWX
|
|
/*
|
|
* LKM RO/NX protection: protect module's text/ro-data
|
|
* from modification and any data from execution.
|
|
*
|
|
* General layout of module is:
|
|
* [text] [read-only-data] [ro-after-init] [writable data]
|
|
* text_size -----^ ^ ^ ^
|
|
* ro_size ------------------------| | |
|
|
* ro_after_init_size -----------------------------| |
|
|
* size -----------------------------------------------------------|
|
|
*
|
|
* These values are always page-aligned (as is base)
|
|
*/
|
|
static void frob_text(const struct module_layout *layout,
|
|
int (*set_memory)(unsigned long start, int num_pages))
|
|
{
|
|
BUG_ON((unsigned long)layout->base & (PAGE_SIZE-1));
|
|
BUG_ON((unsigned long)layout->text_size & (PAGE_SIZE-1));
|
|
set_memory((unsigned long)layout->base,
|
|
layout->text_size >> PAGE_SHIFT);
|
|
}
|
|
|
|
#ifdef CONFIG_STRICT_MODULE_RWX
|
|
static void frob_rodata(const struct module_layout *layout,
|
|
int (*set_memory)(unsigned long start, int num_pages))
|
|
{
|
|
BUG_ON((unsigned long)layout->base & (PAGE_SIZE-1));
|
|
BUG_ON((unsigned long)layout->text_size & (PAGE_SIZE-1));
|
|
BUG_ON((unsigned long)layout->ro_size & (PAGE_SIZE-1));
|
|
set_memory((unsigned long)layout->base + layout->text_size,
|
|
(layout->ro_size - layout->text_size) >> PAGE_SHIFT);
|
|
}
|
|
|
|
static void frob_ro_after_init(const struct module_layout *layout,
|
|
int (*set_memory)(unsigned long start, int num_pages))
|
|
{
|
|
BUG_ON((unsigned long)layout->base & (PAGE_SIZE-1));
|
|
BUG_ON((unsigned long)layout->ro_size & (PAGE_SIZE-1));
|
|
BUG_ON((unsigned long)layout->ro_after_init_size & (PAGE_SIZE-1));
|
|
set_memory((unsigned long)layout->base + layout->ro_size,
|
|
(layout->ro_after_init_size - layout->ro_size) >> PAGE_SHIFT);
|
|
}
|
|
|
|
static void frob_writable_data(const struct module_layout *layout,
|
|
int (*set_memory)(unsigned long start, int num_pages))
|
|
{
|
|
BUG_ON((unsigned long)layout->base & (PAGE_SIZE-1));
|
|
BUG_ON((unsigned long)layout->ro_after_init_size & (PAGE_SIZE-1));
|
|
BUG_ON((unsigned long)layout->size & (PAGE_SIZE-1));
|
|
set_memory((unsigned long)layout->base + layout->ro_after_init_size,
|
|
(layout->size - layout->ro_after_init_size) >> PAGE_SHIFT);
|
|
}
|
|
|
|
/* livepatching wants to disable read-only so it can frob module. */
|
|
void module_disable_ro(const struct module *mod)
|
|
{
|
|
if (!rodata_enabled)
|
|
return;
|
|
|
|
frob_text(&mod->core_layout, set_memory_rw);
|
|
frob_rodata(&mod->core_layout, set_memory_rw);
|
|
frob_ro_after_init(&mod->core_layout, set_memory_rw);
|
|
frob_text(&mod->init_layout, set_memory_rw);
|
|
frob_rodata(&mod->init_layout, set_memory_rw);
|
|
}
|
|
|
|
void module_enable_ro(const struct module *mod, bool after_init)
|
|
{
|
|
if (!rodata_enabled)
|
|
return;
|
|
|
|
set_vm_flush_reset_perms(mod->core_layout.base);
|
|
set_vm_flush_reset_perms(mod->init_layout.base);
|
|
frob_text(&mod->core_layout, set_memory_ro);
|
|
|
|
frob_rodata(&mod->core_layout, set_memory_ro);
|
|
frob_text(&mod->init_layout, set_memory_ro);
|
|
frob_rodata(&mod->init_layout, set_memory_ro);
|
|
|
|
if (after_init)
|
|
frob_ro_after_init(&mod->core_layout, set_memory_ro);
|
|
}
|
|
|
|
static void module_enable_nx(const struct module *mod)
|
|
{
|
|
frob_rodata(&mod->core_layout, set_memory_nx);
|
|
frob_ro_after_init(&mod->core_layout, set_memory_nx);
|
|
frob_writable_data(&mod->core_layout, set_memory_nx);
|
|
frob_rodata(&mod->init_layout, set_memory_nx);
|
|
frob_writable_data(&mod->init_layout, set_memory_nx);
|
|
}
|
|
|
|
/* Iterate through all modules and set each module's text as RW */
|
|
void set_all_modules_text_rw(void)
|
|
{
|
|
struct module *mod;
|
|
|
|
if (!rodata_enabled)
|
|
return;
|
|
|
|
mutex_lock(&module_mutex);
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
|
|
frob_text(&mod->core_layout, set_memory_rw);
|
|
frob_text(&mod->init_layout, set_memory_rw);
|
|
}
|
|
mutex_unlock(&module_mutex);
|
|
}
|
|
|
|
/* Iterate through all modules and set each module's text as RO */
|
|
void set_all_modules_text_ro(void)
|
|
{
|
|
struct module *mod;
|
|
|
|
if (!rodata_enabled)
|
|
return;
|
|
|
|
mutex_lock(&module_mutex);
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
/*
|
|
* Ignore going modules since it's possible that ro
|
|
* protection has already been disabled, otherwise we'll
|
|
* run into protection faults at module deallocation.
|
|
*/
|
|
if (mod->state == MODULE_STATE_UNFORMED ||
|
|
mod->state == MODULE_STATE_GOING)
|
|
continue;
|
|
|
|
frob_text(&mod->core_layout, set_memory_ro);
|
|
frob_text(&mod->init_layout, set_memory_ro);
|
|
}
|
|
mutex_unlock(&module_mutex);
|
|
}
|
|
#else /* !CONFIG_STRICT_MODULE_RWX */
|
|
static void module_enable_nx(const struct module *mod) { }
|
|
#endif /* CONFIG_STRICT_MODULE_RWX */
|
|
static void module_enable_x(const struct module *mod)
|
|
{
|
|
frob_text(&mod->core_layout, set_memory_x);
|
|
frob_text(&mod->init_layout, set_memory_x);
|
|
}
|
|
#else /* !CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
|
|
static void module_enable_nx(const struct module *mod) { }
|
|
static void module_enable_x(const struct module *mod) { }
|
|
#endif /* CONFIG_ARCH_HAS_STRICT_MODULE_RWX */
|
|
|
|
|
|
#ifdef CONFIG_LIVEPATCH
|
|
/*
|
|
* Persist Elf information about a module. Copy the Elf header,
|
|
* section header table, section string table, and symtab section
|
|
* index from info to mod->klp_info.
|
|
*/
|
|
static int copy_module_elf(struct module *mod, struct load_info *info)
|
|
{
|
|
unsigned int size, symndx;
|
|
int ret;
|
|
|
|
size = sizeof(*mod->klp_info);
|
|
mod->klp_info = kmalloc(size, GFP_KERNEL);
|
|
if (mod->klp_info == NULL)
|
|
return -ENOMEM;
|
|
|
|
/* Elf header */
|
|
size = sizeof(mod->klp_info->hdr);
|
|
memcpy(&mod->klp_info->hdr, info->hdr, size);
|
|
|
|
/* Elf section header table */
|
|
size = sizeof(*info->sechdrs) * info->hdr->e_shnum;
|
|
mod->klp_info->sechdrs = kmemdup(info->sechdrs, size, GFP_KERNEL);
|
|
if (mod->klp_info->sechdrs == NULL) {
|
|
ret = -ENOMEM;
|
|
goto free_info;
|
|
}
|
|
|
|
/* Elf section name string table */
|
|
size = info->sechdrs[info->hdr->e_shstrndx].sh_size;
|
|
mod->klp_info->secstrings = kmemdup(info->secstrings, size, GFP_KERNEL);
|
|
if (mod->klp_info->secstrings == NULL) {
|
|
ret = -ENOMEM;
|
|
goto free_sechdrs;
|
|
}
|
|
|
|
/* Elf symbol section index */
|
|
symndx = info->index.sym;
|
|
mod->klp_info->symndx = symndx;
|
|
|
|
/*
|
|
* For livepatch modules, core_kallsyms.symtab is a complete
|
|
* copy of the original symbol table. Adjust sh_addr to point
|
|
* to core_kallsyms.symtab since the copy of the symtab in module
|
|
* init memory is freed at the end of do_init_module().
|
|
*/
|
|
mod->klp_info->sechdrs[symndx].sh_addr = \
|
|
(unsigned long) mod->core_kallsyms.symtab;
|
|
|
|
return 0;
|
|
|
|
free_sechdrs:
|
|
kfree(mod->klp_info->sechdrs);
|
|
free_info:
|
|
kfree(mod->klp_info);
|
|
return ret;
|
|
}
|
|
|
|
static void free_module_elf(struct module *mod)
|
|
{
|
|
kfree(mod->klp_info->sechdrs);
|
|
kfree(mod->klp_info->secstrings);
|
|
kfree(mod->klp_info);
|
|
}
|
|
#else /* !CONFIG_LIVEPATCH */
|
|
static int copy_module_elf(struct module *mod, struct load_info *info)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static void free_module_elf(struct module *mod)
|
|
{
|
|
}
|
|
#endif /* CONFIG_LIVEPATCH */
|
|
|
|
void __weak module_memfree(void *module_region)
|
|
{
|
|
/*
|
|
* This memory may be RO, and freeing RO memory in an interrupt is not
|
|
* supported by vmalloc.
|
|
*/
|
|
WARN_ON(in_interrupt());
|
|
vfree(module_region);
|
|
}
|
|
|
|
void __weak module_arch_cleanup(struct module *mod)
|
|
{
|
|
}
|
|
|
|
void __weak module_arch_freeing_init(struct module *mod)
|
|
{
|
|
}
|
|
|
|
static void cfi_cleanup(struct module *mod);
|
|
|
|
/* Free a module, remove from lists, etc. */
|
|
static void free_module(struct module *mod)
|
|
{
|
|
trace_module_free(mod);
|
|
|
|
mod_sysfs_teardown(mod);
|
|
|
|
/* We leave it in list to prevent duplicate loads, but make sure
|
|
* that noone uses it while it's being deconstructed. */
|
|
mutex_lock(&module_mutex);
|
|
mod->state = MODULE_STATE_UNFORMED;
|
|
mutex_unlock(&module_mutex);
|
|
|
|
/* Remove dynamic debug info */
|
|
ddebug_remove_module(mod->name);
|
|
|
|
/* Arch-specific cleanup. */
|
|
module_arch_cleanup(mod);
|
|
|
|
/* Module unload stuff */
|
|
module_unload_free(mod);
|
|
|
|
/* Free any allocated parameters. */
|
|
destroy_params(mod->kp, mod->num_kp);
|
|
|
|
if (is_livepatch_module(mod))
|
|
free_module_elf(mod);
|
|
|
|
/* Now we can delete it from the lists */
|
|
mutex_lock(&module_mutex);
|
|
/* Unlink carefully: kallsyms could be walking list. */
|
|
list_del_rcu(&mod->list);
|
|
mod_tree_remove(mod);
|
|
/* Remove this module from bug list, this uses list_del_rcu */
|
|
module_bug_cleanup(mod);
|
|
/* Wait for RCU-sched synchronizing before releasing mod->list and buglist. */
|
|
synchronize_rcu();
|
|
mutex_unlock(&module_mutex);
|
|
|
|
/* Clean up CFI for the module. */
|
|
cfi_cleanup(mod);
|
|
|
|
/* This may be empty, but that's OK */
|
|
module_arch_freeing_init(mod);
|
|
module_memfree(mod->init_layout.base);
|
|
kfree(mod->args);
|
|
percpu_modfree(mod);
|
|
|
|
/* Free lock-classes; relies on the preceding sync_rcu(). */
|
|
lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size);
|
|
|
|
#ifdef CONFIG_DEBUG_MODULE_LOAD_INFO
|
|
pr_info("Unloaded %s: module core layout, start: 0x%pK size: 0x%x\n",
|
|
mod->name, mod->core_layout.base, mod->core_layout.size);
|
|
#endif
|
|
/* Finally, free the core (containing the module structure) */
|
|
module_memfree(mod->core_layout.base);
|
|
}
|
|
|
|
void *__symbol_get(const char *symbol)
|
|
{
|
|
struct module *owner;
|
|
const struct kernel_symbol *sym;
|
|
|
|
preempt_disable();
|
|
sym = find_symbol(symbol, &owner, NULL, NULL, true, true);
|
|
if (sym && strong_try_module_get(owner))
|
|
sym = NULL;
|
|
preempt_enable();
|
|
|
|
return sym ? (void *)kernel_symbol_value(sym) : NULL;
|
|
}
|
|
|
|
/*
|
|
* Ensure that an exported symbol [global namespace] does not already exist
|
|
* in the kernel or in some other module's exported symbol table.
|
|
*
|
|
* You must hold the module_mutex.
|
|
*/
|
|
static int verify_exported_symbols(struct module *mod)
|
|
{
|
|
unsigned int i;
|
|
struct module *owner;
|
|
const struct kernel_symbol *s;
|
|
struct {
|
|
const struct kernel_symbol *sym;
|
|
unsigned int num;
|
|
} arr[] = {
|
|
{ mod->syms, mod->num_syms },
|
|
{ mod->gpl_syms, mod->num_gpl_syms },
|
|
{ mod->gpl_future_syms, mod->num_gpl_future_syms },
|
|
#ifdef CONFIG_UNUSED_SYMBOLS
|
|
{ mod->unused_syms, mod->num_unused_syms },
|
|
{ mod->unused_gpl_syms, mod->num_unused_gpl_syms },
|
|
#endif
|
|
};
|
|
|
|
for (i = 0; i < ARRAY_SIZE(arr); i++) {
|
|
for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {
|
|
if (find_symbol(kernel_symbol_name(s), &owner, NULL,
|
|
NULL, true, false)) {
|
|
pr_err("%s: exports duplicate symbol %s"
|
|
" (owned by %s)\n",
|
|
mod->name, kernel_symbol_name(s),
|
|
module_name(owner));
|
|
return -ENOEXEC;
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* Change all symbols so that st_value encodes the pointer directly. */
|
|
static int simplify_symbols(struct module *mod, const struct load_info *info)
|
|
{
|
|
Elf_Shdr *symsec = &info->sechdrs[info->index.sym];
|
|
Elf_Sym *sym = (void *)symsec->sh_addr;
|
|
unsigned long secbase;
|
|
unsigned int i;
|
|
int ret = 0;
|
|
const struct kernel_symbol *ksym;
|
|
|
|
for (i = 1; i < symsec->sh_size / sizeof(Elf_Sym); i++) {
|
|
const char *name = info->strtab + sym[i].st_name;
|
|
|
|
switch (sym[i].st_shndx) {
|
|
case SHN_COMMON:
|
|
/* Ignore common symbols */
|
|
if (!strncmp(name, "__gnu_lto", 9))
|
|
break;
|
|
|
|
/* We compiled with -fno-common. These are not
|
|
supposed to happen. */
|
|
pr_debug("Common symbol: %s\n", name);
|
|
pr_warn("%s: please compile with -fno-common\n",
|
|
mod->name);
|
|
ret = -ENOEXEC;
|
|
break;
|
|
|
|
case SHN_ABS:
|
|
/* Don't need to do anything */
|
|
pr_debug("Absolute symbol: 0x%08lx\n",
|
|
(long)sym[i].st_value);
|
|
break;
|
|
|
|
case SHN_LIVEPATCH:
|
|
/* Livepatch symbols are resolved by livepatch */
|
|
break;
|
|
|
|
case SHN_UNDEF:
|
|
ksym = resolve_symbol_wait(mod, info, name);
|
|
/* Ok if resolved. */
|
|
if (ksym && !IS_ERR(ksym)) {
|
|
sym[i].st_value = kernel_symbol_value(ksym);
|
|
break;
|
|
}
|
|
|
|
/* Ok if weak. */
|
|
if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
|
|
break;
|
|
|
|
ret = PTR_ERR(ksym) ?: -ENOENT;
|
|
pr_warn("%s: Unknown symbol %s (err %d)\n",
|
|
mod->name, name, ret);
|
|
break;
|
|
|
|
default:
|
|
/* Divert to percpu allocation if a percpu var. */
|
|
if (sym[i].st_shndx == info->index.pcpu)
|
|
secbase = (unsigned long)mod_percpu(mod);
|
|
else
|
|
secbase = info->sechdrs[sym[i].st_shndx].sh_addr;
|
|
sym[i].st_value += secbase;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int apply_relocations(struct module *mod, const struct load_info *info)
|
|
{
|
|
unsigned int i;
|
|
int err = 0;
|
|
|
|
/* Now do relocations. */
|
|
for (i = 1; i < info->hdr->e_shnum; i++) {
|
|
unsigned int infosec = info->sechdrs[i].sh_info;
|
|
|
|
/* Not a valid relocation section? */
|
|
if (infosec >= info->hdr->e_shnum)
|
|
continue;
|
|
|
|
/* Don't bother with non-allocated sections */
|
|
if (!(info->sechdrs[infosec].sh_flags & SHF_ALLOC))
|
|
continue;
|
|
|
|
/* Livepatch relocation sections are applied by livepatch */
|
|
if (info->sechdrs[i].sh_flags & SHF_RELA_LIVEPATCH)
|
|
continue;
|
|
|
|
if (info->sechdrs[i].sh_type == SHT_REL)
|
|
err = apply_relocate(info->sechdrs, info->strtab,
|
|
info->index.sym, i, mod);
|
|
else if (info->sechdrs[i].sh_type == SHT_RELA)
|
|
err = apply_relocate_add(info->sechdrs, info->strtab,
|
|
info->index.sym, i, mod);
|
|
if (err < 0)
|
|
break;
|
|
}
|
|
return err;
|
|
}
|
|
|
|
/* Additional bytes needed by arch in front of individual sections */
|
|
unsigned int __weak arch_mod_section_prepend(struct module *mod,
|
|
unsigned int section)
|
|
{
|
|
/* default implementation just returns zero */
|
|
return 0;
|
|
}
|
|
|
|
/* Update size with this section: return offset. */
|
|
static long get_offset(struct module *mod, unsigned int *size,
|
|
Elf_Shdr *sechdr, unsigned int section)
|
|
{
|
|
long ret;
|
|
|
|
*size += arch_mod_section_prepend(mod, section);
|
|
ret = ALIGN(*size, sechdr->sh_addralign ?: 1);
|
|
*size = ret + sechdr->sh_size;
|
|
return ret;
|
|
}
|
|
|
|
/* Lay out the SHF_ALLOC sections in a way not dissimilar to how ld
|
|
might -- code, read-only data, read-write data, small data. Tally
|
|
sizes, and place the offsets into sh_entsize fields: high bit means it
|
|
belongs in init. */
|
|
static void layout_sections(struct module *mod, struct load_info *info)
|
|
{
|
|
static unsigned long const masks[][2] = {
|
|
/* NOTE: all executable code must be the first section
|
|
* in this array; otherwise modify the text_size
|
|
* finder in the two loops below */
|
|
{ SHF_EXECINSTR | SHF_ALLOC, ARCH_SHF_SMALL },
|
|
{ SHF_ALLOC, SHF_WRITE | ARCH_SHF_SMALL },
|
|
{ SHF_RO_AFTER_INIT | SHF_ALLOC, ARCH_SHF_SMALL },
|
|
{ SHF_WRITE | SHF_ALLOC, ARCH_SHF_SMALL },
|
|
{ ARCH_SHF_SMALL | SHF_ALLOC, 0 }
|
|
};
|
|
unsigned int m, i;
|
|
|
|
for (i = 0; i < info->hdr->e_shnum; i++)
|
|
info->sechdrs[i].sh_entsize = ~0UL;
|
|
|
|
pr_debug("Core section allocation order:\n");
|
|
for (m = 0; m < ARRAY_SIZE(masks); ++m) {
|
|
for (i = 0; i < info->hdr->e_shnum; ++i) {
|
|
Elf_Shdr *s = &info->sechdrs[i];
|
|
const char *sname = info->secstrings + s->sh_name;
|
|
|
|
if ((s->sh_flags & masks[m][0]) != masks[m][0]
|
|
|| (s->sh_flags & masks[m][1])
|
|
|| s->sh_entsize != ~0UL
|
|
|| strstarts(sname, ".init"))
|
|
continue;
|
|
s->sh_entsize = get_offset(mod, &mod->core_layout.size, s, i);
|
|
pr_debug("\t%s\n", sname);
|
|
}
|
|
switch (m) {
|
|
case 0: /* executable */
|
|
mod->core_layout.size = debug_align(mod->core_layout.size);
|
|
mod->core_layout.text_size = mod->core_layout.size;
|
|
break;
|
|
case 1: /* RO: text and ro-data */
|
|
mod->core_layout.size = debug_align(mod->core_layout.size);
|
|
mod->core_layout.ro_size = mod->core_layout.size;
|
|
break;
|
|
case 2: /* RO after init */
|
|
mod->core_layout.size = debug_align(mod->core_layout.size);
|
|
mod->core_layout.ro_after_init_size = mod->core_layout.size;
|
|
break;
|
|
case 4: /* whole core */
|
|
mod->core_layout.size = debug_align(mod->core_layout.size);
|
|
break;
|
|
}
|
|
}
|
|
|
|
pr_debug("Init section allocation order:\n");
|
|
for (m = 0; m < ARRAY_SIZE(masks); ++m) {
|
|
for (i = 0; i < info->hdr->e_shnum; ++i) {
|
|
Elf_Shdr *s = &info->sechdrs[i];
|
|
const char *sname = info->secstrings + s->sh_name;
|
|
|
|
if ((s->sh_flags & masks[m][0]) != masks[m][0]
|
|
|| (s->sh_flags & masks[m][1])
|
|
|| s->sh_entsize != ~0UL
|
|
|| !strstarts(sname, ".init"))
|
|
continue;
|
|
s->sh_entsize = (get_offset(mod, &mod->init_layout.size, s, i)
|
|
| INIT_OFFSET_MASK);
|
|
pr_debug("\t%s\n", sname);
|
|
}
|
|
switch (m) {
|
|
case 0: /* executable */
|
|
mod->init_layout.size = debug_align(mod->init_layout.size);
|
|
mod->init_layout.text_size = mod->init_layout.size;
|
|
break;
|
|
case 1: /* RO: text and ro-data */
|
|
mod->init_layout.size = debug_align(mod->init_layout.size);
|
|
mod->init_layout.ro_size = mod->init_layout.size;
|
|
break;
|
|
case 2:
|
|
/*
|
|
* RO after init doesn't apply to init_layout (only
|
|
* core_layout), so it just takes the value of ro_size.
|
|
*/
|
|
mod->init_layout.ro_after_init_size = mod->init_layout.ro_size;
|
|
break;
|
|
case 4: /* whole init */
|
|
mod->init_layout.size = debug_align(mod->init_layout.size);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
static void set_license(struct module *mod, const char *license)
|
|
{
|
|
if (!license)
|
|
license = "unspecified";
|
|
|
|
if (!license_is_gpl_compatible(license)) {
|
|
if (!test_taint(TAINT_PROPRIETARY_MODULE))
|
|
pr_warn("%s: module license '%s' taints kernel.\n",
|
|
mod->name, license);
|
|
add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
|
|
LOCKDEP_NOW_UNRELIABLE);
|
|
}
|
|
}
|
|
|
|
/* Parse tag=value strings from .modinfo section */
|
|
static char *next_string(char *string, unsigned long *secsize)
|
|
{
|
|
/* Skip non-zero chars */
|
|
while (string[0]) {
|
|
string++;
|
|
if ((*secsize)-- <= 1)
|
|
return NULL;
|
|
}
|
|
|
|
/* Skip any zero padding. */
|
|
while (!string[0]) {
|
|
string++;
|
|
if ((*secsize)-- <= 1)
|
|
return NULL;
|
|
}
|
|
return string;
|
|
}
|
|
|
|
static char *get_next_modinfo(const struct load_info *info, const char *tag,
|
|
char *prev)
|
|
{
|
|
char *p;
|
|
unsigned int taglen = strlen(tag);
|
|
Elf_Shdr *infosec = &info->sechdrs[info->index.info];
|
|
unsigned long size = infosec->sh_size;
|
|
|
|
/*
|
|
* get_modinfo() calls made before rewrite_section_headers()
|
|
* must use sh_offset, as sh_addr isn't set!
|
|
*/
|
|
char *modinfo = (char *)info->hdr + infosec->sh_offset;
|
|
|
|
if (prev) {
|
|
size -= prev - modinfo;
|
|
modinfo = next_string(prev, &size);
|
|
}
|
|
|
|
for (p = modinfo; p; p = next_string(p, &size)) {
|
|
if (strncmp(p, tag, taglen) == 0 && p[taglen] == '=')
|
|
return p + taglen + 1;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
static char *get_modinfo(const struct load_info *info, const char *tag)
|
|
{
|
|
return get_next_modinfo(info, tag, NULL);
|
|
}
|
|
|
|
static void setup_modinfo(struct module *mod, struct load_info *info)
|
|
{
|
|
struct module_attribute *attr;
|
|
int i;
|
|
|
|
for (i = 0; (attr = modinfo_attrs[i]); i++) {
|
|
if (attr->setup)
|
|
attr->setup(mod, get_modinfo(info, attr->attr.name));
|
|
}
|
|
}
|
|
|
|
static void free_modinfo(struct module *mod)
|
|
{
|
|
struct module_attribute *attr;
|
|
int i;
|
|
|
|
for (i = 0; (attr = modinfo_attrs[i]); i++) {
|
|
if (attr->free)
|
|
attr->free(mod);
|
|
}
|
|
}
|
|
|
|
#ifdef CONFIG_KALLSYMS
|
|
|
|
/* Lookup exported symbol in given range of kernel_symbols */
|
|
static const struct kernel_symbol *lookup_exported_symbol(const char *name,
|
|
const struct kernel_symbol *start,
|
|
const struct kernel_symbol *stop)
|
|
{
|
|
return bsearch(name, start, stop - start,
|
|
sizeof(struct kernel_symbol), cmp_name);
|
|
}
|
|
|
|
static int is_exported(const char *name, unsigned long value,
|
|
const struct module *mod)
|
|
{
|
|
const struct kernel_symbol *ks;
|
|
if (!mod)
|
|
ks = lookup_exported_symbol(name, __start___ksymtab, __stop___ksymtab);
|
|
else
|
|
ks = lookup_exported_symbol(name, mod->syms, mod->syms + mod->num_syms);
|
|
|
|
return ks != NULL && kernel_symbol_value(ks) == value;
|
|
}
|
|
|
|
/* As per nm */
|
|
static char elf_type(const Elf_Sym *sym, const struct load_info *info)
|
|
{
|
|
const Elf_Shdr *sechdrs = info->sechdrs;
|
|
|
|
if (ELF_ST_BIND(sym->st_info) == STB_WEAK) {
|
|
if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT)
|
|
return 'v';
|
|
else
|
|
return 'w';
|
|
}
|
|
if (sym->st_shndx == SHN_UNDEF)
|
|
return 'U';
|
|
if (sym->st_shndx == SHN_ABS || sym->st_shndx == info->index.pcpu)
|
|
return 'a';
|
|
if (sym->st_shndx >= SHN_LORESERVE)
|
|
return '?';
|
|
if (sechdrs[sym->st_shndx].sh_flags & SHF_EXECINSTR)
|
|
return 't';
|
|
if (sechdrs[sym->st_shndx].sh_flags & SHF_ALLOC
|
|
&& sechdrs[sym->st_shndx].sh_type != SHT_NOBITS) {
|
|
if (!(sechdrs[sym->st_shndx].sh_flags & SHF_WRITE))
|
|
return 'r';
|
|
else if (sechdrs[sym->st_shndx].sh_flags & ARCH_SHF_SMALL)
|
|
return 'g';
|
|
else
|
|
return 'd';
|
|
}
|
|
if (sechdrs[sym->st_shndx].sh_type == SHT_NOBITS) {
|
|
if (sechdrs[sym->st_shndx].sh_flags & ARCH_SHF_SMALL)
|
|
return 's';
|
|
else
|
|
return 'b';
|
|
}
|
|
if (strstarts(info->secstrings + sechdrs[sym->st_shndx].sh_name,
|
|
".debug")) {
|
|
return 'n';
|
|
}
|
|
return '?';
|
|
}
|
|
|
|
static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs,
|
|
unsigned int shnum, unsigned int pcpundx)
|
|
{
|
|
const Elf_Shdr *sec;
|
|
|
|
if (src->st_shndx == SHN_UNDEF
|
|
|| src->st_shndx >= shnum
|
|
|| !src->st_name)
|
|
return false;
|
|
|
|
#ifdef CONFIG_KALLSYMS_ALL
|
|
if (src->st_shndx == pcpundx)
|
|
return true;
|
|
#endif
|
|
|
|
sec = sechdrs + src->st_shndx;
|
|
if (!(sec->sh_flags & SHF_ALLOC)
|
|
#ifndef CONFIG_KALLSYMS_ALL
|
|
|| !(sec->sh_flags & SHF_EXECINSTR)
|
|
#endif
|
|
|| (sec->sh_entsize & INIT_OFFSET_MASK))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
* We only allocate and copy the strings needed by the parts of symtab
|
|
* we keep. This is simple, but has the effect of making multiple
|
|
* copies of duplicates. We could be more sophisticated, see
|
|
* linux-kernel thread starting with
|
|
* <73defb5e4bca04a6431392cc341112b1@localhost>.
|
|
*/
|
|
static void layout_symtab(struct module *mod, struct load_info *info)
|
|
{
|
|
Elf_Shdr *symsect = info->sechdrs + info->index.sym;
|
|
Elf_Shdr *strsect = info->sechdrs + info->index.str;
|
|
const Elf_Sym *src;
|
|
unsigned int i, nsrc, ndst, strtab_size = 0;
|
|
|
|
/* Put symbol section at end of init part of module. */
|
|
symsect->sh_flags |= SHF_ALLOC;
|
|
symsect->sh_entsize = get_offset(mod, &mod->init_layout.size, symsect,
|
|
info->index.sym) | INIT_OFFSET_MASK;
|
|
pr_debug("\t%s\n", info->secstrings + symsect->sh_name);
|
|
|
|
src = (void *)info->hdr + symsect->sh_offset;
|
|
nsrc = symsect->sh_size / sizeof(*src);
|
|
|
|
/* Compute total space required for the core symbols' strtab. */
|
|
for (ndst = i = 0; i < nsrc; i++) {
|
|
if (i == 0 || is_livepatch_module(mod) ||
|
|
is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum,
|
|
info->index.pcpu)) {
|
|
strtab_size += strlen(&info->strtab[src[i].st_name])+1;
|
|
ndst++;
|
|
}
|
|
}
|
|
|
|
/* Append room for core symbols at end of core part. */
|
|
info->symoffs = ALIGN(mod->core_layout.size, symsect->sh_addralign ?: 1);
|
|
info->stroffs = mod->core_layout.size = info->symoffs + ndst * sizeof(Elf_Sym);
|
|
mod->core_layout.size += strtab_size;
|
|
info->core_typeoffs = mod->core_layout.size;
|
|
mod->core_layout.size += ndst * sizeof(char);
|
|
mod->core_layout.size = debug_align(mod->core_layout.size);
|
|
|
|
/* Put string table section at end of init part of module. */
|
|
strsect->sh_flags |= SHF_ALLOC;
|
|
strsect->sh_entsize = get_offset(mod, &mod->init_layout.size, strsect,
|
|
info->index.str) | INIT_OFFSET_MASK;
|
|
pr_debug("\t%s\n", info->secstrings + strsect->sh_name);
|
|
|
|
/* We'll tack temporary mod_kallsyms on the end. */
|
|
mod->init_layout.size = ALIGN(mod->init_layout.size,
|
|
__alignof__(struct mod_kallsyms));
|
|
info->mod_kallsyms_init_off = mod->init_layout.size;
|
|
mod->init_layout.size += sizeof(struct mod_kallsyms);
|
|
info->init_typeoffs = mod->init_layout.size;
|
|
mod->init_layout.size += nsrc * sizeof(char);
|
|
mod->init_layout.size = debug_align(mod->init_layout.size);
|
|
}
|
|
|
|
/*
|
|
* We use the full symtab and strtab which layout_symtab arranged to
|
|
* be appended to the init section. Later we switch to the cut-down
|
|
* core-only ones.
|
|
*/
|
|
static void add_kallsyms(struct module *mod, const struct load_info *info)
|
|
{
|
|
unsigned int i, ndst;
|
|
const Elf_Sym *src;
|
|
Elf_Sym *dst;
|
|
char *s;
|
|
Elf_Shdr *symsec = &info->sechdrs[info->index.sym];
|
|
|
|
/* Set up to point into init section. */
|
|
mod->kallsyms = mod->init_layout.base + info->mod_kallsyms_init_off;
|
|
|
|
mod->kallsyms->symtab = (void *)symsec->sh_addr;
|
|
mod->kallsyms->num_symtab = symsec->sh_size / sizeof(Elf_Sym);
|
|
/* Make sure we get permanent strtab: don't use info->strtab. */
|
|
mod->kallsyms->strtab = (void *)info->sechdrs[info->index.str].sh_addr;
|
|
mod->kallsyms->typetab = mod->init_layout.base + info->init_typeoffs;
|
|
|
|
/*
|
|
* Now populate the cut down core kallsyms for after init
|
|
* and set types up while we still have access to sections.
|
|
*/
|
|
mod->core_kallsyms.symtab = dst = mod->core_layout.base + info->symoffs;
|
|
mod->core_kallsyms.strtab = s = mod->core_layout.base + info->stroffs;
|
|
mod->core_kallsyms.typetab = mod->core_layout.base + info->core_typeoffs;
|
|
src = mod->kallsyms->symtab;
|
|
for (ndst = i = 0; i < mod->kallsyms->num_symtab; i++) {
|
|
mod->kallsyms->typetab[i] = elf_type(src + i, info);
|
|
if (i == 0 || is_livepatch_module(mod) ||
|
|
is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum,
|
|
info->index.pcpu)) {
|
|
mod->core_kallsyms.typetab[ndst] =
|
|
mod->kallsyms->typetab[i];
|
|
dst[ndst] = src[i];
|
|
dst[ndst++].st_name = s - mod->core_kallsyms.strtab;
|
|
s += strlcpy(s, &mod->kallsyms->strtab[src[i].st_name],
|
|
KSYM_NAME_LEN) + 1;
|
|
}
|
|
}
|
|
mod->core_kallsyms.num_symtab = ndst;
|
|
}
|
|
#else
|
|
static inline void layout_symtab(struct module *mod, struct load_info *info)
|
|
{
|
|
}
|
|
|
|
static void add_kallsyms(struct module *mod, const struct load_info *info)
|
|
{
|
|
}
|
|
#endif /* CONFIG_KALLSYMS */
|
|
|
|
static void dynamic_debug_setup(struct module *mod, struct _ddebug *debug, unsigned int num)
|
|
{
|
|
if (!debug)
|
|
return;
|
|
ddebug_add_module(debug, num, mod->name);
|
|
}
|
|
|
|
static void dynamic_debug_remove(struct module *mod, struct _ddebug *debug)
|
|
{
|
|
if (debug)
|
|
ddebug_remove_module(mod->name);
|
|
}
|
|
|
|
void * __weak module_alloc(unsigned long size)
|
|
{
|
|
return vmalloc_exec(size);
|
|
}
|
|
|
|
bool __weak module_exit_section(const char *name)
|
|
{
|
|
return strstarts(name, ".exit");
|
|
}
|
|
|
|
#ifdef CONFIG_DEBUG_KMEMLEAK
|
|
static void kmemleak_load_module(const struct module *mod,
|
|
const struct load_info *info)
|
|
{
|
|
unsigned int i;
|
|
|
|
/* only scan the sections containing data */
|
|
kmemleak_scan_area(mod, sizeof(struct module), GFP_KERNEL);
|
|
|
|
for (i = 1; i < info->hdr->e_shnum; i++) {
|
|
/* Scan all writable sections that's not executable */
|
|
if (!(info->sechdrs[i].sh_flags & SHF_ALLOC) ||
|
|
!(info->sechdrs[i].sh_flags & SHF_WRITE) ||
|
|
(info->sechdrs[i].sh_flags & SHF_EXECINSTR))
|
|
continue;
|
|
|
|
kmemleak_scan_area((void *)info->sechdrs[i].sh_addr,
|
|
info->sechdrs[i].sh_size, GFP_KERNEL);
|
|
}
|
|
}
|
|
#else
|
|
static inline void kmemleak_load_module(const struct module *mod,
|
|
const struct load_info *info)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_MODULE_SIG
|
|
static int module_sig_check(struct load_info *info, int flags)
|
|
{
|
|
int err = -ENODATA;
|
|
const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
|
|
const char *reason;
|
|
const void *mod = info->hdr;
|
|
|
|
/*
|
|
* Require flags == 0, as a module with version information
|
|
* removed is no longer the module that was signed
|
|
*/
|
|
if (flags == 0 &&
|
|
info->len > markerlen &&
|
|
memcmp(mod + info->len - markerlen, MODULE_SIG_STRING, markerlen) == 0) {
|
|
/* We truncate the module to discard the signature */
|
|
info->len -= markerlen;
|
|
err = mod_verify_sig(mod, info);
|
|
}
|
|
|
|
switch (err) {
|
|
case 0:
|
|
info->sig_ok = true;
|
|
return 0;
|
|
|
|
/* We don't permit modules to be loaded into trusted kernels
|
|
* without a valid signature on them, but if we're not
|
|
* enforcing, certain errors are non-fatal.
|
|
*/
|
|
case -ENODATA:
|
|
reason = "Loading of unsigned module";
|
|
goto decide;
|
|
case -ENOPKG:
|
|
reason = "Loading of module with unsupported crypto";
|
|
goto decide;
|
|
case -ENOKEY:
|
|
reason = "Loading of module with unavailable key";
|
|
decide:
|
|
if (is_module_sig_enforced()) {
|
|
pr_notice("%s is rejected\n", reason);
|
|
return -EKEYREJECTED;
|
|
}
|
|
|
|
return security_locked_down(LOCKDOWN_MODULE_SIGNATURE);
|
|
|
|
/* All other errors are fatal, including nomem, unparseable
|
|
* signatures and signature check failures - even if signatures
|
|
* aren't required.
|
|
*/
|
|
default:
|
|
return err;
|
|
}
|
|
}
|
|
#else /* !CONFIG_MODULE_SIG */
|
|
static int module_sig_check(struct load_info *info, int flags)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif /* !CONFIG_MODULE_SIG */
|
|
|
|
/* Sanity checks against invalid binaries, wrong arch, weird elf version. */
|
|
static int elf_header_check(struct load_info *info)
|
|
{
|
|
if (info->len < sizeof(*(info->hdr)))
|
|
return -ENOEXEC;
|
|
|
|
if (memcmp(info->hdr->e_ident, ELFMAG, SELFMAG) != 0
|
|
|| info->hdr->e_type != ET_REL
|
|
|| !elf_check_arch(info->hdr)
|
|
|| info->hdr->e_shentsize != sizeof(Elf_Shdr))
|
|
return -ENOEXEC;
|
|
|
|
if (info->hdr->e_shoff >= info->len
|
|
|| (info->hdr->e_shnum * sizeof(Elf_Shdr) >
|
|
info->len - info->hdr->e_shoff))
|
|
return -ENOEXEC;
|
|
|
|
return 0;
|
|
}
|
|
|
|
#define COPY_CHUNK_SIZE (16*PAGE_SIZE)
|
|
|
|
static int copy_chunked_from_user(void *dst, const void __user *usrc, unsigned long len)
|
|
{
|
|
do {
|
|
unsigned long n = min(len, COPY_CHUNK_SIZE);
|
|
|
|
if (copy_from_user(dst, usrc, n) != 0)
|
|
return -EFAULT;
|
|
cond_resched();
|
|
dst += n;
|
|
usrc += n;
|
|
len -= n;
|
|
} while (len);
|
|
return 0;
|
|
}
|
|
|
|
#ifdef CONFIG_LIVEPATCH
|
|
static int check_modinfo_livepatch(struct module *mod, struct load_info *info)
|
|
{
|
|
if (get_modinfo(info, "livepatch")) {
|
|
mod->klp = true;
|
|
add_taint_module(mod, TAINT_LIVEPATCH, LOCKDEP_STILL_OK);
|
|
pr_notice_once("%s: tainting kernel with TAINT_LIVEPATCH\n",
|
|
mod->name);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
#else /* !CONFIG_LIVEPATCH */
|
|
static int check_modinfo_livepatch(struct module *mod, struct load_info *info)
|
|
{
|
|
if (get_modinfo(info, "livepatch")) {
|
|
pr_err("%s: module is marked as livepatch module, but livepatch support is disabled",
|
|
mod->name);
|
|
return -ENOEXEC;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_LIVEPATCH */
|
|
|
|
static void check_modinfo_retpoline(struct module *mod, struct load_info *info)
|
|
{
|
|
if (retpoline_module_ok(get_modinfo(info, "retpoline")))
|
|
return;
|
|
|
|
pr_warn("%s: loading module not compiled with retpoline compiler.\n",
|
|
mod->name);
|
|
}
|
|
|
|
/* Sets info->hdr and info->len. */
|
|
static int copy_module_from_user(const void __user *umod, unsigned long len,
|
|
struct load_info *info)
|
|
{
|
|
int err;
|
|
|
|
info->len = len;
|
|
if (info->len < sizeof(*(info->hdr)))
|
|
return -ENOEXEC;
|
|
|
|
err = security_kernel_load_data(LOADING_MODULE);
|
|
if (err)
|
|
return err;
|
|
|
|
/* Suck in entire file: we'll want most of it. */
|
|
info->hdr = __vmalloc(info->len,
|
|
GFP_KERNEL | __GFP_NOWARN, PAGE_KERNEL);
|
|
if (!info->hdr)
|
|
return -ENOMEM;
|
|
|
|
if (copy_chunked_from_user(info->hdr, umod, info->len) != 0) {
|
|
vfree(info->hdr);
|
|
return -EFAULT;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void free_copy(struct load_info *info)
|
|
{
|
|
vfree(info->hdr);
|
|
}
|
|
|
|
static int rewrite_section_headers(struct load_info *info, int flags)
|
|
{
|
|
unsigned int i;
|
|
|
|
/* This should always be true, but let's be sure. */
|
|
info->sechdrs[0].sh_addr = 0;
|
|
|
|
for (i = 1; i < info->hdr->e_shnum; i++) {
|
|
Elf_Shdr *shdr = &info->sechdrs[i];
|
|
if (shdr->sh_type != SHT_NOBITS
|
|
&& info->len < shdr->sh_offset + shdr->sh_size) {
|
|
pr_err("Module len %lu truncated\n", info->len);
|
|
return -ENOEXEC;
|
|
}
|
|
|
|
/* Mark all sections sh_addr with their address in the
|
|
temporary image. */
|
|
shdr->sh_addr = (size_t)info->hdr + shdr->sh_offset;
|
|
|
|
#ifndef CONFIG_MODULE_UNLOAD
|
|
/* Don't load .exit sections */
|
|
if (module_exit_section(info->secstrings+shdr->sh_name))
|
|
shdr->sh_flags &= ~(unsigned long)SHF_ALLOC;
|
|
#endif
|
|
}
|
|
|
|
/* Track but don't keep modinfo and version sections. */
|
|
info->sechdrs[info->index.vers].sh_flags &= ~(unsigned long)SHF_ALLOC;
|
|
info->sechdrs[info->index.info].sh_flags &= ~(unsigned long)SHF_ALLOC;
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Set up our basic convenience variables (pointers to section headers,
|
|
* search for module section index etc), and do some basic section
|
|
* verification.
|
|
*
|
|
* Set info->mod to the temporary copy of the module in info->hdr. The final one
|
|
* will be allocated in move_module().
|
|
*/
|
|
static int setup_load_info(struct load_info *info, int flags)
|
|
{
|
|
unsigned int i;
|
|
|
|
/* Set up the convenience variables */
|
|
info->sechdrs = (void *)info->hdr + info->hdr->e_shoff;
|
|
info->secstrings = (void *)info->hdr
|
|
+ info->sechdrs[info->hdr->e_shstrndx].sh_offset;
|
|
|
|
/* Try to find a name early so we can log errors with a module name */
|
|
info->index.info = find_sec(info, ".modinfo");
|
|
if (info->index.info)
|
|
info->name = get_modinfo(info, "name");
|
|
|
|
/* Find internal symbols and strings. */
|
|
for (i = 1; i < info->hdr->e_shnum; i++) {
|
|
if (info->sechdrs[i].sh_type == SHT_SYMTAB) {
|
|
info->index.sym = i;
|
|
info->index.str = info->sechdrs[i].sh_link;
|
|
info->strtab = (char *)info->hdr
|
|
+ info->sechdrs[info->index.str].sh_offset;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (info->index.sym == 0) {
|
|
pr_warn("%s: module has no symbols (stripped?)\n",
|
|
info->name ?: "(missing .modinfo section or name field)");
|
|
return -ENOEXEC;
|
|
}
|
|
|
|
info->index.mod = find_sec(info, ".gnu.linkonce.this_module");
|
|
if (!info->index.mod) {
|
|
pr_warn("%s: No module found in object\n",
|
|
info->name ?: "(missing .modinfo section or name field)");
|
|
return -ENOEXEC;
|
|
}
|
|
/* This is temporary: point mod into copy of data. */
|
|
info->mod = (void *)info->hdr + info->sechdrs[info->index.mod].sh_offset;
|
|
|
|
/*
|
|
* If we didn't load the .modinfo 'name' field earlier, fall back to
|
|
* on-disk struct mod 'name' field.
|
|
*/
|
|
if (!info->name)
|
|
info->name = info->mod->name;
|
|
|
|
if (flags & MODULE_INIT_IGNORE_MODVERSIONS)
|
|
info->index.vers = 0; /* Pretend no __versions section! */
|
|
else
|
|
info->index.vers = find_sec(info, "__versions");
|
|
|
|
info->index.pcpu = find_pcpusec(info);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
|
|
{
|
|
const char *modmagic = get_modinfo(info, "vermagic");
|
|
int err;
|
|
|
|
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
|
|
modmagic = NULL;
|
|
|
|
/* This is allowed: modprobe --force will invalidate it. */
|
|
if (!modmagic) {
|
|
err = try_to_force_load(mod, "bad vermagic");
|
|
if (err)
|
|
return err;
|
|
} else if (!same_magic(modmagic, vermagic, info->index.vers)) {
|
|
pr_err("%s: version magic '%s' should be '%s'\n",
|
|
info->name, modmagic, vermagic);
|
|
return -ENOEXEC;
|
|
}
|
|
|
|
if (!get_modinfo(info, "intree")) {
|
|
if (!test_taint(TAINT_OOT_MODULE))
|
|
pr_warn("%s: loading out-of-tree module taints kernel.\n",
|
|
mod->name);
|
|
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
|
|
}
|
|
|
|
check_modinfo_retpoline(mod, info);
|
|
|
|
if (get_modinfo(info, "staging")) {
|
|
add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
|
|
pr_warn("%s: module is from the staging directory, the quality "
|
|
"is unknown, you have been warned.\n", mod->name);
|
|
}
|
|
|
|
err = check_modinfo_livepatch(mod, info);
|
|
if (err)
|
|
return err;
|
|
|
|
/* Set up license info based on the info section */
|
|
set_license(mod, get_modinfo(info, "license"));
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int find_module_sections(struct module *mod, struct load_info *info)
|
|
{
|
|
mod->kp = section_objs(info, "__param",
|
|
sizeof(*mod->kp), &mod->num_kp);
|
|
mod->syms = section_objs(info, "__ksymtab",
|
|
sizeof(*mod->syms), &mod->num_syms);
|
|
mod->crcs = section_addr(info, "__kcrctab");
|
|
mod->gpl_syms = section_objs(info, "__ksymtab_gpl",
|
|
sizeof(*mod->gpl_syms),
|
|
&mod->num_gpl_syms);
|
|
mod->gpl_crcs = section_addr(info, "__kcrctab_gpl");
|
|
mod->gpl_future_syms = section_objs(info,
|
|
"__ksymtab_gpl_future",
|
|
sizeof(*mod->gpl_future_syms),
|
|
&mod->num_gpl_future_syms);
|
|
mod->gpl_future_crcs = section_addr(info, "__kcrctab_gpl_future");
|
|
|
|
#ifdef CONFIG_UNUSED_SYMBOLS
|
|
mod->unused_syms = section_objs(info, "__ksymtab_unused",
|
|
sizeof(*mod->unused_syms),
|
|
&mod->num_unused_syms);
|
|
mod->unused_crcs = section_addr(info, "__kcrctab_unused");
|
|
mod->unused_gpl_syms = section_objs(info, "__ksymtab_unused_gpl",
|
|
sizeof(*mod->unused_gpl_syms),
|
|
&mod->num_unused_gpl_syms);
|
|
mod->unused_gpl_crcs = section_addr(info, "__kcrctab_unused_gpl");
|
|
#endif
|
|
#ifdef CONFIG_CONSTRUCTORS
|
|
mod->ctors = section_objs(info, ".ctors",
|
|
sizeof(*mod->ctors), &mod->num_ctors);
|
|
if (!mod->ctors)
|
|
mod->ctors = section_objs(info, ".init_array",
|
|
sizeof(*mod->ctors), &mod->num_ctors);
|
|
else if (find_sec(info, ".init_array")) {
|
|
/*
|
|
* This shouldn't happen with same compiler and binutils
|
|
* building all parts of the module.
|
|
*/
|
|
pr_warn("%s: has both .ctors and .init_array.\n",
|
|
mod->name);
|
|
return -EINVAL;
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_TRACEPOINTS
|
|
mod->tracepoints_ptrs = section_objs(info, "__tracepoints_ptrs",
|
|
sizeof(*mod->tracepoints_ptrs),
|
|
&mod->num_tracepoints);
|
|
#endif
|
|
#ifdef CONFIG_TREE_SRCU
|
|
mod->srcu_struct_ptrs = section_objs(info, "___srcu_struct_ptrs",
|
|
sizeof(*mod->srcu_struct_ptrs),
|
|
&mod->num_srcu_structs);
|
|
#endif
|
|
#ifdef CONFIG_BPF_EVENTS
|
|
mod->bpf_raw_events = section_objs(info, "__bpf_raw_tp_map",
|
|
sizeof(*mod->bpf_raw_events),
|
|
&mod->num_bpf_raw_events);
|
|
#endif
|
|
#ifdef CONFIG_JUMP_LABEL
|
|
mod->jump_entries = section_objs(info, "__jump_table",
|
|
sizeof(*mod->jump_entries),
|
|
&mod->num_jump_entries);
|
|
#endif
|
|
#ifdef CONFIG_EVENT_TRACING
|
|
mod->trace_events = section_objs(info, "_ftrace_events",
|
|
sizeof(*mod->trace_events),
|
|
&mod->num_trace_events);
|
|
mod->trace_evals = section_objs(info, "_ftrace_eval_map",
|
|
sizeof(*mod->trace_evals),
|
|
&mod->num_trace_evals);
|
|
#endif
|
|
#ifdef CONFIG_TRACING
|
|
mod->trace_bprintk_fmt_start = section_objs(info, "__trace_printk_fmt",
|
|
sizeof(*mod->trace_bprintk_fmt_start),
|
|
&mod->num_trace_bprintk_fmt);
|
|
#endif
|
|
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
|
|
/* sechdrs[0].sh_size is always zero */
|
|
mod->ftrace_callsites = section_objs(info, "__mcount_loc",
|
|
sizeof(*mod->ftrace_callsites),
|
|
&mod->num_ftrace_callsites);
|
|
#endif
|
|
#ifdef CONFIG_FUNCTION_ERROR_INJECTION
|
|
mod->ei_funcs = section_objs(info, "_error_injection_whitelist",
|
|
sizeof(*mod->ei_funcs),
|
|
&mod->num_ei_funcs);
|
|
#endif
|
|
mod->extable = section_objs(info, "__ex_table",
|
|
sizeof(*mod->extable), &mod->num_exentries);
|
|
|
|
if (section_addr(info, "__obsparm"))
|
|
pr_warn("%s: Ignoring obsolete parameters\n", mod->name);
|
|
|
|
info->debug = section_objs(info, "__verbose",
|
|
sizeof(*info->debug), &info->num_debug);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int move_module(struct module *mod, struct load_info *info)
|
|
{
|
|
int i;
|
|
void *ptr;
|
|
|
|
/* Do the allocs. */
|
|
ptr = module_alloc(mod->core_layout.size);
|
|
/*
|
|
* The pointer to this block is stored in the module structure
|
|
* which is inside the block. Just mark it as not being a
|
|
* leak.
|
|
*/
|
|
kmemleak_not_leak(ptr);
|
|
if (!ptr)
|
|
return -ENOMEM;
|
|
|
|
memset(ptr, 0, mod->core_layout.size);
|
|
mod->core_layout.base = ptr;
|
|
|
|
if (mod->init_layout.size) {
|
|
ptr = module_alloc(mod->init_layout.size);
|
|
/*
|
|
* The pointer to this block is stored in the module structure
|
|
* which is inside the block. This block doesn't need to be
|
|
* scanned as it contains data and code that will be freed
|
|
* after the module is initialized.
|
|
*/
|
|
kmemleak_ignore(ptr);
|
|
if (!ptr) {
|
|
module_memfree(mod->core_layout.base);
|
|
return -ENOMEM;
|
|
}
|
|
memset(ptr, 0, mod->init_layout.size);
|
|
mod->init_layout.base = ptr;
|
|
} else
|
|
mod->init_layout.base = NULL;
|
|
|
|
/* Transfer each section which specifies SHF_ALLOC */
|
|
pr_debug("final section addresses:\n");
|
|
for (i = 0; i < info->hdr->e_shnum; i++) {
|
|
void *dest;
|
|
Elf_Shdr *shdr = &info->sechdrs[i];
|
|
|
|
if (!(shdr->sh_flags & SHF_ALLOC))
|
|
continue;
|
|
|
|
if (shdr->sh_entsize & INIT_OFFSET_MASK)
|
|
dest = mod->init_layout.base
|
|
+ (shdr->sh_entsize & ~INIT_OFFSET_MASK);
|
|
else
|
|
dest = mod->core_layout.base + shdr->sh_entsize;
|
|
|
|
if (shdr->sh_type != SHT_NOBITS)
|
|
memcpy(dest, (void *)shdr->sh_addr, shdr->sh_size);
|
|
/* Update sh_addr to point to copy in image. */
|
|
shdr->sh_addr = (unsigned long)dest;
|
|
pr_debug("\t0x%lx %s\n",
|
|
(long)shdr->sh_addr, info->secstrings + shdr->sh_name);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int check_module_license_and_versions(struct module *mod)
|
|
{
|
|
int prev_taint = test_taint(TAINT_PROPRIETARY_MODULE);
|
|
|
|
/*
|
|
* ndiswrapper is under GPL by itself, but loads proprietary modules.
|
|
* Don't use add_taint_module(), as it would prevent ndiswrapper from
|
|
* using GPL-only symbols it needs.
|
|
*/
|
|
if (strcmp(mod->name, "ndiswrapper") == 0)
|
|
add_taint(TAINT_PROPRIETARY_MODULE, LOCKDEP_NOW_UNRELIABLE);
|
|
|
|
/* driverloader was caught wrongly pretending to be under GPL */
|
|
if (strcmp(mod->name, "driverloader") == 0)
|
|
add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
|
|
LOCKDEP_NOW_UNRELIABLE);
|
|
|
|
/* lve claims to be GPL but upstream won't provide source */
|
|
if (strcmp(mod->name, "lve") == 0)
|
|
add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
|
|
LOCKDEP_NOW_UNRELIABLE);
|
|
|
|
if (!prev_taint && test_taint(TAINT_PROPRIETARY_MODULE))
|
|
pr_warn("%s: module license taints kernel.\n", mod->name);
|
|
|
|
#ifdef CONFIG_MODVERSIONS
|
|
if ((mod->num_syms && !mod->crcs)
|
|
|| (mod->num_gpl_syms && !mod->gpl_crcs)
|
|
|| (mod->num_gpl_future_syms && !mod->gpl_future_crcs)
|
|
#ifdef CONFIG_UNUSED_SYMBOLS
|
|
|| (mod->num_unused_syms && !mod->unused_crcs)
|
|
|| (mod->num_unused_gpl_syms && !mod->unused_gpl_crcs)
|
|
#endif
|
|
) {
|
|
return try_to_force_load(mod,
|
|
"no versions for exported symbols");
|
|
}
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
static void flush_module_icache(const struct module *mod)
|
|
{
|
|
mm_segment_t old_fs;
|
|
|
|
/* flush the icache in correct context */
|
|
old_fs = get_fs();
|
|
set_fs(KERNEL_DS);
|
|
|
|
/*
|
|
* Flush the instruction cache, since we've played with text.
|
|
* Do it before processing of module parameters, so the module
|
|
* can provide parameter accessor functions of its own.
|
|
*/
|
|
if (mod->init_layout.base)
|
|
flush_icache_range((unsigned long)mod->init_layout.base,
|
|
(unsigned long)mod->init_layout.base
|
|
+ mod->init_layout.size);
|
|
flush_icache_range((unsigned long)mod->core_layout.base,
|
|
(unsigned long)mod->core_layout.base + mod->core_layout.size);
|
|
|
|
set_fs(old_fs);
|
|
}
|
|
|
|
int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
|
|
Elf_Shdr *sechdrs,
|
|
char *secstrings,
|
|
struct module *mod)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/* module_blacklist is a comma-separated list of module names */
|
|
static char *module_blacklist;
|
|
static bool blacklisted(const char *module_name)
|
|
{
|
|
const char *p;
|
|
size_t len;
|
|
|
|
if (!module_blacklist)
|
|
return false;
|
|
|
|
for (p = module_blacklist; *p; p += len) {
|
|
len = strcspn(p, ",");
|
|
if (strlen(module_name) == len && !memcmp(module_name, p, len))
|
|
return true;
|
|
if (p[len] == ',')
|
|
len++;
|
|
}
|
|
return false;
|
|
}
|
|
core_param(module_blacklist, module_blacklist, charp, 0400);
|
|
|
|
static struct module *layout_and_allocate(struct load_info *info, int flags)
|
|
{
|
|
struct module *mod;
|
|
unsigned int ndx;
|
|
int err;
|
|
|
|
err = check_modinfo(info->mod, info, flags);
|
|
if (err)
|
|
return ERR_PTR(err);
|
|
|
|
/* Allow arches to frob section contents and sizes. */
|
|
err = module_frob_arch_sections(info->hdr, info->sechdrs,
|
|
info->secstrings, info->mod);
|
|
if (err < 0)
|
|
return ERR_PTR(err);
|
|
|
|
/* We will do a special allocation for per-cpu sections later. */
|
|
info->sechdrs[info->index.pcpu].sh_flags &= ~(unsigned long)SHF_ALLOC;
|
|
|
|
/*
|
|
* Mark ro_after_init section with SHF_RO_AFTER_INIT so that
|
|
* layout_sections() can put it in the right place.
|
|
* Note: ro_after_init sections also have SHF_{WRITE,ALLOC} set.
|
|
*/
|
|
ndx = find_sec(info, ".data..ro_after_init");
|
|
if (ndx)
|
|
info->sechdrs[ndx].sh_flags |= SHF_RO_AFTER_INIT;
|
|
/*
|
|
* Mark the __jump_table section as ro_after_init as well: these data
|
|
* structures are never modified, with the exception of entries that
|
|
* refer to code in the __init section, which are annotated as such
|
|
* at module load time.
|
|
*/
|
|
ndx = find_sec(info, "__jump_table");
|
|
if (ndx)
|
|
info->sechdrs[ndx].sh_flags |= SHF_RO_AFTER_INIT;
|
|
|
|
/* Determine total sizes, and put offsets in sh_entsize. For now
|
|
this is done generically; there doesn't appear to be any
|
|
special cases for the architectures. */
|
|
layout_sections(info->mod, info);
|
|
layout_symtab(info->mod, info);
|
|
|
|
/* Allocate and move to the final place */
|
|
err = move_module(info->mod, info);
|
|
if (err)
|
|
return ERR_PTR(err);
|
|
|
|
/* Module has been copied to its final place now: return it. */
|
|
mod = (void *)info->sechdrs[info->index.mod].sh_addr;
|
|
kmemleak_load_module(mod, info);
|
|
return mod;
|
|
}
|
|
|
|
/* mod is no longer valid after this! */
|
|
static void module_deallocate(struct module *mod, struct load_info *info)
|
|
{
|
|
percpu_modfree(mod);
|
|
module_arch_freeing_init(mod);
|
|
module_memfree(mod->init_layout.base);
|
|
module_memfree(mod->core_layout.base);
|
|
}
|
|
|
|
int __weak module_finalize(const Elf_Ehdr *hdr,
|
|
const Elf_Shdr *sechdrs,
|
|
struct module *me)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static void cfi_init(struct module *mod);
|
|
|
|
static int post_relocation(struct module *mod, const struct load_info *info)
|
|
{
|
|
/* Sort exception table now relocations are done. */
|
|
sort_extable(mod->extable, mod->extable + mod->num_exentries);
|
|
|
|
/* Copy relocated percpu area over. */
|
|
percpu_modcopy(mod, (void *)info->sechdrs[info->index.pcpu].sh_addr,
|
|
info->sechdrs[info->index.pcpu].sh_size);
|
|
|
|
/* Setup kallsyms-specific fields. */
|
|
add_kallsyms(mod, info);
|
|
|
|
/* Setup CFI for the module. */
|
|
cfi_init(mod);
|
|
|
|
/* Arch-specific module finalizing. */
|
|
return module_finalize(info->hdr, info->sechdrs, mod);
|
|
}
|
|
|
|
/* Is this module of this name done loading? No locks held. */
|
|
static bool finished_loading(const char *name)
|
|
{
|
|
struct module *mod;
|
|
bool ret;
|
|
|
|
/*
|
|
* The module_mutex should not be a heavily contended lock;
|
|
* if we get the occasional sleep here, we'll go an extra iteration
|
|
* in the wait_event_interruptible(), which is harmless.
|
|
*/
|
|
sched_annotate_sleep();
|
|
mutex_lock(&module_mutex);
|
|
mod = find_module_all(name, strlen(name), true);
|
|
ret = !mod || mod->state == MODULE_STATE_LIVE;
|
|
mutex_unlock(&module_mutex);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/* Call module constructors. */
|
|
static void do_mod_ctors(struct module *mod)
|
|
{
|
|
#ifdef CONFIG_CONSTRUCTORS
|
|
unsigned long i;
|
|
|
|
for (i = 0; i < mod->num_ctors; i++)
|
|
mod->ctors[i]();
|
|
#endif
|
|
}
|
|
|
|
/* For freeing module_init on success, in case kallsyms traversing */
|
|
struct mod_initfree {
|
|
struct llist_node node;
|
|
void *module_init;
|
|
};
|
|
|
|
static void do_free_init(struct work_struct *w)
|
|
{
|
|
struct llist_node *pos, *n, *list;
|
|
struct mod_initfree *initfree;
|
|
|
|
list = llist_del_all(&init_free_list);
|
|
|
|
synchronize_rcu();
|
|
|
|
llist_for_each_safe(pos, n, list) {
|
|
initfree = container_of(pos, struct mod_initfree, node);
|
|
module_memfree(initfree->module_init);
|
|
kfree(initfree);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* This is where the real work happens.
|
|
*
|
|
* Keep it uninlined to provide a reliable breakpoint target, e.g. for the gdb
|
|
* helper command 'lx-symbols'.
|
|
*/
|
|
static noinline int do_init_module(struct module *mod)
|
|
{
|
|
int ret = 0;
|
|
struct mod_initfree *freeinit;
|
|
|
|
freeinit = kmalloc(sizeof(*freeinit), GFP_KERNEL);
|
|
if (!freeinit) {
|
|
ret = -ENOMEM;
|
|
goto fail;
|
|
}
|
|
freeinit->module_init = mod->init_layout.base;
|
|
|
|
/*
|
|
* We want to find out whether @mod uses async during init. Clear
|
|
* PF_USED_ASYNC. async_schedule*() will set it.
|
|
*/
|
|
current->flags &= ~PF_USED_ASYNC;
|
|
|
|
do_mod_ctors(mod);
|
|
/* Start the module */
|
|
if (mod->init != NULL)
|
|
ret = do_one_initcall(mod->init);
|
|
if (ret < 0) {
|
|
goto fail_free_freeinit;
|
|
}
|
|
if (ret > 0) {
|
|
pr_warn("%s: '%s'->init suspiciously returned %d, it should "
|
|
"follow 0/-E convention\n"
|
|
"%s: loading module anyway...\n",
|
|
__func__, mod->name, ret, __func__);
|
|
dump_stack();
|
|
}
|
|
|
|
/* Now it's a first class citizen! */
|
|
mod->state = MODULE_STATE_LIVE;
|
|
blocking_notifier_call_chain(&module_notify_list,
|
|
MODULE_STATE_LIVE, mod);
|
|
|
|
/*
|
|
* We need to finish all async code before the module init sequence
|
|
* is done. This has potential to deadlock. For example, a newly
|
|
* detected block device can trigger request_module() of the
|
|
* default iosched from async probing task. Once userland helper
|
|
* reaches here, async_synchronize_full() will wait on the async
|
|
* task waiting on request_module() and deadlock.
|
|
*
|
|
* This deadlock is avoided by perfomring async_synchronize_full()
|
|
* iff module init queued any async jobs. This isn't a full
|
|
* solution as it will deadlock the same if module loading from
|
|
* async jobs nests more than once; however, due to the various
|
|
* constraints, this hack seems to be the best option for now.
|
|
* Please refer to the following thread for details.
|
|
*
|
|
* http://thread.gmane.org/gmane.linux.kernel/1420814
|
|
*/
|
|
if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC))
|
|
async_synchronize_full();
|
|
|
|
ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base +
|
|
mod->init_layout.size);
|
|
mutex_lock(&module_mutex);
|
|
/* Drop initial reference. */
|
|
module_put(mod);
|
|
trim_init_extable(mod);
|
|
#ifdef CONFIG_KALLSYMS
|
|
/* Switch to core kallsyms now init is done: kallsyms may be walking! */
|
|
rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms);
|
|
#endif
|
|
module_enable_ro(mod, true);
|
|
mod_tree_remove_init(mod);
|
|
module_arch_freeing_init(mod);
|
|
mod->init_layout.base = NULL;
|
|
mod->init_layout.size = 0;
|
|
mod->init_layout.ro_size = 0;
|
|
mod->init_layout.ro_after_init_size = 0;
|
|
mod->init_layout.text_size = 0;
|
|
/*
|
|
* We want to free module_init, but be aware that kallsyms may be
|
|
* walking this with preempt disabled. In all the failure paths, we
|
|
* call synchronize_rcu(), but we don't want to slow down the success
|
|
* path. module_memfree() cannot be called in an interrupt, so do the
|
|
* work and call synchronize_rcu() in a work queue.
|
|
*
|
|
* Note that module_alloc() on most architectures creates W+X page
|
|
* mappings which won't be cleaned up until do_free_init() runs. Any
|
|
* code such as mark_rodata_ro() which depends on those mappings to
|
|
* be cleaned up needs to sync with the queued work - ie
|
|
* rcu_barrier()
|
|
*/
|
|
if (llist_add(&freeinit->node, &init_free_list))
|
|
schedule_work(&init_free_wq);
|
|
|
|
mutex_unlock(&module_mutex);
|
|
wake_up_all(&module_wq);
|
|
|
|
return 0;
|
|
|
|
fail_free_freeinit:
|
|
kfree(freeinit);
|
|
fail:
|
|
/* Try to protect us from buggy refcounters. */
|
|
mod->state = MODULE_STATE_GOING;
|
|
synchronize_rcu();
|
|
module_put(mod);
|
|
blocking_notifier_call_chain(&module_notify_list,
|
|
MODULE_STATE_GOING, mod);
|
|
klp_module_going(mod);
|
|
ftrace_release_mod(mod);
|
|
free_module(mod);
|
|
wake_up_all(&module_wq);
|
|
return ret;
|
|
}
|
|
|
|
static int may_init_module(void)
|
|
{
|
|
if (!capable(CAP_SYS_MODULE) || modules_disabled)
|
|
return -EPERM;
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* We try to place it in the list now to make sure it's unique before
|
|
* we dedicate too many resources. In particular, temporary percpu
|
|
* memory exhaustion.
|
|
*/
|
|
static int add_unformed_module(struct module *mod)
|
|
{
|
|
int err;
|
|
struct module *old;
|
|
|
|
mod->state = MODULE_STATE_UNFORMED;
|
|
|
|
again:
|
|
mutex_lock(&module_mutex);
|
|
old = find_module_all(mod->name, strlen(mod->name), true);
|
|
if (old != NULL) {
|
|
if (old->state != MODULE_STATE_LIVE) {
|
|
/* Wait in case it fails to load. */
|
|
mutex_unlock(&module_mutex);
|
|
err = wait_event_interruptible(module_wq,
|
|
finished_loading(mod->name));
|
|
if (err)
|
|
goto out_unlocked;
|
|
goto again;
|
|
}
|
|
err = -EEXIST;
|
|
goto out;
|
|
}
|
|
mod_update_bounds(mod);
|
|
list_add_rcu(&mod->list, &modules);
|
|
mod_tree_insert(mod);
|
|
err = 0;
|
|
|
|
out:
|
|
mutex_unlock(&module_mutex);
|
|
out_unlocked:
|
|
return err;
|
|
}
|
|
|
|
static int complete_formation(struct module *mod, struct load_info *info)
|
|
{
|
|
int err;
|
|
|
|
mutex_lock(&module_mutex);
|
|
|
|
/* Find duplicate symbols (must be called under lock). */
|
|
err = verify_exported_symbols(mod);
|
|
if (err < 0)
|
|
goto out;
|
|
|
|
/* This relies on module_mutex for list integrity. */
|
|
module_bug_finalize(info->hdr, info->sechdrs, mod);
|
|
|
|
module_enable_ro(mod, false);
|
|
module_enable_nx(mod);
|
|
module_enable_x(mod);
|
|
|
|
/* Mark state as coming so strong_try_module_get() ignores us,
|
|
* but kallsyms etc. can see us. */
|
|
mod->state = MODULE_STATE_COMING;
|
|
mutex_unlock(&module_mutex);
|
|
|
|
return 0;
|
|
|
|
out:
|
|
mutex_unlock(&module_mutex);
|
|
return err;
|
|
}
|
|
|
|
static int prepare_coming_module(struct module *mod)
|
|
{
|
|
int err;
|
|
|
|
ftrace_module_enable(mod);
|
|
err = klp_module_coming(mod);
|
|
if (err)
|
|
return err;
|
|
|
|
blocking_notifier_call_chain(&module_notify_list,
|
|
MODULE_STATE_COMING, mod);
|
|
return 0;
|
|
}
|
|
|
|
static int unknown_module_param_cb(char *param, char *val, const char *modname,
|
|
void *arg)
|
|
{
|
|
struct module *mod = arg;
|
|
int ret;
|
|
|
|
if (strcmp(param, "async_probe") == 0) {
|
|
mod->async_probe_requested = true;
|
|
return 0;
|
|
}
|
|
|
|
/* Check for magic 'dyndbg' arg */
|
|
ret = ddebug_dyndbg_module_param_cb(param, val, modname);
|
|
if (ret != 0)
|
|
pr_warn("%s: unknown parameter '%s' ignored\n", modname, param);
|
|
return 0;
|
|
}
|
|
|
|
/* Allocate and load the module: note that size of section 0 is always
|
|
zero, and we rely on this for optional sections. */
|
|
static int load_module(struct load_info *info, const char __user *uargs,
|
|
int flags)
|
|
{
|
|
struct module *mod;
|
|
long err = 0;
|
|
char *after_dashes;
|
|
|
|
err = elf_header_check(info);
|
|
if (err)
|
|
goto free_copy;
|
|
|
|
err = setup_load_info(info, flags);
|
|
if (err)
|
|
goto free_copy;
|
|
|
|
if (blacklisted(info->name)) {
|
|
err = -EPERM;
|
|
goto free_copy;
|
|
}
|
|
|
|
err = module_sig_check(info, flags);
|
|
if (err)
|
|
goto free_copy;
|
|
|
|
err = rewrite_section_headers(info, flags);
|
|
if (err)
|
|
goto free_copy;
|
|
|
|
/* Check module struct version now, before we try to use module. */
|
|
if (!check_modstruct_version(info, info->mod)) {
|
|
err = -ENOEXEC;
|
|
goto free_copy;
|
|
}
|
|
|
|
/* Figure out module layout, and allocate all the memory. */
|
|
mod = layout_and_allocate(info, flags);
|
|
if (IS_ERR(mod)) {
|
|
err = PTR_ERR(mod);
|
|
goto free_copy;
|
|
}
|
|
|
|
audit_log_kern_module(mod->name);
|
|
|
|
/* Reserve our place in the list. */
|
|
err = add_unformed_module(mod);
|
|
if (err)
|
|
goto free_module;
|
|
|
|
#ifdef CONFIG_MODULE_SIG
|
|
mod->sig_ok = info->sig_ok;
|
|
if (!mod->sig_ok) {
|
|
pr_notice_once("%s: module verification failed: signature "
|
|
"and/or required key missing - tainting "
|
|
"kernel\n", mod->name);
|
|
add_taint_module(mod, TAINT_UNSIGNED_MODULE, LOCKDEP_STILL_OK);
|
|
}
|
|
#endif
|
|
|
|
/* To avoid stressing percpu allocator, do this once we're unique. */
|
|
err = percpu_modalloc(mod, info);
|
|
if (err)
|
|
goto unlink_mod;
|
|
|
|
/* Now module is in final location, initialize linked lists, etc. */
|
|
err = module_unload_init(mod);
|
|
if (err)
|
|
goto unlink_mod;
|
|
|
|
init_param_lock(mod);
|
|
|
|
/* Now we've got everything in the final locations, we can
|
|
* find optional sections. */
|
|
err = find_module_sections(mod, info);
|
|
if (err)
|
|
goto free_unload;
|
|
|
|
err = check_module_license_and_versions(mod);
|
|
if (err)
|
|
goto free_unload;
|
|
|
|
/* Set up MODINFO_ATTR fields */
|
|
setup_modinfo(mod, info);
|
|
|
|
/* Fix up syms, so that st_value is a pointer to location. */
|
|
err = simplify_symbols(mod, info);
|
|
if (err < 0)
|
|
goto free_modinfo;
|
|
|
|
err = apply_relocations(mod, info);
|
|
if (err < 0)
|
|
goto free_modinfo;
|
|
|
|
err = post_relocation(mod, info);
|
|
if (err < 0)
|
|
goto free_modinfo;
|
|
|
|
flush_module_icache(mod);
|
|
|
|
/* Now copy in args */
|
|
mod->args = strndup_user(uargs, ~0UL >> 1);
|
|
if (IS_ERR(mod->args)) {
|
|
err = PTR_ERR(mod->args);
|
|
goto free_arch_cleanup;
|
|
}
|
|
|
|
dynamic_debug_setup(mod, info->debug, info->num_debug);
|
|
|
|
/* Ftrace init must be called in the MODULE_STATE_UNFORMED state */
|
|
ftrace_module_init(mod);
|
|
|
|
/* Finally it's fully formed, ready to start executing. */
|
|
err = complete_formation(mod, info);
|
|
if (err)
|
|
goto ddebug_cleanup;
|
|
|
|
err = prepare_coming_module(mod);
|
|
if (err)
|
|
goto bug_cleanup;
|
|
|
|
/* Module is ready to execute: parsing args may do that. */
|
|
after_dashes = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
|
|
-32768, 32767, mod,
|
|
unknown_module_param_cb);
|
|
if (IS_ERR(after_dashes)) {
|
|
err = PTR_ERR(after_dashes);
|
|
goto coming_cleanup;
|
|
} else if (after_dashes) {
|
|
pr_warn("%s: parameters '%s' after `--' ignored\n",
|
|
mod->name, after_dashes);
|
|
}
|
|
|
|
/* Link in to sysfs. */
|
|
err = mod_sysfs_setup(mod, info, mod->kp, mod->num_kp);
|
|
if (err < 0)
|
|
goto coming_cleanup;
|
|
|
|
if (is_livepatch_module(mod)) {
|
|
err = copy_module_elf(mod, info);
|
|
if (err < 0)
|
|
goto sysfs_cleanup;
|
|
}
|
|
|
|
/* Get rid of temporary copy. */
|
|
free_copy(info);
|
|
|
|
/* Done! */
|
|
trace_module_load(mod);
|
|
|
|
return do_init_module(mod);
|
|
|
|
sysfs_cleanup:
|
|
mod_sysfs_teardown(mod);
|
|
coming_cleanup:
|
|
mod->state = MODULE_STATE_GOING;
|
|
destroy_params(mod->kp, mod->num_kp);
|
|
blocking_notifier_call_chain(&module_notify_list,
|
|
MODULE_STATE_GOING, mod);
|
|
klp_module_going(mod);
|
|
bug_cleanup:
|
|
/* module_bug_cleanup needs module_mutex protection */
|
|
mutex_lock(&module_mutex);
|
|
module_bug_cleanup(mod);
|
|
mutex_unlock(&module_mutex);
|
|
|
|
ddebug_cleanup:
|
|
/* Clean up CFI for the module. */
|
|
cfi_cleanup(mod);
|
|
ftrace_release_mod(mod);
|
|
dynamic_debug_remove(mod, info->debug);
|
|
synchronize_rcu();
|
|
kfree(mod->args);
|
|
free_arch_cleanup:
|
|
module_arch_cleanup(mod);
|
|
free_modinfo:
|
|
free_modinfo(mod);
|
|
free_unload:
|
|
module_unload_free(mod);
|
|
unlink_mod:
|
|
mutex_lock(&module_mutex);
|
|
/* Unlink carefully: kallsyms could be walking list. */
|
|
list_del_rcu(&mod->list);
|
|
mod_tree_remove(mod);
|
|
wake_up_all(&module_wq);
|
|
/* Wait for RCU-sched synchronizing before releasing mod->list. */
|
|
synchronize_rcu();
|
|
mutex_unlock(&module_mutex);
|
|
free_module:
|
|
/* Free lock-classes; relies on the preceding sync_rcu() */
|
|
lockdep_free_key_range(mod->core_layout.base, mod->core_layout.size);
|
|
|
|
module_deallocate(mod, info);
|
|
free_copy:
|
|
free_copy(info);
|
|
return err;
|
|
}
|
|
|
|
SYSCALL_DEFINE3(init_module, void __user *, umod,
|
|
unsigned long, len, const char __user *, uargs)
|
|
{
|
|
int err;
|
|
struct load_info info = { };
|
|
|
|
err = may_init_module();
|
|
if (err)
|
|
return err;
|
|
|
|
pr_debug("init_module: umod=%p, len=%lu, uargs=%p\n",
|
|
umod, len, uargs);
|
|
|
|
err = copy_module_from_user(umod, len, &info);
|
|
if (err)
|
|
return err;
|
|
|
|
return load_module(&info, uargs, 0);
|
|
}
|
|
|
|
SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
|
|
{
|
|
struct load_info info = { };
|
|
loff_t size;
|
|
void *hdr;
|
|
int err;
|
|
|
|
err = may_init_module();
|
|
if (err)
|
|
return err;
|
|
|
|
pr_debug("finit_module: fd=%d, uargs=%p, flags=%i\n", fd, uargs, flags);
|
|
|
|
if (flags & ~(MODULE_INIT_IGNORE_MODVERSIONS
|
|
|MODULE_INIT_IGNORE_VERMAGIC))
|
|
return -EINVAL;
|
|
|
|
err = kernel_read_file_from_fd(fd, &hdr, &size, INT_MAX,
|
|
READING_MODULE);
|
|
if (err)
|
|
return err;
|
|
info.hdr = hdr;
|
|
info.len = size;
|
|
|
|
return load_module(&info, uargs, flags);
|
|
}
|
|
|
|
static inline int within(unsigned long addr, void *start, unsigned long size)
|
|
{
|
|
return ((void *)addr >= start && (void *)addr < start + size);
|
|
}
|
|
|
|
#ifdef CONFIG_KALLSYMS
|
|
/*
|
|
* This ignores the intensely annoying "mapping symbols" found
|
|
* in ARM ELF files: $a, $t and $d.
|
|
*/
|
|
static inline int is_arm_mapping_symbol(const char *str)
|
|
{
|
|
if (str[0] == '.' && str[1] == 'L')
|
|
return true;
|
|
return str[0] == '$' && strchr("axtd", str[1])
|
|
&& (str[2] == '\0' || str[2] == '.');
|
|
}
|
|
|
|
static const char *kallsyms_symbol_name(struct mod_kallsyms *kallsyms, unsigned int symnum)
|
|
{
|
|
return kallsyms->strtab + kallsyms->symtab[symnum].st_name;
|
|
}
|
|
|
|
/*
|
|
* Given a module and address, find the corresponding symbol and return its name
|
|
* while providing its size and offset if needed.
|
|
*/
|
|
static const char *find_kallsyms_symbol(struct module *mod,
|
|
unsigned long addr,
|
|
unsigned long *size,
|
|
unsigned long *offset)
|
|
{
|
|
unsigned int i, best = 0;
|
|
unsigned long nextval, bestval;
|
|
struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
|
|
|
|
/* At worse, next value is at end of module */
|
|
if (within_module_init(addr, mod))
|
|
nextval = (unsigned long)mod->init_layout.base+mod->init_layout.text_size;
|
|
else
|
|
nextval = (unsigned long)mod->core_layout.base+mod->core_layout.text_size;
|
|
|
|
bestval = kallsyms_symbol_value(&kallsyms->symtab[best]);
|
|
|
|
/* Scan for closest preceding symbol, and next symbol. (ELF
|
|
starts real symbols at 1). */
|
|
for (i = 1; i < kallsyms->num_symtab; i++) {
|
|
const Elf_Sym *sym = &kallsyms->symtab[i];
|
|
unsigned long thisval = kallsyms_symbol_value(sym);
|
|
|
|
if (sym->st_shndx == SHN_UNDEF)
|
|
continue;
|
|
|
|
/* We ignore unnamed symbols: they're uninformative
|
|
* and inserted at a whim. */
|
|
if (*kallsyms_symbol_name(kallsyms, i) == '\0'
|
|
|| is_arm_mapping_symbol(kallsyms_symbol_name(kallsyms, i)))
|
|
continue;
|
|
|
|
if (thisval <= addr && thisval > bestval) {
|
|
best = i;
|
|
bestval = thisval;
|
|
}
|
|
if (thisval > addr && thisval < nextval)
|
|
nextval = thisval;
|
|
}
|
|
|
|
if (!best)
|
|
return NULL;
|
|
|
|
if (size)
|
|
*size = nextval - bestval;
|
|
if (offset)
|
|
*offset = addr - bestval;
|
|
|
|
return kallsyms_symbol_name(kallsyms, best);
|
|
}
|
|
|
|
void * __weak dereference_module_function_descriptor(struct module *mod,
|
|
void *ptr)
|
|
{
|
|
return ptr;
|
|
}
|
|
|
|
/* For kallsyms to ask for address resolution. NULL means not found. Careful
|
|
* not to lock to avoid deadlock on oopses, simply disable preemption. */
|
|
const char *module_address_lookup(unsigned long addr,
|
|
unsigned long *size,
|
|
unsigned long *offset,
|
|
char **modname,
|
|
char *namebuf)
|
|
{
|
|
const char *ret = NULL;
|
|
struct module *mod;
|
|
|
|
preempt_disable();
|
|
mod = __module_address(addr);
|
|
if (mod) {
|
|
if (modname)
|
|
*modname = mod->name;
|
|
|
|
ret = find_kallsyms_symbol(mod, addr, size, offset);
|
|
}
|
|
/* Make a copy in here where it's safe */
|
|
if (ret) {
|
|
strncpy(namebuf, ret, KSYM_NAME_LEN - 1);
|
|
ret = namebuf;
|
|
}
|
|
preempt_enable();
|
|
|
|
return ret;
|
|
}
|
|
|
|
int lookup_module_symbol_name(unsigned long addr, char *symname)
|
|
{
|
|
struct module *mod;
|
|
|
|
preempt_disable();
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
if (within_module(addr, mod)) {
|
|
const char *sym;
|
|
|
|
sym = find_kallsyms_symbol(mod, addr, NULL, NULL);
|
|
if (!sym)
|
|
goto out;
|
|
|
|
strlcpy(symname, sym, KSYM_NAME_LEN);
|
|
preempt_enable();
|
|
return 0;
|
|
}
|
|
}
|
|
out:
|
|
preempt_enable();
|
|
return -ERANGE;
|
|
}
|
|
|
|
int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
|
|
unsigned long *offset, char *modname, char *name)
|
|
{
|
|
struct module *mod;
|
|
|
|
preempt_disable();
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
if (within_module(addr, mod)) {
|
|
const char *sym;
|
|
|
|
sym = find_kallsyms_symbol(mod, addr, size, offset);
|
|
if (!sym)
|
|
goto out;
|
|
if (modname)
|
|
strlcpy(modname, mod->name, MODULE_NAME_LEN);
|
|
if (name)
|
|
strlcpy(name, sym, KSYM_NAME_LEN);
|
|
preempt_enable();
|
|
return 0;
|
|
}
|
|
}
|
|
out:
|
|
preempt_enable();
|
|
return -ERANGE;
|
|
}
|
|
|
|
int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
|
|
char *name, char *module_name, int *exported)
|
|
{
|
|
struct module *mod;
|
|
|
|
preempt_disable();
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
struct mod_kallsyms *kallsyms;
|
|
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
kallsyms = rcu_dereference_sched(mod->kallsyms);
|
|
if (symnum < kallsyms->num_symtab) {
|
|
const Elf_Sym *sym = &kallsyms->symtab[symnum];
|
|
|
|
*value = kallsyms_symbol_value(sym);
|
|
*type = kallsyms->typetab[symnum];
|
|
strlcpy(name, kallsyms_symbol_name(kallsyms, symnum), KSYM_NAME_LEN);
|
|
strlcpy(module_name, mod->name, MODULE_NAME_LEN);
|
|
*exported = is_exported(name, *value, mod);
|
|
preempt_enable();
|
|
return 0;
|
|
}
|
|
symnum -= kallsyms->num_symtab;
|
|
}
|
|
preempt_enable();
|
|
return -ERANGE;
|
|
}
|
|
|
|
/* Given a module and name of symbol, find and return the symbol's value */
|
|
static unsigned long find_kallsyms_symbol_value(struct module *mod, const char *name)
|
|
{
|
|
unsigned int i;
|
|
struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms);
|
|
|
|
for (i = 0; i < kallsyms->num_symtab; i++) {
|
|
const Elf_Sym *sym = &kallsyms->symtab[i];
|
|
|
|
if (strcmp(name, kallsyms_symbol_name(kallsyms, i)) == 0 &&
|
|
sym->st_shndx != SHN_UNDEF)
|
|
return kallsyms_symbol_value(sym);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/* Look for this name: can be of form module:name. */
|
|
unsigned long module_kallsyms_lookup_name(const char *name)
|
|
{
|
|
struct module *mod;
|
|
char *colon;
|
|
unsigned long ret = 0;
|
|
|
|
/* Don't lock: we're in enough trouble already. */
|
|
preempt_disable();
|
|
if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) {
|
|
if ((mod = find_module_all(name, colon - name, false)) != NULL)
|
|
ret = find_kallsyms_symbol_value(mod, colon+1);
|
|
} else {
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
if ((ret = find_kallsyms_symbol_value(mod, name)) != 0)
|
|
break;
|
|
}
|
|
}
|
|
preempt_enable();
|
|
return ret;
|
|
}
|
|
|
|
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
|
struct module *, unsigned long),
|
|
void *data)
|
|
{
|
|
struct module *mod;
|
|
unsigned int i;
|
|
int ret;
|
|
|
|
module_assert_mutex();
|
|
|
|
list_for_each_entry(mod, &modules, list) {
|
|
/* We hold module_mutex: no need for rcu_dereference_sched */
|
|
struct mod_kallsyms *kallsyms = mod->kallsyms;
|
|
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
for (i = 0; i < kallsyms->num_symtab; i++) {
|
|
const Elf_Sym *sym = &kallsyms->symtab[i];
|
|
|
|
if (sym->st_shndx == SHN_UNDEF)
|
|
continue;
|
|
|
|
ret = fn(data, kallsyms_symbol_name(kallsyms, i),
|
|
mod, kallsyms_symbol_value(sym));
|
|
if (ret != 0)
|
|
return ret;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
#endif /* CONFIG_KALLSYMS */
|
|
|
|
static void cfi_init(struct module *mod)
|
|
{
|
|
#ifdef CONFIG_CFI_CLANG
|
|
rcu_read_lock_sched();
|
|
mod->cfi_check = (cfi_check_fn)find_kallsyms_symbol_value(mod,
|
|
CFI_CHECK_FN_NAME);
|
|
rcu_read_unlock_sched();
|
|
cfi_module_add(mod, module_addr_min, module_addr_max);
|
|
#endif
|
|
}
|
|
|
|
static void cfi_cleanup(struct module *mod)
|
|
{
|
|
#ifdef CONFIG_CFI_CLANG
|
|
cfi_module_remove(mod, module_addr_min, module_addr_max);
|
|
#endif
|
|
}
|
|
|
|
/* Maximum number of characters written by module_flags() */
|
|
#define MODULE_FLAGS_BUF_SIZE (TAINT_FLAGS_COUNT + 4)
|
|
|
|
/* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */
|
|
static char *module_flags(struct module *mod, char *buf)
|
|
{
|
|
int bx = 0;
|
|
|
|
BUG_ON(mod->state == MODULE_STATE_UNFORMED);
|
|
if (mod->taints ||
|
|
mod->state == MODULE_STATE_GOING ||
|
|
mod->state == MODULE_STATE_COMING) {
|
|
buf[bx++] = '(';
|
|
bx += module_flags_taint(mod, buf + bx);
|
|
/* Show a - for module-is-being-unloaded */
|
|
if (mod->state == MODULE_STATE_GOING)
|
|
buf[bx++] = '-';
|
|
/* Show a + for module-is-being-loaded */
|
|
if (mod->state == MODULE_STATE_COMING)
|
|
buf[bx++] = '+';
|
|
buf[bx++] = ')';
|
|
}
|
|
buf[bx] = '\0';
|
|
|
|
return buf;
|
|
}
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
/* Called by the /proc file system to return a list of modules. */
|
|
static void *m_start(struct seq_file *m, loff_t *pos)
|
|
{
|
|
mutex_lock(&module_mutex);
|
|
return seq_list_start(&modules, *pos);
|
|
}
|
|
|
|
static void *m_next(struct seq_file *m, void *p, loff_t *pos)
|
|
{
|
|
return seq_list_next(p, &modules, pos);
|
|
}
|
|
|
|
static void m_stop(struct seq_file *m, void *p)
|
|
{
|
|
mutex_unlock(&module_mutex);
|
|
}
|
|
|
|
static int m_show(struct seq_file *m, void *p)
|
|
{
|
|
struct module *mod = list_entry(p, struct module, list);
|
|
char buf[MODULE_FLAGS_BUF_SIZE];
|
|
void *value;
|
|
|
|
/* We always ignore unformed modules. */
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
return 0;
|
|
|
|
seq_printf(m, "%s %u",
|
|
mod->name, mod->init_layout.size + mod->core_layout.size);
|
|
print_unload_info(m, mod);
|
|
|
|
/* Informative for users. */
|
|
seq_printf(m, " %s",
|
|
mod->state == MODULE_STATE_GOING ? "Unloading" :
|
|
mod->state == MODULE_STATE_COMING ? "Loading" :
|
|
"Live");
|
|
/* Used by oprofile and other similar tools. */
|
|
value = m->private ? NULL : mod->core_layout.base;
|
|
seq_printf(m, " 0x%px", value);
|
|
|
|
/* Taints info */
|
|
if (mod->taints)
|
|
seq_printf(m, " %s", module_flags(mod, buf));
|
|
|
|
seq_puts(m, "\n");
|
|
return 0;
|
|
}
|
|
|
|
/* Format: modulename size refcount deps address
|
|
|
|
Where refcount is a number or -, and deps is a comma-separated list
|
|
of depends or -.
|
|
*/
|
|
static const struct seq_operations modules_op = {
|
|
.start = m_start,
|
|
.next = m_next,
|
|
.stop = m_stop,
|
|
.show = m_show
|
|
};
|
|
|
|
/*
|
|
* This also sets the "private" pointer to non-NULL if the
|
|
* kernel pointers should be hidden (so you can just test
|
|
* "m->private" to see if you should keep the values private).
|
|
*
|
|
* We use the same logic as for /proc/kallsyms.
|
|
*/
|
|
static int modules_open(struct inode *inode, struct file *file)
|
|
{
|
|
int err = seq_open(file, &modules_op);
|
|
|
|
if (!err) {
|
|
struct seq_file *m = file->private_data;
|
|
m->private = kallsyms_show_value(file->f_cred) ? NULL : (void *)8ul;
|
|
}
|
|
|
|
return err;
|
|
}
|
|
|
|
static const struct file_operations proc_modules_operations = {
|
|
.open = modules_open,
|
|
.read = seq_read,
|
|
.llseek = seq_lseek,
|
|
.release = seq_release,
|
|
};
|
|
|
|
static int __init proc_modules_init(void)
|
|
{
|
|
proc_create("modules", 0, NULL, &proc_modules_operations);
|
|
return 0;
|
|
}
|
|
module_init(proc_modules_init);
|
|
#endif
|
|
|
|
/* Given an address, look for it in the module exception tables. */
|
|
const struct exception_table_entry *search_module_extables(unsigned long addr)
|
|
{
|
|
const struct exception_table_entry *e = NULL;
|
|
struct module *mod;
|
|
|
|
preempt_disable();
|
|
mod = __module_address(addr);
|
|
if (!mod)
|
|
goto out;
|
|
|
|
if (!mod->num_exentries)
|
|
goto out;
|
|
|
|
e = search_extable(mod->extable,
|
|
mod->num_exentries,
|
|
addr);
|
|
out:
|
|
preempt_enable();
|
|
|
|
/*
|
|
* Now, if we found one, we are running inside it now, hence
|
|
* we cannot unload the module, hence no refcnt needed.
|
|
*/
|
|
return e;
|
|
}
|
|
|
|
/*
|
|
* is_module_address - is this address inside a module?
|
|
* @addr: the address to check.
|
|
*
|
|
* See is_module_text_address() if you simply want to see if the address
|
|
* is code (not data).
|
|
*/
|
|
bool is_module_address(unsigned long addr)
|
|
{
|
|
bool ret;
|
|
|
|
preempt_disable();
|
|
ret = __module_address(addr) != NULL;
|
|
preempt_enable();
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* __module_address - get the module which contains an address.
|
|
* @addr: the address.
|
|
*
|
|
* Must be called with preempt disabled or module mutex held so that
|
|
* module doesn't get freed during this.
|
|
*/
|
|
struct module *__module_address(unsigned long addr)
|
|
{
|
|
struct module *mod;
|
|
|
|
if (addr < module_addr_min || addr > module_addr_max)
|
|
return NULL;
|
|
|
|
module_assert_mutex_or_preempt();
|
|
|
|
mod = mod_find(addr);
|
|
if (mod) {
|
|
BUG_ON(!within_module(addr, mod));
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
mod = NULL;
|
|
}
|
|
return mod;
|
|
}
|
|
|
|
/*
|
|
* is_module_text_address - is this address inside module code?
|
|
* @addr: the address to check.
|
|
*
|
|
* See is_module_address() if you simply want to see if the address is
|
|
* anywhere in a module. See kernel_text_address() for testing if an
|
|
* address corresponds to kernel or module code.
|
|
*/
|
|
bool is_module_text_address(unsigned long addr)
|
|
{
|
|
bool ret;
|
|
|
|
preempt_disable();
|
|
ret = __module_text_address(addr) != NULL;
|
|
preempt_enable();
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* __module_text_address - get the module whose code contains an address.
|
|
* @addr: the address.
|
|
*
|
|
* Must be called with preempt disabled or module mutex held so that
|
|
* module doesn't get freed during this.
|
|
*/
|
|
struct module *__module_text_address(unsigned long addr)
|
|
{
|
|
struct module *mod = __module_address(addr);
|
|
if (mod) {
|
|
/* Make sure it's within the text section. */
|
|
if (!within(addr, mod->init_layout.base, mod->init_layout.text_size)
|
|
&& !within(addr, mod->core_layout.base, mod->core_layout.text_size))
|
|
mod = NULL;
|
|
}
|
|
return mod;
|
|
}
|
|
|
|
/* Don't grab lock, we're oopsing. */
|
|
void print_modules(void)
|
|
{
|
|
struct module *mod;
|
|
char buf[MODULE_FLAGS_BUF_SIZE];
|
|
|
|
printk(KERN_DEFAULT "Modules linked in:");
|
|
/* Most callers should already have preempt disabled, but make sure */
|
|
preempt_disable();
|
|
list_for_each_entry_rcu(mod, &modules, list) {
|
|
if (mod->state == MODULE_STATE_UNFORMED)
|
|
continue;
|
|
pr_cont(" %s%s", mod->name, module_flags(mod, buf));
|
|
}
|
|
preempt_enable();
|
|
if (last_unloaded_module[0])
|
|
pr_cont(" [last unloaded: %s]", last_unloaded_module);
|
|
pr_cont("\n");
|
|
}
|
|
|
|
#ifdef CONFIG_MODVERSIONS
|
|
/* Generate the signature for all relevant module structures here.
|
|
* If these change, we don't want to try to parse the module. */
|
|
void module_layout(struct module *mod,
|
|
struct modversion_info *ver,
|
|
struct kernel_param *kp,
|
|
struct kernel_symbol *ks,
|
|
struct tracepoint * const *tp)
|
|
{
|
|
}
|
|
EXPORT_SYMBOL(module_layout);
|
|
#endif
|