Patch "usb: gadget: f_uac2: fix return value for UAC2_ATTRIBUTE_STRING store" has been added to the 6.6-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: gadget: f_uac2: fix return value for UAC2_ATTRIBUTE_STRING store

to the 6.6-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-gadget-f_uac2-fix-return-value-for-uac2_attribut.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 5a42d949e31f2c7cfeffe28f267f29e590091080
Author: Kevin Groeneveld <kgroeneveld@xxxxxxxxxxxx>
Date:   Sun Oct 6 19:26:31 2024 -0400

    usb: gadget: f_uac2: fix return value for UAC2_ATTRIBUTE_STRING store
    
    [ Upstream commit 9499327714de7bc5cf6c792112c1474932d8ad31 ]
    
    The configfs store callback should return the number of bytes consumed
    not the total number of bytes we actually stored. These could differ if
    for example the passed in string had a newline we did not store.
    
    If the returned value does not match the number of bytes written the
    writer might assume a failure or keep trying to write the remaining bytes.
    
    For example the following command will hang trying to write the final
    newline over and over again (tested on bash 2.05b):
    
      echo foo > function_name
    
    Fixes: 993a44fa85c1 ("usb: gadget: f_uac2: allow changing interface name via configfs")
    Cc: stable <stable@xxxxxxxxxx>
    Signed-off-by: Kevin Groeneveld <kgroeneveld@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241006232637.4267-1-kgroeneveld@xxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 79d1f87c6cc59..b3dc5f5164f42 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -2052,7 +2052,7 @@ static ssize_t f_uac2_opts_##name##_store(struct config_item *item,	\
 					  const char *page, size_t len)	\
 {									\
 	struct f_uac2_opts *opts = to_f_uac2_opts(item);		\
-	int ret = 0;							\
+	int ret = len;							\
 									\
 	mutex_lock(&opts->lock);					\
 	if (opts->refcnt) {						\
@@ -2063,8 +2063,8 @@ static ssize_t f_uac2_opts_##name##_store(struct config_item *item,	\
 	if (len && page[len - 1] == '\n')				\
 		len--;							\
 									\
-	ret = scnprintf(opts->name, min(sizeof(opts->name), len + 1),	\
-			"%s", page);					\
+	scnprintf(opts->name, min(sizeof(opts->name), len + 1),		\
+		  "%s", page);						\
 									\
 end:									\
 	mutex_unlock(&opts->lock);					\




[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