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.14-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.14 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 @@ -271,12 +271,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.14/rdma-i40iw-avoid-panic-when-reading-back-the-irq-affinity-hint.patch queue-4.14/usb-dwc3-gadget-fix-start_transfer-link-state-check.patch queue-4.14/md-raid1-properly-indicate-failure-when-ending-a-failed-write-request.patch queue-4.14/usb-core-hub-fix-race-condition-about-trsmrcy-of-resume.patch queue-4.14/usb-xhci-fix-port-minor-revision.patch queue-4.14/hsr-use-netdev_err-instead-of-warn_once.patch queue-4.14/usb-gadget-udc-fix-wrong-pointer-passed-to-is_err-an.patch queue-4.14/media-dvbdev-fix-memory-leak-in-dvb_media_device_free.patch queue-4.14/modules-unexport-__module_address.patch queue-4.14/ext4-fix-error-code-in-ext4_commit_super.patch queue-4.14/fotg210-udc-fix-dma-on-ep0-for-length-max-packet-siz.patch queue-4.14/modules-mark-find_symbol-static.patch queue-4.14/net-usb-ax88179_178a-initialize-local-variables-before-use.patch queue-4.14/powerpc-64s-fix-crashes-when-toggling-stf-barrier.patch queue-4.14/mips-reinstate-platform-__div64_32-handler.patch queue-4.14/usb-gadget-pch_udc-check-for-dma-mapping-error.patch queue-4.14/arm64-dts-mt8173-fix-property-typo-of-phys-in-dsi-node.patch queue-4.14/mips-cpu-features.h-replace-__mips_isa_rev-with-mips_isa_rev.patch queue-4.14/acpi-x86-call-acpi_boot_table_init-after-acpi_table_upgrade.patch queue-4.14/posix-timers-preserve-return-value-in-clock_adjtime32.patch queue-4.14/ipw2x00-potential-buffer-overflow-in-libipw_wx_set_encodeext.patch queue-4.14/usb-typec-tcpci-check-role_control-while-interpretin.patch queue-4.14/fddi-defxx-bail-out-gracefully-with-unassigned-pci-resource-for-csr.patch queue-4.14/modules-return-licensing-information-from-find_symbol.patch queue-4.14/usb-dwc3-omap-improve-extcon-initialization.patch queue-4.14/serial-stm32-fix-incorrect-characters-on-console.patch queue-4.14/sctp-delay-auto_asconf-init-until-binding-the-first-addr.patch queue-4.14/tpm-fix-error-return-code-in-tpm2_get_cc_attrs_tbl.patch queue-4.14/usbip-vudc-synchronize-sysfs-code-paths.patch queue-4.14/tracing-restructure-trace_clock_global-to-never-block.patch queue-4.14/usb-xhci-increase-timeout-for-hc-halt.patch queue-4.14/s390-disassembler-increase-ebpf-disasm-buffer-size.patch queue-4.14/ecryptfs-fix-kernel-panic-with-null-dev_name.patch queue-4.14/revert-337f13046ff0-futex-allow-futex_clock_realtime-with-futex_wait-op.patch queue-4.14/usb-gadget-pch_udc-check-if-driver-is-present-before.patch queue-4.14/bluetooth-verify-amp-hci_chan-before-amp_destroy.patch queue-4.14/usb-fotg210-hcd-fix-an-error-message.patch queue-4.14/dm-rq-fix-double-free-of-blk_mq_tag_set-in-dev-remove-after-table-load-fails.patch queue-4.14/usb-gadget-pch_udc-revert-d3cb25a12138-completely.patch queue-4.14/staging-greybus-uart-fix-unprivileged-tioccserial.patch queue-4.14/squashfs-fix-divide-error-in-calculate_skip.patch queue-4.14/modules-inherit-taint_proprietary_module.patch queue-4.14/usb-cdc-acm-fix-unprivileged-tioccserial.patch queue-4.14/mips-avoid-handcoded-divu-in-__div64_32-altogether.patch queue-4.14/fotg210-udc-complete-out-requests-on-short-packets.patch queue-4.14/powerpc-64s-fix-crashes-when-toggling-entry-flush-barrier.patch queue-4.14/alsa-hda-realtek-re-order-alc269-sony-quirk-table-entries.patch queue-4.14/usb-gadget-dummy_hcd-fix-gpf-in-gadget_setup.patch queue-4.14/misc-vmw_vmci-explicitly-initialize-vmci_datagram-payload.patch queue-4.14/dm-space-map-common-fix-division-bug-in-sm_ll_find_free_block.patch queue-4.14/smp-fix-smp_call_function_single_async-prototype.patch queue-4.14/alsa-emu8000-fix-a-use-after-free-in-snd_emu8000_create_mixer.patch queue-4.14/alsa-hda-realtek-re-order-alc269-lenovo-quirk-table-entries.patch queue-4.14/acpi-tables-x86-reserve-memory-occupied-by-acpi-tables.patch queue-4.14/modules-mark-ref_module-static.patch queue-4.14/fix-misc-new-gcc-warnings.patch queue-4.14/staging-rtl8192u-fix-potential-infinite-loop.patch queue-4.14/usb-add-lpm-quirk-for-lenovo-thinkpad-usb-c-dock-gen2-ethernet.patch queue-4.14/intel_th-pci-add-alder-lake-m-support.patch queue-4.14/platform-x86-thinkpad_acpi-correct-thermal-sensor-allocation.patch queue-4.14/drm-radeon-dpm-disable-sclk-switching-on-oland-when-two-4k-60hz-monitors-are-connected.patch queue-4.14/tty-fix-return-value-for-unsupported-ioctls.patch queue-4.14/thermal-core-fair-share-lock-the-thermal-zone-while-looping-over-instances.patch queue-4.14/tracing-map-all-pids-to-command-lines.patch queue-4.14/usb-gadget-fix-double-free-of-device-descriptor-pointers.patch queue-4.14/fotg210-udc-fix-ep0-in-requests-bigger-than-two-pack.patch queue-4.14/kvm-s390-split-kvm_s390_real_to_abs.patch queue-4.14/fddi-defxx-make-mmio-the-configuration-default-except-for-eisa.patch queue-4.14/x86-cpu-initialize-msr_tsc_aux-if-rdtscp-or-rdpid-is-supported.patch queue-4.14/mips-introduce-isa-rev.h-to-define-mips_isa_rev.patch queue-4.14/iwlwifi-fix-softirq-hardirq-disabling-in-iwl_pcie_enqueue_hcmd.patch queue-4.14/ttyprintk-add-tty-hangup-callback.patch queue-4.14/mips-do-not-include-hi-and-lo-in-clobber-list-for-r6.patch queue-4.14/modules-rename-the-licence-field-in-struct-symsearch-to-license.patch queue-4.14/alsa-hda-realtek-re-order-alc882-sony-quirk-table-entries.patch queue-4.14/mmc-block-update-ext_csd.cache_ctrl-if-it-was-written.patch queue-4.14/fotg210-udc-mask-grp2-interrupts-we-don-t-handle.patch queue-4.14/kvm-s390-split-kvm_s390_logical_to_effective.patch queue-4.14/usb-gadget-r8a66597-add-missing-null-check-on-return.patch queue-4.14/btrfs-fix-metadata-extent-leak-after-failure-to-create-subvolume.patch queue-4.14/serial-stm32-fix-tx_empty-condition.patch queue-4.14/staging-wimax-i2400m-fix-byte-order-issue.patch queue-4.14/powerpc-eeh-fix-eeh-handling-for-hugepages-in-ioremap-space.patch queue-4.14/revert-fdt-properly-handle-no-map-field-in-the-memory-region.patch queue-4.14/md-factor-out-a-mddev_find_locked-helper-from-mddev_find.patch queue-4.14/usb-dwc2-fix-gadget-dma-unmap-direction.patch queue-4.14/iio-tsl2583-fix-division-by-a-zero-lux_val.patch queue-4.14/bpf-fix-backport-of-bpf-restrict-unknown-scalars-of-mixed-signed-bounds-for-unprivileged.patch queue-4.14/mmc-core-set-read-only-for-sd-cards-with-permanent-write-protect-bit.patch queue-4.14/alsa-usb-audio-add-midi-quirk-for-vox-tonelab-ex.patch queue-4.14/modules-unexport-__module_text_address.patch queue-4.14/revert-net-sctp-fix-race-condition-in-sctp_destroy_sock.patch queue-4.14/iwlwifi-fix-softirq-hardirq-disabling-in-iwl_pcie_gen2_enqueue_hcmd.patch queue-4.14/usb-gadget-f_uac1-validate-input-parameters.patch queue-4.14/firmware-qcom-scm-fix-qcom_scm-configuration.patch queue-4.14/ext4-fix-check-to-prevent-false-positive-report-of-incorrect-used-inodes.patch queue-4.14/modules-mark-each_symbol_section-static.patch queue-4.14/cfg80211-scan-drop-entry-from-hidden_list-on-overflow.patch queue-4.14/iio-gyro-mpu3050-fix-reported-temperature-value.patch queue-4.14/bpf-fix-masking-negation-logic-upon-negative-dst-register.patch queue-4.14/mips-avoid-divu-in-__div64_32-is-result-would-be-zero.patch queue-4.14/cifs-return-correct-error-code-from-smb2_get_enc_key.patch queue-4.14/spi-spi-ti-qspi-free-dma-resources.patch queue-4.14/nfsv4-don-t-discard-segments-marked-for-return-in-_pnfs_return_layout.patch queue-4.14/usb-gadget-uvc-add-binterval-checking-for-hs-mode.patch queue-4.14/mmc-core-do-a-power-cycle-when-the-cmd11-fails.patch queue-4.14/kvm-s390-fix-guarded-storage-control-register-handling.patch queue-4.14/openvswitch-fix-stack-oob-read-while-fragmenting-ipv4-packets.patch queue-4.14/md-cluster-fix-use-after-free-issue-when-removing-rdev.patch queue-4.14/mtd-require-write-permissions-for-locking-and-badblo.patch queue-4.14/security-commoncap-fix-wstringop-overread-warning.patch queue-4.14/fotg210-udc-don-t-dma-more-than-the-buffer-can-take.patch queue-4.14/tty-actually-undefine-superseded-async-flags.patch queue-4.14/usb-dwc3-gadget-ignore-ep-queue-requests-during-bus-.patch queue-4.14/fotg210-udc-remove-a-dubious-condition-leading-to-fo.patch queue-4.14/acpi-gtdt-don-t-corrupt-interrupt-mappings-on-watchdow-probe-failure.patch queue-4.14/jffs2-check-the-validity-of-dstlen-in-jffs2_zlib_compress.patch queue-4.14/bpf-fix-up-selftests-after-backports-were-fixed.patch queue-4.14/jffs2-fix-kasan-slab-out-of-bounds-problem.patch queue-4.14/net-nfc-fix-use-after-free-llcp_sock_bind-connect.patch queue-4.14/fbdev-zero-fill-colormap-in-fbcmap.c.patch queue-4.14/ftrace-handle-commands-when-closing-set_ftrace_filter-file.patch queue-4.14/drm-radeon-fix-copy-of-uninitialized-variable-back-to-userspace.patch queue-4.14/powerpc-fix-edeadlock-redefinition-error-in-uapi-asm-errno.h.patch queue-4.14/intel_th-consistency-and-off-by-one-fix.patch queue-4.14/kobject_uevent-remove-warning-in-init_uevent_argv.patch queue-4.14/dm-persistent-data-packed-struct-should-have-an-aligned-attribute-too.patch queue-4.14/kvm-x86-cancel-pvclock_gtod_work-on-module-removal.patch queue-4.14/misc-vmw_vmci-explicitly-initialize-vmci_notify_bm_set_msg-struct.patch queue-4.14/bluetooth-eliminate-the-potential-race-condition-when-removing-the-hci-controller.patch queue-4.14/acpi-custom_method-fix-a-possible-memory-leak.patch queue-4.14/acpi-custom_method-fix-potential-use-after-free-issue.patch queue-4.14/arc-entry-fix-off-by-one-error-in-syscall-number-validation.patch queue-4.14/md-md_open-returns-ebusy-when-entering-racing-area.patch queue-4.14/alsa-sb-fix-two-use-after-free-in-snd_sb_qsound_build.patch queue-4.14/userfaultfd-release-page-in-error-path-to-avoid-bug_on.patch queue-4.14/mips-pci-rt2880-fix-slot-0-configuration.patch queue-4.14/usb-gadget-function-f_fs-string-table-fix-for-multiple-languages.patch queue-4.14/intel_th-pci-add-rocket-lake-cpu-support.patch queue-4.14/alsa-hda-realtek-remove-redundant-entry-for-alc861-haier-uniwill-devices.patch queue-4.14/alsa-hda-conexant-re-order-cx5066-quirk-table-entries.patch queue-4.14/usb-gadget-pch_udc-replace-cpu_to_le32-by-lower_32_b.patch queue-4.14/alsa-hda-realtek-re-order-alc882-acer-quirk-table-entries.patch queue-4.14/usb-add-reset-resume-quirk-for-wd19-s-realtek-hub.patch queue-4.14/phy-phy-twl4030-usb-fix-possible-use-after-free-in-t.patch queue-4.14/revert-of-fdt-make-sure-no-map-does-not-remove-already-reserved-regions.patch queue-4.14/misc-lis3lv02d-fix-false-positive-warn-on-various-hp-models.patch