From: Greg Kroah-Hartman Date: Tue, 28 Mar 2023 11:48:39 +0000 (+0200) Subject: 6.1-stable patches X-Git-Tag: v5.15.105~36 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7930eda2fa192866e62ff20cd4f73e40b7920fc6;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: cifs-append-path-to-open_enter-trace-event.patch cifs-do-not-poll-server-interfaces-too-regularly.patch cifs-dump-pending-mids-for-all-channels-in-debugdata.patch cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch cifs-fix-dentry-lookups-in-directory-handle-cache.patch cifs-lock-chan_lock-outside-match_session.patch cifs-print-session-id-while-listing-open-files.patch scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch selftests-x86-amx-add-a-ptrace-test.patch usb-dwc2-drd-fix-inconsistent-mode-if-role-switch-default-mode-host.patch usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch usb-misc-onboard-hub-add-support-for-microchip-usb2517-usb-2.0-hub.patch x86-fpu-xstate-prevent-false-positive-warning-in-__copy_xstate_uabi_buf.patch --- diff --git a/queue-6.1/cifs-append-path-to-open_enter-trace-event.patch b/queue-6.1/cifs-append-path-to-open_enter-trace-event.patch new file mode 100644 index 00000000000..e9eb2bedd9c --- /dev/null +++ b/queue-6.1/cifs-append-path-to-open_enter-trace-event.patch @@ -0,0 +1,226 @@ +From fddc6ccc487e5de07b98df8d04118d5dcb5e0407 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Fri, 17 Mar 2023 12:51:17 +0000 +Subject: cifs: append path to open_enter trace event + +From: Shyam Prasad N + +commit fddc6ccc487e5de07b98df8d04118d5dcb5e0407 upstream. + +We do not dump the file path for smb3_open_enter ftrace +calls, which is a severe handicap while debugging +using ftrace evens. This change adds that info. + +Unfortunately, we're not updating the path in open params +in many places; which I had to do as a part of this change. +SMB2_open gets path in utf16 format, but it's easier of +path is supplied as char pointer in oparms. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/cached_dir.c | 1 + + fs/cifs/link.c | 2 ++ + fs/cifs/smb2inode.c | 1 + + fs/cifs/smb2ops.c | 11 +++++++++++ + fs/cifs/smb2pdu.c | 4 ++-- + fs/cifs/trace.h | 12 ++++++++---- + 6 files changed, 25 insertions(+), 6 deletions(-) + +--- a/fs/cifs/cached_dir.c ++++ b/fs/cifs/cached_dir.c +@@ -184,6 +184,7 @@ int open_cached_dir(unsigned int xid, st + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = path, + .create_options = cifs_create_options(cifs_sb, CREATE_NOT_FILE), + .desired_access = FILE_READ_ATTRIBUTES, + .disposition = FILE_OPEN, +--- a/fs/cifs/link.c ++++ b/fs/cifs/link.c +@@ -360,6 +360,7 @@ smb3_query_mf_symlink(unsigned int xid, + oparms = (struct cifs_open_parms) { + .tcon = tcon, + .cifs_sb = cifs_sb, ++ .path = path, + .desired_access = GENERIC_READ, + .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), + .disposition = FILE_OPEN, +@@ -427,6 +428,7 @@ smb3_create_mf_symlink(unsigned int xid, + oparms = (struct cifs_open_parms) { + .tcon = tcon, + .cifs_sb = cifs_sb, ++ .path = path, + .desired_access = GENERIC_WRITE, + .create_options = cifs_create_options(cifs_sb, CREATE_NOT_DIR), + .disposition = FILE_CREATE, +--- a/fs/cifs/smb2inode.c ++++ b/fs/cifs/smb2inode.c +@@ -106,6 +106,7 @@ static int smb2_compound_op(const unsign + + vars->oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = full_path, + .desired_access = desired_access, + .disposition = create_disposition, + .create_options = cifs_create_options(cifs_sb, create_options), +--- a/fs/cifs/smb2ops.c ++++ b/fs/cifs/smb2ops.c +@@ -731,6 +731,7 @@ smb3_qfs_tcon(const unsigned int xid, st + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = "", + .desired_access = FILE_READ_ATTRIBUTES, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -774,6 +775,7 @@ smb2_qfs_tcon(const unsigned int xid, st + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = "", + .desired_access = FILE_READ_ATTRIBUTES, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -821,6 +823,7 @@ smb2_is_path_accessible(const unsigned i + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = full_path, + .desired_access = FILE_READ_ATTRIBUTES, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -1105,6 +1108,7 @@ smb2_set_ea(const unsigned int xid, stru + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = path, + .desired_access = FILE_WRITE_EA, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -2096,6 +2100,7 @@ smb3_notify(const unsigned int xid, stru + tcon = cifs_sb_master_tcon(cifs_sb); + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = path, + .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -2168,6 +2173,7 @@ smb2_query_dir_first(const unsigned int + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = path, + .desired_access = FILE_READ_ATTRIBUTES | FILE_READ_DATA, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -2500,6 +2506,7 @@ smb2_query_info_compound(const unsigned + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = path, + .desired_access = desired_access, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -2634,6 +2641,7 @@ smb311_queryfs(const unsigned int xid, s + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = "", + .desired_access = FILE_READ_ATTRIBUTES, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, 0), +@@ -2928,6 +2936,7 @@ smb2_query_symlink(const unsigned int xi + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = full_path, + .desired_access = FILE_READ_ATTRIBUTES, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, create_options), +@@ -3068,6 +3077,7 @@ smb2_query_reparse_tag(const unsigned in + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = full_path, + .desired_access = FILE_READ_ATTRIBUTES, + .disposition = FILE_OPEN, + .create_options = cifs_create_options(cifs_sb, OPEN_REPARSE_POINT), +@@ -3208,6 +3218,7 @@ get_smb2_acl_by_path(struct cifs_sb_info + + oparms = (struct cifs_open_parms) { + .tcon = tcon, ++ .path = path, + .desired_access = READ_CONTROL, + .disposition = FILE_OPEN, + /* +--- a/fs/cifs/smb2pdu.c ++++ b/fs/cifs/smb2pdu.c +@@ -2742,7 +2742,7 @@ int smb311_posix_mkdir(const unsigned in + rqst.rq_nvec = n_iov; + + /* no need to inc num_remote_opens because we close it just below */ +- trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE, ++ trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, full_path, CREATE_NOT_FILE, + FILE_WRITE_ATTRIBUTES); + /* resource #4: response buffer */ + rc = cifs_send_recv(xid, ses, server, +@@ -3010,7 +3010,7 @@ SMB2_open(const unsigned int xid, struct + if (rc) + goto creat_exit; + +- trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, ++ trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path, + oparms->create_options, oparms->desired_access); + + rc = cifs_send_recv(xid, ses, server, +--- a/fs/cifs/trace.h ++++ b/fs/cifs/trace.h +@@ -701,13 +701,15 @@ DECLARE_EVENT_CLASS(smb3_open_enter_clas + TP_PROTO(unsigned int xid, + __u32 tid, + __u64 sesid, ++ const char *full_path, + int create_options, + int desired_access), +- TP_ARGS(xid, tid, sesid, create_options, desired_access), ++ TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access), + TP_STRUCT__entry( + __field(unsigned int, xid) + __field(__u32, tid) + __field(__u64, sesid) ++ __string(path, full_path) + __field(int, create_options) + __field(int, desired_access) + ), +@@ -715,11 +717,12 @@ DECLARE_EVENT_CLASS(smb3_open_enter_clas + __entry->xid = xid; + __entry->tid = tid; + __entry->sesid = sesid; ++ __assign_str(path, full_path); + __entry->create_options = create_options; + __entry->desired_access = desired_access; + ), +- TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x", +- __entry->xid, __entry->sesid, __entry->tid, ++ TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s cr_opts=0x%x des_access=0x%x", ++ __entry->xid, __entry->sesid, __entry->tid, __get_str(path), + __entry->create_options, __entry->desired_access) + ) + +@@ -728,9 +731,10 @@ DEFINE_EVENT(smb3_open_enter_class, smb3 + TP_PROTO(unsigned int xid, \ + __u32 tid, \ + __u64 sesid, \ ++ const char *full_path, \ + int create_options, \ + int desired_access), \ +- TP_ARGS(xid, tid, sesid, create_options, desired_access)) ++ TP_ARGS(xid, tid, sesid, full_path, create_options, desired_access)) + + DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter); + DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter); diff --git a/queue-6.1/cifs-do-not-poll-server-interfaces-too-regularly.patch b/queue-6.1/cifs-do-not-poll-server-interfaces-too-regularly.patch new file mode 100644 index 00000000000..3cdf616f3d7 --- /dev/null +++ b/queue-6.1/cifs-do-not-poll-server-interfaces-too-regularly.patch @@ -0,0 +1,56 @@ +From 072a28c8907c841f7d4b56c78bce46d3ee211e73 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Wed, 8 Mar 2023 12:11:31 +0000 +Subject: cifs: do not poll server interfaces too regularly + +From: Shyam Prasad N + +commit 072a28c8907c841f7d4b56c78bce46d3ee211e73 upstream. + +We have the server interface list hanging off the tcon +structure today for reasons unknown. So each tcon which is +connected to a file server can query them separately, +which is really unnecessary. To avoid this, in the query +function, we will check the time of last update of the +interface list, and avoid querying the server if it is +within a certain range. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/smb2ops.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/fs/cifs/smb2ops.c ++++ b/fs/cifs/smb2ops.c +@@ -530,6 +530,14 @@ parse_server_interfaces(struct network_i + p = buf; + + spin_lock(&ses->iface_lock); ++ /* do not query too frequently, this time with lock held */ ++ if (ses->iface_last_update && ++ time_before(jiffies, ses->iface_last_update + ++ (SMB_INTERFACE_POLL_INTERVAL * HZ))) { ++ spin_unlock(&ses->iface_lock); ++ return 0; ++ } ++ + /* + * Go through iface_list and do kref_put to remove + * any unused ifaces. ifaces in use will be removed +@@ -696,6 +704,12 @@ SMB3_request_interfaces(const unsigned i + struct network_interface_info_ioctl_rsp *out_buf = NULL; + struct cifs_ses *ses = tcon->ses; + ++ /* do not query too frequently */ ++ if (ses->iface_last_update && ++ time_before(jiffies, ses->iface_last_update + ++ (SMB_INTERFACE_POLL_INTERVAL * HZ))) ++ return 0; ++ + rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID, + FSCTL_QUERY_NETWORK_INTERFACE_INFO, + NULL /* no data input */, 0 /* no data input */, diff --git a/queue-6.1/cifs-dump-pending-mids-for-all-channels-in-debugdata.patch b/queue-6.1/cifs-dump-pending-mids-for-all-channels-in-debugdata.patch new file mode 100644 index 00000000000..7f58904f2bf --- /dev/null +++ b/queue-6.1/cifs-dump-pending-mids-for-all-channels-in-debugdata.patch @@ -0,0 +1,86 @@ +From d12bc6d26f92c51b28e8f4a146ffcc630b688198 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Mon, 13 Mar 2023 11:09:12 +0000 +Subject: cifs: dump pending mids for all channels in DebugData + +From: Shyam Prasad N + +commit d12bc6d26f92c51b28e8f4a146ffcc630b688198 upstream. + +Currently, we only dump the pending mid information only +on the primary channel in /proc/fs/cifs/DebugData. +If multichannel is active, we do not print the pending MID +list on secondary channels. + +This change will dump the pending mids for all the channels +based on server->conn_id. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/cifs_debug.c | 41 +++++++++++++++++++++++++++-------------- + 1 file changed, 27 insertions(+), 14 deletions(-) + +--- a/fs/cifs/cifs_debug.c ++++ b/fs/cifs/cifs_debug.c +@@ -215,6 +215,7 @@ static int cifs_debug_data_proc_show(str + { + struct mid_q_entry *mid_entry; + struct TCP_Server_Info *server; ++ struct TCP_Server_Info *chan_server; + struct cifs_ses *ses; + struct cifs_tcon *tcon; + struct cifs_server_iface *iface; +@@ -458,23 +459,35 @@ skip_rdma: + seq_puts(m, "\t\t[CONNECTED]\n"); + } + spin_unlock(&ses->iface_lock); ++ ++ seq_puts(m, "\n\n\tMIDs: "); ++ spin_lock(&ses->chan_lock); ++ for (j = 0; j < ses->chan_count; j++) { ++ chan_server = ses->chans[j].server; ++ if (!chan_server) ++ continue; ++ ++ if (list_empty(&chan_server->pending_mid_q)) ++ continue; ++ ++ seq_printf(m, "\n\tServer ConnectionId: 0x%llx", ++ chan_server->conn_id); ++ spin_lock(&chan_server->mid_lock); ++ list_for_each_entry(mid_entry, &chan_server->pending_mid_q, qhead) { ++ seq_printf(m, "\n\t\tState: %d com: %d pid: %d cbdata: %p mid %llu", ++ mid_entry->mid_state, ++ le16_to_cpu(mid_entry->command), ++ mid_entry->pid, ++ mid_entry->callback_data, ++ mid_entry->mid); ++ } ++ spin_unlock(&chan_server->mid_lock); ++ } ++ spin_unlock(&ses->chan_lock); ++ seq_puts(m, "\n--\n"); + } + if (i == 0) + seq_printf(m, "\n\t\t[NONE]"); +- +- seq_puts(m, "\n\n\tMIDs: "); +- spin_lock(&server->mid_lock); +- list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) { +- seq_printf(m, "\n\tState: %d com: %d pid:" +- " %d cbdata: %p mid %llu\n", +- mid_entry->mid_state, +- le16_to_cpu(mid_entry->command), +- mid_entry->pid, +- mid_entry->callback_data, +- mid_entry->mid); +- } +- spin_unlock(&server->mid_lock); +- seq_printf(m, "\n--\n"); + } + if (c == 0) + seq_printf(m, "\n\t[NONE]"); diff --git a/queue-6.1/cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch b/queue-6.1/cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch new file mode 100644 index 00000000000..fa7e91af811 --- /dev/null +++ b/queue-6.1/cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch @@ -0,0 +1,33 @@ +From 896cd316b841053f6df95ab77b5f1322c16a8e18 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Thu, 9 Mar 2023 13:23:29 +0000 +Subject: cifs: empty interface list when server doesn't support query interfaces + +From: Shyam Prasad N + +commit 896cd316b841053f6df95ab77b5f1322c16a8e18 upstream. + +When querying server interfaces returns -EOPNOTSUPP, +clear the list of interfaces. Assumption is that multichannel +would be disabled too. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/smb2ops.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/cifs/smb2ops.c ++++ b/fs/cifs/smb2ops.c +@@ -717,7 +717,7 @@ SMB3_request_interfaces(const unsigned i + if (rc == -EOPNOTSUPP) { + cifs_dbg(FYI, + "server does not support query network interfaces\n"); +- goto out; ++ ret_data_len = 0; + } else if (rc != 0) { + cifs_tcon_dbg(VFS, "error %d on ioctl to get interface list\n", rc); + goto out; diff --git a/queue-6.1/cifs-fix-dentry-lookups-in-directory-handle-cache.patch b/queue-6.1/cifs-fix-dentry-lookups-in-directory-handle-cache.patch new file mode 100644 index 00000000000..f9f01ec638e --- /dev/null +++ b/queue-6.1/cifs-fix-dentry-lookups-in-directory-handle-cache.patch @@ -0,0 +1,97 @@ +From be4fde79812f02914e350bde0bc4cfeae8429378 Mon Sep 17 00:00:00 2001 +From: Paulo Alcantara +Date: Fri, 24 Mar 2023 13:56:33 -0300 +Subject: cifs: fix dentry lookups in directory handle cache + +From: Paulo Alcantara + +commit be4fde79812f02914e350bde0bc4cfeae8429378 upstream. + +Get rid of any prefix paths in @path before lookup_positive_unlocked() +as it will call ->lookup() which already adds those prefix paths +through build_path_from_dentry(). + +This has caused a performance regression when mounting shares with a +prefix path where readdir(2) would end up retrying several times to +open bad directory names that contained duplicate prefix paths. + +Fix this by skipping any prefix paths in @path before calling +lookup_positive_unlocked(). + +Fixes: e4029e072673 ("cifs: find and use the dentry for cached non-root directories also") +Cc: stable@vger.kernel.org # 6.1+ +Signed-off-by: Paulo Alcantara (SUSE) +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/cached_dir.c | 36 ++++++++++++++++++++++++++++++++++-- + 1 file changed, 34 insertions(+), 2 deletions(-) + +--- a/fs/cifs/cached_dir.c ++++ b/fs/cifs/cached_dir.c +@@ -99,6 +99,23 @@ path_to_dentry(struct cifs_sb_info *cifs + return dentry; + } + ++static const char *path_no_prefix(struct cifs_sb_info *cifs_sb, ++ const char *path) ++{ ++ size_t len = 0; ++ ++ if (!*path) ++ return path; ++ ++ if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) && ++ cifs_sb->prepath) { ++ len = strlen(cifs_sb->prepath) + 1; ++ if (unlikely(len > strlen(path))) ++ return ERR_PTR(-EINVAL); ++ } ++ return path + len; ++} ++ + /* + * Open the and cache a directory handle. + * If error then *cfid is not initialized. +@@ -125,6 +142,7 @@ int open_cached_dir(unsigned int xid, st + struct dentry *dentry = NULL; + struct cached_fid *cfid; + struct cached_fids *cfids; ++ const char *npath; + + if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache || + is_smb1_server(tcon->ses->server)) +@@ -161,6 +179,20 @@ int open_cached_dir(unsigned int xid, st + } + + /* ++ * Skip any prefix paths in @path as lookup_positive_unlocked() ends up ++ * calling ->lookup() which already adds those through ++ * build_path_from_dentry(). Also, do it earlier as we might reconnect ++ * below when trying to send compounded request and then potentially ++ * having a different prefix path (e.g. after DFS failover). ++ */ ++ npath = path_no_prefix(cifs_sb, path); ++ if (IS_ERR(npath)) { ++ rc = PTR_ERR(npath); ++ kfree(utf16_path); ++ return rc; ++ } ++ ++ /* + * We do not hold the lock for the open because in case + * SMB2_open needs to reconnect. + * This is safe because no other thread will be able to get a ref +@@ -252,10 +284,10 @@ int open_cached_dir(unsigned int xid, st + (char *)&cfid->file_all_info)) + cfid->file_all_info_is_valid = true; + +- if (!path[0]) ++ if (!npath[0]) + dentry = dget(cifs_sb->root); + else { +- dentry = path_to_dentry(cifs_sb, path); ++ dentry = path_to_dentry(cifs_sb, npath); + if (IS_ERR(dentry)) { + rc = -ENOENT; + goto oshr_free; diff --git a/queue-6.1/cifs-lock-chan_lock-outside-match_session.patch b/queue-6.1/cifs-lock-chan_lock-outside-match_session.patch new file mode 100644 index 00000000000..b08d8d11da3 --- /dev/null +++ b/queue-6.1/cifs-lock-chan_lock-outside-match_session.patch @@ -0,0 +1,79 @@ +From 2f4e429c846972c8405951a9ff7a82aceeca7461 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Mon, 20 Feb 2023 13:02:11 +0000 +Subject: cifs: lock chan_lock outside match_session + +From: Shyam Prasad N + +commit 2f4e429c846972c8405951a9ff7a82aceeca7461 upstream. + +Coverity had rightly indicated a possible deadlock +due to chan_lock being done inside match_session. +All callers of match_* functions should pick up the +necessary locks and call them. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Fixes: 724244cdb382 ("cifs: protect session channel fields with chan_lock") +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/connect.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -1774,7 +1774,7 @@ out_err: + return ERR_PTR(rc); + } + +-/* this function must be called with ses_lock held */ ++/* this function must be called with ses_lock and chan_lock held */ + static int match_session(struct cifs_ses *ses, struct smb3_fs_context *ctx) + { + if (ctx->sectype != Unspecified && +@@ -1785,12 +1785,8 @@ static int match_session(struct cifs_ses + * If an existing session is limited to less channels than + * requested, it should not be reused + */ +- spin_lock(&ses->chan_lock); +- if (ses->chan_max < ctx->max_channels) { +- spin_unlock(&ses->chan_lock); ++ if (ses->chan_max < ctx->max_channels) + return 0; +- } +- spin_unlock(&ses->chan_lock); + + switch (ses->sectype) { + case Kerberos: +@@ -1918,10 +1914,13 @@ cifs_find_smb_ses(struct TCP_Server_Info + spin_unlock(&ses->ses_lock); + continue; + } ++ spin_lock(&ses->chan_lock); + if (!match_session(ses, ctx)) { ++ spin_unlock(&ses->chan_lock); + spin_unlock(&ses->ses_lock); + continue; + } ++ spin_unlock(&ses->chan_lock); + spin_unlock(&ses->ses_lock); + + ++ses->ses_count; +@@ -2742,6 +2741,7 @@ cifs_match_super(struct super_block *sb, + + spin_lock(&tcp_srv->srv_lock); + spin_lock(&ses->ses_lock); ++ spin_lock(&ses->chan_lock); + spin_lock(&tcon->tc_lock); + if (!match_server(tcp_srv, ctx) || + !match_session(ses, ctx) || +@@ -2754,6 +2754,7 @@ cifs_match_super(struct super_block *sb, + rc = compare_mount_options(sb, mnt_data); + out: + spin_unlock(&tcon->tc_lock); ++ spin_unlock(&ses->chan_lock); + spin_unlock(&ses->ses_lock); + spin_unlock(&tcp_srv->srv_lock); + diff --git a/queue-6.1/cifs-print-session-id-while-listing-open-files.patch b/queue-6.1/cifs-print-session-id-while-listing-open-files.patch new file mode 100644 index 00000000000..c3b298ee2d0 --- /dev/null +++ b/queue-6.1/cifs-print-session-id-while-listing-open-files.patch @@ -0,0 +1,47 @@ +From 175b54abc443b6965e9379b71ec05f7c73c192e9 Mon Sep 17 00:00:00 2001 +From: Shyam Prasad N +Date: Mon, 13 Mar 2023 12:17:34 +0000 +Subject: cifs: print session id while listing open files + +From: Shyam Prasad N + +commit 175b54abc443b6965e9379b71ec05f7c73c192e9 upstream. + +In the output of /proc/fs/cifs/open_files, we only print +the tree id for the tcon of each open file. It becomes +difficult to know which tcon these files belong to with +just the tree id. + +This change dumps ses id in addition to all other data today. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Paulo Alcantara (SUSE) +Cc: stable@vger.kernel.org +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman +--- + fs/cifs/cifs_debug.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/fs/cifs/cifs_debug.c ++++ b/fs/cifs/cifs_debug.c +@@ -175,7 +175,7 @@ static int cifs_debug_files_proc_show(st + + seq_puts(m, "# Version:1\n"); + seq_puts(m, "# Format:\n"); +- seq_puts(m, "# "); ++ seq_puts(m, "# "); + #ifdef CONFIG_CIFS_DEBUG2 + seq_printf(m, " \n"); + #else +@@ -188,8 +188,9 @@ static int cifs_debug_files_proc_show(st + spin_lock(&tcon->open_file_lock); + list_for_each_entry(cfile, &tcon->openFileList, tlist) { + seq_printf(m, +- "0x%x 0x%llx 0x%x %d %d %d %pd", ++ "0x%x 0x%llx 0x%llx 0x%x %d %d %d %pd", + tcon->tid, ++ ses->Suid, + cfile->fid.persistent_fid, + cfile->f_flags, + cfile->count, diff --git a/queue-6.1/scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch b/queue-6.1/scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch new file mode 100644 index 00000000000..15ee557e312 --- /dev/null +++ b/queue-6.1/scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch @@ -0,0 +1,37 @@ +From a204b490595de71016b2360a1886ec8c12d0afac Mon Sep 17 00:00:00 2001 +From: Joel Selvaraj +Date: Sun, 12 Mar 2023 23:14:02 -0500 +Subject: scsi: core: Add BLIST_SKIP_VPD_PAGES for SKhynix H28U74301AMR + +From: Joel Selvaraj + +commit a204b490595de71016b2360a1886ec8c12d0afac upstream. + +Xiaomi Poco F1 (qcom/sdm845-xiaomi-beryllium*.dts) comes with a SKhynix +H28U74301AMR UFS. The sd_read_cpr() operation leads to a 120 second +timeout, making the device bootup very slow: + +[ 121.457736] sd 0:0:0:1: [sdb] tag#23 timing out command, waited 120s + +Setting the BLIST_SKIP_VPD_PAGES allows the device to skip the failing +sd_read_cpr operation and boot normally. + +Signed-off-by: Joel Selvaraj +Link: https://lore.kernel.org/r/20230313041402.39330-1-joelselvaraj.oss@gmail.com +Cc: stable@vger.kernel.org +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/scsi_devinfo.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/scsi/scsi_devinfo.c ++++ b/drivers/scsi/scsi_devinfo.c +@@ -234,6 +234,7 @@ static struct { + {"SGI", "RAID5", "*", BLIST_SPARSELUN}, + {"SGI", "TP9100", "*", BLIST_REPORTLUN2}, + {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, ++ {"SKhynix", "H28U74301AMR", NULL, BLIST_SKIP_VPD_PAGES}, + {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, + {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, + {"DELL", "Universal Xport", "*", BLIST_NO_ULD_ATTACH}, diff --git a/queue-6.1/selftests-x86-amx-add-a-ptrace-test.patch b/queue-6.1/selftests-x86-amx-add-a-ptrace-test.patch new file mode 100644 index 00000000000..e82d55f8c11 --- /dev/null +++ b/queue-6.1/selftests-x86-amx-add-a-ptrace-test.patch @@ -0,0 +1,172 @@ +From 62faca1ca10cc84e99ae7f38aa28df2bc945369b Mon Sep 17 00:00:00 2001 +From: "Chang S. Bae" +Date: Mon, 27 Feb 2023 13:05:04 -0800 +Subject: selftests/x86/amx: Add a ptrace test + +From: Chang S. Bae + +commit 62faca1ca10cc84e99ae7f38aa28df2bc945369b upstream. + +Include a test case to validate the XTILEDATA injection to the target. + +Also, it ensures the kernel's ability to copy states between different +XSAVE formats. + +Refactor the memcmp() code to be usable for the state validation. + +Signed-off-by: Chang S. Bae +Signed-off-by: Dave Hansen +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/all/20230227210504.18520-3-chang.seok.bae%40intel.com +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/x86/amx.c | 108 ++++++++++++++++++++++++++++++++++++-- + 1 file changed, 105 insertions(+), 3 deletions(-) + +--- a/tools/testing/selftests/x86/amx.c ++++ b/tools/testing/selftests/x86/amx.c +@@ -14,8 +14,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + + #include "../kselftest.h" /* For __cpuid_count() */ + +@@ -583,6 +585,13 @@ static void test_dynamic_state(void) + _exit(0); + } + ++static inline int __compare_tiledata_state(struct xsave_buffer *xbuf1, struct xsave_buffer *xbuf2) ++{ ++ return memcmp(&xbuf1->bytes[xtiledata.xbuf_offset], ++ &xbuf2->bytes[xtiledata.xbuf_offset], ++ xtiledata.size); ++} ++ + /* + * Save current register state and compare it to @xbuf1.' + * +@@ -599,9 +608,7 @@ static inline bool __validate_tiledata_r + fatal_error("failed to allocate XSAVE buffer\n"); + + xsave(xbuf2, XFEATURE_MASK_XTILEDATA); +- ret = memcmp(&xbuf1->bytes[xtiledata.xbuf_offset], +- &xbuf2->bytes[xtiledata.xbuf_offset], +- xtiledata.size); ++ ret = __compare_tiledata_state(xbuf1, xbuf2); + + free(xbuf2); + +@@ -826,6 +833,99 @@ static void test_context_switch(void) + free(finfo); + } + ++/* Ptrace test */ ++ ++/* ++ * Make sure the ptracee has the expanded kernel buffer on the first ++ * use. Then, initialize the state before performing the state ++ * injection from the ptracer. ++ */ ++static inline void ptracee_firstuse_tiledata(void) ++{ ++ load_rand_tiledata(stashed_xsave); ++ init_xtiledata(); ++} ++ ++/* ++ * Ptracer injects the randomized tile data state. It also reads ++ * before and after that, which will execute the kernel's state copy ++ * functions. So, the tester is advised to double-check any emitted ++ * kernel messages. ++ */ ++static void ptracer_inject_tiledata(pid_t target) ++{ ++ struct xsave_buffer *xbuf; ++ struct iovec iov; ++ ++ xbuf = alloc_xbuf(); ++ if (!xbuf) ++ fatal_error("unable to allocate XSAVE buffer"); ++ ++ printf("\tRead the init'ed tiledata via ptrace().\n"); ++ ++ iov.iov_base = xbuf; ++ iov.iov_len = xbuf_size; ++ ++ memset(stashed_xsave, 0, xbuf_size); ++ ++ if (ptrace(PTRACE_GETREGSET, target, (uint32_t)NT_X86_XSTATE, &iov)) ++ fatal_error("PTRACE_GETREGSET"); ++ ++ if (!__compare_tiledata_state(stashed_xsave, xbuf)) ++ printf("[OK]\tThe init'ed tiledata was read from ptracee.\n"); ++ else ++ printf("[FAIL]\tThe init'ed tiledata was not read from ptracee.\n"); ++ ++ printf("\tInject tiledata via ptrace().\n"); ++ ++ load_rand_tiledata(xbuf); ++ ++ memcpy(&stashed_xsave->bytes[xtiledata.xbuf_offset], ++ &xbuf->bytes[xtiledata.xbuf_offset], ++ xtiledata.size); ++ ++ if (ptrace(PTRACE_SETREGSET, target, (uint32_t)NT_X86_XSTATE, &iov)) ++ fatal_error("PTRACE_SETREGSET"); ++ ++ if (ptrace(PTRACE_GETREGSET, target, (uint32_t)NT_X86_XSTATE, &iov)) ++ fatal_error("PTRACE_GETREGSET"); ++ ++ if (!__compare_tiledata_state(stashed_xsave, xbuf)) ++ printf("[OK]\tTiledata was correctly written to ptracee.\n"); ++ else ++ printf("[FAIL]\tTiledata was not correctly written to ptracee.\n"); ++} ++ ++static void test_ptrace(void) ++{ ++ pid_t child; ++ int status; ++ ++ child = fork(); ++ if (child < 0) { ++ err(1, "fork"); ++ } else if (!child) { ++ if (ptrace(PTRACE_TRACEME, 0, NULL, NULL)) ++ err(1, "PTRACE_TRACEME"); ++ ++ ptracee_firstuse_tiledata(); ++ ++ raise(SIGTRAP); ++ _exit(0); ++ } ++ ++ do { ++ wait(&status); ++ } while (WSTOPSIG(status) != SIGTRAP); ++ ++ ptracer_inject_tiledata(child); ++ ++ ptrace(PTRACE_DETACH, child, NULL, NULL); ++ wait(&status); ++ if (!WIFEXITED(status) || WEXITSTATUS(status)) ++ err(1, "ptrace test"); ++} ++ + int main(void) + { + /* Check hardware availability at first */ +@@ -846,6 +946,8 @@ int main(void) + ctxtswtest_config.num_threads = 5; + test_context_switch(); + ++ test_ptrace(); ++ + clearhandler(SIGILL); + free_stashed_xsave(); + diff --git a/queue-6.1/series b/queue-6.1/series index ff1ed1e6324..3545be46f93 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -147,3 +147,17 @@ drm-amdgpu-fix-call-trace-warning-and-hang-when-remo.patch drm-amd-fix-initialization-mistake-for-nbio-7.3.0.patch net-sched-act_mirred-better-wording-on-protection-ag.patch act_mirred-use-the-backlog-for-nested-calls-to-mirre.patch +cifs-lock-chan_lock-outside-match_session.patch +cifs-append-path-to-open_enter-trace-event.patch +cifs-do-not-poll-server-interfaces-too-regularly.patch +cifs-empty-interface-list-when-server-doesn-t-support-query-interfaces.patch +cifs-dump-pending-mids-for-all-channels-in-debugdata.patch +cifs-print-session-id-while-listing-open-files.patch +cifs-fix-dentry-lookups-in-directory-handle-cache.patch +x86-fpu-xstate-prevent-false-positive-warning-in-__copy_xstate_uabi_buf.patch +selftests-x86-amx-add-a-ptrace-test.patch +scsi-core-add-blist_skip_vpd_pages-for-skhynix-h28u74301amr.patch +usb-misc-onboard-hub-add-support-for-microchip-usb2517-usb-2.0-hub.patch +usb-dwc2-drd-fix-inconsistent-mode-if-role-switch-default-mode-host.patch +usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch +usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch diff --git a/queue-6.1/usb-dwc2-drd-fix-inconsistent-mode-if-role-switch-default-mode-host.patch b/queue-6.1/usb-dwc2-drd-fix-inconsistent-mode-if-role-switch-default-mode-host.patch new file mode 100644 index 00000000000..5a1d2e4217b --- /dev/null +++ b/queue-6.1/usb-dwc2-drd-fix-inconsistent-mode-if-role-switch-default-mode-host.patch @@ -0,0 +1,55 @@ +From 82f5332d3b9872ab5b287e85c57b76d8bb640cd1 Mon Sep 17 00:00:00 2001 +From: Ziyang Huang +Date: Tue, 21 Feb 2023 18:30:04 +0800 +Subject: usb: dwc2: drd: fix inconsistent mode if role-switch-default-mode="host" + +From: Ziyang Huang + +commit 82f5332d3b9872ab5b287e85c57b76d8bb640cd1 upstream. + +Some boards might use USB-A female connector for USB ports, however, +the port could be connected to a dual-mode USB controller, making it +also behaves as a peripheral device if male-to-male cable is connected. + +In this case, the dts looks like this: + + &usb0 { + status = "okay"; + dr_mode = "otg"; + usb-role-switch; + role-switch-default-mode = "host"; + }; + +After boot, dwc2_ovr_init() sets GOTGCTL to GOTGCTL_AVALOVAL and call +dwc2_force_mode() with parameter host=false, which causes inconsistent +mode - The hardware is in peripheral mode while the kernel status is +in host mode. + +What we can do now is to call dwc2_drd_role_sw_set() to switch to +device mode, and everything should work just fine now, even switching +back to none(default) mode afterwards. + +Fixes: e14acb876985 ("usb: dwc2: drd: add role-switch-default-node support") +Cc: stable +Signed-off-by: Ziyang Huang +Tested-by: Fabrice Gasnier +Acked-by: Minas Harutyunyan +Reviewed-by: Amelie Delaunay +Link: https://lore.kernel.org/r/SG2PR01MB204837BF68EDB0E343D2A375C9A59@SG2PR01MB2048.apcprd01.prod.exchangelabs.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc2/drd.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/usb/dwc2/drd.c ++++ b/drivers/usb/dwc2/drd.c +@@ -35,7 +35,8 @@ static void dwc2_ovr_init(struct dwc2_hs + + spin_unlock_irqrestore(&hsotg->lock, flags); + +- dwc2_force_mode(hsotg, (hsotg->dr_mode == USB_DR_MODE_HOST)); ++ dwc2_force_mode(hsotg, (hsotg->dr_mode == USB_DR_MODE_HOST) || ++ (hsotg->role_sw_default_mode == USB_DR_MODE_HOST)); + } + + static int dwc2_ovr_avalid(struct dwc2_hsotg *hsotg, bool valid) diff --git a/queue-6.1/usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch b/queue-6.1/usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch new file mode 100644 index 00000000000..af5bfadaccf --- /dev/null +++ b/queue-6.1/usb-dwc2-fix-a-devres-leak-in-hw_enable-upon-suspend-resume.patch @@ -0,0 +1,100 @@ +From f747313249b74f323ddf841a9c8db14d989f296a Mon Sep 17 00:00:00 2001 +From: Fabrice Gasnier +Date: Thu, 16 Mar 2023 09:41:27 +0100 +Subject: usb: dwc2: fix a devres leak in hw_enable upon suspend resume + +From: Fabrice Gasnier + +commit f747313249b74f323ddf841a9c8db14d989f296a upstream. + +Each time the platform goes to low power, PM suspend / resume routines +call: __dwc2_lowlevel_hw_enable -> devm_add_action_or_reset(). +This adds a new devres each time. +This may also happen at runtime, as dwc2_lowlevel_hw_enable() can be +called from udc_start(). + +This can be seen with tracing: +- echo 1 > /sys/kernel/debug/tracing/events/dev/devres_log/enable +- go to low power +- cat /sys/kernel/debug/tracing/trace + +A new "ADD" entry is found upon each low power cycle: +... devres_log: 49000000.usb-otg ADD 82a13bba devm_action_release (8 bytes) +... devres_log: 49000000.usb-otg ADD 49889daf devm_action_release (8 bytes) +... + +A second issue is addressed here: +- regulator_bulk_enable() is called upon each PM cycle (suspend/resume). +- regulator_bulk_disable() never gets called. + +So the reference count for these regulators constantly increase, by one +upon each low power cycle, due to missing regulator_bulk_disable() call +in __dwc2_lowlevel_hw_disable(). + +The original fix that introduced the devm_add_action_or_reset() call, +fixed an issue during probe, that happens due to other errors in +dwc2_driver_probe() -> dwc2_core_reset(). Then the probe fails without +disabling regulators, when dr_mode == USB_DR_MODE_PERIPHERAL. + +Rather fix the error path: disable all the low level hardware in the +error path, by using the "hsotg->ll_hw_enabled" flag. Checking dr_mode +has been introduced to avoid a dual call to dwc2_lowlevel_hw_disable(). +"ll_hw_enabled" should achieve the same (and is used currently in the +remove() routine). + +Fixes: 54c196060510 ("usb: dwc2: Always disable regulators on driver teardown") +Fixes: 33a06f1300a7 ("usb: dwc2: Fix error path in gadget registration") +Cc: stable +Signed-off-by: Fabrice Gasnier +Link: https://lore.kernel.org/r/20230316084127.126084-1-fabrice.gasnier@foss.st.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc2/platform.c | 16 ++-------------- + 1 file changed, 2 insertions(+), 14 deletions(-) + +--- a/drivers/usb/dwc2/platform.c ++++ b/drivers/usb/dwc2/platform.c +@@ -91,13 +91,6 @@ static int dwc2_get_dr_mode(struct dwc2_ + return 0; + } + +-static void __dwc2_disable_regulators(void *data) +-{ +- struct dwc2_hsotg *hsotg = data; +- +- regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); +-} +- + static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg) + { + struct platform_device *pdev = to_platform_device(hsotg->dev); +@@ -108,11 +101,6 @@ static int __dwc2_lowlevel_hw_enable(str + if (ret) + return ret; + +- ret = devm_add_action_or_reset(&pdev->dev, +- __dwc2_disable_regulators, hsotg); +- if (ret) +- return ret; +- + if (hsotg->clk) { + ret = clk_prepare_enable(hsotg->clk); + if (ret) +@@ -168,7 +156,7 @@ static int __dwc2_lowlevel_hw_disable(st + if (hsotg->clk) + clk_disable_unprepare(hsotg->clk); + +- return 0; ++ return regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies); + } + + /** +@@ -607,7 +595,7 @@ error_init: + if (hsotg->params.activate_stm_id_vb_detection) + regulator_disable(hsotg->usb33d); + error: +- if (hsotg->dr_mode != USB_DR_MODE_PERIPHERAL) ++ if (hsotg->ll_hw_enabled) + dwc2_lowlevel_hw_disable(hsotg); + return retval; + } diff --git a/queue-6.1/usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch b/queue-6.1/usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch new file mode 100644 index 00000000000..eb324b399e0 --- /dev/null +++ b/queue-6.1/usb-gadget-u_audio-don-t-let-userspace-block-driver-unbind.patch @@ -0,0 +1,72 @@ +From 6c67ed9ad9b83e453e808f9b31a931a20a25629b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alvin=20=C5=A0ipraga?= +Date: Thu, 2 Mar 2023 17:36:47 +0100 +Subject: usb: gadget: u_audio: don't let userspace block driver unbind +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alvin Å ipraga + +commit 6c67ed9ad9b83e453e808f9b31a931a20a25629b upstream. + +In the unbind callback for f_uac1 and f_uac2, a call to snd_card_free() +via g_audio_cleanup() will disconnect the card and then wait for all +resources to be released, which happens when the refcount falls to zero. +Since userspace can keep the refcount incremented by not closing the +relevant file descriptor, the call to unbind may block indefinitely. +This can cause a deadlock during reboot, as evidenced by the following +blocked task observed on my machine: + + task:reboot state:D stack:0 pid:2827 ppid:569 flags:0x0000000c + Call trace: + __switch_to+0xc8/0x140 + __schedule+0x2f0/0x7c0 + schedule+0x60/0xd0 + schedule_timeout+0x180/0x1d4 + wait_for_completion+0x78/0x180 + snd_card_free+0x90/0xa0 + g_audio_cleanup+0x2c/0x64 + afunc_unbind+0x28/0x60 + ... + kernel_restart+0x4c/0xac + __do_sys_reboot+0xcc/0x1ec + __arm64_sys_reboot+0x28/0x30 + invoke_syscall+0x4c/0x110 + ... + +The issue can also be observed by opening the card with arecord and +then stopping the process through the shell before unbinding: + + # arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null + Recording WAVE '/dev/null' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo + ^Z[1]+ Stopped arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null + # echo gadget.0 > /sys/bus/gadget/drivers/configfs-gadget/unbind + (observe that the unbind command never finishes) + +Fix the problem by using snd_card_free_when_closed() instead, which will +still disconnect the card as desired, but defer the task of freeing the +resources to the core once userspace closes its file descriptor. + +Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver") +Cc: stable@vger.kernel.org +Signed-off-by: Alvin Å ipraga +Reviewed-by: Ruslan Bilovol +Reviewed-by: John Keeping +Link: https://lore.kernel.org/r/20230302163648.3349669-1-alvin@pqrs.dk +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/function/u_audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/function/u_audio.c ++++ b/drivers/usb/gadget/function/u_audio.c +@@ -1422,7 +1422,7 @@ void g_audio_cleanup(struct g_audio *g_a + uac = g_audio->uac; + card = uac->card; + if (card) +- snd_card_free(card); ++ snd_card_free_when_closed(card); + + kfree(uac->p_prm.reqs); + kfree(uac->c_prm.reqs); diff --git a/queue-6.1/usb-misc-onboard-hub-add-support-for-microchip-usb2517-usb-2.0-hub.patch b/queue-6.1/usb-misc-onboard-hub-add-support-for-microchip-usb2517-usb-2.0-hub.patch new file mode 100644 index 00000000000..070476a0bad --- /dev/null +++ b/queue-6.1/usb-misc-onboard-hub-add-support-for-microchip-usb2517-usb-2.0-hub.patch @@ -0,0 +1,44 @@ +From f7c13cb48e85538709850589b496c4ddb3d3898e Mon Sep 17 00:00:00 2001 +From: Alexander Stein +Date: Thu, 23 Feb 2023 08:39:20 +0100 +Subject: usb: misc: onboard-hub: add support for Microchip USB2517 USB 2.0 hub + +From: Alexander Stein + +commit f7c13cb48e85538709850589b496c4ddb3d3898e upstream. + +Add support for Microchip USB2517 USB 2.0 hub to the onboard usb hub +driver. Adopt the generic usb-device compatible ("usbVID,PID"). +This hub has the same reset timings as USB2514, so reuse that one. +There is also an USB2517I which just has industrial temperature range. + +Signed-off-by: Alexander Stein +Cc: stable +Acked-by: Matthias Kaehlcke +Link: https://lore.kernel.org/r/20230223073920.2912298-1-alexander.stein@ew.tq-group.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/misc/onboard_usb_hub.c | 1 + + drivers/usb/misc/onboard_usb_hub.h | 1 + + 2 files changed, 2 insertions(+) + +--- a/drivers/usb/misc/onboard_usb_hub.c ++++ b/drivers/usb/misc/onboard_usb_hub.c +@@ -406,6 +406,7 @@ static void onboard_hub_usbdev_disconnec + + static const struct usb_device_id onboard_hub_id_table[] = { + { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2514) }, /* USB2514B USB 2.0 */ ++ { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2517) }, /* USB2517 USB 2.0 */ + { USB_DEVICE(VENDOR_ID_REALTEK, 0x0411) }, /* RTS5411 USB 3.1 */ + { USB_DEVICE(VENDOR_ID_REALTEK, 0x5411) }, /* RTS5411 USB 2.1 */ + { USB_DEVICE(VENDOR_ID_REALTEK, 0x0414) }, /* RTS5414 USB 3.2 */ +--- a/drivers/usb/misc/onboard_usb_hub.h ++++ b/drivers/usb/misc/onboard_usb_hub.h +@@ -24,6 +24,7 @@ static const struct onboard_hub_pdata ti + + static const struct of_device_id onboard_hub_match[] = { + { .compatible = "usb424,2514", .data = µchip_usb424_data, }, ++ { .compatible = "usb424,2517", .data = µchip_usb424_data, }, + { .compatible = "usb451,8140", .data = &ti_tusb8041_data, }, + { .compatible = "usb451,8142", .data = &ti_tusb8041_data, }, + { .compatible = "usbbda,411", .data = &realtek_rts5411_data, }, diff --git a/queue-6.1/x86-fpu-xstate-prevent-false-positive-warning-in-__copy_xstate_uabi_buf.patch b/queue-6.1/x86-fpu-xstate-prevent-false-positive-warning-in-__copy_xstate_uabi_buf.patch new file mode 100644 index 00000000000..98f8b025912 --- /dev/null +++ b/queue-6.1/x86-fpu-xstate-prevent-false-positive-warning-in-__copy_xstate_uabi_buf.patch @@ -0,0 +1,89 @@ +From b15888840207c2bfe678dd1f68a32db54315e71f Mon Sep 17 00:00:00 2001 +From: "Chang S. Bae" +Date: Mon, 27 Feb 2023 13:05:03 -0800 +Subject: x86/fpu/xstate: Prevent false-positive warning in __copy_xstate_uabi_buf() + +From: Chang S. Bae + +commit b15888840207c2bfe678dd1f68a32db54315e71f upstream. + +__copy_xstate_to_uabi_buf() copies either from the tasks XSAVE buffer +or from init_fpstate into the ptrace buffer. Dynamic features, like +XTILEDATA, have an all zeroes init state and are not saved in +init_fpstate, which means the corresponding bit is not set in the +xfeatures bitmap of the init_fpstate header. + +But __copy_xstate_to_uabi_buf() retrieves addresses for both the tasks +xstate and init_fpstate unconditionally via __raw_xsave_addr(). + +So if the tasks XSAVE buffer has a dynamic feature set, then the +address retrieval for init_fpstate triggers the warning in +__raw_xsave_addr() which checks the feature bit in the init_fpstate +header. + +Remove the address retrieval from init_fpstate for extended features. +They have an all zeroes init state so init_fpstate has zeros for them. +Then zeroing the user buffer for the init state is the same as copying +them from init_fpstate. + +Fixes: 2308ee57d93d ("x86/fpu/amx: Enable the AMX feature in 64-bit mode") +Reported-by: Mingwei Zhang +Link: https://lore.kernel.org/kvm/20230221163655.920289-2-mizhang@google.com/ +Signed-off-by: Chang S. Bae +Signed-off-by: Dave Hansen +Tested-by: Mingwei Zhang +Link: https://lore.kernel.org/all/20230227210504.18520-2-chang.seok.bae%40intel.com +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kernel/fpu/xstate.c | 30 ++++++++++++++---------------- + 1 file changed, 14 insertions(+), 16 deletions(-) + +--- a/arch/x86/kernel/fpu/xstate.c ++++ b/arch/x86/kernel/fpu/xstate.c +@@ -1118,21 +1118,20 @@ void __copy_xstate_to_uabi_buf(struct me + zerofrom = offsetof(struct xregs_state, extended_state_area); + + /* +- * The ptrace buffer is in non-compacted XSAVE format. In +- * non-compacted format disabled features still occupy state space, +- * but there is no state to copy from in the compacted +- * init_fpstate. The gap tracking will zero these states. ++ * This 'mask' indicates which states to copy from fpstate. ++ * Those extended states that are not present in fpstate are ++ * either disabled or initialized: ++ * ++ * In non-compacted format, disabled features still occupy ++ * state space but there is no state to copy from in the ++ * compacted init_fpstate. The gap tracking will zero these ++ * states. ++ * ++ * The extended features have an all zeroes init state. Thus, ++ * remove them from 'mask' to zero those features in the user ++ * buffer instead of retrieving them from init_fpstate. + */ +- mask = fpstate->user_xfeatures; +- +- /* +- * Dynamic features are not present in init_fpstate. When they are +- * in an all zeros init state, remove those from 'mask' to zero +- * those features in the user buffer instead of retrieving them +- * from init_fpstate. +- */ +- if (fpu_state_size_dynamic()) +- mask &= (header.xfeatures | xinit->header.xcomp_bv); ++ mask = header.xfeatures; + + for_each_extended_xfeature(i, mask) { + /* +@@ -1151,9 +1150,8 @@ void __copy_xstate_to_uabi_buf(struct me + pkru.pkru = pkru_val; + membuf_write(&to, &pkru, sizeof(pkru)); + } else { +- copy_feature(header.xfeatures & BIT_ULL(i), &to, ++ membuf_write(&to, + __raw_xsave_addr(xsave, i), +- __raw_xsave_addr(xinit, i), + xstate_sizes[i]); + } + /*