This is a note to let you know that I've just added the patch titled kobject_uevent: remove warning in init_uevent_argv() to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kobject_uevent-remove-warning-in-init_uevent_argv.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b4104180a2efb85f55e1ba1407885c9421970338 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Date: Mon, 5 Apr 2021 11:48:52 +0200 Subject: kobject_uevent: remove warning in init_uevent_argv() From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> commit b4104180a2efb85f55e1ba1407885c9421970338 upstream. syzbot can trigger the WARN() in init_uevent_argv() which isn't the nicest as the code does properly recover and handle the error. So change the WARN() call to pr_warn() and provide some more information on what the buffer size that was needed. Link: https://lore.kernel.org/r/20201107082206.GA19079@xxxxxxxxx Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx> Cc: linux-kernel@xxxxxxxxxxxxxxx Reported-by: syzbot+92340f7b2b4789907fdb@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20210405094852.1348499-1-gregkh@xxxxxxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- lib/kobject_uevent.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -250,12 +250,13 @@ static int kobj_usermode_filter(struct k static int init_uevent_argv(struct kobj_uevent_env *env, const char *subsystem) { + int buffer_size = sizeof(env->buf) - env->buflen; int len; - len = strlcpy(&env->buf[env->buflen], subsystem, - sizeof(env->buf) - env->buflen); - if (len >= (sizeof(env->buf) - env->buflen)) { - WARN(1, KERN_ERR "init_uevent_argv: buffer size too small\n"); + len = strlcpy(&env->buf[env->buflen], subsystem, buffer_size); + if (len >= buffer_size) { + pr_warn("init_uevent_argv: buffer size of %d too small, needed %d\n", + buffer_size, len); return -ENOMEM; } Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-4.19/cdc-wdm-untangle-a-circular-dependency-between-callback-and-softint.patch queue-4.19/md-bitmap-wait-for-external-bitmap-writes-to-complete-during-tear-down.patch queue-4.19/usb-dwc3-gadget-fix-start_transfer-link-state-check.patch queue-4.19/md-raid1-properly-indicate-failure-when-ending-a-failed-write-request.patch queue-4.19/tty-fix-memory-leak-in-vc_deallocate.patch queue-4.19/usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch queue-4.19/usb-xhci-fix-port-minor-revision.patch queue-4.19/hsr-use-netdev_err-instead-of-warn_once.patch queue-4.19/usb-gadget-udc-fix-wrong-pointer-passed-to-is_err-an.patch queue-4.19/media-dvbdev-fix-memory-leak-in-dvb_media_device_free.patch queue-4.19/modules-unexport-__module_address.patch queue-4.19/hfsplus-prevent-corruption-in-shrinking-truncate.patch queue-4.19/ext4-fix-error-code-in-ext4_commit_super.patch queue-4.19/fotg210-udc-fix-dma-on-ep0-for-length-max-packet-siz.patch queue-4.19/modules-mark-find_symbol-static.patch queue-4.19/nfs-don-t-discard-pnfs-layout-segments-that-are-marked-for-return.patch queue-4.19/powerpc-64s-fix-crashes-when-toggling-stf-barrier.patch queue-4.19/mips-reinstate-platform-__div64_32-handler.patch queue-4.19/usb-gadget-pch_udc-check-for-dma-mapping-error.patch queue-4.19/arm64-dts-mt8173-fix-property-typo-of-phys-in-dsi-node.patch queue-4.19/posix-timers-preserve-return-value-in-clock_adjtime32.patch queue-4.19/ipw2x00-potential-buffer-overflow-in-libipw_wx_set_encodeext.patch queue-4.19/usb-typec-tcpci-check-role_control-while-interpretin.patch queue-4.19/fddi-defxx-bail-out-gracefully-with-unassigned-pci-resource-for-csr.patch queue-4.19/modules-return-licensing-information-from-find_symbol.patch queue-4.19/usb-dwc3-omap-improve-extcon-initialization.patch queue-4.19/serial-stm32-fix-incorrect-characters-on-console.patch queue-4.19/f2fs-fix-to-avoid-out-of-bounds-memory-access.patch queue-4.19/sctp-delay-auto_asconf-init-until-binding-the-first-addr.patch queue-4.19/tpm-fix-error-return-code-in-tpm2_get_cc_attrs_tbl.patch queue-4.19/tracing-restructure-trace_clock_global-to-never-block.patch queue-4.19/xhci-fix-potential-array-out-of-bounds-with-several-.patch queue-4.19/ext4-do-not-set-sb_active-in-ext4_orphan_cleanup.patch queue-4.19/alsa-hda-realtek-re-order-alc882-clevo-quirk-table-entries.patch queue-4.19/usb-xhci-increase-timeout-for-hc-halt.patch queue-4.19/alsa-usb-audio-more-constifications.patch queue-4.19/s390-disassembler-increase-ebpf-disasm-buffer-size.patch queue-4.19/ecryptfs-fix-kernel-panic-with-null-dev_name.patch queue-4.19/revert-337f13046ff0-futex-allow-futex_clock_realtime-with-futex_wait-op.patch queue-4.19/usb-gadget-pch_udc-check-if-driver-is-present-before.patch queue-4.19/bluetooth-verify-amp-hci_chan-before-amp_destroy.patch queue-4.19/iio-accel-adis16201-fix-wrong-axis-assignment-that-prevents-loading.patch queue-4.19/usb-fotg210-hcd-fix-an-error-message.patch queue-4.19/erofs-add-unsupported-inode-i_format-check.patch queue-4.19/dm-rq-fix-double-free-of-blk_mq_tag_set-in-dev-remove-after-table-load-fails.patch queue-4.19/usb-gadget-pch_udc-revert-d3cb25a12138-completely.patch queue-4.19/staging-greybus-uart-fix-unprivileged-tioccserial.patch queue-4.19/arm64-dts-marvell-armada-37xx-add-syscon-compatible-to-nb-clk-node.patch queue-4.19/squashfs-fix-divide-error-in-calculate_skip.patch queue-4.19/modules-inherit-taint_proprietary_module.patch queue-4.19/usb-cdc-acm-fix-unprivileged-tioccserial.patch queue-4.19/mips-avoid-handcoded-divu-in-__div64_32-altogether.patch queue-4.19/fotg210-udc-complete-out-requests-on-short-packets.patch queue-4.19/powerpc-64s-fix-crashes-when-toggling-entry-flush-barrier.patch queue-4.19/alsa-hda-realtek-re-order-alc269-sony-quirk-table-entries.patch queue-4.19/mmc-block-issue-a-cache-flush-only-when-it-s-enabled.patch queue-4.19/mips-pci-mt7620-fix-pll-lock-check.patch queue-4.19/usb-gadget-dummy_hcd-fix-gpf-in-gadget_setup.patch queue-4.19/misc-vmw_vmci-explicitly-initialize-vmci_datagram-payload.patch queue-4.19/dm-space-map-common-fix-division-bug-in-sm_ll_find_free_block.patch queue-4.19/smp-fix-smp_call_function_single_async-prototype.patch queue-4.19/alsa-emu8000-fix-a-use-after-free-in-snd_emu8000_create_mixer.patch queue-4.19/alsa-hda-realtek-re-order-alc269-lenovo-quirk-table-entries.patch queue-4.19/modules-mark-ref_module-static.patch queue-4.19/fix-misc-new-gcc-warnings.patch queue-4.19/staging-rtl8192u-fix-potential-infinite-loop.patch queue-4.19/mlxsw-spectrum_mr-update-egress-rif-list-before-route-s-action.patch queue-4.19/alsa-hda-realtek-re-order-alc269-dell-quirk-table-entries.patch queue-4.19/md-fix-missing-unused-status-line-of-proc-mdstat.patch queue-4.19/intel_th-pci-add-alder-lake-m-support.patch queue-4.19/ubifs-only-check-replay-with-inode-type-to-judge-if-inode-linked.patch queue-4.19/drm-radeon-dpm-disable-sclk-switching-on-oland-when-two-4k-60hz-monitors-are-connected.patch queue-4.19/mtd-rawnand-atmel-update-ecc_stats.corrected-counter.patch queue-4.19/usb-dwc2-fix-hibernation-between-host-and-device-mod.patch queue-4.19/usb-dwc2-fix-host-mode-hibernation-exit-with-remote-.patch queue-4.19/tty-fix-return-value-for-unsupported-ioctls.patch queue-4.19/net-only-allow-init-netns-to-set-default-tcp-cong-to-a-restricted-algo.patch queue-4.19/thermal-core-fair-share-lock-the-thermal-zone-while-looping-over-instances.patch queue-4.19/tracing-map-all-pids-to-command-lines.patch queue-4.19/usb-gadget-fix-double-free-of-device-descriptor-pointers.patch queue-4.19/fotg210-udc-fix-ep0-in-requests-bigger-than-two-pack.patch queue-4.19/kvm-s390-split-kvm_s390_real_to_abs.patch queue-4.19/fddi-defxx-make-mmio-the-configuration-default-except-for-eisa.patch queue-4.19/usb-xhci-mtk-support-quirk-to-disable-usb2-lpm.patch queue-4.19/usbip-vudc-fix-missing-unlock-on-error-in-usbip_sock.patch queue-4.19/x86-cpu-initialize-msr_tsc_aux-if-rdtscp-or-rdpid-is-supported.patch queue-4.19/xhci-add-reset-resume-quirk-for-amd-xhci-controller.patch queue-4.19/ttyprintk-add-tty-hangup-callback.patch queue-4.19/modules-rename-the-licence-field-in-struct-symsearch-to-license.patch queue-4.19/alsa-hda-realtek-re-order-alc882-sony-quirk-table-entries.patch queue-4.19/mmc-block-update-ext_csd.cache_ctrl-if-it-was-written.patch queue-4.19/fotg210-udc-mask-grp2-interrupts-we-don-t-handle.patch queue-4.19/kvm-s390-split-kvm_s390_logical_to_effective.patch queue-4.19/mtd-spinand-core-add-missing-module_device_table.patch queue-4.19/usb-gadget-r8a66597-add-missing-null-check-on-return.patch queue-4.19/btrfs-fix-metadata-extent-leak-after-failure-to-create-subvolume.patch queue-4.19/arm-9056-1-decompressor-fix-bss-size-calculation-for-llvm-ld.lld.patch queue-4.19/serial-stm32-fix-tx_empty-condition.patch queue-4.19/staging-wimax-i2400m-fix-byte-order-issue.patch queue-4.19/powerpc-eeh-fix-eeh-handling-for-hugepages-in-ioremap-space.patch queue-4.19/revert-fdt-properly-handle-no-map-field-in-the-memory-region.patch queue-4.19/md-factor-out-a-mddev_find_locked-helper-from-mddev_find.patch queue-4.19/alsa-hda-realtek-re-order-alc269-hp-quirk-table-entries.patch queue-4.19/ovl-fix-missing-revert_creds-on-error-path.patch queue-4.19/arm64-vdso-remove-commas-between-macro-name-and-arguments.patch queue-4.19/usb-dwc2-fix-gadget-dma-unmap-direction.patch queue-4.19/iio-tsl2583-fix-division-by-a-zero-lux_val.patch queue-4.19/scsi-qla2xxx-fix-crash-in-qla2xxx_mqueuecommand.patch queue-4.19/mmc-core-set-read-only-for-sd-cards-with-permanent-write-protect-bit.patch queue-4.19/modules-unexport-__module_text_address.patch queue-4.19/revert-net-sctp-fix-race-condition-in-sctp_destroy_sock.patch queue-4.19/usb-gadget-f_uac1-validate-input-parameters.patch queue-4.19/firmware-qcom-scm-fix-qcom_scm-configuration.patch queue-4.19/ext4-fix-check-to-prevent-false-positive-report-of-incorrect-used-inodes.patch queue-4.19/modules-mark-each_symbol_section-static.patch queue-4.19/usb-dwc3-pci-enable-usb2-gadget-lpm-disable-for-intel-merrifield.patch queue-4.19/cfg80211-scan-drop-entry-from-hidden_list-on-overflow.patch queue-4.19/iio-gyro-mpu3050-fix-reported-temperature-value.patch queue-4.19/alsa-hda-realtek-add-quirk-for-intel-clevo-pcx0dx.patch queue-4.19/usb-dwc3-gadget-return-success-always-for-kick-transfer-in-ep-queue.patch queue-4.19/mips-avoid-divu-in-__div64_32-is-result-would-be-zero.patch queue-4.19/cifs-return-correct-error-code-from-smb2_get_enc_key.patch queue-4.19/spi-spi-ti-qspi-free-dma-resources.patch queue-4.19/nfsv4-don-t-discard-segments-marked-for-return-in-_pnfs_return_layout.patch queue-4.19/usb-dwc2-fix-session-request-interrupt-handler.patch queue-4.19/usb-gadget-uvc-add-binterval-checking-for-hs-mode.patch queue-4.19/mmc-sdhci-pci-fix-initialization-of-some-sd-cards-for-intel-byt-based-controllers.patch queue-4.19/mmc-core-do-a-power-cycle-when-the-cmd11-fails.patch queue-4.19/kvm-s390-fix-guarded-storage-control-register-handling.patch queue-4.19/openvswitch-fix-stack-oob-read-while-fragmenting-ipv4-packets.patch queue-4.19/md-cluster-fix-use-after-free-issue-when-removing-rdev.patch queue-4.19/mtd-require-write-permissions-for-locking-and-badblo.patch queue-4.19/security-commoncap-fix-wstringop-overread-warning.patch queue-4.19/dm-raid-fix-inconclusive-reshape-layout-on-fast-raid4-5-6-table-reload-sequences.patch queue-4.19/fotg210-udc-don-t-dma-more-than-the-buffer-can-take.patch queue-4.19/tty-actually-undefine-superseded-async-flags.patch queue-4.19/usb-dwc3-gadget-ignore-ep-queue-requests-during-bus-.patch queue-4.19/fotg210-udc-remove-a-dubious-condition-leading-to-fo.patch queue-4.19/acpi-gtdt-don-t-corrupt-interrupt-mappings-on-watchdow-probe-failure.patch queue-4.19/xhci-do-not-use-gfp_kernel-in-potentially-atomic-context.patch queue-4.19/jffs2-check-the-validity-of-dstlen-in-jffs2_zlib_compress.patch queue-4.19/jffs2-fix-kasan-slab-out-of-bounds-problem.patch queue-4.19/net-nfc-fix-use-after-free-llcp_sock_bind-connect.patch queue-4.19/fbdev-zero-fill-colormap-in-fbcmap.c.patch queue-4.19/ftrace-handle-commands-when-closing-set_ftrace_filter-file.patch queue-4.19/drm-radeon-fix-copy-of-uninitialized-variable-back-to-userspace.patch queue-4.19/powerpc-fix-edeadlock-redefinition-error-in-uapi-asm-errno.h.patch queue-4.19/intel_th-consistency-and-off-by-one-fix.patch queue-4.19/kobject_uevent-remove-warning-in-init_uevent_argv.patch queue-4.19/xhci-check-control-context-is-valid-before-dereferen.patch queue-4.19/dm-persistent-data-packed-struct-should-have-an-aligned-attribute-too.patch queue-4.19/kvm-x86-cancel-pvclock_gtod_work-on-module-removal.patch queue-4.19/rsi-use-resume_noirq-for-sdio.patch queue-4.19/misc-vmw_vmci-explicitly-initialize-vmci_notify_bm_set_msg-struct.patch queue-4.19/bluetooth-eliminate-the-potential-race-condition-when-removing-the-hci-controller.patch queue-4.19/acpi-custom_method-fix-a-possible-memory-leak.patch queue-4.19/acpi-custom_method-fix-potential-use-after-free-issue.patch queue-4.19/arc-entry-fix-off-by-one-error-in-syscall-number-validation.patch queue-4.19/md-md_open-returns-ebusy-when-entering-racing-area.patch queue-4.19/alsa-sb-fix-two-use-after-free-in-snd_sb_qsound_build.patch queue-4.19/alsa-usb-audio-add-db-range-mapping-for-sennheiser-communications-headset-pc-8.patch queue-4.19/asoc-samsung-tm2_wm5110-check-of-of_parse-return-value.patch queue-4.19/userfaultfd-release-page-in-error-path-to-avoid-bug_on.patch queue-4.19/mips-pci-rt2880-fix-slot-0-configuration.patch queue-4.19/usb-gadget-function-f_fs-string-table-fix-for-multiple-languages.patch queue-4.19/intel_th-pci-add-rocket-lake-cpu-support.patch queue-4.19/alsa-hda-realtek-remove-redundant-entry-for-alc861-haier-uniwill-devices.patch queue-4.19/alsa-hda-conexant-re-order-cx5066-quirk-table-entries.patch queue-4.19/usb-gadget-pch_udc-replace-cpu_to_le32-by-lower_32_b.patch queue-4.19/alsa-hda-realtek-re-order-alc882-acer-quirk-table-entries.patch queue-4.19/phy-phy-twl4030-usb-fix-possible-use-after-free-in-t.patch queue-4.19/revert-of-fdt-make-sure-no-map-does-not-remove-already-reserved-regions.patch queue-4.19/misc-lis3lv02d-fix-false-positive-warn-on-various-hp-models.patch queue-4.19/tpm-vtpm_proxy-avoid-reading-host-log-when-using-a-virtual-device.patch queue-4.19/alsa-usb-audio-explicitly-set-up-the-clock-selector.patch queue-4.19/usb-gadget-aspeed-fix-dma-map-failure.patch