6.1.175-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 542/969 selftest: memcg: skip memcg_sock test if address family not supported
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
[ Upstream commit 2d028f3e4bbbfd448928a8d3d2814b0b04c214f4 ]
The test_memcg_sock test in memcontrol.c sets up an IPv6 socket and send data over it to consume memory and verify that memory.stat.sock and memory.current values are close.
On systems where IPv6 isn't enabled or not configured to support SOCK_STREAM, the test_memcg_sock test always fails. When the socket() call fails, there is no way we can test the memory consumption and verify the above claim. I believe it is better to just skip the test in this case instead of reporting a test failure hinting that there may be something wrong with the memcg code.
--- tools/testing/selftests/cgroup/test_memcontrol.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tools/testing/selftests/cgroup/test_memcontrol.c +10 -1
@@ -921,8 +921,11 @@ static int tcp_server(const char *cgroup, void *arg) saddr.sin6_port =htons (srv_args->port); sk =socket (AF_INET6 ,SOCK_STREAM ,0 ); -if (sk <0 ) +if (sk <0 ) { +/* Pass back errno to the ctl_fd */ +write (ctl_fd, &errno,sizeof (errno));return ret; + }if (setsockopt (sk,SOL_SOCKET ,SO_REUSEADDR , &yes,sizeof (yes)) <0 ) goto cleanup;
@@ -1049,6 +1052,12 @@ static int test_memcg_sock(const char *root) goto cleanup;close (args.ctl[0 ]); +/* Skip if address family not supported by protocol */ +if (err ==EAFNOSUPPORT ) { + ret =KSFT_SKIP ; + goto cleanup; + } +if (!err)break ;if (err !=EADDRINUSE )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 543/969 ALSA: scarlett2: Add missing sentinel initializer field
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Panagiotis Petrakopoulos <[email protected]>
[ Upstream commit 2428cd6e8b6fa80c36db4652702ca0acd2ce3f08 ]
A "-Wmissing-field-initializers" warning was emitted when compiling the module using the W=2 option. There is a sentinel initializer field missing in the end of scarlett2_devices[]. Tested using a Scarlett Solo 4th gen.
--- sound/usb/mixer_scarlett2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_scarlett2.c +1 -1
@@ -1011,7 +1011,7 @@ static const struct scarlett2_device_entry scarlett2_devices[] = { { USB_ID(0x1235, 0x820c), &clarett_8pre_info, "Clarett+" },/* End of list */ - { 0, NULL }, + { 0, NULL, NULL }, };/* get the starting port index number for a given port type/direction */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 544/969 ASoC: SOF: amd: Fix for reading position updates from stream box.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: V sujith kumar Reddy <[email protected]>
[ Upstream commit aae7e412b0ec0378e392b18c50b612dae09cdb74 ]
By default the position updates are read from dsp box when streambox size is not defined.if the streambox size is defined to some value then position updates can be read from the streambox.
Stable-dep-of: 2c4fdd055f92 ("ASoC: SOF: compress: return the configured codec from get_params")
--- sound/soc/sof/amd/acp-common.c | 1 + sound/soc/sof/amd/acp-ipc.c | 30 +++++++++++++++++++++++++++++- sound/soc/sof/amd/acp.h | 4 ++++ 3 files changed, 34 insertions(+), 1 deletion(-)
sound/soc/sof/amd/acp-common.c +1 -0
@@ -76,6 +76,7 @@ struct snd_sof_dsp_ops sof_acp_common_ops = {/*IPC */ .send_msg = acp_sof_ipc_send_msg, .ipc_msg_data = acp_sof_ipc_msg_data, + .set_stream_data_offset = acp_set_stream_data_offset, .get_mailbox_offset = acp_sof_ipc_get_mailbox_offset, .get_window_offset = acp_sof_ipc_get_window_offset, .irq_thread = acp_sof_ipc_irq_thread,
sound/soc/sof/amd/acp-ipc.c +29 -1
@@ -192,13 +192,41 @@ int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_pcm_substream *sub {unsigned int offset = sdev->dsp_box.offset; -if (!substream || !sdev->stream_box.size) +if (!substream || !sdev->stream_box.size) {acp_mailbox_read (sdev, offset, p, sz); + }else { +struct acp_dsp_stream *stream = substream->runtime->private_data; + +if (!stream) +return -ESTRPIPE ; + +acp_mailbox_read (sdev, stream->posn_offset, p, sz); + }return 0 ; }EXPORT_SYMBOL_NS (acp_sof_ipc_msg_data,SND_SOC_SOF_AMD_COMMON ); +int acp_set_stream_data_offset (struct snd_sof_dev *sdev, +struct snd_pcm_substream *substream, +size_t posn_offset) +{ +struct acp_dsp_stream *stream = substream->runtime->private_data; + +/* check for unaligned offset or overflow */ +if (posn_offset > sdev->stream_box.size || + posn_offset %sizeof (struct sof_ipc_stream_posn ) !=0 ) +return -EINVAL ; + + stream->posn_offset = sdev->stream_box.offset + posn_offset; + +dev_dbg (sdev->dev,"pcm: stream dir %d, posn mailbox offset is %zu" , + substream->stream, stream->posn_offset); + +return 0 ; +} +EXPORT_SYMBOL_NS (acp_set_stream_data_offset,SND_SOC_SOF_AMD_COMMON ); +int acp_sof_ipc_get_mailbox_offset (struct snd_sof_dev *sdev) {const struct sof_amd_acp_desc *desc =get_chip_info (sdev->pdata);
sound/soc/sof/amd/acp.h +4 -0
@@ -144,6 +144,7 @@ struct acp_dsp_stream {int stream_tag;int active;unsigned int reg_offset; +size_t posn_offset; };struct sof_amd_acp_desc {
@@ -205,6 +206,9 @@ int acp_dsp_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_tyirqreturn_t acp_sof_ipc_irq_thread (int irq,void *context);int acp_sof_ipc_msg_data (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream,void *p,size_t sz); +int acp_set_stream_data_offset (struct snd_sof_dev *sdev, +struct snd_pcm_substream *substream, +size_t posn_offset);int acp_sof_ipc_send_msg (struct snd_sof_dev *sdev,struct snd_sof_ipc_msg *msg);int acp_sof_ipc_get_mailbox_offset (struct snd_sof_dev *sdev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 545/969 ASoC: SOF: Prepare ipc_msg_data to be used with compress API
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Baluta <[email protected]>
[ Upstream commit 1b905942d6cd182b7ef14e9f095178376d3847e6 ]
Make second parameter of ipc_msg_data generic in order to be able to support compressed streams.
This patch doesn't hold any functional change.
With this case we can use ipc_msg_data, to retrieve information from DSP for both PCM/Compress API.
Stable-dep-of: 2c4fdd055f92 ("ASoC: SOF: compress: return the configured codec from get_params")
--- sound/soc/sof/amd/acp-ipc.c | 5 +++-- sound/soc/sof/amd/acp.h | 3 ++- sound/soc/sof/intel/hda-ipc.c | 5 +++-- sound/soc/sof/intel/hda.h | 2 +- sound/soc/sof/ipc3.c | 4 ++-- sound/soc/sof/mediatek/mt8186/mt8186.c | 2 +- sound/soc/sof/mediatek/mt8195/mt8195.c | 2 +- sound/soc/sof/ops.h | 4 ++-- sound/soc/sof/sof-priv.h | 6 ++++-- sound/soc/sof/stream-ipc.c | 6 ++++-- 10 files changed, 23 insertions(+), 16 deletions(-)
sound/soc/sof/amd/acp-ipc.c +3 -2
@@ -187,14 +187,15 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context) }EXPORT_SYMBOL_NS (acp_sof_ipc_irq_thread,SND_SOC_SOF_AMD_COMMON ); -int acp_sof_ipc_msg_data (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream, +int acp_sof_ipc_msg_data (struct snd_sof_dev *sdev,struct snd_sof_pcm_stream *sps,void *p,size_t sz) {unsigned int offset = sdev->dsp_box.offset; -if (!substream || !sdev->stream_box.size) { +if (!sps || !sdev->stream_box.size) {acp_mailbox_read (sdev, offset, p, sz); }else { +struct snd_pcm_substream *substream = sps->substream;struct acp_dsp_stream *stream = substream->runtime->private_data;if (!stream)
sound/soc/sof/amd/acp.h +2 -1
@@ -12,6 +12,7 @@#define __SOF_AMD_ACP_H#include "../sof-priv.h" +#include "../sof-audio.h" #define ACP_MAX_STREAM 8
@@ -204,7 +205,7 @@ int acp_dsp_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_ty/* IPC callbacks */ irqreturn_t acp_sof_ipc_irq_thread (int irq,void *context); -int acp_sof_ipc_msg_data (struct snd_sof_dev *sdev,struct snd_pcm_substream *substream, +int acp_sof_ipc_msg_data (struct snd_sof_dev *sdev,struct snd_sof_pcm_stream *sps,void *p,size_t sz); int acp_set_stream_data_offset(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,
sound/soc/sof/intel/hda-ipc.c +3 -2
@@ -342,12 +342,13 @@ int hda_dsp_ipc_get_window_offset(struct snd_sof_dev *sdev, u32 id) }int hda_ipc_msg_data (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,void *p,size_t sz) { -if (!substream || !sdev->stream_box.size) { +if (!sps || !sdev->stream_box.size) {sof_mailbox_read (sdev, sdev->dsp_box.offset, p, sz); }else { +struct snd_pcm_substream *substream = sps->substream;struct hdac_stream *hstream = substream->runtime->private_data;struct sof_intel_hda_stream *hda_stream;
sound/soc/sof/intel/hda.h +1 -1
@@ -645,7 +645,7 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev, int enable, u32 size);int hda_ipc_msg_data (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,void *p,size_t sz); int hda_set_stream_data_offset(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,
sound/soc/sof/ipc3.c +2 -2
@@ -847,7 +847,7 @@ static void ipc3_period_elapsed(struct snd_sof_dev *sdev, u32 msg_id) } stream = &spcm->stream[direction]; - ret =snd_sof_ipc_msg_data (sdev, stream->substream, &posn,sizeof (posn)); + ret =snd_sof_ipc_msg_data (sdev, stream, &posn,sizeof (posn));if (ret <0 ) {dev_warn (sdev->dev,"failed to read stream position: %d\n" , ret);return ;
@@ -882,7 +882,7 @@ static void ipc3_xrun(struct snd_sof_dev *sdev, u32 msg_id) } stream = &spcm->stream[direction]; - ret =snd_sof_ipc_msg_data (sdev, stream->substream, &posn,sizeof (posn)); + ret =snd_sof_ipc_msg_data (sdev, stream, &posn,sizeof (posn));if (ret <0 ) {dev_warn (sdev->dev,"failed to read overrun position: %d\n" , ret);return ;
sound/soc/sof/mediatek/mt8186/mt8186.c +1 -1
@@ -489,7 +489,7 @@ static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev, } stream = &spcm->stream[substream->stream]; - ret =snd_sof_ipc_msg_data (sdev, stream->substream, &posn,sizeof (posn)); + ret =snd_sof_ipc_msg_data (sdev, stream, &posn,sizeof (posn));if (ret <0 ) {dev_warn (sdev->dev,"failed to read stream position: %d\n" , ret);return 0 ;
sound/soc/sof/mediatek/mt8195/mt8195.c +1 -1
@@ -525,7 +525,7 @@ static snd_pcm_uframes_t mt8195_pcm_pointer(struct snd_sof_dev *sdev, } stream = &spcm->stream[substream->stream]; - ret =snd_sof_ipc_msg_data (sdev, stream->substream, &posn,sizeof (posn)); + ret =snd_sof_ipc_msg_data (sdev, stream, &posn,sizeof (posn));if (ret <0 ) {dev_warn (sdev->dev,"failed to read stream position: %d\n" , ret);return 0 ;
sound/soc/sof/ops.h +2 -2
@@ -449,10 +449,10 @@ static inline int snd_sof_load_firmware(struct snd_sof_dev *sdev)/* host DSP message data */ static inline int snd_sof_ipc_msg_data (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,void *p,size_t sz) { -return sof_ops (sdev)->ipc_msg_data (sdev, substream, p, sz); +return sof_ops (sdev)->ipc_msg_data (sdev, sps, p, sz); }/* host side configuration of the stream's data offset in stream mailbox area */ static inline int
sound/soc/sof/sof-priv.h +4 -2
@@ -20,6 +20,8 @@#include <uapi/sound/sof/fw.h> #include <sound/sof/ext_manifest.h> +struct snd_sof_pcm_stream ; +/* Flag definitions used in sof_core_debug (sof_debug module parameter) */ #define SOF_DBG_ENABLE_TRACE BIT(0)#define SOF_DBG_RETAIN_CTX BIT(1)/* prevent DSP D3 on FW exception */
@@ -240,7 +242,7 @@ struct snd_sof_dsp_ops {/* host read DSP stream data */ int (*ipc_msg_data)(struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,void *p,size_t sz);/* mandatory */ /* host side configuration of the stream's data offset in stream mailbox area */
@@ -743,7 +745,7 @@ int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type, u32 offset, void *dest, size_t size);int sof_ipc_msg_data (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,void *p,size_t sz); int sof_set_stream_data_offset(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream,
sound/soc/sof/stream-ipc.c +4 -2
@@ -19,6 +19,7 @@#include "ops.h" #include "sof-priv.h" +#include "sof-audio.h" struct sof_stream {size_t posn_offset;
@@ -26,12 +27,13 @@ struct sof_stream {/* Mailbox-based Generic IPC implementation */ int sof_ipc_msg_data (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,void *p,size_t sz) { -if (!substream || !sdev->stream_box.size) { +if (!sps || !sdev->stream_box.size) {snd_sof_dsp_mailbox_read (sdev, sdev->dsp_box.offset, p, sz); }else { +struct snd_pcm_substream *substream = sps->substream;struct sof_stream *stream = substream->runtime->private_data;/* The stream might already be closed */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 546/969 ASoC: SOF: Prepare set_stream_data_offset for compress API
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Baluta <[email protected]>
[ Upstream commit 249f186d6b0211fc59d83db128030f2b298063a1 ]
Make second parameter of set_stream_data_offset generic in order to be used for both PCM and compress streams.
Current patch doesn't introduce any functional change, just prepare the code for compress support.
Stable-dep-of: 2c4fdd055f92 ("ASoC: SOF: compress: return the configured codec from get_params")
--- sound/soc/sof/amd/acp-ipc.c | 3 ++- sound/soc/sof/amd/acp.h | 2 +- sound/soc/sof/intel/hda-ipc.c | 3 ++- sound/soc/sof/intel/hda.h | 2 +- sound/soc/sof/ipc3-pcm.c | 3 ++- sound/soc/sof/ops.h | 4 ++-- sound/soc/sof/sof-priv.h | 4 ++-- sound/soc/sof/stream-ipc.c | 3 ++- 8 files changed, 14 insertions(+), 10 deletions(-)
sound/soc/sof/amd/acp-ipc.c +2 -1
@@ -209,9 +209,10 @@ int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *spEXPORT_SYMBOL_NS (acp_sof_ipc_msg_data,SND_SOC_SOF_AMD_COMMON );int acp_set_stream_data_offset (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset) { +struct snd_pcm_substream *substream = sps->substream;struct acp_dsp_stream *stream = substream->runtime->private_data;/* check for unaligned offset or overflow */
sound/soc/sof/amd/acp.h +1 -1
@@ -208,7 +208,7 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context);int acp_sof_ipc_msg_data (struct snd_sof_dev *sdev,struct snd_sof_pcm_stream *sps,void *p,size_t sz);int acp_set_stream_data_offset (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset);int acp_sof_ipc_send_msg (struct snd_sof_dev *sdev,struct snd_sof_ipc_msg *msg);
sound/soc/sof/intel/hda-ipc.c +2 -1
@@ -367,9 +367,10 @@ int hda_ipc_msg_data(struct snd_sof_dev *sdev, }int hda_set_stream_data_offset (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset) { +struct snd_pcm_substream *substream = sps->substream;struct hdac_stream *hstream = substream->runtime->private_data;struct sof_intel_hda_stream *hda_stream;
sound/soc/sof/intel/hda.h +1 -1
@@ -648,7 +648,7 @@ int hda_ipc_msg_data(struct snd_sof_dev *sdev,struct snd_sof_pcm_stream *sps, void *p, size_t sz);int hda_set_stream_data_offset (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset);/*
sound/soc/sof/ipc3-pcm.c +2 -1
@@ -129,7 +129,8 @@ static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component,return ret; } - ret =snd_sof_set_stream_data_offset (sdev, substream, ipc_params_reply.posn_offset); + ret =snd_sof_set_stream_data_offset (sdev, &spcm->stream[substream->stream], + ipc_params_reply.posn_offset);if (ret <0 ) {dev_err (component->dev,"%s: invalid stream data offset for PCM %d\n" , __func__, spcm->pcm.pcm_id);
sound/soc/sof/ops.h +2 -2
@@ -457,11 +457,11 @@ static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev,/* host side configuration of the stream's data offset in stream mailbox area */ static inline int snd_sof_set_stream_data_offset (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset) {if (sof_ops (sdev) &&sof_ops (sdev)->set_stream_data_offset) -return sof_ops (sdev)->set_stream_data_offset (sdev, substream, +return sof_ops (sdev)->set_stream_data_offset (sdev, sps, posn_offset);return 0 ;
sound/soc/sof/sof-priv.h +2 -2
@@ -247,7 +247,7 @@ struct snd_sof_dsp_ops {/* host side configuration of the stream's data offset in stream mailbox area */ int (*set_stream_data_offset)(struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset);/* optional */ /* pre/post firmware run */
@@ -748,7 +748,7 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,struct snd_sof_pcm_stream *sps, void *p, size_t sz);int sof_set_stream_data_offset (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset); int sof_stream_pcm_open(struct snd_sof_dev *sdev,
sound/soc/sof/stream-ipc.c +2 -1
@@ -48,9 +48,10 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,EXPORT_SYMBOL (sof_ipc_msg_data);int sof_set_stream_data_offset (struct snd_sof_dev *sdev, -struct snd_pcm_substream *substream, +struct snd_sof_pcm_stream *sps,size_t posn_offset) { +struct snd_pcm_substream *substream = sps->substream;struct sof_stream *stream = substream->runtime->private_data;/* check if offset is overflow or it is not aligned */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 547/969 ASoC: SOF: Add support for compress API for stream data/offset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Baluta <[email protected]>
[ Upstream commit 090349a9feba3ceee3997d31d68ffe54e5b57acb ]
snd_sof_pcm_stream keeps information about both PCM (snd_pcm_substream) and Compress (snd_compr_stream) streams.
When PCM substream pointer is NULL this means we are dealing with a compress stream.
Stable-dep-of: 2c4fdd055f92 ("ASoC: SOF: compress: return the configured codec from get_params")
--- sound/soc/sof/sof-priv.h | 1 + sound/soc/sof/stream-ipc.c | 48 ++++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 12 deletions(-)
sound/soc/sof/sof-priv.h +1 -0
@@ -112,6 +112,7 @@ struct sof_compr_stream {u32 sampling_rate;u16 channels;u16 sample_container_bytes; +size_t posn_offset; };struct snd_sof_dev ;
sound/soc/sof/stream-ipc.c +36 -12
68 lines not on this page · raw message
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 548/969 ASoC: SOF: compress: return the configured codec from get_params
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit 2c4fdd055f92a2fc8602dcd88bcea08c374b7e8b ]
The SOF compressed offload path accepts codec parameters in sof_compr_set_params() and forwards them to firmware as extended data in the SOF IPC stream params message.
However, sof_compr_get_params() still returns success without filling the snd_codec structure. Since the compress core allocates that structure zeroed and copies it back to userspace on success, SNDRV_COMPRESS_GET_PARAMS returns an all-zero codec description even after the stream has been configured successfully.
The stale TODO in this callback conflates get_params() with capability discovery. Supported codec enumeration belongs in get_caps() and get_codec_caps(). get_params() should report the current codec settings.
Cache the codec accepted by sof_compr_set_params() in the per-stream SOF compress state and return it from sof_compr_get_params().
--- sound/soc/sof/compress.c | 8 +++++--- sound/soc/sof/sof-priv.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-)
sound/soc/sof/compress.c +5 -3
@@ -240,6 +240,7 @@ static int sof_compr_set_params(struct snd_soc_component *component, sstream->sampling_rate = params->codec.sample_rate; sstream->channels = params->codec.ch_out; sstream->sample_container_bytes = pcm->params.sample_container_bytes; + sstream->codec_params = params->codec; spcm->prepared[cstream->direction] = true;
@@ -252,9 +253,10 @@ static int sof_compr_set_params(struct snd_soc_component *component,static int sof_compr_get_params (struct snd_soc_component *component,struct snd_compr_stream *cstream,struct snd_codec *params) { -/* TODO: we don't query the supported codecs for now, if the -* application asks for an unsupported codec the set_params() will fail. -*/ +struct sof_compr_stream *sstream = cstream->runtime->private_data; + + *params = sstream->codec_params; +return 0 ; }
sound/soc/sof/sof-priv.h +2 -0
@@ -17,6 +17,7 @@#include <sound/sof/info.h> #include <sound/sof/pm.h> #include <sound/sof/trace.h> +#include <sound/compress_params.h> #include <uapi/sound/sof/fw.h> #include <sound/sof/ext_manifest.h>
@@ -112,6 +113,7 @@ struct sof_compr_stream {u32 sampling_rate;u16 channels;u16 sample_container_bytes; +struct snd_codec codec_params;size_t posn_offset; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 549/969 PCI: Add PCIE_PME_TO_L2_TIMEOUT_US L2 ready timeout value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit e78bd50b4078b3b2d9f85d97796b7c271e7860ca ]
Add the PCIE_PME_TO_L2_TIMEOUT_US macro to define the L2 ready timeout as described in the PCI specifications.
Stable-dep-of: adaffed907f1 ("PCI: tegra194: Fix polling delay for L2 state")
--- drivers/pci/pci.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/pci/pci.h +6 -0
@@ -14,6 +14,12 @@#define PCI_EXP_AER_FLAGS (PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_NFERE | \ PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE) +/* +* PCIe r6.0, sec 5.3.3.2.1 <PME Synchronization> +* Recommends 1ms to 10ms timeout to check L2 ready. +*/ +#define PCIE_PME_TO_L2_TIMEOUT_US 10000 +extern const unsigned char pcie_link_speed[];extern bool pci_early_dump;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 550/969 PCI: tegra194: Fix polling delay for L2 state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
[ Upstream commit adaffed907f14f954096555665ad6af2ae724d83 ]
As per PCIe r7.0, sec 5.3.3.2.1, after sending PME_Turn_Off message, Root Port should wait for 1-10 msec for PME_TO_Ack message. Currently, driver is polling for 10 msec with 1 usec delay which is aggressive. Use existing macro PCIE_PME_TO_L2_TIMEOUT_US to poll for 10 msec with 1 msec delay. Since this function is used in non-atomic context only, use non-atomic poll function.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +4 -5
@@ -206,8 +206,6 @@#define CAP_SPCIE_CAP_OFF_USP_TX_PRESET0_MASK GENMASK(11, 8)#define CAP_SPCIE_CAP_OFF_USP_TX_PRESET0_SHIFT 8 -#define PME_ACK_TIMEOUT 10000 -#define LTSSM_TIMEOUT 50000/* 50ms */ #define GEN3_GEN4_EQ_PRESET_INIT 5
@@ -1569,9 +1567,10 @@ static int tegra_pcie_try_link_l2(struct tegra_pcie_dw *pcie) val |=APPL_PM_XMT_TURNOFF_STATE ;appl_writel (pcie, val,APPL_RADM_STATUS ); -return readl_poll_timeout_atomic (pcie->appl_base +APPL_DEBUG , val, - val &APPL_DEBUG_PM_LINKST_IN_L2_LAT , -1 ,PME_ACK_TIMEOUT ); +return readl_poll_timeout (pcie->appl_base +APPL_DEBUG , val, + val &APPL_DEBUG_PM_LINKST_IN_L2_LAT , +PCIE_PME_TO_L2_TIMEOUT_US /10 , +PCIE_PME_TO_L2_TIMEOUT_US ); }static void tegra_pcie_dw_pme_turnoff (struct tegra_pcie_dw *pcie)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 551/969 PCI: tegra194: Increase LTSSM poll time on surprise link down
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manikanta Maddireddy <[email protected]>
[ Upstream commit 74dd8efe4d6cead433162147333af989a568aac7 ]
On surprise link down, LTSSM state transits from L0 -> Recovery.RcvrLock -> Recovery.RcvrSpeed -> Gen1 Recovery.RcvrLock -> Detect. Recovery.RcvrLock and Recovery.RcvrSpeed transit times are 24 ms and 48 ms respectively, so the total time from L0 to Detect is ~96 ms. Increase the poll timeout to 120 ms to account for this.
While at it, add LTSSM state defines for Detect-related states and use them in the poll condition. Use readl_poll_timeout() instead of readl_poll_timeout_atomic() in tegra_pcie_dw_pme_turnoff() since that path runs in non-atomic context.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +21 -15
@@ -140,7 +140,11 @@#define APPL_DEBUG_PM_LINKST_IN_L0 0x11#define APPL_DEBUG_LTSSM_STATE_MASK GENMASK(8, 3)#define APPL_DEBUG_LTSSM_STATE_SHIFT 3 -#define LTSSM_STATE_PRE_DETECT 5 +#define LTSSM_STATE_DETECT_QUIET 0x00 +#define LTSSM_STATE_DETECT_ACT 0x08 +#define LTSSM_STATE_PRE_DETECT_QUIET 0x28 +#define LTSSM_STATE_DETECT_WAIT 0x30 +#define LTSSM_STATE_L2_IDLE 0xa8#define APPL_RADM_STATUS 0xE4#define APPL_PM_XMT_TURNOFF_STATE BIT(0)
@@ -206,7 +210,8 @@#define CAP_SPCIE_CAP_OFF_USP_TX_PRESET0_MASK GENMASK(11, 8)#define CAP_SPCIE_CAP_OFF_USP_TX_PRESET0_SHIFT 8 -#define LTSSM_TIMEOUT 50000/* 50ms */ +#define LTSSM_DELAY_US 10000/* 10 ms */ +#define LTSSM_TIMEOUT_US 120000/* 120 ms */ #define GEN3_GEN4_EQ_PRESET_INIT 5
@@ -1613,15 +1618,14 @@ static void tegra_pcie_dw_pme_turnoff(struct tegra_pcie_dw *pcie) data &= ~APPL_CTRL_LTSSM_EN ;writel (data, pcie->appl_base +APPL_CTRL ); - err =readl_poll_timeout_atomic (pcie->appl_base +APPL_DEBUG , - data, - ((data & -APPL_DEBUG_LTSSM_STATE_MASK ) >> -APPL_DEBUG_LTSSM_STATE_SHIFT ) == -LTSSM_STATE_PRE_DETECT , -1 ,LTSSM_TIMEOUT ); + err =readl_poll_timeout (pcie->appl_base +APPL_DEBUG , data, + ((data &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_DETECT_QUIET ) || + ((data &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_DETECT_ACT ) || + ((data &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_PRE_DETECT_QUIET ) || + ((data &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_DETECT_WAIT ), +LTSSM_DELAY_US ,LTSSM_TIMEOUT_US );if (err) -dev_info (pcie->dev,"Link didn't go to detect state\n" ); +dev_info (pcie->dev,"LTSSM state: 0x%x detect timeout: %d\n" , data, err); }/* * DBI registers may not be accessible after this as PLL-E would be
@@ -1709,12 +1713,14 @@ static void pex_ep_event_pex_rst_assert(struct tegra_pcie_dw *pcie)appl_writel (pcie, val,APPL_CTRL ); ret =readl_poll_timeout (pcie->appl_base +APPL_DEBUG , val, - ((val &APPL_DEBUG_LTSSM_STATE_MASK ) >> -APPL_DEBUG_LTSSM_STATE_SHIFT ) == -LTSSM_STATE_PRE_DETECT , -1 ,LTSSM_TIMEOUT ); + ((val &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_DETECT_QUIET ) || + ((val &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_DETECT_ACT ) || + ((val &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_PRE_DETECT_QUIET ) || + ((val &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_DETECT_WAIT ) || + ((val &APPL_DEBUG_LTSSM_STATE_MASK ) ==LTSSM_STATE_L2_IDLE ), +LTSSM_DELAY_US ,LTSSM_TIMEOUT_US );if (ret) -dev_err (pcie->dev,"Failed to go Detect state: %d\n" , ret); +dev_info (pcie->dev,"LTSSM state: 0x%x detect timeout: %d\n" , val, ret);reset_control_assert (pcie->core_rst);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 552/969 PCI: tegra194: Disable LTSSM after transition to Detect on surprise link down
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manikanta Maddireddy <[email protected]>
[ Upstream commit 9fa0c242f8d7acf1b124d4462d18f4023573ac1c ]
After the link reaches a Detect-related LTSSM state, disable LTSSM so it does not keep toggling between Polling and Detect. Do this by polling for the Detect state first, then clearing APPL_CTRL_LTSSM_EN in both tegra_pcie_dw_pme_turnoff() and pex_ep_event_pex_rst_assert().
--- drivers/pci/controller/dwc/pcie-tegra194.c | 29 ++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +16 -13
@@ -1610,14 +1610,6 @@ static void tegra_pcie_dw_pme_turnoff(struct tegra_pcie_dw *pcie) data &= ~APPL_PINMUX_PEX_RST ;appl_writel (pcie, data,APPL_PINMUX ); -/* -* Some cards do not go to detect state even after de-asserting -* PERST#. So, de-assert LTSSM to bring link to detect state. -*/ - data =readl (pcie->appl_base +APPL_CTRL ); - data &= ~APPL_CTRL_LTSSM_EN ; -writel (data, pcie->appl_base +APPL_CTRL ); - err = readl_poll_timeout(pcie->appl_base + APPL_DEBUG, data, ((data & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_QUIET) || ((data & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_ACT) ||
@@ -1626,6 +1618,14 @@ static void tegra_pcie_dw_pme_turnoff(struct tegra_pcie_dw *pcie) LTSSM_DELAY_US, LTSSM_TIMEOUT_US);if (err)dev_info (pcie->dev,"LTSSM state: 0x%x detect timeout: %d\n" , data, err); + +/* +* Deassert LTSSM state to stop the state toggling between +* Polling and Detect. +*/ + data =readl (pcie->appl_base +APPL_CTRL ); + data &= ~APPL_CTRL_LTSSM_EN ; +writel (data, pcie->appl_base +APPL_CTRL ); }/* * DBI registers may not be accessible after this as PLL-E would be
@@ -1707,11 +1707,6 @@ static void pex_ep_event_pex_rst_assert(struct tegra_pcie_dw *pcie)if (pcie->ep_state ==EP_STATE_DISABLED )return ; -/* Disable LTSSM */ - val =appl_readl (pcie,APPL_CTRL ); - val &= ~APPL_CTRL_LTSSM_EN ; -appl_writel (pcie, val,APPL_CTRL ); - ret = readl_poll_timeout(pcie->appl_base + APPL_DEBUG, val, ((val & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_QUIET) || ((val & APPL_DEBUG_LTSSM_STATE_MASK) == LTSSM_STATE_DETECT_ACT) ||
@@ -1722,6 +1717,14 @@ static void pex_ep_event_pex_rst_assert(struct tegra_pcie_dw *pcie)if (ret)dev_info (pcie->dev,"LTSSM state: 0x%x detect timeout: %d\n" , val, ret); +/* +* Deassert LTSSM state to stop the state toggling between +* Polling and Detect. +*/ + val =appl_readl (pcie,APPL_CTRL ); + val &= ~APPL_CTRL_LTSSM_EN ; +appl_writel (pcie, val,APPL_CTRL ); +reset_control_assert (pcie->core_rst);tegra_pcie_disable_phy (pcie);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 553/969 PCI: tegra194: Rename root_bus to root_port_bus in tegra_pcie_downstream_dev_to_D0()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit e1bd928479fb1fa60e9034b0fdb1ab9f3fa92f33 ]
In tegra_pcie_downstream_dev_to_D0(), PCI devices are transitioned to D0 state. For iterating over the devices, first the downstream bus of the Root Port is searched from the root bus. But the name of the variable that holds the Root Port downstream bus is named as 'root_bus', which is wrong.
Rename the variable to 'root_port_bus'. Also, move the comment on 'bringing the devices to D0' to where the state is set exactly.
Stable-dep-of: 71d9f67701e1 ("PCI: tegra194: Don't force the device into the D0 state before L2")
--- drivers/pci/controller/dwc/pcie-tegra194.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +6 -6
@@ -1277,7 +1277,7 @@ static int tegra_pcie_bpmp_set_pll_state(struct tegra_pcie_dw *pcie,static void tegra_pcie_downstream_dev_to_D0 (struct tegra_pcie_dw *pcie) {struct dw_pcie_rp *pp = &pcie->pci.pp; -struct pci_bus *child, *root_bus =NULL ; +struct pci_bus *child, *root_port_bus =NULL ;struct pci_dev *pdev;/*
@@ -1290,19 +1290,19 @@ static void tegra_pcie_downstream_dev_to_D0(struct tegra_pcie_dw *pcie)*/ list_for_each_entry (child, &pp->bridge->bus->children, node) { -/* Bring downstream devices to D0 if they are not already in */ if (child->parent == pp->bridge->bus) { - root_bus = child; + root_port_bus = child;break ; } } -if (!root_bus) { -dev_err (pcie->dev,"Failed to find downstream devices\n" ); +if (!root_port_bus) { +dev_err (pcie->dev,"Failed to find downstream bus of Root Port\n" );return ; } -list_for_each_entry (pdev, &root_bus->devices, bus_list) { +/* Bring downstream devices to D0 if they are not already in */ +list_for_each_entry (pdev, &root_port_bus->devices, bus_list) {if (PCI_SLOT (pdev->devfn) ==0 ) {if (pci_set_power_state (pdev,PCI_D0 )) dev_err(pcie->dev,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 554/969 PCI: tegra194: Dont force the device into the D0 state before L2
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
[ Upstream commit 71d9f67701e1affc82d18ca88ae798c5361beddf ]
As per PCIe CEM r6.0, sec 2.3, the PCIe Endpoint device should be in D3cold to assert WAKE# pin. The previous workaround that forced downstream devices to D0 before taking the link to L2 cited PCIe r4.0, sec 5.2, "Link State Power Management"; however, that spec does not explicitly require putting the device into D0 and only indicates that power removal may be initiated without transitioning to D3hot.
Remove the D0 workaround so that Endpoint devices can use wake functionality (WAKE# from D3). With some Endpoints the link may not enter L2 when they remain in D3, but the Root Port continues with the usual flow after PME timeout, so there is no functional issue.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 41 ---------------------- 1 file changed, 41 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +0 -41
@@ -1274,44 +1274,6 @@ static int tegra_pcie_bpmp_set_pll_state(struct tegra_pcie_dw *pcie,return 0 ; } -static void tegra_pcie_downstream_dev_to_D0 (struct tegra_pcie_dw *pcie) -{ -struct dw_pcie_rp *pp = &pcie->pci.pp; -struct pci_bus *child, *root_port_bus =NULL ; -struct pci_dev *pdev; - -/* -* link doesn't go into L2 state with some of the endpoints with Tegra -* if they are not in D0 state. So, need to make sure that immediate -* downstream devices are in D0 state before sending PME_TurnOff to put -* link into L2 state. -* This is as per PCI Express Base r4.0 v1.0 September 27-2017, -* 5.2 Link State Power Management (Page #428). -*/ - -list_for_each_entry (child, &pp->bridge->bus->children, node) { -if (child->parent == pp->bridge->bus) { - root_port_bus = child; -break ; - } - } - -if (!root_port_bus) { -dev_err (pcie->dev,"Failed to find downstream bus of Root Port\n" ); -return ; - } - -/* Bring downstream devices to D0 if they are not already in */ -list_for_each_entry (pdev, &root_port_bus->devices, bus_list) { -if (PCI_SLOT (pdev->devfn) ==0 ) { -if (pci_set_power_state (pdev,PCI_D0 )) -dev_err (pcie->dev, -"Failed to transition %s to D0 state\n" , -dev_name (&pdev->dev)); - } - } -} -static int tegra_pcie_get_slot_regulators (struct tegra_pcie_dw *pcie) { pcie->slot_ctl_3v3 =devm_regulator_get_optional (pcie->dev,"vpcie3v3" );
@@ -1641,7 +1603,6 @@ static void tegra_pcie_dw_pme_turnoff(struct tegra_pcie_dw *pcie)static void tegra_pcie_deinit_controller (struct tegra_pcie_dw *pcie) { -tegra_pcie_downstream_dev_to_D0 (pcie);dw_pcie_host_deinit (&pcie->pci.pp);tegra_pcie_dw_pme_turnoff (pcie);tegra_pcie_unconfig_controller (pcie);
@@ -2353,7 +2314,6 @@ static int tegra_pcie_dw_suspend_noirq(struct device *dev)if (!pcie->link_state)return 0 ; -tegra_pcie_downstream_dev_to_D0 (pcie);tegra_pcie_dw_pme_turnoff (pcie);tegra_pcie_unconfig_controller (pcie);
@@ -2427,7 +2387,6 @@ static void tegra_pcie_dw_shutdown(struct platform_device *pdev)return ;debugfs_remove_recursive (pcie->debugfs); -tegra_pcie_downstream_dev_to_D0 (pcie);disable_irq (pcie->pci.pp.irq);if (IS_ENABLED (CONFIG_PCI_MSI ))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 555/969 PCI: tegra194: Disable PERST# IRQ only in Endpoint mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manikanta Maddireddy <[email protected]>
[ Upstream commit 40658a31b6e134169c648041efc84944c4c71dcd ]
The PERST# GPIO interrupt is only registered when the controller is operating in Endpoint mode. In Root Port mode, the PERST# GPIO is configured as an output to control downstream devices, and no interrupt is registered for it.
Currently, tegra_pcie_dw_stop_link() unconditionally calls disable_irq() on pex_rst_irq, which causes issues in Root Port mode where this IRQ is not registered.
Fix this by only disabling the PERST# IRQ when operating in Endpoint mode, where the interrupt is actually registered and used to detect PERST# assertion/deassertion from the host.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-tegra194.c +2 -1
@@ -1041,7 +1041,8 @@ static void tegra_pcie_dw_stop_link(struct dw_pcie *pci) {struct tegra_pcie_dw *pcie =to_tegra_pcie (pci); -disable_irq (pcie->pex_rst_irq); +if (pcie->of_data->mode ==DW_PCIE_EP_TYPE ) +disable_irq (pcie->pex_rst_irq); }static const struct dw_pcie_ops tegra_dw_pcie_ops = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 556/969 PCI: tegra194: Use devm_gpiod_get_optional() to parse "nvidia,refclk-select"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
[ Upstream commit f62bc7917de1374dce86a852ffba8baf9cb7a56a ]
The GPIO DT property "nvidia,refclk-select", to select the PCIe reference clock is optional. Use devm_gpiod_get_optional() to get it.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +3 -3
@@ -1183,9 +1183,9 @@ static int tegra_pcie_dw_parse_dt(struct tegra_pcie_dw *pcie)return err; } - pcie->pex_refclk_sel_gpiod =devm_gpiod_get (pcie->dev, -"nvidia,refclk-select" , -GPIOD_OUT_HIGH ); + pcie->pex_refclk_sel_gpiod =devm_gpiod_get_optional (pcie->dev, +"nvidia,refclk-select" , +GPIOD_OUT_HIGH );if (IS_ERR (pcie->pex_refclk_sel_gpiod)) {int err =PTR_ERR (pcie->pex_refclk_sel_gpiod);const char *level =KERN_ERR ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 557/969 PCI: tegra194: Disable direct speed change for Endpoint mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
[ Upstream commit 976f6763f57970388bcd7118931f33f447916927 ]
Pre-silicon simulation showed the controller operating in Endpoint mode initiating link speed change after completing Secondary Bus Reset. Ideally, the Root Port or the Switch Downstream Port should initiate the link speed change post SBR, not the Endpoint.
So, as per the hardware team recommendation, disable direct speed change for the Endpoint mode to prevent it from initiating speed change after the physical layer link is up at Gen1, leaving speed change ownership with the host.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/controller/dwc/pcie-tegra194.c +4 -0
@@ -1825,6 +1825,10 @@ static void pex_ep_event_pex_rst_deassert(struct tegra_pcie_dw *pcie)reset_control_deassert (pcie->core_rst); + val =dw_pcie_readl_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL ); + val &= ~PORT_LOGIC_SPEED_CHANGE ; +dw_pcie_writel_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL , val); +if (pcie->update_fc_fixup) { val =dw_pcie_readl_dbi (pci,CFG_TIMER_CTRL_MAX_FUNC_NUM_OFF ); val |=0x1 <<CFG_TIMER_CTRL_ACK_NAK_SHIFT ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 558/969 PCI: tegra194: Allow system suspend when the Endpoint link is not up
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
[ Upstream commit c76f8eae7d4695b1176c4ea5eb93c17e16a20272 ]
Host software initiates the L2 sequence. PCIe link is kept in L2 state during suspend. If Endpoint mode is enabled and the link is up, the software cannot proceed with suspend. However, when the PCIe Endpoint driver is probed, but the PCIe link is not up, Tegra can go into suspend state. So, allow system to suspend in this case.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +25 -6
@@ -2287,16 +2287,28 @@ static int tegra_pcie_dw_remove(struct platform_device *pdev)return 0 ; } -static int tegra_pcie_dw_suspend_late (struct device *dev) +static int tegra_pcie_dw_suspend (struct device *dev) {struct tegra_pcie_dw *pcie =dev_get_drvdata (dev); -u32 val;if (pcie->of_data->mode ==DW_PCIE_EP_TYPE ) { -dev_err (dev,"Failed to Suspend as Tegra PCIe is in EP mode\n" ); -return -EPERM ; +if (pcie->ep_state ==EP_STATE_ENABLED ) { +dev_err (dev,"Tegra PCIe is in EP mode, suspend not allowed\n" ); +return -EPERM ; + } + +disable_irq (pcie->pex_rst_irq); +return 0 ; } +return 0 ; +} + +static int tegra_pcie_dw_suspend_late (struct device *dev) +{ +struct tegra_pcie_dw *pcie =dev_get_drvdata (dev); +u32 val; +if (!pcie->link_state)return 0 ;
@@ -2316,6 +2328,9 @@ static int tegra_pcie_dw_suspend_noirq(struct device *dev) {struct tegra_pcie_dw *pcie =dev_get_drvdata (dev); +if (pcie->of_data->mode ==DW_PCIE_EP_TYPE ) +return 0 ; +if (!pcie->link_state)return 0 ;
@@ -2330,6 +2345,9 @@ static int tegra_pcie_dw_resume_noirq(struct device *dev)struct tegra_pcie_dw *pcie =dev_get_drvdata (dev);int ret; +if (pcie->of_data->mode ==DW_PCIE_EP_TYPE ) +return 0 ; +if (!pcie->link_state)return 0 ;
@@ -2362,8 +2380,8 @@ static int tegra_pcie_dw_resume_early(struct device *dev)u32 val;if (pcie->of_data->mode ==DW_PCIE_EP_TYPE ) { -dev_err (dev,"Suspend is not supported in EP mode" ); -return -ENOTSUPP ; +enable_irq (pcie->pex_rst_irq); +return 0 ; }if (!pcie->link_state)
@@ -2468,6 +2486,7 @@ static const struct of_device_id tegra_pcie_dw_of_match[] = { };static const struct dev_pm_ops tegra_pcie_dw_pm_ops = { + .suspend = tegra_pcie_dw_suspend, .suspend_late = tegra_pcie_dw_suspend_late, .suspend_noirq = tegra_pcie_dw_suspend_noirq, .resume_noirq = tegra_pcie_dw_resume_noirq,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 559/969 spi: mtk-snfi: unregister ECC engine on probe failure and remove() callback
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit ab00febad191d7a4400aa1c3468279fb508258d4 ]
mtk_snand_probe() registers the on-host NAND ECC engine, but teardown was missing from both probe unwind and remove-time cleanup. Add a devm cleanup action after successful registration so nand_ecc_unregister_on_host_hw_engine() runs automatically on probe failures and during device removal.
--- drivers/spi/spi-mtk-snfi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/spi/spi-mtk-snfi.c +14 -0
@@ -1276,6 +1276,13 @@ static const struct spi_controller_mem_caps mtk_snand_mem_caps = { .ecc = true, }; +static void mtk_unregister_ecc_engine (void *data) +{ +struct nand_ecc_engine *eng = data; + +nand_ecc_unregister_on_host_hw_engine (eng); +} +static irqreturn_t mtk_snand_irq (int irq,void *id) {struct mtk_snand *snf = id;
@@ -1424,6 +1431,13 @@ static int mtk_snand_probe(struct platform_device *pdev) goto disable_clk; } + ret =devm_add_action_or_reset (&pdev->dev, mtk_unregister_ecc_engine, + &ms->ecc_eng); +if (ret) { +dev_err_probe (&pdev->dev, ret,"failed to add ECC unregister action\n" ); + goto release_ecc; + } + ctlr->num_chipselect =1 ; ctlr->mem_ops = &mtk_snand_mem_ops; ctlr->mem_caps = &mtk_snand_mem_caps;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 560/969 ALSA: sc6000: Use standard print API
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit e7c475b92043c02c3e6cd0c20e308fbb6f03ebde ]
Use the standard print API with dev_*() instead of the old house-baked one. It gives better information and allows dynamically control of debug prints.
Some functions are changed to receive a device pointer to be passed to dev_*() calls.
Stable-dep-of: fb79bf127ac2 ("ALSA: sc6000: Keep the programmed board state in card-private data")
--- sound/isa/sc6000.c | 177 +++++++++++++++++++++++---------------------- 1 file changed, 90 insertions(+), 87 deletions(-)
sound/isa/sc6000.c +90 -87
@@ -204,7 +204,7 @@ static int sc6000_read(char __iomem *vport) } -static int sc6000_write (char __iomem *vport,int cmd) +static int sc6000_write (struct device *devptr,char __iomem *vport,int cmd) {unsigned char val;int loop =500000 ;
@@ -221,18 +221,19 @@ static int sc6000_write(char __iomem *vport, int cmd)cpu_relax (); }while (loop--); -snd_printk (KERN_ERR "DSP Command (0x%x) timeout.\n" , cmd); +dev_err (devptr,"DSP Command (0x%x) timeout.\n" , cmd);return -EIO ; } -static int sc6000_dsp_get_answer (char __iomem *vport,int command, +static int sc6000_dsp_get_answer (struct device *devptr, +char __iomem *vport,int command,char *data,int data_len) {int len =0 ; -if (sc6000_write (vport, command)) { -snd_printk (KERN_ERR "CMD 0x%x: failed!\n" , command); +if (sc6000_write (devptr, vport, command)) { +dev_err (devptr,"CMD 0x%x: failed!\n" , command);return -EIO ; }
@@ -265,82 +266,86 @@ static int sc6000_dsp_reset(char __iomem *vport) }/* detection and initialization */ -static int sc6000_hw_cfg_write (char __iomem *vport,const int *cfg) +static int sc6000_hw_cfg_write (struct device *devptr, +char __iomem *vport,const int *cfg) { -if (sc6000_write (vport,COMMAND_6C ) <0 ) { -snd_printk (KERN_WARNING "CMD 0x%x: failed!\n" ,COMMAND_6C ); +if (sc6000_write (devptr, vport,COMMAND_6C ) <0 ) { +dev_warn (devptr,"CMD 0x%x: failed!\n" ,COMMAND_6C );return -EIO ; } -if (sc6000_write (vport,COMMAND_5C ) <0 ) { -snd_printk (KERN_ERR "CMD 0x%x: failed!\n" ,COMMAND_5C ); +if (sc6000_write (devptr, vport,COMMAND_5C ) <0 ) { +dev_err (devptr,"CMD 0x%x: failed!\n" ,COMMAND_5C );return -EIO ; } -if (sc6000_write (vport, cfg[0 ]) <0 ) { -snd_printk (KERN_ERR "DATA 0x%x: failed!\n" , cfg[0 ]); +if (sc6000_write (devptr, vport, cfg[0 ]) <0 ) { +dev_err (devptr,"DATA 0x%x: failed!\n" , cfg[0 ]);return -EIO ; } -if (sc6000_write (vport, cfg[1 ]) <0 ) { -snd_printk (KERN_ERR "DATA 0x%x: failed!\n" , cfg[1 ]); +if (sc6000_write (devptr, vport, cfg[1 ]) <0 ) { +dev_err (devptr,"DATA 0x%x: failed!\n" , cfg[1 ]);return -EIO ; } -if (sc6000_write (vport,COMMAND_C5 ) <0 ) { -snd_printk (KERN_ERR "CMD 0x%x: failed!\n" ,COMMAND_C5 ); +if (sc6000_write (devptr, vport,COMMAND_C5 ) <0 ) { +dev_err (devptr,"CMD 0x%x: failed!\n" ,COMMAND_C5 );return -EIO ; }return 0 ; } -static int sc6000_cfg_write (char __iomem *vport,unsigned char softcfg) +static int sc6000_cfg_write (struct device *devptr, +char __iomem *vport,unsigned char softcfg) { -if (sc6000_write (vport,WRITE_MDIRQ_CFG )) { -snd_printk (KERN_ERR "CMD 0x%x: failed!\n" ,WRITE_MDIRQ_CFG ); +if (sc6000_write (devptr, vport,WRITE_MDIRQ_CFG )) { +dev_err (devptr,"CMD 0x%x: failed!\n" ,WRITE_MDIRQ_CFG );return -EIO ; } -if (sc6000_write (vport, softcfg)) { -snd_printk (KERN_ERR "sc6000_cfg_write: failed!\n" ); +if (sc6000_write (devptr, vport, softcfg)) { +dev_err (devptr,"%s: failed!\n" , __func__);return -EIO ; }return 0 ; } -static int sc6000_setup_board (char __iomem *vport,int config) +static int sc6000_setup_board (struct device *devptr, +char __iomem *vport,int config) {int loop =10 ;do { -if (sc6000_write (vport,COMMAND_88 )) { -snd_printk (KERN_ERR "CMD 0x%x: failed!\n" , -COMMAND_88 ); +if (sc6000_write (devptr, vport,COMMAND_88 )) { +dev_err (devptr,"CMD 0x%x: failed!\n" , +COMMAND_88 );return -EIO ; } }while ((sc6000_wait_data (vport) <0 ) && loop--);if (sc6000_read (vport) <0 ) { -snd_printk (KERN_ERR "sc6000_read after CMD 0x%x: failed\n" , -COMMAND_88 ); +dev_err (devptr,"sc6000_read after CMD 0x%x: failed\n" , +COMMAND_88 );return -EIO ; } -if (sc6000_cfg_write (vport, config)) +if (sc6000_cfg_write (devptr, vport, config))return -ENODEV ;return 0 ; } -static int sc6000_init_mss (char __iomem *vport,int config, +static int sc6000_init_mss (struct device *devptr, +char __iomem *vport,int config,char __iomem *vmss_port,int mss_config) { -if (sc6000_write (vport,DSP_INIT_MSS )) { -snd_printk (KERN_ERR "sc6000_init_mss [0x%x]: failed!\n" , -DSP_INIT_MSS ); +if (sc6000_write (devptr, vport,DSP_INIT_MSS )) { +dev_err (devptr,"%s [0x%x]: failed!\n" , __func__, +DSP_INIT_MSS );return -EIO ; }msleep (10 ); -if (sc6000_cfg_write (vport, config)) +if (sc6000_cfg_write (devptr, vport, config))return -EIO ;iowrite8 (mss_config, vmss_port);
@@ -348,7 +353,8 @@ static int sc6000_init_mss(char __iomem *vport, int config,return 0 ; } -static void sc6000_hw_cfg_encode (char __iomem *vport,int *cfg, +static void sc6000_hw_cfg_encode (struct device *devptr, +char __iomem *vport,int *cfg,long xport,long xmpu,long xmss_port,int joystick) {
@@ -367,10 +373,11 @@ static void sc6000_hw_cfg_encode(char __iomem *vport, int *cfg, cfg[0 ] |=0x02 ; cfg[1 ] |=0x80 ;/* enable WSS system */ cfg[1 ] &= ~0x40 ;/* disable IDE */ -snd_printd ("hw cfg %x, %x\n" , cfg[0 ], cfg[1 ]); +dev_dbg (devptr,"hw cfg %x, %x\n" , cfg[0 ], cfg[1 ]); } -static int sc6000_init_board (char __iomem *vport, +static int sc6000_init_board (struct device *devptr, +char __iomem *vport,char __iomem *vmss_port,int dev) {char answer[15 ];
@@ -384,14 +391,14 @@ static int sc6000_init_board(char __iomem *vport, err =sc6000_dsp_reset (vport);if (err <0 ) { -snd_printk (KERN_ERR "sc6000_dsp_reset: failed!\n" ); +dev_err (devptr,"sc6000_dsp_reset: failed!\n" );return err; }memset (answer,0 ,sizeof (answer)); - err =sc6000_dsp_get_answer (vport,GET_DSP_COPYRIGHT , answer,15 ); + err =sc6000_dsp_get_answer (devptr, vport,GET_DSP_COPYRIGHT , answer,15 );if (err <=0 ) { -snd_printk (KERN_ERR "sc6000_dsp_copyright: failed!\n" ); +dev_err (devptr,"sc6000_dsp_copyright: failed!\n" );return -ENODEV ; }/*
@@ -399,52 +406,52 @@ static int sc6000_init_board(char __iomem *vport,* if we have something different, we have to be warned. */ if (strncmp ("SC-6000" , answer,7 )) -snd_printk (KERN_WARNING "Warning: non SC-6000 audio card!\n" ); +dev_warn (devptr,"Warning: non SC-6000 audio card!\n" ); -if (sc6000_dsp_get_answer (vport,GET_DSP_VERSION , version,2 ) <2 ) { -snd_printk (KERN_ERR "sc6000_dsp_version: failed!\n" ); +if (sc6000_dsp_get_answer (devptr, vport,GET_DSP_VERSION , version,2 ) <2 ) { +dev_err (devptr,"sc6000_dsp_version: failed!\n" );return -ENODEV ; } - printk(KERN_INFO PFX "Detected model: %s, DSP version %d.%d\n", +dev_info (devptr,"Detected model: %s, DSP version %d.%d\n" , answer, version[0 ], version[1 ]);/* set configuration */ -sc6000_write (vport,COMMAND_5C ); +sc6000_write (devptr, vport,COMMAND_5C );if (sc6000_read (vport) <0 ) old =1 ;if (!old) {int cfg[2 ]; -sc6000_hw_cfg_encode (vport, &cfg[0 ], port[dev], mpu_port[dev], +sc6000_hw_cfg_encode (devptr, + vport, &cfg[0 ], port[dev], mpu_port[dev], mss_port[dev], joystick[dev]); -if (sc6000_hw_cfg_write (vport, cfg) <0 ) { -snd_printk (KERN_ERR "sc6000_hw_cfg_write: failed!\n" ); +if (sc6000_hw_cfg_write (devptr, vport, cfg) <0 ) { +dev_err (devptr,"sc6000_hw_cfg_write: failed!\n" );return -EIO ; } } - err =sc6000_setup_board (vport, config); + err =sc6000_setup_board (devptr, vport, config);if (err <0 ) { -snd_printk (KERN_ERR "sc6000_setup_board: failed!\n" ); +dev_err (devptr,"sc6000_setup_board: failed!\n" );return -ENODEV ; }sc6000_dsp_reset (vport);if (!old) { -sc6000_write (vport,COMMAND_60 ); -sc6000_write (vport,0x02 ); +sc6000_write (devptr, vport,COMMAND_60 ); +sc6000_write (devptr, vport,0x02 );sc6000_dsp_reset (vport); } - err =sc6000_setup_board (vport, config); + err =sc6000_setup_board (devptr, vport, config);if (err <0 ) { -snd_printk (KERN_ERR "sc6000_setup_board: failed!\n" ); +dev_err (devptr,"sc6000_setup_board: failed!\n" );return -ENODEV ; } - err =sc6000_init_mss (vport, config, vmss_port, mss_config); + err =sc6000_init_mss (devptr, vport, config, vmss_port, mss_config);if (err <0 ) { -snd_printk (KERN_ERR "Cannot initialize " -"Microsoft Sound System mode.\n" ); +dev_err (devptr,"Cannot initialize Microsoft Sound System mode.\n" );return -ENODEV ; }
@@ -491,39 +498,39 @@ static int snd_sc6000_match(struct device *devptr, unsigned int dev)if (!enable[dev])return 0 ;if (port[dev] ==SNDRV_AUTO_PORT ) { - printk(KERN_ERR PFX "specify IO port\n"); +dev_err (devptr,"specify IO port\n" );return 0 ; }if (mss_port[dev] ==SNDRV_AUTO_PORT ) { - printk(KERN_ERR PFX "specify MSS port\n"); +dev_err (devptr,"specify MSS port\n" );return 0 ; }if (port[dev] !=0x220 && port[dev] !=0x240 ) { - printk(KERN_ERR PFX "Port must be 0x220 or 0x240\n"); +dev_err (devptr,"Port must be 0x220 or 0x240\n" );return 0 ; }if (mss_port[dev] !=0x530 && mss_port[dev] !=0xe80 ) { - printk(KERN_ERR PFX "MSS port must be 0x530 or 0xe80\n"); +dev_err (devptr,"MSS port must be 0x530 or 0xe80\n" );return 0 ; }if (irq[dev] !=SNDRV_AUTO_IRQ && !sc6000_irq_to_softcfg (irq[dev])) { - printk(KERN_ERR PFX "invalid IRQ %d\n", irq[dev]); +dev_err (devptr,"invalid IRQ %d\n" , irq[dev]);return 0 ; }if (dma[dev] !=SNDRV_AUTO_DMA && !sc6000_dma_to_softcfg (dma[dev])) { - printk(KERN_ERR PFX "invalid DMA %d\n", dma[dev]); +dev_err (devptr,"invalid DMA %d\n" , dma[dev]);return 0 ; }if (mpu_port[dev] !=SNDRV_AUTO_PORT && (mpu_port[dev] & ~0x30L ) !=0x300 ) { - printk(KERN_ERR PFX "invalid MPU-401 port %lx\n", +dev_err (devptr,"invalid MPU-401 port %lx\n" , mpu_port[dev]);return 0 ; }if (mpu_port[dev] !=SNDRV_AUTO_PORT && mpu_irq[dev] !=SNDRV_AUTO_IRQ && mpu_irq[dev] !=0 && !sc6000_mpu_irq_to_softcfg (mpu_irq[dev])) { - printk(KERN_ERR PFX "invalid MPU-401 IRQ %d\n", mpu_irq[dev]); +dev_err (devptr,"invalid MPU-401 IRQ %d\n" , mpu_irq[dev]);return 0 ; }return 1 ;
@@ -534,7 +541,7 @@ static void snd_sc6000_free(struct snd_card *card)char __iomem *vport = (char __force __iomem *)card->private_data;if (vport) -sc6000_setup_board (vport,0 ); +sc6000_setup_board (card->dev, vport,0 ); }static int __snd_sc6000_probe (struct device *devptr,unsigned int dev)
@@ -558,7 +565,7 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)if (xirq ==SNDRV_AUTO_IRQ ) { xirq =snd_legacy_find_free_irq (possible_irqs);if (xirq <0 ) { - snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); +dev_err (devptr,"unable to find a free IRQ\n" );return -EBUSY ; } }
@@ -566,42 +573,39 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)if (xdma ==SNDRV_AUTO_DMA ) { xdma =snd_legacy_find_free_dma (possible_dmas);if (xdma <0 ) { - snd_printk(KERN_ERR PFX "unable to find a free DMA\n"); +dev_err (devptr,"unable to find a free DMA\n" );return -EBUSY ; } }if (!devm_request_region (devptr, port[dev],0x10 ,DRV_NAME )) { - snd_printk(KERN_ERR PFX - "I/O port region is already in use.\n"); +dev_err (devptr,"I/O port region is already in use.\n" );return -EBUSY ; } vport =devm_ioport_map (devptr, port[dev],0x10 );if (!vport) { - snd_printk(KERN_ERR PFX - "I/O port cannot be iomapped.\n"); +dev_err (devptr,"I/O port cannot be iomapped.\n" );return -EBUSY ; } card->private_data = (void __force *)vport;/* to make it marked as used */ if (!devm_request_region (devptr, mss_port[dev],4 ,DRV_NAME )) { - snd_printk(KERN_ERR PFX - "SC-6000 port I/O port region is already in use.\n"); +dev_err (devptr, +"SC-6000 port I/O port region is already in use.\n" );return -EBUSY ; } vmss_port =devm_ioport_map (devptr, mss_port[dev],4 );if (!vmss_port) { - snd_printk(KERN_ERR PFX - "MSS port I/O cannot be iomapped.\n"); +dev_err (devptr,"MSS port I/O cannot be iomapped.\n" );return -EBUSY ; } -snd_printd ("Initializing BASE[0x%lx] IRQ[%d] DMA[%d] MIRQ[%d]\n" , - port[dev], xirq, xdma, - mpu_irq[dev] ==SNDRV_AUTO_IRQ ?0 : mpu_irq[dev]); +dev_dbg (devptr,"Initializing BASE[0x%lx] IRQ[%d] DMA[%d] MIRQ[%d]\n" , + port[dev], xirq, xdma, + mpu_irq[dev] ==SNDRV_AUTO_IRQ ?0 : mpu_irq[dev]); - err =sc6000_init_board (vport, vmss_port, dev); + err =sc6000_init_board (devptr, vport, vmss_port, dev);if (err <0 )return err; card->private_free = snd_sc6000_free;
@@ -613,25 +617,24 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev) err =snd_wss_pcm (chip,0 );if (err <0 ) { - snd_printk(KERN_ERR PFX - "error creating new WSS PCM device\n"); +dev_err (devptr,"error creating new WSS PCM device\n" );return err; } err =snd_wss_mixer (chip);if (err <0 ) { - snd_printk(KERN_ERR PFX "error creating new WSS mixer\n"); +dev_err (devptr,"error creating new WSS mixer\n" );return err; } err =snd_sc6000_mixer (chip);if (err <0 ) { - snd_printk(KERN_ERR PFX "the mixer rewrite failed\n"); +dev_err (devptr,"the mixer rewrite failed\n" );return err; }if (snd_opl3_create (card,0x388 ,0x388 +2 ,OPL3_HW_AUTO ,0 , &opl3) <0 ) { - snd_printk(KERN_ERR PFX "no OPL device at 0x%x-0x%x ?\n", - 0x388, 0x388 + 2); +dev_err (devptr,"no OPL device at 0x%x-0x%x ?\n" , +0x388 ,0x388 +2 ); }else { err =snd_opl3_hwdep_new (opl3,0 ,1 ,NULL );if (err <0 )
@@ -645,8 +648,8 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev) MPU401_HW_MPU401, mpu_port[dev], 0, mpu_irq[dev], NULL) < 0) -snd_printk (KERN_ERR "no MPU-401 device at 0x%lx ?\n" , - mpu_port[dev]); +dev_err (devptr,"no MPU-401 device at 0x%lx ?\n" , + mpu_port[dev]); }strcpy (card->driver,DRV_NAME );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 561/969 ALSA: sc6000: Keep the programmed board state in card-private data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cássio Gabriel <[email protected]>
[ Upstream commit fb79bf127ac2577b4876132da6dba768018aad4c ]
The driver may auto-select IRQ and DMA resources at probe time, but sc6000_init_board() still derives the SC-6000 soft configuration from the module parameter arrays. When irq=auto or dma=auto is used, the codec is created with the selected resources while the board is programmed with the unresolved values.
Store the mapped ports and generated SC-6000 board configuration in card-private data, build that configuration from the live probe results instead of the raw module parameters, and keep the probe-time board programming in a shared helper.
This fixes the resource-programming mismatch and leaves the driver with a stable board-state block that can be reused by suspend/resume.
--- sound/isa/sc6000.c | 152 +++++++++++++++++++++++++++------------------ 1 file changed, 92 insertions(+), 60 deletions(-)
sound/isa/sc6000.c +92 -60
@@ -100,6 +100,15 @@ MODULE_PARM_DESC(joystick, "Enable gameport.");#define PFX "sc6000: "#define DRV_NAME "SC-6000" +struct snd_sc6000 { +char __iomem *vport; +char __iomem *vmss_port; +u8 mss_config; +u8 config; +u8 hw_cfg[2 ]; +bool old_dsp; +}; +/* hardware dependent functions */ /*
@@ -267,7 +276,7 @@ static int sc6000_dsp_reset(char __iomem *vport)/* detection and initialization */ static int sc6000_hw_cfg_write (struct device *devptr, -char __iomem *vport,const int *cfg) +char __iomem *vport,const u8 *cfg) {if (sc6000_write (devptr, vport,COMMAND_6C ) <0 ) {dev_warn (devptr,"CMD 0x%x: failed!\n" ,COMMAND_6C );
@@ -353,8 +362,7 @@ static int sc6000_init_mss(struct device *devptr,return 0 ; } -static void sc6000_hw_cfg_encode (struct device *devptr, -char __iomem *vport,int *cfg, +static void sc6000_hw_cfg_encode (struct device *devptr,u8 *cfg,long xport,long xmpu,long xmss_port,int joystick) {
@@ -376,27 +384,83 @@ static void sc6000_hw_cfg_encode(struct device *devptr,dev_dbg (devptr,"hw cfg %x, %x\n" , cfg[0 ], cfg[1 ]); } -static int sc6000_init_board (struct device *devptr, -char __iomem *vport, -char __iomem *vmss_port,int dev) +static void sc6000_prepare_board (struct device *devptr, +struct snd_sc6000 *sc6000, +unsigned int dev,int xirq,int xdma) +{ + sc6000->mss_config =sc6000_irq_to_softcfg (xirq) | +sc6000_dma_to_softcfg (xdma); + sc6000->config = sc6000->mss_config | +sc6000_mpu_irq_to_softcfg (mpu_irq[dev]); +sc6000_hw_cfg_encode (devptr, sc6000->hw_cfg, port[dev], mpu_port[dev], + mss_port[dev], joystick[dev]); +} + +static void sc6000_detect_old_dsp (struct device *devptr, +struct snd_sc6000 *sc6000) +{ +sc6000_write (devptr, sc6000->vport,COMMAND_5C ); + sc6000->old_dsp =sc6000_read (sc6000->vport) <0 ; +} + +static int sc6000_program_board (struct device *devptr, +struct snd_sc6000 *sc6000) +{ +int err; + +if (!sc6000->old_dsp) { +if (sc6000_hw_cfg_write (devptr, sc6000->vport, + sc6000->hw_cfg) <0 ) { +dev_err (devptr,"sc6000_hw_cfg_write: failed!\n" ); +return -EIO ; + } + } + + err =sc6000_setup_board (devptr, sc6000->vport, sc6000->config); +if (err <0 ) { +dev_err (devptr,"sc6000_setup_board: failed!\n" ); +return -ENODEV ; + } + +sc6000_dsp_reset (sc6000->vport); + +if (!sc6000->old_dsp) { +sc6000_write (devptr, sc6000->vport,COMMAND_60 ); +sc6000_write (devptr, sc6000->vport,0x02 ); +sc6000_dsp_reset (sc6000->vport); + } + + err =sc6000_setup_board (devptr, sc6000->vport, sc6000->config); +if (err <0 ) { +dev_err (devptr,"sc6000_setup_board: failed!\n" ); +return -ENODEV ; + } + + err =sc6000_init_mss (devptr, sc6000->vport, sc6000->config, + sc6000->vmss_port, sc6000->mss_config); +if (err <0 ) { +dev_err (devptr,"Cannot initialize Microsoft Sound System mode.\n" ); +return -ENODEV ; + } + +return 0 ; +} + +static int sc6000_init_board (struct device *devptr,struct snd_sc6000 *sc6000) {char answer[15 ];char version[2 ]; -int mss_config =sc6000_irq_to_softcfg (irq[dev]) | -sc6000_dma_to_softcfg (dma[dev]); -int config = mss_config | -sc6000_mpu_irq_to_softcfg (mpu_irq[dev]);int err; -int old =0 ; - err =sc6000_dsp_reset (vport); + err =sc6000_dsp_reset (sc6000->vport);if (err <0 ) {dev_err (devptr,"sc6000_dsp_reset: failed!\n" );return err; }memset (answer,0 ,sizeof (answer)); - err =sc6000_dsp_get_answer (devptr, vport,GET_DSP_COPYRIGHT , answer,15 ); + err =sc6000_dsp_get_answer (devptr, sc6000->vport,GET_DSP_COPYRIGHT , + answer,15 );if (err <=0 ) {dev_err (devptr,"sc6000_dsp_copyright: failed!\n" );return -ENODEV ;
@@ -408,54 +472,17 @@ static int sc6000_init_board(struct device *devptr,if (strncmp ("SC-6000" , answer,7 ))dev_warn (devptr,"Warning: non SC-6000 audio card!\n" ); -if (sc6000_dsp_get_answer (devptr, vport,GET_DSP_VERSION , version,2 ) <2 ) { +if (sc6000_dsp_get_answer (devptr, sc6000->vport, +GET_DSP_VERSION , version,2 ) <2 ) {dev_err (devptr,"sc6000_dsp_version: failed!\n" );return -ENODEV ; }dev_info (devptr,"Detected model: %s, DSP version %d.%d\n" , answer, version[0 ], version[1 ]); -/* set configuration */ -sc6000_write (devptr, vport,COMMAND_5C ); -if (sc6000_read (vport) <0 ) - old =1 ; - -if (!old) { -int cfg[2 ]; -sc6000_hw_cfg_encode (devptr, - vport, &cfg[0 ], port[dev], mpu_port[dev], - mss_port[dev], joystick[dev]); -if (sc6000_hw_cfg_write (devptr, vport, cfg) <0 ) { -dev_err (devptr,"sc6000_hw_cfg_write: failed!\n" ); -return -EIO ; - } - } - err =sc6000_setup_board (devptr, vport, config); -if (err <0 ) { -dev_err (devptr,"sc6000_setup_board: failed!\n" ); -return -ENODEV ; - } - -sc6000_dsp_reset (vport); - -if (!old) { -sc6000_write (devptr, vport,COMMAND_60 ); -sc6000_write (devptr, vport,0x02 ); -sc6000_dsp_reset (vport); - } +sc6000_detect_old_dsp (devptr, sc6000); - err =sc6000_setup_board (devptr, vport, config); -if (err <0 ) { -dev_err (devptr,"sc6000_setup_board: failed!\n" ); -return -ENODEV ; - } - err =sc6000_init_mss (devptr, vport, config, vmss_port, mss_config); -if (err <0 ) { -dev_err (devptr,"Cannot initialize Microsoft Sound System mode.\n" ); -return -ENODEV ; - } - -return 0 ; +return sc6000_program_board (devptr, sc6000); }static int snd_sc6000_mixer (struct snd_wss *chip)
@@ -538,10 +565,10 @@ static int snd_sc6000_match(struct device *devptr, unsigned int dev)static void snd_sc6000_free (struct snd_card *card) { -char __iomem *vport = (char __force __iomem *)card->private_data; +struct snd_sc6000 *sc6000 = card->private_data; -if (vport) -sc6000_setup_board (card->dev, vport,0 ); +if (sc6000->vport) +sc6000_setup_board (card->dev, sc6000->vport,0 ); }static int __snd_sc6000_probe (struct device *devptr,unsigned int dev)
@@ -552,15 +579,17 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)int xirq = irq[dev];int xdma = dma[dev];struct snd_card *card; +struct snd_sc6000 *sc6000;struct snd_wss *chip;struct snd_opl3 *opl3;char __iomem *vport;char __iomem *vmss_port; err =snd_devm_card_new (devptr, index[dev], id[dev],THIS_MODULE , -0 , &card); +sizeof (*sc6000), &card);if (err <0 )return err; + sc6000 = card->private_data;if (xirq ==SNDRV_AUTO_IRQ ) { xirq =snd_legacy_find_free_irq (possible_irqs);
@@ -587,7 +616,7 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)dev_err (devptr,"I/O port cannot be iomapped.\n" );return -EBUSY ; } - card->private_data = (void __force *)vport; + sc6000->vport = vport;/* to make it marked as used */ if (!devm_request_region (devptr, mss_port[dev],4 ,DRV_NAME )) {
@@ -600,12 +629,15 @@ static int __snd_sc6000_probe(struct device *devptr, unsigned int dev)dev_err (devptr,"MSS port I/O cannot be iomapped.\n" );return -EBUSY ; } + sc6000->vmss_port = vmss_port;dev_dbg (devptr,"Initializing BASE[0x%lx] IRQ[%d] DMA[%d] MIRQ[%d]\n" , port[dev], xirq, xdma, mpu_irq[dev] ==SNDRV_AUTO_IRQ ?0 : mpu_irq[dev]); - err =sc6000_init_board (devptr, vport, vmss_port, dev); +sc6000_prepare_board (devptr, sc6000, dev, xirq, xdma); + + err =sc6000_init_board (devptr, sc6000);if (err <0 )return err; card->private_free = snd_sc6000_free;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 562/969 dm cache: fix missing return in invalidate_committeds error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming-Hung Tsai <[email protected]>
[ Upstream commit 8c0ee19db81f0fa1ff25fd75b22b17c0cc2acde3 ]
In passthrough mode, dm-cache defers write submission until after metadata commit completes via the invalidate_committed() continuation. On commit error, invalidate_committed() calls invalidate_complete() to end the bio and free the migration struct, after which it should return immediately.
The patch 4ca8b8bd952d ("dm cache: fix write hang in passthrough mode") omitted this early return, causing execution to fall through into the success path on error. This results in use-after-free on the migration struct in the subsequent calls.
Fix by adding the missing return after the invalidate_complete() call.
--- drivers/md/dm-cache-target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/dm-cache-target.c +3 -1
@@ -1502,8 +1502,10 @@ static void invalidate_committed(struct work_struct *ws)struct bio *bio = mg->overwrite_bio;struct per_bio_data *pb =get_per_bio_data (bio); -if (mg->k.input) +if (mg->k.input) {invalidate_complete (mg, false); +return ; + }init_continuation (&mg->k, invalidate_completed);remap_to_origin_clear_discard (cache, bio, mg->invalidate_oblock);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 563/969 gfs2: Call unlock_new_inode before d_instantiate
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 2ff7cf7e0640ff071ebc5c7e3dc2df024a7c91e6 ]
As Neil Brown describes in detail in the link referenced below, new inodes must be unlocked before they can be instantiated.
An even better fix is to use d_instantiate_new(), which combines d_instantiate() and unlock_new_inode().
--- fs/gfs2/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/gfs2/inode.c +1 -2
@@ -779,7 +779,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, goto fail_gunlock4;mark_inode_dirty (inode); -d_instantiate (dentry, inode); +d_instantiate_new (dentry, inode);/* After instantiate, errors should result in evict which will destroy * both inode and iopen glocks properly. */ if (file) {
@@ -791,7 +791,6 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,gfs2_glock_dq_uninit (ghs +1 );gfs2_glock_put (io_gl);gfs2_qa_put (dip); -unlock_new_inode (inode);return error; fail_gunlock4:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 564/969 ktest: Avoid undef warning when WARNINGS_FILE is unset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marlière <[email protected]>
[ Upstream commit 057854f8a595160656fe77ed7bf0d2403724b915 ]
check_buildlog() probes $warnings_file with -f even when WARNINGS_FILE is not configured. Perl warns about the uninitialized value and adds noise to the test log, which can hide the output we actually care about.
Check that WARNINGS_FILE is defined before testing whether the file exists.
--- tools/testing/ktest/ktest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/ktest/ktest.pl +1 -1
@@ -2465,7 +2465,7 @@ sub check_buildlog { my $save_no_reboot = $no_reboot; $no_reboot = 1; - if (-f $warnings_file) { + if (defined($warnings_file) && -f $warnings_file) { open(IN, $warnings_file) or dodie "Error opening $warnings_file";
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 565/969 ktest: Honor empty per-test option overrides
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marlière <[email protected]>
[ Upstream commit a2de57a3c8192dcd67cccaff6c341b93748d799b ]
A per-test override can clear an inherited default option by assigning an empty value, but __set_test_option() still used option_defined() to decide whether a per-test key existed. That turned an empty per-test assignment back into "fall back to the default", so tests still could not clear inherited settings.
For example:
DEFAULTS
(...)
LOG_FILE = /tmp/ktest-empty-override.log
CLEAR_LOG = 1
ADD_CONFIG = /tmp/.config
TEST_START
TEST_TYPE = build
BUILD_TYPE = nobuild
ADD_CONFIG =
This would run the test with ADD_CONFIG[1] = /tmp/.config
Fix by checking whether the per-test key exists before falling back. If it does exist but is empty, treat it as unset for that test and stop the fallback chain there.
--- tools/testing/ktest/ktest.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/testing/ktest/ktest.pl +4 -2
@@ -4106,7 +4106,8 @@ sub __set_test_option { my $option = "$name\[$i\]"; - if (option_defined($option)) { + if (exists($opt{$option})) { + return undef if (!option_defined($option)); return $opt{$option}; }
@@ -4114,7 +4115,8 @@ sub __set_test_option { if ($i >= $test && $i < $test + $repeat_tests{$test}) { $option = "$name\[$test\]"; - if (option_defined($option)) { + if (exists($opt{$option})) { + return undef if (!option_defined($option)); return $opt{$option}; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 566/969 ktest: Run POST_KTEST hooks on failure and cancellation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo B. Marlière <[email protected]>
[ Upstream commit bc6e165a452da909cef0efbc286e6695624db372 ]
PRE_KTEST can be useful for setting up the environment and POST_KTEST to tear it down, however POST_KTEST only runs on the normal end-of-run path. It is skipped when ktest exits through dodie() or cancel_test(). Final cleanup hooks are skipped.
Factor the final hook execution into run_post_ktest(), call it from the normal exit path and from the early exit paths, and guard it so the hook runs at most once.
--- tools/testing/ktest/ktest.pl | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
tools/testing/ktest/ktest.pl +22 -5
@@ -98,6 +98,7 @@ my $test_type; my $build_type; my $build_options; my $final_post_ktest; +my $post_ktest_done = 0; my $pre_ktest; my $post_ktest; my $pre_test;
@@ -1530,6 +1531,24 @@ sub get_test_name() { return $name; } +sub run_post_ktest { + my $cmd; + + return if ($post_ktest_done); + + if (defined($final_post_ktest)) { + $cmd = $final_post_ktest; + } elsif (defined($post_ktest)) { + $cmd = $post_ktest; + } else { + return; + } + + my $cp_post_ktest = eval_kernel_version($cmd); + run_command $cp_post_ktest; + $post_ktest_done = 1; +} + sub dodie { # avoid recursion return if ($in_die);
@@ -1589,6 +1608,7 @@ sub dodie { if (defined($post_test)) { run_command $post_test; } + run_post_ktest; die @_, "\n"; }
@@ -4223,6 +4243,7 @@ sub cancel_test { send_email("KTEST: Your [$name] test was cancelled", "Your test started at $script_start_time was cancelled: sig int"); } + run_post_ktest; die "\nCaught Sig Int, test interrupted: $!\n" }
@@ -4533,11 +4554,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { success $i; } -if (defined($final_post_ktest)) { - - my $cp_final_post_ktest = eval_kernel_version $final_post_ktest; - run_command $cp_final_post_ktest; -} +run_post_ktest; if ($opt{"POWEROFF_ON_SUCCESS"}) { halt;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 567/969 quota: Fix race of dquot_scan_active() with quota deactivation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit e93ab401da4b2e2c1b8ef2424de2f238d51c8b2d ]
dquot_scan_active() can race with quota deactivation in quota_release_workfn() like:
CPU0 (quota_release_workfn) CPU1 (dquot_scan_active)
============================== ==============================
spin_lock(&dq_list_lock);
list_replace_init(
&releasing_dquots, &rls_head);
/* dquot X on rls_head,
dq_count == 0,
DQ_ACTIVE_B still set */
spin_unlock(&dq_list_lock);
synchronize_srcu(&dquot_srcu);
spin_lock(&dq_list_lock);
list_for_each_entry(dquot,
&inuse_list, dq_inuse) {
/* finds dquot X */
dquot_active(X) -> true
atomic_inc(&X->dq_count);
}
spin_unlock(&dq_list_lock);
spin_lock(&dq_list_lock);
dquot = list_first_entry(&rls_head);
WARN_ON_ONCE(atomic_read(&dquot->dq_count));The problem is not only a cosmetic one as under memory pressure the caller of dquot_scan_active() can end up working on freed dquot.
Fix the problem by making sure the dquot is removed from releasing list when we acquire a reference to it.
--- fs/quota/dquot.c | 38 ++++++++++++++++++++++++++++++-------- include/linux/quotaops.h | 9 +-------- 2 files changed, 31 insertions(+), 16 deletions(-)
fs/quota/dquot.c +30 -8
@@ -362,6 +362,31 @@ static inline int dquot_active(struct dquot *dquot)return test_bit (DQ_ACTIVE_B , &dquot->dq_flags); } +static struct dquot *__dqgrab (struct dquot *dquot) +{ +lockdep_assert_held (&dq_list_lock); +if (!atomic_read (&dquot->dq_count)) +remove_free_dquot (dquot); +atomic_inc (&dquot->dq_count); +return dquot; +} + +/* +* Get reference to dquot when we got pointer to it by some other means. The +* dquot has to be active and the caller has to make sure it cannot get +* deactivated under our hands. +*/ +struct dquot *dqgrab (struct dquot *dquot) +{ +spin_lock (&dq_list_lock); +WARN_ON_ONCE (!dquot_active (dquot)); + dquot =__dqgrab (dquot); +spin_unlock (&dq_list_lock); + +return dquot; +} +EXPORT_SYMBOL_GPL (dqgrab); +static inline int dquot_dirty (struct dquot *dquot) {return test_bit (DQ_MOD_B , &dquot->dq_flags);
@@ -640,15 +665,14 @@ int dquot_scan_active(struct super_block *sb,continue ;if (dquot->dq_sb != sb)continue ; -/* Now we have active dquot so we can just increase use count */ -atomic_inc (&dquot->dq_count); +__dqgrab (dquot);spin_unlock (&dq_list_lock);dqput (old_dquot); old_dquot = dquot;/* * ->release_dquot() can be racing with us. Our reference -* protects us from new calls to it so just wait for any -* outstanding call and recheck the DQ_ACTIVE_B after that. +* protects us from dquot_release() proceeding so just wait for +* any outstanding call and recheck the DQ_ACTIVE_B after that. */ wait_on_dquot (dquot);if (dquot_active (dquot)) {
@@ -716,7 +740,7 @@ int dquot_writeback_dquots(struct super_block *sb, int type)/* Now we have active dquot from which someone is * holding reference so we can safely just increase * use count */ -dqgrab (dquot); +__dqgrab (dquot);spin_unlock (&dq_list_lock); err =dquot_write_dquot (dquot);if (err && !ret)
@@ -971,9 +995,7 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid)spin_unlock (&dq_list_lock);dqstats_inc (DQST_LOOKUPS ); }else { -if (!atomic_read (&dquot->dq_count)) -remove_free_dquot (dquot); -atomic_inc (&dquot->dq_count); +__dqgrab (dquot);spin_unlock (&dq_list_lock);dqstats_inc (DQST_CACHE_HITS );dqstats_inc (DQST_LOOKUPS );
include/linux/quotaops.h +1 -8
@@ -44,14 +44,7 @@ int dquot_initialize(struct inode *inode);bool dquot_initialize_needed (struct inode *inode);void dquot_drop (struct inode *inode);struct dquot *dqget (struct super_block *sb,struct kqid qid); -static inline struct dquot *dqgrab (struct dquot *dquot) -{ -/* Make sure someone else has active reference to dquot */ -WARN_ON_ONCE (!atomic_read (&dquot->dq_count)); -WARN_ON_ONCE (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags)); -atomic_inc (&dquot->dq_count); -return dquot; -} +struct dquot *dqgrab (struct dquot *dquot);static inline bool dquot_is_busy (struct dquot *dquot) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 568/969 gfs2: add some missing log locking
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit fe2c8d051150b90b3ccb85f89e3b1d636cb88ec8 ]
Function gfs2_logd() calls the log flushing functions gfs2_ail1_start(), gfs2_ail1_wait(), and gfs2_ail1_empty() without holding sdp->sd_log_flush_lock, but these functions require exclusion against concurrent transactions.
To fix that, add a non-locking __gfs2_log_flush() function. Then, in gfs2_logd(), take sdp->sd_log_flush_lock before calling the above mentioned log flushing functions and __gfs2_log_flush().
--- fs/gfs2/log.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-)
fs/gfs2/log.c +20 -8
@@ -1025,14 +1025,15 @@ static void trans_drain(struct gfs2_trans *tr) }/** -* gfs2_log_flush - flush incore transaction(s) +* __gfs2_log_flush - flush incore transaction(s) * @sdp: The filesystem * @gl: The glock structure to flush. If NULL, flush the whole incore log * @flags: The log header flags: GFS2_LOG_HEAD_FLUSH_* and debug flags * */ -void gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl,u32 flags) +static void __gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl, +u32 flags) {struct gfs2_trans *tr =NULL ;unsigned int reserved_blocks =0 , used_blocks =0 ;
@@ -1040,7 +1041,6 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)unsigned int first_log_head;unsigned int reserved_revokes =0 ; -down_write (&sdp->sd_log_flush_lock);trace_gfs2_log_flush (sdp,1 , flags); repeat:
@@ -1151,7 +1151,6 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)gfs2_assert_withdraw_delayed (sdp, used_blocks < reserved_blocks);gfs2_log_release (sdp, reserved_blocks - used_blocks); } -up_write (&sdp->sd_log_flush_lock);gfs2_trans_free (sdp, tr);if (gfs2_withdrawing (sdp))gfs2_withdraw (sdp);
@@ -1174,6 +1173,13 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) goto out_end; } +void gfs2_log_flush (struct gfs2_sbd *sdp,struct gfs2_glock *gl,u32 flags) +{ +down_write (&sdp->sd_log_flush_lock); +__gfs2_log_flush (sdp, gl, flags); +up_write (&sdp->sd_log_flush_lock); +} +/** * gfs2_merge_trans - Merge a new transaction into a cached transaction * @sdp: the filesystem
@@ -1319,19 +1325,25 @@ int gfs2_logd(void *data) }if (gfs2_jrnl_flush_reqd (sdp) || t ==0 ) { +down_write (&sdp->sd_log_flush_lock);gfs2_ail1_empty (sdp,0 ); -gfs2_log_flush (sdp,NULL ,GFS2_LOG_HEAD_FLUSH_NORMAL | -GFS2_LFC_LOGD_JFLUSH_REQD ); +__gfs2_log_flush (sdp,NULL , +GFS2_LOG_HEAD_FLUSH_NORMAL | +GFS2_LFC_LOGD_JFLUSH_REQD ); +up_write (&sdp->sd_log_flush_lock); }if (test_bit (SDF_FORCE_AIL_FLUSH , &sdp->sd_flags) ||gfs2_ail_flush_reqd (sdp)) {clear_bit (SDF_FORCE_AIL_FLUSH , &sdp->sd_flags); +down_write (&sdp->sd_log_flush_lock);gfs2_ail1_start (sdp);gfs2_ail1_wait (sdp);gfs2_ail1_empty (sdp,0 ); -gfs2_log_flush (sdp,NULL ,GFS2_LOG_HEAD_FLUSH_NORMAL | -GFS2_LFC_LOGD_AIL_FLUSH_REQD ); +__gfs2_log_flush (sdp,NULL , +GFS2_LOG_HEAD_FLUSH_NORMAL | +GFS2_LFC_LOGD_AIL_FLUSH_REQD ); +up_write (&sdp->sd_log_flush_lock); } t =gfs2_tune_get (sdp, gt_logd_secs) *HZ ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 569/969 gfs2: prevent NULL pointer dereference during unmount
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 74b4dbb946060a3233604d91859a9abd3708141d ]
When flushing out outstanding glock work during an unmount, gfs2_log_flush() can be called when sdp->sd_jdesc has already been deallocated and sdp->sd_jdesc is NULL. Commit 35264909e9d1 ("gfs2: Fix NULL pointer dereference in gfs2_log_flush") added a check for that to gfs2_log_flush() itself, but it missed the sdp->sd_jdesc dereference in gfs2_log_release(). Fix that.
--- fs/gfs2/log.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/gfs2/log.c +3 -2
@@ -478,8 +478,9 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) {atomic_add (blks, &sdp->sd_log_blks_free);trace_gfs2_log_blocks (sdp, blks); -gfs2_assert_withdraw (sdp,atomic_read (&sdp->sd_log_blks_free) <= - sdp->sd_jdesc->jd_blocks); +gfs2_assert_withdraw (sdp, !sdp->sd_jdesc || +atomic_read (&sdp->sd_log_blks_free) <= + sdp->sd_jdesc->jd_blocks);if (atomic_read (&sdp->sd_log_blks_needed))wake_up (&sdp->sd_log_waitq); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 570/969 efi/capsule-loader: fix incorrect sizeof in phys array reallocation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Huth <[email protected]>
[ Upstream commit 48a428215782321b56956974f23593e40ce84b7a ]
The krealloc() call for cap_info->phys in __efi_capsule_setup_info() uses sizeof(phys_addr_t *) instead of sizeof(phys_addr_t), which might be causing an undersized allocation.
The allocation is also inconsistent with the initial array allocation in efi_capsule_open() that allocates one entry with sizeof(phys_addr_t), and the efi_capsule_write() function that stores phys_addr_t values (not pointers) via page_to_phys().
On 64-bit systems where sizeof(phys_addr_t) == sizeof(phys_addr_t *), this goes unnoticed. On 32-bit systems with PAE where phys_addr_t is 64-bit but pointers are 32-bit, this allocates half the required space, which might lead to a heap buffer overflow when storing physical addresses.
This is similar to the bug fixed in commit fccfa646ef36 ("efi/capsule-loader:
fix incorrect allocation size") which fixed the same issue at the initial allocation site.
--- drivers/firmware/efi/capsule-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/capsule-loader.c +1 -1
@@ -67,7 +67,7 @@ int __efi_capsule_setup_info(struct capsule_info *cap_info) cap_info->pages = temp_page; temp_page =krealloc (cap_info->phys, - pages_needed *sizeof (phys_addr_t *), + pages_needed *sizeof (phys_addr_t),GFP_KERNEL | __GFP_ZERO);if (!temp_page)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 571/969 ksmbd: fix use-after-free from async crypto on Qualcomm crypto engine
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joshua Klinesmith <[email protected]>
[ Upstream commit 3e298897f41c61450c2e7a4f457e8b2485eb35b3 ]
ksmbd_crypt_message() sets a NULL completion callback on AEAD requests and does not handle the -EINPROGRESS return code from async hardware crypto engines like the Qualcomm Crypto Engine (QCE). When QCE returns -EINPROGRESS, ksmbd treats it as an error and immediately frees the request while the hardware DMA operation is still in flight. The DMA completion callback then dereferences freed memory, causing a NULL pointer crash:
pc : qce_skcipher_done+0x24/0x174 lr : vchan_complete+0x230/0x27c ... el1h_64_irq+0x68/0x6c ksmbd_free_work_struct+0x20/0x118 [ksmbd] ksmbd_exit_file_cache+0x694/0xa4c [ksmbd]
Use the standard crypto_wait_req() pattern with crypto_req_done() as the completion callback, matching the approach used by the SMB client in fs/smb/client/smb2ops.c. This properly handles both synchronous engines (immediate return) and async engines (-EINPROGRESS followed by callback notification).
--- fs/smb/server/auth.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/smb/server/auth.c +6 -5
@@ -1104,6 +1104,7 @@ int ksmbd_crypt_message(struct ksmbd_work *work, struct kvec *iov,struct smb2_transform_hdr *tr_hdr =smb2_get_msg (iov[0 ].iov_base);unsigned int assoc_data_len =sizeof (struct smb2_transform_hdr ) -20 ;int rc; +DECLARE_CRYPTO_WAIT (wait);struct scatterlist *sg;u8 sign[SMB2_SIGNATURE_SIZE ] = {};u8 key[SMB3_ENC_DEC_KEY_SIZE ];
@@ -1190,12 +1191,12 @@ int ksmbd_crypt_message(struct ksmbd_work *work, struct kvec *iov,aead_request_set_crypt (req, sg, sg, crypt_len, iv);aead_request_set_ad (req, assoc_data_len); -aead_request_set_callback (req,CRYPTO_TFM_REQ_MAY_SLEEP ,NULL ,NULL ); +aead_request_set_callback (req,CRYPTO_TFM_REQ_MAY_BACKLOG | +CRYPTO_TFM_REQ_MAY_SLEEP , + crypto_req_done, &wait); -if (enc) - rc =crypto_aead_encrypt (req); -else - rc =crypto_aead_decrypt (req); + rc =crypto_wait_req (enc ?crypto_aead_encrypt (req) : +crypto_aead_decrypt (req), &wait);if (rc) goto free_iv;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 572/969 ARM: dts: mediatek: mt7623: fix efuse fallback compatible
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 5978ff33cc6f0988388a2830dc5cd2ea4e81f36a ]
Fix following validation error:arch/arm/boot/dts/mediatek/mt7623a-rfb-emmc.dtb: efuse@10206000: compatible: 'oneOf' conditional failed, one must be fixed:
['mediatek,mt7623-efuse', 'mediatek,mt8173-efuse'] is too long
'mediatek,mt8173-efuse' was expected
'mediatek,efuse' was expected
from schema $id: http://devicetree.org/schemas/nvmem/mediatek,efuse.yaml#arch/arm/boot/dts/mediatek/mt7623a-rfb-emmc.dtb: efuse@10206000: Unevaluated properties are not allowed ('compatible' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/mediatek,efuse.yaml#
--- arch/arm/boot/dts/mt7623.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/mt7623.dtsi +1 -1
@@ -329,7 +329,7 @@ sysirq: interrupt-controller@10200100 { efuse: efuse@10206000 { compatible = "mediatek,mt7623-efuse", - "mediatek,mt8173-efuse"; + "mediatek,efuse"; reg = <0 0x10206000 0 0x1000>; #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 573/969 memory: tegra124-emc: Fix dll_change check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikko Perttunen <[email protected]>
[ Upstream commit 9597ab9a8296ab337e6820f8a717ff621078b632 ]
The code checking whether the specified memory timing enables DLL in the EMRS register was reversed. DLL is enabled if bit A0 is low. Fix the check.
--- drivers/memory/tegra/tegra124-emc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/tegra/tegra124-emc.c +1 -1
@@ -608,7 +608,7 @@ static int tegra_emc_prepare_timing_change(struct tegra_emc *emc,if ((last->emc_mode_1 &0x1 ) == (timing->emc_mode_1 &0x1 )) dll_change =DLL_CHANGE_NONE ; -else if (timing->emc_mode_1 &0x1 ) +else if (!(timing->emc_mode_1 &0x1 )) dll_change =DLL_CHANGE_ON ;else dll_change =DLL_CHANGE_OFF ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 574/969 memory: tegra30-emc: Fix dll_change check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikko Perttunen <[email protected]>
[ Upstream commit 0a93f2355cf4922ad2399dbef5ea1049fef116d4 ]
The code checking whether the specified memory timing enables DLL in the EMRS register was reversed. DLL is enabled if bit A0 is low. Fix the check.
--- drivers/memory/tegra/tegra30-emc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/memory/tegra/tegra30-emc.c +3 -3
@@ -554,14 +554,14 @@ static int emc_prepare_timing_change(struct tegra_emc *emc, unsigned long rate) emc->emc_cfg =readl_relaxed (emc->regs +EMC_CFG ); emc_dbg =readl_relaxed (emc->regs +EMC_DBG ); -if (emc->dll_on == !!(timing->emc_mode_1 &0x1 )) +if (emc->dll_on == !(timing->emc_mode_1 &0x1 )) dll_change =DLL_CHANGE_NONE ; -else if (timing->emc_mode_1 &0x1 ) +else if (!(timing->emc_mode_1 &0x1 )) dll_change =DLL_CHANGE_ON ;else dll_change =DLL_CHANGE_OFF ; - emc->dll_on = !!(timing->emc_mode_1 &0x1 ); + emc->dll_on = !(timing->emc_mode_1 &0x1 );if (timing->data[80 ] && !readl_relaxed (emc->regs +EMC_ZCAL_INTERVAL )) emc->zcal_long = true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 575/969 arm64: dts: imx8mp-evk: Enable pull select bit for PCIe regulator GPIO (M.2 W_DISABLE1)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sherry Sun <[email protected]>
[ Upstream commit d1e7eab6033f9885a02c4b4e8f09e34d8e9d21ab ]
The current pin configuration for MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06 sets the weak pull-up but does not enable the pull select field. Bit 8 in the IOMUX register must be set in order for the weak pull-up to actually take effect.
Update the pinctrl setting from 0x40 to 0x140 to enable both the pull select and the weak pull-up, ensuring the line behaves as expected.
--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +1 -1
@@ -551,7 +551,7 @@ MX8MP_IOMUXC_SD1_DATA5__GPIO2_IO07 0x40 pinctrl_pcie0_reg: pcie0reggrp { fsl,pins = < - MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06 0x40 + MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06 0x140 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 576/969 arm64: dts: mediatek: mt6795: Fix gpio-ranges pin count
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akari Tsuyukusa <[email protected]>
[ Upstream commit c4c4823c8a5baa10b8100b01f49d7c3f4a871689 ]
The gpio-ranges in the MT6795 pinctrl node were incorrectly defined, therefore, GPIO196 cannot be used.
Correct the range count to match the driver.
--- arch/arm64/boot/dts/mediatek/mt6795.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt6795.dtsi +1 -1
@@ -200,7 +200,7 @@ pio: pinctrl@10005000 { <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>; gpio-controller; #gpio-cells = <2>; - gpio-ranges = <&pio 0 0 196>; + gpio-ranges = <&pio 0 0 197>; interrupt-controller; #interrupt-cells = <2>; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 577/969 arm64: dts: mediatek: mt7986a: Fix gpio-ranges pin count
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akari Tsuyukusa <[email protected]>
[ Upstream commit 820ed0c1a13c5fafb36232538d793f99a0986ef3 ]
The gpio-ranges in the MT7986A pinctrl node were incorrectly defined, therefore, pin 100 cannot be used.
Correct the range count to match the driver.
--- arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +1 -1
@@ -153,7 +153,7 @@ pio: pinctrl@1001f000 { "iocfg_lb", "iocfg_tr", "iocfg_tl", "eint"; gpio-controller; #gpio-cells = <2>; - gpio-ranges = <&pio 0 0 100>; + gpio-ranges = <&pio 0 0 101>; interrupt-controller; interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&gic>;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 578/969 soc: qcom: ocmem: use scoped device node handling to simplify error paths
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f4c1c19f5c0e5cf2870df91dedc6b40400fd9c8a ]
Obtain the device node reference with scoped/cleanup.h to reduce error handling and make the code a bit simpler.
Stable-dep-of: 9dfd69cd89cd ("soc: qcom: ocmem: register reasons for probe deferrals")
--- drivers/soc/qcom/ocmem.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/soc/qcom/ocmem.c +2 -5
@@ -192,23 +192,20 @@ static void update_range(struct ocmem *ocmem, struct ocmem_buf *buf,struct ocmem *of_get_ocmem (struct device *dev) {struct platform_device *pdev; -struct device_node *devnode;struct ocmem *ocmem; - devnode =of_parse_phandle (dev->of_node,"sram" ,0 ); + struct device_node *devnode __free(device_node) = of_parse_phandle(dev->of_node, +"sram" ,0 );if (!devnode || !devnode->parent) {dev_err (dev,"Cannot look up sram phandle\n" ); -of_node_put (devnode);return ERR_PTR (-ENODEV ); } pdev =of_find_device_by_node (devnode->parent);if (!pdev) {dev_err (dev,"Cannot find device node %s\n" , devnode->name); -of_node_put (devnode);return ERR_PTR (-EPROBE_DEFER ); } -of_node_put (devnode); ocmem =platform_get_drvdata (pdev);put_device (&pdev->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 579/969 soc: qcom: ocmem: register reasons for probe deferrals
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 9dfd69cd89cd6afa4723be9098979abeef3bb8c6 ]
Instead of printing messages to the dmesg, let the message be recorded as a reason for the OCMEM client deferral.
[bjorn: s/ERR_PTR(dev_err_probe)/dev_err_ptr_probe/
--- drivers/soc/qcom/ocmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soc/qcom/ocmem.c +4 -4
@@ -202,10 +202,10 @@ struct ocmem *of_get_ocmem(struct device *dev) } pdev =of_find_device_by_node (devnode->parent); -if (!pdev) { -dev_err (dev,"Cannot find device node %s\n" , devnode->name); -return ERR_PTR (-EPROBE_DEFER ); - } +if (!pdev) +return dev_err_ptr_probe (dev, -EPROBE_DEFER , +"Cannot find device node %s\n" , + devnode->name); ocmem =platform_get_drvdata (pdev);put_device (&pdev->dev);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 580/969 soc: qcom: ocmem: return -EPROBE_DEFER is ocmem is not available
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 91b59009c7d48b58dbc50fecb27f2ad20749a05a ]
If OCMEM is declared in DT, it is expected that it is present and handled by the driver. The GPU driver will ignore -ENODEV error, which typically means that OCMEM isn't defined in DT. Let ocmem return -EPROBE_DEFER if it supposed to be used, but it is not probed (yet).
[bjorn: s/ERR_PTR(dev_err_probe)/dev_err_ptr_probe/
--- drivers/soc/qcom/ocmem.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/soc/qcom/ocmem.c +3 -4
@@ -209,10 +209,9 @@ struct ocmem *of_get_ocmem(struct device *dev) ocmem =platform_get_drvdata (pdev);put_device (&pdev->dev); -if (!ocmem) { -dev_err (dev,"Cannot get ocmem\n" ); -return ERR_PTR (-ENODEV ); - } +if (!ocmem) +return dev_err_ptr_probe (dev, -EPROBE_DEFER ,"Cannot get ocmem\n" ); +return ocmem; }EXPORT_SYMBOL (of_get_ocmem);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 581/969 arm64: dts: qcom: sm8450: Fix GIC_ITS range length
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 14044fa192c50265bc1f636108371044bbdcf7b7 ]
Currently, the GITS_SGIR register is cut off. Fix it up.
--- arch/arm64/boot/dts/qcom/sm8450.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8450.dtsi +1 -1
@@ -2915,7 +2915,7 @@ intc: interrupt-controller@17100000 { gic_its: msi-controller@17140000 { compatible = "arm,gic-v3-its"; - reg = <0x0 0x17140000 0x0 0x20000>; + reg = <0x0 0x17140000 0x0 0x40000>; msi-controller; #msi-cells = <1>; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 582/969 arm64: dts: qcom: sm8450: Enable UHS-I SDR50 and SDR104 SD card modes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Zapolskiy <[email protected]>
[ Upstream commit db0c5ef1abda6effdc5c85d6688fb6af2b351ae5 ]
The reported problem of some non-working UHS-I speed modes on SM8450 originates in commit 0a631a36f724 ("arm64: dts: qcom: Add device tree for Sony Xperia 1 IV"), and then it was spread to all SM8450 powered platforms by commit 9d561dc4e5cc ("arm64: dts: qcom: sm8450: disable SDHCI SDR104/SDR50 on all boards").
The tests show that the rootcause of the problem was related to an overclocking of SD cards, and it's fixed later on by commit a27ac3806b0a ("clk: qcom: gcc-sm8450: Use floor ops for SDCC RCGs").
Since then both SDR50 and SDR104 speed modes are working fine on SM8450, tested on SM8450-HDK:
SDR50 speed mode:
mmc0: new UHS-I speed SDR50 SDHC card at address 0001
mmcblk0: mmc0:0001 00000 14.6 GiB
mmcblk0: p1
% dd if=/dev/mmcblk0p1 of=/dev/null bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 24.6254 s, 43.6 MB/sSDR104 speed mode:
mmc0: new UHS-I speed SDR104 SDHC card at address 59b4
mmcblk0: mmc0:59b4 USDU1 28.3 GiB
mmcblk0: p1
% dd if=/dev/mmcblk0p1 of=/dev/null bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 12.3266 s, 87.1 MB/sRemove the restrictions on SD card speed modes from the SM8450 platform dtsi file and enable UHS-I speed modes.
--- arch/arm64/boot/dts/qcom/sm8450.dtsi | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8450.dtsi +0 -3
@@ -3191,9 +3191,6 @@ sdhc_2: sdhci@8804000 { bus-width = <4>; dma-coherent; - /* Forbid SDR104/SDR50 - broken hw! */ - sdhci-caps-mask = <0x3 0x0>; - status = "disabled"; sdhc2_opp_table: opp-table {
Signature · 1 line
2.53.0
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.1.175-rc1-00982-g02eba76b9117 #1 SMP PREEMPT_DYNAMIC Sat May 30 17:06:16 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Greg Kroah-Hartman
maintainerPATCH 583/969 arm64: dts: qcom: sdm845-xiaomi-beryllium: Mark l1a regulator as powered during boot
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Heidelberg <[email protected]>
[ Upstream commit 3b0dd81eea6b7a239fce456ce4545af76f1a9715 ]
The regulator must be on, since it provides the display subsystem and therefore the bootloader had turned it on before Linux booted.
--- arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts +1 -0
@@ -133,6 +133,7 @@ vreg_l1a_0p875: ldo1 { regulator-min-microvolt = <880000>; regulator-max-microvolt = <880000>; regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; + regulator-boot-on; }; vreg_l5a_0p8: ldo5 {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 584/969 soc/tegra: cbb: Set ERD on resume for err interrupt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumit Gupta <[email protected]>
[ Upstream commit b6ff71c5d1d4ad858ddf6f39394d169c96689596 ]
Set the Error Response Disable (ERD) bit to mask SError responses and use interrupt-based error reporting. When the ERD bit is set, inband error responses to the initiator via SError are suppressed, and fabric errors are reported via an interrupt instead.
The register is set during boot but the info is lost during system suspend and needs to be set again on resume.
--- drivers/soc/tegra/cbb/tegra234-cbb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/soc/tegra/cbb/tegra234-cbb.c +4 -0
@@ -1185,6 +1185,10 @@ static int __maybe_unused tegra234_cbb_resume_noirq(struct device *dev) {struct tegra234_cbb *cbb =dev_get_drvdata (dev); +/* set ERD bit to mask SError and generate interrupt to report error */ +if (cbb->fabric->off_mask_erd) +tegra234_cbb_mask_serror (cbb); +tegra234_cbb_error_enable (&cbb->base);dev_dbg (dev,"%s resumed\n" , cbb->fabric->name);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 585/969 unshare: fix nsproxy leak in ksys_unshare() on set_cred_ucounts() failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Grzedzicki <[email protected]>
[ Upstream commit a98621a0f187a934c115dcfe79a49520ae892111 ]
When set_cred_ucounts() fails in ksys_unshare() new_nsproxy is leaked.
Let's call put_nsproxy() if that happens.
--- kernel/fork.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/fork.c +7 -4
@@ -3285,11 +3285,10 @@ int ksys_unshare(unsigned long unshare_flags) new_cred, new_fs);if (err) goto bad_unshare_cleanup_cred; -if (new_cred) { err =set_cred_ucounts (new_cred);if (err) - goto bad_unshare_cleanup_cred; + goto bad_unshare_cleanup_nsproxy; }if (new_fs || new_fd || do_sysvsem || new_cred || new_nsproxy) {
@@ -3305,8 +3304,10 @@ int ksys_unshare(unsigned long unshare_flags)shm_init_task (current); } -if (new_nsproxy) +if (new_nsproxy) {switch_task_namespaces (current, new_nsproxy); + new_nsproxy =NULL ; + }task_lock (current);
@@ -3335,13 +3336,15 @@ int ksys_unshare(unsigned long unshare_flags)perf_event_namespaces (current); +bad_unshare_cleanup_nsproxy: +if (new_nsproxy) +put_nsproxy (new_nsproxy); bad_unshare_cleanup_cred:if (new_cred)put_cred (new_cred); bad_unshare_cleanup_fd:if (new_fd)put_files_struct (new_fd); - bad_unshare_cleanup_fs:if (new_fs)free_fs_struct (new_fs);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 586/969 ocfs2/dlm: validate qr_numregions in dlm_match_regions()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
[ Upstream commit 7ab3fbb01bc6d79091bc375e5235d360cd9b78be ]
Patch series "ocfs2/dlm: fix two bugs in dlm_match_regions()".
In dlm_match_regions(), the qr_numregions field from a DLM_QUERY_REGION network message is used to drive loops over the qr_regions buffer without sufficient validation. This series fixes two issues:
- Patch 1 adds a bounds check to reject messages where qr_numregions exceeds O2NM_MAX_REGIONS. The o2net layer only validates message byte length; it does not constrain field values, so a crafted message can set qr_numregions up to 255 and trigger out-of-bounds reads past the 1024-byte qr_regions buffer.
- Patch 2 fixes an off-by-one in the local-vs-remote comparison loop, which uses '<=' instead of '<', reading one entry past the valid range even when qr_numregions is within bounds.
This patch (of 2):
The qr_numregions field from a DLM_QUERY_REGION network message is used directly as loop bounds in dlm_match_regions() without checking against O2NM_MAX_REGIONS. Since qr_regions is sized for at most O2NM_MAX_REGIONS
(32) entries, a crafted message with qr_numregions > 32 causes out-of-bounds reads past the qr_regions buffer.
Add a bounds check for qr_numregions before entering the loops.
--- fs/ocfs2/dlm/dlmdomain.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ocfs2/dlm/dlmdomain.c +8 -0
@@ -980,6 +980,14 @@ static int dlm_match_regions(struct dlm_ctxt *dlm, goto bail; } +if (qr->qr_numregions >O2NM_MAX_REGIONS ) { +mlog (ML_ERROR ,"Domain %s: Joining node %d has invalid " +"number of heartbeat regions %u\n" , + qr->qr_domain, qr->qr_node, qr->qr_numregions); + status = -EINVAL ; + goto bail; + } + r = remote;for (i =0 ; i < qr->qr_numregions; ++i) {mlog (0 ,"Region %.*s\n" ,O2HB_MAX_REGION_NAME_LEN , r);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 587/969 ocfs2/dlm: fix off-by-one in dlm_match_regions() region comparison
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
[ Upstream commit 01b61e8dda9b0fdb0d4cda43de25f4e390554d7b ]
The local-vs-remote region comparison loop uses '<=' instead of '<', causing it to read one entry past the valid range of qr_regions. The other loops in the same function correctly use '<'.
Fix the loop condition to use '<' for consistency and correctness.
--- fs/ocfs2/dlm/dlmdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlm/dlmdomain.c +1 -1
@@ -1002,7 +1002,7 @@ static int dlm_match_regions(struct dlm_ctxt *dlm,for (i =0 ; i < localnr; ++i) { foundit =0 ; r = remote; -for (j =0 ; j <= qr->qr_numregions; ++j) { +for (j =0 ; j < qr->qr_numregions; ++j) {if (!memcmp (l, r,O2HB_MAX_REGION_NAME_LEN )) { foundit =1 ;break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 588/969 soc: qcom: llcc: fix v1 SB syndrome register offset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit 24e7625df5ce065393249b78930781be593bc381 ]
The llcc_v1_edac_reg_offset table uses 0x2304c for trp_ecc_sb_err_syn0, which is inconsistent with the surrounding TRP ECC registers (0x2034x) and with llcc_v2_1_edac_reg_offset, where trp_ecc_sb_err_syn0 is 0x2034c adjacent to trp_ecc_error_status0/1 at 0x20344/0x20348.
Use 0x2034c for llcc v1 so the SB syndrome register follows the expected +0x4 progression from trp_ecc_error_status1. This fixes EDAC reading the wrong register for SB syndrome reporting.
--- drivers/soc/qcom/llcc-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/llcc-qcom.c +1 -1
@@ -299,7 +299,7 @@ static const struct llcc_slice_config sm8450_data[] = {static const struct llcc_edac_reg_offset llcc_v1_edac_reg_offset = { .trp_ecc_error_status0 =0x20344 , .trp_ecc_error_status1 =0x20348 , - .trp_ecc_sb_err_syn0 =0x2304c , + .trp_ecc_sb_err_syn0 =0x2034c , .trp_ecc_db_err_syn0 =0x20370 , .trp_ecc_error_cntr_clear =0x20440 , .trp_interrupt_0_status =0x20480 ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 589/969 soc: qcom: aoss: compare against normalized cooling state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit cd3c4670db3ffe997be9548c7a9db3952563cf14 ]
qmp_cdev_set_cur_state() normalizes the requested state to a boolean (cdev_state = !!state). The existing early-return check compares qmp_cdev->state == state, which can be wrong if state is non-boolean (any non-zero value). Compare qmp_cdev->state against cdev_state instead, so the check matches the effective state and avoids redundant updates.
--- drivers/soc/qcom/qcom_aoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/qcom_aoss.c +1 -1
@@ -336,7 +336,7 @@ static int qmp_cdev_set_cur_state(struct thermal_cooling_device *cdev,/* Normalize state */ cdev_state = !!state; -if (qmp_cdev->state == state) +if (qmp_cdev->state == cdev_state)return 0 ; snprintf(buf, sizeof(buf),
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 590/969 arm64: dts: qcom: sm8250: Add missing CPU7 3.09GHz OPP
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Koskovich <[email protected]>
[ Upstream commit b683730e27ba4f91986c4c92f5cb7297f1e01a6d ]
This resolves the following error seen on the ASUS ROG Phone 3:
cpu cpu7: Voltage update failed freq=3091200
cpu cpu7: failed to update OPP for freq=3091200
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/qcom/sm8250.dtsi +5 -0
@@ -627,6 +627,11 @@ cpu7_opp20: opp-2841600000 { opp-hz = /bits/ 64 <2841600000>; opp-peak-kBps = <8368000 51609600>; }; + + cpu7_opp21: opp-3091200000 { + opp-hz = /bits/ 64 <3091200000>; + opp-peak-kBps = <8368000 51609600>; + }; }; firmware {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 591/969 ARM: OMAP1: Fix DEBUG_LL and earlyprintk on OMAP16XX
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
[ Upstream commit 7e74b606dd39c46d4378d6f6563f560a00ab8694 ]
On OMAP16XX, the UART enable bit shifts are written instead of the actual bits. This breaks the boot when DEBUG_LL and earlyprintk is enabled; the UART gets disabled and some random bits get enabled. Fix that.
--- arch/arm/mach-omap1/clock_data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap1/clock_data.c +2 -2
@@ -700,8 +700,8 @@ int __init omap1_clk_init(void)/* Make sure UART clocks are enabled early */ if (cpu_is_omap16xx ())omap_writel (omap_readl (MOD_CONF_CTRL_0 ) | -CONF_MOD_UART1_CLK_MODE_R | -CONF_MOD_UART3_CLK_MODE_R ,MOD_CONF_CTRL_0 ); + (1 <<CONF_MOD_UART1_CLK_MODE_R ) | + (1 <<CONF_MOD_UART3_CLK_MODE_R ),MOD_CONF_CTRL_0 );#endif /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 592/969 arm64/xor: fix conflicting attributes for xor_block_template
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 675a0dd596e712404557286d0a883b54ee28e4f4 ]
Commit 2c54b423cf85 ("arm64/xor: use EOR3 instructions when available") changes the definition to __ro_after_init instead of const, but failed to update the external declaration in xor.h. This was not found because xor-neon.c doesn't include <asm/xor.h>, and can't easily do that due to current architecture of the XOR code.
--- arch/arm64/include/asm/xor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/include/asm/xor.h +1 -1
@@ -13,7 +13,7 @@#ifdef CONFIG_KERNEL_MODE_NEON -extern struct xor_block_template const xor_block_inner_neon; +extern struct xor_block_template xor_block_inner_neon__ro_after_init ; static void xor_neon_2(unsigned long bytes, unsigned long * __restrict p1,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 593/969 ocfs2: fix listxattr handling when the buffer is full
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit d12f558e6200b3f47dbef9331ed6d115d2410e59 ]
[BUG]
If an OCFS2 inode has both inline and block-based xattrs, listxattr() can return a size larger than the caller's buffer when the inline names consume that buffer exactly.
kernel BUG at mm/usercopy.c:102!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI RIP: 0010:usercopy_abort+0xb7/0xd0 mm/usercopy.c:102 Call Trace: __check_heap_object+0xe3/0x120 mm/slub.c:8243 check_heap_object mm/usercopy.c:196 [inline] __check_object_size mm/usercopy.c:250 [inline] __check_object_size+0x5c5/0x780 mm/usercopy.c:215 check_object_size include/linux/ucopysize.h:22 [inline] check_copy_size include/linux/ucopysize.h:59 [inline] copy_to_user include/linux/uaccess.h:219 [inline] listxattr+0xb0/0x170 fs/xattr.c:926 filename_listxattr fs/xattr.c:958 [inline] path_listxattrat+0x137/0x320 fs/xattr.c:988 __do_sys_listxattr fs/xattr.c:1001 [inline] __se_sys_listxattr fs/xattr.c:998 [inline] __x64_sys_listxattr+0x7f/0xd0 fs/xattr.c:998 ...
[CAUSE]
Commit 936b8834366e ("ocfs2: Refactor xattr list and remove ocfs2_xattr_handler().") replaced the old per-handler list accounting with ocfs2_xattr_list_entry(), but it kept using size == 0 to detect probe mode.
That assumption stops being true once ocfs2_listxattr() finishes the inline-xattr pass. If the inline names fill the caller buffer exactly, the block-xattr pass runs with a non-NULL buffer and a remaining size of zero. ocfs2_xattr_list_entry() then skips the bounds check, keeps counting block names, and returns a positive size larger than the supplied buffer.
[FIX]
Detect probe mode by testing whether the destination buffer pointer is NULL instead of whether the remaining size is zero.
That restores the pre-refactor behavior and matches the OCFS2 getxattr helpers. Once the remaining buffer reaches zero while more names are left, the block-xattr pass now returns -ERANGE instead of reporting a size larger than the allocated list buffer.
--- fs/ocfs2/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ocfs2/xattr.c +2 -2
@@ -911,8 +911,8 @@ static int ocfs2_xattr_list_entry(struct super_block *sb, total_len = prefix_len + name_len +1 ; *result += total_len; -/* we are just looking for how big our buffer needs to be */ -if (!size) +/* No buffer means we are only looking for the required size. */ +if (!buffer)return 0 ;if (*result > size)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 594/969 ocfs2: validate bg_bits during freefrag scan
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit 8f687eeed3da3012152b0f9473f578869de0cd7b ]
[BUG]
A crafted filesystem can trigger an out-of-bounds bitmap walk when OCFS2_IOC_INFO is issued with OCFS2_INFO_FL_NON_COHERENT.
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline] BUG: KASAN: use-after-free in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline] BUG: KASAN: use-after-free in test_bit_le include/asm-generic/bitops/le.h:21 [inline] BUG: KASAN: use-after-free in ocfs2_info_freefrag_scan_chain fs/ocfs2/ioctl.c:495 [inline] BUG: KASAN: use-after-free in ocfs2_info_freefrag_scan_bitmap fs/ocfs2/ioctl.c:588 [inline] BUG: KASAN: use-after-free in ocfs2_info_handle_freefrag fs/ocfs2/ioctl.c:662 [inline] BUG: KASAN: use-after-free in ocfs2_info_handle_request+0x1c66/0x3370 fs/ocfs2/ioctl.c:754 Read of size 8 at addr ffff888031bce000 by task syz.0.636/1435 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xbe/0x130 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xd1/0x650 mm/kasan/report.c:482 kasan_report+0xfb/0x140 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:186 [inline] kasan_check_range+0x11c/0x200 mm/kasan/generic.c:200 __kasan_check_read+0x11/0x20 mm/kasan/shadow.c:31 instrument_atomic_read include/linux/instrumented.h:68 [inline] _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline] test_bit_le include/asm-generic/bitops/le.h:21 [inline] ocfs2_info_freefrag_scan_chain fs/ocfs2/ioctl.c:495 [inline] ocfs2_info_freefrag_scan_bitmap fs/ocfs2/ioctl.c:588 [inline] ocfs2_info_handle_freefrag fs/ocfs2/ioctl.c:662 [inline] ocfs2_info_handle_request+0x1c66/0x3370 fs/ocfs2/ioctl.c:754 ocfs2_info_handle+0x18d/0x2a0 fs/ocfs2/ioctl.c:828 ocfs2_ioctl+0x632/0x6e0 fs/ocfs2/ioctl.c:913 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x197/0x1e0 fs/ioctl.c:583 ...
[CAUSE]ocfs2_info_freefrag_scan_chain() uses on-disk bg_bits directly as the bitmap scan limit. The coherent path reads group descriptors through ocfs2_read_group_descriptor(), which validates the descriptor before use. The non-coherent path uses ocfs2_read_blocks_sync() instead and skips that validation, so an impossible bg_bits value can drive the bitmap walk past the end of the block.
[FIX]
Compute the bitmap capacity from the filesystem format with ocfs2_group_bitmap_size(), report descriptors whose bg_bits exceeds that limit, and clamp the scan to the computed capacity. This keeps the freefrag report going while avoiding reads beyond the buffer.
--- fs/ocfs2/ioctl.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
fs/ocfs2/ioctl.c +17 -1
@@ -442,13 +442,16 @@ static int ocfs2_info_freefrag_scan_chain(struct ocfs2_super *osb,struct buffer_head *bh =NULL ;struct ocfs2_group_desc *bg =NULL ; -unsigned int max_bits, num_clusters; +unsigned int max_bits, max_bitmap_bits, num_clusters;unsigned int offset =0 , cluster, chunk;unsigned int chunk_free, last_chunksize =0 ;if (!le32_to_cpu (rec->c_free)) goto bail; + max_bitmap_bits =8 *ocfs2_group_bitmap_size (osb->sb,0 , + osb->s_feature_incompat); + do { if (!bg) blkno = le64_to_cpu(rec->c_blkno);
@@ -480,6 +483,19 @@ static int ocfs2_info_freefrag_scan_chain(struct ocfs2_super *osb,continue ; max_bits =le16_to_cpu (bg->bg_bits); + +/* +* Non-coherent scans read raw blocks and do not get the +* bg_bits validation from +* ocfs2_read_group_descriptor(). +*/ +if (max_bits > max_bitmap_bits) { +mlog (ML_ERROR , +"Group desc #%llu has %u bits, max bitmap bits %u\n" , + (unsigned long long )blkno, max_bits, max_bitmap_bits); + max_bits = max_bitmap_bits; + } + offset =0 ;for (chunk =0 ; chunk < chunks_in_group; chunk++) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 595/969 ocfs2: validate group add input before caching
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZhengYuan Huang <[email protected]>
[ Upstream commit 70b672833f4025341c11b22c7f83778a5cd611bc ]
[BUG]OCFS2_IOC_GROUP_ADD can trigger a BUG_ON inocfs2_set_new_buffer_uptodate():
kernel BUG at fs/ocfs2/uptodate.c:509!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI RIP: 0010:ocfs2_set_new_buffer_uptodate+0x194/0x1e0 fs/ocfs2/uptodate.c:509 Code: ffffe88f 42b9fe4c 89e64889 dfe8b4df Call Trace: ocfs2_group_add+0x3f1/0x1510 fs/ocfs2/resize.c:507 ocfs2_ioctl+0x309/0x6e0 fs/ocfs2/ioctl.c:887 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x197/0x1e0 fs/ioctl.c:583 x64_sys_call+0x1144/0x26a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x93/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7bbfb55a966d
[CAUSE]ocfs2_group_add() calls ocfs2_set_new_buffer_uptodate() on a user-controlled group block before ocfs2_verify_group_and_input() validates that block number. That helper is only valid for newly allocated metadata and asserts that the block is not already present in the chosen metadata cache. The code also uses INODE_CACHE(inode) even though the group descriptor belongs to main_bm_inode and later journal accesses use that cache context instead.
[FIX]
Validate the on-disk group descriptor before caching it, then add it to the metadata cache tracked by INODE_CACHE(main_bm_inode). Keep the validation failure path separate from the later cleanup path so we only remove the buffer from that cache after it has actually been inserted. This keeps the group buffer lifetime consistent across validation, journaling, and cleanup.
--- fs/ocfs2/resize.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
fs/ocfs2/resize.c +7 -5
@@ -500,14 +500,14 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) goto out_unlock; } -ocfs2_set_new_buffer_uptodate (INODE_CACHE (inode), group_bh); - ret =ocfs2_verify_group_and_input (main_bm_inode, fe, input, group_bh);if (ret) {mlog_errno (ret); goto out_free_group_bh; } +ocfs2_set_new_buffer_uptodate (INODE_CACHE (main_bm_inode), group_bh); +trace_ocfs2_group_add ((unsigned long long )input->group, input->chain, input->clusters, input->frees);
@@ -515,7 +515,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)if (IS_ERR (handle)) {mlog_errno (PTR_ERR (handle)); ret = -EINVAL ; - goto out_free_group_bh; + goto out_remove_cache; } cl_bpc =le16_to_cpu (fe->id2.i_chain.cl_bpc);
@@ -569,9 +569,11 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) out_commit:ocfs2_commit_trans (osb, handle); -out_free_group_bh: +out_remove_cache:if (ret <0 ) -ocfs2_remove_from_cache (INODE_CACHE (inode), group_bh); +ocfs2_remove_from_cache (INODE_CACHE (main_bm_inode), group_bh); + +out_free_group_bh:brelse (group_bh); out_unlock:
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 596/969 dmaengine: dw-axi-dmac: Remove unnecessary return statement from void function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khairul Anuar Romli <[email protected]>
[ Upstream commit 48278a72fce8a8d30efaedeb206c9c3f05c1eb3f ]
checkpatch.pl --strict reports a WARNING in dw-axi-dmac-platform.c:
WARNING: void function return statements are not generally useful
FILE: drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
According to Linux kernel coding style [Documentation/process/ coding-style.rst], explicit "return;" statements at the end of void functions are redundant and should be omitted. The function will automatically return upon reaching the closing brace, so the extra statement adds unnecessary clutter without functional benefit.
This patch removes the superfluous "return;" statement in dw_axi_dma_set_hw_channel() to comply with kernel coding standards and eliminate the checkpatch warning.
--- drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 2 -- 1 file changed, 2 deletions(-)
drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +0 -2
@@ -540,8 +540,6 @@ static void dw_axi_dma_set_hw_channel(struct axi_dma_chan *chan, bool set) (chan->id * DMA_APB_HS_SEL_BIT_SIZE)); reg_value |= (val << (chan->id *DMA_APB_HS_SEL_BIT_SIZE ));lo_hi_writeq (reg_value, chip->apb_regs +DMAC_APB_HW_HS_SEL_0 ); - -return ; }/*
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 597/969 soundwire: bus: demote UNATTACHED state warnings to dev_dbg()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cole Leavitt <[email protected]>
[ Upstream commit 2c96956fe764f8224f9ec93b2a9160a578949a7a ]
The dev_warn() messages in sdw_handle_slave_status() for UNATTACHED transitions were added in commit d1b328557058 ("soundwire: bus: add dev_warn() messages to track UNATTACHED devices") to debug attachment failures with dynamic debug enabled.
These warnings fire during normal operation -- for example when a codec driver triggers a hardware reset after firmware download, causing the device to momentarily go UNATTACHED before re-attaching -- producing misleading noise on every boot.
Demote the messages to dev_dbg() so they remain available via dynamic debug for diagnosing real attachment failures without alarming users during expected initialization sequences.
--- drivers/soundwire/bus.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soundwire/bus.c +4 -4
@@ -1815,8 +1815,8 @@ int sdw_handle_slave_status(struct sdw_bus *bus,if (status[i] ==SDW_SLAVE_UNATTACHED && slave->status !=SDW_SLAVE_UNATTACHED ) { -dev_warn (&slave->dev,"Slave %d state check1: UNATTACHED, status was %d\n" , - i, slave->status); +dev_dbg (&slave->dev,"Slave %d state check1: UNATTACHED, status was %d\n" , + i, slave->status);sdw_modify_slave_status (slave,SDW_SLAVE_UNATTACHED );/* Ensure driver knows that peripheral unattached */
@@ -1867,8 +1867,8 @@ int sdw_handle_slave_status(struct sdw_bus *bus,if (slave->status ==SDW_SLAVE_UNATTACHED )break ; -dev_warn (&slave->dev,"Slave %d state check2: UNATTACHED, status was %d\n" , - i, slave->status); +dev_dbg (&slave->dev,"Slave %d state check2: UNATTACHED, status was %d\n" , + i, slave->status);sdw_modify_slave_status (slave,SDW_SLAVE_UNATTACHED );break ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 598/969 dmaengine: mxs-dma: Fix missing return value from of_dma_controller_register()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
[ Upstream commit ab2bf6d4c0a0152907b18d25c1b118ea5ea779df ]
Propagate the return value of of_dma_controller_register() in probe() instead of ignoring it.
--- drivers/dma/mxs-dma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/mxs-dma.c +1 -0
@@ -827,6 +827,7 @@ static int mxs_dma_probe(struct platform_device *pdev)if (ret) {dev_err (mxs_dma->dma_device.dev,"failed to register controller\n" ); +return ret; }dev_info (mxs_dma->dma_device.dev,"initialized\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 599/969 tracing: Rebuild full_name on each hist_field_name() call
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 5ec1d1e97de134beed3a5b08235a60fc1c51af96 ]
hist_field_name() uses a static MAX_FILTER_STR_VAL buffer for fully qualified variable-reference names, but it currently appends into that buffer with strcat() without rebuilding it first. As a result, repeated calls append a new "system.event.field" name onto the previous one, which can eventually run past the end of full_name.
Build the name with snprintf() on each call and return NULL if the fully qualified name does not fit in MAX_FILTER_STR_VAL.
--- kernel/trace/trace_events_hist.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
kernel/trace/trace_events_hist.c +7 -5
@@ -1346,12 +1346,14 @@ static const char *hist_field_name(struct hist_field *field, field->flags & HIST_FIELD_FL_VAR_REF) {if (field->system) {static char full_name[MAX_FILTER_STR_VAL ]; +int len; + + len =snprintf (full_name,sizeof (full_name),"%s.%s.%s" , + field->system, field->event_name, + field->name); +if (len >=sizeof (full_name)) +return NULL ; -strcat (full_name, field->system); -strcat (full_name,"." ); -strcat (full_name, field->event_name); -strcat (full_name,"." ); -strcat (full_name, field->name); field_name = full_name; }else field_name = field->name;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 600/969 ima: check return value of crypto_shash_final() in boot aggregate
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Hodges <[email protected]>
[ Upstream commit 870819434c8dfcc3158033b66e7851b81bb17e21 ]
The return value of crypto_shash_final() is not checked in ima_calc_boot_aggregate_tfm(). If the hash finalization fails, the function returns success and a corrupted boot aggregate digest could be used for IMA measurements.
Capture the return value and propagate any error to the caller.
--- security/integrity/ima/ima_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/ima/ima_crypto.c +1 -1
@@ -837,7 +837,7 @@ static int ima_calc_boot_aggregate_tfm(char *digest, u16 alg_id, } }if (!rc) -crypto_shash_final (shash, digest); + rc =crypto_shash_final (shash, digest);return rc; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 601/969 HID: asus: make asus_resume adhere to linux kernel coding standards
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Benato <[email protected]>
[ Upstream commit 51d33b42b8ae23da92819d28439fdd5636c45186 ]
Linux kernel coding standars requires functions opening brackets to be in a newline: move the opening bracket of asus_resume in its own line.
--- drivers/hid/hid-asus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-asus.c +2 -1
@@ -996,7 +996,8 @@ static int asus_start_multitouch(struct hid_device *hdev)return 0 ; } -static int __maybe_unused asus_resume (struct hid_device *hdev) { +static int __maybe_unused asus_resume (struct hid_device *hdev) +{struct asus_drvdata *drvdata =hid_get_drvdata (hdev);int ret =0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 602/969 HID: asus: do not abort probe when not necessary
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Benato <[email protected]>
[ Upstream commit 7253091766ded0fd81fe8d8be9b8b835495b06e8 ]
In order to avoid dereferencing a NULL pointer asus_probe is aborted early and control of some asus devices is transferred over hid-generic after erroring out even when such NULL dereference cannot happen: only early abort when the NULL dereference can happen.
Also make the code shorter and more adherent to coding standards removing square brackets enclosing single-line if-else statements.
--- drivers/hid/hid-asus.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
drivers/hid/hid-asus.c +10 -15
@@ -1124,22 +1124,17 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)* were freed during registration due to no usages being mapped, * leaving drvdata->input pointing to freed memory. */ -if (!drvdata->input || !(hdev->claimed &HID_CLAIMED_INPUT )) { -hid_err (hdev,"Asus input not registered\n" ); - ret = -ENOMEM ; - goto err_stop_hw; - } - -if (drvdata->tp) { - drvdata->input->name ="Asus TouchPad" ; - }else { - drvdata->input->name ="Asus Keyboard" ; - } +if (drvdata->input && (hdev->claimed &HID_CLAIMED_INPUT )) { +if (drvdata->tp) + drvdata->input->name ="Asus TouchPad" ; +else + drvdata->input->name ="Asus Keyboard" ; -if (drvdata->tp) { - ret =asus_start_multitouch (hdev); -if (ret) - goto err_stop_hw; +if (drvdata->tp) { + ret =asus_start_multitouch (hdev); +if (ret) + goto err_stop_hw; + } }return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 603/969 mtd: physmap_of_gemini: Fix disabled pinctrl state check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit b7c0982184b0661f5b1b805f3a56f1bd3757b63e ]
The condition for checking the disabled pinctrl state incorrectly checks gf->enabled_state instead of gf->disabled_state. This causes misleading error messages and could lead to incorrect behavior when only one of the pinctrl states is defined.
Fix the condition to properly check gf->disabled_state.
--- drivers/mtd/maps/physmap-gemini.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/physmap-gemini.c +1 -1
@@ -181,7 +181,7 @@ int of_flash_probe_gemini(struct platform_device *pdev,dev_err (dev,"no enabled pin control state\n" ); gf->disabled_state =pinctrl_lookup_state (gf->p,"disabled" ); -if (IS_ERR (gf->enabled_state)) { +if (IS_ERR (gf->disabled_state)) {dev_err (dev,"no disabled pin control state\n" ); }else { ret =pinctrl_select_state (gf->p, gf->disabled_state);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 604/969 mtd: spi-nor: core: correct the op.dummy.nbytes when check read operations
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Chen <[email protected]>
[ Upstream commit 756564a536ecd8c9d33edd89f0647a91a0b03587 ]
When check read operation, need to setting the op.dummy.nbytes based on current read operation rather than the nor->read_proto.
--- drivers/mtd/spi-nor/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +1 -1
@@ -2061,7 +2061,7 @@ static int spi_nor_spimem_check_readop(struct spi_nor *nor,/* convert the dummy cycles to the number of bytes */ op.dummy.nbytes = (read->num_mode_clocks + read->num_wait_states) * op.dummy.buswidth /8 ; -if (spi_nor_protocol_is_dtr (nor->read_proto)) +if (spi_nor_protocol_is_dtr (read->proto)) op.dummy.nbytes *=2 ;return spi_nor_spimem_check_op (nor, &op);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 605/969 mtd: spi-nor: spansion: Rename s28hs512t prefix
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit 06051322704bf38cbd721e14bdbd6e43c8e6d7e1 ]
Change prefix to support all other devices in SEMPER S28 family.
Stable-dep-of: 3620d67b4849 ("mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation")
--- drivers/mtd/spi-nor/spansion.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/mtd/spi-nor/spansion.c +10 -10
@@ -288,7 +288,7 @@ static int cypress_nor_octal_dtr_enable(struct spi_nor *nor, bool enable)cypress_nor_octal_dtr_dis (nor); } -static void s28hs512t_post_sfdp_fixup (struct spi_nor *nor) +static void s28hx_t_post_sfdp_fixup (struct spi_nor *nor) {/* * On older versions of the flash the xSPI Profile 1.0 table has the
@@ -316,23 +316,23 @@ static void s28hs512t_post_sfdp_fixup(struct spi_nor *nor) nor->params->rdsr_addr_nbytes =4 ; } -static int s28hs512t_post_bfpt_fixup (struct spi_nor *nor, -const struct sfdp_parameter_header *bfpt_header, -const struct sfdp_bfpt *bfpt) +static int s28hx_t_post_bfpt_fixup (struct spi_nor *nor, +const struct sfdp_parameter_header *bfpt_header, +const struct sfdp_bfpt *bfpt) {return cypress_nor_set_page_size (nor); } -static void s28hs512t_late_init (struct spi_nor *nor) +static void s28hx_t_late_init (struct spi_nor *nor) { nor->params->octal_dtr_enable = cypress_nor_octal_dtr_enable;cypress_nor_ecc_init (nor); } -static const struct spi_nor_fixups s28hs512t_fixups = { - .post_sfdp = s28hs512t_post_sfdp_fixup, - .post_bfpt = s28hs512t_post_bfpt_fixup, - .late_init = s28hs512t_late_init, +static const struct spi_nor_fixups s28hx_t_fixups = { + .post_sfdp = s28hx_t_post_sfdp_fixup, + .post_bfpt = s28hx_t_post_bfpt_fixup, + .late_init = s28hx_t_late_init, }; static int
@@ -468,7 +468,7 @@ static const struct flash_info spansion_nor_parts[] = { FLAGS(SPI_NOR_NO_ERASE) }, { "s28hs512t", INFO(0x345b1a, 0, 256 * 1024, 256) PARSE_SFDP - .fixups = &s28hs512t_fixups, + .fixups = &s28hx_t_fixups, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 606/969 mtd: spi-nor: spansion: Replace hardcoded values for addr_nbytes/addr_mode_nbytes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tudor Ambarus <[email protected]>
[ Upstream commit 05ebc1ccb8affcbaaa9f8b8fe56839cbfc9b9144 ]
We track in the core the internal address mode of the flash. Stop using hardcoded values for the number of bytes of address and use nor->addr_nbytes and nor->params->addr_mode_nbytes instead.
Stable-dep-of: 3620d67b4849 ("mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation")
--- drivers/mtd/spi-nor/spansion.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/mtd/spi-nor/spansion.c +11 -5
@@ -54,11 +54,13 @@ static int cypress_nor_octal_dtr_en(struct spi_nor *nor)struct spi_mem_op op;u8 *buf = nor->bouncebuf;int ret; +u8 addr_mode_nbytes = nor->params->addr_mode_nbytes;/* Use 24 dummy cycles for memory array reads. */ *buf =SPINOR_REG_CYPRESS_CFR2V_MEMLAT_11_24 ; op = (struct spi_mem_op ) -CYPRESS_NOR_WR_ANY_REG_OP (3 ,SPINOR_REG_CYPRESS_CFR2V ,1 , buf); +CYPRESS_NOR_WR_ANY_REG_OP (addr_mode_nbytes, +SPINOR_REG_CYPRESS_CFR2V ,1 , buf); ret =spi_nor_write_any_volatile_reg (nor, &op, nor->reg_proto);if (ret)
@@ -69,14 +71,16 @@ static int cypress_nor_octal_dtr_en(struct spi_nor *nor)/* Set the octal and DTR enable bits. */ buf[0 ] =SPINOR_REG_CYPRESS_CFR5V_OCT_DTR_EN ; op = (struct spi_mem_op ) -CYPRESS_NOR_WR_ANY_REG_OP (3 ,SPINOR_REG_CYPRESS_CFR5V ,1 , buf); +CYPRESS_NOR_WR_ANY_REG_OP (addr_mode_nbytes, +SPINOR_REG_CYPRESS_CFR5V ,1 , buf); ret =spi_nor_write_any_volatile_reg (nor, &op, nor->reg_proto);if (ret)return ret;/* Read flash ID to make sure the switch was successful. */ - ret =spi_nor_read_id (nor,4 ,3 , buf,SNOR_PROTO_8_8_8_DTR ); + ret =spi_nor_read_id (nor, nor->addr_nbytes,3 , buf, +SNOR_PROTO_8_8_8_DTR );if (ret) {dev_dbg (nor->dev,"error %d reading JEDEC ID after enabling 8D-8D-8D mode\n" , ret);return ret;
@@ -102,7 +106,8 @@ static int cypress_nor_octal_dtr_dis(struct spi_nor *nor) buf[0 ] =SPINOR_REG_CYPRESS_CFR5V_OCT_DTR_DS ; buf[1 ] =0 ; op = (struct spi_mem_op ) -CYPRESS_NOR_WR_ANY_REG_OP (4 ,SPINOR_REG_CYPRESS_CFR5V ,2 , buf); +CYPRESS_NOR_WR_ANY_REG_OP (nor->addr_nbytes, +SPINOR_REG_CYPRESS_CFR5V ,2 , buf); ret =spi_nor_write_any_volatile_reg (nor, &op,SNOR_PROTO_8_8_8_DTR );if (ret)return ret;
@@ -196,7 +201,8 @@ static int cypress_nor_quad_enable_volatile(struct spi_nor *nor)static int cypress_nor_set_page_size (struct spi_nor *nor) {struct spi_mem_op op = -CYPRESS_NOR_RD_ANY_REG_OP (3 ,SPINOR_REG_CYPRESS_CFR3V , +CYPRESS_NOR_RD_ANY_REG_OP (nor->params->addr_mode_nbytes, +SPINOR_REG_CYPRESS_CFR3V , nor->bouncebuf);int ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 607/969 mtd: spi-nor: spansion: Make RD_ANY_REG_OP macro take number of dummy bytes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit d628783c46d3c317deb0671ceb986be358fbaf69 ]
Currently Read Any Register op is used to read volatile registers without any dummy cycles, but the op requires dummy cycles depending on register type (volatiler or non-volatile), device family, and device configuration. Add 'ndummy' argument to RD_ANY_REG_OP macro to support other use cases.
Stable-dep-of: 3620d67b4849 ("mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation")
--- drivers/mtd/spi-nor/spansion.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mtd/spi-nor/spansion.c +5 -5
@@ -37,10 +37,10 @@ SPI_MEM_OP_NO_DUMMY, \ SPI_MEM_OP_DATA_OUT(ndata, buf, 0)) -#define CYPRESS_NOR_RD_ANY_REG_OP (naddr, addr, buf) \ +#define CYPRESS_NOR_RD_ANY_REG_OP (naddr, addr, ndummy, buf) \ SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RD_ANY_REG, 0), \ SPI_MEM_OP_ADDR(naddr, addr, 0), \ - SPI_MEM_OP_NO_DUMMY, \ + SPI_MEM_OP_DUMMY(ndummy, 0), \ SPI_MEM_OP_DATA_IN(1, buf, 0))#define SPANSION_CLSR_OP \
@@ -148,7 +148,7 @@ static int cypress_nor_quad_enable_volatile(struct spi_nor *nor) op = (struct spi_mem_op )CYPRESS_NOR_RD_ANY_REG_OP (addr_mode_nbytes, -SPINOR_REG_CYPRESS_CFR1V , +SPINOR_REG_CYPRESS_CFR1V ,0 , nor->bouncebuf); ret =spi_nor_read_any_reg (nor, &op, nor->reg_proto);
@@ -173,7 +173,7 @@ static int cypress_nor_quad_enable_volatile(struct spi_nor *nor)/* Read back and check it. */ op = (struct spi_mem_op )CYPRESS_NOR_RD_ANY_REG_OP (addr_mode_nbytes, -SPINOR_REG_CYPRESS_CFR1V , +SPINOR_REG_CYPRESS_CFR1V ,0 , nor->bouncebuf); ret =spi_nor_read_any_reg (nor, &op, nor->reg_proto);if (ret)
@@ -202,7 +202,7 @@ static int cypress_nor_set_page_size(struct spi_nor *nor) {struct spi_mem_op op =CYPRESS_NOR_RD_ANY_REG_OP (nor->params->addr_mode_nbytes, -SPINOR_REG_CYPRESS_CFR3V , +SPINOR_REG_CYPRESS_CFR3V ,0 , nor->bouncebuf);int ret;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 608/969 mtd: spi-nor: spansion: Add support for Infineon S25FS256T
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit 6afcc84080c415df81765c6d773edcba8fc30f6c ]
Infineon S25FS256T is 256Mbit Quad SPI NOR flash. The key features and differences comparing to other Spansion/Cypress flash familes are:
- 4-byte address mode by factory default
- Quad mode is enabled by factory default
- OP_READ_FAST_4B(0Ch) is not supported
- Supports mixture of 128KB and 64KB sectors by OTP configuration (this patch supports uniform 128KB only due to complexity of non-uniform layout)
Tested on Xilinx Zynq-7000 FPGA board.
Stable-dep-of: 3620d67b4849 ("mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation")
--- drivers/mtd/spi-nor/spansion.c | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
drivers/mtd/spi-nor/spansion.c +60 -0
@@ -29,6 +29,7 @@ SPINOR_REG_CYPRESS_CFR5_OPI)#define SPINOR_REG_CYPRESS_CFR5V_OCT_DTR_DS SPINOR_REG_CYPRESS_CFR5_BIT6#define SPINOR_OP_CYPRESS_RD_FAST 0xee +#define SPINOR_REG_CYPRESS_ARCFN 0x00000006/* Cypress SPI NOR flash operations. */ #define CYPRESS_NOR_WR_ANY_REG_OP (naddr, addr, ndata, buf) \
@@ -229,6 +230,62 @@ static void cypress_nor_ecc_init(struct spi_nor *nor) nor->flags |=SNOR_F_ECC ; } +static int +s25fs256t_post_bfpt_fixup (struct spi_nor *nor, +const struct sfdp_parameter_header *bfpt_header, +const struct sfdp_bfpt *bfpt) +{ +struct spi_mem_op op; +int ret; + +/* 4-byte address mode is enabled by default */ + nor->params->addr_nbytes =4 ; + nor->params->addr_mode_nbytes =4 ; + +/* Read Architecture Configuration Register (ARCFN) */ + op = (struct spi_mem_op ) +CYPRESS_NOR_RD_ANY_REG_OP (nor->params->addr_mode_nbytes, +SPINOR_REG_CYPRESS_ARCFN ,1 , + nor->bouncebuf); + ret =spi_nor_read_any_reg (nor, &op, nor->reg_proto); +if (ret) +return ret; + +/* ARCFN value must be 0 if uniform sector is selected */ +if (nor->bouncebuf[0 ]) +return -ENODEV ; + +return cypress_nor_set_page_size (nor); +} + +static void s25fs256t_post_sfdp_fixup (struct spi_nor *nor) +{ +struct spi_nor_flash_parameter *params = nor->params; + +/* PP_1_1_4_4B is supported but missing in 4BAIT. */ + params->hwcaps.mask |=SNOR_HWCAPS_PP_1_1_4 ; +spi_nor_set_pp_settings (¶ms->page_programs[SNOR_CMD_PP_1_1_4 ], +SPINOR_OP_PP_1_1_4_4B , +SNOR_PROTO_1_1_4 ); +} + +static void s25fs256t_late_init (struct spi_nor *nor) +{ +/* +* Programming is supported only in 16-byte ECC data unit granularity. +* Byte-programming, bit-walking, or multiple program operations to the +* same ECC data unit without an erase are not allowed. See chapter +* 5.3.1 and 5.6 in the datasheet. +*/ + nor->params->writesize =16 ; +} + +static struct spi_nor_fixups s25fs256t_fixups = { + .post_bfpt = s25fs256t_post_bfpt_fixup, + .post_sfdp = s25fs256t_post_sfdp_fixup, + .late_init = s25fs256t_late_init, +}; + static int s25hx_t_post_bfpt_fixup(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header,
@@ -454,6 +511,9 @@ static const struct flash_info spansion_nor_parts[] = { { "s25fl256l", INFO(0x016019, 0, 64 * 1024, 512) NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) FIXUP_FLAGS(SPI_NOR_4B_OPCODES) }, + { "s25fs256t", INFO6(0x342b19, 0x0f0890, 0, 0) +PARSE_SFDP + .fixups = &s25fs256t_fixups }, { "s25hl512t", INFO6(0x342a1a, 0x0f0390, 256 * 1024, 256)PARSE_SFDP MFR_FLAGS (USE_CLSR )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 609/969 mtd: spi-nor: Allow post_sfdp hook to return errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tudor Ambarus <[email protected]>
[ Upstream commit e570f7872a34dc290014c80c7bad365d6577836b ]
Multi die flashes like s25hl02gt need to determine the page_size at run-time by querying a configuration register for each die. Since the number of dice is determined in an optional SFDP table, SCCR MC, the page size configuration must be done in the post_sfdp hook. Allow post_sfdp to return errors, as reading the configuration register might return errors.
Stable-dep-of: 3620d67b4849 ("mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation")
--- drivers/mtd/spi-nor/core.h | 2 +- drivers/mtd/spi-nor/micron-st.c | 4 +++- drivers/mtd/spi-nor/sfdp.c | 17 ++++++++++++----- drivers/mtd/spi-nor/spansion.c | 12 +++++++++--- 4 files changed, 25 insertions(+), 10 deletions(-)
drivers/mtd/spi-nor/core.h +1 -1
@@ -424,7 +424,7 @@ struct spi_nor_fixups {int (*post_bfpt)(struct spi_nor *nor,const struct sfdp_parameter_header *bfpt_header,const struct sfdp_bfpt *bfpt); -void (*post_sfdp)(struct spi_nor *nor); +int (*post_sfdp)(struct spi_nor *nor);void (*late_init)(struct spi_nor *nor); };
drivers/mtd/spi-nor/micron-st.c +3 -1
@@ -127,7 +127,7 @@ static void mt35xu512aba_default_init(struct spi_nor *nor) nor->params->octal_dtr_enable = micron_st_nor_octal_dtr_enable; } -static void mt35xu512aba_post_sfdp_fixup (struct spi_nor *nor) +static int mt35xu512aba_post_sfdp_fixup (struct spi_nor *nor) {/* Set the Fast Read settings. */ nor->params->hwcaps.mask |=SNOR_HWCAPS_READ_8_8_8_DTR ;
@@ -145,6 +145,8 @@ static void mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor)* disable it. */ nor->params->quad_enable =NULL ; + +return 0 ; }static const struct spi_nor_fixups mt35xu512aba_fixups = {
drivers/mtd/spi-nor/sfdp.c +12 -5
@@ -1239,14 +1239,21 @@ static int spi_nor_parse_sccr(struct spi_nor *nor,* Used to tweak various flash parameters when information provided by the SFDP * tables are wrong. */ -static void spi_nor_post_sfdp_fixups (struct spi_nor *nor) +static int spi_nor_post_sfdp_fixups (struct spi_nor *nor) { +int ret; +if (nor->manufacturer && nor->manufacturer->fixups && - nor->manufacturer->fixups->post_sfdp) - nor->manufacturer->fixups->post_sfdp (nor); + nor->manufacturer->fixups->post_sfdp) { + ret = nor->manufacturer->fixups->post_sfdp (nor); +if (ret) +return ret; + }if (nor->info->fixups && nor->info->fixups->post_sfdp) - nor->info->fixups->post_sfdp (nor); +return nor->info->fixups->post_sfdp (nor); + +return 0 ; }/**
@@ -1429,7 +1436,7 @@ int spi_nor_parse_sfdp(struct spi_nor *nor) } } -spi_nor_post_sfdp_fixups (nor); + err =spi_nor_post_sfdp_fixups (nor); exit:kfree (param_headers);return err;
drivers/mtd/spi-nor/spansion.c +9 -3
@@ -258,7 +258,7 @@ s25fs256t_post_bfpt_fixup(struct spi_nor *nor,return cypress_nor_set_page_size (nor); } -static void s25fs256t_post_sfdp_fixup (struct spi_nor *nor) +static int s25fs256t_post_sfdp_fixup (struct spi_nor *nor) {struct spi_nor_flash_parameter *params = nor->params;
@@ -267,6 +267,8 @@ static void s25fs256t_post_sfdp_fixup(struct spi_nor *nor)spi_nor_set_pp_settings (¶ms->page_programs[SNOR_CMD_PP_1_1_4 ],SPINOR_OP_PP_1_1_4_4B ,SNOR_PROTO_1_1_4 ); + +return 0 ; }static void s25fs256t_late_init (struct spi_nor *nor)
@@ -297,7 +299,7 @@ s25hx_t_post_bfpt_fixup(struct spi_nor *nor,return cypress_nor_set_page_size (nor); } -static void s25hx_t_post_sfdp_fixup (struct spi_nor *nor) +static int s25hx_t_post_sfdp_fixup (struct spi_nor *nor) {struct spi_nor_erase_type *erase_type = nor->params->erase_map.erase_type;
@@ -319,6 +321,8 @@ static void s25hx_t_post_sfdp_fixup(struct spi_nor *nor)break ; } } + +return 0 ; }static void s25hx_t_late_init (struct spi_nor *nor)
@@ -351,7 +355,7 @@ static int cypress_nor_octal_dtr_enable(struct spi_nor *nor, bool enable)cypress_nor_octal_dtr_dis (nor); } -static void s28hx_t_post_sfdp_fixup (struct spi_nor *nor) +static int s28hx_t_post_sfdp_fixup (struct spi_nor *nor) {/* * On older versions of the flash the xSPI Profile 1.0 table has the
@@ -377,6 +381,8 @@ static void s28hx_t_post_sfdp_fixup(struct spi_nor *nor)* actual value for that is 4. */ nor->params->rdsr_addr_nbytes =4 ; + +return 0 ; } static int s28hx_t_post_bfpt_fixup(struct spi_nor *nor,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 610/969 mtd: spi-nor: sfdp: introduce smpt_read_dummy fixup hook
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit 653f6def567c81f37302f9591ffd54df3e2a11eb ]
SMPT contains config detection info that describes opcode, address, and dummy cycles to read sector map config. The dummy cycles parameter can be SMPT_CMD_READ_DUMMY_IS_VARIABLE and in that case nor->read_dummy (initialized as 0) is used. In Infineon flash chips, Read Any Register command with variable dummy cycle is defined in SMPT. S25Hx/S28Hx flash has 0 dummy cycle by default to read volatile regiters and nor->read_dummy can work. S25FS-S flash has 8 dummy cycles so we need a hook that can fix dummy cycles with actually used value.
Inroduce smpt_read_dummy() in struct spi_nor_fixups. It is called when the dummy cycle field in SMPT config detection is 'varialble'.
Stable-dep-of: 3620d67b4849 ("mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation")
--- drivers/mtd/spi-nor/core.h | 3 +++ drivers/mtd/spi-nor/sfdp.c | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/core.h +3 -0
@@ -407,6 +407,8 @@ struct spi_nor_flash_parameter {* flash parameters when information provided by the flash_info * table is incomplete or wrong. * @post_bfpt: called after the BFPT table has been parsed +* @smpt_read_dummy: called during SMPT table is being parsed. Used to fix the +* number of dummy cycles in read register ops. * @post_sfdp: called after SFDP has been parsed (is also called for SPI NORs * that do not support RDSFDP). Typically used to tweak various * parameters that could not be extracted by other means (i.e.
@@ -424,6 +426,7 @@ struct spi_nor_fixups {int (*post_bfpt)(struct spi_nor *nor,const struct sfdp_parameter_header *bfpt_header,const struct sfdp_bfpt *bfpt); +void (*smpt_read_dummy)(const struct spi_nor *nor,u8 *read_dummy);int (*post_sfdp)(struct spi_nor *nor);void (*late_init)(struct spi_nor *nor); };
drivers/mtd/spi-nor/sfdp.c +16 -2
@@ -659,6 +659,17 @@ static u8 spi_nor_smpt_addr_nbytes(const struct spi_nor *nor, const u32 settings } } +static void spi_nor_smpt_read_dummy_fixups (const struct spi_nor *nor, +u8 *read_dummy) +{ +if (nor->manufacturer && nor->manufacturer->fixups && + nor->manufacturer->fixups->smpt_read_dummy) + nor->manufacturer->fixups->smpt_read_dummy (nor, read_dummy); + +if (nor->info->fixups && nor->info->fixups->smpt_read_dummy) + nor->info->fixups->smpt_read_dummy (nor, read_dummy); +} +/** * spi_nor_smpt_read_dummy() - return the configuration detection command read * latency, in clock cycles.
@@ -671,8 +682,11 @@ static u8 spi_nor_smpt_read_dummy(const struct spi_nor *nor, const u32 settings) {u8 read_dummy =SMPT_CMD_READ_DUMMY (settings); -if (read_dummy ==SMPT_CMD_READ_DUMMY_IS_VARIABLE ) -return nor->read_dummy; +if (read_dummy ==SMPT_CMD_READ_DUMMY_IS_VARIABLE ) { + read_dummy = nor->read_dummy; +spi_nor_smpt_read_dummy_fixups (nor, &read_dummy); + } +return read_dummy; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 611/969 mtd: spi-nor: sfdp: introduce smpt_map_id fixup hook
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takahiro Kuwano <[email protected]>
[ Upstream commit f74de390557bf2bcc5dca4a357b41c0701d3f76e ]
Certain chips have inconsistent Sector Map Parameter Table (SMPT) data, which leads to the wrong map ID being identified, causing failures to detect the correct sector map.
To fix this, introduce smpt_map_id() into the struct spi_nor_fixups. This function will be called after the initial SMPT-based detection, allowing chip-specific logic to correct the map ID.
Infineon S25FS512S needs this fixup as it has inconsistency between map ID definition and configuration register value actually obtained.
Stable-dep-of: 3620d67b4849 ("mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation")
--- drivers/mtd/spi-nor/core.h | 3 +++ drivers/mtd/spi-nor/sfdp.c | 12 ++++++++++++ 2 files changed, 15 insertions(+)
drivers/mtd/spi-nor/core.h +3 -0
@@ -409,6 +409,8 @@ struct spi_nor_flash_parameter {* @post_bfpt: called after the BFPT table has been parsed * @smpt_read_dummy: called during SMPT table is being parsed. Used to fix the * number of dummy cycles in read register ops. +* @smpt_map_id: called after map ID in SMPT table has been determined for the +* case the map ID is wrong and needs to be fixed. * @post_sfdp: called after SFDP has been parsed (is also called for SPI NORs * that do not support RDSFDP). Typically used to tweak various * parameters that could not be extracted by other means (i.e.
@@ -427,6 +429,7 @@ struct spi_nor_fixups {const struct sfdp_parameter_header *bfpt_header, const struct sfdp_bfpt *bfpt);void (*smpt_read_dummy)(const struct spi_nor *nor,u8 *read_dummy); +void (*smpt_map_id)(const struct spi_nor *nor,u8 *map_id);int (*post_sfdp)(struct spi_nor *nor);void (*late_init)(struct spi_nor *nor); };
drivers/mtd/spi-nor/sfdp.c +12 -0
@@ -690,6 +690,16 @@ static u8 spi_nor_smpt_read_dummy(const struct spi_nor *nor, const u32 settings)return read_dummy; } +static void spi_nor_smpt_map_id_fixups (const struct spi_nor *nor,u8 *map_id) +{ +if (nor->manufacturer && nor->manufacturer->fixups && + nor->manufacturer->fixups->smpt_map_id) + nor->manufacturer->fixups->smpt_map_id (nor, map_id); + +if (nor->info->fixups && nor->info->fixups->smpt_map_id) + nor->info->fixups->smpt_map_id (nor, map_id); +} +/** * spi_nor_get_map_in_use() - get the configuration map in use * @nor: pointer to a 'struct spi_nor'
@@ -743,6 +753,8 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt, map_id = map_id <<1 | !!(*buf & read_data_mask); } +spi_nor_smpt_map_id_fixups (nor, &map_id); +/* * If command descriptors are provided, they always precede map * descriptors in the table. There is no need to start the iteration
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 612/969 mtd: spi-nor: update spi_nor_fixups::post_sfdp() documentation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Gorski <[email protected]>
[ Upstream commit 3620d67b48493c6252bbc873dc88dde81641d56b ]
After commit 5273cc6df984 ("mtd: spi-nor: core: Call spi_nor_post_sfdp_fixups() only when SFDP is defined") spi_nor_post_sfdp_fixups() isn't called anymore if no SFDP is detected.
Update the documentation accordingly.
--- drivers/mtd/spi-nor/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/core.h +1 -1
@@ -411,7 +411,7 @@ struct spi_nor_flash_parameter {* number of dummy cycles in read register ops. * @smpt_map_id: called after map ID in SMPT table has been determined for the * case the map ID is wrong and needs to be fixed. -* @post_sfdp: called after SFDP has been parsed (is also called for SPI NORs +* @post_sfdp: called after SFDP has been parsed (is not called for SPI NORs * that do not support RDSFDP). Typically used to tweak various * parameters that could not be extracted by other means (i.e. * when information provided by the SFDP/flash_info tables are
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 613/969 mtd: spi-nor: swp: check SR_TB flag when getting tb_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiji Yang <[email protected]>
[ Upstream commit 94645aa41bf9ecb87c2ce78b1c3405bfb6074a37 ]
When the chip does not support top/bottom block protect, the tb_mask must be set to 0, otherwise SR1 bit5 will be unexpectedly modified.
--- drivers/mtd/spi-nor/swp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/swp.c +3 -1
@@ -27,8 +27,10 @@ static u8 spi_nor_get_sr_tb_mask(struct spi_nor *nor) {if (nor->flags &SNOR_F_HAS_SR_TB_BIT6 )return SR_TB_BIT6 ; -else +else if (nor->flags &SNOR_F_HAS_SR_TB )return SR_TB_BIT5 ; +else +return 0 ; }static u64 spi_nor_get_min_prot_length_sr (struct spi_nor *nor)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 614/969 mtd: parsers: ofpart: call of_node_put() only in ofpart_fail path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
[ Upstream commit 0c87dea1aab86116211cb37387c404c9e9231c39 ]
ofpart_none can only be reached after the for_each_child_of_node() loop finishes. for_each_child_of_node() correctly calls of_node_put() for all device nodes it iterates over as long as we don't break or jump out of the loop.
Calling of_node_put() inside the ofpart_none path will wrongly decrement the ref count of the last node in the for_each_child_of_node() loop.
Move the call to of_node_put() under the ofpart_fail label to fix this.
--- drivers/mtd/parsers/ofpart_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/parsers/ofpart_core.c +1 -1
@@ -191,11 +191,11 @@ static int parse_fixed_partitions(struct mtd_info *master, ofpart_fail:pr_err ("%s: error parsing ofpart partition %pOF (%pOF)\n" , master->name, pp, mtd_node); +of_node_put (pp); ret = -EINVAL ; ofpart_none:if (dedicated)of_node_put (ofpart_node); -of_node_put (pp);kfree (parts);return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 615/969 mtd: parsers: ofpart: call of_node_get() for dedicated subpartitions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
[ Upstream commit e882626c1747653f1f01ea9d12e278e613b11d0f ]
In order to parse sub-partitions, add_mtd_partitions() calls parse_mtd_partitions() for all previously found partitions.
Each partition will end up being passed to parse_fixed_partitions(), and its of_node will be treated as the ofpart_node.
Commit 7cce81df7d26 ("mtd: parsers: ofpart: fix OF node refcount leak in parse_fixed_partitions()") added of_node_put() calls for ofpart_node on all exit paths.
In the case where the partition passed to parse_fixed_partitions() has a parent, it is treated as a dedicated partitions node, and of_node_put() is wrongly called for it, even if of_node_get() was not called explicitly.
On repeated bind / unbinds of the MTD, the extra of_node_put() ends up decrementing the refcount down to 0, which should never happen, resulting in the following error:
OF: ERROR: of_node_release() detected bad of_node_put() on /soc/spi@80007000/flash@0/partitions/partition@0
Call of_node_get() to balance the call to of_node_put() done for dedicated partitions nodes.
--- drivers/mtd/parsers/ofpart_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/parsers/ofpart_core.c +1 -1
@@ -71,7 +71,7 @@ static int parse_fixed_partitions(struct mtd_info *master, dedicated = false; } }else {/* Partition */ - ofpart_node = mtd_node; + ofpart_node =of_node_get (mtd_node); } of_id =of_match_node (parse_ofpart_match_table, ofpart_node);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 616/969 mtd: rawnand: sunxi: fix sunxi_nfc_hw_ecc_read_extra_oob
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Genoud <[email protected]>
[ Upstream commit 848c13996c55fe4ea6bf5acc3ce6c8c5c944b5f6 ]
When dumping the OOB, the bytes at the end where actually copied from the beginning of the OOB instead of current_offset.
That leads to something like:
OOB: ff ff ff ff ff ff ff ff ea 19 00 3a 83 db aa 8d
OOB: 99 09 c8 9a 90 36 35 7d aa 15 13 07 3d 97 b2 a4
OOB: a8 bb 19 b3 07 e9 f6 25 52 d7 1a 23 e2 7e 0a e4
OOB: 52 8a 09 d2 1a 86 3d cf b4 99 43 13 d3 90 33 0b
OOB: ff ff ff ff ff ff ff ff ea 19 00 3a 83 db aa 8d
OOB: 99 09 c8 9a 90 36 35 7d aa 15 13 07 3d 97 b2 a4
OOB: a8 bb 19 b3 07 e9 f6 25 52 d7 1a 23 e2 7e 0a e4
OOB: 52 8a 09 d2 1a 86 3d cf b4 99 43 13 d3 90 33 0b instead of:
OOB: ff ff ff ff ff ff ff ff ea 19 00 3a 83 db aa 8d
OOB: 99 09 c8 9a 90 36 35 7d aa 15 13 07 3d 97 b2 a4
OOB: a8 bb 19 b3 07 e9 f6 25 52 d7 1a 23 e2 7e 0a e4
OOB: 52 8a 09 d2 1a 86 3d cf b4 99 43 13 d3 90 33 0b
OOB: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
OOB: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
OOB: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
OOB: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff (example with BCH16, user data [8,0], no scrambling)
*cur_off (offset from the beginning of the page) was compared to offset (offset from the beginning of the OOB), and then, the nand_change_read_column_op() sets the current position to the beginning of the OOB instead of OOB+offset
--- drivers/mtd/nand/raw/sunxi_nand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/sunxi_nand.c +3 -3
@@ -898,9 +898,9 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct nand_chip *nand,if (len <=0 )return ; -if (!cur_off || *cur_off != offset) -nand_change_read_column_op (nand, mtd->writesize,NULL ,0 , - false); +if (!cur_off || *cur_off != (offset + mtd->writesize)) +nand_change_read_column_op (nand, mtd->writesize + offset, +NULL ,0 , false);if (!randomize)sunxi_nfc_read_buf (nand, oob + offset, len);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 617/969 HID: usbhid: fix deadlock in hid_post_reset()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
[ Upstream commit 8df2c1b47ee3cd50fd454f75c7a7e2ae8a6adf72 ]
You can build a USB device that includes a HID component and a storage or UAS component. The components can be reset only together. That means that hid_pre_reset() and hid_post_reset() are in the block IO error handling. Hence no memory allocation used in them may do block IO because the IO can deadlock on the mutex held while resetting a device and calling the interface drivers.
Use GFP_NOIO for all allocations in them.
--- drivers/hid/usbhid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/hid-core.c +1 -1
@@ -1544,7 +1544,7 @@ static int hid_post_reset(struct usb_interface *intf)* configuration descriptors passed, we already know that * the size of the HID report descriptor has not changed. */ - rdesc =kmalloc (hid->dev_rsize,GFP_KERNEL ); + rdesc =kmalloc (hid->dev_rsize,GFP_NOIO );if (!rdesc)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 618/969 bpf, arm64: Fix off-by-one in check_imm signed range check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 1dd8be4ec722ce54e4cace59f3a4ba658111b3ec ]
check_imm(bits, imm) is used in the arm64 BPF JIT to verify that a branch displacement (in arm64 instruction units) fits into the signed N-bit immediate field of a B, B.cond or CBZ/CBNZ encoding before it is handed to the encoder. The macro currently tests for (imm > 0 && imm >> bits) || (imm < 0 && ~imm >> bits) which admits values in [-2^N, 2^N) — effectively a signed (N+1)-bit range. A signed N-bit field only holds [-2^(N-1), 2^(N-1)), so the check admits one extra bit of range on each side.
In particular, for check_imm19(), values in [2^18, 2^19) slip past the check but do not fit into the 19-bit signed imm19 field of B.cond. aarch64_insn_encode_immediate() then masks the raw value into the 19-bit field, setting bit 18 (the sign bit) and flipping a forward branch into a backward one. Same class of issue exists for check_imm26() and the B/BL encoding. Shift by (bits - 1) instead of bits so the actual signed N-bit range is enforced.
--- arch/arm64/net/bpf_jit_comp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/net/bpf_jit_comp.c +2 -2
@@ -33,8 +33,8 @@#define FP_BOTTOM (MAX_BPF_JIT_REG + 4)#define check_imm (bits, imm) do { \ - if ((((imm) > 0) && ((imm) >> (bits))) || \ - (((imm) < 0) && (~(imm) >> (bits)))) { \ + if ((((imm) > 0) && ((imm) >> ((bits) - 1))) || \ + (((imm) < 0) && (~(imm) >> ((bits) - 1)))) { \ pr_info("[%2d] imm=%d(0x%x) out of range\n", \ i, imm, imm); \ return -EINVAL; \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 619/969 bpf, sockmap: Fix af_unix iter deadlock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit 4d328dd695383224aa750ddee6b4ad40c0f8d205 ]
bpf_iter_unix_seq_show() may deadlock when lock_sock_fast() takes the fast path and the iter prog attempts to update a sockmap. Which ends up spinning at sock_map_update_elem()'s bh_lock_sock():
WARNING: possible recursive locking detected
test_progs/1393 is trying to acquire lock:ffff88811ec25f58 (slock-AF_UNIX){+...}-{3:3}, at: sock_map_update_elem+0xdb/0x1f0
but task is already holding lock:ffff88811ec25f58 (slock-AF_UNIX){+...}-{3:3}, at: __lock_sock_fast+0x37/0xe0
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
---- lock(slock-AF_UNIX);
lock(slock-AF_UNIX);
*** DEADLOCK ***
May be due to missing lock nesting notation
4 locks held by test_progs/1393:
#0: ffff88814b59c790 (&p->lock){+.+.}-{4:4}, at: bpf_seq_read+0x59/0x10d0 #1: ffff88811ec25fd8 (sk_lock-AF_UNIX){+.+.}-{0:0}, at: bpf_seq_read+0x42c/0x10d0 #2: ffff88811ec25f58 (slock-AF_UNIX){+...}-{3:3}, at: __lock_sock_fast+0x37/0xe0 #3: ffffffff85a6a7c0 (rcu_read_lock){....}-{1:3}, at: bpf_iter_run_prog+0x51d/0xb00
Call Trace: dump_stack_lvl+0x5d/0x80 print_deadlock_bug.cold+0xc0/0xce __lock_acquire+0x130f/0x2590 lock_acquire+0x14e/0x2b0 _raw_spin_lock+0x30/0x40 sock_map_update_elem+0xdb/0x1f0 bpf_prog_2d0075e5d9b721cd_dump_unix+0x55/0x4f4 bpf_iter_run_prog+0x5b9/0xb00 bpf_iter_unix_seq_show+0x1f7/0x2e0 bpf_seq_read+0x42c/0x10d0 vfs_read+0x171/0xb20 ksys_read+0xff/0x200 do_syscall_64+0x6b/0x3a0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/unix/af_unix.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/unix/af_unix.c +3 -4
@@ -3598,15 +3598,14 @@ static int bpf_iter_unix_seq_show(structstruct bpf_prog *prog;struct sock *sk = v;uid_t uid; -bool slow;int ret;if (v ==SEQ_START_TOKEN )return 0 ; - slow =lock_sock_fast (sk); +lock_sock (sk); -if (unlikely (sk_unhashed (sk))) { +if (unlikely (sock_flag (sk,SOCK_DEAD ))) { ret =SEQ_SKIP ; goto unlock; }
@@ -3616,7 +3615,7 @@ static int bpf_iter_unix_seq_show(struct prog =bpf_iter_get_info (&meta, false); ret =unix_prog_seq_show (prog, &meta, v, uid); unlock: -unlock_sock_fast (sk, slow); +release_sock (sk);return ret; }
Greg Kroah-Hartman
maintainerPATCH 620/969 bpf, sockmap: Fix af_unix null-ptr-deref in proto update
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit dca38b7734d2ea00af4818ff3ae836fab33d5d5a ]
unix_stream_connect() sets sk_state (WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED)) _before_ it assigns a peer (unix_peer(sk) = newsk). sk_state == TCP_ESTABLISHED makes sock_map_sk_state_allowed() believe that socket is properly set up, which would include having a defined peer. IOW, there's a window when unix_stream_bpf_update_proto() can be called on socket which still has unix_peer(sk) == NULL.
CPU0 bpf CPU1 connect
-------- ------------
WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED)sock_map_sk_state_allowed(sk)
...sk_pair = unix_peer(sk)sock_hold(sk_pair)
sock_hold(newsk) smp_mb__after_atomic() unix_peer(sk) = newsk
BUG: kernel NULL pointer dereference, address: 0000000000000080 RIP: 0010:unix_stream_bpf_update_proto+0xa0/0x1b0 Call Trace: sock_map_link+0x564/0x8b0 sock_map_update_common+0x6e/0x340 sock_map_update_elem_sys+0x17d/0x240 __sys_bpf+0x26db/0x3250 __x64_sys_bpf+0x21/0x30 do_syscall_64+0x6b/0x3a0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
Initial idea was to move peer assignment _before_ the sk_state update[1], but that involved an additional memory barrier, and changing the hot path was rejected.
Then a NULL check during proto update in unix_stream_bpf_update_proto() was considered[2], but the follow-up discussion[3] focused on the root cause, i.e. sockmap update taking a wrong lock. Or, more specifically, missing unix_state_lock()[4].
In the end it was concluded that teaching sockmap about the af_unix locking would be unnecessarily complex[5].
Complexity aside, since BPF_PROG_TYPE_SCHED_CLS and BPF_PROG_TYPE_SCHED_ACT are allowed to update sockmaps, sock_map_update_elem() taking the unix lock, as it is currently implemented in unix_state_lock():
spin_lock(&unix_sk(s)->lock), would be problematic. unix_state_lock() taken in a process context, followed by a softirq-context TC BPF program attempting to take the same spinlock -- deadlock[6].
This way we circled back to the peer check idea[2].
[1]: https://lore.kernel.org/netdev/[email protected]/
[2]: https://lore.kernel.org/netdev/[email protected]/
[3]: https://lore.kernel.org/netdev/[email protected]/
[4]: https://lore.kernel.org/netdev/CAAVpQUA+8GL_j63CaKb8hbxoL21izD58yr1NvhOhU=j+35+3og@mail.gmail.com/
[5]: https://lore.kernel.org/bpf/CAAVpQUAHijOMext28Gi10dSLuMzGYh+jK61Ujn+fZ-wvcODR2A@mail.gmail.com/
[6]: https://lore.kernel.org/bpf/[email protected]/
Summary of scenarios where af_unix/stream connect() may race a sockmap update:
1. connect() vs. bpf(BPF_MAP_UPDATE_ELEM), i.e. sock_map_update_elem_sys()
Implemented NULL check is sufficient. Once assigned, socket peer won't be released until socket fd is released. And that's not an issue because sock_map_update_elem_sys() bumps fd refcnf.
2. connect() vs BPF program doing update
Update restricted per verifier.c:may_update_sockmap() to
BPF_PROG_TYPE_TRACING/BPF_TRACE_ITER BPF_PROG_TYPE_SOCK_OPS (bpf_sock_map_update() only) BPF_PROG_TYPE_SOCKET_FILTER BPF_PROG_TYPE_SCHED_CLS BPF_PROG_TYPE_SCHED_ACT
BPF_PROG_TYPE_XDP BPF_PROG_TYPE_SK_REUSEPORT BPF_PROG_TYPE_FLOW_DISSECTOR BPF_PROG_TYPE_SK_LOOKUP
Plus one more race to consider:
CPU0 bpf CPU1 connect
-------- ------------
WRITE_ONCE(sk->sk_state, TCP_ESTABLISHED)
sock_map_sk_state_allowed(sk)
sock_hold(newsk)
smp_mb__after_atomic()
unix_peer(sk) = newsk
sk_pair = unix_peer(sk)
if (unlikely(!sk_pair))
return -EINVAL;
CPU1 close
----------
skpair = unix_peer(sk);
unix_peer(sk) = NULL;
sock_put(skpair) // use after free?
sock_hold(sk_pair)
2.1 BPF program invoking helper function bpf_sock_map_update() ->
BPF_CALL_4(bpf_sock_map_update(), ...)
Helper limited to BPF_PROG_TYPE_SOCK_OPS. Nevertheless, a unix sock might be accessible via bpf_map_lookup_elem(). Which implies sk already having psock, which in turn implies sk already having sk_pair. Since sk_psock_destroy() is queued as RCU work, sk_pair won't go away while BPF executes the update.
2.2 BPF program invoking helper function bpf_map_update_elem() ->
sock_map_update_elem()
2.2.1 Unix sock accessible to BPF prog only via sockmap lookup in
BPF_PROG_TYPE_SOCKET_FILTER, BPF_PROG_TYPE_SCHED_CLS,
BPF_PROG_TYPE_SCHED_ACT, BPF_PROG_TYPE_XDP,
BPF_PROG_TYPE_SK_REUSEPORT, BPF_PROG_TYPE_FLOW_DISSECTOR,
BPF_PROG_TYPE_SK_LOOKUP.
Pretty much the same as case 2.1.
2.2.2 Unix sock accessible to BPF program directly:
BPF_PROG_TYPE_TRACING, narrowed down to BPF_TRACE_ITER.
Sockmap iterator (sock_map_seq_ops) is safe: unix sock
residing in a sockmap means that the sock already went through
the proto update step.
Unix sock iterator (bpf_iter_unix_seq_ops), on the other hand,
gives access to socks that may still be unconnected. Which
means iterator prog can race sockmap/proto update against
connect().
BUG: KASAN: null-ptr-deref in unix_stream_bpf_update_proto+0x253/0x4d0
Write of size 4 at addr 0000000000000080 by task test_progs/3140
Call Trace:
dump_stack_lvl+0x5d/0x80
kasan_report+0xe4/0x1c0
kasan_check_range+0x125/0x200
unix_stream_bpf_update_proto+0x253/0x4d0
sock_map_link+0x71c/0xec0
sock_map_update_common+0xbc/0x600
sock_map_update_elem+0x19a/0x1f0
bpf_prog_bbbf56096cdd4f01_selective_dump_unix+0x20c/0x217
bpf_iter_run_prog+0x21e/0xae0
bpf_iter_unix_seq_show+0x1e0/0x2a0
bpf_seq_read+0x42c/0x10d0
vfs_read+0x171/0xb20
ksys_read+0xff/0x200
do_syscall_64+0xf7/0x5e0
entry_SYSCALL_64_after_hwframe+0x76/0x7e
While the introduced NULL check prevents null-ptr-deref in the
BPF program path as well, it is insufficient to guard against
a poorly timed close() leading to a use-after-free. This will
be addressed in a subsequent patch.--- net/unix/unix_bpf.c | 3 +++ 1 file changed, 3 insertions(+)
net/unix/unix_bpf.c +3 -0
@@ -184,6 +184,9 @@ int unix_stream_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool r*/ if (!psock->sk_pair) { sk_pair =unix_peer (sk); +if (unlikely (!sk_pair)) +return -EINVAL ; +sock_hold (sk_pair); psock->sk_pair = sk_pair; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 621/969 bpf, sockmap: Take state lock for af_unix iter
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Luczaj <[email protected]>
[ Upstream commit 64c2f93fc3254d3bf5de4445fb732ee5c451edb6 ]
When a BPF iterator program updates a sockmap, there is a race condition in unix_stream_bpf_update_proto() where the peer pointer can become stale[1] during a state transition TCP_ESTABLISHED -> TCP_CLOSE.
CPU0 bpf CPU1 close
-------- ----------
// unix_stream_bpf_update_proto()sk_pair = unix_peer(sk)
if (unlikely(!sk_pair))
return -EINVAL;
// unix_release_sock()
skpair = unix_peer(sk);
unix_peer(sk) = NULL;
sock_put(skpair)sock_hold(sk_pair) // UaF
More practically, this fix guarantees that the iterator program is consistently provided with a unix socket that remains stable during iterator execution.
[1]:
BUG: KASAN: slab-use-after-free in unix_stream_bpf_update_proto+0x155/0x490 Write of size 4 at addr ffff8881178c9a00 by task test_progs/2231 Call Trace: dump_stack_lvl+0x5d/0x80 print_report+0x170/0x4f3 kasan_report+0xe4/0x1c0 kasan_check_range+0x125/0x200 unix_stream_bpf_update_proto+0x155/0x490 sock_map_link+0x71c/0xec0 sock_map_update_common+0xbc/0x600 sock_map_update_elem+0x19a/0x1f0 bpf_prog_bbbf56096cdd4f01_selective_dump_unix+0x20c/0x217 bpf_iter_run_prog+0x21e/0xae0 bpf_iter_unix_seq_show+0x1e0/0x2a0 bpf_seq_read+0x42c/0x10d0 vfs_read+0x171/0xb20 ksys_read+0xff/0x200 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Allocated by task 2236: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 __kasan_slab_alloc+0x63/0x80 kmem_cache_alloc_noprof+0x1d5/0x680 sk_prot_alloc+0x59/0x210 sk_alloc+0x34/0x470 unix_create1+0x86/0x8a0 unix_stream_connect+0x318/0x15b0 __sys_connect+0xfd/0x130 __x64_sys_connect+0x72/0xd0 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 2236: kasan_save_stack+0x30/0x50 kasan_save_track+0x14/0x30 kasan_save_free_info+0x3b/0x70 __kasan_slab_free+0x47/0x70 kmem_cache_free+0x11c/0x590 __sk_destruct+0x432/0x6e0 unix_release_sock+0x9b3/0xf60 unix_release+0x8a/0xf0 __sock_release+0xb0/0x270 sock_close+0x18/0x20 __fput+0x36e/0xac0 fput_close_sync+0xe5/0x1a0 __x64_sys_close+0x7d/0xd0 do_syscall_64+0xf7/0x5e0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- net/unix/af_unix.c | 2 ++ 1 file changed, 2 insertions(+)
net/unix/af_unix.c +2 -0
@@ -3604,6 +3604,7 @@ static int bpf_iter_unix_seq_show(structreturn 0 ;lock_sock (sk); +unix_state_lock (sk);if (unlikely (sock_flag (sk,SOCK_DEAD ))) { ret =SEQ_SKIP ;
@@ -3615,6 +3616,7 @@ static int bpf_iter_unix_seq_show(struct prog =bpf_iter_get_info (&meta, false); ret =unix_prog_seq_show (prog, &meta, v, uid); unlock: +unix_state_unlock (sk);release_sock (sk);return ret; }
Greg Kroah-Hartman
maintainerPATCH 622/969 bpf: Fix precedence bug in convert_bpf_ld_abs alignment check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit e5f635edd393aeaa7cad9e42831d397e6e2e1eed ]
Fix an operator precedence issue in convert_bpf_ld_abs() where the expression offset + ip_align % size evaluates as offset + (ip_align % size) due to % having higher precedence than +. That latter evaluation does not make any sense. The intended check is (offset + ip_align) % size == 0 to verify that the packet load offset is properly aligned for direct access.
With NET_IP_ALIGN == 2, the bug causes the inline fast-path for direct packet loads to almost never be taken on !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS platforms. This forces nearly all cBPF BPF_LD_ABS packet loads through the bpf_skb_load_helper slow path on the affected archs.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -493,7 +493,7 @@ static bool convert_bpf_ld_abs(struct sock_filter *fp, struct bpf_insn **insnp) ((unaligned_ok && offset >= 0) || (!unaligned_ok && offset >= 0 && offset + ip_align >= 0 && - offset + ip_align % size == 0))) { + (offset + ip_align) % size == 0))) {bool ldx_off_ok = offset <=S16_MAX ; *insn++ =BPF_MOV64_REG (BPF_REG_TMP ,BPF_REG_H );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 623/969 bpf: allow UTF-8 literals in bpf_bprintf_prepare()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yihan Ding <[email protected]>
[ Upstream commit b960430ea8862ef37ce53c8bf74a8dc79d3f2404 ]
bpf_bprintf_prepare() only needs ASCII parsing for conversion specifiers. Plain text can safely carry bytes >= 0x80, so allow UTF-8 literals outside '%' sequences while keeping ASCII control bytes rejected and format specifiers ASCII-only.
This keeps existing parsing rules for format directives unchanged, while allowing helpers such as bpf_trace_printk() to emit UTF-8 literal text.
Update test_snprintf_negative() in the same commit so selftests keep matching the new plain-text vs format-specifier split during bisection.
--- kernel/bpf/helpers.c | 17 ++++++++++++++++- .../testing/selftests/bpf/prog_tests/snprintf.c | 3 ++- 2 files changed, 18 insertions(+), 2 deletions(-)
kernel/bpf/helpers.c +16 -1
@@ -840,7 +840,13 @@ int bpf_bprintf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args, data->buf = buffers->buf;for (i =0 ; i < fmt_size; i++) { -if ((!isprint (fmt[i]) && !isspace (fmt[i])) || !isascii (fmt[i])) { +unsigned char c = fmt[i]; + +/* +* Permit bytes >= 0x80 in plain text so UTF-8 literals can pass +* through unchanged, while still rejecting ASCII control bytes. +*/ +if (isascii (c) && !isprint (c) && !isspace (c)) { err = -EINVAL ; goto out; }
@@ -862,6 +868,15 @@ int bpf_bprintf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args,* always access fmt[i + 1], in the worst case it will be a 0 */ i++; + c = fmt[i]; +/* +* The format parser below only understands ASCII conversion +* specifiers and modifiers, so reject non-ASCII after '%'. +*/ +if (!isascii (c)) { + err = -EINVAL ; + goto out; + }/* skip optional "[0 +-][num]" width formatting field */ while (fmt[i] == '0' || fmt[i] == '+' || fmt[i] == '-' ||
tools/testing/selftests/bpf/prog_tests/snprintf.c +2 -1
@@ -114,7 +114,8 @@ static void test_snprintf_negative(void)ASSERT_ERR (load_single_snprintf ("%--------" ),"invalid specifier 5" );ASSERT_ERR (load_single_snprintf ("%lc" ),"invalid specifier 6" );ASSERT_ERR (load_single_snprintf ("%llc" ),"invalid specifier 7" ); -ASSERT_ERR (load_single_snprintf ("\x80" ),"non ascii character" ); +ASSERT_OK (load_single_snprintf ("\x80" ),"non ascii plain text" ); +ASSERT_ERR (load_single_snprintf ("%\x80" ),"non ascii in specifier" );ASSERT_ERR (load_single_snprintf ("\x1" ),"non printable character" ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 624/969 bpf, arm32: Reject BPF-to-BPF calls and callbacks in the JIT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit e1d486445af3c392628532229f7ce5f5cf7891b6 ]
The ARM32 BPF JIT does not support BPF-to-BPF function calls (BPF_PSEUDO_CALL) or callbacks (BPF_PSEUDO_FUNC), but it does not reject them either.
When a program with subprograms is loaded (e.g. libxdp's XDP dispatcher uses __noinline__ subprograms, or any program using callbacks like bpf_loop or bpf_for_each_map_elem), the verifier invokes bpf_jit_subprogs() which calls bpf_int_jit_compile() for each subprogram.
For BPF_PSEUDO_CALL, since ARM32 does not reject it, the JIT silently emits code using the wrong address computation:
func = __bpf_call_base + imm
where imm is a pc-relative subprogram offset, producing a bogus function pointer.
For BPF_PSEUDO_FUNC, the ldimm64 handler ignores src_reg and loads the immediate as a normal 64-bit value without error.
In both cases, build_body() reports success and a JIT image is allocated. ARM32 lacks the jit_data/extra_pass mechanism needed for the second JIT pass in bpf_jit_subprogs(). On the second pass, bpf_int_jit_compile() performs a full fresh compilation, allocating a new JIT binary and overwriting prog->bpf_func. The first allocation is never freed. bpf_jit_subprogs() then detects the function pointer changed and aborts with -ENOTSUPP, but the original JIT binary has already been leaked. Each program load/unload cycle leaks one JIT binary allocation, as reported by kmemleak:
unreferenced object 0xbf0a1000 (size 4096):
backtrace:
bpf_jit_binary_alloc+0x64/0xfc
bpf_int_jit_compile+0x14c/0x348
bpf_jit_subprogs+0x4fc/0xa60Fix this by rejecting both BPF_PSEUDO_CALL in the BPF_CALL handler and BPF_PSEUDO_FUNC in the BPF_LD_IMM64 handler, falling through to the existing 'notyet' path. This causes build_body() to fail before any JIT binary is allocated, so bpf_int_jit_compile() returns the original program unjitted. bpf_jit_subprogs() then sees !prog->jited and cleanly falls back to the interpreter with no leak.
--- arch/arm/net/bpf_jit_32.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/net/bpf_jit_32.c +6 -0
@@ -1594,6 +1594,9 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) {u64 val = (u32 )imm | (u64 )insn[1 ].imm <<32 ; +if (insn->src_reg ==BPF_PSEUDO_FUNC ) + goto notyet; +emit_a32_mov_i64 (dst, val, ctx);return 1 ;
@@ -1785,6 +1788,9 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)const s8 *r5 = bpf2a32[BPF_REG_5 ];const u32 func = (u32 )__bpf_call_base + (u32 )imm; +if (insn->src_reg ==BPF_PSEUDO_CALL ) + goto notyet; +emit_a32_mov_r64 (true, r0, r1, ctx);emit_a32_mov_r64 (true, r1, r2, ctx);emit_push_r64 (r5, ctx);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 625/969 pinctrl: pinctrl-pic32: Fix resource leak
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ethan Tidmore <[email protected]>
[ Upstream commit fe5560688f3ba98364c7de7b4f8dc240ffd1ff75 ]
Fix three possible resource leaks by using the devres version of clk_prepare_enable(). Also, update error message accordingly.
Detected by Smatch:drivers/pinctrl/pinctrl-pic32.c:2211 pic32_pinctrl_probe() warn:
'pctl->clk' from clk_prepare_enable() not released on lines: 2208.
drivers/pinctrl/pinctrl-pic32.c:2274 pic32_gpio_probe() warn:
'bank->clk' from clk_prepare_enable() not released on lines: 2264,2272.
--- drivers/pinctrl/pinctrl-pic32.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
drivers/pinctrl/pinctrl-pic32.c +4 -16
@@ -2162,16 +2162,10 @@ static int pic32_pinctrl_probe(struct platform_device *pdev)if (IS_ERR (pctl->reg_base))return PTR_ERR (pctl->reg_base); - pctl->clk =devm_clk_get (&pdev->dev,NULL ); + pctl->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (pctl->clk)) { ret =PTR_ERR (pctl->clk); -dev_err (&pdev->dev,"clk get failed\n" ); -return ret; - } - - ret =clk_prepare_enable (pctl->clk); -if (ret) { -dev_err (&pdev->dev,"clk enable failed\n" ); +dev_err (&pdev->dev,"Failed to get and enable clock\n" );return ret; }
@@ -2227,16 +2221,10 @@ static int pic32_gpio_probe(struct platform_device *pdev)if (irq <0 )return irq; - bank->clk =devm_clk_get (&pdev->dev,NULL ); + bank->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (bank->clk)) { ret =PTR_ERR (bank->clk); -dev_err (&pdev->dev,"clk get failed\n" ); -return ret; - } - - ret =clk_prepare_enable (bank->clk); -if (ret) { -dev_err (&pdev->dev,"clk enable failed\n" ); +dev_err (&pdev->dev,"Failed to get and enable clock\n" );return ret; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 626/969 pinctrl: cy8c95x0: remove duplicate error message
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 970dacb3b9f0fedbbbcfd7dbf1f4f22340b3f359 ]
The pin control core is covered to report any error via message. The devm_request_threaded_irq() already prints an error message. Remove the duplicates.
While at it, drop the info message as the same information about an IRQ in use can be retrieved differently.
Stable-dep-of: 5ad32c3607cf ("pinctrl: cy8c95x0: Avoid returning positive values to user space")
--- drivers/pinctrl/pinctrl-cy8c95x0.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +5 -16
@@ -1206,6 +1206,7 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq) {struct gpio_irq_chip *girq = &chip->gpio_chip.irq;DECLARE_BITMAP (pending_irqs,MAX_LINE ); +struct device *dev = chip->dev;int ret;mutex_init (&chip->irq_lock);
@@ -1232,17 +1233,9 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq) girq->handler = handle_simple_irq; girq->threaded = true; - ret =devm_request_threaded_irq (chip->dev, irq, -NULL , cy8c95x0_irq_handler, -IRQF_ONESHOT |IRQF_SHARED , -dev_name (chip->dev), chip); -if (ret) { -dev_err (chip->dev,"failed to request irq %d\n" , irq); -return ret; - } -dev_info (chip->dev,"Registered threaded IRQ\n" ); - -return 0 ; +return devm_request_threaded_irq (dev, irq,NULL , cy8c95x0_irq_handler, +IRQF_ONESHOT |IRQF_SHARED , +dev_name (chip->dev), chip); }static int cy8c95x0_setup_pinctrl (struct cy8c95x0_pinctrl *chip)
@@ -1258,11 +1251,7 @@ static int cy8c95x0_setup_pinctrl(struct cy8c95x0_pinctrl *chip) pd->owner =THIS_MODULE ; chip->pctldev =devm_pinctrl_register (chip->dev, pd, chip); -if (IS_ERR (chip->pctldev)) -return dev_err_probe (chip->dev,PTR_ERR (chip->pctldev), -"can't register controller\n" ); - -return 0 ; +return PTR_ERR_OR_ZERO (chip->pctldev); } static int cy8c95x0_detect(struct i2c_client *client,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 627/969 pinctrl: cy8c95x0: Unify messages with help of dev_err_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 014884732095b982412d13d3220c3fe8483b9b3e ]
Unify error messages that might appear during probe phase by switching to use dev_err_probe().
Stable-dep-of: 5ad32c3607cf ("pinctrl: cy8c95x0: Avoid returning positive values to user space")
--- drivers/pinctrl/pinctrl-cy8c95x0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +2 -4
@@ -1215,10 +1215,8 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq)/* Read IRQ status register to clear all pending interrupts */ ret =cy8c95x0_irq_pending (chip, pending_irqs); -if (ret) { -dev_err (chip->dev,"failed to clear irq status register\n" ); -return ret; - } +if (ret) +return dev_err_probe (dev, ret,"failed to clear irq status register\n" );/* Mask all interrupts */ bitmap_fill (chip->irq_mask,MAX_LINE );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 628/969 pinctrl: cy8c95x0: Avoid returning positive values to user space
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 5ad32c3607cf241a1a2680cabd64cbcd757227aa ]
When probe fails due to unclear interrupt status register, it returns a positive number instead of the proper error code. Fix this accordingly.
--- drivers/pinctrl/pinctrl-cy8c95x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-cy8c95x0.c +1 -1
@@ -1216,7 +1216,7 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq)/* Read IRQ status register to clear all pending interrupts */ ret =cy8c95x0_irq_pending (chip, pending_irqs);if (ret) -return dev_err_probe (dev, ret,"failed to clear irq status register\n" ); +return dev_err_probe (dev, -EBUSY ,"failed to clear irq status register\n" );/* Mask all interrupts */ bitmap_fill (chip->irq_mask,MAX_LINE );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 629/969 perf branch: Avoid incrementing NULL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit c969a9d7bbf46f983c4a48566b3b2f7340b02296 ]
If the entry is NULL the value is meaningless so early return NULL to avoid an increment of NULL. This was happening in calls from has_stitched_lbr when running the "perf record LBR tests". The return value isn't used in that case, so returning NULL as no effect.
--- tools/perf/util/branch.h | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/branch.h +3 -0
@@ -66,6 +66,9 @@ static inline struct branch_entry *perf_sample__branch_entries(struct perf_sampl {u64 *entry = (u64 *)sample->branch_stack; +if (entry ==NULL ) +return NULL ; + entry++;if (sample->no_hw_idx)return (struct branch_entry *)entry;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 630/969 perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Leach <[email protected]>
[ Upstream commit 6c478e7b3eba3f387a2d6c749e3e3ee0f8ad1c53 ]
Building perf with CORESIGHT=1 and the optional CSTRACE_RAW=1 enables additional debug printing of raw trace data when using command:- perf report --dump.
This raw trace prints the CoreSight formatted trace frames, which may be used to investigate suspected issues with trace quality / corruption / decode.
These frames are not present in ETE + TRBE trace. This fix removes the unnecessary call to print these frames.
This fix also rationalises implementation - original code had helper function that unnecessarily repeated initialisation calls that had already been made.
Due to an addtional fault with the OpenCSD library, this call when ETE/TRBE are being decoded will cause a segfault in perf. This fix also prevents that problem for perf using older (<= 1.8.0 version) OpenCSD libraries.
--- .../perf/util/cs-etm-decoder/cs-etm-decoder.c | 51 +++++-------------- 1 file changed, 13 insertions(+), 38 deletions(-)
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +13 -38
@@ -214,46 +214,24 @@ cs_etm_decoder__init_def_logger_printing(struct cs_etm_decoder_params *d_params, (void *)decoder, cs_etm_decoder__print_str_cb);if (ret !=0 ) - ret =-1 ; - -return 0 ; -} +return -1 ;#ifdef CS_LOG_RAW_FRAMES -static void -cs_etm_decoder__init_raw_frame_logging (struct cs_etm_decoder_params *d_params, -struct cs_etm_decoder *decoder) -{ -/* Only log these during a --dump operation */ -if (d_params->operation ==CS_ETM_OPERATION_PRINT ) { -/* set up a library default logger to process the -* raw frame printer we add later -*/ -ocsd_def_errlog_init (OCSD_ERR_SEV_ERROR ,1 ); - -/* no stdout / err / file output */ -ocsd_def_errlog_config_output (C_API_MSGLOGOUT_FLG_NONE ,NULL ); - -/* set the string CB for the default logger, -* passes strings to perf print logger. -*/ -ocsd_def_errlog_set_strprint_cb (decoder->dcd_tree, - (void *)decoder, - cs_etm_decoder__print_str_cb); - +/* +* Only log raw frames if --dump operation and hardware is actually +* generating formatted CoreSight trace frames +*/ +if ((d_params->operation ==CS_ETM_OPERATION_PRINT ) && + (d_params->formatted == true)) {/* use the built in library printer for the raw frames */ -ocsd_dt_set_raw_frame_printer (decoder->dcd_tree, -CS_RAW_DEBUG_FLAGS ); + ret =ocsd_dt_set_raw_frame_printer (decoder->dcd_tree, +CS_RAW_DEBUG_FLAGS ); +if (ret !=0 ) +return -1 ; } -} -#else -static void -cs_etm_decoder__init_raw_frame_logging ( -struct cs_etm_decoder_params *d_params__maybe_unused , -struct cs_etm_decoder *decoder__maybe_unused ) -{ -}#endif +return 0 ; +} static ocsd_datapath_resp_t cs_etm_decoder__do_soft_timestamp(struct cs_etm_queue *etmq,
@@ -716,9 +694,6 @@ cs_etm_decoder__new(int decoders, struct cs_etm_decoder_params *d_params,if (ret !=0 ) goto err_free_decoder; -/* init raw frame logging if required */ -cs_etm_decoder__init_raw_frame_logging (d_params, decoder); -for (i =0 ; i < decoders; i++) { ret = cs_etm_decoder__create_etm_decoder(d_params, &t_params[i],
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 631/969 pinctrl: abx500: Fix type of argument variable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu-Chun Lin <[email protected]>
[ Upstream commit 34006f77890d050e6d80cbee365b5d703c1140b4 ]
The argument variable is assigned the return value of pinconf_to_config_argument(), which returns a u32. Change its type from enum pin_config_param to unsigned int to correctly store the configuration argument.
--- drivers/pinctrl/nomadik/pinctrl-abx500.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/nomadik/pinctrl-abx500.c +1 -1
@@ -850,7 +850,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,int ret = -EINVAL ;int i;enum pin_config_param param; -enum pin_config_param argument; +unsigned int argument;for (i =0 ; i < num_configs; i++) { param =pinconf_to_config_param (configs[i]);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 632/969 perf expr: Return -EINVAL for syntax error in expr__find_ids()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leo Yan <[email protected]>
[ Upstream commit 3a61fd866ef9aaa1d3158b460f852b74a2df07f4 ]
expr__find_ids() propagates the parser return value directly. For syntax errors, the parser can return a positive value, but callers treat it as success, e.g., for below case on Arm64 platform:
metric expr 100 * (STALL_SLOT_BACKEND / (CPU_CYCLES * #slots) - BR_MIS_PRED * 3 / CPU_CYCLES) for backend_bound parsing metric: 100 * (STALL_SLOT_BACKEND / (CPU_CYCLES * #slots) - BR_MIS_PRED * 3 / CPU_CYCLES) Failure to read '#slots' literal: #slots = nan
syntax error
Convert positive parser returns in expr__find_ids() to -EINVAL, as a result, the error value will be respected by callers.
Before:
perf stat -C 5
Failure to read '#slots'Failure to read '#slots'Failure to read '#slots'Failure to read '#slots'Segmentation fault
After:
perf stat -C 5
Failure to read '#slots'Cannot find metric or group `Default'
--- tools/perf/util/expr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/expr.c +2 -1
@@ -380,7 +380,8 @@ int expr__find_ids(const char *expr, const char *one,if (one)expr__del_id (ctx, one); -return ret; +/* A positive value means syntax error, convert to -EINVAL */ +return ret >0 ? -EINVAL : ret; }double expr_id_data__value (const struct expr_id_data *data)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 633/969 perf util: Kill die() prototype, dead for a long time
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit e5cce1b9c82fbd48e2f1f7a25a9fad8ee228176f ]
In fef2a735167a827a ("perf tools: Kill die()") the die() function was removed, but not the prototype in util.h, now when building with LIBPERL=1, during a 'make -C tools/perf build-test' routine test, it is failing as perl likes die() calls and then this clashes with this remnant, remove it.
--- tools/perf/util/util.h | 1 - 1 file changed, 1 deletion(-)
tools/perf/util/util.h +0 -1
@@ -17,7 +17,6 @@/* General helper functions */ void usage (const char *err)__noreturn ; -void die(const char *err, ...) __noreturn __printf(1, 2);struct dirent ;struct strlist ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 634/969 i3c: mipi-i3c-hci: fix IBI payload length calculation for final status
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Billy Tsai <[email protected]>
[ Upstream commit d35a6db887eeae7c57b719521e39d64f929c6dc3 ]
In DMA mode, the IBI status descriptor encodes the payload using CHUNKS (number of chunks) and DATA_LENGTH (valid bytes in the last chunk). All preceding chunks are implicitly full-sized.
The current code accumulates full chunk sizes for non-final status descriptors, but for the final status descriptor it only adds DATA_LENGTH. This ignores the contribution of the preceding full chunks described by the same final status entry.
As a result, the computed IBI payload length is truncated whenever the final status spans multiple chunks. For example, with a chunk size of 4 bytes, CHUNKS=2 and DATA_LENGTH=1 should result in a total payload size of 5 bytes, but the current code reports only 1 byte.
Fix the calculation by adding the size of (CHUNKS - 1) full chunks plus DATA_LENGTH for the last chunk.
--- drivers/i3c/master/mipi-i3c-hci/dma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i3c/master/mipi-i3c-hci/dma.c +4 -1
@@ -636,7 +636,10 @@ static void hci_dma_process_ibi(struct i3c_hci *hci, struct hci_rh_data *rh)if (!(ibi_status &IBI_LAST_STATUS )) { ibi_size += chunks * rh->ibi_chunk_sz; }else { - ibi_size +=FIELD_GET (IBI_DATA_LENGTH , ibi_status); +if (chunks) { + ibi_size += (chunks -1 ) * rh->ibi_chunk_sz; + ibi_size +=FIELD_GET (IBI_DATA_LENGTH , ibi_status); + } last_ptr = ptr;break ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 635/969 driver core: device.h: remove extern from function prototypes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit f43243c66e5e9ad839d235f82a58e73a7e7612af ]
The kernel coding style does not require 'extern' in function prototypes in .h files, so remove them from include/linux/device.h as they are not needed.
Stable-dep-of: 797cc011ae02 ("backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt()")
--- include/linux/device.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/device.h +1 -2
@@ -1149,8 +1149,7 @@ void device_links_supplier_sync_state_pause(void);void device_links_supplier_sync_state_resume (void );void device_link_wait_removal (void ); -extern __printf(3, 4) -int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); +__printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);/* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV (major,minor) \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 636/969 driver core: Move dev_err_probe() to where it belogs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 9e0cace7a6254070159ebd86497eadc29ea307ca ]
dev_err_probe() belongs to the printing API, hence move the definition from device.h to dev_printk.h.
There is no change to the callers at all, since:
1) implementation is located in the same core.c;
2) dev_printk.h is guaranteed to be included by device.h.
Stable-dep-of: 797cc011ae02 ("backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt()")
--- include/linux/dev_printk.h | 2 ++ include/linux/device.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/dev_printk.h +2 -0
@@ -275,4 +275,6 @@ do { \ WARN_ONCE(condition, "%s %s: " format, \ dev_driver_string(dev), dev_name(dev), ## arg) +__printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); +#endif /* _DEVICE_PRINTK_H_ */
include/linux/device.h +0 -2
@@ -1149,8 +1149,6 @@ void device_links_supplier_sync_state_pause(void);void device_links_supplier_sync_state_resume (void );void device_link_wait_removal (void ); -__printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); -/* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV (major,minor) \ MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 637/969 dev_printk: add new dev_err_probe() helpers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nuno Sa <[email protected]>
[ Upstream commit dbbe7eaf0e4795bf003ac06872aaf52b6b6b1310 ]
This is similar to dev_err_probe() but for cases where an ERR_PTR() or ERR_CAST() is to be returned simplifying patterns like:
dev_err_probe(dev, ret, ...); return ERR_PTR(ret) or dev_err_probe(dev, PTR_ERR(ptr), ...); return ERR_CAST(ptr)
Stable-dep-of: 797cc011ae02 ("backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt()")
--- include/linux/dev_printk.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/dev_printk.h +8 -0
@@ -277,4 +277,12 @@ do { \ __printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); +/* Simple helper for dev_err_probe() when ERR_PTR() is to be returned. */ +#define dev_err_ptr_probe (dev, ___err, fmt, ...) \ + ERR_PTR(dev_err_probe(dev, ___err, fmt, ##__VA_ARGS__)) + +/* Simple helper for dev_err_probe() when ERR_CAST() is to be returned. */ +#define dev_err_cast_probe (dev, ___err_ptr, fmt, ...) \ + ERR_PTR(dev_err_probe(dev, PTR_ERR(___err_ptr), fmt, ##__VA_ARGS__)) +#endif /* _DEVICE_PRINTK_H_ */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 638/969 backlight: sky81452-backlight: Check return value of devm_gpiod_get_optional() in sky81452_bl_parse_dt()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 797cc011ae02bda26f93d25a4442d7a1a77d84df ]
The devm_gpiod_get_optional() function may return an ERR_PTR in case of genuine GPIO acquisition errors, not just NULL which indicates the legitimate absence of an optional GPIO.
Add an IS_ERR() check after the call in sky81452_bl_parse_dt(). On error, return the error code to ensure proper failure handling rather than proceeding with invalid pointers.
--- drivers/video/backlight/sky81452-backlight.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/backlight/sky81452-backlight.c +3 -0
@@ -204,6 +204,9 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( pdata->dpwm_mode =of_property_read_bool (np,"skyworks,dpwm-mode" ); pdata->phase_shift =of_property_read_bool (np,"skyworks,phase-shift" ); pdata->gpiod_enable =devm_gpiod_get_optional (dev,NULL ,GPIOD_OUT_HIGH ); +if (IS_ERR (pdata->gpiod_enable)) +return dev_err_cast_probe (dev, pdata->gpiod_enable, +"failed to get gpio\n" ); ret =of_property_count_u32_elems (np,"led-sources" );if (ret <0 ) {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 639/969 platform/surface: surfacepro3_button: Drop wakeup source on remove
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 1410a228ab2d36fe2b383415a632ae12048d4f3a ]
The wakeup source added by device_init_wakeup() in surface_button_add() needs to be dropped during driver removal, so update the driver to do that.
--- drivers/platform/surface/surfacepro3_button.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/surface/surfacepro3_button.c +1 -0
@@ -243,6 +243,7 @@ static int surface_button_remove(struct acpi_device *device) {struct surface_button *button =acpi_driver_data (device); +device_init_wakeup (&device->dev, false);input_unregister_device (button->input);kfree (button);return 0 ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 640/969 leds: lgm-sso: Remove duplicate assignments for priv->mmap
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 7186d0330c3f3e86de577687a82f4ebd96dcb5ac ]
Remove duplicate assignment of priv->mmap in intel_sso_led_probe().
--- drivers/leds/blink/leds-lgm-sso.c | 2 -- 1 file changed, 2 deletions(-)
drivers/leds/blink/leds-lgm-sso.c +0 -2
@@ -807,8 +807,6 @@ static int intel_sso_led_probe(struct platform_device *pdev) priv->fpid_clkrate =clk_get_rate (priv->clocks[1 ].clk); - priv->mmap =syscon_node_to_regmap (dev->of_node); - priv->mmap =syscon_node_to_regmap (dev->of_node);if (IS_ERR (priv->mmap)) {dev_err (dev,"Failed to map iomem!\n" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 641/969 tty: hvc_iucv: fix off-by-one in number of supported devices
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit f2a880e802ad12d1e38039d1334fb1475d0f5241 ]
MAX_HVC_IUCV_LINES == HVC_ALLOC_TTY_ADAPTERS == 8.
This is the number of entries in:
static struct hvc_iucv_private *hvc_iucv_table[MAX_HVC_IUCV_LINES];
Sometimes hvc_iucv_table[] is limited by:
(a) if (num > hvc_iucv_devices) // for error detection
or
(b) for (i = 0; i < hvc_iucv_devices; i++) // in 2 places
(so these 2 don't agree; second one appears to be correct to me.)
hvc_iucv_devices can be 0..8. This is a counter.
(c) if (hvc_iucv_devices > MAX_HVC_IUCV_LINES)
If hvc_iucv_devices == 8, (a) allows the code to access hvc_iucv_table[8]. Oops.
--- drivers/tty/hvc/hvc_iucv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/hvc/hvc_iucv.c +1 -1
@@ -130,7 +130,7 @@ static struct iucv_handler hvc_iucv_handler = {*/ static struct hvc_iucv_private *hvc_iucv_get_private (uint32_t num) { -if (num > hvc_iucv_devices) +if (num >= hvc_iucv_devices)return NULL ;return hvc_iucv_table[num]; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 642/969 platform/x86: panasonic-laptop: Fix OPTD notifier registration and cleanup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
[ Upstream commit 8baeff2c1d33dad8572216c6ad3a7425852507d4 ]
An ACPI notify handler is leaked if device_create_file() returns an error in acpi_pcc_hotkey_add().
Also, it is pointless to call pcc_unregister_optd_notifier() in acpi_pcc_hotkey_remove() if pcc->platform is NULL and it is better to arrange the cleanup code in that function in the same order as the rollback code in acpi_pcc_hotkey_add().
Address the above by placing the pcc_register_optd_notifier() call in acpi_pcc_hotkey_add() after the device_create_file() return value check and placing the pcc_unregister_optd_notifier() call in acpi_pcc_hotkey_remove() right before the device_remove_file() call.
--- drivers/platform/x86/panasonic-laptop.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/panasonic-laptop.c +3 -2
@@ -1081,9 +1081,10 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) } result =device_create_file (&pcc->platform->dev, &dev_attr_cdpower); -pcc_register_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" );if (result) goto out_platform; + +pcc_register_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" ); }else { pcc->platform =NULL ; }
@@ -1117,10 +1118,10 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device)i8042_remove_filter (panasonic_i8042_filter);if (pcc->platform) { +pcc_unregister_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" );device_remove_file (&pcc->platform->dev, &dev_attr_cdpower);platform_device_unregister (pcc->platform); } -pcc_unregister_optd_notifier (pcc,"\\_SB.PCI0.EHCI.ERHB.OPTD" );sysfs_remove_group (&device->dev.kobj, &pcc_attr_group);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 643/969 mfd: mc13xxx-core: Fix memory leak in mc13xxx_add_subdevice_pdata()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdun Nihaal <[email protected]>
[ Upstream commit a5a65a7fb2f7796bbe492cd6be59c92cb64377d1 ]
The memory allocated for cell.name using kmemdup() is not freed when mfd_add_devices() fails. Fix that by using devm_kmemdup().
--- drivers/mfd/mc13xxx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +1 -1
@@ -377,7 +377,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,if (snprintf (buf,sizeof (buf), format, name) >sizeof (buf))return -E2BIG ; - cell.name =kmemdup (buf,strlen (buf) +1 ,GFP_KERNEL ); + cell.name =devm_kmemdup (mc13xxx->dev, buf,strlen (buf) +1 ,GFP_KERNEL );if (!cell.name)return -ENOMEM ;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 644/969 nfs/blocklayout: Fix compilation error (`make W=1`) in bl_write_pagelist()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit f83c8dda456ce4863f346aa26d88efa276eda35d ]
Clang compiler is not happy about set but unused variable (when dprintk() is no-op):
.../blocklayout/blocklayout.c:384:9: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
Remove a leftover from the previous cleanup.
--- fs/nfs/blocklayout/blocklayout.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/nfs/blocklayout/blocklayout.c +1 -3
@@ -381,14 +381,13 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync)sector_t isect, extent_length =0 ;struct parallel_io *par =NULL ;loff_t offset = header->args.offset; -size_t count = header->args.count;struct page **pages = header->args.pages;int pg_index = header->args.pgbase >>PAGE_SHIFT ;unsigned int pg_len;struct blk_plug plug;int i; -dprintk ("%s enter, %zu@%lld\n" , __func__, count, offset); +dprintk ("%s enter, %u@%lld\n" , __func__, header->args.count, offset);/* At this point, header->page_aray is a (sequential) list of nfs_pages. * We want to write each, and if there is an error set pnfs_error
@@ -429,7 +428,6 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync) } offset += pg_len; - count -= pg_len; isect += (pg_len >>SECTOR_SHIFT ); extent_length -= (pg_len >>SECTOR_SHIFT ); }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 645/969 fs/ntfs3: terminate the cached volume label after UTF-8 conversion
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit a6cd43fe9b083fa23fe1595666d5738856cb261a ]
ntfs_fill_super() loads the on-disk volume label with utf16s_to_utf8s() and stores the result in sbi->volume.label. The converted label is later exposed through ntfs3_label_show() using %s, but utf16s_to_utf8s() only returns the number of bytes written and does not add a trailing NUL.
If the converted label fills the entire fixed buffer, ntfs3_label_show() can read past the end of sbi->volume.label while looking for a terminator.
Terminate the cached label explicitly after a successful conversion and clamp the exact-full case to the last byte of the buffer.
--- fs/ntfs3/super.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ntfs3/super.c +6 -1
@@ -992,8 +992,13 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)le32_to_cpu (attr->res.data_size) >>1 ,UTF16_LITTLE_ENDIAN , sbi->volume.label, sizeof(sbi->volume.label)); -if (err <0 ) +if (err <0 ) { sbi->volume.label[0 ] =0 ; + }else if (err >=sizeof (sbi->volume.label)) { + sbi->volume.label[sizeof (sbi->volume.label) -1 ] =0 ; + }else { + sbi->volume.label[err] =0 ; + } }else {/* Should we break mounting here? */ //err = -EINVAL;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 646/969 platform/x86: dell_rbu: avoid uninit value usage in packet_size_write()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit f8fd138c2363c0e2d3235c32bfb4fb5c6474e4ae ]
Ensure the temp value has been properly parsed from the user-provided buffer and initialized to be used in later operations. While at it, prefer a convenient kstrtoul() helper.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.
--- drivers/platform/x86/dell/dell_rbu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/dell/dell_rbu.c +5 -1
@@ -30,6 +30,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/init.h> +#include <linux/kstrtox.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/string.h>
@@ -617,9 +618,12 @@ static ssize_t packet_size_write(struct file *filp, struct kobject *kobj, char *buffer, loff_t pos, size_t count) { unsigned long temp; + +if (kstrtoul (buffer,10 , &temp)) +return -EINVAL ; +spin_lock (&rbu_data.lock);packet_empty_list (); -sscanf (buffer,"%lu" , &temp);if (temp <0xffffffff ) rbu_data.packetsize = temp;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 647/969 platform/x86: dell-wmi-sysman: bound enumeration string aggregation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pengpeng Hou <[email protected]>
[ Upstream commit 3c34471c26abc52a37f5ad90949e2e4b8027eb14 ]
populate_enum_data() aggregates firmware-provided value-modifier and possible-value strings into fixed 512-byte struct members. The current code bounds each individual source string but then appends every string and separator with raw strcat() and no remaining-space check.
Switch the aggregation loops to a bounded append helper and reject enumeration packages whose combined strings do not fit in the destination buffers.
--- .../dell/dell-wmi-sysman/enum-attributes.c | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c +28 -6
@@ -6,10 +6,32 @@* Copyright (c) 2020 Dell Inc. */ +#include <linux/bug.h> +#include "dell-wmi-sysman.h" get_instance_id (enumeration); +static int append_enum_string (char *dest,const char *src) +{ +size_t dest_len =strlen (dest); +ssize_t copied; + +if (WARN_ON_ONCE (dest_len >=MAX_BUFF )) +return -EINVAL ; + + copied =strscpy (dest + dest_len, src,MAX_BUFF - dest_len); +if (copied <0 ) +return -EINVAL ; + + dest_len += copied; + copied =strscpy (dest + dest_len,";" ,MAX_BUFF - dest_len); +if (copied <0 ) +return -EINVAL ; + +return 0 ; +} +static ssize_t current_value_show (struct kobject *kobj,struct kobj_attribute *attr,char *buf) {int instance_id =get_enumeration_instance_id (kobj);
@@ -176,9 +198,9 @@ int populate_enum_data(union acpi_object *enumeration_obj, int instance_id,return -EINVAL ;if (check_property_type (enumeration, next_obj,ACPI_TYPE_STRING ))return -EINVAL ; -strcat (wmi_priv.enumeration_data[instance_id].dell_value_modifier, - enumeration_obj[next_obj++].string.pointer); -strcat (wmi_priv.enumeration_data[instance_id].dell_value_modifier,";" ); +if (append_enum_string (wmi_priv.enumeration_data[instance_id].dell_value_modifier, + enumeration_obj[next_obj++].string.pointer)) +return -EINVAL ; }if (next_obj >= enum_property_count)
@@ -193,9 +215,9 @@ int populate_enum_data(union acpi_object *enumeration_obj, int instance_id,return -EINVAL ;if (check_property_type (enumeration, next_obj,ACPI_TYPE_STRING ))return -EINVAL ; -strcat (wmi_priv.enumeration_data[instance_id].possible_values, - enumeration_obj[next_obj++].string.pointer); -strcat (wmi_priv.enumeration_data[instance_id].possible_values,";" ); +if (append_enum_string (wmi_priv.enumeration_data[instance_id].possible_values, + enumeration_obj[next_obj++].string.pointer)) +return -EINVAL ; }return sysfs_create_group (attr_name_kobj, &enumeration_attr_group);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 648/969 RDMA/core: Prefer NLA_NUL_STRING
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 6ed3d14fc45d3da6025e7fe4a6a09066856698e2 ]
These attributes are evaluated as c-string (passed to strcmp), but NLA_STRING doesn't check for the presence of a \0 terminator.
Either this needs to switch to nla_strcmp() and needs to adjust printf fmt specifier to not use plain %s, or this needs to use NLA_NUL_STRING.
As the code has been this way for long time, it seems to me that userspace does include the terminating nul, even tough its not enforced so far, and thus NLA_NUL_STRING use is the simpler solution.
--- drivers/infiniband/core/iwpm_msg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/core/iwpm_msg.c +3 -3
@@ -365,9 +365,9 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)/* netlink attribute policy for the received response to register pid request */ static const struct nla_policy resp_reg_policy[IWPM_NLA_RREG_PID_MAX ] = { [IWPM_NLA_RREG_PID_SEQ ] = { .type =NLA_U32 }, - [IWPM_NLA_RREG_IBDEV_NAME ] = { .type =NLA_STRING , + [IWPM_NLA_RREG_IBDEV_NAME ] = { .type =NLA_NUL_STRING , .len =IWPM_DEVNAME_SIZE -1 }, - [IWPM_NLA_RREG_ULIB_NAME ] = { .type =NLA_STRING , + [IWPM_NLA_RREG_ULIB_NAME ] = { .type =NLA_NUL_STRING , .len =IWPM_ULIBNAME_SIZE -1 }, [IWPM_NLA_RREG_ULIB_VER ] = { .type =NLA_U16 }, [IWPM_NLA_RREG_PID_ERR ] = { .type =NLA_U16 }
@@ -677,7 +677,7 @@ int iwpm_remote_info_cb(struct sk_buff *skb, struct netlink_callback *cb)/* netlink attribute policy for the received request for mapping info */ static const struct nla_policy resp_mapinfo_policy[IWPM_NLA_MAPINFO_REQ_MAX ] = { - [IWPM_NLA_MAPINFO_ULIB_NAME ] = { .type =NLA_STRING , + [IWPM_NLA_MAPINFO_ULIB_NAME ] = { .type =NLA_NUL_STRING , .len =IWPM_ULIBNAME_SIZE -1 }, [IWPM_NLA_MAPINFO_ULIB_VER ] = { .type =NLA_U16 } };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 649/969 clk: qcom: dispcc-sm8450: use RCG2 ops for DPTX1 AUX clock source
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 141af1be817c42c7f1e1605348d4b1983d319bea ]
The clk_dp_ops are supposed to be used for DP-related clocks with a proper MND divier. Use standard RCG2 ops for dptx1_aux_clk_src, the same as all other DPTX AUX clocks in this driver.
--- drivers/clk/qcom/dispcc-sm8450.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-sm8450.c +1 -1
@@ -364,7 +364,7 @@ static struct clk_rcg2 disp_cc_mdss_dptx1_aux_clk_src = { .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_dp_ops, + .ops = &clk_rcg2_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 650/969 scsi: sg: Resolve soft lockup issue when opening /dev/sgX
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
[ Upstream commit d06a310b45e153872033dd0cf19d5a2279121099 ]
The parameter def_reserved_size defines the default buffer size reserved for each Sg_fd and should be restricted to a range between 0 and 1,048,576 (see https://tldp.org/HOWTO/SCSI-Generic-HOWTO/proc.html). Although the function sg_proc_write_dressz enforces this limit, it is possible to bypass it by directly modifying the module parameter as shown below, which then causes a soft lockup:
echo -1 > /sys/module/sg/parameters/def_reserved_size exec 4<> /dev/sg0
watchdog: BUG: soft lockup - CPU#5 stuck for 26 seconds! [bash:537] Modules loaded: CPU: 5 UID: 0 PID: 537 Command: bash, kernel version 6.19.0-rc3+ #134,
PREEMPT disabled
Hardware: QEMU Standard PC (i440FX + PIIX, 1996), BIOS version 1.16.1-2.fc37 dated 04/01/2014
...
Call Trace: sg_build_reserve+0x5c/0xa0 sg_add_sfp+0x168/0x270 sg_open+0x16e/0x340 chrdev_open+0xbe/0x230 do_dentry_open+0x175/0x480 vfs_open+0x34/0xf0 do_open+0x265/0x3d0 path_openat+0x110/0x290 do_filp_open+0xc3/0x170 do_sys_openat2+0x71/0xe0 __x64_sys_openat+0x6d/0xa0 do_syscall_64+0x62/0x310 entry_SYSCALL_64_after_hwframe+0x76/0x7e
The fix is to use module_param_cb to validate and reject invalid values assigned to def_reserved_size.
--- drivers/scsi/sg.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/scsi/sg.c +27 -2
@@ -1614,10 +1614,35 @@ sg_remove_device(struct device *cl_dev, struct class_interface *cl_intf) }module_param_named (scatter_elem_sz, scatter_elem_sz, int,S_IRUGO |S_IWUSR ); -module_param_named (def_reserved_size, def_reserved_size, int, -S_IRUGO |S_IWUSR );module_param_named (allow_dio, sg_allow_dio, int,S_IRUGO |S_IWUSR ); +static int def_reserved_size_set (const char *val,const struct kernel_param *kp) +{ +int size, ret; + +if (!val) +return -EINVAL ; + + ret =kstrtoint (val,0 , &size); +if (ret) +return ret; + +/* limit to 1 MB */ +if (size <0 || size >1048576 ) +return -ERANGE ; + + def_reserved_size = size; +return 0 ; +} + +static const struct kernel_param_ops def_reserved_size_ops = { + .set = def_reserved_size_set, + .get = param_get_int, +}; + +module_param_cb (def_reserved_size, &def_reserved_size_ops, &def_reserved_size, +S_IRUGO |S_IWUSR ); +MODULE_AUTHOR ("Douglas Gilbert" );MODULE_DESCRIPTION ("SCSI generic (sg) driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 651/969 scsi: target: core: Fix integer overflow in UNMAP bounds check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junrui Luo <[email protected]>
[ Upstream commit 2bf2d65f76697820dbc4227d13866293576dd90a ]
sbc_execute_unmap() checks LBA + range does not exceed the device capacity, but does not guard against LBA + range wrapping around on 64-bit overflow.
Add an overflow check matching the pattern already used for WRITE_SAME in the same file.
--- drivers/target/target_core_sbc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/target/target_core_sbc.c +2 -1
@@ -1133,7 +1133,8 @@ sbc_execute_unmap(struct se_cmd *cmd) goto err; } -if (lba + range > dev->transport->get_blocks (dev) +1 ) { +if (lba + range < lba || + lba + range > dev->transport->get_blocks (dev) +1 ) { ret =TCM_ADDRESS_OUT_OF_RANGE ; goto err; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 652/969 dt-bindings: clock: qcom,gcc-sc8180x: Add missing GDSCs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 76404ffbf07f28a5ec04748e18fce3dac2e78ef6 ]
There are 5 more GDSCs that we were ignoring and not putting to sleep, which are listed in downstream DTS. Add them.
Stable-dep-of: 3565741eb985 ("clk: qcom: gcc-sc8180x: Add missing GDSCs")
--- include/dt-bindings/clock/qcom,gcc-sc8180x.h | 5 +++++ 1 file changed, 5 insertions(+)
include/dt-bindings/clock/qcom,gcc-sc8180x.h +5 -0
@@ -308,5 +308,10 @@#define USB30_MP_GDSC 8#define USB30_PRIM_GDSC 9#define USB30_SEC_GDSC 10 +#define HLOS1_VOTE_MMNOC_MMU_TBU_HF0_GDSC 11 +#define HLOS1_VOTE_MMNOC_MMU_TBU_HF1_GDSC 12 +#define HLOS1_VOTE_MMNOC_MMU_TBU_SF_GDSC 13 +#define HLOS1_VOTE_TURING_MMU_TBU0_GDSC 14 +#define HLOS1_VOTE_TURING_MMU_TBU1_GDSC 15#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 653/969 clk: qcom: gcc-sc8180x: Add missing GDSCs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 3565741eb985a8a7cc6656eb33496195468cb99e ]
There are 5 more GDSCs that we were ignoring and not putting to sleep, which are listed in downstream DTS. Add them.
--- drivers/clk/qcom/gcc-sc8180x.c | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
drivers/clk/qcom/gcc-sc8180x.c +50 -0
@@ -4200,6 +4200,51 @@ static struct gdsc usb30_mp_gdsc = { .flags = POLL_CFG_GDSCR, }; +static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = { + .gdscr =0x7d050 , + .pd = { + .name ="hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = { + .gdscr =0x7d058 , + .pd = { + .name ="hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = { + .gdscr =0x7d054 , + .pd = { + .name ="hlos1_vote_mmnoc_mmu_tbu_sf_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_turing_mmu_tbu0_gdsc = { + .gdscr =0x7d05c , + .pd = { + .name ="hlos1_vote_turing_mmu_tbu0_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; + +static struct gdsc hlos1_vote_turing_mmu_tbu1_gdsc = { + .gdscr =0x7d060 , + .pd = { + .name ="hlos1_vote_turing_mmu_tbu1_gdsc" , + }, + .pwrsts =PWRSTS_OFF_ON , + .flags =VOTABLE , +}; +static struct clk_regmap *gcc_sc8180x_clocks[] = { [GCC_AGGRE_NOC_PCIE_TBU_CLK ] = &gcc_aggre_noc_pcie_tbu_clk.clkr, [GCC_AGGRE_UFS_CARD_AXI_CLK ] = &gcc_aggre_ufs_card_axi_clk.clkr,
@@ -4500,6 +4545,11 @@ static struct gdsc *gcc_sc8180x_gdscs[] = { [USB30_MP_GDSC] = &usb30_mp_gdsc, [USB30_PRIM_GDSC] = &usb30_prim_gdsc, [USB30_SEC_GDSC] = &usb30_sec_gdsc, + [HLOS1_VOTE_MMNOC_MMU_TBU_HF0_GDSC] = &hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc, + [HLOS1_VOTE_MMNOC_MMU_TBU_HF1_GDSC] = &hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc, + [HLOS1_VOTE_MMNOC_MMU_TBU_SF_GDSC] = &hlos1_vote_mmnoc_mmu_tbu_sf_gdsc, + [HLOS1_VOTE_TURING_MMU_TBU0_GDSC] = &hlos1_vote_turing_mmu_tbu0_gdsc, + [HLOS1_VOTE_TURING_MMU_TBU1_GDSC] = &hlos1_vote_turing_mmu_tbu1_gdsc, };static const struct regmap_config gcc_sc8180x_regmap_config = {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 654/969 clk: qcom: gcc-sc8180x: Use retention for USB power domains
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 25bc96f26cd6c19dde13a0b9859183e531d6fbfc ]
The USB subsystem does not expect to lose its state on suspend:
xhci-hcd xhci-hcd.0.auto: xHC error in resume, USBSTS 0x401, Reinit usb usb1: root hub lost power or was reset
(The reinitialization usually succeeds, but it does slow down resume.)
To maintain state during suspend, the relevant GDSCs need to stay in retention mode, like they do on other similar SoCs. Change the mode to PWRSTS_RET_ON to fix.
--- drivers/clk/qcom/gcc-sc8180x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/qcom/gcc-sc8180x.c +3 -3
@@ -4106,7 +4106,7 @@ static struct gdsc usb30_sec_gdsc = { .pd = { .name = "usb30_sec_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4124,7 +4124,7 @@ static struct gdsc usb30_prim_gdsc = { .pd = { .name = "usb30_prim_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4196,7 +4196,7 @@ static struct gdsc usb30_mp_gdsc = { .pd = { .name = "usb30_mp_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 655/969 clk: qcom: gcc-sc8180x: Use retention for PCIe power domains
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit ccb92c78b42edd26225b4d5920847dfee3e1b093 ]
As the PCIe host controller driver does not yet support dealing with the loss of state during suspend, use retention for relevant GDSCs.
This fixes the link not surviving upon resume:
nvme 0002:01:00.0: Unable to change power state from D3cold to D0, device inaccessible nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS read failed (134) nvme 0002:01:00.0: Unable to change power state from D3cold to D0, device inaccessible nvme nvme0: Disabling device after reset failure: -19
--- drivers/clk/qcom/gcc-sc8180x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/qcom/gcc-sc8180x.c +4 -4
@@ -4133,7 +4133,7 @@ static struct gdsc pcie_0_gdsc = { .pd = { .name = "pcie_0_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4160,7 +4160,7 @@ static struct gdsc pcie_1_gdsc = { .pd = { .name = "pcie_1_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4169,7 +4169,7 @@ static struct gdsc pcie_2_gdsc = { .pd = { .name = "pcie_2_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
@@ -4187,7 +4187,7 @@ static struct gdsc pcie_3_gdsc = { .pd = { .name = "pcie_3_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 656/969 clk: qcom: dispcc-sm8250: Use shared ops on the mdss vsync clk
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit 8c522da70f0c2e5148c4c13ccb1c64cca57a6fdb ]
mdss_gdsc can get stuck on boot due to RCGs being left on from last boot. As a fix, commit 01a0a6cc8cfd ("clk: qcom: Park shared RCGs upon registration") introduced a callback to ensure the RCG is off upon init. However, the fix depends on all shared RCGs being marked as such in code.
For SM8150/SC8180X/SM8250 the MDSS vsync clock was using regular ops, unlike the same clock in the SC7180 code. This was causing display to frequently fail to initialize after rebooting on the Surface Pro X. Fix by using shared ops for this clock.
--- drivers/clk/qcom/dispcc-sm8250.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/dispcc-sm8250.c +1 -1
@@ -618,7 +618,7 @@ static struct clk_rcg2 disp_cc_mdss_vsync_clk_src = { .parent_data = disp_cc_parent_data_1, .num_parents = ARRAY_SIZE(disp_cc_parent_data_1), .flags = CLK_SET_RATE_PARENT, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_shared_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 657/969 clk: qcom: dispcc-sm8250: Enable parents for pixel clocks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Val Packett <[email protected]>
[ Upstream commit acf7a91d0b0e9e3ef374944021de62062125b7e4 ]
Add CLK_OPS_PARENT_ENABLE to MDSS pixel clock sources to ensure parent clocks are enabled during clock operations, preventing potential stability issues during display configuration.
--- drivers/clk/qcom/dispcc-sm8250.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/qcom/dispcc-sm8250.c +2 -2
@@ -564,7 +564,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk0_clk_src = { .name = "disp_cc_mdss_pclk0_clk_src", .parent_data = disp_cc_parent_data_6, .num_parents = ARRAY_SIZE(disp_cc_parent_data_6), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
@@ -578,7 +578,7 @@ static struct clk_rcg2 disp_cc_mdss_pclk1_clk_src = { .name = "disp_cc_mdss_pclk1_clk_src", .parent_data = disp_cc_parent_data_6, .num_parents = ARRAY_SIZE(disp_cc_parent_data_6), - .flags = CLK_SET_RATE_PARENT, + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, .ops = &clk_pixel_ops, }, };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 658/969 clk: imx: imx6q: Fix device node reference leak in pll6_bypassed()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 4b84d496c804b470124cd3a08e928df6801d8eae ]
The function pll6_bypassed() calls of_parse_phandle_with_args() but never calls of_node_put() to release the reference, causing a memory leak.
Fix this by adding proper cleanup calls on all exit paths.
--- drivers/clk/imx/clk-imx6q.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-imx6q.c +7 -1
@@ -233,8 +233,11 @@ static bool pll6_bypassed(struct device_node *node)return false;if (clkspec.np == node && - clkspec.args[0 ] ==IMX6QDL_PLL6_BYPASS ) + clkspec.args[0 ] ==IMX6QDL_PLL6_BYPASS ) { +of_node_put (clkspec.np);break ; + } +of_node_put (clkspec.np); }/* PLL6 bypass is not part of the assigned clock list */
@@ -244,6 +247,9 @@ static bool pll6_bypassed(struct device_node *node) ret =of_parse_phandle_with_args (node,"assigned-clock-parents" ,"#clock-cells" , index, &clkspec); +if (!ret) +of_node_put (clkspec.np); +if (clkspec.args[0 ] !=IMX6QDL_CLK_PLL6 )return true;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 659/969 clk: imx: imx6q: Fix device node reference leak in of_assigned_ldb_sels()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Gu <[email protected]>
[ Upstream commit 9faf207208951460f3f7eefbc112246c8d28ff1b ]
The function of_assigned_ldb_sels() calls of_parse_phandle_with_args() but never calls of_node_put() to release the reference, causing a memory leak.
Fix this by adding proper cleanup calls on all exit paths.
--- drivers/clk/imx/clk-imx6q.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/clk/imx/clk-imx6q.c +4 -0
@@ -183,9 +183,11 @@ static void of_assigned_ldb_sels(struct device_node *node, }if (clkspec.np != node || clkspec.args[0 ] >=IMX6QDL_CLK_END ) {pr_err ("ccm: parent clock %d not in ccm\n" , index); +of_node_put (clkspec.np);return ; } parent = clkspec.args[0 ]; +of_node_put (clkspec.np); rc =of_parse_phandle_with_args (node,"assigned-clocks" ,"#clock-cells" , index, &clkspec);
@@ -193,9 +195,11 @@ static void of_assigned_ldb_sels(struct device_node *node,return ;if (clkspec.np != node || clkspec.args[0 ] >=IMX6QDL_CLK_END ) {pr_err ("ccm: child clock %d not in ccm\n" , index); +of_node_put (clkspec.np);return ; } child = clkspec.args[0 ]; +of_node_put (clkspec.np);if (child !=IMX6QDL_CLK_LDB_DI0_SEL && child !=IMX6QDL_CLK_LDB_DI1_SEL )
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 660/969 clk: imx8mq: Correct the CSI PHY sels
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit d16f57caa78776e6e8a88b96cb2597797b376138 ]
According to i.MX 8M Quad Reference Manual (Section 5.1.2 Table 5-1) MIPI_CSI1_PHY_REF_CLK_ROOT and MIPI_CSI2_PHY_REF_CLK_ROOT have SYSTEM_PLL2_DIV3 available as their second source, which corresponds to sys2_pll_333m rather than sys2_pll_125m.
--- drivers/clk/imx/clk-imx8mq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-imx8mq.c +2 -2
@@ -237,7 +237,7 @@ static const char * const imx8mq_dsi_esc_sels[] = {"osc_25m", "sys2_pll_100m", "static const char *const imx8mq_csi1_core_sels[] = {"osc_25m" ,"sys1_pll_266m" ,"sys2_pll_250m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"sys3_pll_out" ,"audio_pll2_out" ,"video_pll1_out" , }; -static const char *const imx8mq_csi1_phy_sels[] = {"osc_25m" ,"sys2_pll_125m" ,"sys2_pll_100m" ,"sys1_pll_800m" , +static const char *const imx8mq_csi1_phy_sels[] = {"osc_25m" ,"sys2_pll_333m" ,"sys2_pll_100m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"clk_ext2" ,"audio_pll2_out" ,"video_pll1_out" , };static const char *const imx8mq_csi1_esc_sels[] = {"osc_25m" ,"sys2_pll_100m" ,"sys1_pll_80m" ,"sys1_pll_800m" ,
@@ -246,7 +246,7 @@ static const char * const imx8mq_csi1_esc_sels[] = {"osc_25m", "sys2_pll_100m",static const char *const imx8mq_csi2_core_sels[] = {"osc_25m" ,"sys1_pll_266m" ,"sys2_pll_250m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"sys3_pll_out" ,"audio_pll2_out" ,"video_pll1_out" , }; -static const char *const imx8mq_csi2_phy_sels[] = {"osc_25m" ,"sys2_pll_125m" ,"sys2_pll_100m" ,"sys1_pll_800m" , +static const char *const imx8mq_csi2_phy_sels[] = {"osc_25m" ,"sys2_pll_333m" ,"sys2_pll_100m" ,"sys1_pll_800m" ,"sys2_pll_1000m" ,"clk_ext2" ,"audio_pll2_out" ,"video_pll1_out" , };static const char *const imx8mq_csi2_esc_sels[] = {"osc_25m" ,"sys2_pll_100m" ,"sys1_pll_80m" ,"sys1_pll_800m" ,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 661/969 clk: qoriq: avoid format string warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 096abbb6682ee031a0f5ce9f4c71ead9fa63d31e ]
clang-22 warns about the use of non-variadic format arguments passed into snprintf():
drivers/clk/clk-qoriq.c:925:39: error: diagnostic behavior may be improved by adding the
'format(printf, 7, 8)' attribute to the declaration of 'create_mux_common' [-Werror,-Wmissing-format-attribute]
910 | static struct clk * __init create_mux_common(struct clockgen *cg,
| __attribute__((format(printf, 7, 8)))
911 | struct mux_hwclock *hwc,
912 | const struct clk_ops *ops,
913 | unsigned long min_rate,
914 | unsigned long max_rate,
915 | unsigned long pct80_rate,
916 | const char *fmt, int idx)
917 | {
918 | struct clk_init_data init = {};
919 | struct clk *clk;
920 | const struct clockgen_pll_div *div;
921 | const char *parent_names[NUM_MUX_PARENTS];
922 | char name[32];
923 | int i, j;
924 |
925 | snprintf(name, sizeof(name), fmt, idx);
| ^drivers/clk/clk-qoriq.c:910:28: note: 'create_mux_common' declared here
910 | static struct clk * __init create_mux_common(struct clockgen *cg,
Rework this to pass the 'int idx' as a varargs argument, allowing the format string to be verified at the caller location.
--- drivers/clk/clk-qoriq.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/clk/clk-qoriq.c +9 -8
@@ -905,13 +905,11 @@ static const struct clockgen_pll_div *get_pll_div(struct clockgen *cg,return &cg->pll[pll].div[div]; } -static struct clk *__init create_mux_common (struct clockgen *cg, -struct mux_hwclock *hwc, -const struct clk_ops *ops, -unsigned long min_rate, -unsigned long max_rate, -unsigned long pct80_rate, -const char *fmt,int idx) +static struct clk * __init __printf(7, 8) +create_mux_common(struct clockgen *cg, struct mux_hwclock *hwc, + const struct clk_ops *ops, unsigned long min_rate, + unsigned long max_rate, unsigned long pct80_rate, + const char *fmt, ...) { struct clk_init_data init = {};struct clk *clk;
@@ -919,8 +917,11 @@ static struct clk * __init create_mux_common(struct clockgen *cg,const char *parent_names[NUM_MUX_PARENTS ];char name[32 ];int i, j; +va_list args; -snprintf (name,sizeof (name), fmt, idx); +va_start (args, fmt); +vsnprintf (name,sizeof (name), fmt, args); +va_end (args);for (i =0 , j =0 ; i <NUM_MUX_PARENTS ; i++) {unsigned long rate;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 662/969 clk: xgene: Fix mapping leak in xgene_pllclk_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit f520a492e07bc6718e26cfb7543ab4cadd8bb0e2 ]
If xgene_register_clk_pll() fails, the mapped register block is never unmapped.
--- drivers/clk/clk-xgene.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/clk-xgene.c +2 -0
@@ -187,6 +187,8 @@ static void xgene_pllclk_init(struct device_node *np, enum xgene_pll_type pll_tyof_clk_add_provider (np, of_clk_src_simple_get, clk);clk_register_clkdev (clk, clk_name,NULL );pr_debug ("Add %s clock PLL\n" , clk_name); + }else { +iounmap (reg); } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 663/969 dt-bindings: clock: qcom,dispcc-sc7180: Define MDSS resets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit fc6e29d42872680dca017f2e5169eefe971f8d89 ]
The MDSS resets have so far been left undescribed. Fix that.
Stable-dep-of: b0bc6011c549 ("clk: qcom: dispcc-sc7180: Add missing MDSS resets")
--- include/dt-bindings/clock/qcom,dispcc-sc7180.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/dt-bindings/clock/qcom,dispcc-sc7180.h +6 -1
@@ -6,6 +6,7 @@#ifndef _DT_BINDINGS_CLK_QCOM_DISP_CC_SC7180_H#define _DT_BINDINGS_CLK_QCOM_DISP_CC_SC7180_H +/* Clocks */ #define DISP_CC_PLL0 0#define DISP_CC_PLL0_OUT_EVEN 1#define DISP_CC_MDSS_AHB_CLK 2
@@ -40,7 +41,11 @@#define DISP_CC_MDSS_VSYNC_CLK_SRC 31#define DISP_CC_XO_CLK 32 -/* DISP_CC GDSCR */ +/* Resets */ +#define DISP_CC_MDSS_CORE_BCR 0 +#define DISP_CC_MDSS_RSCC_BCR 1 + +/* GDSCs */ #define MDSS_GDSC 0#endif
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 664/969 clk: qcom: dispcc-sc7180: Add missing MDSS resets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit b0bc6011c5499bdfddd0390262bfa13dce1eff74 ]
The MDSS resets have so far been left undescribed. Fix that.
--- drivers/clk/qcom/dispcc-sc7180.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/clk/qcom/dispcc-sc7180.c +8 -0
@@ -16,6 +16,7 @@#include "clk-regmap-divider.h" #include "common.h" #include "gdsc.h" +#include "reset.h" enum {P_BI_TCXO ,
@@ -635,6 +636,11 @@ static struct gdsc mdss_gdsc = { .flags = HW_CTRL, }; +static const struct qcom_reset_map disp_cc_sc7180_resets[] = { + [DISP_CC_MDSS_CORE_BCR ] = {0x2000 }, + [DISP_CC_MDSS_RSCC_BCR ] = {0x4000 }, +}; +static struct gdsc *disp_cc_sc7180_gdscs[] = { [MDSS_GDSC ] = &mdss_gdsc, };
@@ -686,6 +692,8 @@ static const struct qcom_cc_desc disp_cc_sc7180_desc = { .config = &disp_cc_sc7180_regmap_config, .clks = disp_cc_sc7180_clocks, .num_clks = ARRAY_SIZE(disp_cc_sc7180_clocks), + .resets = disp_cc_sc7180_resets, + .num_resets = ARRAY_SIZE(disp_cc_sc7180_resets), .gdscs = disp_cc_sc7180_gdscs, .num_gdscs = ARRAY_SIZE(disp_cc_sc7180_gdscs), };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 665/969 lib/hexdump: print_hex_dump_bytes() calls print_hex_dump_debug()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 36776b7f8a8955b4e75b5d490a75fee0c7a2a7ef ]
print_hex_dump_bytes() claims to be a simple wrapper around print_hex_dump(), but it actally calls print_hex_dump_debug(), which means no output is printed if (dynamic) DEBUG is disabled.
Update the documentation to match the implementation.
--- include/linux/printk.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/linux/printk.h +3 -2
@@ -748,7 +748,8 @@ static inline void print_hex_dump_debug(const char *prefix_str, int prefix_type,#endif /** -* print_hex_dump_bytes - shorthand form of print_hex_dump() with default params +* print_hex_dump_bytes - shorthand form of print_hex_dump_debug() with default +* params * @prefix_str: string to prefix each line with; * caller supplies trailing spaces for alignment if desired * @prefix_type: controls whether prefix of an offset, address, or none
@@ -756,7 +757,7 @@ static inline void print_hex_dump_debug(const char *prefix_str, int prefix_type,* @buf: data blob to dump * @len: number of bytes in the @buf * -* Calls print_hex_dump(), with log level of KERN_DEBUG, +* Calls print_hex_dump_debug(), with log level of KERN_DEBUG, * rowsize of 16, groupsize of 1, and ASCII output included. */ #define print_hex_dump_bytes (prefix_str, prefix_type, buf, len) \
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 666/969 clk: visconti: pll: initialize clk_init_data to zero
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Masney <[email protected]>
[ Upstream commit 1603cbb64173a0e9fa7500f2a686f4aa011c58b9 ]
Sashiko reported the following:
Quoted 4 lines
The struct
clk_init_datainit is declared on the stack without being fully zero-initialized. While fields like name, flags,parent_names,num_parents, and ops are explicitly assigned, theparent_dataandparent_hwsfields are left containing stack garbage.
clk_core_populate_parent_map() currently prefers the parent names over the parent data and hws, so this isn't a problem at the moment. If that ordering ever changed in the future, then this could lead to some unexpected crashes. Let's just go ahead and make sure that the struct clk_init_data is initialized to zero as a good practice.
--- drivers/clk/visconti/pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/visconti/pll.c +1 -1
@@ -244,7 +244,7 @@ static struct clk_hw *visconti_register_pll(struct visconti_pll_provider *ctx,const struct visconti_pll_rate_table *rate_table, spinlock_t *lock) { - struct clk_init_data init; + struct clk_init_data init = {};struct visconti_pll *pll;struct clk_hw *pll_hw_clk;size_t len;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 667/969 f2fs: Use sysfs_emit_at() to simplify code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit f7a678bbe5a8f22cfcef5369757cc9b95f73e027 ]
This file already uses sysfs_emit(). So be consistent and also use sysfs_emit_at().
This slightly simplifies the code and makes it more readable.
Stable-dep-of: 5909bedbed38 ("f2fs: protect extension_list reading with sb_lock in f2fs_sbi_show()")
--- fs/f2fs/sysfs.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-)
fs/f2fs/sysfs.c +21 -24
@@ -150,50 +150,50 @@ static ssize_t features_show(struct f2fs_attr *a,int len =0 ;if (f2fs_sb_has_encrypt (sbi)) - len +=scnprintf (buf,PAGE_SIZE - len,"%s" , + len +=sysfs_emit_at (buf, len,"%s" ,"encryption" );if (f2fs_sb_has_blkzoned (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"blkzoned" );if (f2fs_sb_has_extra_attr (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"extra_attr" );if (f2fs_sb_has_project_quota (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"projquota" );if (f2fs_sb_has_inode_chksum (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"inode_checksum" );if (f2fs_sb_has_flexible_inline_xattr (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"flexible_inline_xattr" );if (f2fs_sb_has_quota_ino (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"quota_ino" );if (f2fs_sb_has_inode_crtime (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"inode_crtime" );if (f2fs_sb_has_lost_found (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"lost_found" );if (f2fs_sb_has_verity (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"verity" );if (f2fs_sb_has_sb_chksum (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"sb_checksum" );if (f2fs_sb_has_casefold (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"casefold" );if (f2fs_sb_has_readonly (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"readonly" );if (f2fs_sb_has_compression (sbi)) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"compression" ); - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s%s" , + len +=sysfs_emit_at (buf, len,"%s%s" , len ?", " :"" ,"pin_file" ); - len +=scnprintf (buf + len,PAGE_SIZE - len,"\n" ); + len +=sysfs_emit_at (buf, len,"\n" );return len; }
@@ -310,17 +310,14 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,int hot_count = sbi->raw_super->hot_ext_count;int len =0 , i; - len +=scnprintf (buf + len,PAGE_SIZE - len, -"cold file extension:\n" ); + len +=sysfs_emit_at (buf, len,"cold file extension:\n" );for (i =0 ; i < cold_count; i++) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s\n" , - extlist[i]); + len +=sysfs_emit_at (buf, len,"%s\n" , extlist[i]); - len +=scnprintf (buf + len,PAGE_SIZE - len, -"hot file extension:\n" ); + len +=sysfs_emit_at (buf, len,"hot file extension:\n" );for (i = cold_count; i < cold_count + hot_count; i++) - len +=scnprintf (buf + len,PAGE_SIZE - len,"%s\n" , - extlist[i]); + len +=sysfs_emit_at (buf, len,"%s\n" , extlist[i]); +return len; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 668/969 f2fs: protect extension_list reading with sb_lock in f2fs_sbi_show()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yongpeng Yang <[email protected]>
[ Upstream commit 5909bedbed38c558bee7cb6758ceedf9bc3a9194 ]
In f2fs_sbi_show(), the extension_list, extension_count and hot_ext_count are read without holding sbi->sb_lock. If a concurrent sysfs store modifies the extension list via f2fs_update_extension_list(), the show path may read inconsistent count and array contents, potentially leading to out-of-bounds access or displaying stale data.
Fix this by holding sb_lock around the entire extension list read and format operation.
--- fs/f2fs/sysfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/f2fs/sysfs.c +5 -2
@@ -306,10 +306,12 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a,if (!strcmp (a->attr.name,"extension_list" )) {__u8 (*extlist)[F2FS_EXTENSION_LEN ] = sbi->raw_super->extension_list; -int cold_count =le32_to_cpu (sbi->raw_super->extension_count); -int hot_count = sbi->raw_super->hot_ext_count; +int cold_count, hot_count;int len =0 , i; +f2fs_down_read (&sbi->sb_lock); + cold_count =le32_to_cpu (sbi->raw_super->extension_count); + hot_count = sbi->raw_super->hot_ext_count; len +=sysfs_emit_at (buf, len,"cold file extension:\n" );for (i =0 ; i < cold_count; i++) len +=sysfs_emit_at (buf, len,"%s\n" , extlist[i]);
@@ -317,6 +319,7 @@ static ssize_t f2fs_sbi_show(struct f2fs_attr *a, len +=sysfs_emit_at (buf, len,"hot file extension:\n" );for (i = cold_count; i < cold_count + hot_count; i++) len +=sysfs_emit_at (buf, len,"%s\n" , extlist[i]); +f2fs_up_read (&sbi->sb_lock);return len; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 669/969 drm/i915: Constify watermark state checker
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
[ Upstream commit 487a2db8bc4eb79c53c9ff8fca65a7fc8350df6c ]
The skl+ wm state checker has no reason to modify the crtc state, so make it const.
Stable-dep-of: a97c88a176b6 ("drm/i915/wm: Verify the correct plane DDB entry")
--- drivers/gpu/drm/i915/display/skl_watermark.c | 2 +- drivers/gpu/drm/i915/display/skl_watermark.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/skl_watermark.c +1 -1
@@ -3014,7 +3014,7 @@ void skl_wm_sanitize(struct drm_i915_private *i915) }void intel_wm_state_verify (struct intel_crtc *crtc, -struct intel_crtc_state *new_crtc_state) +const struct intel_crtc_state *new_crtc_state) {struct drm_i915_private *i915 =to_i915 (crtc->base.dev); struct skl_hw_state {
drivers/gpu/drm/i915/display/skl_watermark.h +1 -1
@@ -42,7 +42,7 @@ void skl_wm_get_hw_state(struct drm_i915_private *i915);void skl_wm_sanitize (struct drm_i915_private *i915);void intel_wm_state_verify (struct intel_crtc *crtc, -struct intel_crtc_state *new_crtc_state); +const struct intel_crtc_state *new_crtc_state);void skl_watermark_ipc_init (struct drm_i915_private *i915);void skl_watermark_ipc_update (struct drm_i915_private *i915);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 670/969 drm/i915: Extract intel_dbuf_mdclk_cdclk_ratio_update()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Sousa <[email protected]>
[ Upstream commit 66a0e0681392420b326f00ba732e6bda099eda29 ]
As of Xe2LPD, it is now possible to select the source of the MDCLK as either the CD2XCLK or the CDCLK PLL.
Previous display IPs were hardcoded to use the CD2XCLK. For those, the ratio between MDCLK and CDCLK remained constant, namely 2. For Xe2LPD, when we select the CDCLK PLL as the source, the ratio will vary according to the squashing configuration (since the cd2x divisor is fixed for all supported configurations).
To help the transition to supporting changes in the ratio, extract the function intel_dbuf_mdclk_cdclk_ratio_update() from the existing logic and call it using 2 as hardcoded ratio. Upcoming changes will use that function for updates in the ratio due to CDCLK changes.
Bspec: 50057, 69445, 49213, 68868
Stable-dep-of: a97c88a176b6 ("drm/i915/wm: Verify the correct plane DDB entry")
--- drivers/gpu/drm/i915/display/skl_watermark.c | 30 +++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/skl_watermark.c +19 -11
@@ -3346,6 +3346,21 @@ int intel_dbuf_init(struct drm_i915_private *i915)return 0 ; } +static void intel_dbuf_mdclk_cdclk_ratio_update (struct drm_i915_private *i915, +u8 ratio, +bool joined_mbus) +{ +enum dbuf_slice slice; + +if (joined_mbus) + ratio *=2 ; + +for_each_dbuf_slice (i915, slice) +intel_de_rmw (i915,DBUF_CTL_S (slice), +DBUF_MIN_TRACKER_STATE_SERVICE_MASK , +DBUF_MIN_TRACKER_STATE_SERVICE (ratio -1 )); +} +/* * Configure MBUS_CTL and all DBUF_CTL_S of each slice to join_mbus state before * update the request state of all DBUS slices.
@@ -3353,8 +3368,7 @@ int intel_dbuf_init(struct drm_i915_private *i915)static void update_mbus_pre_enable (struct intel_atomic_state *state) {struct drm_i915_private *i915 =to_i915 (state->base.dev); -u32 mbus_ctl, dbuf_min_tracker_val; -enum dbuf_slice slice; +u32 mbus_ctl;const struct intel_dbuf_state *dbuf_state =intel_atomic_get_new_dbuf_state (state);
@@ -3365,24 +3379,18 @@ static void update_mbus_pre_enable(struct intel_atomic_state *state)* TODO: Implement vblank synchronized MBUS joining changes. * Must be properly coordinated with dbuf reprogramming. */ -if (dbuf_state->joined_mbus) { +if (dbuf_state->joined_mbus) mbus_ctl = MBUS_HASHING_MODE_1x4 |MBUS_JOIN |MBUS_JOIN_PIPE_SELECT_NONE ; - dbuf_min_tracker_val =DBUF_MIN_TRACKER_STATE_SERVICE (3 ); - }else { +else mbus_ctl = MBUS_HASHING_MODE_2x2 |MBUS_JOIN_PIPE_SELECT_NONE ; - dbuf_min_tracker_val =DBUF_MIN_TRACKER_STATE_SERVICE (1 ); - }intel_de_rmw (i915,MBUS_CTL ,MBUS_HASHING_MODE_MASK |MBUS_JOIN |MBUS_JOIN_PIPE_SELECT_MASK , mbus_ctl); -for_each_dbuf_slice (i915, slice) -intel_de_rmw (i915,DBUF_CTL_S (slice), -DBUF_MIN_TRACKER_STATE_SERVICE_MASK , - dbuf_min_tracker_val); +intel_dbuf_mdclk_cdclk_ratio_update (i915,2 , dbuf_state->joined_mbus); }void intel_dbuf_pre_plane_update (struct intel_atomic_state *state)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 671/969 drm/i915: Loop over all active pipes in intel_mbus_dbox_update
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Lisovskiy <[email protected]>
[ Upstream commit e8333ab22cd8c750b7c14d3da7c0eef3ba85527f ]
We need to loop through all active pipes, not just the ones, that are in current state, because disabling and enabling even a particular pipe affects credits in another one.
Stable-dep-of: a97c88a176b6 ("drm/i915/wm: Verify the correct plane DDB entry")
--- drivers/gpu/drm/i915/display/skl_watermark.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/i915/display/skl_watermark.c +1 -6
@@ -3456,10 +3456,8 @@ void intel_mbus_dbox_update(struct intel_atomic_state *state) {struct drm_i915_private *i915 =to_i915 (state->base.dev);const struct intel_dbuf_state *new_dbuf_state, *old_dbuf_state; -const struct intel_crtc_state *new_crtc_state;const struct intel_crtc *crtc;u32 val =0 ; -int i;if (DISPLAY_VER (i915) <11 )return ;
@@ -3503,12 +3501,9 @@ void intel_mbus_dbox_update(struct intel_atomic_state *state) val |=MBUS_DBOX_B_CREDIT (8 ); } -for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) { +for_each_intel_crtc_in_pipe_mask (&i915->drm, crtc, new_dbuf_state->active_pipes) {u32 pipe_val = val; -if (!new_crtc_state->hw.active) -continue ; -if (DISPLAY_VER (i915) >=14 ) {if (xelpdp_is_only_pipe_per_dbuf_bank (crtc->pipe, new_dbuf_state->active_pipes))
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 672/969 drm/i915/wm: Verify the correct plane DDB entry
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
[ Upstream commit a97c88a176b6b8d116f4d3f508f3bd02bc77b462 ]
Actually verify the DDB entry for the plane we're looking at instead of always verifying the cursor DDB.
--- drivers/gpu/drm/i915/display/skl_watermark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/skl_watermark.c +2 -2
@@ -3118,8 +3118,8 @@ void intel_wm_state_verify(struct intel_crtc *crtc, }/* DDB */ - hw_ddb_entry = &hw->ddb[PLANE_CURSOR ]; - sw_ddb_entry = &new_crtc_state->wm.skl.plane_ddb[PLANE_CURSOR ]; + hw_ddb_entry = &hw->ddb[plane->id]; + sw_ddb_entry = &new_crtc_state->wm.skl.plane_ddb[plane->id];if (!skl_ddb_entry_equal (hw_ddb_entry, sw_ddb_entry)) { drm_err(&i915->drm,
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 673/969 crypto: sa2ul - Fix AEAD fallback algorithm names
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: T Pratham <[email protected]>
[ Upstream commit 8451ab6ad686ffdcdf9ddadaa446a79ab48e5590 ]
For authenc AEAD algorithms, sa2ul is trying to register very specific -ce version as a fallback. This causes registration failure on SoCs which do not have ARMv8-CE enabled/available. Change the fallback algorithm from the specific driver name to generic algorithm name so that the kernel can allocate any available fallback.
--- drivers/crypto/sa2ul.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/sa2ul.c +2 -2
@@ -1774,13 +1774,13 @@ static int sa_cra_init_aead(struct crypto_aead *tfm, const char *hash,static int sa_cra_init_aead_sha1 (struct crypto_aead *tfm) {return sa_cra_init_aead (tfm,"sha1" , -"authenc(hmac(sha1-ce),cbc(aes-ce))" ); +"authenc(hmac(sha1),cbc(aes))" ); }static int sa_cra_init_aead_sha256 (struct crypto_aead *tfm) {return sa_cra_init_aead (tfm,"sha256" , -"authenc(hmac(sha256-ce),cbc(aes-ce))" ); +"authenc(hmac(sha256),cbc(aes))" ); }static void sa_exit_tfm_aead (struct crypto_aead *tfm)
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 674/969 crypto: ccp - copy IV using skcipher ivsize
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moses <[email protected]>
[ Upstream commit a7a1f3cdd64d8a165d9b8c9e9ad7fb46ac19dfc4 ]
AF_ALG rfc3686-ctr-aes-ccp requests pass an 8-byte IV to the driver.
ccp_aes_complete() restores AES_BLOCK_SIZE bytes into the caller's IV buffer while RFC3686 skciphers expose an 8-byte IV, so the restore overruns the provided buffer.
Use crypto_skcipher_ivsize() to copy only the algorithm's IV length.
--- drivers/crypto/ccp/ccp-crypto-aes.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/crypto/ccp/ccp-crypto-aes.c +5 -2
@@ -28,8 +28,11 @@ static int ccp_aes_complete(struct crypto_async_request *async_req, int ret)if (ret)return ret; -if (ctx->u.aes.mode !=CCP_AES_MODE_ECB ) -memcpy (req->iv, rctx->iv,AES_BLOCK_SIZE ); +if (ctx->u.aes.mode !=CCP_AES_MODE_ECB ) { +size_t ivsize =crypto_skcipher_ivsize (crypto_skcipher_reqtfm (req)); + +memcpy (req->iv, rctx->iv, ivsize); + }return 0 ; }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 675/969 arm64: dts: imx8mp-icore-mx8mp: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit ea8c90f5c7ceeb6657a8fe564aa7b190dce298a6 ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mp-icore-mx8mp.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-icore-mx8mp.dtsi +1 -1
@@ -132,7 +132,7 @@ MX8MP_IOMUXC_I2C1_SDA__I2C1_SDA 0x400001c3 pinctrl_pmic: pmicgrp { fsl,pins = < - MX8MP_IOMUXC_NAND_CE0_B__GPIO3_IO01 0x41 + MX8MP_IOMUXC_NAND_CE0_B__GPIO3_IO01 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 676/969 arm64: dts: imx8mp-dhcom-som: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit f9ed5afc988da3e22543725e35be6addbb0497bc ]
PMIC_nINT is low level triggered, but the current PAD settings is PE=0,PUE=0,FSEL_1_FAST_SLEW_RATE=1,SION=1. So PAD needs to be configured as PULL UP with PULL Enable, no need SION. Correct it.
--- arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mp-dhcom-som.dtsi +1 -1
@@ -807,7 +807,7 @@ MX8MP_IOMUXC_HDMI_DDC_SDA__GPIO3_IO27 0x84 pinctrl_pmic: dhcom-pmic-grp { fsl,pins = < /* PMIC_nINT */ - MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x40000090 + MX8MP_IOMUXC_GPIO1_IO03__GPIO1_IO03 0x1c0 >; };
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 677/969 PCMCIA: Fix garbled log messages for KERN_CONT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: René Rebe <[email protected]>
[ Upstream commit bfeaa6814bd3f9a1f6d525b3b35a03b9a0368961 ]
For years the PCMCIA info messages are messed up by superfluous newlines. While f2e6cf76751d ("pcmcia: Convert dev_printk to dev_<level>") converted the code to pr_cont(), dev_info enforces a \n via vprintk_store setting LOG_NEWLINE, breaking subsequent pr_cont.
Fix by logging the device name manually to allow pr_cont to work for more readable and not \n distorted logs.
--- drivers/pcmcia/rsrc_nonstatic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pcmcia/rsrc_nonstatic.c +3 -3
@@ -188,7 +188,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,int any;u_char *b, hole, most; -dev_info (&s->dev,"cs: IO port probe %#x-%#x:" , base, base+num-1 ); +pr_info ("%s: cs: IO port probe %#x-%#x:" ,dev_name (&s->dev), base, base+num-1 );/* First, what does a floating port look like? */ b =kzalloc (256 ,GFP_KERNEL );
@@ -410,8 +410,8 @@ static int do_mem_probe(struct pcmcia_socket *s, u_long base, u_long num,struct socket_data *s_data = s->resource_data;u_long i, j, bad, fail, step; -dev_info (&s->dev,"cs: memory probe 0x%06lx-0x%06lx:" , - base, base+num-1 ); +pr_info ("%s: cs: memory probe 0x%06lx-0x%06lx:" , +dev_name (&s->dev), base, base+num-1 ); bad = fail =0 ; step = (num <0x20000 ) ?0x2000 : ((num>>4 ) & ~0x1fff );/* don't allow too large steps */
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 678/969 arm64: dts: imx8mn-tqma8mqnl: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 0fb37990774113afd943eaa91323679388584b6d ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mn-tqma8mqnl.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mn-tqma8mqnl.dtsi +1 -1
@@ -282,7 +282,7 @@ pinctrl_i2c1_gpio: i2c1gpiogrp { }; pinctrl_pmic: pmicgrp { - fsl,pins = <MX8MN_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x84>; + fsl,pins = <MX8MN_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x1c4>; }; pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 679/969 arm64: dts: imx8mm-tqma8mqml: Correct PAD settings for PMIC_nINT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 42a9f5a16328ed78a88e0498556965b6c6ec515c ]
With commit 5d0efaf47ee90 ("regulator: pca9450: Correct interrupt type"), there might be interrupt storm for this board. Need to set PAD PUE and PU together to make pull up work properly.
--- arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi +1 -1
@@ -280,7 +280,7 @@ pinctrl_i2c1_gpio: i2c1gpiogrp { }; pinctrl_pmic: pmicgrp { - fsl,pins = <MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x94>; + fsl,pins = <MX8MM_IOMUXC_GPIO1_IO08_GPIO1_IO8 0x1d4>; }; pinctrl_reg_usdhc2_vmmc: regusdhc2vmmcgrp {
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 680/969 net/sched: sch_cake: fix NAT destination port not being updated in cake_update_flowkeys
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <[email protected]>
[ Upstream commit f9e40664706927d7ae22a448a3383e23c38a4c0b ]
cake_update_flowkeys() is supposed to update the flow dissector keys with the NAT-translated addresses and ports from conntrack, so that CAKE's per-flow fairness correctly identifies post-NAT flows as belonging to the same connection.
For the source port, this works correctly:
keys->ports.src = port;
But for the destination port, the assignment is reversed:
port = keys->ports.dst;
This means the NAT destination port is never updated in the flow keys. As a result, when multiple connections are NATed to the same destination, CAKE treats them as separate flows because the original (pre-NAT) destination ports differ. This breaks CAKE's NAT-aware flow isolation when using the "nat" mode.
The bug was introduced in commit b0c19ed6088a ("sch_cake: Take advantage of skb->hash where appropriate") which refactored the original direct assignment into a compare-and-conditionally-update pattern, but wrote the destination port update backwards.
Fix by reversing the assignment direction to match the source port pattern.
--- net/sched/sch_cake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_cake.c +1 -1
@@ -619,7 +619,7 @@ static bool cake_update_flowkeys(struct flow_keys *keys, } port = rev ? tuple.src.u.all : tuple.dst.u.all;if (port != keys->ports.dst) { - port = keys->ports.dst; + keys->ports.dst = port; upd = true; } }
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 681/969 nexthop: fix IPv6 route referencing IPv4 nexthop
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 29c95185ba32b621fbc3800fb86e7dc3edf5c2be ]
syzbot reported a panic [1] [2].
When an IPv6 nexthop is replaced with an IPv4 nexthop, the has_v4 flag of all groups containing this nexthop is not updated. This is because nh_group_v4_update is only called when replacing AF_INET to AF_INET6, but the reverse direction (AF_INET6 to AF_INET) is missed.
This allows a stale has_v4=false to bypass fib6_check_nexthop, causing IPv6 routes to be attached to groups that effectively contain only AF_INET members. Subsequent route lookups then call nexthop_fib6_nh() which returns NULL for the AF_INET member, leading to a NULL pointer dereference.
Fix by calling nh_group_v4_update whenever the family changes, not just AF_INET to AF_INET6.
Reproducer:
# AF_INET6 blackhole
ip -6 nexthop add id 1 blackhole
# group with has_v4=false
ip nexthop add id 100 group 1
# replace with AF_INET (no -6), has_v4 stays false ip nexthop replace id 1 blackhole
# pass stale has_v4 check
ip -6 route add 2001:db8::/64 nhid 100
# panic
ping -6 2001:db8::1
[1] https://syzkaller.appspot.com/bug?id=e17283eb2f8dcf3dd9b47fe6f67a95f71faadad0
[2] https://syzkaller.appspot.com/bug?id=8699b6ae54c9f35837d925686208402949e12ef3
--- net/ipv4/nexthop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/nexthop.c +2 -2
@@ -2160,10 +2160,10 @@ static int replace_nexthop_single(struct net *net, struct nexthop *old, goto err_notify; } -/* When replacing an IPv4 nexthop with an IPv6 nexthop, potentially +/* When replacing a nexthop with one of a different family, potentially * update IPv4 indication in all the groups using the nexthop. */ -if (oldi->family ==AF_INET && newi->family ==AF_INET6 ) { +if (oldi->family != newi->family) {list_for_each_entry (nhge, &old->grp_list, nh_list) {struct nexthop *nhp = nhge->nh_parent;struct nh_group *nhg;
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 682/969 net/sched: taprio: continue with other TXQs if one dequeue() failed
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit 1638bbbe4ececa615b273497d347d59ad71060a2 ]
This changes the handling of an unlikely condition to not stop dequeuing if taprio failed to dequeue the peeked skb in taprio_dequeue().
I've no idea when this can happen, but the only side effect seems to be that the atomic_sub_return() call right above will have consumed some budget. This isn't a big deal, since either that made us remain without any budget (and therefore, we'd exit on the next peeked skb anyway), or we could send some packets from other TXQs.
I'm making this change because in a future patch I'll be refactoring the dequeue procedure to simplify it, and this corner case will have to go away.
Stable-dep-of: 105425b1969c ("net/sched: taprio: fix use-after-free in advance_sched() on schedule switch")
--- net/sched/sch_taprio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_taprio.c +1 -1
@@ -626,7 +626,7 @@ static struct sk_buff *taprio_dequeue(struct Qdisc *sch) skb = child->ops->dequeue (child);if (unlikely (!skb)) - goto done; +continue ; skb_found:qdisc_bstats_update (sch, skb);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 683/969 net/sched: taprio: refactor one skb dequeue from TXQ to separate function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit 92f966674f6a257eddfa60a85f9b6741d6087ccb ]
Future changes will refactor the TXQ selection procedure, and a lot of stuff will become messy, the indentation of the bulk of the dequeue procedure would increase, etc.
Break out the bulk of the function into a new one, which knows the TXQ (child qdisc) we should perform a dequeue from.
Stable-dep-of: 105425b1969c ("net/sched: taprio: fix use-after-free in advance_sched() on schedule switch")
--- net/sched/sch_taprio.c | 121 +++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 58 deletions(-)
net/sched/sch_taprio.c +63 -58
@@ -551,6 +551,66 @@ static void taprio_set_budget(struct taprio_sched *q, struct sched_entry *entry) atomic64_read(&q->picos_per_byte))); } +static struct sk_buff *taprio_dequeue_from_txq (struct Qdisc *sch,int txq, +struct sched_entry *entry, +u32 gate_mask) +{ +struct taprio_sched *q =qdisc_priv (sch); +struct net_device *dev =qdisc_dev (sch); +struct Qdisc *child = q->qdiscs[txq]; +struct sk_buff *skb; +ktime_t guard; +int prio; +int len; +u8 tc; + +if (unlikely (!child)) +return NULL ; + +if (TXTIME_ASSIST_IS_ENABLED (q->flags)) { + skb = child->ops->dequeue (child); +if (!skb) +return NULL ; + goto skb_found; + } + + skb = child->ops->peek (child); +if (!skb) +return NULL ; + + prio = skb->priority; + tc =netdev_get_prio_tc_map (dev, prio); + +if (!(gate_mask &BIT (tc))) +return NULL ; + + len =qdisc_pkt_len (skb); + guard =ktime_add_ns (taprio_get_time (q),length_to_duration (q, len)); + +/* In the case that there's no gate entry, there's no +* guard band ... +*/ +if (gate_mask !=TAPRIO_ALL_GATES_OPEN && +ktime_after (guard, entry->close_time)) +return NULL ; + +/* ... and no budget. */ +if (gate_mask !=TAPRIO_ALL_GATES_OPEN && +atomic_sub_return (len, &entry->budget) <0 ) +return NULL ; + + skb = child->ops->dequeue (child); +if (unlikely (!skb)) +return NULL ; + +skb_found: +qdisc_bstats_update (sch, skb); +qdisc_qstats_backlog_dec (sch, skb); + sch->q.qlen--; + +return skb; +} +/* Will not be called in the full offload case, since the TX queues are * attached to the Qdisc created using qdisc_create_dflt() */
@@ -576,64 +636,9 @@ static struct sk_buff *taprio_dequeue(struct Qdisc *sch) goto done;for (i =0 ; i < dev->num_tx_queues; i++) { -struct Qdisc *child = q->qdiscs[i]; -ktime_t guard; -int prio; -int len; -u8 tc; - -if (unlikely (!child)) -continue ; - -if (TXTIME_ASSIST_IS_ENABLED (q->flags)) { - skb = child->ops->dequeue (child); -if (!skb) -continue ; - goto skb_found; - } - - skb = child->ops->peek (child); -if (!skb) -continue ; - - prio = skb->priority; - tc =netdev_get_prio_tc_map (dev, prio); - -if (!(gate_mask &BIT (tc))) { - skb =NULL ; -continue ; - } - - len =qdisc_pkt_len (skb); - guard =ktime_add_ns (taprio_get_time (q), -length_to_duration (q, len)); - -/* In the case that there's no gate entry, there's no -* guard band ... -*/ -if (gate_mask !=TAPRIO_ALL_GATES_OPEN && -ktime_after (guard, entry->close_time)) { - skb =NULL ; -continue ; - } - -/* ... and no budget. */ -if (gate_mask !=TAPRIO_ALL_GATES_OPEN && -atomic_sub_return (len, &entry->budget) <0 ) { - skb =NULL ; -continue ; - } - - skb = child->ops->dequeue (child); -if (unlikely (!skb)) -continue ; - -skb_found: -qdisc_bstats_update (sch, skb); -qdisc_qstats_backlog_dec (sch, skb); - sch->q.qlen--; - - goto done; + skb =taprio_dequeue_from_txq (sch, i, entry, gate_mask); +if (skb) + goto done; } done:
Signature · 1 line
2.53.0