Patch "usb: cdc-acm: return correct error code on unsupported break" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    usb: cdc-acm: return correct error code on unsupported break

to the 5.15-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-cdc-acm-return-correct-error-code-on-unsupported.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 8be40c1c0c6e2f5c24b4de1c1cb8b27b8d7ea3df
Author: Oliver Neukum <oneukum@xxxxxxxx>
Date:   Thu Dec 7 14:26:30 2023 +0100

    usb: cdc-acm: return correct error code on unsupported break
    
    [ Upstream commit 66aad7d8d3ec5a3a8ec2023841bcec2ded5f65c9 ]
    
    In ACM support for sending breaks to devices is optional.
    If a device says that it doenot support sending breaks,
    the host must respect that.
    Given the number of optional features providing tty operations
    for each combination is not practical and errors need to be
    returned dynamically if unsupported features are requested.
    
    In case a device does not support break, we want the tty layer
    to treat that like it treats drivers that statically cannot
    support sending a break. It ignores the inability and does nothing.
    This patch uses EOPNOTSUPP to indicate that.
    
    Signed-off-by: Oliver Neukum <oneukum@xxxxxxxx>
    Fixes: 9e98966c7bb94 ("tty: rework break handling")
    Link: https://lore.kernel.org/r/20231207132639.18250-1-oneukum@xxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 82b49aa0f9de..d5191065b6e9 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2514,6 +2514,9 @@ static int send_break(struct tty_struct *tty, unsigned int duration)
 	if (!retval) {
 		msleep_interruptible(duration);
 		retval = tty->ops->break_ctl(tty, 0);
+	} else if (retval == -EOPNOTSUPP) {
+		/* some drivers can tell only dynamically */
+		retval = 0;
 	}
 	tty_write_unlock(tty);
 
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index adc154b691d0..f21fd809e44f 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -896,6 +896,9 @@ static int acm_tty_break_ctl(struct tty_struct *tty, int state)
 	struct acm *acm = tty->driver_data;
 	int retval;
 
+	if (!(acm->ctrl_caps & USB_CDC_CAP_BRK))
+		return -EOPNOTSUPP;
+
 	retval = acm_send_break(acm, state ? 0xffff : 0);
 	if (retval < 0)
 		dev_dbg(&acm->control->dev,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux