From: Sasha Levin Date: Fri, 30 Aug 2024 18:38:33 +0000 (-0400) Subject: Fixes for 6.6 X-Git-Tag: v4.19.321~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e60d601583fcfb992284264034d01e320ffd6fe;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.6 Signed-off-by: Sasha Levin --- diff --git a/queue-6.6/asoc-amd-acp-fix-module-autoloading.patch b/queue-6.6/asoc-amd-acp-fix-module-autoloading.patch new file mode 100644 index 00000000000..49a826ef1d9 --- /dev/null +++ b/queue-6.6/asoc-amd-acp-fix-module-autoloading.patch @@ -0,0 +1,37 @@ +From bd92d8fd064952bc4e6ef772a156462fb0b18be0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Aug 2024 08:49:23 +0000 +Subject: ASoC: amd: acp: fix module autoloading + +From: Yuntao Liu + +[ Upstream commit 164199615ae230ace4519141285f06766d6d8036 ] + +Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded +based on the alias from platform_device_id table. + +Fixes: 9d8a7be88b336 ("ASoC: amd: acp: Add legacy sound card support for Chrome audio") +Signed-off-by: Yuntao Liu +Link: https://patch.msgid.link/20240815084923.756476-1-liuyuntao12@huawei.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/amd/acp/acp-legacy-mach.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c +index 6d57d17ddfd77..6e820c2edd1d8 100644 +--- a/sound/soc/amd/acp/acp-legacy-mach.c ++++ b/sound/soc/amd/acp/acp-legacy-mach.c +@@ -137,6 +137,8 @@ static const struct platform_device_id board_ids[] = { + }, + { } + }; ++MODULE_DEVICE_TABLE(platform, board_ids); ++ + static struct platform_driver acp_asoc_audio = { + .driver = { + .pm = &snd_soc_pm_ops, +-- +2.43.0 + diff --git a/queue-6.6/asoc-sof-amd-fix-for-acp-init-sequence.patch b/queue-6.6/asoc-sof-amd-fix-for-acp-init-sequence.patch new file mode 100644 index 00000000000..be8281c2462 --- /dev/null +++ b/queue-6.6/asoc-sof-amd-fix-for-acp-init-sequence.patch @@ -0,0 +1,86 @@ +From 1ec6954cc6114f61f752995a39b1343df7a6cdd0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Aug 2024 12:33:28 +0530 +Subject: ASoC: SOF: amd: Fix for acp init sequence + +From: Vijendar Mukunda + +[ Upstream commit a42db293e5983aa1508d12644f23d73f0553b32c ] + +When ACP is not powered on by default, acp power on sequence explicitly +invoked by programming pgfsm control mask. The existing implementation +checks the same PGFSM status mask and programs the same PGFSM control mask +in all ACP variants which breaks acp power on sequence for ACP6.0 and +ACP6.3 variants. So to fix this issue, update ACP pgfsm control mask and +status mask based on acp descriptor rev field, which will vary based on +acp variant. + +Fixes: 846aef1d7cc0 ("ASoC: SOF: amd: Add Renoir ACP HW support") +Signed-off-by: Vijendar Mukunda +Link: https://patch.msgid.link/20240816070328.610360-1-Vijendar.Mukunda@amd.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sof/amd/acp.c | 19 +++++++++++++++++-- + sound/soc/sof/amd/acp.h | 7 +++++-- + 2 files changed, 22 insertions(+), 4 deletions(-) + +diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c +index add386f749ae9..bfed848de77c8 100644 +--- a/sound/soc/sof/amd/acp.c ++++ b/sound/soc/sof/amd/acp.c +@@ -380,6 +380,7 @@ static int acp_power_on(struct snd_sof_dev *sdev) + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); + unsigned int base = desc->pgfsm_base; + unsigned int val; ++ unsigned int acp_pgfsm_status_mask, acp_pgfsm_cntl_mask; + int ret; + + val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET); +@@ -387,9 +388,23 @@ static int acp_power_on(struct snd_sof_dev *sdev) + if (val == ACP_POWERED_ON) + return 0; + +- if (val & ACP_PGFSM_STATUS_MASK) ++ switch (desc->rev) { ++ case 3: ++ case 5: ++ acp_pgfsm_status_mask = ACP3X_PGFSM_STATUS_MASK; ++ acp_pgfsm_cntl_mask = ACP3X_PGFSM_CNTL_POWER_ON_MASK; ++ break; ++ case 6: ++ acp_pgfsm_status_mask = ACP6X_PGFSM_STATUS_MASK; ++ acp_pgfsm_cntl_mask = ACP6X_PGFSM_CNTL_POWER_ON_MASK; ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (val & acp_pgfsm_status_mask) + snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + PGFSM_CONTROL_OFFSET, +- ACP_PGFSM_CNTL_POWER_ON_MASK); ++ acp_pgfsm_cntl_mask); + + ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET, val, + !val, ACP_REG_POLL_INTERVAL, ACP_REG_POLL_TIMEOUT_US); +diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h +index 4dcceb7647694..133abed74f015 100644 +--- a/sound/soc/sof/amd/acp.h ++++ b/sound/soc/sof/amd/acp.h +@@ -25,8 +25,11 @@ + #define ACP_REG_POLL_TIMEOUT_US 2000 + #define ACP_DMA_COMPLETE_TIMEOUT_US 5000 + +-#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 +-#define ACP_PGFSM_STATUS_MASK 0x03 ++#define ACP3X_PGFSM_CNTL_POWER_ON_MASK 0x01 ++#define ACP3X_PGFSM_STATUS_MASK 0x03 ++#define ACP6X_PGFSM_CNTL_POWER_ON_MASK 0x07 ++#define ACP6X_PGFSM_STATUS_MASK 0x0F ++ + #define ACP_POWERED_ON 0x00 + #define ACP_ASSERT_RESET 0x01 + #define ACP_RELEASE_RESET 0x00 +-- +2.43.0 + diff --git a/queue-6.6/cifs-fix-falloc_fl_punch_hole-support.patch b/queue-6.6/cifs-fix-falloc_fl_punch_hole-support.patch new file mode 100644 index 00000000000..49de0f4b648 --- /dev/null +++ b/queue-6.6/cifs-fix-falloc_fl_punch_hole-support.patch @@ -0,0 +1,105 @@ +From 0b99565ef0f8c7477e54fff2c50ed5ae773d71fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Aug 2024 14:22:42 +0100 +Subject: cifs: Fix FALLOC_FL_PUNCH_HOLE support + +From: David Howells + +[ Upstream commit 416871f4fb84bc96822562e654941d5625a25bf8 ] + +The cifs filesystem doesn't quite emulate FALLOC_FL_PUNCH_HOLE correctly +(note that due to lack of protocol support, it can't actually implement it +directly). Whilst it will (partially) invalidate dirty folios in the +pagecache, it doesn't write them back first, and so the EOF marker on the +server may be lower than inode->i_size. + +This presents a problem, however, as if the punched hole invalidates the +tail of the locally cached dirty data, writeback won't know it needs to +move the EOF over to account for the hole punch (which isn't supposed to +move the EOF). We could just write zeroes over the punched out region of +the pagecache and write that back - but this is supposed to be a +deallocatory operation. + +Fix this by manually moving the EOF over on the server after the operation +if the hole punched would corrupt it. + +Note that the FSCTL_SET_ZERO_DATA RPC and the setting of the EOF should +probably be compounded to stop a third party interfering (or, at least, +massively reduce the chance). + +This was reproducible occasionally by using fsx with the following script: + + truncate 0x0 0x375e2 0x0 + punch_hole 0x2f6d3 0x6ab5 0x375e2 + truncate 0x0 0x3a71f 0x375e2 + mapread 0xee05 0xcf12 0x3a71f + write 0x2078e 0x5604 0x3a71f + write 0x3ebdf 0x1421 0x3a71f * + punch_hole 0x379d0 0x8630 0x40000 * + mapread 0x2aaa2 0x85b 0x40000 + fallocate 0x1b401 0x9ada 0x40000 + read 0x15f2 0x7d32 0x40000 + read 0x32f37 0x7a3b 0x40000 * + +The second "write" should extend the EOF to 0x40000, and the "punch_hole" +should operate inside of that - but that depends on whether the VM gets in +and writes back the data first. If it doesn't, the file ends up 0x3a71f in +size, not 0x40000. + +Fixes: 31742c5a3317 ("enable fallocate punch hole ("fallocate -p") for SMB3") +Signed-off-by: David Howells +cc: Steve French +cc: Paulo Alcantara +cc: Shyam Prasad N +cc: Jeff Layton +cc: linux-cifs@vger.kernel.org +cc: netfs@lists.linux.dev +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/smb/client/smb2ops.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c +index 66cfce456263b..012d6ec12a691 100644 +--- a/fs/smb/client/smb2ops.c ++++ b/fs/smb/client/smb2ops.c +@@ -3251,6 +3251,7 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, + struct inode *inode = file_inode(file); + struct cifsFileInfo *cfile = file->private_data; + struct file_zero_data_information fsctl_buf; ++ unsigned long long end = offset + len, i_size, remote_i_size; + long rc; + unsigned int xid; + __u8 set_sparse = 1; +@@ -3282,6 +3283,27 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon, + (char *)&fsctl_buf, + sizeof(struct file_zero_data_information), + CIFSMaxBufSize, NULL, NULL); ++ ++ if (rc) ++ goto unlock; ++ ++ /* If there's dirty data in the buffer that would extend the EOF if it ++ * were written, then we need to move the EOF marker over to the lower ++ * of the high end of the hole and the proposed EOF. The problem is ++ * that we locally hole-punch the tail of the dirty data, the proposed ++ * EOF update will end up in the wrong place. ++ */ ++ i_size = i_size_read(inode); ++ remote_i_size = netfs_inode(inode)->remote_i_size; ++ if (end > remote_i_size && i_size > remote_i_size) { ++ unsigned long long extend_to = umin(end, i_size); ++ rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, ++ cfile->fid.volatile_fid, cfile->pid, extend_to); ++ if (rc >= 0) ++ netfs_inode(inode)->remote_i_size = extend_to; ++ } ++ ++unlock: + filemap_invalidate_unlock(inode->i_mapping); + out: + inode_unlock(inode); +-- +2.43.0 + diff --git a/queue-6.6/mm-fix-missing-folio-invalidation-calls-during-trunc.patch b/queue-6.6/mm-fix-missing-folio-invalidation-calls-during-trunc.patch new file mode 100644 index 00000000000..48abbea50ab --- /dev/null +++ b/queue-6.6/mm-fix-missing-folio-invalidation-calls-during-trunc.patch @@ -0,0 +1,66 @@ +From 51b98ca07b200ac5320de17cdb1a5c3fc43a8f91 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Aug 2024 21:08:09 +0100 +Subject: mm: Fix missing folio invalidation calls during truncation + +From: David Howells + +[ Upstream commit 0aa2e1b2fb7a75aa4b5b4347055ccfea6f091769 ] + +When AS_RELEASE_ALWAYS is set on a mapping, the ->release_folio() and +->invalidate_folio() calls should be invoked even if PG_private and +PG_private_2 aren't set. This is used by netfslib to keep track of the +point above which reads can be skipped in favour of just zeroing pagecache +locally. + +There are a couple of places in truncation in which invalidation is only +called when folio_has_private() is true. Fix these to check +folio_needs_release() instead. + +Without this, the generic/075 and generic/112 xfstests (both fsx-based +tests) fail with minimum folio size patches applied[1]. + +Fixes: b4fa966f03b7 ("mm, netfs, fscache: stop read optimisation when folio removed from pagecache") +Signed-off-by: David Howells +Link: https://lore.kernel.org/r/20240815090849.972355-1-kernel@pankajraghav.com/ [1] +Link: https://lore.kernel.org/r/20240823200819.532106-2-dhowells@redhat.com +Reviewed-by: Matthew Wilcox (Oracle) +cc: Matthew Wilcox (Oracle) +cc: Pankaj Raghav +cc: Jeff Layton +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +cc: netfs@lists.linux.dev +cc: linux-mm@kvack.org +cc: linux-fsdevel@vger.kernel.org +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + mm/truncate.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mm/truncate.c b/mm/truncate.c +index 8e3aa9e8618ed..70c09213bb920 100644 +--- a/mm/truncate.c ++++ b/mm/truncate.c +@@ -174,7 +174,7 @@ static void truncate_cleanup_folio(struct folio *folio) + if (folio_mapped(folio)) + unmap_mapping_folio(folio); + +- if (folio_has_private(folio)) ++ if (folio_needs_release(folio)) + folio_invalidate(folio, 0, folio_size(folio)); + + /* +@@ -235,7 +235,7 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end) + */ + folio_zero_range(folio, offset, length); + +- if (folio_has_private(folio)) ++ if (folio_needs_release(folio)) + folio_invalidate(folio, offset, length); + if (!folio_test_large(folio)) + return true; +-- +2.43.0 + diff --git a/queue-6.6/of-introduce-for_each_-_child_of_node_scoped-to-auto.patch b/queue-6.6/of-introduce-for_each_-_child_of_node_scoped-to-auto.patch new file mode 100644 index 00000000000..97dd240c380 --- /dev/null +++ b/queue-6.6/of-introduce-for_each_-_child_of_node_scoped-to-auto.patch @@ -0,0 +1,65 @@ +From 8862e24b92cfe615944450ef770899edc8de647c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 25 Feb 2024 14:27:12 +0000 +Subject: of: Introduce for_each_*_child_of_node_scoped() to automate + of_node_put() handling + +From: Jonathan Cameron + +[ Upstream commit 34af4554fb0ce164e2c4876683619eb1e23848d4 ] + +To avoid issues with out of order cleanup, or ambiguity about when the +auto freed data is first instantiated, do it within the for loop definition. + +The disadvantage is that the struct device_node *child variable creation +is not immediately obvious where this is used. +However, in many cases, if there is another definition of +struct device_node *child; the compiler / static analysers will notify us +that it is unused, or uninitialized. + +Note that, in the vast majority of cases, the _available_ form should be +used and as code is converted to these scoped handers, we should confirm +that any cases that do not check for available have a good reason not +to. + +Signed-off-by: Jonathan Cameron +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20240225142714.286440-3-jic23@kernel.org +Signed-off-by: Rob Herring +Stable-dep-of: afc954fd223d ("thermal: of: Fix OF node leak in thermal_of_trips_init() error path") +Signed-off-by: Sasha Levin +--- + include/linux/of.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/include/linux/of.h b/include/linux/of.h +index 50e882ee91da7..024dda54b9c77 100644 +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -1430,10 +1430,23 @@ static inline int of_property_read_s32(const struct device_node *np, + #define for_each_child_of_node(parent, child) \ + for (child = of_get_next_child(parent, NULL); child != NULL; \ + child = of_get_next_child(parent, child)) ++ ++#define for_each_child_of_node_scoped(parent, child) \ ++ for (struct device_node *child __free(device_node) = \ ++ of_get_next_child(parent, NULL); \ ++ child != NULL; \ ++ child = of_get_next_child(parent, child)) ++ + #define for_each_available_child_of_node(parent, child) \ + for (child = of_get_next_available_child(parent, NULL); child != NULL; \ + child = of_get_next_available_child(parent, child)) + ++#define for_each_available_child_of_node_scoped(parent, child) \ ++ for (struct device_node *child __free(device_node) = \ ++ of_get_next_available_child(parent, NULL); \ ++ child != NULL; \ ++ child = of_get_next_available_child(parent, child)) ++ + #define for_each_of_cpu_node(cpu) \ + for (cpu = of_get_next_cpu_node(NULL); cpu != NULL; \ + cpu = of_get_next_cpu_node(cpu)) +-- +2.43.0 + diff --git a/queue-6.6/ovl-fix-wrong-lowerdir-number-check-for-parameter-op.patch b/queue-6.6/ovl-fix-wrong-lowerdir-number-check-for-parameter-op.patch new file mode 100644 index 00000000000..be6c4a8e15f --- /dev/null +++ b/queue-6.6/ovl-fix-wrong-lowerdir-number-check-for-parameter-op.patch @@ -0,0 +1,123 @@ +From 25327359cd529a59e425dd2a22cdae1cc9c1e7d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Jul 2024 09:15:09 +0800 +Subject: ovl: fix wrong lowerdir number check for parameter Opt_lowerdir + +From: Zhihao Cheng + +[ Upstream commit ca76ac36bb6068866feca185045e7edf2a8f392f ] + +The max count of lowerdir is OVL_MAX_STACK[500], which is broken by +commit 37f32f526438("ovl: fix memory leak in ovl_parse_param()") for +parameter Opt_lowerdir. Since commit 819829f0319a("ovl: refactor layer +parsing helpers") and commit 24e16e385f22("ovl: add support for +appending lowerdirs one by one") added check ovl_mount_dir_check() in +function ovl_parse_param_lowerdir(), the 'ctx->nr' should be smaller +than OVL_MAX_STACK, after commit 37f32f526438("ovl: fix memory leak in +ovl_parse_param()") is applied, the 'ctx->nr' is updated before the +check ovl_mount_dir_check(), which leads the max count of lowerdir +to become 499 for parameter Opt_lowerdir. +Fix it by replacing lower layers parsing code with the existing helper +function ovl_parse_layer(). + +Fixes: 37f32f526438 ("ovl: fix memory leak in ovl_parse_param()") +Signed-off-by: Zhihao Cheng +Link: https://lore.kernel.org/r/20240705011510.794025-3-chengzhihao1@huawei.com +Reviewed-by: Amir Goldstein +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/overlayfs/params.c | 40 +++++++--------------------------------- + 1 file changed, 7 insertions(+), 33 deletions(-) + +diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c +index 17b9c1838182d..39919a10ce1c9 100644 +--- a/fs/overlayfs/params.c ++++ b/fs/overlayfs/params.c +@@ -357,6 +357,8 @@ static void ovl_add_layer(struct fs_context *fc, enum ovl_opt layer, + case Opt_datadir_add: + ctx->nr_data++; + fallthrough; ++ case Opt_lowerdir: ++ fallthrough; + case Opt_lowerdir_add: + WARN_ON(ctx->nr >= ctx->capacity); + l = &ctx->lower[ctx->nr++]; +@@ -379,7 +381,7 @@ static int ovl_parse_layer(struct fs_context *fc, const char *layer_name, enum o + if (!name) + return -ENOMEM; + +- if (upper) ++ if (upper || layer == Opt_lowerdir) + err = ovl_mount_dir(name, &path); + else + err = ovl_mount_dir_noesc(name, &path); +@@ -435,7 +437,6 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) + { + int err; + struct ovl_fs_context *ctx = fc->fs_private; +- struct ovl_fs_context_layer *l; + char *dup = NULL, *iter; + ssize_t nr_lower, nr; + bool data_layer = false; +@@ -475,35 +476,11 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) + goto out_err; + } + +- if (nr_lower > ctx->capacity) { +- err = -ENOMEM; +- l = krealloc_array(ctx->lower, nr_lower, sizeof(*ctx->lower), +- GFP_KERNEL_ACCOUNT); +- if (!l) +- goto out_err; +- +- ctx->lower = l; +- ctx->capacity = nr_lower; +- } +- + iter = dup; +- l = ctx->lower; +- for (nr = 0; nr < nr_lower; nr++, l++) { +- ctx->nr++; +- memset(l, 0, sizeof(*l)); +- +- err = ovl_mount_dir(iter, &l->path); ++ for (nr = 0; nr < nr_lower; nr++) { ++ err = ovl_parse_layer(fc, iter, Opt_lowerdir); + if (err) +- goto out_put; +- +- err = ovl_mount_dir_check(fc, &l->path, Opt_lowerdir, iter, false); +- if (err) +- goto out_put; +- +- err = -ENOMEM; +- l->name = kstrdup(iter, GFP_KERNEL_ACCOUNT); +- if (!l->name) +- goto out_put; ++ goto out_err; + + if (data_layer) + ctx->nr_data++; +@@ -521,7 +498,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) + */ + if (ctx->nr_data > 0) { + pr_err("regular lower layers cannot follow data lower layers"); +- goto out_put; ++ goto out_err; + } + + data_layer = false; +@@ -535,9 +512,6 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) + kfree(dup); + return 0; + +-out_put: +- ovl_reset_lowerdirs(ctx); +- + out_err: + kfree(dup); + +-- +2.43.0 + diff --git a/queue-6.6/ovl-ovl_parse_param_lowerdir-add-missed-n-for-pr_err.patch b/queue-6.6/ovl-ovl_parse_param_lowerdir-add-missed-n-for-pr_err.patch new file mode 100644 index 00000000000..3f18e393ec4 --- /dev/null +++ b/queue-6.6/ovl-ovl_parse_param_lowerdir-add-missed-n-for-pr_err.patch @@ -0,0 +1,46 @@ +From d8f7f84d7518bc604f73fc6de639a115f28dc765 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Jul 2024 09:15:10 +0800 +Subject: ovl: ovl_parse_param_lowerdir: Add missed '\n' for pr_err + +From: Zhihao Cheng + +[ Upstream commit 441e36ef5b347d9ab4f54f7b54853266be687556 ] + +Add '\n' for pr_err in function ovl_parse_param_lowerdir(), which +ensures that error message is displayed at once. + +Fixes: b36a5780cb44 ("ovl: modify layer parameter parsing") +Signed-off-by: Zhihao Cheng +Link: https://lore.kernel.org/r/20240705011510.794025-4-chengzhihao1@huawei.com +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/overlayfs/params.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c +index 39919a10ce1c9..0f3768cf9e871 100644 +--- a/fs/overlayfs/params.c ++++ b/fs/overlayfs/params.c +@@ -453,7 +453,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) + return 0; + + if (*name == ':') { +- pr_err("cannot append lower layer"); ++ pr_err("cannot append lower layer\n"); + return -EINVAL; + } + +@@ -497,7 +497,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) + * there are no data layers. + */ + if (ctx->nr_data > 0) { +- pr_err("regular lower layers cannot follow data lower layers"); ++ pr_err("regular lower layers cannot follow data lower layers\n"); + goto out_err; + } + +-- +2.43.0 + diff --git a/queue-6.6/ovl-pass-string-to-ovl_parse_layer.patch b/queue-6.6/ovl-pass-string-to-ovl_parse_layer.patch new file mode 100644 index 00000000000..11f70ea980e --- /dev/null +++ b/queue-6.6/ovl-pass-string-to-ovl_parse_layer.patch @@ -0,0 +1,49 @@ +From 3094e5e9ed34536d42979e22456b7297ed6e1715 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Jul 2024 09:15:08 +0800 +Subject: ovl: pass string to ovl_parse_layer() + +From: Christian Brauner + +[ Upstream commit 7eff3453cbd7e0bfc7524d59694119b5ca844778 ] + +So it can be used for parsing the Opt_lowerdir. + +Signed-off-by: Zhihao Cheng +Link: https://lore.kernel.org/r/20240705011510.794025-2-chengzhihao1@huawei.com +Signed-off-by: Christian Brauner +Stable-dep-of: ca76ac36bb60 ("ovl: fix wrong lowerdir number check for parameter Opt_lowerdir") +Signed-off-by: Sasha Levin +--- + fs/overlayfs/params.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c +index 488f920f79d28..17b9c1838182d 100644 +--- a/fs/overlayfs/params.c ++++ b/fs/overlayfs/params.c +@@ -369,10 +369,9 @@ static void ovl_add_layer(struct fs_context *fc, enum ovl_opt layer, + } + } + +-static int ovl_parse_layer(struct fs_context *fc, struct fs_parameter *param, +- enum ovl_opt layer) ++static int ovl_parse_layer(struct fs_context *fc, const char *layer_name, enum ovl_opt layer) + { +- char *name = kstrdup(param->string, GFP_KERNEL); ++ char *name = kstrdup(layer_name, GFP_KERNEL); + bool upper = (layer == Opt_upperdir || layer == Opt_workdir); + struct path path; + int err; +@@ -586,7 +585,7 @@ static int ovl_parse_param(struct fs_context *fc, struct fs_parameter *param) + case Opt_datadir_add: + case Opt_upperdir: + case Opt_workdir: +- err = ovl_parse_layer(fc, param, opt); ++ err = ovl_parse_layer(fc, param->string, opt); + break; + case Opt_default_permissions: + config->default_permissions = true; +-- +2.43.0 + diff --git a/queue-6.6/pinctrl-mediatek-common-v2-fix-broken-bias-disable-f.patch b/queue-6.6/pinctrl-mediatek-common-v2-fix-broken-bias-disable-f.patch new file mode 100644 index 00000000000..d9f6b88f0fe --- /dev/null +++ b/queue-6.6/pinctrl-mediatek-common-v2-fix-broken-bias-disable-f.patch @@ -0,0 +1,184 @@ +From c61c01ce9f02ccb94fe5f3f38899adf18d851c8d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Aug 2024 19:27:09 -0400 +Subject: pinctrl: mediatek: common-v2: Fix broken bias-disable for + PULL_PU_PD_RSEL_TYPE +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nícolas F. R. A. Prado + +[ Upstream commit 166bf8af91225576f85208a31eaedbadd182d1ea ] + +Despite its name, commit fed74d75277d ("pinctrl: mediatek: common-v2: +Fix bias-disable for PULL_PU_PD_RSEL_TYPE") actually broke bias-disable +for PULL_PU_PD_RSEL_TYPE. + +mtk_pinconf_bias_set_combo() tries every bias method supported by the +pin until one succeeds. For PULL_PU_PD_RSEL_TYPE pins, before the +breaking commit, mtk_pinconf_bias_set_rsel() would be called first to +try and set the RSEL value (as well as PU and PD), and if that failed, +the only other valid option was that bias-disable was specified, which +would then be handled by calling mtk_pinconf_bias_set_pu_pd() and +disabling both PU and PD. + +The breaking commit misunderstood this logic and added an early "return +0" in mtk_pinconf_bias_set_rsel(). The result was that in the +bias-disable case, the bias was left unchanged, since by returning +success, mtk_pinconf_bias_set_combo() no longer tried calling +mtk_pinconf_bias_set_pu_pd() to disable the bias. + +Since the logic for configuring bias-disable on PULL_PU_PD_RSEL_TYPE +pins required mtk_pinconf_bias_set_rsel() to fail first, in that case, +an error was printed to the log, eg: + + mt8195-pinctrl 10005000.pinctrl: Not support rsel value 0 Ohm for pin = 29 (GPIO29) + +This is what the breaking commit actually got rid of, and likely part of +the reason why that commit was thought to be fixing functionality, while +in reality it was breaking it. + +Instead of simply reverting that commit, restore the functionality but +in a way that avoids the error from being printed and makes the code +less confusing: +* Return 0 explicitly if a bias method was successful +* Introduce an extra function mtk_pinconf_bias_set_pu_pd_rsel() that + calls both mtk_pinconf_bias_set_rsel() (only if needed) and + mtk_pinconf_bias_set_pu_pd() + * And analogously for the corresponding getters + +Fixes: fed74d75277d ("pinctrl: mediatek: common-v2: Fix bias-disable for PULL_PU_PD_RSEL_TYPE") +Signed-off-by: Nícolas F. R. A. Prado +Link: https://lore.kernel.org/20240808-mtk-rsel-bias-disable-fix-v1-1-1b4e85bf596c@collabora.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + .../pinctrl/mediatek/pinctrl-mtk-common-v2.c | 55 ++++++++++--------- + 1 file changed, 29 insertions(+), 26 deletions(-) + +diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +index b7921b59eb7b1..54301fbba524a 100644 +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +@@ -709,32 +709,35 @@ static int mtk_pinconf_bias_set_rsel(struct mtk_pinctrl *hw, + { + int err, rsel_val; + +- if (!pullup && arg == MTK_DISABLE) +- return 0; +- + if (hw->rsel_si_unit) { + /* find pin rsel_index from pin_rsel array*/ + err = mtk_hw_pin_rsel_lookup(hw, desc, pullup, arg, &rsel_val); + if (err) +- goto out; ++ return err; + } else { +- if (arg < MTK_PULL_SET_RSEL_000 || +- arg > MTK_PULL_SET_RSEL_111) { +- err = -EINVAL; +- goto out; +- } ++ if (arg < MTK_PULL_SET_RSEL_000 || arg > MTK_PULL_SET_RSEL_111) ++ return -EINVAL; + + rsel_val = arg - MTK_PULL_SET_RSEL_000; + } + +- err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val); +- if (err) +- goto out; ++ return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_RSEL, rsel_val); ++} + +- err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, MTK_ENABLE); ++static int mtk_pinconf_bias_set_pu_pd_rsel(struct mtk_pinctrl *hw, ++ const struct mtk_pin_desc *desc, ++ u32 pullup, u32 arg) ++{ ++ u32 enable = arg == MTK_DISABLE ? MTK_DISABLE : MTK_ENABLE; ++ int err; + +-out: +- return err; ++ if (arg != MTK_DISABLE) { ++ err = mtk_pinconf_bias_set_rsel(hw, desc, pullup, arg); ++ if (err) ++ return err; ++ } ++ ++ return mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, enable); + } + + int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, +@@ -750,22 +753,22 @@ int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, + try_all_type = MTK_PULL_TYPE_MASK; + + if (try_all_type & MTK_PULL_RSEL_TYPE) { +- err = mtk_pinconf_bias_set_rsel(hw, desc, pullup, arg); ++ err = mtk_pinconf_bias_set_pu_pd_rsel(hw, desc, pullup, arg); + if (!err) +- return err; ++ return 0; + } + + if (try_all_type & MTK_PULL_PU_PD_TYPE) { + err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, arg); + if (!err) +- return err; ++ return 0; + } + + if (try_all_type & MTK_PULL_PULLSEL_TYPE) { + err = mtk_pinconf_bias_set_pullsel_pullen(hw, desc, + pullup, arg); + if (!err) +- return err; ++ return 0; + } + + if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE) +@@ -803,9 +806,9 @@ static int mtk_rsel_get_si_unit(struct mtk_pinctrl *hw, + return 0; + } + +-static int mtk_pinconf_bias_get_rsel(struct mtk_pinctrl *hw, +- const struct mtk_pin_desc *desc, +- u32 *pullup, u32 *enable) ++static int mtk_pinconf_bias_get_pu_pd_rsel(struct mtk_pinctrl *hw, ++ const struct mtk_pin_desc *desc, ++ u32 *pullup, u32 *enable) + { + int pu, pd, rsel, err; + +@@ -939,22 +942,22 @@ int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw, + try_all_type = MTK_PULL_TYPE_MASK; + + if (try_all_type & MTK_PULL_RSEL_TYPE) { +- err = mtk_pinconf_bias_get_rsel(hw, desc, pullup, enable); ++ err = mtk_pinconf_bias_get_pu_pd_rsel(hw, desc, pullup, enable); + if (!err) +- return err; ++ return 0; + } + + if (try_all_type & MTK_PULL_PU_PD_TYPE) { + err = mtk_pinconf_bias_get_pu_pd(hw, desc, pullup, enable); + if (!err) +- return err; ++ return 0; + } + + if (try_all_type & MTK_PULL_PULLSEL_TYPE) { + err = mtk_pinconf_bias_get_pullsel_pullen(hw, desc, + pullup, enable); + if (!err) +- return err; ++ return 0; + } + + if (try_all_type & MTK_PULL_PUPD_R1R0_TYPE) +-- +2.43.0 + diff --git a/queue-6.6/pinctrl-starfive-jh7110-correct-the-level-trigger-co.patch b/queue-6.6/pinctrl-starfive-jh7110-correct-the-level-trigger-co.patch new file mode 100644 index 00000000000..4749d9113d0 --- /dev/null +++ b/queue-6.6/pinctrl-starfive-jh7110-correct-the-level-trigger-co.patch @@ -0,0 +1,43 @@ +From f4111b325cff06654b1e7ed7463c5a655e9a5fce Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Aug 2024 15:01:08 +0800 +Subject: pinctrl: starfive: jh7110: Correct the level trigger configuration of + iev register + +From: Hal Feng + +[ Upstream commit 639766ca10d1e218e257ae7eabe76814bae6ab89 ] + +A mistake was made in level trigger register configuration. Correct it. + +Fixes: 447976ab62c5 ("pinctrl: starfive: Add StarFive JH7110 sys controller driver") +Signed-off-by: Hal Feng +Link: https://lore.kernel.org/20240812070108.100923-1-hal.feng@starfivetech.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +index b4f7995726894..a3fee55479d20 100644 +--- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c ++++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +@@ -805,12 +805,12 @@ static int jh7110_irq_set_type(struct irq_data *d, unsigned int trigger) + case IRQ_TYPE_LEVEL_HIGH: + irq_type = 0; /* 0: level triggered */ + edge_both = 0; /* 0: ignored */ +- polarity = mask; /* 1: high level */ ++ polarity = 0; /* 0: high level */ + break; + case IRQ_TYPE_LEVEL_LOW: + irq_type = 0; /* 0: level triggered */ + edge_both = 0; /* 0: ignored */ +- polarity = 0; /* 0: low level */ ++ polarity = mask; /* 1: low level */ + break; + default: + return -EINVAL; +-- +2.43.0 + diff --git a/queue-6.6/series b/queue-6.6/series index 5377c044d8a..31334bf251b 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -26,3 +26,15 @@ drm-amdgpu-swsmu-always-force-a-state-reprogram-on-init.patch drm-vmwgfx-fix-prime-with-external-buffers.patch tracing-have-format-file-honor-event_file_fl_freed.patch usb-typec-fix-up-incorrectly-backported-usb-typec-tcpm-unregister-existing-source-caps-before-re-registration.patch +of-introduce-for_each_-_child_of_node_scoped-to-auto.patch +thermal-of-fix-of-node-leak-in-thermal_of_trips_init.patch +thermal-of-fix-of-node-leak-in-of_thermal_zone_find-.patch +asoc-amd-acp-fix-module-autoloading.patch +asoc-sof-amd-fix-for-acp-init-sequence.patch +pinctrl-mediatek-common-v2-fix-broken-bias-disable-f.patch +pinctrl-starfive-jh7110-correct-the-level-trigger-co.patch +ovl-pass-string-to-ovl_parse_layer.patch +ovl-fix-wrong-lowerdir-number-check-for-parameter-op.patch +ovl-ovl_parse_param_lowerdir-add-missed-n-for-pr_err.patch +mm-fix-missing-folio-invalidation-calls-during-trunc.patch +cifs-fix-falloc_fl_punch_hole-support.patch diff --git a/queue-6.6/thermal-of-fix-of-node-leak-in-of_thermal_zone_find-.patch b/queue-6.6/thermal-of-fix-of-node-leak-in-of_thermal_zone_find-.patch new file mode 100644 index 00000000000..fe0312c07b4 --- /dev/null +++ b/queue-6.6/thermal-of-fix-of-node-leak-in-of_thermal_zone_find-.patch @@ -0,0 +1,73 @@ +From 2c62d1300222c13a62109ac1a8064bbbfd119af6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 14 Aug 2024 21:58:23 +0200 +Subject: thermal: of: Fix OF node leak in of_thermal_zone_find() error paths + +From: Krzysztof Kozlowski + +[ Upstream commit c0a1ef9c5be72ff28a5413deb1b3e1a066593c13 ] + +Terminating for_each_available_child_of_node() loop requires dropping OF +node reference, so bailing out on errors misses this. Solve the OF node +reference leak with scoped for_each_available_child_of_node_scoped(). + +Fixes: 3fd6d6e2b4e8 ("thermal/of: Rework the thermal device tree initialization") +Cc: +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Chen-Yu Tsai +Reviewed-by: Daniel Lezcano +Link: https://patch.msgid.link/20240814195823.437597-3-krzysztof.kozlowski@linaro.org +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/thermal/thermal_of.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c +index e7d25e70fb93e..d8dfcd49695d3 100644 +--- a/drivers/thermal/thermal_of.c ++++ b/drivers/thermal/thermal_of.c +@@ -182,14 +182,14 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int + * Search for each thermal zone, a defined sensor + * corresponding to the one passed as parameter + */ +- for_each_available_child_of_node(np, tz) { ++ for_each_available_child_of_node_scoped(np, child) { + + int count, i; + +- count = of_count_phandle_with_args(tz, "thermal-sensors", ++ count = of_count_phandle_with_args(child, "thermal-sensors", + "#thermal-sensor-cells"); + if (count <= 0) { +- pr_err("%pOFn: missing thermal sensor\n", tz); ++ pr_err("%pOFn: missing thermal sensor\n", child); + tz = ERR_PTR(-EINVAL); + goto out; + } +@@ -198,18 +198,19 @@ static struct device_node *of_thermal_zone_find(struct device_node *sensor, int + + int ret; + +- ret = of_parse_phandle_with_args(tz, "thermal-sensors", ++ ret = of_parse_phandle_with_args(child, "thermal-sensors", + "#thermal-sensor-cells", + i, &sensor_specs); + if (ret < 0) { +- pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", tz, ret); ++ pr_err("%pOFn: Failed to read thermal-sensors cells: %d\n", child, ret); + tz = ERR_PTR(ret); + goto out; + } + + if ((sensor == sensor_specs.np) && id == (sensor_specs.args_count ? + sensor_specs.args[0] : 0)) { +- pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, tz); ++ pr_debug("sensor %pOFn id=%d belongs to %pOFn\n", sensor, id, child); ++ tz = no_free_ptr(child); + goto out; + } + } +-- +2.43.0 + diff --git a/queue-6.6/thermal-of-fix-of-node-leak-in-thermal_of_trips_init.patch b/queue-6.6/thermal-of-fix-of-node-leak-in-thermal_of_trips_init.patch new file mode 100644 index 00000000000..9483967b560 --- /dev/null +++ b/queue-6.6/thermal-of-fix-of-node-leak-in-thermal_of_trips_init.patch @@ -0,0 +1,51 @@ +From 18644377bc53312956e5c472bb75d8803859cf26 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 14 Aug 2024 21:58:21 +0200 +Subject: thermal: of: Fix OF node leak in thermal_of_trips_init() error path + +From: Krzysztof Kozlowski + +[ Upstream commit afc954fd223ded70b1fa000767e2531db55cce58 ] + +Terminating for_each_child_of_node() loop requires dropping OF node +reference, so bailing out after thermal_of_populate_trip() error misses +this. Solve the OF node reference leak with scoped +for_each_child_of_node_scoped(). + +Fixes: d0c75fa2c17f ("thermal/of: Initialize trip points separately") +Cc: All applicable +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Chen-Yu Tsai +Reviewed-by: Daniel Lezcano +Link: https://patch.msgid.link/20240814195823.437597-1-krzysztof.kozlowski@linaro.org +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/thermal/thermal_of.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c +index d5174f11b91c2..e7d25e70fb93e 100644 +--- a/drivers/thermal/thermal_of.c ++++ b/drivers/thermal/thermal_of.c +@@ -123,7 +123,7 @@ static int thermal_of_populate_trip(struct device_node *np, + static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *ntrips) + { + struct thermal_trip *tt; +- struct device_node *trips, *trip; ++ struct device_node *trips; + int ret, count; + + trips = of_get_child_by_name(np, "trips"); +@@ -148,7 +148,7 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n + *ntrips = count; + + count = 0; +- for_each_child_of_node(trips, trip) { ++ for_each_child_of_node_scoped(trips, trip) { + ret = thermal_of_populate_trip(trip, &tt[count++]); + if (ret) + goto out_kfree; +-- +2.43.0 +