This is a note to let you know that I've just added the patch titled USB: serial: mos7840: fix error code in mos7840_write() to the 5.10-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: usb-serial-mos7840-fix-error-code-in-mos7840_write.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a70aa7dc60099bbdcbd6faca42a915d80f31161e Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Date: Tue, 26 Jan 2021 13:26:54 +0300 Subject: USB: serial: mos7840: fix error code in mos7840_write() From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> commit a70aa7dc60099bbdcbd6faca42a915d80f31161e upstream. This should return -ENOMEM instead of 0 if the kmalloc() fails. Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Johan Hovold <johan@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/serial/mos7840.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -883,8 +883,10 @@ static int mos7840_write(struct tty_stru if (urb->transfer_buffer == NULL) { urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC); - if (!urb->transfer_buffer) + if (!urb->transfer_buffer) { + bytes_sent = -ENOMEM; goto exit; + } } transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); Patches currently in stable-queue which might be from dan.carpenter@xxxxxxxxxx are queue-5.10/media-allegro-fix-use-after-free-on-error.patch queue-5.10/asoc-cs42l56-fix-up-error-handling-in-probe.patch queue-5.10/media-atomisp-fix-a-buffer-overflow-in-debug-code.patch queue-5.10/media-camss-missing-error-code-in-msm_video_register.patch queue-5.10/staging-vchiq-fix-bulk-transfers-on-64-bit-builds.patch queue-5.10/mtd-parser-imagetag-fix-error-codes-in-bcm963xx_pars.patch queue-5.10/asoc-cpcap-fix-microphone-timeslot-mask.patch queue-5.10/drm-amdgpu-prevent-shift-wrapping-in-amdgpu_read_mas.patch queue-5.10/rdma-rtrs-srv-do-not-pass-a-valid-pointer-to-ptr_err.patch queue-5.10/soc-qcom-socinfo-fix-an-off-by-one-in-qcom_show_pmic.patch queue-5.10/gma500-clean-up-error-handling-in-init.patch queue-5.10/input-joydev-prevent-potential-read-overflow-in-ioctl.patch queue-5.10/nvmem-core-fix-a-resource-leak-on-error-in-nvmem_add.patch queue-5.10/input-elo-fix-an-error-code-in-elo_connect.patch queue-5.10/usb-serial-mos7840-fix-error-code-in-mos7840_write.patch queue-5.10/usb-serial-mos7720-fix-error-code-in-mos7720_write.patch queue-5.10/ath11k-fix-a-locking-bug-in-ath11k_mac_op_start.patch queue-5.10/staging-vchiq-fix-bulk-userdata-handling.patch queue-5.10/phy-cadence-torrent-fix-error-code-in-cdns_torrent_p.patch queue-5.10/octeontx2-af-fix-an-off-by-one-in-rvu_dbg_qsize_writ.patch queue-5.10/input-sur40-fix-an-error-code-in-sur40_probe.patch queue-5.10/scsi-lpfc-fix-ancient-double-free.patch queue-5.10/staging-gdm724x-fix-dma-from-stack.patch queue-5.10/mfd-wm831x-auxadc-prevent-use-after-free-in-wm831x_a.patch queue-5.10/ocfs2-fix-a-use-after-free-on-error.patch queue-5.10/scsi-sd-sd_zbc-don-t-pass-gfp_noio-to-kvcalloc.patch