From: Sasha Levin Date: Sun, 3 Nov 2024 00:30:49 +0000 (-0400) Subject: Fixes for 6.11 X-Git-Tag: v4.19.323~108 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98c99cde7b1c8d41cb5b20e4086cb4f4d4faa65c;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.11 Signed-off-by: Sasha Levin --- diff --git a/queue-6.11/acpi-resource-fold-asus-vivobook-pro-n6506m-dmi-quir.patch b/queue-6.11/acpi-resource-fold-asus-vivobook-pro-n6506m-dmi-quir.patch new file mode 100644 index 00000000000..c8b056aa880 --- /dev/null +++ b/queue-6.11/acpi-resource-fold-asus-vivobook-pro-n6506m-dmi-quir.patch @@ -0,0 +1,60 @@ +From 34b72b6eb7e4b1417999edbfa24a8ed8ce6158d2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Oct 2024 23:28:19 +0200 +Subject: ACPI: resource: Fold Asus Vivobook Pro N6506M* DMI quirks together + +From: Hans de Goede + +[ Upstream commit 1af7e441feb08cdaab8f4a320577ed0bba1f5896 ] + +Asus Vivobook Pro 15 OLED comes in 3 N6506M* models: + +N6506MU: Intel Ultra 9 185H, 3K OLED, RTX4060 +N6506MV: Intel Ultra 7 155H, 3K OLED, RTX4050 +N6506MJ: Intel Ultra 7 155H, FHD OLED, RTX3050 + +Fold the 3 DMI quirks for these into a single quirk to reduce the number +of quirks. + +Signed-off-by: Hans de Goede +Link: https://patch.msgid.link/20241005212819.354681-5-hdegoede@redhat.com +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/resource.c | 18 ++---------------- + 1 file changed, 2 insertions(+), 16 deletions(-) + +diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c +index a904bf9a7f7db..42c490149a431 100644 +--- a/drivers/acpi/resource.c ++++ b/drivers/acpi/resource.c +@@ -511,24 +511,10 @@ static const struct dmi_system_id irq1_level_low_skip_override[] = { + }, + }, + { +- /* Asus Vivobook Pro N6506MV */ ++ /* Asus Vivobook Pro N6506M* */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), +- DMI_MATCH(DMI_BOARD_NAME, "N6506MV"), +- }, +- }, +- { +- /* Asus Vivobook Pro N6506MU */ +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), +- DMI_MATCH(DMI_BOARD_NAME, "N6506MU"), +- }, +- }, +- { +- /* Asus Vivobook Pro N6506MJ */ +- .matches = { +- DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), +- DMI_MATCH(DMI_BOARD_NAME, "N6506MJ"), ++ DMI_MATCH(DMI_BOARD_NAME, "N6506M"), + }, + }, + { +-- +2.43.0 + diff --git a/queue-6.11/cifs-fix-creating-native-symlinks-pointing-to-curren.patch b/queue-6.11/cifs-fix-creating-native-symlinks-pointing-to-curren.patch new file mode 100644 index 00000000000..809d397c02b --- /dev/null +++ b/queue-6.11/cifs-fix-creating-native-symlinks-pointing-to-curren.patch @@ -0,0 +1,69 @@ +From 03753a857ff1f96e6d72f51df5937b45b17b9429 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Oct 2024 16:02:56 +0200 +Subject: cifs: Fix creating native symlinks pointing to current or parent + directory +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +[ Upstream commit 63271b7d569fbe924bccc7dadc17d3d07a4e5f7a ] + +Calling 'ln -s . symlink' or 'ln -s .. symlink' creates symlink pointing to +some object name which ends with U+F029 unicode codepoint. This is because +trailing dot in the object name is replaced by non-ASCII unicode codepoint. + +So Linux SMB client currently is not able to create native symlink pointing +to current or parent directory on Windows SMB server which can be read by +either on local Windows server or by any other SMB client which does not +implement compatible-reverse character replacement. + +Fix this problem in cifsConvertToUTF16() function which is doing that +character replacement. Function comment already says that it does not need +to handle special cases '.' and '..', but after introduction of native +symlinks in reparse point form, this handling is needed. + +Note that this change depends on the previous change +"cifs: Improve creating native symlinks pointing to directory". + +Signed-off-by: Pali Rohár +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/smb/client/cifs_unicode.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/fs/smb/client/cifs_unicode.c b/fs/smb/client/cifs_unicode.c +index 79d99a9139441..4cc6e0896fad3 100644 +--- a/fs/smb/client/cifs_unicode.c ++++ b/fs/smb/client/cifs_unicode.c +@@ -484,10 +484,21 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, + /** + * Remap spaces and periods found at the end of every + * component of the path. The special cases of '.' and +- * '..' do not need to be dealt with explicitly because +- * they are addressed in namei.c:link_path_walk(). ++ * '..' are need to be handled because of symlinks. ++ * They are treated as non-end-of-string to avoid ++ * remapping and breaking symlinks pointing to . or .. + **/ +- if ((i == srclen - 1) || (source[i+1] == '\\')) ++ if ((i == 0 || source[i-1] == '\\') && ++ source[i] == '.' && ++ (i == srclen-1 || source[i+1] == '\\')) ++ end_of_string = false; /* "." case */ ++ else if (i >= 1 && ++ (i == 1 || source[i-2] == '\\') && ++ source[i-1] == '.' && ++ source[i] == '.' && ++ (i == srclen-1 || source[i+1] == '\\')) ++ end_of_string = false; /* ".." case */ ++ else if ((i == srclen - 1) || (source[i+1] == '\\')) + end_of_string = true; + else + end_of_string = false; +-- +2.43.0 + diff --git a/queue-6.11/cifs-improve-creating-native-symlinks-pointing-to-di.patch b/queue-6.11/cifs-improve-creating-native-symlinks-pointing-to-di.patch new file mode 100644 index 00000000000..4533bc12a15 --- /dev/null +++ b/queue-6.11/cifs-improve-creating-native-symlinks-pointing-to-di.patch @@ -0,0 +1,300 @@ +From 5db59fca76aca5fedf080312eba25df04ee2c880 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 5 Oct 2024 16:02:55 +0200 +Subject: cifs: Improve creating native symlinks pointing to directory +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +[ Upstream commit 3eb40512530e4f64f819d8e723b6f41695dace5a ] + +SMB protocol for native symlinks distinguish between symlink to directory +and symlink to file. These two symlink types cannot be exchanged, which +means that symlink of file type pointing to directory cannot be resolved at +all (and vice-versa). + +Windows follows this rule for local filesystems (NTFS) and also for SMB. + +Linux SMB client currenly creates all native symlinks of file type. Which +means that Windows (and some other SMB clients) cannot resolve symlinks +pointing to directory created by Linux SMB client. + +As Linux system does not distinguish between directory and file symlinks, +its API does not provide enough information for Linux SMB client during +creating of native symlinks. + +Add some heuristic into the Linux SMB client for choosing the correct +symlink type during symlink creation. Check if the symlink target location +ends with slash, or last path component is dot or dot-dot, and check if the +target location on SMB share exists and is a directory. If at least one +condition is truth then create a new SMB symlink of directory type. +Otherwise create it as file type symlink. + +This change improves interoperability with Windows systems. Windows systems +would be able to resolve more SMB symlinks created by Linux SMB client +which points to existing directory. + +Signed-off-by: Pali Rohár +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/smb/client/reparse.c | 164 +++++++++++++++++++++++++++++++++++++- + fs/smb/client/smb2inode.c | 3 +- + fs/smb/client/smb2proto.h | 1 + + 3 files changed, 164 insertions(+), 4 deletions(-) + +diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c +index c848b5e88d32f..74abbdf5026c7 100644 +--- a/fs/smb/client/reparse.c ++++ b/fs/smb/client/reparse.c +@@ -14,6 +14,12 @@ + #include "fs_context.h" + #include "reparse.h" + ++static int detect_directory_symlink_target(struct cifs_sb_info *cifs_sb, ++ const unsigned int xid, ++ const char *full_path, ++ const char *symname, ++ bool *directory); ++ + int smb2_create_reparse_symlink(const unsigned int xid, struct inode *inode, + struct dentry *dentry, struct cifs_tcon *tcon, + const char *full_path, const char *symname) +@@ -24,6 +30,7 @@ int smb2_create_reparse_symlink(const unsigned int xid, struct inode *inode, + struct inode *new; + struct kvec iov; + __le16 *path; ++ bool directory; + char *sym, sep = CIFS_DIR_SEP(cifs_sb); + u16 len, plen; + int rc = 0; +@@ -45,6 +52,18 @@ int smb2_create_reparse_symlink(const unsigned int xid, struct inode *inode, + goto out; + } + ++ /* ++ * SMB distinguish between symlink to directory and symlink to file. ++ * They cannot be exchanged (symlink of file type which points to ++ * directory cannot be resolved and vice-versa). Try to detect if ++ * the symlink target could be a directory or not. When detection ++ * fails then treat symlink as a file (non-directory) symlink. ++ */ ++ directory = false; ++ rc = detect_directory_symlink_target(cifs_sb, xid, full_path, symname, &directory); ++ if (rc < 0) ++ goto out; ++ + plen = 2 * UniStrnlen((wchar_t *)path, PATH_MAX); + len = sizeof(*buf) + plen * 2; + buf = kzalloc(len, GFP_KERNEL); +@@ -69,7 +88,8 @@ int smb2_create_reparse_symlink(const unsigned int xid, struct inode *inode, + iov.iov_base = buf; + iov.iov_len = len; + new = smb2_get_reparse_inode(&data, inode->i_sb, xid, +- tcon, full_path, &iov, NULL); ++ tcon, full_path, directory, ++ &iov, NULL); + if (!IS_ERR(new)) + d_instantiate(dentry, new); + else +@@ -81,6 +101,144 @@ int smb2_create_reparse_symlink(const unsigned int xid, struct inode *inode, + return rc; + } + ++static int detect_directory_symlink_target(struct cifs_sb_info *cifs_sb, ++ const unsigned int xid, ++ const char *full_path, ++ const char *symname, ++ bool *directory) ++{ ++ char sep = CIFS_DIR_SEP(cifs_sb); ++ struct cifs_open_parms oparms; ++ struct tcon_link *tlink; ++ struct cifs_tcon *tcon; ++ const char *basename; ++ struct cifs_fid fid; ++ char *resolved_path; ++ int full_path_len; ++ int basename_len; ++ int symname_len; ++ char *path_sep; ++ __u32 oplock; ++ int open_rc; ++ ++ /* ++ * First do some simple check. If the original Linux symlink target ends ++ * with slash, or last path component is dot or dot-dot then it is for ++ * sure symlink to the directory. ++ */ ++ basename = kbasename(symname); ++ basename_len = strlen(basename); ++ if (basename_len == 0 || /* symname ends with slash */ ++ (basename_len == 1 && basename[0] == '.') || /* last component is "." */ ++ (basename_len == 2 && basename[0] == '.' && basename[1] == '.')) { /* or ".." */ ++ *directory = true; ++ return 0; ++ } ++ ++ /* ++ * For absolute symlinks it is not possible to determinate ++ * if it should point to directory or file. ++ */ ++ if (symname[0] == '/') { ++ cifs_dbg(FYI, ++ "%s: cannot determinate if the symlink target path '%s' " ++ "is directory or not, creating '%s' as file symlink\n", ++ __func__, symname, full_path); ++ return 0; ++ } ++ ++ /* ++ * If it was not detected as directory yet and the symlink is relative ++ * then try to resolve the path on the SMB server, check if the path ++ * exists and determinate if it is a directory or not. ++ */ ++ ++ full_path_len = strlen(full_path); ++ symname_len = strlen(symname); ++ ++ tlink = cifs_sb_tlink(cifs_sb); ++ if (IS_ERR(tlink)) ++ return PTR_ERR(tlink); ++ ++ resolved_path = kzalloc(full_path_len + symname_len + 1, GFP_KERNEL); ++ if (!resolved_path) { ++ cifs_put_tlink(tlink); ++ return -ENOMEM; ++ } ++ ++ /* ++ * Compose the resolved SMB symlink path from the SMB full path ++ * and Linux target symlink path. ++ */ ++ memcpy(resolved_path, full_path, full_path_len+1); ++ path_sep = strrchr(resolved_path, sep); ++ if (path_sep) ++ path_sep++; ++ else ++ path_sep = resolved_path; ++ memcpy(path_sep, symname, symname_len+1); ++ if (sep == '\\') ++ convert_delimiter(path_sep, sep); ++ ++ tcon = tlink_tcon(tlink); ++ oparms = CIFS_OPARMS(cifs_sb, tcon, resolved_path, ++ FILE_READ_ATTRIBUTES, FILE_OPEN, 0, ACL_NO_MODE); ++ oparms.fid = &fid; ++ ++ /* Try to open as a directory (NOT_FILE) */ ++ oplock = 0; ++ oparms.create_options = cifs_create_options(cifs_sb, ++ CREATE_NOT_FILE | OPEN_REPARSE_POINT); ++ open_rc = tcon->ses->server->ops->open(xid, &oparms, &oplock, NULL); ++ if (open_rc == 0) { ++ /* Successful open means that the target path is definitely a directory. */ ++ *directory = true; ++ tcon->ses->server->ops->close(xid, tcon, &fid); ++ } else if (open_rc == -ENOTDIR) { ++ /* -ENOTDIR means that the target path is definitely a file. */ ++ *directory = false; ++ } else if (open_rc == -ENOENT) { ++ /* -ENOENT means that the target path does not exist. */ ++ cifs_dbg(FYI, ++ "%s: symlink target path '%s' does not exist, " ++ "creating '%s' as file symlink\n", ++ __func__, symname, full_path); ++ } else { ++ /* Try to open as a file (NOT_DIR) */ ++ oplock = 0; ++ oparms.create_options = cifs_create_options(cifs_sb, ++ CREATE_NOT_DIR | OPEN_REPARSE_POINT); ++ open_rc = tcon->ses->server->ops->open(xid, &oparms, &oplock, NULL); ++ if (open_rc == 0) { ++ /* Successful open means that the target path is definitely a file. */ ++ *directory = false; ++ tcon->ses->server->ops->close(xid, tcon, &fid); ++ } else if (open_rc == -EISDIR) { ++ /* -EISDIR means that the target path is definitely a directory. */ ++ *directory = true; ++ } else { ++ /* ++ * This code branch is called when we do not have a permission to ++ * open the resolved_path or some other client/process denied ++ * opening the resolved_path. ++ * ++ * TODO: Try to use ops->query_dir_first on the parent directory ++ * of resolved_path, search for basename of resolved_path and ++ * check if the ATTR_DIRECTORY is set in fi.Attributes. In some ++ * case this could work also when opening of the path is denied. ++ */ ++ cifs_dbg(FYI, ++ "%s: cannot determinate if the symlink target path '%s' " ++ "is directory or not, creating '%s' as file symlink\n", ++ __func__, symname, full_path); ++ } ++ } ++ ++ kfree(resolved_path); ++ cifs_put_tlink(tlink); ++ return 0; ++} ++ + static int nfs_set_reparse_buf(struct reparse_posix_data *buf, + mode_t mode, dev_t dev, + struct kvec *iov) +@@ -137,7 +295,7 @@ static int mknod_nfs(unsigned int xid, struct inode *inode, + }; + + new = smb2_get_reparse_inode(&data, inode->i_sb, xid, +- tcon, full_path, &iov, NULL); ++ tcon, full_path, false, &iov, NULL); + if (!IS_ERR(new)) + d_instantiate(dentry, new); + else +@@ -283,7 +441,7 @@ static int mknod_wsl(unsigned int xid, struct inode *inode, + data.wsl.eas_len = len; + + new = smb2_get_reparse_inode(&data, inode->i_sb, +- xid, tcon, full_path, ++ xid, tcon, full_path, false, + &reparse_iov, &xattr_iov); + if (!IS_ERR(new)) + d_instantiate(dentry, new); +diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c +index a6dab60e2c01e..cdb0e028e73c4 100644 +--- a/fs/smb/client/smb2inode.c ++++ b/fs/smb/client/smb2inode.c +@@ -1198,6 +1198,7 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data, + const unsigned int xid, + struct cifs_tcon *tcon, + const char *full_path, ++ bool directory, + struct kvec *reparse_iov, + struct kvec *xattr_iov) + { +@@ -1217,7 +1218,7 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data, + FILE_READ_ATTRIBUTES | + FILE_WRITE_ATTRIBUTES, + FILE_CREATE, +- CREATE_NOT_DIR | OPEN_REPARSE_POINT, ++ (directory ? CREATE_NOT_FILE : CREATE_NOT_DIR) | OPEN_REPARSE_POINT, + ACL_NO_MODE); + if (xattr_iov) + oparms.ea_cctx = xattr_iov; +diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h +index b208232b12a24..5e0855fefcfe6 100644 +--- a/fs/smb/client/smb2proto.h ++++ b/fs/smb/client/smb2proto.h +@@ -61,6 +61,7 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data, + const unsigned int xid, + struct cifs_tcon *tcon, + const char *full_path, ++ bool directory, + struct kvec *reparse_iov, + struct kvec *xattr_iov); + int smb2_query_reparse_point(const unsigned int xid, +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-add-rough-attr-alloc_size-check.patch b/queue-6.11/fs-ntfs3-add-rough-attr-alloc_size-check.patch new file mode 100644 index 00000000000..ca8bfc01828 --- /dev/null +++ b/queue-6.11/fs-ntfs3-add-rough-attr-alloc_size-check.patch @@ -0,0 +1,33 @@ +From d2b5a5dea45fed7a08c5ccda19ec9e10e1ff5c70 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Aug 2024 16:26:59 +0300 +Subject: fs/ntfs3: Add rough attr alloc_size check + +From: Konstantin Komarov + +[ Upstream commit c4a8ba334262e9a5c158d618a4820e1b9c12495c ] + +Reported-by: syzbot+c6d94bedd910a8216d25@syzkaller.appspotmail.com +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/record.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c +index 2a375247b3c09..427c71be0f087 100644 +--- a/fs/ntfs3/record.c ++++ b/fs/ntfs3/record.c +@@ -331,6 +331,9 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr) + + if (attr->nres.c_unit) + return NULL; ++ ++ if (alloc_size > mi->sbi->volume.size) ++ return NULL; + } + + return attr; +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-additional-check-in-ni_clear.patch b/queue-6.11/fs-ntfs3-additional-check-in-ni_clear.patch new file mode 100644 index 00000000000..da03deda1f0 --- /dev/null +++ b/queue-6.11/fs-ntfs3-additional-check-in-ni_clear.patch @@ -0,0 +1,37 @@ +From 74a152fc7277f1164e5b896ca626cb6108a686dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Sep 2024 15:39:10 +0300 +Subject: fs/ntfs3: Additional check in ni_clear() + +From: Konstantin Komarov + +[ Upstream commit d178944db36b3369b78a08ba520de109b89bf2a9 ] + +Checking of NTFS_FLAGS_LOG_REPLAYING added to prevent access to +uninitialized bitmap during replay process. + +Reported-by: syzbot+3bfd2cc059ab93efcdb4@syzkaller.appspotmail.com +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/frecord.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c +index 60c975ac38e61..2a017b5c8101f 100644 +--- a/fs/ntfs3/frecord.c ++++ b/fs/ntfs3/frecord.c +@@ -102,7 +102,9 @@ void ni_clear(struct ntfs_inode *ni) + { + struct rb_node *node; + +- if (!ni->vfs_inode.i_nlink && ni->mi.mrec && is_rec_inuse(ni->mi.mrec)) ++ if (!ni->vfs_inode.i_nlink && ni->mi.mrec && ++ is_rec_inuse(ni->mi.mrec) && ++ !(ni->mi.sbi->flags & NTFS_FLAGS_LOG_REPLAYING)) + ni_delete_all(ni); + + al_destroy(ni); +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-additional-check-in-ntfs_file_release.patch b/queue-6.11/fs-ntfs3-additional-check-in-ntfs_file_release.patch new file mode 100644 index 00000000000..035dc86e446 --- /dev/null +++ b/queue-6.11/fs-ntfs3-additional-check-in-ntfs_file_release.patch @@ -0,0 +1,39 @@ +From 779f1461448572a15b14f13b5b5ba9ef5f205098 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Sep 2024 12:57:31 +0300 +Subject: fs/ntfs3: Additional check in ntfs_file_release + +From: Konstantin Komarov + +[ Upstream commit 031d6f608290c847ba6378322d0986d08d1a645a ] + +Reported-by: syzbot+8c652f14a0fde76ff11d@syzkaller.appspotmail.com +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/file.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c +index d31eae611fe06..906ee60d91cb1 100644 +--- a/fs/ntfs3/file.c ++++ b/fs/ntfs3/file.c +@@ -1285,7 +1285,14 @@ static int ntfs_file_release(struct inode *inode, struct file *file) + /* If we are last writer on the inode, drop the block reservation. */ + if (sbi->options->prealloc && + ((file->f_mode & FMODE_WRITE) && +- atomic_read(&inode->i_writecount) == 1)) { ++ atomic_read(&inode->i_writecount) == 1) ++ /* ++ * The only file when inode->i_fop = &ntfs_file_operations and ++ * init_rwsem(&ni->file.run_lock) is not called explicitly is MFT. ++ * ++ * Add additional check here. ++ */ ++ && inode->i_ino != MFT_REC_MFT) { + ni_lock(ni); + down_write(&ni->file.run_lock); + +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-check-if-more-than-chunk-size-bytes-are-wri.patch b/queue-6.11/fs-ntfs3-check-if-more-than-chunk-size-bytes-are-wri.patch new file mode 100644 index 00000000000..a92ff9fe8b7 --- /dev/null +++ b/queue-6.11/fs-ntfs3-check-if-more-than-chunk-size-bytes-are-wri.patch @@ -0,0 +1,37 @@ +From 666efea879e0ec8fc6198f04ffc048423d130514 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 May 2024 07:38:33 -0500 +Subject: fs/ntfs3: Check if more than chunk-size bytes are written + +From: Andrew Ballance + +[ Upstream commit 9931122d04c6d431b2c11b5bb7b10f28584067f0 ] + +A incorrectly formatted chunk may decompress into +more than LZNT_CHUNK_SIZE bytes and a index out of bounds +will occur in s_max_off. + +Signed-off-by: Andrew Ballance +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/lznt.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c +index 4aae598d6d884..fdc9b2ebf3410 100644 +--- a/fs/ntfs3/lznt.c ++++ b/fs/ntfs3/lznt.c +@@ -236,6 +236,9 @@ static inline ssize_t decompress_chunk(u8 *unc, u8 *unc_end, const u8 *cmpr, + + /* Do decompression until pointers are inside range. */ + while (up < unc_end && cmpr < cmpr_end) { ++ // return err if more than LZNT_CHUNK_SIZE bytes are written ++ if (up - unc > LZNT_CHUNK_SIZE) ++ return -EINVAL; + /* Correct index */ + while (unc + s_max_off[index] < up) + index += 1; +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-fix-general-protection-fault-in-run_is_mapp.patch b/queue-6.11/fs-ntfs3-fix-general-protection-fault-in-run_is_mapp.patch new file mode 100644 index 00000000000..d42082a76c7 --- /dev/null +++ b/queue-6.11/fs-ntfs3-fix-general-protection-fault-in-run_is_mapp.patch @@ -0,0 +1,38 @@ +From 178076d2dd4c0eb103af34b252fc7cb8f1301311 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Aug 2024 13:50:18 +0300 +Subject: fs/ntfs3: Fix general protection fault in run_is_mapped_full + +From: Konstantin Komarov + +[ Upstream commit a33fb016e49e37aafab18dc3c8314d6399cb4727 ] + +Fixed deleating of a non-resident attribute in ntfs_create_inode() +rollback. + +Reported-by: syzbot+9af29acd8f27fbce94bc@syzkaller.appspotmail.com +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/inode.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c +index 56b6c4c6f528f..4804eb9628bb2 100644 +--- a/fs/ntfs3/inode.c ++++ b/fs/ntfs3/inode.c +@@ -1717,7 +1717,10 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, + attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL); + if (attr && attr->non_res) { + /* Delete ATTR_EA, if non-resident. */ +- attr_set_size(ni, ATTR_EA, NULL, 0, NULL, 0, NULL, false, NULL); ++ struct runs_tree run; ++ run_init(&run); ++ attr_set_size(ni, ATTR_EA, NULL, 0, &run, 0, NULL, false, NULL); ++ run_close(&run); + } + + if (rp_inserted) +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-fix-possible-deadlock-in-mi_read.patch b/queue-6.11/fs-ntfs3-fix-possible-deadlock-in-mi_read.patch new file mode 100644 index 00000000000..ea1120a8933 --- /dev/null +++ b/queue-6.11/fs-ntfs3-fix-possible-deadlock-in-mi_read.patch @@ -0,0 +1,34 @@ +From 8a5d699b525b6b8e7ef62f82c1916c84a978494d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Aug 2024 11:55:53 +0300 +Subject: fs/ntfs3: Fix possible deadlock in mi_read + +From: Konstantin Komarov + +[ Upstream commit 03b097099eef255fbf85ea6a786ae3c91b11f041 ] + +Mutex lock with another subclass used in ni_lock_dir(). + +Reported-by: syzbot+bc7ca0ae4591cb2550f9@syzkaller.appspotmail.com +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/namei.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c +index 0a70c36585463..02b745f117a51 100644 +--- a/fs/ntfs3/namei.c ++++ b/fs/ntfs3/namei.c +@@ -81,7 +81,7 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry, + if (err < 0) + inode = ERR_PTR(err); + else { +- ni_lock(ni); ++ ni_lock_dir(ni); + inode = dir_search_u(dir, uni, NULL); + ni_unlock(ni); + } +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-fix-warning-possible-deadlock-in-ntfs_set_s.patch b/queue-6.11/fs-ntfs3-fix-warning-possible-deadlock-in-ntfs_set_s.patch new file mode 100644 index 00000000000..53b39f5f889 --- /dev/null +++ b/queue-6.11/fs-ntfs3-fix-warning-possible-deadlock-in-ntfs_set_s.patch @@ -0,0 +1,34 @@ +From e457bb2e100252787ad65eec1c17c1ac576e7c9a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Aug 2024 16:26:22 +0300 +Subject: fs/ntfs3: Fix warning possible deadlock in ntfs_set_state + +From: Konstantin Komarov + +[ Upstream commit 5b2db723455a89dc96743d34d8bdaa23a402db2f ] + +Use non-zero subkey to skip analyzer warnings. + +Signed-off-by: Konstantin Komarov +Reported-by: syzbot+c2ada45c23d98d646118@syzkaller.appspotmail.com +Signed-off-by: Sasha Levin +--- + fs/ntfs3/ntfs_fs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h +index e5255a251929a..79047cd546117 100644 +--- a/fs/ntfs3/ntfs_fs.h ++++ b/fs/ntfs3/ntfs_fs.h +@@ -334,7 +334,7 @@ struct mft_inode { + + /* Nested class for ntfs_inode::ni_lock. */ + enum ntfs_inode_mutex_lock_class { +- NTFS_INODE_MUTEX_DIRTY, ++ NTFS_INODE_MUTEX_DIRTY = 1, + NTFS_INODE_MUTEX_SECURITY, + NTFS_INODE_MUTEX_OBJID, + NTFS_INODE_MUTEX_REPARSE, +-- +2.43.0 + diff --git a/queue-6.11/fs-ntfs3-stale-inode-instead-of-bad.patch b/queue-6.11/fs-ntfs3-stale-inode-instead-of-bad.patch new file mode 100644 index 00000000000..3e665058a8b --- /dev/null +++ b/queue-6.11/fs-ntfs3-stale-inode-instead-of-bad.patch @@ -0,0 +1,43 @@ +From 265a970f1107c0693c108e2d69d8da32de268a05 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 22 Aug 2024 14:43:32 +0300 +Subject: fs/ntfs3: Stale inode instead of bad + +From: Konstantin Komarov + +[ Upstream commit 1fd21919de6de245b63066b8ee3cfba92e36f0e9 ] + +Fixed the logic of processing inode with wrong sequence number. + +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/inode.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c +index 6b0bdc474e763..56b6c4c6f528f 100644 +--- a/fs/ntfs3/inode.c ++++ b/fs/ntfs3/inode.c +@@ -536,11 +536,15 @@ struct inode *ntfs_iget5(struct super_block *sb, const struct MFT_REF *ref, + if (inode->i_state & I_NEW) + inode = ntfs_read_mft(inode, name, ref); + else if (ref->seq != ntfs_i(inode)->mi.mrec->seq) { +- /* Inode overlaps? */ +- _ntfs_bad_inode(inode); ++ /* ++ * Sequence number is not expected. ++ * Looks like inode was reused but caller uses the old reference ++ */ ++ iput(inode); ++ inode = ERR_PTR(-ESTALE); + } + +- if (IS_ERR(inode) && name) ++ if (IS_ERR(inode)) + ntfs_set_state(sb->s_fs_info, NTFS_DIRTY_ERROR); + + return inode; +-- +2.43.0 + diff --git a/queue-6.11/misc-sgi-gru-don-t-disable-preemption-in-gru-driver.patch b/queue-6.11/misc-sgi-gru-don-t-disable-preemption-in-gru-driver.patch new file mode 100644 index 00000000000..e7105ca63e0 --- /dev/null +++ b/queue-6.11/misc-sgi-gru-don-t-disable-preemption-in-gru-driver.patch @@ -0,0 +1,96 @@ +From 8abee73be91462651327e8426cc6ce82ac233a81 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Sep 2024 07:34:50 -0500 +Subject: misc: sgi-gru: Don't disable preemption in GRU driver + +From: Dimitri Sivanich + +[ Upstream commit b983b271662bd6104d429b0fd97af3333ba760bf ] + +Disabling preemption in the GRU driver is unnecessary, and clashes with +sleeping locks in several code paths. Remove preempt_disable and +preempt_enable from the GRU driver. + +Signed-off-by: Dimitri Sivanich +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + drivers/misc/sgi-gru/grukservices.c | 2 -- + drivers/misc/sgi-gru/grumain.c | 4 ---- + drivers/misc/sgi-gru/grutlbpurge.c | 2 -- + 3 files changed, 8 deletions(-) + +diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c +index 37e804bbb1f28..205945ce9e86a 100644 +--- a/drivers/misc/sgi-gru/grukservices.c ++++ b/drivers/misc/sgi-gru/grukservices.c +@@ -258,7 +258,6 @@ static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr) + int lcpu; + + BUG_ON(dsr_bytes > GRU_NUM_KERNEL_DSR_BYTES); +- preempt_disable(); + bs = gru_lock_kernel_context(-1); + lcpu = uv_blade_processor_id(); + *cb = bs->kernel_cb + lcpu * GRU_HANDLE_STRIDE; +@@ -272,7 +271,6 @@ static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr) + static void gru_free_cpu_resources(void *cb, void *dsr) + { + gru_unlock_kernel_context(uv_numa_blade_id()); +- preempt_enable(); + } + + /* +diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c +index 0f5b09e290c89..3036c15f36892 100644 +--- a/drivers/misc/sgi-gru/grumain.c ++++ b/drivers/misc/sgi-gru/grumain.c +@@ -937,10 +937,8 @@ vm_fault_t gru_fault(struct vm_fault *vmf) + + again: + mutex_lock(>s->ts_ctxlock); +- preempt_disable(); + + if (gru_check_context_placement(gts)) { +- preempt_enable(); + mutex_unlock(>s->ts_ctxlock); + gru_unload_context(gts, 1); + return VM_FAULT_NOPAGE; +@@ -949,7 +947,6 @@ vm_fault_t gru_fault(struct vm_fault *vmf) + if (!gts->ts_gru) { + STAT(load_user_context); + if (!gru_assign_gru_context(gts)) { +- preempt_enable(); + mutex_unlock(>s->ts_ctxlock); + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(GRU_ASSIGN_DELAY); /* true hack ZZZ */ +@@ -965,7 +962,6 @@ vm_fault_t gru_fault(struct vm_fault *vmf) + vma->vm_page_prot); + } + +- preempt_enable(); + mutex_unlock(>s->ts_ctxlock); + + return VM_FAULT_NOPAGE; +diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c +index 10921cd2608df..1107dd3e2e9fa 100644 +--- a/drivers/misc/sgi-gru/grutlbpurge.c ++++ b/drivers/misc/sgi-gru/grutlbpurge.c +@@ -65,7 +65,6 @@ static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_state + struct gru_tlb_global_handle *tgh; + int n; + +- preempt_disable(); + if (uv_numa_blade_id() == gru->gs_blade_id) + n = get_on_blade_tgh(gru); + else +@@ -79,7 +78,6 @@ static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_state + static void get_unlock_tgh_handle(struct gru_tlb_global_handle *tgh) + { + unlock_tgh_handle(tgh); +- preempt_enable(); + } + + /* +-- +2.43.0 + diff --git a/queue-6.11/net-amd-mvme147-fix-probe-banner-message.patch b/queue-6.11/net-amd-mvme147-fix-probe-banner-message.patch new file mode 100644 index 00000000000..ccb924c1f6a --- /dev/null +++ b/queue-6.11/net-amd-mvme147-fix-probe-banner-message.patch @@ -0,0 +1,53 @@ +From 5037b41dc4d09100debc2d5377fb1e82736cf70a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 7 Oct 2024 19:43:17 +0900 +Subject: net: amd: mvme147: Fix probe banner message + +From: Daniel Palmer + +[ Upstream commit 82c5b53140faf89c31ea2b3a0985a2f291694169 ] + +Currently this driver prints this line with what looks like +a rogue format specifier when the device is probed: +[ 2.840000] eth%d: MVME147 at 0xfffe1800, irq 12, Hardware Address xx:xx:xx:xx:xx:xx + +Change the printk() for netdev_info() and move it after the +registration has completed so it prints out the name of the +interface properly. + +Signed-off-by: Daniel Palmer +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amd/mvme147.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/amd/mvme147.c b/drivers/net/ethernet/amd/mvme147.c +index c156566c09064..f19b04b92fa9f 100644 +--- a/drivers/net/ethernet/amd/mvme147.c ++++ b/drivers/net/ethernet/amd/mvme147.c +@@ -105,10 +105,6 @@ static struct net_device * __init mvme147lance_probe(void) + macaddr[3] = address&0xff; + eth_hw_addr_set(dev, macaddr); + +- printk("%s: MVME147 at 0x%08lx, irq %d, Hardware Address %pM\n", +- dev->name, dev->base_addr, MVME147_LANCE_IRQ, +- dev->dev_addr); +- + lp = netdev_priv(dev); + lp->ram = __get_dma_pages(GFP_ATOMIC, 3); /* 32K */ + if (!lp->ram) { +@@ -138,6 +134,9 @@ static struct net_device * __init mvme147lance_probe(void) + return ERR_PTR(err); + } + ++ netdev_info(dev, "MVME147 at 0x%08lx, irq %d, Hardware Address %pM\n", ++ dev->base_addr, MVME147_LANCE_IRQ, dev->dev_addr); ++ + return dev; + } + +-- +2.43.0 + diff --git a/queue-6.11/nfs-remove-revoked-delegation-from-server-s-delegati.patch b/queue-6.11/nfs-remove-revoked-delegation-from-server-s-delegati.patch new file mode 100644 index 00000000000..53e9485d7df --- /dev/null +++ b/queue-6.11/nfs-remove-revoked-delegation-from-server-s-delegati.patch @@ -0,0 +1,56 @@ +From 867d67b873c029b1200f6b532cd8dc803aad5125 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Oct 2024 15:58:07 -0700 +Subject: NFS: remove revoked delegation from server's delegation list + +From: Dai Ngo + +[ Upstream commit 7ef60108069b7e3cc66432304e1dd197d5c0a9b5 ] + +After the delegation is returned to the NFS server remove it +from the server's delegations list to reduce the time it takes +to scan this list. + +Network trace captured while running the below script shows the +time taken to service the CB_RECALL increases gradually due to +the overhead of traversing the delegation list in +nfs_delegation_find_inode_server. + +The NFS server in this test is a Solaris server which issues +CB_RECALL when receiving the all-zero stateid in the SETATTR. + +mount=/mnt/data +for i in $(seq 1 20) +do + echo $i + mkdir $mount/testtarfile$i + time tar -C $mount/testtarfile$i -xf 5000_files.tar +done + +Signed-off-by: Dai Ngo +Reviewed-by: Trond Myklebust +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/delegation.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c +index 20cb2008f9e46..035ba52742a50 100644 +--- a/fs/nfs/delegation.c ++++ b/fs/nfs/delegation.c +@@ -1001,6 +1001,11 @@ void nfs_delegation_mark_returned(struct inode *inode, + } + + nfs_mark_delegation_revoked(delegation); ++ clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags); ++ spin_unlock(&delegation->lock); ++ if (nfs_detach_delegation(NFS_I(inode), delegation, NFS_SERVER(inode))) ++ nfs_put_delegation(delegation); ++ goto out_rcu_unlock; + + out_clear_returning: + clear_bit(NFS_DELEGATION_RETURNING, &delegation->flags); +-- +2.43.0 + diff --git a/queue-6.11/ntfs3-add-bounds-checking-to-mi_enum_attr.patch b/queue-6.11/ntfs3-add-bounds-checking-to-mi_enum_attr.patch new file mode 100644 index 00000000000..cfebf030ce7 --- /dev/null +++ b/queue-6.11/ntfs3-add-bounds-checking-to-mi_enum_attr.patch @@ -0,0 +1,72 @@ +From 061fbdaa3aa9c6fa798d067e45ddeb39f914e571 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Aug 2024 21:39:44 +0800 +Subject: ntfs3: Add bounds checking to mi_enum_attr() + +From: lei lu + +[ Upstream commit 556bdf27c2dd5c74a9caacbe524b943a6cd42d99 ] + +Added bounds checking to make sure that every attr don't stray beyond +valid memory region. + +Signed-off-by: lei lu +Signed-off-by: Konstantin Komarov +Signed-off-by: Sasha Levin +--- + fs/ntfs3/record.c | 23 ++++++++++------------- + 1 file changed, 10 insertions(+), 13 deletions(-) + +diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c +index 6c76503edc200..2a375247b3c09 100644 +--- a/fs/ntfs3/record.c ++++ b/fs/ntfs3/record.c +@@ -223,28 +223,19 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr) + prev_type = 0; + attr = Add2Ptr(rec, off); + } else { +- /* Check if input attr inside record. */ ++ /* ++ * We don't need to check previous attr here. There is ++ * a bounds checking in the previous round. ++ */ + off = PtrOffset(rec, attr); +- if (off >= used) +- return NULL; + + asize = le32_to_cpu(attr->size); +- if (asize < SIZEOF_RESIDENT) { +- /* Impossible 'cause we should not return such attribute. */ +- return NULL; +- } +- +- /* Overflow check. */ +- if (off + asize < off) +- return NULL; + + prev_type = le32_to_cpu(attr->type); + attr = Add2Ptr(attr, asize); + off += asize; + } + +- asize = le32_to_cpu(attr->size); +- + /* Can we use the first field (attr->type). */ + if (off + 8 > used) { + static_assert(ALIGN(sizeof(enum ATTR_TYPE), 8) == 8); +@@ -265,6 +256,12 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr) + if (t32 < prev_type) + return NULL; + ++ asize = le32_to_cpu(attr->size); ++ if (asize < SIZEOF_RESIDENT) { ++ /* Impossible 'cause we should not return such attribute. */ ++ return NULL; ++ } ++ + /* Check overflow and boundary. */ + if (off + asize < off || off + asize > used) + return NULL; +-- +2.43.0 + diff --git a/queue-6.11/powercap-intel_rapl_msr-add-pl4-support-for-arrowlak.patch b/queue-6.11/powercap-intel_rapl_msr-add-pl4-support-for-arrowlak.patch new file mode 100644 index 00000000000..12e9efcf817 --- /dev/null +++ b/queue-6.11/powercap-intel_rapl_msr-add-pl4-support-for-arrowlak.patch @@ -0,0 +1,36 @@ +From 42ca60424e90801e30bbc100e7242df79c4429e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Sep 2024 16:17:59 +0800 +Subject: powercap: intel_rapl_msr: Add PL4 support for Arrowlake-U + +From: Sumeet Pawnikar + +[ Upstream commit f517ff174ab79dd59f538a9aa2770cd3ee6dd48b ] + +Add PL4 support for ArrowLake-U platform. + +Signed-off-by: Sumeet Pawnikar +Signed-off-by: Zhang Rui +Reviewed-by: Srinivas Pandruvada +Link: https://patch.msgid.link/20240930081801.28502-5-rui.zhang@intel.com +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/powercap/intel_rapl_msr.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/powercap/intel_rapl_msr.c b/drivers/powercap/intel_rapl_msr.c +index 733a36f67fbc6..1f4c5389676ac 100644 +--- a/drivers/powercap/intel_rapl_msr.c ++++ b/drivers/powercap/intel_rapl_msr.c +@@ -147,6 +147,7 @@ static const struct x86_cpu_id pl4_support_ids[] = { + X86_MATCH_VFM(INTEL_RAPTORLAKE_P, NULL), + X86_MATCH_VFM(INTEL_METEORLAKE, NULL), + X86_MATCH_VFM(INTEL_METEORLAKE_L, NULL), ++ X86_MATCH_VFM(INTEL_ARROWLAKE_U, NULL), + {} + }; + +-- +2.43.0 + diff --git a/queue-6.11/rust-device-change-the-from_raw-function.patch b/queue-6.11/rust-device-change-the-from_raw-function.patch new file mode 100644 index 00000000000..9fb9a833939 --- /dev/null +++ b/queue-6.11/rust-device-change-the-from_raw-function.patch @@ -0,0 +1,76 @@ +From ab50b8c2fdf5688de2908bc767015e143b8c49a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2024 17:56:03 -0300 +Subject: rust: device: change the from_raw() function + +From: Guilherme Giacomo Simoes + +[ Upstream commit cc4332afb5631b0e9d2ce5699b7f4b7caf743526 ] + +The function Device::from_raw() increments a refcount by a call to +bindings::get_device(ptr). This can be confused because usually +from_raw() functions don't increment a refcount. +Hence, rename Device::from_raw() to avoid confuion with other "from_raw" +semantics. + +The new name of function should be "get_device" to be consistent with +the function get_device() already exist in .c files. + +This function body also changed, because the `into()` will convert the +`&'a Device` into `ARef` and also call `inc_ref` from the +`AlwaysRefCounted` trait implemented for Device. + +Signed-off-by: Guilherme Giacomo Simoes +Acked-by: Danilo Krummrich +Closes: https://github.com/Rust-for-Linux/linux/issues/1088 +Reviewed-by: Boqun Feng +Link: https://lore.kernel.org/r/20241001205603.106278-1-trintaeoitogc@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + rust/kernel/device.rs | 15 +++------------ + rust/kernel/firmware.rs | 2 +- + 2 files changed, 4 insertions(+), 13 deletions(-) + +diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs +index 851018eef885e..c8199ee079eff 100644 +--- a/rust/kernel/device.rs ++++ b/rust/kernel/device.rs +@@ -51,18 +51,9 @@ impl Device { + /// + /// It must also be ensured that `bindings::device::release` can be called from any thread. + /// While not officially documented, this should be the case for any `struct device`. +- pub unsafe fn from_raw(ptr: *mut bindings::device) -> ARef { +- // SAFETY: By the safety requirements, ptr is valid. +- // Initially increase the reference count by one to compensate for the final decrement once +- // this newly created `ARef` instance is dropped. +- unsafe { bindings::get_device(ptr) }; +- +- // CAST: `Self` is a `repr(transparent)` wrapper around `bindings::device`. +- let ptr = ptr.cast::(); +- +- // SAFETY: `ptr` is valid by the safety requirements of this function. By the above call to +- // `bindings::get_device` we also own a reference to the underlying `struct device`. +- unsafe { ARef::from_raw(ptr::NonNull::new_unchecked(ptr)) } ++ pub unsafe fn get_device(ptr: *mut bindings::device) -> ARef { ++ // SAFETY: By the safety requirements ptr is valid ++ unsafe { Self::as_ref(ptr) }.into() + } + + /// Obtain the raw `struct device *`. +diff --git a/rust/kernel/firmware.rs b/rust/kernel/firmware.rs +index dee5b4b18aec4..13a374a5cdb74 100644 +--- a/rust/kernel/firmware.rs ++++ b/rust/kernel/firmware.rs +@@ -44,7 +44,7 @@ fn request_nowarn() -> Self { + /// + /// # fn no_run() -> Result<(), Error> { + /// # // SAFETY: *NOT* safe, just for the example to get an `ARef` instance +-/// # let dev = unsafe { Device::from_raw(core::ptr::null_mut()) }; ++/// # let dev = unsafe { Device::get_device(core::ptr::null_mut()) }; + /// + /// let fw = Firmware::request(c_str!("path/to/firmware.bin"), &dev)?; + /// let blob = fw.data(); +-- +2.43.0 + diff --git a/queue-6.11/scsi-scsi_transport_fc-allow-setting-rport-state-to-.patch b/queue-6.11/scsi-scsi_transport_fc-allow-setting-rport-state-to-.patch new file mode 100644 index 00000000000..49aa1df181f --- /dev/null +++ b/queue-6.11/scsi-scsi_transport_fc-allow-setting-rport-state-to-.patch @@ -0,0 +1,48 @@ +From 4bd8502eaf348649b86080c480c3118813686fdd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Sep 2024 19:06:43 -0400 +Subject: scsi: scsi_transport_fc: Allow setting rport state to current state + +From: Benjamin Marzinski + +[ Upstream commit d539a871ae47a1f27a609a62e06093fa69d7ce99 ] + +The only input fc_rport_set_marginal_state() currently accepts is +"Marginal" when port_state is "Online", and "Online" when the port_state +is "Marginal". It should also allow setting port_state to its current +state, either "Marginal or "Online". + +Signed-off-by: Benjamin Marzinski +Link: https://lore.kernel.org/r/20240917230643.966768-1-bmarzins@redhat.com +Reviewed-by: Ewan D. Milne +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/scsi_transport_fc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c +index 7d088b8da0757..2270732b353c8 100644 +--- a/drivers/scsi/scsi_transport_fc.c ++++ b/drivers/scsi/scsi_transport_fc.c +@@ -1255,7 +1255,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev, + */ + if (rport->port_state == FC_PORTSTATE_ONLINE) + rport->port_state = port_state; +- else ++ else if (port_state != rport->port_state) + return -EINVAL; + } else if (port_state == FC_PORTSTATE_ONLINE) { + /* +@@ -1265,7 +1265,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev, + */ + if (rport->port_state == FC_PORTSTATE_MARGINAL) + rport->port_state = port_state; +- else ++ else if (port_state != rport->port_state) + return -EINVAL; + } else + return -EINVAL; +-- +2.43.0 + diff --git a/queue-6.11/series b/queue-6.11/series index a7b83b6fb44..82a36c9390d 100644 --- a/queue-6.11/series +++ b/queue-6.11/series @@ -88,3 +88,23 @@ nvme-module-parameter-to-disable-pi-with-offsets.patch drm-panthor-fix-firmware-initialization-on-systems-w.patch drm-panthor-fail-job-creation-when-the-group-is-dead.patch drm-panthor-report-group-as-timedout-when-we-fail-to.patch +ntfs3-add-bounds-checking-to-mi_enum_attr.patch +fs-ntfs3-check-if-more-than-chunk-size-bytes-are-wri.patch +fs-ntfs3-fix-warning-possible-deadlock-in-ntfs_set_s.patch +fs-ntfs3-stale-inode-instead-of-bad.patch +fs-ntfs3-add-rough-attr-alloc_size-check.patch +fs-ntfs3-fix-possible-deadlock-in-mi_read.patch +fs-ntfs3-additional-check-in-ni_clear.patch +fs-ntfs3-fix-general-protection-fault-in-run_is_mapp.patch +fs-ntfs3-additional-check-in-ntfs_file_release.patch +rust-device-change-the-from_raw-function.patch +scsi-scsi_transport_fc-allow-setting-rport-state-to-.patch +cifs-improve-creating-native-symlinks-pointing-to-di.patch +cifs-fix-creating-native-symlinks-pointing-to-curren.patch +acpi-resource-fold-asus-vivobook-pro-n6506m-dmi-quir.patch +powercap-intel_rapl_msr-add-pl4-support-for-arrowlak.patch +thermal-intel-int340x-processor-remove-mmio-rapl-cpu.patch +thermal-intel-int340x-processor-add-mmio-rapl-pl4-su.patch +net-amd-mvme147-fix-probe-banner-message.patch +nfs-remove-revoked-delegation-from-server-s-delegati.patch +misc-sgi-gru-don-t-disable-preemption-in-gru-driver.patch diff --git a/queue-6.11/thermal-intel-int340x-processor-add-mmio-rapl-pl4-su.patch b/queue-6.11/thermal-intel-int340x-processor-add-mmio-rapl-pl4-su.patch new file mode 100644 index 00000000000..0ab7db64897 --- /dev/null +++ b/queue-6.11/thermal-intel-int340x-processor-add-mmio-rapl-pl4-su.patch @@ -0,0 +1,44 @@ +From 66fa448cc8b18c4f47303f515b4edbae7c6ffcba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Sep 2024 16:18:01 +0800 +Subject: thermal: intel: int340x: processor: Add MMIO RAPL PL4 support + +From: Zhang Rui + +[ Upstream commit 3fb0eea8a1c4be5884e0731ea76cbd3ce126e1f3 ] + +Similar to the MSR RAPL interface, MMIO RAPL supports PL4 too, so add +MMIO RAPL PL4d support to the processor_thermal driver. + +As a result, the powercap sysfs for MMIO RAPL will show a new "peak +power" constraint. + +Signed-off-by: Zhang Rui +Reviewed-by: Srinivas Pandruvada +Link: https://patch.msgid.link/20240930081801.28502-7-rui.zhang@intel.com +[ rjw: Subject and changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + .../thermal/intel/int340x_thermal/processor_thermal_rapl.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c +index 769510e748c0b..bde2cc386afdd 100644 +--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c ++++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c +@@ -13,9 +13,9 @@ static struct rapl_if_priv rapl_mmio_priv; + + static const struct rapl_mmio_regs rapl_mmio_default = { + .reg_unit = 0x5938, +- .regs[RAPL_DOMAIN_PACKAGE] = { 0x59a0, 0x593c, 0x58f0, 0, 0x5930}, ++ .regs[RAPL_DOMAIN_PACKAGE] = { 0x59a0, 0x593c, 0x58f0, 0, 0x5930, 0x59b0}, + .regs[RAPL_DOMAIN_DRAM] = { 0x58e0, 0x58e8, 0x58ec, 0, 0}, +- .limits[RAPL_DOMAIN_PACKAGE] = BIT(POWER_LIMIT2), ++ .limits[RAPL_DOMAIN_PACKAGE] = BIT(POWER_LIMIT2) | BIT(POWER_LIMIT4), + .limits[RAPL_DOMAIN_DRAM] = BIT(POWER_LIMIT2), + }; + +-- +2.43.0 + diff --git a/queue-6.11/thermal-intel-int340x-processor-remove-mmio-rapl-cpu.patch b/queue-6.11/thermal-intel-int340x-processor-remove-mmio-rapl-cpu.patch new file mode 100644 index 00000000000..5c90a3b6e9f --- /dev/null +++ b/queue-6.11/thermal-intel-int340x-processor-remove-mmio-rapl-cpu.patch @@ -0,0 +1,131 @@ +From c65729d0eefdab1451624a23caf6f5e75d5252cc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Sep 2024 16:18:00 +0800 +Subject: thermal: intel: int340x: processor: Remove MMIO RAPL CPU hotplug + support + +From: Zhang Rui + +[ Upstream commit bfc6819e4bf56a55df6178f93241b5845ad672eb ] + +CPU0/package0 is always online and the MMIO RAPL driver runs on single +package systems only, so there is no need to handle CPU hotplug in it. + +Always register a RAPL package device for package 0 and remove the +unnecessary CPU hotplug support. + +Signed-off-by: Zhang Rui +Reviewed-by: Srinivas Pandruvada +Link: https://patch.msgid.link/20240930081801.28502-6-rui.zhang@intel.com +[ rjw: Subject edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + .../int340x_thermal/processor_thermal_rapl.c | 66 +++++++------------ + 1 file changed, 22 insertions(+), 44 deletions(-) + +diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c +index e9aa9e23aab9e..769510e748c0b 100644 +--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c ++++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c +@@ -19,42 +19,6 @@ static const struct rapl_mmio_regs rapl_mmio_default = { + .limits[RAPL_DOMAIN_DRAM] = BIT(POWER_LIMIT2), + }; + +-static int rapl_mmio_cpu_online(unsigned int cpu) +-{ +- struct rapl_package *rp; +- +- /* mmio rapl supports package 0 only for now */ +- if (topology_physical_package_id(cpu)) +- return 0; +- +- rp = rapl_find_package_domain_cpuslocked(cpu, &rapl_mmio_priv, true); +- if (!rp) { +- rp = rapl_add_package_cpuslocked(cpu, &rapl_mmio_priv, true); +- if (IS_ERR(rp)) +- return PTR_ERR(rp); +- } +- cpumask_set_cpu(cpu, &rp->cpumask); +- return 0; +-} +- +-static int rapl_mmio_cpu_down_prep(unsigned int cpu) +-{ +- struct rapl_package *rp; +- int lead_cpu; +- +- rp = rapl_find_package_domain_cpuslocked(cpu, &rapl_mmio_priv, true); +- if (!rp) +- return 0; +- +- cpumask_clear_cpu(cpu, &rp->cpumask); +- lead_cpu = cpumask_first(&rp->cpumask); +- if (lead_cpu >= nr_cpu_ids) +- rapl_remove_package_cpuslocked(rp); +- else if (rp->lead_cpu == cpu) +- rp->lead_cpu = lead_cpu; +- return 0; +-} +- + static int rapl_mmio_read_raw(int cpu, struct reg_action *ra) + { + if (!ra->reg.mmio) +@@ -82,6 +46,7 @@ static int rapl_mmio_write_raw(int cpu, struct reg_action *ra) + int proc_thermal_rapl_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv) + { + const struct rapl_mmio_regs *rapl_regs = &rapl_mmio_default; ++ struct rapl_package *rp; + enum rapl_domain_reg_id reg; + enum rapl_domain_type domain; + int ret; +@@ -109,25 +74,38 @@ int proc_thermal_rapl_add(struct pci_dev *pdev, struct proc_thermal_device *proc + return PTR_ERR(rapl_mmio_priv.control_type); + } + +- ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "powercap/rapl:online", +- rapl_mmio_cpu_online, rapl_mmio_cpu_down_prep); +- if (ret < 0) { +- powercap_unregister_control_type(rapl_mmio_priv.control_type); +- rapl_mmio_priv.control_type = NULL; +- return ret; ++ /* Register a RAPL package device for package 0 which is always online */ ++ rp = rapl_find_package_domain(0, &rapl_mmio_priv, false); ++ if (rp) { ++ ret = -EEXIST; ++ goto err; ++ } ++ ++ rp = rapl_add_package(0, &rapl_mmio_priv, false); ++ if (IS_ERR(rp)) { ++ ret = PTR_ERR(rp); ++ goto err; + } +- rapl_mmio_priv.pcap_rapl_online = ret; + + return 0; ++ ++err: ++ powercap_unregister_control_type(rapl_mmio_priv.control_type); ++ rapl_mmio_priv.control_type = NULL; ++ return ret; + } + EXPORT_SYMBOL_GPL(proc_thermal_rapl_add); + + void proc_thermal_rapl_remove(void) + { ++ struct rapl_package *rp; ++ + if (IS_ERR_OR_NULL(rapl_mmio_priv.control_type)) + return; + +- cpuhp_remove_state(rapl_mmio_priv.pcap_rapl_online); ++ rp = rapl_find_package_domain(0, &rapl_mmio_priv, false); ++ if (rp) ++ rapl_remove_package(rp); + powercap_unregister_control_type(rapl_mmio_priv.control_type); + } + EXPORT_SYMBOL_GPL(proc_thermal_rapl_remove); +-- +2.43.0 +