5.17.2-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 394/1126 ASoC: cs35l41: Fix max number of TX channels
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit 16639d39bdf577168d3fe34315917a94365c8d19 ]
This device only has 4 TX channels.
--- sound/soc/codecs/cs35l41.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs35l41.c +1 -1
@@ -1091,7 +1091,7 @@ static struct snd_soc_dai_driver cs35l41_dai[] = { .capture = { .stream_name = "AMP Capture", .channels_min = 1, - .channels_max = 8, + .channels_max = 4, .rates = SNDRV_PCM_RATE_KNOT, .formats = CS35L41_TX_FORMATS, },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 395/1126 ASoC: atmel: Add missing of_node_put() in at91sam9g20ek_audio_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit f590797fa3c1bccdd19e55441592a23b46aef449 ]
This node pointer is returned by of_parse_phandle() with refcount incremented in this function.
Calling of_node_put() to avoid the refcount leak.
--- sound/soc/atmel/sam9g20_wm8731.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/atmel/sam9g20_wm8731.c +1 -0
@@ -214,6 +214,7 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) cpu_np =of_parse_phandle (np,"atmel,ssc-controller" ,0 );if (!cpu_np) {dev_err (&pdev->dev,"dai and pcm info missing\n" ); +of_node_put (codec_np);return -EINVAL ; } at91sam9g20ek_dai.cpus->of_node = cpu_np;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 396/1126 ASoC: wm8350: Handle error for wm8350_register_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit db0350da8084ad549bca16cc0486c11cc70a1f9b ]
As the potential failure of the wm8350_register_irq(), it should be better to check it and return error if fails. Also, use 'free_' in order to avoid the same code.
--- sound/soc/codecs/wm8350.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
sound/soc/codecs/wm8350.c +24 -4
@@ -1537,18 +1537,38 @@ static int wm8350_component_probe(struct snd_soc_component *component)wm8350_clear_bits (wm8350,WM8350_JACK_DETECT ,WM8350_JDL_ENA |WM8350_JDR_ENA ); -wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_JCK_DET_L , + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_JCK_DET_L , wm8350_hpl_jack_handler,0 ,"Left jack detect" , priv); -wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_JCK_DET_R , +if (ret !=0 ) + goto err; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_JCK_DET_R , wm8350_hpr_jack_handler,0 ,"Right jack detect" , priv); -wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_MICSCD , +if (ret !=0 ) + goto free_jck_det_l; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_MICSCD , wm8350_mic_handler,0 ,"Microphone short" , priv); -wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_MICD , +if (ret !=0 ) + goto free_jck_det_r; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CODEC_MICD , wm8350_mic_handler,0 ,"Microphone detect" , priv); +if (ret !=0 ) + goto free_micscd;return 0 ; + +free_micscd: +wm8350_free_irq (wm8350,WM8350_IRQ_CODEC_MICSCD , priv); +free_jck_det_r: +wm8350_free_irq (wm8350,WM8350_IRQ_CODEC_JCK_DET_R , priv); +free_jck_det_l: +wm8350_free_irq (wm8350,WM8350_IRQ_CODEC_JCK_DET_L , priv); +err: +return ret; }static void wm8350_component_remove (struct snd_soc_component *component)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 397/1126 ASoC: fsi: Add check for clk_enable
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 405afed8a728f23cfaa02f75bbc8bdd6b7322123 ]
As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.
--- sound/soc/sh/fsi.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
sound/soc/sh/fsi.c +16 -3
@@ -816,14 +816,27 @@ static int fsi_clk_enable(struct device *dev,return ret; } -clk_enable (clock->xck); -clk_enable (clock->ick); -clk_enable (clock->div); + ret =clk_enable (clock->xck); +if (ret) + goto err; + ret =clk_enable (clock->ick); +if (ret) + goto disable_xck; + ret =clk_enable (clock->div); +if (ret) + goto disable_ick; clock->count++; }return ret; + +disable_ick: +clk_disable (clock->ick); +disable_xck: +clk_disable (clock->xck); +err: +return ret; } static int fsi_clk_disable(struct device *dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 398/1126 video: fbdev: omapfb: Add missing of_node_put() in dvic_probe_of
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit a58c22cfbbf62fefca090334bbd35fd132e92a23 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c +1 -0
@@ -246,6 +246,7 @@ static int dvic_probe_of(struct platform_device *pdev) adapter_node =of_parse_phandle (node,"ddc-i2c-bus" ,0 );if (adapter_node) { adapter =of_get_i2c_adapter_by_node (adapter_node); +of_node_put (adapter_node);if (adapter ==NULL ) {dev_err (&pdev->dev,"failed to parse ddc-i2c-bus\n" );omap_dss_put_device (ddata->in);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 399/1126 media: saa7134: fix incorrect use to determine if list is empty
In reply to Greg Kroah-HartmanFrom: Jakob Koschel <[email protected]>
[ Upstream commit 9f1f4b642451d35667a4dc6a9c0a89d954b530a3 ]
'dev' will *always* be set by list_for_each_entry().
It is incorrect to assume that the iterator value will be NULL if the list is empty.
Instead of checking the pointer it should be checked if the list is empty.
--- drivers/media/pci/saa7134/saa7134-alsa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/saa7134/saa7134-alsa.c +2 -2
@@ -1214,7 +1214,7 @@ static int alsa_device_exit(struct saa7134_dev *dev)static int saa7134_alsa_init (void ) { -struct saa7134_dev *dev =NULL ; +struct saa7134_dev *dev; saa7134_dmasound_init = alsa_device_init; saa7134_dmasound_exit = alsa_device_exit;
@@ -1229,7 +1229,7 @@ static int saa7134_alsa_init(void)alsa_device_init (dev); } -if (dev ==NULL ) +if (list_empty (&saa7134_devlist))pr_info ("saa7134 ALSA: no saa7134 cards found\n" );return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 400/1126 ivtv: fix incorrect device_caps for ivtvfb
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 25e94139218c0293b4375233c14f2256d7dcfaa8 ]
The VIDIOC_G_FBUF and related overlay ioctls no longer worked (-ENOTTY was returned).
The root cause was the introduction of the caps field in ivtv-driver.h. While loading the ivtvfb module would update the video_device device_caps field with V4L2_CAP_VIDEO_OUTPUT_OVERLAY it would not update that caps field, and that's what the overlay ioctls would look at.
It's a bad idea to keep information in two places, so drop the caps field and only use vdev.device_caps.
--- drivers/media/pci/ivtv/ivtv-driver.h | 1 - drivers/media/pci/ivtv/ivtv-ioctl.c | 10 +++++----- drivers/media/pci/ivtv/ivtv-streams.c | 11 ++++------- 3 files changed, 9 insertions(+), 13 deletions(-)
drivers/media/pci/ivtv/ivtv-driver.h +0 -1
@@ -330,7 +330,6 @@ struct ivtv_stream {struct ivtv *itv;/* for ease of use */ const char *name;/* name of the stream */ int type;/* stream type */ -u32 caps;/* V4L2 capabilities */ struct v4l2_fh *fh;/* pointer to the streaming filehandle */ spinlock_t qlock;/* locks access to the queues */
drivers/media/pci/ivtv/ivtv-ioctl.c +5 -5
@@ -438,7 +438,7 @@ static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_fstruct ivtv_stream *s = &itv->streams[fh2id (fh)->type];struct v4l2_window *winfmt = &fmt->fmt.win; -if (!(s->caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY )) +if (!(s->vdev.device_caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY ))return -EINVAL ;if (!itv->osd_video_pbase)return -EINVAL ;
@@ -549,7 +549,7 @@ static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2u32 chromakey = fmt->fmt.win.chromakey;u8 global_alpha = fmt->fmt.win.global_alpha; -if (!(s->caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY )) +if (!(s->vdev.device_caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY ))return -EINVAL ;if (!itv->osd_video_pbase)return -EINVAL ;
@@ -1383,7 +1383,7 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) 0, }; -if (!(s->caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY )) +if (!(s->vdev.device_caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY ))return -ENOTTY ;if (!itv->osd_video_pbase)return -ENOTTY ;
@@ -1450,7 +1450,7 @@ static int ivtv_s_fbuf(struct file *file, void *fh, const struct v4l2_framebuffestruct ivtv_stream *s = &itv->streams[fh2id (fh)->type];struct yuv_playback_info *yi = &itv->yuv_info; -if (!(s->caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY )) +if (!(s->vdev.device_caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY ))return -ENOTTY ;if (!itv->osd_video_pbase)return -ENOTTY ;
@@ -1470,7 +1470,7 @@ static int ivtv_overlay(struct file *file, void *fh, unsigned int on)struct ivtv *itv = id->itv;struct ivtv_stream *s = &itv->streams[fh2id (fh)->type]; -if (!(s->caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY )) +if (!(s->vdev.device_caps &V4L2_CAP_VIDEO_OUTPUT_OVERLAY ))return -ENOTTY ;if (!itv->osd_video_pbase)return -ENOTTY ;
drivers/media/pci/ivtv/ivtv-streams.c +4 -7
@@ -176,7 +176,7 @@ static void ivtv_stream_init(struct ivtv *itv, int type) s->itv = itv; s->type = type; s->name = ivtv_stream_info[type].name; - s->caps = ivtv_stream_info[type].v4l2_caps; + s->vdev.device_caps = ivtv_stream_info[type].v4l2_caps;if (ivtv_stream_info[type].pio) s->dma =DMA_NONE ;
@@ -299,12 +299,9 @@ static int ivtv_reg_dev(struct ivtv *itv, int type)if (s_mpg->vdev.v4l2_dev) num = s_mpg->vdev.num + ivtv_stream_info[type].num_offset; } - s->vdev.device_caps = s->caps; -if (itv->osd_video_pbase) { - itv->streams[IVTV_DEC_STREAM_TYPE_YUV ].vdev.device_caps |= -V4L2_CAP_VIDEO_OUTPUT_OVERLAY ; - itv->streams[IVTV_DEC_STREAM_TYPE_MPG ].vdev.device_caps |= -V4L2_CAP_VIDEO_OUTPUT_OVERLAY ; +if (itv->osd_video_pbase && (type ==IVTV_DEC_STREAM_TYPE_YUV || + type ==IVTV_DEC_STREAM_TYPE_MPG )) { + s->vdev.device_caps |=V4L2_CAP_VIDEO_OUTPUT_OVERLAY ; itv->v4l2_cap |=V4L2_CAP_VIDEO_OUTPUT_OVERLAY ; }video_set_drvdata (&s->vdev, s);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 401/1126 ASoC: atmel: Fix error handling in snd_proto_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b0bfaf0544d08d093d6211d7ef8816fb0b5b6c75 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error paths. Fix this by calling of_node_put() in error handling too.
--- sound/soc/atmel/mikroe-proto.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
sound/soc/atmel/mikroe-proto.c +12 -8
@@ -115,7 +115,8 @@ static int snd_proto_probe(struct platform_device *pdev) cpu_np =of_parse_phandle (np,"i2s-controller" ,0 );if (!cpu_np) {dev_err (&pdev->dev,"i2s-controller missing\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_codec_node; } dai->cpus->of_node = cpu_np; dai->platforms->of_node = cpu_np;
@@ -125,7 +126,8 @@ static int snd_proto_probe(struct platform_device *pdev) &bitclkmaster, &framemaster);if (bitclkmaster != framemaster) {dev_err (&pdev->dev,"Must be the same bitclock and frame master\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_cpu_node; }if (bitclkmaster) {if (codec_np == bitclkmaster)
@@ -136,18 +138,20 @@ static int snd_proto_probe(struct platform_device *pdev) dai_fmt |=snd_soc_daifmt_parse_clock_provider_as_flag (np,NULL ); } -of_node_put (bitclkmaster); -of_node_put (framemaster); - dai->dai_fmt = dai_fmt; - -of_node_put (codec_np); -of_node_put (cpu_np); + dai->dai_fmt = dai_fmt; ret =snd_soc_register_card (&snd_proto);if (ret)dev_err_probe (&pdev->dev, ret,"snd_soc_register_card() failed\n" ); + +put_cpu_node: +of_node_put (bitclkmaster); +of_node_put (framemaster); +of_node_put (cpu_np); +put_codec_node: +of_node_put (codec_np);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 402/1126 ASoC: rockchip: i2s: Fix missing clk_disable_unprepare() in rockchip_i2s_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit f725d20579807a68afbe5dba69e78b8fa05f5ef0 ]
Fix the missing clk_disable_unprepare() before return from rockchip_i2s_probe() in the error handling case.
--- sound/soc/rockchip/rockchip_i2s.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
sound/soc/rockchip/rockchip_i2s.c +10 -5
@@ -716,19 +716,23 @@ static int rockchip_i2s_probe(struct platform_device *pdev) i2s->mclk =devm_clk_get (&pdev->dev,"i2s_clk" );if (IS_ERR (i2s->mclk)) {dev_err (&pdev->dev,"Can't retrieve i2s master clock\n" ); -return PTR_ERR (i2s->mclk); + ret =PTR_ERR (i2s->mclk); + goto err_clk; } regs =devm_platform_get_and_ioremap_resource (pdev,0 , &res); -if (IS_ERR (regs)) -return PTR_ERR (regs); +if (IS_ERR (regs)) { + ret =PTR_ERR (regs); + goto err_clk; + } i2s->regmap =devm_regmap_init_mmio (&pdev->dev, regs, &rockchip_i2s_regmap_config);if (IS_ERR (i2s->regmap)) {dev_err (&pdev->dev,"Failed to initialise managed register map\n" ); -return PTR_ERR (i2s->regmap); + ret =PTR_ERR (i2s->regmap); + goto err_clk; } i2s->bclk_ratio =64 ;
@@ -768,7 +772,8 @@ static int rockchip_i2s_probe(struct platform_device *pdev)i2s_runtime_suspend (&pdev->dev); err_pm_disable:pm_runtime_disable (&pdev->dev); - +err_clk: +clk_disable_unprepare (i2s->hclk);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 403/1126 ASoC: SOF: Add missing of_node_put() in imx8m_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 5575f7f49134c7386a684335c9007737c606d3b5 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- sound/soc/sof/imx/imx8m.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/imx/imx8m.c +1 -0
@@ -224,6 +224,7 @@ static int imx8m_probe(struct snd_sof_dev *sdev) } ret =of_address_to_resource (res_node,0 , &res); +of_node_put (res_node);if (ret) {dev_err (&pdev->dev,"failed to get reserved region address\n" ); goto exit_pdev_unregister;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 404/1126 ASoC: mediatek: mt8192-mt6359: Fix error handling in mt8192_mt6359_dev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit e45ac7831ff3e2934d58cce319c17c8ec763c95c ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error paths. Fix this by calling of_node_put() in error handling too.
--- .../mt8192/mt8192-mt6359-rt1015-rt5682.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +12 -6
@@ -1116,8 +1116,10 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) } card = (struct snd_soc_card *)of_device_get_match_data (&pdev->dev); -if (!card) -return -EINVAL ; +if (!card) { + ret = -EINVAL ; + goto put_platform_node; + } card->dev = &pdev->dev; hdmi_codec = of_parse_phandle(pdev->dev.of_node,
@@ -1159,20 +1161,24 @@ static int mt8192_mt6359_dev_probe(struct platform_device *pdev) } priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); -if (!priv) -return -ENOMEM ; +if (!priv) { + ret = -ENOMEM ; + goto put_hdmi_codec; + }snd_soc_card_set_drvdata (card, priv); ret =mt8192_afe_gpio_init (&pdev->dev);if (ret) {dev_err (&pdev->dev,"init gpio error %d\n" , ret); -return ret; + goto put_hdmi_codec; } ret =devm_snd_soc_register_card (&pdev->dev, card); -of_node_put (platform_node); +put_hdmi_codec:of_node_put (hdmi_codec); +put_platform_node: +of_node_put (platform_node);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 405/1126 ASoC: rk817: Fix missing clk_disable_unprepare() in rk817_platform_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit a6b44a2518a08348bd0f0401e4d2b99233bbabc2 ]
Fix the missing clk_disable_unprepare() before return from rk817_platform_probe() in the error handling case.
--- sound/soc/codecs/rk817_codec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/codecs/rk817_codec.c +4 -2
@@ -508,12 +508,14 @@ static int rk817_platform_probe(struct platform_device *pdev)if (ret <0 ) {dev_err (&pdev->dev,"%s() register codec error %d\n" , __func__, ret); - goto err_; + goto err_clk; }return 0 ; -err_: +err_clk: +clk_disable_unprepare (rk817_codec_data->mclk); +err_:return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 406/1126 ASoC: dmaengine: do not use a NULL prepare_slave_config() callback
In reply to Greg Kroah-HartmanFrom: Codrin Ciubotariu <[email protected]>
[ Upstream commit 9a1e13440a4f2e7566fd4c5eae6a53e6400e08a4 ]
Even if struct snd_dmaengine_pcm_config is used, prepare_slave_config() callback might not be set. Check if this callback is set before using it.
--- sound/soc/soc-generic-dmaengine-pcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/soc-generic-dmaengine-pcm.c +3 -3
@@ -86,10 +86,10 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component,memset (&slave_config,0 ,sizeof (slave_config)); -if (!pcm->config) - prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; -else +if (pcm->config && pcm->config->prepare_slave_config) prepare_slave_config = pcm->config->prepare_slave_config; +else + prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;if (prepare_slave_config) {int ret =prepare_slave_config (substream, params, &slave_config);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 407/1126 ASoC: mxs: Fix error handling in mxs_sgtl5000_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6ae0a4d8fec551ec581d620f0eb1fe31f755551c ]
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error paths.
For example, when codec_np is NULL, saif_np[0] and saif_np[1] are not NULL, it will cause leaks.
of_node_put() will check if the node pointer is NULL, so we can call it directly to release the refcount of regular pointers.
--- sound/soc/mxs/mxs-sgtl5000.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/mxs/mxs-sgtl5000.c +3 -0
@@ -118,6 +118,9 @@ static int mxs_sgtl5000_probe(struct platform_device *pdev) codec_np =of_parse_phandle (np,"audio-codec" ,0 );if (!saif_np[0 ] || !saif_np[1 ] || !codec_np) {dev_err (&pdev->dev,"phandle missing or invalid\n" ); +of_node_put (codec_np); +of_node_put (saif_np[0 ]); +of_node_put (saif_np[1 ]);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 408/1126 ASoC: fsl_spdif: Disable TX clock when stop
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 6ddf611219ba8f7c8fa0d26b39710a641e7d37a5 ]
The TX clock source may be changed in next case, need to disable it when stop, otherwise the TX may not work after changing the clock source, error log is:
aplay: pcm_write:2058: write error: Input/output error
--- sound/soc/fsl/fsl_spdif.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/fsl/fsl_spdif.c +2 -0
@@ -610,6 +610,8 @@ static void fsl_spdif_shutdown(struct snd_pcm_substream *substream, mask =SCR_TXFIFO_AUTOSYNC_MASK |SCR_TXFIFO_CTRL_MASK |SCR_TXSEL_MASK |SCR_USRC_SEL_MASK |SCR_TXFIFO_FSEL_MASK ; +/* Disable TX clock */ +regmap_update_bits (regmap,REG_SPDIF_STC ,STC_TXCLK_ALL_EN_MASK ,0 ); }else { scr =SCR_RXFIFO_OFF |SCR_RXFIFO_CTL_ZERO ; mask = SCR_RXFIFO_FSEL_MASK | SCR_RXFIFO_AUTOSYNC_MASK|
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 409/1126 ASoC: imx-es8328: Fix error return code in imx_es8328_probe()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 3b891513f95cba3944e72c1139ea706d04f3781b ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- sound/soc/fsl/imx-es8328.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/imx-es8328.c +1 -0
@@ -87,6 +87,7 @@ static int imx_es8328_probe(struct platform_device *pdev)if (int_port >MUX_PORT_MAX || int_port ==0 ) {dev_err (dev,"mux-int-port: hardware only has %d mux ports\n" ,MUX_PORT_MAX ); + ret = -EINVAL ; goto fail; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 410/1126 ASoC: SOF: Intel: enable DMI L1 for playback streams
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
[ Upstream commit a174e72e2355b9025205b4b6727bf43047eac6c6 ]
Add back logic to mark all playback streams as L1 compatible.
--- sound/soc/sof/intel/hda-pcm.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/intel/hda-pcm.c +1 -0
@@ -315,6 +315,7 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev, runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE ;if (hda_always_enable_dmi_l1 || + direction ==SNDRV_PCM_STREAM_PLAYBACK || spcm->stream[substream->stream].d0i3_compatible) flags |=SOF_HDA_STREAM_DMI_L1_COMPATIBLE ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 411/1126 ASoC: msm8916-wcd-digital: Fix missing clk_disable_unprepare() in msm8916_wcd_digital_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 375a347da4889f64d86e1ab7f4e6702b6e9bf299 ]
Fix the missing clk_disable_unprepare() before return from msm8916_wcd_digital_probe in the error handling case.
--- sound/soc/codecs/msm8916-wcd-digital.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/msm8916-wcd-digital.c +4 -1
@@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) ret =clk_prepare_enable (priv->mclk);if (ret <0 ) {dev_err (dev,"failed to enable mclk %d\n" , ret); -return ret; + goto err_clk; }dev_set_drvdata (dev, priv);
@@ -1209,6 +1209,9 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)return devm_snd_soc_register_component (dev, &msm8916_wcd_digital, msm8916_wcd_digital_dai,ARRAY_SIZE (msm8916_wcd_digital_dai)); +err_clk: +clk_disable_unprepare (priv->ahbclk); +return ret; }static int msm8916_wcd_digital_remove (struct platform_device *pdev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 412/1126 mmc: davinci_mmc: Handle error for clk_enable
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 09e7af76db02c74f2a339b3cb2d95460fa2ddbe4 ]
As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.
--- drivers/mmc/host/davinci_mmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mmc/host/davinci_mmc.c +5 -1
@@ -1375,8 +1375,12 @@ static int davinci_mmcsd_suspend(struct device *dev)static int davinci_mmcsd_resume (struct device *dev) {struct mmc_davinci_host *host =dev_get_drvdata (dev); +int ret; + + ret =clk_enable (host->clk); +if (ret) +return ret; -clk_enable (host->clk);mmc_davinci_reset_ctrl (host,0 );return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 413/1126 rtla/osnoise: Fix osnoise hist stop tracing message
In reply to Greg Kroah-HartmanFrom: Daniel Bristot de Oliveira <[email protected]>
[ Upstream commit 7d38c35167c58153e8b5bea839616d00e90564b9 ]
rtla osnoise hist is printing the following message when hitting stop tracing:
printf("rtla timelat hit stop tracing\n");which is obviosly wrong.
s/timerlat/osnoise/ fixing the printf.
--- tools/tracing/rtla/src/osnoise_hist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/src/osnoise_hist.c +1 -1
@@ -782,7 +782,7 @@ int osnoise_hist_main(int argc, char *argv[]) return_value =0 ;if (!tracefs_trace_is_on (trace->inst)) { -printf ("rtla timelat hit stop tracing\n" ); +printf ("rtla osnoise hit stop tracing\n" );if (params->trace_output) {printf (" Saving trace to %s\n" , params->trace_output);save_trace_to_file (record->trace.inst, params->trace_output);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 414/1126 ASoC: rockchip: Fix PM usage reference of rockchip_i2s_tdm_resume
In reply to Greg Kroah-HartmanFrom: zhangqilong <[email protected]>
[ Upstream commit cc5d8ac95663a5813c696008bc524b794d471215 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. We fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- sound/soc/rockchip/rockchip_i2s_tdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/rockchip/rockchip_i2s_tdm.c +1 -1
@@ -1738,7 +1738,7 @@ static int __maybe_unused rockchip_i2s_tdm_resume(struct device *dev)struct rk_i2s_tdm_dev *i2s_tdm =dev_get_drvdata (dev);int ret; - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 )return ret; ret =regcache_sync (i2s_tdm->regmap);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 415/1126 ASoC: atmel: Fix error handling in sam9x5_wm8731_driver_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 740dc3e846537c3743da98bf106f376023fd085c ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error path.
--- sound/soc/atmel/sam9x5_wm8731.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
sound/soc/atmel/sam9x5_wm8731.c +7 -6
@@ -142,7 +142,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)if (!cpu_np) {dev_err (&pdev->dev,"atmel,ssc-controller node missing\n" ); ret = -EINVAL ; - goto out; + goto out_put_codec_np; } dai->cpus->of_node = cpu_np; dai->platforms->of_node = cpu_np;
@@ -153,12 +153,9 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)if (ret !=0 ) {dev_err (&pdev->dev,"Failed to set SSC %d for audio: %d\n" , ret, priv->ssc_id); - goto out; + goto out_put_cpu_np; } -of_node_put (codec_np); -of_node_put (cpu_np); - ret =devm_snd_soc_register_card (&pdev->dev, card);if (ret) {dev_err (&pdev->dev,"Platform device allocation failed\n" );
@@ -167,10 +164,14 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)dev_dbg (&pdev->dev,"%s ok\n" , __func__); -return ret; + goto out_put_cpu_np; out_put_audio:atmel_ssc_put_audio (priv->ssc_id); +out_put_cpu_np: +of_node_put (cpu_np); +out_put_codec_np: +of_node_put (codec_np); out:return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 416/1126 ASoC: msm8916-wcd-analog: Fix error handling in pm8916_wcd_analog_spmi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9ebd62d60edcd4d9c75485e5ccd0b79581ad3c49 ]
In the error handling path, the clk_prepare_enable() function call should be balanced by a corresponding 'clk_disable_unprepare()' call , as already done in the remove function.
--- sound/soc/codecs/msm8916-wcd-analog.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
sound/soc/codecs/msm8916-wcd-analog.c +16 -6
@@ -1222,8 +1222,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev) } irq =platform_get_irq_byname (pdev,"mbhc_switch_int" ); -if (irq <0 ) -return irq; +if (irq <0 ) { + ret = irq; + goto err_disable_clk; + } ret = devm_request_threaded_irq(dev, irq, NULL, pm8916_mbhc_switch_irq_handler,
@@ -1235,8 +1237,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)if (priv->mbhc_btn_enabled) { irq =platform_get_irq_byname (pdev,"mbhc_but_press_det" ); -if (irq <0 ) -return irq; +if (irq <0 ) { + ret = irq; + goto err_disable_clk; + } ret = devm_request_threaded_irq(dev, irq, NULL, mbhc_btn_press_irq_handler,
@@ -1247,8 +1251,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)dev_err (dev,"cannot request mbhc button press irq\n" ); irq =platform_get_irq_byname (pdev,"mbhc_but_rel_det" ); -if (irq <0 ) -return irq; +if (irq <0 ) { + ret = irq; + goto err_disable_clk; + } ret = devm_request_threaded_irq(dev, irq, NULL, mbhc_btn_release_irq_handler,
@@ -1265,6 +1271,10 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)return devm_snd_soc_register_component (dev, &pm8916_wcd_analog, pm8916_wcd_analog_dai,ARRAY_SIZE (pm8916_wcd_analog_dai)); + +err_disable_clk: +clk_disable_unprepare (priv->mclk); +return ret; }static int pm8916_wcd_analog_spmi_remove (struct platform_device *pdev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 417/1126 ASoC: mediatek: mt8195: Fix error handling in mt8195_mt6359_rt1019_rt5682_dev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit c4b7174fe5bb875a09a78674a14a1589d1a672f3 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error path.
--- sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c +3 -1
@@ -1342,7 +1342,8 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) "mediatek,dai-link");if (ret) {dev_dbg (&pdev->dev,"Parse dai-link fail\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_node; } }else {if (!sof_on)
@@ -1398,6 +1399,7 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) ret =devm_snd_soc_register_card (&pdev->dev, card); +put_node:of_node_put (platform_node);of_node_put (adsp_node);of_node_put (dp_node);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 418/1126 ASoC: codecs: wcd934x: Add missing of_node_put() in wcd934x_codec_parse_data
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9531a631379169d57756b2411178c6238655df88 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. This is similar to commit 64b92de9603f
("ASoC: wcd9335: fix a leaked reference by adding missing of_node_put")
--- sound/soc/codecs/wcd934x.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/wcd934x.c +1 -0
@@ -5886,6 +5886,7 @@ static int wcd934x_codec_parse_data(struct wcd934x_codec *wcd) } wcd->sidev =of_slim_get_device (wcd->sdev->ctrl, ifc_dev_np); +of_node_put (ifc_dev_np);if (!wcd->sidev) {dev_err (dev,"Unable to get SLIM Interface device\n" );return -EINVAL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 419/1126 ASoC: amd: Fix reference to PCM buffer address
In reply to Greg Kroah-HartmanFrom: Meng Tang <[email protected]>
[ Upstream commit 54e1bf9f6177a3ffbd920474f4481a25361163aa ]
PCM buffers might be allocated dynamically when the buffer preallocation failed or a larger buffer is requested, and it's not guaranteed that substream->dma_buffer points to the actually used buffer. The driver needs to refer to substream->runtime->dma_addr instead for the buffer address.
--- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/vangogh/acp5x-pcm-dma.c +1 -1
@@ -281,7 +281,7 @@ static int acp5x_dma_hw_params(struct snd_soc_component *component,return -EINVAL ; } size =params_buffer_bytes (params); - rtd->dma_addr = substream->dma_buffer.addr; + rtd->dma_addr = substream->runtime->dma_addr; rtd->num_pages = (PAGE_ALIGN (size) >>PAGE_SHIFT );config_acp5x_dma (rtd, substream->stream);return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 420/1126 ARM: configs: multi_v5_defconfig: re-enable CONFIG_V4L_PLATFORM_DRIVERS
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit f5eb04d7a0e419d61f784de3ced708259ddb71d7 ]
Commit 06b93644f4d1 ("media: Kconfig: add an option to filter in/out platform drivers") introduced CONFIG_MEDIA_PLATFORM_SUPPORT, to allow more fine grained control over the inclusion of certain Kconfig files. multi_v5_defconfig was selecting some drivers described in drivers/media/platform/Kconfig, which now wasn't included anymore.
Explicitly set the new symbol in multi_v5_defconfig to bring those drivers back.
This enables some new V4L2 and VIDEOBUF2 features, but as modules only.
--- arch/arm/configs/multi_v5_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v5_defconfig +1 -0
@@ -188,6 +188,7 @@ CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_MEDIA_SUPPORT=y CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_PLATFORM_SUPPORT=y CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_VIDEO_ASPEED=m CONFIG_VIDEO_ATMEL_ISI=m
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 421/1126 ARM: configs: multi_v5_defconfig: re-enable DRM_PANEL and FB_xxx
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit 9c44d0805f949c56121b4ae6949fb064537bf198 ]
Commit 91185d55b32e ("drm: Remove DRM_KMS_FB_HELPER Kconfig option") led to de-selection of CONFIG_FB, which was a prerequisite for BACKLIGHT_CLASS_DEVICE, which CONFIG_DRM_PANEL_SIMPLE depended on. Explicitly set CONFIG_FB, to bring DRM_PANEL_SIMPLE, DRM_PANEL_EDP, FB_IMX and FB_ATMEL back into the generated .config.
This also adds some new FB related features like fonts and the framebuffer console.
See also commit 8c1768967e27 ("ARM: config: mutli v7: Reenable FB dependency"), which solved the same problem for multi_v7_defconfig.
This relies on [1], to fix a broken Kconfig dependency.
[1] https://lore.kernel.org/dri-devel/[email protected]/raw
--- arch/arm/configs/multi_v5_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v5_defconfig +1 -0
@@ -197,6 +197,7 @@ CONFIG_DRM_ATMEL_HLCDC=m CONFIG_DRM_PANEL_SIMPLE=y CONFIG_DRM_PANEL_EDP=y CONFIG_DRM_ASPEED_GFX=m +CONFIG_FB=y CONFIG_FB_IMX=y CONFIG_FB_ATMEL=y CONFIG_BACKLIGHT_ATMEL_LCDC=y
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 422/1126 drm/bridge: sn65dsi83: Fix an error handling path in sn65dsi83_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 6edf615618b8259f16eeb1df98f0ba0d2312c22e ]
sn65dsi83_parse_dt() takes a reference on 'ctx->host_node' that must be released in the error handling path of this function and of the probe. This is only done in the remove function up to now.
--- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 32 +++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi83.c +23 -9
@@ -560,10 +560,14 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model) ctx->host_node =of_graph_get_remote_port_parent (endpoint);of_node_put (endpoint); -if (ctx->dsi_lanes <0 || ctx->dsi_lanes >4 ) -return -EINVAL ; -if (!ctx->host_node) -return -ENODEV ; +if (ctx->dsi_lanes <0 || ctx->dsi_lanes >4 ) { + ret = -EINVAL ; + goto err_put_node; + } +if (!ctx->host_node) { + ret = -ENODEV ; + goto err_put_node; + } ctx->lvds_dual_link = false; ctx->lvds_dual_link_even_odd_swap = false;
@@ -590,16 +594,22 @@ static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model) ret =drm_of_find_panel_or_bridge (dev->of_node,2 ,0 , &panel, &panel_bridge);if (ret <0 ) -return ret; + goto err_put_node;if (panel) { panel_bridge =devm_drm_panel_bridge_add (dev, panel); -if (IS_ERR (panel_bridge)) -return PTR_ERR (panel_bridge); +if (IS_ERR (panel_bridge)) { + ret =PTR_ERR (panel_bridge); + goto err_put_node; + } } ctx->panel_bridge = panel_bridge;return 0 ; + +err_put_node: +of_node_put (ctx->host_node); +return ret; }static int sn65dsi83_host_attach (struct sn65dsi83 *ctx)
@@ -673,8 +683,10 @@ static int sn65dsi83_probe(struct i2c_client *client,return ret; ctx->regmap =devm_regmap_init_i2c (client, &sn65dsi83_regmap_config); -if (IS_ERR (ctx->regmap)) -return PTR_ERR (ctx->regmap); +if (IS_ERR (ctx->regmap)) { + ret =PTR_ERR (ctx->regmap); + goto err_put_node; + }dev_set_drvdata (dev, ctx);i2c_set_clientdata (client, ctx);
@@ -691,6 +703,8 @@ static int sn65dsi83_probe(struct i2c_client *client, err_remove_bridge:drm_bridge_remove (&ctx->bridge); +err_put_node: +of_node_put (ctx->host_node);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 423/1126 drm/meson: osd_afbcd: Add an exit callback to struct meson_afbcd_ops
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 04b8a5d9cfd171f65df75f444b5617a372649edd ]
Use this to simplify the driver shutdown. It will also come handy when fixing the error handling in meson_drv_bind_master().
--- drivers/gpu/drm/meson/meson_drv.c | 6 ++-- drivers/gpu/drm/meson/meson_osd_afbcd.c | 41 ++++++++++++++++--------- drivers/gpu/drm/meson/meson_osd_afbcd.h | 1 + 3 files changed, 30 insertions(+), 18 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +2 -4
@@ -385,10 +385,8 @@ static void meson_drv_unbind(struct device *dev)free_irq (priv->vsync_irq, drm);drm_dev_put (drm); -if (priv->afbcd.ops) { - priv->afbcd.ops->reset (priv); -meson_rdma_free (priv); - } +if (priv->afbcd.ops) + priv->afbcd.ops->exit (priv); }static const struct component_master_ops meson_drv_master_ops = {
drivers/gpu/drm/meson/meson_osd_afbcd.c +27 -14
78 lines not on this page · raw message
drivers/gpu/drm/meson/meson_osd_afbcd.h +1 -0
@@ -14,6 +14,7 @@struct meson_afbcd_ops {int (*init)(struct meson_drm *priv); +void (*exit)(struct meson_drm *priv);int (*reset)(struct meson_drm *priv);int (*enable)(struct meson_drm *priv);int (*disable)(struct meson_drm *priv);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 424/1126 drm/meson: Fix error handling when afbcd.ops->init fails
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit fa747d75f65d1b1cbc3f4691fa67b695e8a399c8 ]
When afbcd.ops->init fails we need to free the struct drm_device. Also all errors which come after afbcd.ops->init was successful need to exit the AFBCD, just like meson_drv_unbind() does.
--- drivers/gpu/drm/meson/meson_drv.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +11 -8
@@ -302,42 +302,42 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)if (priv->afbcd.ops) { ret = priv->afbcd.ops->init (priv);if (ret) -return ret; + goto free_drm; }/* Encoder Initialization */ ret =meson_encoder_cvbs_init (priv);if (ret) - goto free_drm; + goto exit_afbcd;if (has_components) { ret =component_bind_all (drm->dev, drm);if (ret) {dev_err (drm->dev,"Couldn't bind all components\n" ); - goto free_drm; + goto exit_afbcd; } } ret =meson_encoder_hdmi_init (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =meson_plane_create (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =meson_overlay_create (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =meson_crtc_create (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =request_irq (priv->vsync_irq, meson_irq,0 , drm->driver->name, drm);if (ret) - goto free_drm; + goto exit_afbcd;drm_mode_config_reset (drm);
@@ -355,6 +355,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) uninstall_irq:free_irq (priv->vsync_irq, drm); +exit_afbcd: +if (priv->afbcd.ops) + priv->afbcd.ops->exit (priv); free_drm:drm_dev_put (drm);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 425/1126 drm/bridge: Fix free wrong object in sii8620_init_rcp_input_dev
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 7c442e76c06cb1bef16a6c523487438175584eea ]
rc_dev is allocated by rc_allocate_device(), and doesn't assigned to ctx->rc_dev before calling rc_free_device(ctx->rc_dev). So it should call rc_free_device(rc_dev);
--- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/sil-sii8620.c +1 -1
@@ -2120,7 +2120,7 @@ static void sii8620_init_rcp_input_dev(struct sii8620 *ctx)if (ret) {dev_err (ctx->dev,"Failed to register RC device\n" ); ctx->error = ret; -rc_free_device (ctx->rc_dev); +rc_free_device (rc_dev);return ; } ctx->rc_dev = rc_dev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 426/1126 drm/bridge: Add missing pm_runtime_disable() in __dw_mipi_dsi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 96211b7c56b109a52768e6cc5e23a1f79316eca0 ]
If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().
Add missing pm_runtime_disable() for __dw_mipi_dsi_probe.
--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -0
@@ -1199,6 +1199,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev, ret =mipi_dsi_host_register (&dsi->dsi_host);if (ret) {dev_err (dev,"Failed to register MIPI host: %d\n" , ret); +pm_runtime_disable (dev);dw_mipi_dsi_debugfs_remove (dsi);return ERR_PTR (ret); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 427/1126 drm/bridge: nwl-dsi: Fix PM disable depth imbalance in nwl_dsi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b146e343a9e05605b491b1bf4a2b62a39d5638d8 ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context.
--- drivers/gpu/drm/bridge/nwl-dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/nwl-dsi.c +1 -0
@@ -1204,6 +1204,7 @@ static int nwl_dsi_probe(struct platform_device *pdev) ret =nwl_dsi_select_input (dsi);if (ret <0 ) { +pm_runtime_disable (dev);mipi_dsi_host_unregister (&dsi->dsi_host);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 428/1126 drm: bridge: adv7511: Fix ADV7535 HPD enablement
In reply to Greg Kroah-HartmanFrom: Jagan Teki <[email protected]>
[ Upstream commit 3dbc84a595d17f64f14fcea00120d31e33e98880 ]
Existing HPD enablement logic is not compatible with ADV7535 bridge, thus any runtime plug-in of HDMI cable is not working on these bridge designs.
Unlike other ADV7511 family of bridges, the ADV7535 require HPD_OVERRIDE bit to set and reset for proper handling of HPD functionality.
Fix it.
--- drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 29 +++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511.h +1 -0
@@ -169,6 +169,7 @@#define ADV7511_PACKET_ENABLE_SPARE2 BIT(1)#define ADV7511_PACKET_ENABLE_SPARE1 BIT(0) +#define ADV7535_REG_POWER2_HPD_OVERRIDE BIT(6)#define ADV7511_REG_POWER2_HPD_SRC_MASK 0xc0#define ADV7511_REG_POWER2_HPD_SRC_BOTH 0x00#define ADV7511_REG_POWER2_HPD_SRC_HPD 0x40
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +22 -7
@@ -351,11 +351,17 @@ static void __adv7511_power_on(struct adv7511 *adv7511)* from standby or are enabled. When the HPD goes low the adv7511 is * reset and the outputs are disabled which might cause the monitor to * go to standby again. To avoid this we ignore the HPD pin for the -* first few seconds after enabling the output. +* first few seconds after enabling the output. On the other hand +* adv7535 require to enable HPD Override bit for proper HPD. */ -regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , -ADV7511_REG_POWER2_HPD_SRC_MASK , -ADV7511_REG_POWER2_HPD_SRC_NONE ); +if (adv7511->type ==ADV7535 ) +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7535_REG_POWER2_HPD_OVERRIDE , +ADV7535_REG_POWER2_HPD_OVERRIDE ); +else +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7511_REG_POWER2_HPD_SRC_MASK , +ADV7511_REG_POWER2_HPD_SRC_NONE ); }static void adv7511_power_on (struct adv7511 *adv7511)
@@ -375,6 +381,10 @@ static void adv7511_power_on(struct adv7511 *adv7511)static void __adv7511_power_off (struct adv7511 *adv7511) {/* TODO: setup additional power down modes */ +if (adv7511->type ==ADV7535 ) +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7535_REG_POWER2_HPD_OVERRIDE ,0 ); +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER ,ADV7511_POWER_POWER_DOWN ,ADV7511_POWER_POWER_DOWN );
@@ -672,9 +682,14 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector) status = connector_status_disconnected; }else {/* Renable HPD sensing */ -regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , -ADV7511_REG_POWER2_HPD_SRC_MASK , -ADV7511_REG_POWER2_HPD_SRC_BOTH ); +if (adv7511->type ==ADV7535 ) +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7535_REG_POWER2_HPD_OVERRIDE , +ADV7535_REG_POWER2_HPD_OVERRIDE ); +else +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7511_REG_POWER2_HPD_SRC_MASK , +ADV7511_REG_POWER2_HPD_SRC_BOTH ); } adv7511->status = status;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 429/1126 ath11k: add missing of_node_put() to avoid leak
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 3d38faef0de1756994b3d95e47b2302842f729e2 ]
The node pointer is returned by of_find_node_by_type() or of_parse_phandle() with refcount incremented. Calling of_node_put() to aovid the refcount leak.
--- drivers/net/wireless/ath/ath11k/mhi.c | 1 + drivers/net/wireless/ath/ath11k/qmi.c | 1 + 2 files changed, 2 insertions(+)
drivers/net/wireless/ath/ath11k/mhi.c +1 -0
@@ -332,6 +332,7 @@ static int ath11k_mhi_read_addr_from_dt(struct mhi_controller *mhi_ctrl)return -ENOENT ; ret =of_address_to_resource (np,0 , &res); +of_node_put (np);if (ret)return ret;
drivers/net/wireless/ath/ath11k/qmi.c +1 -0
@@ -1936,6 +1936,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab) } ret =of_address_to_resource (hremote_node,0 , &res); +of_node_put (hremote_node);if (ret) {ath11k_dbg (ab,ATH11K_DBG_QMI ,"qmi fail to get reg from hremote\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 430/1126 ath10k: fix memory overwrite of the WoWLAN wakeup packet pattern
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit e3fb3d4418fce5484dfe7995fcd94c18b10a431a ]
In function ath10k_wow_convert_8023_to_80211(), it will do memcpy for the new->pattern, and currently the new->pattern and new->mask is same with the old, then the memcpy of new->pattern will also overwrite the old->pattern, because the header format of new->pattern is 802.11, its length is larger than the old->pattern which is 802.3. Then the operation of "Copy frame body" will copy a mistake value because the body memory has been overwrite when memcpy the new->pattern.
Assign another empty value to new_pattern to avoid the overwrite issue.
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049
--- drivers/net/wireless/ath/ath10k/wow.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wow.c +4 -3
@@ -337,14 +337,15 @@ static int ath10k_vif_wow_set_wakeups(struct ath10k_vif *arvif,if (patterns[i].mask[j /8 ] &BIT (j %8 )) bitmask[j] =0xff ; old_pattern.mask = bitmask; - new_pattern = old_pattern;if (ar->wmi.rx_decap_mode ==ATH10K_HW_TXRX_NATIVE_WIFI ) { -if (patterns[i].pkt_offset <ETH_HLEN ) +if (patterns[i].pkt_offset <ETH_HLEN ) {ath10k_wow_convert_8023_to_80211 (&new_pattern, &old_pattern); -else + }else { + new_pattern = old_pattern; new_pattern.pkt_offset +=WOW_HDR_LEN -ETH_HLEN ; + } }if (WARN_ON (new_pattern.pattern_len >WOW_MAX_PATTERN_SIZE ))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 431/1126 drm/v3d/v3d_drv: Check for error num after setting mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 4a39156166b90465da0f9a33b3442d63b5651bec ]
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails.
Also, we can create a variable for the mask to solve the alignment issue.
--- drivers/gpu/drm/v3d/v3d_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +6 -2
@@ -219,6 +219,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)int ret;u32 mmu_debug;u32 ident1; +u64 mask; v3d = devm_drm_dev_alloc(dev, &v3d_drm_driver, struct v3d_dev, drm);if (IS_ERR (v3d))
@@ -237,8 +238,11 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)return ret; mmu_debug =V3D_READ (V3D_MMU_DEBUG_INFO ); -dma_set_mask_and_coherent (dev, -DMA_BIT_MASK (30 +V3D_GET_FIELD (mmu_debug,V3D_MMU_PA_WIDTH ))); + mask =DMA_BIT_MASK (30 +V3D_GET_FIELD (mmu_debug,V3D_MMU_PA_WIDTH )); + ret =dma_set_mask_and_coherent (dev, mask); +if (ret) +return ret; + v3d->va_width =30 +V3D_GET_FIELD (mmu_debug,V3D_MMU_VA_WIDTH ); ident1 =V3D_READ (V3D_HUB_IDENT1 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 432/1126 Bluetooth: hci_sync: unlock on error in hci_inquiry_result_with_rssi_evt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c07ba878ca199a6089cdb323bf526adbeeb4201f ]
Add unlocks to two error paths in hci_inquiry_result_with_rssi_evt().
--- net/bluetooth/hci_event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/hci_event.c +3 -3
@@ -4534,7 +4534,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,if (!info) {bt_dev_err (hdev,"Malformed HCI Event: 0x%2.2x" ,HCI_EV_INQUIRY_RESULT_WITH_RSSI ); -return ; + goto unlock; }bacpy (&data.bdaddr, &info->bdaddr);
@@ -4565,7 +4565,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,if (!info) {bt_dev_err (hdev,"Malformed HCI Event: 0x%2.2x" ,HCI_EV_INQUIRY_RESULT_WITH_RSSI ); -return ; + goto unlock; }bacpy (&data.bdaddr, &info->bdaddr);
@@ -4587,7 +4587,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,bt_dev_err (hdev,"Malformed HCI Event: 0x%2.2x" ,HCI_EV_INQUIRY_RESULT_WITH_RSSI ); } - +unlock:hci_dev_unlock (hdev); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 433/1126 ath11k: free peer for station when disconnect from AP for QCA6390/WCN6855
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 212ad7cb7d7592669c067125949e0a8e31ce6a0b ]
Commit b4a0f54156ac ("ath11k: move peer delete after vdev stop of station for QCA6390 and WCN6855") is to fix firmware crash by changing the WMI command sequence, but actually skip all the peer delete operation, then it lead commit 58595c9874c6 ("ath11k: Fixing dangling pointer issue upon peer delete failure") not take effect, and then happened a use-after-free warning from KASAN. because the peer->sta is not set to NULL and then used later.
Change to only skip the WMI_PEER_DELETE_CMDID for QCA6390/WCN6855.
log of user-after-free:
[ 534.888665] BUG: KASAN: use-after-free in ath11k_dp_rx_update_peer_stats+0x912/0xc10 [ath11k] [ 534.888696] Read of size 8 at addr ffff8881396bb1b8 by task rtcwake/2860
[ 534.888705] CPU: 4 PID: 2860 Comm: rtcwake Kdump: loaded Tainted: G W 5.15.0-wt-ath+ #523 [ 534.888712] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0067.2021.0528.1339 05/28/2021 [ 534.888716] Call Trace: [ 534.888720] <IRQ> [ 534.888726] dump_stack_lvl+0x57/0x7d [ 534.888736] print_address_description.constprop.0+0x1f/0x170 [ 534.888745] ? ath11k_dp_rx_update_peer_stats+0x912/0xc10 [ath11k] [ 534.888771] kasan_report.cold+0x83/0xdf [ 534.888783] ? ath11k_dp_rx_update_peer_stats+0x912/0xc10 [ath11k] [ 534.888810] ath11k_dp_rx_update_peer_stats+0x912/0xc10 [ath11k] [ 534.888840] ath11k_dp_rx_process_mon_status+0x529/0xa70 [ath11k] [ 534.888874] ? ath11k_dp_rx_mon_status_bufs_replenish+0x3f0/0x3f0 [ath11k] [ 534.888897] ? check_prev_add+0x20f0/0x20f0 [ 534.888922] ? __lock_acquire+0xb72/0x1870 [ 534.888937] ? find_held_lock+0x33/0x110 [ 534.888954] ath11k_dp_rx_process_mon_rings+0x297/0x520 [ath11k] [ 534.888981] ? rcu_read_unlock+0x40/0x40 [ 534.888990] ? ath11k_dp_rx_pdev_alloc+0xd90/0xd90 [ath11k] [ 534.889026] ath11k_dp_service_mon_ring+0x67/0xe0 [ath11k] [ 534.889053] ? ath11k_dp_rx_process_mon_rings+0x520/0x520 [ath11k] [ 534.889075] call_timer_fn+0x167/0x4a0 [ 534.889084] ? add_timer_on+0x3b0/0x3b0 [ 534.889103] ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370 [ 534.889117] __run_timers.part.0+0x539/0x8b0 [ 534.889123] ? ath11k_dp_rx_process_mon_rings+0x520/0x520 [ath11k] [ 534.889157] ? call_timer_fn+0x4a0/0x4a0 [ 534.889164] ? mark_lock_irq+0x1c30/0x1c30 [ 534.889173] ? clockevents_program_event+0xdd/0x280 [ 534.889189] ? mark_held_locks+0xa5/0xe0 [ 534.889203] run_timer_softirq+0x97/0x180 [ 534.889213] __do_softirq+0x276/0x86a [ 534.889230] __irq_exit_rcu+0x11c/0x180 [ 534.889238] irq_exit_rcu+0x5/0x20 [ 534.889244] sysvec_apic_timer_interrupt+0x8e/0xc0 [ 534.889251] </IRQ> [ 534.889254] <TASK> [ 534.889259] asm_sysvec_apic_timer_interrupt+0x12/0x20 [ 534.889265] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 [ 534.889271] Code: 74 24 10 e8 ea c2 bf fd 48 89 ef e8 12 53 c0 fd 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 <e8> 13 a7 b5 fd 65 8b 05 cc d9 9c 5e 85 c0 74 0a 5b 5d c3 e8 a0 ee [ 534.889276] RSP: 0018:ffffc90002e5f880 EFLAGS: 00000206 [ 534.889284] RAX: 0000000000000006 RBX: 0000000000000200 RCX: ffffffff9f256f10 [ 534.889289] RDX: 0000000000000000 RSI: ffffffffa1c6e420 RDI: 0000000000000001 [ 534.889293] RBP: ffff8881095e6200 R08: 0000000000000001 R09: ffffffffa40d2b8f [ 534.889298] R10: fffffbfff481a571 R11: 0000000000000001 R12: ffff8881095e6e68 [ 534.889302] R13: ffffc90002e5f908 R14: 0000000000000246 R15: 0000000000000000 [ 534.889316] ? mark_lock+0xd0/0x14a0 [ 534.889332] klist_next+0x1d4/0x450 [ 534.889340] ? dpm_wait_for_subordinate+0x2d0/0x2d0 [ 534.889350] device_for_each_child+0xa8/0x140 [ 534.889360] ? device_remove_class_symlinks+0x1b0/0x1b0 [ 534.889370] ? __lock_release+0x4bd/0x9f0 [ 534.889378] ? dpm_suspend+0x26b/0x3f0 [ 534.889390] dpm_wait_for_subordinate+0x82/0x2d0 [ 534.889400] ? dpm_for_each_dev+0xa0/0xa0 [ 534.889410] ? dpm_suspend+0x233/0x3f0 [ 534.889427] __device_suspend+0xd4/0x10c0 [ 534.889440] ? wait_for_completion_io+0x270/0x270 [ 534.889456] ? async_suspend_late+0xe0/0xe0 [ 534.889463] ? async_schedule_node_domain+0x468/0x640 [ 534.889482] dpm_suspend+0x25a/0x3f0 [ 534.889491] ? dpm_suspend_end+0x1a0/0x1a0 [ 534.889497] ? ktime_get+0x214/0x2f0 [ 534.889502] ? lockdep_hardirqs_on+0x79/0x100 [ 534.889509] ? recalibrate_cpu_khz+0x10/0x10 [ 534.889516] ? ktime_get+0x119/0x2f0 [ 534.889528] dpm_suspend_start+0xab/0xc0 [ 534.889538] suspend_devices_and_enter+0x1ca/0x350 [ 534.889546] ? suspend_enter+0x850/0x850 [ 534.889566] enter_state+0x27c/0x3d7 [ 534.889575] pm_suspend.cold+0x42/0x189 [ 534.889583] state_store+0xab/0x160 [ 534.889595] ? sysfs_file_ops+0x160/0x160 [ 534.889601] kernfs_fop_write_iter+0x2b5/0x450 [ 534.889615] new_sync_write+0x36a/0x600 [ 534.889625] ? new_sync_read+0x600/0x600 [ 534.889639] ? rcu_read_unlock+0x40/0x40 [ 534.889668] vfs_write+0x619/0x910 [ 534.889681] ksys_write+0xf4/0x1d0 [ 534.889689] ? __ia32_sys_read+0xa0/0xa0 [ 534.889699] ? lockdep_hardirqs_on_prepare.part.0+0x18c/0x370 [ 534.889707] ? syscall_enter_from_user_mode+0x1d/0x50 [ 534.889719] do_syscall_64+0x3b/0x90 [ 534.889725] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 534.889731] RIP: 0033:0x7f0b9bc931e7 [ 534.889736] Code: 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 [ 534.889741] RSP: 002b:00007ffd9d34cc88 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 534.889749] RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f0b9bc931e7 [ 534.889753] RDX: 0000000000000004 RSI: 0000561cd023c5f0 RDI: 0000000000000004 [ 534.889757] RBP: 0000561cd023c5f0 R08: 0000000000000000 R09: 0000000000000004 [ 534.889761] R10: 0000561ccef842a6 R11: 0000000000000246 R12: 0000000000000004 [ 534.889765] R13: 0000561cd0239590 R14: 00007f0b9bd6f4a0 R15: 00007f0b9bd6e8a0 [ 534.889789] </TASK>
[ 534.889796] Allocated by task 2711: [ 534.889800] kasan_save_stack+0x1b/0x40 [ 534.889805] __kasan_kmalloc+0x7c/0x90 [ 534.889810] sta_info_alloc+0x98/0x1ef0 [mac80211] [ 534.889874] ieee80211_prep_connection+0x30b/0x11e0 [mac80211] [ 534.889950] ieee80211_mgd_auth+0x529/0xe00 [mac80211] [ 534.890024] cfg80211_mlme_auth+0x332/0x6f0 [cfg80211] [ 534.890090] nl80211_authenticate+0x839/0xcf0 [cfg80211] [ 534.890147] genl_family_rcv_msg_doit+0x1f4/0x2f0 [ 534.890154] genl_rcv_msg+0x280/0x500 [ 534.890160] netlink_rcv_skb+0x11c/0x340 [ 534.890165] genl_rcv+0x1f/0x30 [ 534.890170] netlink_unicast+0x42b/0x700 [ 534.890176] netlink_sendmsg+0x71b/0xc60 [ 534.890181] sock_sendmsg+0xdf/0x110 [ 534.890187] ____sys_sendmsg+0x5c0/0x850 [ 534.890192] ___sys_sendmsg+0xe4/0x160 [ 534.890197] __sys_sendmsg+0xb2/0x140 [ 534.890202] do_syscall_64+0x3b/0x90 [ 534.890207] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 534.890215] Freed by task 2825: [ 534.890218] kasan_save_stack+0x1b/0x40 [ 534.890223] kasan_set_track+0x1c/0x30 [ 534.890227] kasan_set_free_info+0x20/0x30 [ 534.890232] __kasan_slab_free+0xce/0x100 [ 534.890237] slab_free_freelist_hook+0xf0/0x1a0 [ 534.890242] kfree+0xe5/0x370 [ 534.890248] __sta_info_flush+0x333/0x4b0 [mac80211] [ 534.890308] ieee80211_set_disassoc+0x324/0xd20 [mac80211] [ 534.890382] ieee80211_mgd_deauth+0x537/0xee0 [mac80211] [ 534.890472] cfg80211_mlme_deauth+0x349/0x810 [cfg80211] [ 534.890526] cfg80211_mlme_down+0x1ce/0x270 [cfg80211] [ 534.890578] cfg80211_disconnect+0x4f5/0x7b0 [cfg80211] [ 534.890631] cfg80211_leave+0x24/0x40 [cfg80211] [ 534.890677] wiphy_suspend+0x23d/0x2f0 [cfg80211] [ 534.890723] dpm_run_callback+0xf4/0x1b0 [ 534.890728] __device_suspend+0x648/0x10c0 [ 534.890733] async_suspend+0x16/0xe0 [ 534.890737] async_run_entry_fn+0x90/0x4f0 [ 534.890741] process_one_work+0x866/0x1490 [ 534.890747] worker_thread+0x596/0x1010 [ 534.890751] kthread+0x35d/0x420 [ 534.890756] ret_from_fork+0x22/0x30
[ 534.890763] The buggy address belongs to the object at ffff8881396ba000
which belongs to the cache kmalloc-8k of size 8192
[ 534.890767] The buggy address is located 4536 bytes inside of
8192-byte region [ffff8881396ba000, ffff8881396bc000)
[ 534.890772] The buggy address belongs to the page:
[ 534.890775] page:ffffea0004e5ae00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1396b8
[ 534.890780] head:ffffea0004e5ae00 order:3 compound_mapcount:0 compound_pincount:0
[ 534.890784] flags: 0x200000000010200(slab|head|node=0|zone=2)
[ 534.890791] raw: 0200000000010200 ffffea000562be08 ffffea0004b04c08 ffff88810004e340
[ 534.890795] raw: 0000000000000000 0000000000010001 00000001ffffffff 0000000000000000
[ 534.890798] page dumped because: kasan: bad access detected[ 534.890804] Memory state around the buggy address: [ 534.890807] ffff8881396bb080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 534.890811] ffff8881396bb100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 534.890814] >ffff8881396bb180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 534.890817] ^ [ 534.890821] ffff8881396bb200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 534.890824] ffff8881396bb280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 534.890827] ================================================================== [ 534.890830] Disabling lock debugging due to kernel taint
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/mac.c | 31 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +18 -13
@@ -4504,24 +4504,30 @@ static int ath11k_mac_op_sta_state(struct ieee80211_hw *hw, sta->addr, arvif->vdev_id); }else if ((old_state ==IEEE80211_STA_NONE && new_state ==IEEE80211_STA_NOTEXIST )) { -ath11k_dp_peer_cleanup (ar, arvif->vdev_id, sta->addr); +bool skip_peer_delete = ar->ab->hw_params.vdev_start_delay && + vif->type ==NL80211_IFTYPE_STATION ; -if (ar->ab->hw_params.vdev_start_delay && - vif->type ==NL80211_IFTYPE_STATION ) - goto free; +ath11k_dp_peer_cleanup (ar, arvif->vdev_id, sta->addr); - ret =ath11k_peer_delete (ar, arvif->vdev_id, sta->addr); -if (ret) -ath11k_warn (ar->ab,"Failed to delete peer: %pM for VDEV: %d\n" , - sta->addr, arvif->vdev_id); -else -ath11k_dbg (ar->ab,ATH11K_DBG_MAC ,"Removed peer: %pM for VDEV: %d\n" , - sta->addr, arvif->vdev_id); +if (!skip_peer_delete) { + ret =ath11k_peer_delete (ar, arvif->vdev_id, sta->addr); +if (ret) +ath11k_warn (ar->ab, +"Failed to delete peer: %pM for VDEV: %d\n" , + sta->addr, arvif->vdev_id); +else +ath11k_dbg (ar->ab, +ATH11K_DBG_MAC , +"Removed peer: %pM for VDEV: %d\n" , + sta->addr, arvif->vdev_id); + }ath11k_mac_dec_num_stations (arvif, sta);spin_lock_bh (&ar->ab->base_lock); peer =ath11k_peer_find (ar->ab, arvif->vdev_id, sta->addr); -if (peer && peer->sta == sta) { +if (skip_peer_delete && peer) { + peer->sta =NULL ; + }else if (peer && peer->sta == sta) {ath11k_warn (ar->ab,"Found peer entry %pM n vdev %i after it was supposedly removed\n" , vif->addr, arvif->vdev_id); peer->sta =NULL ;
@@ -4531,7 +4537,6 @@ static int ath11k_mac_op_sta_state(struct ieee80211_hw *hw, }spin_unlock_bh (&ar->ab->base_lock); -free:kfree (arsta->tx_stats); arsta->tx_stats =NULL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 434/1126 drm/panfrost: Check for error num after setting mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 44ab30b056149bd59dd7989a593dd25ead6007fd ]
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/panfrost/panfrost_gpu.c +4 -1
@@ -360,8 +360,11 @@ int panfrost_gpu_init(struct panfrost_device *pfdev)panfrost_gpu_init_features (pfdev); -dma_set_mask_and_coherent (pfdev->dev, + err =dma_set_mask_and_coherent (pfdev->dev,DMA_BIT_MASK (FIELD_GET (0xff00 , pfdev->features.mmu_features))); +if (err) +return err; +dma_set_max_seg_size (pfdev->dev,UINT_MAX ); irq =platform_get_irq_byname (to_platform_device (pfdev->dev),"gpu" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 435/1126 bpftool: Fix error check when calling hashmap__new()
In reply to Greg Kroah-HartmanFrom: Mauricio Vásquez <[email protected]>
[ Upstream commit 622a5b582cc27d3deedc38fcef68da2972e8e58d ]
hashmap__new() encodes errors with ERR_PTR(), hence it's not valid to check the returned pointer against NULL and IS_ERR() has to be used instead.
libbpf_get_error() can't be used in this case as hashmap__new() is not part of the public libbpf API and it'll continue using ERR_PTR() after libbpf 1.0.
--- tools/bpf/bpftool/btf.c | 2 +- tools/bpf/bpftool/link.c | 3 ++- tools/bpf/bpftool/map.c | 2 +- tools/bpf/bpftool/pids.c | 3 ++- tools/bpf/bpftool/prog.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-)
tools/bpf/bpftool/btf.c +1 -1
@@ -902,7 +902,7 @@ static int do_show(int argc, char **argv) equal_fn_for_key_as_id, NULL); btf_map_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!btf_prog_table || !btf_map_table) { +if (IS_ERR (btf_prog_table) ||IS_ERR (btf_map_table)) {hashmap__free (btf_prog_table);hashmap__free (btf_map_table);if (fd >=0 )
tools/bpf/bpftool/link.c +2 -1
@@ -2,6 +2,7 @@/* Copyright (C) 2020 Facebook */ #include <errno.h> +#include <linux/err.h> #include <net/if.h> #include <stdio.h> #include <unistd.h>
@@ -306,7 +307,7 @@ static int do_show(int argc, char **argv)if (show_pinned) { link_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!link_table) { +if (IS_ERR (link_table)) {p_err ("failed to create hashmap for pinned paths" );return -1 ; }
tools/bpf/bpftool/map.c +1 -1
@@ -699,7 +699,7 @@ static int do_show(int argc, char **argv)if (show_pinned) { map_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!map_table) { +if (IS_ERR (map_table)) {p_err ("failed to create hashmap for pinned paths" );return -1 ; }
tools/bpf/bpftool/pids.c +2 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2020 Facebook */ #include <errno.h> +#include <linux/err.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h>
@@ -101,7 +102,7 @@ int build_obj_refs_table(struct hashmap **map, enum bpf_obj_type type)libbpf_print_fn_t default_print; *map =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!*map) { +if (IS_ERR (*map)) {p_err ("failed to create hashmap for PID references" );return -1 ; }
tools/bpf/bpftool/prog.c +1 -1
@@ -641,7 +641,7 @@ static int do_show(int argc, char **argv)if (show_pinned) { prog_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!prog_table) { +if (IS_ERR (prog_table)) {p_err ("failed to create hashmap for pinned paths" );return -1 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 436/1126 libbpf: Fix possible NULL pointer dereference when destroying skeleton
In reply to Greg Kroah-HartmanFrom: Yafang Shao <[email protected]>
[ Upstream commit a32ea51a3f17ce6524c9fc19d311e708331c8b5f ]
When I checked the code in skeleton header file generated with my own bpf prog, I found there may be possible NULL pointer dereference when destroying skeleton. Then I checked the in-tree bpf progs, finding that is a common issue. Let's take the generated samples/bpf/xdp_redirect_cpu.skel.h for example. Below is the generated code in xdp_redirect_cpu__create_skeleton():
xdp_redirect_cpu__create_skeleton struct bpf_object_skeleton *s; s = (struct bpf_object_skeleton *)calloc(1, sizeof(*s)); if (!s) goto error; ... error: bpf_object__destroy_skeleton(s); return -ENOMEM;
After goto error, the NULL 's' will be deferenced in bpf_object__destroy_skeleton().
We can simply fix this issue by just adding a NULL check in bpf_object__destroy_skeleton().
--- tools/lib/bpf/libbpf.c | 3 +++ 1 file changed, 3 insertions(+)
tools/lib/bpf/libbpf.c +3 -0
@@ -11795,6 +11795,9 @@ void bpf_object__detach_skeleton(struct bpf_object_skeleton *s)void bpf_object__destroy_skeleton (struct bpf_object_skeleton *s) { +if (!s) +return ; +if (s->progs)bpf_object__detach_skeleton (s);if (s->obj)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 437/1126 bpftool: Only set obj->skeleton on complete success
In reply to Greg Kroah-HartmanFrom: Wei Fu <[email protected]>
[ Upstream commit 0991f6a38f576aa9a5e34713e23c998a3310d4d0 ]
After bpftool gen skeleton, the ${bpf_app}.skel.h will provide that ${bpf_app_name}__open helper to load bpf. If there is some error like ENOMEM, the ${bpf_app_name}__open will rollback(free) the allocated object, including bpf_object_skeleton.
Since the ${bpf_app_name}__create_skeleton set the obj->skeleton first and not rollback it when error, it will cause double-free in ${bpf_app_name}__destory at ${bpf_app_name}__open. Therefore, we should set the obj->skeleton before return 0;
--- tools/bpf/bpftool/gen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/gen.c +1 -1
@@ -927,7 +927,6 @@ static int do_skeleton(int argc, char **argv) s = (struct bpf_object_skeleton *)calloc(1, sizeof(*s));\n\ if (!s) \n\ goto err; \n\ - obj->skeleton = s; \n\ \n\ s->sz = sizeof(*s); \n\ s->name = \"%1$s\"; \n\
@@ -1000,6 +999,7 @@ static int do_skeleton(int argc, char **argv) \n\ s->data = (void *)%2$s__elf_bytes(&s->data_sz); \n\ \n\ + obj->skeleton = s; \n\ return 0; \n\ err: \n\ bpf_object__destroy_skeleton(s); \n\
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 438/1126 ath11k: fix error code in ath11k_qmi_assign_target_mem_chunk()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c9b41832dc080fa59bad597de94865b3ea2d5bab ]
The "ret" vairable is not set at this point. It could be uninitialized or zero. The correct thing to return is -ENODEV.
--- drivers/net/wireless/ath/ath11k/qmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/qmi.c +1 -1
@@ -1932,7 +1932,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)if (!hremote_node) {ath11k_dbg (ab,ATH11K_DBG_QMI ,"qmi fail to get hremote_node\n" ); -return ret; +return -ENODEV ; } ret =of_address_to_resource (hremote_node,0 , &res);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 439/1126 udmabuf: validate ubuf->pagecount
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2b6dd600dd72573c23ea180b5b0b2f1813405882 ]
Syzbot has reported GPF in sg_alloc_append_table_from_pages(). The problem was in ubuf->pages == ZERO_PTR.
ubuf->pagecount is calculated from arguments passed from user-space. If user creates udmabuf with list.size == 0 then ubuf->pagecount will be also equal to zero; it causes kmalloc_array() to return ZERO_PTR.
Fix it by validating ubuf->pagecount before passing it to kmalloc_array().
--- drivers/dma-buf/udmabuf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma-buf/udmabuf.c +4 -0
@@ -190,6 +190,10 @@ static long udmabuf_create(struct miscdevice *device,if (ubuf->pagecount > pglimit) goto err; } + +if (!ubuf->pagecount) + goto err; + ubuf->pages =kmalloc_array (ubuf->pagecount,sizeof (*ubuf->pages),GFP_KERNEL );if (!ubuf->pages) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 440/1126 bpf: Fix UAF due to race between btf_try_get_module and load_module
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 18688de203b47e5d8d9d0953385bf30b5949324f ]
While working on code to populate kfunc BTF ID sets for module BTF from its initcall, I noticed that by the time the initcall is invoked, the module BTF can already be seen by userspace (and the BPF verifier). The existing btf_try_get_module calls try_module_get which only fails if mod->state == MODULE_STATE_GOING, i.e. it can increment module reference when module initcall is happening in parallel.
Currently, BTF parsing happens from MODULE_STATE_COMING notifier callback. At this point, the module initcalls have not been invoked. The notifier callback parses and prepares the module BTF, allocates an ID, which publishes it to userspace, and then adds it to the btf_modules list allowing the kernel to invoke btf_try_get_module for the BTF.
However, at this point, the module has not been fully initialized (i.e. its initcalls have not finished). The code in module.c can still fail and free the module, without caring for other users. However, nothing stops btf_try_get_module from succeeding between the state transition from MODULE_STATE_COMING to MODULE_STATE_LIVE.
This leads to a use-after-free issue when BPF program loads successfully in the state transition, load_module's do_init_module call fails and frees the module, and BPF program fd on close calls module_put for the freed module. Future patch has test case to verify we don't regress in this area in future.
There are multiple points after prepare_coming_module (in load_module) where failure can occur and module loading can return error. We illustrate and test for the race using the last point where it can practically occur (in module __init function).
An illustration of the race:
CPU 0 CPU 1
load_module
notifier_call(MODULE_STATE_COMING)
btf_parse_module
btf_alloc_id // Published to userspace
list_add(&btf_mod->list, btf_modules)
mod->init(...)
... ^
bpf_check |
check_pseudo_btf_id |
btf_try_get_module |
returns true | ...
... | module __init in progress
return prog_fd | ...
... V
if (ret < 0)
free_module(mod)
...close(prog_fd)
...
bpf_prog_free_deferred
module_put(used_btf.mod) // use-after-free
We fix this issue by setting a flag BTF_MODULE_F_LIVE, from the notifier callback when MODULE_STATE_LIVE state is reached for the module, so that we return NULL from btf_try_get_module for modules that are not fully formed. Since try_module_get already checks that module is not in MODULE_STATE_GOING state, and that is the only transition a live module can make before being removed from btf_modules list, this is enough to close the race and prevent the bug.
A later selftest patch crafts the race condition artifically to verify that it has been fixed, and that verifier fails to load program (with ENXIO).
Lastly, a couple of comments:
1. Even if this race didn't exist, it seems more appropriate to only access resources (ksyms and kfuncs) of a fully formed module which has been initialized completely.
2. This patch was born out of need for synchronization against module initcall for the next patch, so it is needed for correctness even without the aforementioned race condition. The BTF resources initialized by module initcall are set up once and then only looked up, so just waiting until the initcall has finished ensures correct behavior.
--- kernel/bpf/btf.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
kernel/bpf/btf.c +24 -2
@@ -6201,12 +6201,17 @@ bool btf_id_set_contains(const struct btf_id_set *set, u32 id)return bsearch (&id, set->ids, set->cnt,sizeof (u32), btf_id_cmp_func) !=NULL ; } +enum { +BTF_MODULE_F_LIVE = (1 <<0 ), +}; +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES struct btf_module {struct list_head list;struct module *module;struct btf *btf;struct bin_attribute *sysfs_attr; +int flags; };static LIST_HEAD (btf_modules);
@@ -6234,7 +6239,8 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op,int err =0 ;if (mod->btf_data_size ==0 || - (op !=MODULE_STATE_COMING && op !=MODULE_STATE_GOING )) + (op !=MODULE_STATE_COMING && op !=MODULE_STATE_LIVE && + op !=MODULE_STATE_GOING )) goto out;switch (op) {
@@ -6292,6 +6298,17 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op, btf_mod->sysfs_attr = attr; } +break ; +case MODULE_STATE_LIVE : +mutex_lock (&btf_module_mutex); +list_for_each_entry_safe (btf_mod, tmp, &btf_modules, list) { +if (btf_mod->module != module) +continue ; + + btf_mod->flags |=BTF_MODULE_F_LIVE ; +break ; + } +mutex_unlock (&btf_module_mutex);break ;case MODULE_STATE_GOING :mutex_lock (&btf_module_mutex);
@@ -6339,7 +6356,12 @@ struct module *btf_try_get_module(const struct btf *btf)if (btf_mod->btf != btf)continue ; -if (try_module_get (btf_mod->module)) +/* We must only consider module whose __init routine has +* finished, hence we must check for BTF_MODULE_F_LIVE flag, +* which is set from the notifier callback for +* MODULE_STATE_LIVE. +*/ +if ((btf_mod->flags &BTF_MODULE_F_LIVE ) &&try_module_get (btf_mod->module)) res = btf_mod->module;break ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 441/1126 drm/selftests/test-drm_dp_mst_helper: Fix memory leak in sideband_msg_req_encode_decode
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit ba3a5ddcf1e5df31f2291006d5297ca62035584f ]
Avoid leaking the "out" variable if it is not possible to allocate the "txmsg" variable.
Addresses-Coverity-ID: 1475685 ("Resource leak")
--- drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c +3 -1
@@ -131,8 +131,10 @@ sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)return false; txmsg =kzalloc (sizeof (*txmsg),GFP_KERNEL ); -if (!txmsg) +if (!txmsg) { +kfree (out);return false; + }drm_dp_encode_sideband_req (in, txmsg); ret =drm_dp_decode_sideband_req (txmsg, out);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 442/1126 drm/locking: fix drm_modeset_acquire_ctx kernel-doc
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit 6f043b5969a4d6d385ca429388ded37e30e0d179 ]
The stack_depot member was added without kernel-doc, leading to below warning. Fix it.
./include/drm/drm_modeset_lock.h:74: warning: Function parameter or member 'stack_depot' not described in 'drm_modeset_acquire_ctx'
--- include/drm/drm_modeset_lock.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_modeset_lock.h +1 -0
@@ -34,6 +34,7 @@ struct drm_modeset_lock;* struct drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx) * @ww_ctx: base acquire ctx * @contended: used internally for -EDEADLK handling +* @stack_depot: used internally for contention debugging * @locked: list of held locks * @trylock_only: trylock mode used in atomic contexts/panic notifiers * @interruptible: whether interruptible locking should be used.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 443/1126 selftests: bpf: Fix bind on used port
In reply to Greg Kroah-HartmanFrom: Felix Maurer <[email protected]>
[ Upstream commit 8c0be0631d81e48f77d0ebf0534c86e32bef5f89 ]
The bind_perm BPF selftest failed when port 111/tcp was already in use during the test. To fix this, the test now runs in its own network name space.
To use unshare, it is necessary to reorder the includes. The style of the includes is adapted to be consistent with the other prog_tests.
v2: Replace deprecated CHECK macro with ASSERT_OK
--- .../selftests/bpf/prog_tests/bind_perm.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/prog_tests/bind_perm.c +17 -3
@@ -1,13 +1,24 @@// SPDX-License-Identifier: GPL-2.0 -#include <test_progs.h> -#include "bind_perm.skel.h" - +#define _GNU_SOURCE +#include <sched.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/capability.h> +#include "test_progs.h" +#include "bind_perm.skel.h" +static int duration; +static int create_netns (void ) +{ +if (!ASSERT_OK (unshare (CLONE_NEWNET ),"create netns" )) +return -1 ; + +return 0 ; +} +void try_bind (int family,int port,int expected_errno) {struct sockaddr_storage addr = {};
@@ -75,6 +86,9 @@ void test_bind_perm(void)struct bind_perm *skel;int cgroup_fd; +if (create_netns ()) +return ; + cgroup_fd =test__join_cgroup ("/bind_perm" );if (CHECK (cgroup_fd <0 ,"cg-join" ,"errno %d" , errno))return ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 444/1126 Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products
In reply to Greg Kroah-HartmanFrom: Tedd Ho-Jeong An <[email protected]>
[ Upstream commit 55235304c2560d4a94ccfff2a47ea927b4114064 ]
This patch adds the flag to identify the Intel legacy ROM products that don't support WBS like WP and StP.
--- drivers/bluetooth/btintel.c | 11 ++++++++--- drivers/bluetooth/btintel.h | 1 + drivers/bluetooth/btusb.c | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-)
drivers/bluetooth/btintel.c +8 -3
@@ -2428,10 +2428,15 @@ static int btintel_setup_combined(struct hci_dev *hdev)/* Apply the device specific HCI quirks * -* WBS for SdP - SdP and Stp have a same hw_varaint but -* different fw_variant +* WBS for SdP - For the Legacy ROM products, only SdP +* supports the WBS. But the version information is not +* enough to use here because the StP2 and SdP have same +* hw_variant and fw_variant. So, this flag is set by +* the transport driver (btusb) based on the HW info +* (idProduct) */ -if (ver.hw_variant ==0x08 && ver.fw_variant ==0x22 ) +if (!btintel_test_flag (hdev, +INTEL_ROM_LEGACY_NO_WBS_SUPPORT ))set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks);
drivers/bluetooth/btintel.h +1 -0
@@ -152,6 +152,7 @@ enum {INTEL_BROKEN_INITIAL_NCMD ,INTEL_BROKEN_SHUTDOWN_LED ,INTEL_ROM_LEGACY , +INTEL_ROM_LEGACY_NO_WBS_SUPPORT , __INTEL_NUM_FLAGS, };
drivers/bluetooth/btusb.c +6 -0
@@ -62,6 +62,7 @@ static struct usb_driver btusb_driver;#define BTUSB_QCA_WCN6855 0x1000000#define BTUSB_INTEL_BROKEN_SHUTDOWN_LED 0x2000000#define BTUSB_INTEL_BROKEN_INITIAL_NCMD 0x4000000 +#define BTUSB_INTEL_NO_WBS_SUPPORT 0x8000000static const struct usb_device_id btusb_table[] = {/* Generic Bluetooth USB device */
@@ -385,9 +386,11 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x8087, 0x0033), .driver_info = BTUSB_INTEL_COMBINED }, { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR }, { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL_COMBINED | +BTUSB_INTEL_NO_WBS_SUPPORT |BTUSB_INTEL_BROKEN_INITIAL_NCMD | BTUSB_INTEL_BROKEN_SHUTDOWN_LED }, { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL_COMBINED | +BTUSB_INTEL_NO_WBS_SUPPORT | BTUSB_INTEL_BROKEN_SHUTDOWN_LED }, { USB_DEVICE(0x8087, 0x0a2b), .driver_info = BTUSB_INTEL_COMBINED }, { USB_DEVICE(0x8087, 0x0aa7), .driver_info = BTUSB_INTEL_COMBINED |
@@ -3743,6 +3746,9 @@ static int btusb_probe(struct usb_interface *intf, hdev->send = btusb_send_frame_intel; hdev->cmd_timeout = btusb_intel_cmd_timeout; +if (id->driver_info &BTUSB_INTEL_NO_WBS_SUPPORT ) +btintel_set_flag (hdev,INTEL_ROM_LEGACY_NO_WBS_SUPPORT ); +if (id->driver_info &BTUSB_INTEL_BROKEN_INITIAL_NCMD )btintel_set_flag (hdev,INTEL_BROKEN_INITIAL_NCMD );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 445/1126 Bluetooth: hci_serdev: call init_rwsem() before p->open()
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 9d7cbe2b9cf5f650067df4f402fdd799d4bbb4e1 ]
kvartet reported, that hci_uart_tx_wakeup() uses uninitialized rwsem. The problem was in wrong place for percpu_init_rwsem() call.
hci_uart_proto::open() may register a timer whose callback may call hci_uart_tx_wakeup(). There is a chance, that hci_uart_register_device() thread won't be fast enough to call percpu_init_rwsem().
Fix it my moving percpu_init_rwsem() call before p->open().
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe you didn't initialize this object before use? turning off the locking correctness validator.
CPU: 2 PID: 18524 Comm: syz-executor.5 Not tainted 5.16.0-rc6 #9 ... Call Trace: <IRQ> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 assign_lock_key kernel/locking/lockdep.c:951 [inline] register_lock_class+0x148d/0x1950 kernel/locking/lockdep.c:1263 __lock_acquire+0x106/0x57e0 kernel/locking/lockdep.c:4906 lock_acquire kernel/locking/lockdep.c:5637 [inline] lock_acquire+0x1ab/0x520 kernel/locking/lockdep.c:5602 percpu_down_read_trylock include/linux/percpu-rwsem.h:92 [inline] hci_uart_tx_wakeup+0x12e/0x490 drivers/bluetooth/hci_ldisc.c:124 h5_timed_event+0x32f/0x6a0 drivers/bluetooth/hci_h5.c:188 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
--- drivers/bluetooth/hci_serdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_serdev.c +2 -1
@@ -305,6 +305,8 @@ int hci_uart_register_device(struct hci_uart *hu,if (err)return err; +percpu_init_rwsem (&hu->proto_lock); + err = p->open (hu);if (err) goto err_open;
@@ -327,7 +329,6 @@ int hci_uart_register_device(struct hci_uart *hu,INIT_WORK (&hu->init_ready, hci_uart_init_work);INIT_WORK (&hu->write_work, hci_uart_write_work); -percpu_init_rwsem (&hu->proto_lock);/* Only when vendor specific setup callback is provided, consider * the manufacturer information valid. This avoids filling in the
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 446/1126 Bluetooth: mt7921s: fix firmware coredump retrieve
In reply to Greg Kroah-HartmanFrom: Mark Chen <[email protected]>
[ Upstream commit 2fc967cc0dadad6735448cfbcbc77fe0ea30203d ]
According to the MCU firmware behavior, as the driver is aware of the notification of the interrupt source FW_MAILBOX_INT that shows the MCU completed delivered a core dump piece to the host, the driver must acknowledge the MCU with the register PH2DSM0R bit PH2DSM0R_DRIVER_OWN to notify the MCU to handle the next core dump piece.
--- drivers/bluetooth/btmtksdio.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/bluetooth/btmtksdio.c +10 -0
@@ -87,8 +87,12 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);#define RX_DONE_INT BIT(1)#define TX_EMPTY BIT(2)#define TX_FIFO_OVERFLOW BIT(8) +#define FW_MAILBOX_INT BIT(15)#define RX_PKT_LEN GENMASK(31, 16) +#define MTK_REG_PH2DSM0R 0xc4 +#define PH2DSM0R_DRIVER_OWN BIT(0) +#define MTK_REG_CTDR 0x18#define MTK_REG_CRDR 0x1c
@@ -481,6 +485,12 @@ static void btmtksdio_txrx_work(struct work_struct *work)*/ sdio_writel (bdev->func, int_status,MTK_REG_CHISR ,NULL ); +if ((int_status &FW_MAILBOX_INT ) && + bdev->data->chipid ==0x7921 ) { +sdio_writel (bdev->func,PH2DSM0R_DRIVER_OWN , +MTK_REG_PH2DSM0R ,0 ); + } +if (int_status &FW_OWN_BACK_INT )bt_dev_dbg (bdev->hdev,"Get fw own back" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 447/1126 Bluetooth: mt7921s: fix bus hang with wrong privilege
In reply to Greg Kroah-HartmanFrom: Mark Chen <[email protected]>
[ Upstream commit 752aea58489fd42f5c54dc50cb098d19e486ae61 ]
According to chip hw flow, mt7921s need to re-acquire privilege again before normal running. Otherwise, the bus may be stuck in an abnormal status.
--- drivers/bluetooth/btmtksdio.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/bluetooth/btmtksdio.c +9 -0
@@ -872,6 +872,15 @@ static int btmtksdio_setup(struct hci_dev *hdev) err =mt79xx_setup (hdev, fwname);if (err <0 )return err; + + err =btmtksdio_fw_pmctrl (bdev); +if (err <0 ) +return err; + + err =btmtksdio_drv_pmctrl (bdev); +if (err <0 ) +return err; +break ;case 0x7663 :case 0x7668 :
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 448/1126 Bluetooth: btmtksdio: refactor btmtksdio_runtime_[suspend|resume]()
In reply to Greg Kroah-HartmanFrom: Mark Chen <[email protected]>
[ Upstream commit c7e301d7c85544607ccc52ca5f26d20c59485342 ]
Refactor btmtksdio_runtime_[suspend|resume]() to create the common funcitons btmtksdio_[fw|drv]_pmctrl() shared with btmtksdio_[open|close]() to avoid the redundant code as well.
This is also a prerequisite patch for the incoming patches.
--- drivers/bluetooth/btmtksdio.c | 94 ++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 41 deletions(-)
drivers/bluetooth/btmtksdio.c +53 -41
@@ -282,6 +282,54 @@ static u32 btmtksdio_drv_own_query(struct btmtksdio_dev *bdev)return sdio_readl (bdev->func,MTK_REG_CHLPCR ,NULL ); } +static int btmtksdio_fw_pmctrl (struct btmtksdio_dev *bdev) +{ +u32 status; +int err; + +sdio_claim_host (bdev->func); + +/* Return ownership to the device */ +sdio_writel (bdev->func,C_FW_OWN_REQ_SET ,MTK_REG_CHLPCR , &err); +if (err <0 ) + goto out; + + err =readx_poll_timeout (btmtksdio_drv_own_query, bdev, status, + !(status &C_COM_DRV_OWN ),2000 ,1000000 ); + +out: +sdio_release_host (bdev->func); + +if (err <0 ) +bt_dev_err (bdev->hdev,"Cannot return ownership to device" ); + +return err; +} + +static int btmtksdio_drv_pmctrl (struct btmtksdio_dev *bdev) +{ +u32 status; +int err; + +sdio_claim_host (bdev->func); + +/* Get ownership from the device */ +sdio_writel (bdev->func,C_FW_OWN_REQ_CLR ,MTK_REG_CHLPCR , &err); +if (err <0 ) + goto out; + + err =readx_poll_timeout (btmtksdio_drv_own_query, bdev, status, + status &C_COM_DRV_OWN ,2000 ,1000000 ); + +out: +sdio_release_host (bdev->func); + +if (err <0 ) +bt_dev_err (bdev->hdev,"Cannot get ownership from device" ); + +return err; +} +static int btmtksdio_recv_event (struct hci_dev *hdev,struct sk_buff *skb) {struct btmtksdio_dev *bdev =hci_get_drvdata (hdev);
@@ -541,7 +589,7 @@ static void btmtksdio_interrupt(struct sdio_func *func)static int btmtksdio_open (struct hci_dev *hdev) {struct btmtksdio_dev *bdev =hci_get_drvdata (hdev); -u32 status, val; +u32 val;int err;sdio_claim_host (bdev->func);
@@ -552,18 +600,10 @@ static int btmtksdio_open(struct hci_dev *hdev)set_bit (BTMTKSDIO_FUNC_ENABLED , &bdev->tx_state); -/* Get ownership from the device */ -sdio_writel (bdev->func,C_FW_OWN_REQ_CLR ,MTK_REG_CHLPCR , &err); + err =btmtksdio_drv_pmctrl (bdev);if (err <0 ) goto err_disable_func; - err =readx_poll_timeout (btmtksdio_drv_own_query, bdev, status, - status &C_COM_DRV_OWN ,2000 ,1000000 ); -if (err <0 ) { -bt_dev_err (bdev->hdev,"Cannot get ownership from device" ); - goto err_disable_func; - } -/* Disable interrupt & mask out all interrupt sources */ sdio_writel (bdev->func,C_INT_EN_CLR ,MTK_REG_CHLPCR , &err);if (err <0 )
@@ -633,8 +673,6 @@ static int btmtksdio_open(struct hci_dev *hdev)static int btmtksdio_close (struct hci_dev *hdev) {struct btmtksdio_dev *bdev =hci_get_drvdata (hdev); -u32 status; -int err;sdio_claim_host (bdev->func);
@@ -645,13 +683,7 @@ static int btmtksdio_close(struct hci_dev *hdev)cancel_work_sync (&bdev->txrx_work); -/* Return ownership to the device */ -sdio_writel (bdev->func,C_FW_OWN_REQ_SET ,MTK_REG_CHLPCR ,NULL ); - - err =readx_poll_timeout (btmtksdio_drv_own_query, bdev, status, - !(status &C_COM_DRV_OWN ),2000 ,1000000 ); -if (err <0 ) -bt_dev_err (bdev->hdev,"Cannot return ownership to device" ); +btmtksdio_fw_pmctrl (bdev);clear_bit (BTMTKSDIO_FUNC_ENABLED , &bdev->tx_state);sdio_disable_func (bdev->func);
@@ -1077,7 +1109,6 @@ static int btmtksdio_runtime_suspend(struct device *dev) {struct sdio_func *func =dev_to_sdio_func (dev);struct btmtksdio_dev *bdev; -u32 status;int err; bdev =sdio_get_drvdata (func);
@@ -1089,19 +1120,10 @@ static int btmtksdio_runtime_suspend(struct device *dev)sdio_set_host_pm_flags (func,MMC_PM_KEEP_POWER ); -sdio_claim_host (bdev->func); - -sdio_writel (bdev->func,C_FW_OWN_REQ_SET ,MTK_REG_CHLPCR , &err); -if (err <0 ) - goto out; + err =btmtksdio_fw_pmctrl (bdev); - err =readx_poll_timeout (btmtksdio_drv_own_query, bdev, status, - !(status &C_COM_DRV_OWN ),2000 ,1000000 ); -out:bt_dev_info (bdev->hdev,"status (%d) return ownership to device" , err); -sdio_release_host (bdev->func); -return err; }
@@ -1109,7 +1131,6 @@ static int btmtksdio_runtime_resume(struct device *dev) {struct sdio_func *func =dev_to_sdio_func (dev);struct btmtksdio_dev *bdev; -u32 status;int err; bdev =sdio_get_drvdata (func);
@@ -1119,19 +1140,10 @@ static int btmtksdio_runtime_resume(struct device *dev)if (!test_bit (BTMTKSDIO_FUNC_ENABLED , &bdev->tx_state))return 0 ; -sdio_claim_host (bdev->func); - -sdio_writel (bdev->func,C_FW_OWN_REQ_CLR ,MTK_REG_CHLPCR , &err); -if (err <0 ) - goto out; + err =btmtksdio_drv_pmctrl (bdev); - err =readx_poll_timeout (btmtksdio_drv_own_query, bdev, status, - status &C_COM_DRV_OWN ,2000 ,1000000 ); -out:bt_dev_info (bdev->hdev,"status (%d) get ownership from device" , err); -sdio_release_host (bdev->func); -return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 449/1126 Bluetooth: mt7921s: fix btmtksdio_[drv|fw]_pmctrl()
In reply to Greg Kroah-HartmanFrom: Mark Chen <[email protected]>
[ Upstream commit 01ecc177b7d7ba055b79645e60e89385736ef2fc ]
According to the firmware behavior (even the oldest one in linux-firmware)
If the firmware is downloaded, MT7921S must rely on the additional mailbox mechanism that resides in firmware to check if the device is the right state for btmtksdio_mcu_[drv|fw]_pmctrl(). Otherwise, we still apply the old way for that.
That is a necessary patch before we enable runtime pm for mt7921s as default.
--- drivers/bluetooth/btmtksdio.c | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
drivers/bluetooth/btmtksdio.c +38 -0
@@ -38,21 +38,25 @@ static bool enable_autosuspend;struct btmtksdio_data {const char *fwname;u16 chipid; +bool lp_mbox_supported; };static const struct btmtksdio_data mt7663_data = { .fwname =FIRMWARE_MT7663 , .chipid =0x7663 , + .lp_mbox_supported = false, };static const struct btmtksdio_data mt7668_data = { .fwname =FIRMWARE_MT7668 , .chipid =0x7668 , + .lp_mbox_supported = false, };static const struct btmtksdio_data mt7921_data = { .fwname =FIRMWARE_MT7961 , .chipid =0x7921 , + .lp_mbox_supported = true, };static const struct sdio_device_id btmtksdio_table[] = {
@@ -90,8 +94,12 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);#define FW_MAILBOX_INT BIT(15)#define RX_PKT_LEN GENMASK(31, 16) +#define MTK_REG_CSICR 0xc0 +#define CSICR_CLR_MBOX_ACK BIT(0)#define MTK_REG_PH2DSM0R 0xc4#define PH2DSM0R_DRIVER_OWN BIT(0) +#define MTK_REG_PD2HRM0R 0xdc +#define PD2HRM0R_DRV_OWN BIT(0)#define MTK_REG_CTDR 0x18
@@ -104,6 +112,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);#define BTMTKSDIO_TX_WAIT_VND_EVT 1#define BTMTKSDIO_HW_TX_READY 2#define BTMTKSDIO_FUNC_ENABLED 3 +#define BTMTKSDIO_PATCH_ENABLED 4struct mtkbtsdio_hdr {__le16 len;
@@ -282,6 +291,11 @@ static u32 btmtksdio_drv_own_query(struct btmtksdio_dev *bdev)return sdio_readl (bdev->func,MTK_REG_CHLPCR ,NULL ); } +static u32 btmtksdio_drv_own_query_79xx (struct btmtksdio_dev *bdev) +{ +return sdio_readl (bdev->func,MTK_REG_PD2HRM0R ,NULL ); +} +static int btmtksdio_fw_pmctrl (struct btmtksdio_dev *bdev) {u32 status;
@@ -289,6 +303,19 @@ static int btmtksdio_fw_pmctrl(struct btmtksdio_dev *bdev)sdio_claim_host (bdev->func); +if (bdev->data->lp_mbox_supported && +test_bit (BTMTKSDIO_PATCH_ENABLED , &bdev->tx_state)) { +sdio_writel (bdev->func,CSICR_CLR_MBOX_ACK ,MTK_REG_CSICR , + &err); + err =readx_poll_timeout (btmtksdio_drv_own_query_79xx, bdev, + status, !(status &PD2HRM0R_DRV_OWN ), +2000 ,1000000 ); +if (err <0 ) { +bt_dev_err (bdev->hdev,"mailbox ACK not cleared" ); + goto out; + } + } +/* Return ownership to the device */ sdio_writel (bdev->func,C_FW_OWN_REQ_SET ,MTK_REG_CHLPCR , &err);if (err <0 )
@@ -321,6 +348,12 @@ static int btmtksdio_drv_pmctrl(struct btmtksdio_dev *bdev) err =readx_poll_timeout (btmtksdio_drv_own_query, bdev, status, status &C_COM_DRV_OWN ,2000 ,1000000 ); +if (!err && bdev->data->lp_mbox_supported && +test_bit (BTMTKSDIO_PATCH_ENABLED , &bdev->tx_state)) + err =readx_poll_timeout (btmtksdio_drv_own_query_79xx, bdev, + status, status &PD2HRM0R_DRV_OWN , +2000 ,1000000 ); + out:sdio_release_host (bdev->func);
@@ -728,6 +761,7 @@ static int btmtksdio_func_query(struct hci_dev *hdev)static int mt76xx_setup (struct hci_dev *hdev,const char *fwname) { +struct btmtksdio_dev *bdev =hci_get_drvdata (hdev);struct btmtk_hci_wmt_params wmt_params;struct btmtk_tci_sleep tci_sleep;struct sk_buff *skb;
@@ -788,6 +822,8 @@ static int mt76xx_setup(struct hci_dev *hdev, const char *fwname)return err; } +set_bit (BTMTKSDIO_PATCH_ENABLED , &bdev->tx_state); + ignore_func_on:/* Apply the low power environment setup */ tci_sleep.mode =0x5 ;
@@ -810,6 +846,7 @@ static int mt76xx_setup(struct hci_dev *hdev, const char *fwname)static int mt79xx_setup (struct hci_dev *hdev,const char *fwname) { +struct btmtksdio_dev *bdev =hci_get_drvdata (hdev);struct btmtk_hci_wmt_params wmt_params;u8 param =0x1 ;int err;
@@ -835,6 +872,7 @@ static int mt79xx_setup(struct hci_dev *hdev, const char *fwname)hci_set_msft_opcode (hdev,0xFD30 );hci_set_aosp_capable (hdev); +set_bit (BTMTKSDIO_PATCH_ENABLED , &bdev->tx_state);return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 450/1126 Bluetooth: btmtksdio: mask out interrupt status
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit db3f1f9b5d88d8d7f9eaa486f71784dd319285ff ]
Currently, there is a loop in btmtksdio_txrx_work() which iteratively executes until the variable int_status is zero.
But the variable int_status should be masked out with the actual interrupt sources (MTK_REG_CHISR bit 0-15) before we check the loop condition. Otherwise, RX_PKT_LEN (MTK_REG_CHISR bit 16-31) which is read-only and unclearable would cause the loop to get stuck on some chipsets like MT7663s.
--- drivers/bluetooth/btmtksdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/bluetooth/btmtksdio.c +2 -0
@@ -92,6 +92,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table);#define TX_EMPTY BIT(2)#define TX_FIFO_OVERFLOW BIT(8)#define FW_MAILBOX_INT BIT(15) +#define INT_MASK GENMASK(15, 0)#define RX_PKT_LEN GENMASK(31, 16)#define MTK_REG_CSICR 0xc0
@@ -565,6 +566,7 @@ static void btmtksdio_txrx_work(struct work_struct *work)* FIFO. */ sdio_writel (bdev->func, int_status,MTK_REG_CHISR ,NULL ); + int_status &=INT_MASK ;if ((int_status &FW_MAILBOX_INT ) && bdev->data->chipid ==0x7921 ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 451/1126 mtd: onenand: Check for error irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 3e68f331c8c759c0daa31cc92c3449b23119a215 ]
For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq().
Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now.
--- drivers/mtd/nand/onenand/generic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/nand/onenand/generic.c +6 -1
@@ -53,7 +53,12 @@ static int generic_onenand_probe(struct platform_device *pdev) } info->onenand.mmcontrol = pdata ? pdata->mmcontrol :NULL ; - info->onenand.irq =platform_get_irq (pdev,0 ); + + err =platform_get_irq (pdev,0 ); +if (err <0 ) + goto out_iounmap; + + info->onenand.irq = err; info->mtd.dev.parent = &pdev->dev; info->mtd.priv = &info->onenand;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 452/1126 mtd: rawnand: gpmi: fix controller timings setting
In reply to Greg Kroah-HartmanFrom: Dario Binacchi <[email protected]>
[ Upstream commit 2970bf5a32f079e1e9197411db4fe9faccb1503a ]
Set the controller registers according to the real clock rate. The controller registers configuration (setup, hold, timeout, ... cycles) depends on the clock rate of the GPMI. Using the real rate instead of the ideal one, avoids that this inaccuracy (required_rate - real_rate) affects the registers setting.
This patch has been tested on two custom boards with i.MX28 and i.MX6 SOCs:
- i.MX28:
required rate 100MHz, real rate 99.3MHz
- i.MX6
required rate 100MHz, real rate 99MHz
--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +3 -0
@@ -648,6 +648,7 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, const struct nand_sdr_timings *sdr) {struct gpmi_nfc_hardware_timing *hw = &this->hw; +struct resources *r = &this->resources;unsigned int dll_threshold_ps = this->devdata->max_chain_delay;unsigned int period_ps, reference_period_ps;unsigned int data_setup_cycles, data_hold_cycles, addr_setup_cycles;
@@ -671,6 +672,8 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, wrn_dly_sel =BV_GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY ; } + hw->clk_rate =clk_round_rate (r->clock[0 ], hw->clk_rate); +/* SDR core timings are given in picoseconds */ period_ps =div_u64 ((u64 )NSEC_PER_SEC *1000 , hw->clk_rate);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 453/1126 selftests, xsk: Fix rx_full stats test
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit b4ec6a19231224f6b08dc54ea07da4c4090e8ee3 ]
Fix the rx_full stats test so that it correctly reports pass even when the fill ring is not full of buffers.
--- tools/testing/selftests/bpf/xdpxceiver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/xdpxceiver.c +4 -1
@@ -906,7 +906,10 @@ static bool rx_stats_are_valid(struct ifobject *ifobject)return true;case STAT_TEST_RX_FULL : xsk_stat = stats.rx_ring_full; - expected_stat -=RX_FULL_RXQSIZE ; +if (ifobject->umem->num_frames <XSK_RING_PROD__DEFAULT_NUM_DESCS ) + expected_stat = ifobject->umem->num_frames -RX_FULL_RXQSIZE ; +else + expected_stat =XSK_RING_PROD__DEFAULT_NUM_DESCS -RX_FULL_RXQSIZE ;break ;case STAT_TEST_RX_FILL_EMPTY : xsk_stat = stats.rx_fill_ring_empty_descs;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 454/1126 drm/edid: Dont clear formats if using deep color
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 75478b3b393bcbdca4e6da76fe3a9f1a4133ec5d ]
The current code, when parsing the EDID Deep Color depths, that the YUV422 cannot be used, referring to the HDMI 1.3 Specification.
This specification, in its section 6.2.4, indeed states:
For each supported Deep Color mode, RGB 4:4:4 shall be supported and optionally YCBCR 4:4:4 may be supported.
YCBCR 4:2:2 is not permitted for any Deep Color mode.
This indeed can be interpreted like the code does, but the HDMI 1.4 specification further clarifies that statement in its section 6.2.4:
For each supported Deep Color mode, RGB 4:4:4 shall be supported and optionally YCBCR 4:4:4 may be supported.
YCBCR 4:2:2 is also 36-bit mode but does not require the further use of the Deep Color modes described in section 6.5.2 and 6.5.3.
This means that, even though YUV422 can be used with 12 bit per color, it shouldn't be treated as a deep color mode.
This is also broken with YUV444 if it's supported by the display, but DRM_EDID_HDMI_DC_Y444 isn't set. In such a case, the code will clear color_formats of the YUV444 support set previously in drm_parse_cea_ext(), but will not set it back.
Since the formats supported are already setup properly in drm_parse_cea_ext(), let's just remove the code modifying the formats in drm_parse_hdmi_deep_color_info()
--- drivers/gpu/drm/drm_edid.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -8
@@ -5105,16 +5105,8 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, connector->name, dc_bpc); info->bpc = dc_bpc; -/* -* Deep color support mandates RGB444 support for all video -* modes and forbids YCRCB422 support for all video modes per -* HDMI 1.3 spec. -*/ - info->color_formats =DRM_COLOR_FORMAT_RGB444 ; -/* YCRCB444 is optional according to spec. */ if (hdmi[6 ] &DRM_EDID_HDMI_DC_Y444 ) { - info->color_formats |=DRM_COLOR_FORMAT_YCRCB444 ;DRM_DEBUG ("%s: HDMI sink does YCRCB444 in deep color.\n" , connector->name); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 455/1126 drm/edid: Split deep color modes between RGB and YUV444
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 4adc33f36d80489339f1b43dfeee96bb9ea8e459 ]
The current code assumes that the RGB444 and YUV444 formats are the same, but the HDMI 2.0 specification states that:
The three DC_XXbit bits above only indicate support for RGB 4:4:4 at that pixel size. Support for YCBCR 4:4:4 in Deep Color modes is indicated with the DC_Y444 bit. If DC_Y444 is set, then YCBCR 4:4:4 is supported for all modes indicated by the DC_XXbit flags.
So if we have YUV444 support and any DC_XXbit flag set but the DC_Y444 flag isn't, we'll assume that we support that deep colour mode for YUV444 which breaks the specification.
In order to fix this, let's split the edid_hdmi_dc_modes field in struct drm_display_info into two fields, one for RGB444 and one for YUV444.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 2 +- drivers/gpu/drm/drm_edid.c | 7 ++++--- drivers/gpu/drm/i915/display/intel_hdmi.c | 4 ++-- drivers/gpu/drm/radeon/radeon_connectors.c | 2 +- include/drm/drm_connector.h | 12 +++++++++--- 5 files changed, 17 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -1
@@ -175,7 +175,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector)/* Check if bpc is within clock limit. Try to degrade gracefully otherwise */ if ((bpc ==12 ) && (mode_clock *3 /2 > max_tmds_clock)) { -if ((connector->display_info.edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_30 ) && +if ((connector->display_info.edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_30 ) && (mode_clock *5 /4 <= max_tmds_clock)) bpc =10 ;else
drivers/gpu/drm/drm_edid.c +4 -3
@@ -5076,21 +5076,21 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,if (hdmi[6 ] &DRM_EDID_HDMI_DC_30 ) { dc_bpc =10 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_30 ; + info->edid_hdmi_rgb444_dc_modes |=DRM_EDID_HDMI_DC_30 ;DRM_DEBUG ("%s: HDMI sink does deep color 30.\n" , connector->name); }if (hdmi[6 ] &DRM_EDID_HDMI_DC_36 ) { dc_bpc =12 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_36 ; + info->edid_hdmi_rgb444_dc_modes |=DRM_EDID_HDMI_DC_36 ;DRM_DEBUG ("%s: HDMI sink does deep color 36.\n" , connector->name); }if (hdmi[6 ] &DRM_EDID_HDMI_DC_48 ) { dc_bpc =16 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_48 ; + info->edid_hdmi_rgb444_dc_modes |=DRM_EDID_HDMI_DC_48 ;DRM_DEBUG ("%s: HDMI sink does deep color 48.\n" , connector->name); }
@@ -5107,6 +5107,7 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,/* YCRCB444 is optional according to spec. */ if (hdmi[6 ] &DRM_EDID_HDMI_DC_Y444 ) { + info->edid_hdmi_ycbcr444_dc_modes = info->edid_hdmi_rgb444_dc_modes;DRM_DEBUG ("%s: HDMI sink does YCRCB444 in deep color.\n" , connector->name); }
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -2
@@ -1912,7 +1912,7 @@ static bool intel_hdmi_sink_bpc_possible(struct drm_connector *connector,if (ycbcr420_output)return hdmi->y420_dc_modes &DRM_EDID_YCBCR420_DC_36 ;else -return info->edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_36 ; +return info->edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_36 ;case 10 :if (!has_hdmi_sink)return false;
@@ -1920,7 +1920,7 @@ static bool intel_hdmi_sink_bpc_possible(struct drm_connector *connector,if (ycbcr420_output)return hdmi->y420_dc_modes &DRM_EDID_YCBCR420_DC_30 ;else -return info->edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_30 ; +return info->edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_30 ;case 8 :return true;default :
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
@@ -204,7 +204,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector)/* Check if bpc is within clock limit. Try to degrade gracefully otherwise */ if ((bpc ==12 ) && (mode_clock *3 /2 > max_tmds_clock)) { -if ((connector->display_info.edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_30 ) && +if ((connector->display_info.edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_30 ) && (mode_clock *5 /4 <= max_tmds_clock)) bpc =10 ;else
include/drm/drm_connector.h +9 -3
@@ -592,10 +592,16 @@ struct drm_display_info {bool rgb_quant_range_selectable;/** -* @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even -* more stuff redundant with @bus_formats. +* @edid_hdmi_dc_rgb444_modes: Mask of supported hdmi deep color modes +* in RGB 4:4:4. Even more stuff redundant with @bus_formats. */ -u8 edid_hdmi_dc_modes; +u8 edid_hdmi_rgb444_dc_modes; + +/** +* @edid_hdmi_dc_ycbcr444_modes: Mask of supported hdmi deep color +* modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats. +*/ +u8 edid_hdmi_ycbcr444_dc_modes;/** * @cea_rev: CEA revision of the HDMI sink.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 456/1126 ionic: fix type complaint in ionic_dev_cmd_clean()
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit bc0bf9de6f48268f4ee59e57fb42ac751be3ecda ]
Sparse seems to have gotten a little more picky lately and we need to revisit this bit of code to make sparse happy.
warning: incorrect type in initializer (different address spaces)
expected union ionic_dev_cmd_regs *regs
got union ionic_dev_cmd_regs [noderef] __iomem *dev_cmd_regs
warning: incorrect type in argument 2 (different address spaces)
expected void [noderef] __iomem *
got unsigned int *
warning: incorrect type in argument 1 (different address spaces)
expected void volatile [noderef] __iomem *
got union ionic_dev_cmd *
--- drivers/net/ethernet/pensando/ionic/ionic_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_main.c +3 -3
@@ -370,10 +370,10 @@ int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *static void ionic_dev_cmd_clean (struct ionic *ionic) { -union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs; +struct ionic_dev *idev = &ionic->idev; -iowrite32 (0 , ®s->doorbell); -memset_io (®s->cmd,0 ,sizeof (regs->cmd)); +iowrite32 (0 , &idev->dev_cmd_regs->doorbell); +memset_io (&idev->dev_cmd_regs->cmd,0 ,sizeof (idev->dev_cmd_regs->cmd)); }int ionic_dev_cmd_wait (struct ionic *ionic,unsigned long max_seconds)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 457/1126 ionic: start watchdog after all is setup
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 9ad2939a1525962a79a2fd974ec7e3a71455b964 ]
The watchdog expects the lif to fully exist when it goes off, so lets not start the watchdog until all is ready in case there is some quirky time dialation that makes probe take multiple seconds.
--- drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 4 +++- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +3 -1
@@ -331,6 +331,9 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_deregister_lifs; } +mod_timer (&ionic->watchdog_timer, +round_jiffies (jiffies + ionic->watchdog_period)); +return 0 ; err_out_deregister_lifs:
@@ -348,7 +351,6 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_out_reset:ionic_reset (ionic); err_out_teardown: -del_timer_sync (&ionic->watchdog_timer);pci_clear_master (pdev);/* Don't fail the probe for these errors, keep * the hw interface around for inspection
drivers/net/ethernet/pensando/ionic/ionic_dev.c +0 -3
@@ -122,9 +122,6 @@ int ionic_dev_setup(struct ionic *ionic) idev->fw_generation =IONIC_FW_STS_F_GENERATION &ioread8 (&idev->dev_info_regs->fw_status); -mod_timer (&ionic->watchdog_timer, -round_jiffies (jiffies + ionic->watchdog_period)); - idev->db_pages = bar->vaddr; idev->phy_db_pages = bar->bus_addr;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 458/1126 ionic: Dont send reset commands if FW isnt running
In reply to Greg Kroah-HartmanFrom: Brett Creeley <[email protected]>
[ Upstream commit b8fd0271dad00b953caaabe73474788d3d19e252 ]
It's possible the FW is already shutting down while the driver is being removed and/or when the driver is going through reset. This can cause unexpected/unnecessary errors to be printed:
eth0: DEV_CMD IONIC_CMD_PORT_RESET (12) error, IONIC_RC_ERROR (29) failed
eth1: DEV_CMD IONIC_CMD_RESET (3) error, IONIC_RC_ERROR (29) failed
Fix this by checking the FW status register before issuing the reset commands.
Also, since err may not be assigned in ionic_port_reset(), assign it a default value of 0, and remove an unnecessary log message.
--- .../net/ethernet/pensando/ionic/ionic_dev.c | 17 ++++++++++++----- .../net/ethernet/pensando/ionic/ionic_dev.h | 1 + .../net/ethernet/pensando/ionic/ionic_main.c | 18 ++++++++++-------- 3 files changed, 23 insertions(+), 13 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_dev.c +12 -5
@@ -129,6 +129,16 @@ int ionic_dev_setup(struct ionic *ionic) }/* Devcmd Interface */ +bool ionic_is_fw_running (struct ionic_dev *idev) +{ +u8 fw_status =ioread8 (&idev->dev_info_regs->fw_status); + +/* firmware is useful only if the running bit is set and +* fw_status != 0xff (bad PCI read) +*/ +return (fw_status !=0xff ) && (fw_status &IONIC_FW_STS_F_RUNNING ); +} +int ionic_heartbeat_check (struct ionic *ionic) {struct ionic_dev *idev = &ionic->idev;
@@ -152,13 +162,10 @@ int ionic_heartbeat_check(struct ionic *ionic) goto do_check_time; } -/* firmware is useful only if the running bit is set and -* fw_status != 0xff (bad PCI read) -* If fw_status is not ready don't bother with the generation. -*/ fw_status =ioread8 (&idev->dev_info_regs->fw_status); -if (fw_status ==0xff || !(fw_status &IONIC_FW_STS_F_RUNNING )) { +/* If fw_status is not ready don't bother with the generation */ +if (!ionic_is_fw_running (idev)) { fw_status_ready = false; }else { fw_generation = fw_status &IONIC_FW_STS_F_GENERATION ;
drivers/net/ethernet/pensando/ionic/ionic_dev.h +1 -0
@@ -353,5 +353,6 @@ void ionic_q_rewind(struct ionic_queue *q, struct ionic_desc_info *start);void ionic_q_service (struct ionic_queue *q,struct ionic_cq_info *cq_info,unsigned int stop_index);int ionic_heartbeat_check (struct ionic *ionic); +bool ionic_is_fw_running (struct ionic_dev *idev);#endif /* _IONIC_DEV_H_ */
drivers/net/ethernet/pensando/ionic/ionic_main.c +10 -8
@@ -540,6 +540,9 @@ int ionic_reset(struct ionic *ionic)struct ionic_dev *idev = &ionic->idev;int err; +if (!ionic_is_fw_running (idev)) +return 0 ; +mutex_lock (&ionic->dev_cmd_lock);ionic_dev_cmd_reset (idev); err =ionic_dev_cmd_wait (ionic,DEVCMD_TIMEOUT );
@@ -612,15 +615,17 @@ int ionic_port_init(struct ionic *ionic)int ionic_port_reset (struct ionic *ionic) {struct ionic_dev *idev = &ionic->idev; -int err; +int err =0 ;if (!idev->port_info)return 0 ; -mutex_lock (&ionic->dev_cmd_lock); -ionic_dev_cmd_port_reset (idev); - err =ionic_dev_cmd_wait (ionic,DEVCMD_TIMEOUT ); -mutex_unlock (&ionic->dev_cmd_lock); +if (ionic_is_fw_running (idev)) { +mutex_lock (&ionic->dev_cmd_lock); +ionic_dev_cmd_port_reset (idev); + err =ionic_dev_cmd_wait (ionic,DEVCMD_TIMEOUT ); +mutex_unlock (&ionic->dev_cmd_lock); + }dma_free_coherent (ionic->dev, idev->port_info_sz, idev->port_info, idev->port_info_pa);
@@ -628,9 +633,6 @@ int ionic_port_reset(struct ionic *ionic) idev->port_info =NULL ; idev->port_info_pa =0 ; -if (err) -dev_err (ionic->dev,"Failed to reset port\n" ); -return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 459/1126 ionic: fix up printing of timeout error
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 4cc787bd88be6974f3362fa49fd8c5609bd039b8 ]
Make sure we print the TIMEOUT string if we had a timeout error, rather than printing the wrong status.
--- drivers/net/ethernet/pensando/ionic/ionic_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_main.c +6 -2
@@ -215,9 +215,13 @@ static void ionic_adminq_flush(struct ionic_lif *lif)void ionic_adminq_netdev_err_print (struct ionic_lif *lif,u8 opcode,u8 status,int err) { +const char *stat_str; + + stat_str = (err == -ETIMEDOUT ) ?"TIMEOUT" : +ionic_error_to_str (status); +netdev_err (lif->netdev,"%s (%d) failed: %s (%d)\n" , -ionic_opcode_to_str (opcode), opcode, -ionic_error_to_str (status), err); +ionic_opcode_to_str (opcode), opcode, stat_str, err); } static int ionic_adminq_check_err(struct ionic_lif *lif,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 460/1126 ionic: Correctly print AQ errors if completions arent received
In reply to Greg Kroah-HartmanFrom: Brett Creeley <[email protected]>
[ Upstream commit bc43ed4f35abfdb1d52311110d49b545fccce975 ]
Recent changes went into the driver to allow flexibility when printing error messages. Unfortunately this had the unexpected consequence of printing confusing messages like the following:
IONIC_CMD_RX_FILTER_ADD (31) failed: IONIC_RC_SUCCESS (-6)
In cases like this the completion of the admin queue command never completes, so the completion status is 0, hence IONIC_RC_SUCCESS is printed even though the command clearly failed. For example, this could happen when the driver tries to add a filter and at the same time the FW goes through a reset, so the AQ command never completes.
Fix this by forcing the FW completion status to IONIC_RC_ERROR in cases where we never get the completion.
--- drivers/net/ethernet/pensando/ionic/ionic_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/pensando/ionic/ionic_main.c +2 -0
@@ -322,6 +322,7 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,if (do_msg && !test_bit (IONIC_LIF_F_FW_RESET , lif->state))netdev_err (netdev,"Posting of %s (%d) failed: %d\n" , name, ctx->cmd.cmd.opcode, err); + ctx->comp.comp.status =IONIC_RC_ERROR ;return err; }
@@ -340,6 +341,7 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,if (do_msg)netdev_err (netdev,"%s (%d) interrupted, FW in reset\n" , name, ctx->cmd.cmd.opcode); + ctx->comp.comp.status =IONIC_RC_ERROR ;return -ENXIO ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 461/1126 net: dsa: Move VLAN filtering syncing out of dsa_switch_bridge_leave
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
[ Upstream commit 381a730182f1d174e1950cd4e63e885b1c302051 ]
Most of dsa_switch_bridge_leave was, in fact, dealing with the syncing of VLAN filtering for switches on which that is a global setting. Separate the two phases to prepare for the cross-chip related bugfix in the following commit.
--- net/dsa/switch.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-)
net/dsa/switch.c +25 -13
@@ -113,26 +113,15 @@ static int dsa_switch_bridge_join(struct dsa_switch *ds,return dsa_tag_8021q_bridge_join (ds, info); } -static int dsa_switch_bridge_leave (struct dsa_switch *ds, -struct dsa_notifier_bridge_info *info) +static int dsa_switch_sync_vlan_filtering (struct dsa_switch *ds, +struct dsa_notifier_bridge_info *info) { -struct dsa_switch_tree *dst = ds->dst;struct netlink_ext_ack extack = {0 };bool change_vlan_filtering = false;bool vlan_filtering;struct dsa_port *dp;int err; -if (dst->index == info->tree_index && ds->index == info->sw_index && - ds->ops->port_bridge_leave) - ds->ops->port_bridge_leave (ds, info->port, info->bridge); - -if ((dst->index != info->tree_index || ds->index != info->sw_index) && - ds->ops->crosschip_bridge_leave) - ds->ops->crosschip_bridge_leave (ds, info->tree_index, - info->sw_index, info->port, - info->bridge); -if (ds->needs_standalone_vlan_filtering && !br_vlan_enabled (info->bridge.dev)) { change_vlan_filtering = true;
@@ -172,6 +161,29 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,return err; } +return 0 ; +} + +static int dsa_switch_bridge_leave (struct dsa_switch *ds, +struct dsa_notifier_bridge_info *info) +{ +struct dsa_switch_tree *dst = ds->dst; +int err; + +if (dst->index == info->tree_index && ds->index == info->sw_index && + ds->ops->port_bridge_leave) + ds->ops->port_bridge_leave (ds, info->port, info->bridge); + +if ((dst->index != info->tree_index || ds->index != info->sw_index) && + ds->ops->crosschip_bridge_leave) + ds->ops->crosschip_bridge_leave (ds, info->tree_index, + info->sw_index, info->port, + info->bridge); + + err =dsa_switch_sync_vlan_filtering (ds, info); +if (err) +return err; +return dsa_tag_8021q_bridge_leave (ds, info); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 462/1126 net: dsa: Avoid cross-chip syncing of VLAN filtering
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
[ Upstream commit 108dc8741c203e9d6ce4e973367f1bac20c7192b ]
Changes to VLAN filtering are not applicable to cross-chip notifications.
On a system like this:
.-----. .-----. .-----.
| sw1 +---+ sw2 +---+ sw3 | '-1-2-' '-1-2-' '-1-2-'
Before this change, upon sw1p1 leaving a bridge, a call to dsa_port_vlan_filtering would also be made to sw2p1 and sw3p1.
In this scenario:
.---------. .-----. .-----.
| sw1 +---+ sw2 +---+ sw3 | '-1-2-3-4-' '-1-2-' '-1-2-'
When sw1p4 would leave a bridge, dsa_port_vlan_filtering would be called for sw2 and sw3 with a non-existing port - leading to array out-of-bounds accesses and crashes on mv88e6xxx.
--- net/dsa/switch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/dsa/switch.c +5 -3
@@ -180,9 +180,11 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds, info->sw_index, info->port, info->bridge); - err =dsa_switch_sync_vlan_filtering (ds, info); -if (err) -return err; +if (ds->dst->index == info->tree_index && ds->index == info->sw_index) { + err =dsa_switch_sync_vlan_filtering (ds, info); +if (err) +return err; + }return dsa_tag_8021q_bridge_leave (ds, info); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 463/1126 Bluetooth: hci_event: Fix HCI_EV_VENDOR max_len
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 314d8cd2787418c5ac6b02035c344644f47b292b ]
HCI_EV_VENDOR is in fact variable length since it acts as metaevent where a vendor can implement their own event sets.
In addition to it this makes use of bt_dev_warn_ratelimited to supress the amount of logging in case the event has more data than expected.
--- net/bluetooth/hci_event.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/bluetooth/hci_event.c +4 -3
@@ -6798,7 +6798,7 @@ static const struct hci_ev {HCI_EV (HCI_EV_NUM_COMP_BLOCKS , hci_num_comp_blocks_evt,sizeof (struct hci_ev_num_comp_blocks )),/* [0xff = HCI_EV_VENDOR] */ - HCI_EV(HCI_EV_VENDOR, msft_vendor_evt, 0), + HCI_EV_VL(HCI_EV_VENDOR, msft_vendor_evt, 0, HCI_MAX_EVENT_SIZE), }; static void hci_event_func(struct hci_dev *hdev, u8 event, struct sk_buff *skb,
@@ -6823,8 +6823,9 @@ static void hci_event_func(struct hci_dev *hdev, u8 event, struct sk_buff *skb,* decide if that is acceptable. */ if (skb->len > ev->max_len) -bt_dev_warn (hdev,"unexpected event 0x%2.2x length: %u > %u" , - event, skb->len, ev->max_len); +bt_dev_warn_ratelimited (hdev, +"unexpected event 0x%2.2x length: %u > %u" , + event, skb->len, ev->max_len); data =hci_ev_skb_pull (hdev, skb, event, ev->min_len);if (!data)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 464/1126 drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 2343bcdb4747d4f418a4daf2e898b94f86c24a59 ]
In nvkm_acr_hsfw_load_bl(), the return value of kmalloc() is directly passed to memcpy(), which could lead to undefined behavior on failure of kmalloc().
Fix this bug by using kmemdup() instead of kmalloc()+memcpy().
This bug was found by a static analyzer.
Builds with 'make allyesconfig' show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c +5 -4
@@ -142,11 +142,12 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char *name, int ver, hsfw->imem_size = desc->code_size; hsfw->imem_tag = desc->start_tag; - hsfw->imem =kmalloc (desc->code_size,GFP_KERNEL ); -memcpy (hsfw->imem, data + desc->code_off, desc->code_size); - + hsfw->imem =kmemdup (data + desc->code_off, desc->code_size,GFP_KERNEL );nvkm_firmware_put (fw); -return 0 ; +if (!hsfw->imem) +return -ENOMEM ; +else +return 0 ; }int
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 465/1126 drm/amd/display: Call dc_stream_release for remove link enc assignment
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit f2bde8349c35d01d7c50456ea06a5c7d5e0e5ed0 ]
[Why]
A porting error resulted in the stream assignment for the link being retained without being released - a memory leak.
[How]
Fix the porting error by adding back the dc_stream_release() intended as part of the original patch.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c +1 -0
@@ -122,6 +122,7 @@ static void remove_link_enc_assignment( stream->link_enc =NULL ; state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].eng_id =ENGINE_ID_UNKNOWN ; state->res_ctx.link_enc_cfg_ctx.link_enc_assignments[i].stream =NULL ; +dc_stream_release (stream);break ; } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 466/1126 drm/amd/display: Fix a NULL pointer dereference in amdgpu_dm_connector_add_common_modes()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 588a70177df3b1777484267584ef38ab2ca899a2 ]
In amdgpu_dm_connector_add_common_modes(), amdgpu_dm_create_common_mode() is assigned to mode and is passed to drm_mode_probed_add() directly after that. drm_mode_probed_add() passes &mode->head to list_add_tail(), and there is a dereference of it in list_add_tail() without recoveries, which could lead to NULL pointer dereference on failure of amdgpu_dm_create_common_mode().
Fix this by adding a NULL check of mode.
This bug was found by a static analyzer.
Builds with 'make allyesconfig' show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -8144,6 +8144,9 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder, mode =amdgpu_dm_create_common_mode (encoder, common_modes[i].name, common_modes[i].w, common_modes[i].h); +if (!mode) +continue ; +drm_mode_probed_add (connector, mode); amdgpu_dm_connector->num_modes++; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 467/1126 drm/amd/pm: return -ENOTSUPP if there is no get_dpm_ultimate_freq function
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 430e6a0212b2a0eb1de5e9d47a016fa79edf3978 ]
clang static analysis reports this represenative problem amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value
return clk_freq * 100;
~~~~~~~~ ^If there is no get_dpm_ultimate_freq function, smu_get_dpm_freq_range returns success without setting the output min,max parameters. So return an -ENOTSUPP error.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
@@ -138,7 +138,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu,uint32_t *min, uint32_t *max) { - int ret = 0; + int ret = -ENOTSUPP;if (!min && !max)return -EINVAL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 468/1126 net: phy: at803x: move page selection fix to config_init
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 4f3a00c7f5b2cfe4e127fd3fe49b55e1b318c01f ]
The fix to select the copper page on AR8031 was being done in the probe function rather than config_init, so it would not be redone after resume from suspend. Move this to config_init so it is always redone when needed.
--- drivers/net/phy/at803x.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-)
drivers/net/phy/at803x.c +16 -24
@@ -784,25 +784,7 @@ static int at803x_probe(struct phy_device *phydev)return ret; } -/* Some bootloaders leave the fiber page selected. -* Switch to the copper page, as otherwise we read -* the PHY capabilities from the fiber side. -*/ -if (phydev->drv->phy_id ==ATH8031_PHY_ID ) { -phy_lock_mdio_bus (phydev); - ret =at803x_write_page (phydev,AT803X_PAGE_COPPER ); -phy_unlock_mdio_bus (phydev); -if (ret) - goto err; - } -return 0 ; - -err: -if (priv->vddio) -regulator_disable (priv->vddio); - -return ret; }static void at803x_remove (struct phy_device *phydev)
@@ -912,6 +894,22 @@ static int at803x_config_init(struct phy_device *phydev) {int ret; +if (phydev->drv->phy_id ==ATH8031_PHY_ID ) { +/* Some bootloaders leave the fiber page selected. +* Switch to the copper page, as otherwise we read +* the PHY capabilities from the fiber side. +*/ +phy_lock_mdio_bus (phydev); + ret =at803x_write_page (phydev,AT803X_PAGE_COPPER ); +phy_unlock_mdio_bus (phydev); +if (ret) +return ret; + + ret =at8031_pll_config (phydev); +if (ret <0 ) +return ret; + } +/* The RX and TX delay default is: * after HW reset: RX delay enabled and TX delay disabled * after SW reset: RX delay enabled, while TX delay retains the
@@ -941,12 +939,6 @@ static int at803x_config_init(struct phy_device *phydev)if (ret <0 )return ret; -if (phydev->drv->phy_id ==ATH8031_PHY_ID ) { - ret =at8031_pll_config (phydev); -if (ret <0 ) -return ret; - } -/* Ar803x extended next page bit is enabled by default. Cisco * multigig switches read this bit and attempt to negotiate 10Gbps * rates even if the next page bit is disabled. This is incorrect
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 469/1126 selftests/bpf/test_xdp_redirect_multi: use temp netns for testing
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit cec74489a8dee93053340ec88ea938ff4008c3c0 ]
Use temp netns instead of hard code name for testing in case the netns already exists.
Remove the hard code interface index when creating the veth interfaces. Because when the system loads some virtual interface modules, e.g. tunnels. the ifindex of 2 will be used and the cmd will fail.
As the netns has not created if checking environment failed. Trap the clean up function after checking env.
--- .../selftests/bpf/test_xdp_redirect_multi.sh | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-)
tools/testing/selftests/bpf/test_xdp_redirect_multi.sh +31 -29
@@ -32,6 +32,11 @@ DRV_MODE="xdpgeneric xdpdrv xdpegress" PASS=0 FAIL=0 LOG_DIR=$(mktemp -d) +declare -a NS +NS[0]="ns0-$(mktemp -u XXXXXX)" +NS[1]="ns1-$(mktemp -u XXXXXX)" +NS[2]="ns2-$(mktemp -u XXXXXX)" +NS[3]="ns3-$(mktemp -u XXXXXX)" test_pass() {
@@ -47,11 +52,9 @@ test_fail() clean_up() { - for i in $(seq $NUM); do - ip link del veth$i 2> /dev/null - ip netns del ns$i 2> /dev/null + for i in $(seq 0 $NUM); do + ip netns del ${NS[$i]} 2> /dev/null done - ip netns del ns0 2> /dev/null } # Kselftest framework requirement - SKIP code is 4.
@@ -79,23 +82,22 @@ setup_ns() mode="xdpdrv" fi - ip netns add ns0 + ip netns add ${NS[0]} for i in $(seq $NUM); do - ip netns add ns$i - ip -n ns$i link add veth0 index 2 type veth \ - peer name veth$i netns ns0 index $((1 + $i)) - ip -n ns0 link set veth$i up - ip -n ns$i link set veth0 up - - ip -n ns$i addr add 192.0.2.$i/24 dev veth0 - ip -n ns$i addr add 2001:db8::$i/64 dev veth0 + ip netns add ${NS[$i]} + ip -n ${NS[$i]} link add veth0 type veth peer name veth$i netns ${NS[0]} + ip -n ${NS[$i]} link set veth0 up + ip -n ${NS[0]} link set veth$i up + + ip -n ${NS[$i]} addr add 192.0.2.$i/24 dev veth0 + ip -n ${NS[$i]} addr add 2001:db8::$i/64 dev veth0 # Add a neigh entry for IPv4 ping test - ip -n ns$i neigh add 192.0.2.253 lladdr 00:00:00:00:00:01 dev veth0 - ip -n ns$i link set veth0 $mode obj \ + ip -n ${NS[$i]} neigh add 192.0.2.253 lladdr 00:00:00:00:00:01 dev veth0 + ip -n ${NS[$i]} link set veth0 $mode obj \ xdp_dummy.o sec xdp &> /dev/null || \ { test_fail "Unable to load dummy xdp" && exit 1; } IFACES="$IFACES veth$i" - veth_mac[$i]=$(ip -n ns0 link show veth$i | awk '/link\/ether/ {print $2}') + veth_mac[$i]=$(ip -n ${NS[0]} link show veth$i | awk '/link\/ether/ {print $2}') done }
@@ -104,10 +106,10 @@ do_egress_tests() local mode=$1 # mac test - ip netns exec ns2 tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-2_${mode}.log & - ip netns exec ns3 tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-3_${mode}.log & + ip netns exec ${NS[2]} tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-2_${mode}.log & + ip netns exec ${NS[3]} tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-3_${mode}.log & sleep 0.5 - ip netns exec ns1 ping 192.0.2.254 -i 0.1 -c 4 &> /dev/null + ip netns exec ${NS[1]} ping 192.0.2.254 -i 0.1 -c 4 &> /dev/null sleep 0.5 pkill tcpdump
@@ -123,18 +125,18 @@ do_ping_tests() local mode=$1 # ping6 test: echo request should be redirect back to itself, not others - ip netns exec ns1 ip neigh add 2001:db8::2 dev veth0 lladdr 00:00:00:00:00:02 + ip netns exec ${NS[1]} ip neigh add 2001:db8::2 dev veth0 lladdr 00:00:00:00:00:02 - ip netns exec ns1 tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-1_${mode}.log & - ip netns exec ns2 tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-2_${mode}.log & - ip netns exec ns3 tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-3_${mode}.log & + ip netns exec ${NS[1]} tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-1_${mode}.log & + ip netns exec ${NS[2]} tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-2_${mode}.log & + ip netns exec ${NS[3]} tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-3_${mode}.log & sleep 0.5 # ARP test - ip netns exec ns1 arping -q -c 2 -I veth0 192.0.2.254 + ip netns exec ${NS[1]} arping -q -c 2 -I veth0 192.0.2.254 # IPv4 test - ip netns exec ns1 ping 192.0.2.253 -i 0.1 -c 4 &> /dev/null + ip netns exec ${NS[1]} ping 192.0.2.253 -i 0.1 -c 4 &> /dev/null # IPv6 test - ip netns exec ns1 ping6 2001:db8::2 -i 0.1 -c 2 &> /dev/null + ip netns exec ${NS[1]} ping6 2001:db8::2 -i 0.1 -c 2 &> /dev/null sleep 0.5 pkill tcpdump
@@ -180,7 +182,7 @@ do_tests() xdpgeneric) drv_p="-S";; esac - ip netns exec ns0 ./xdp_redirect_multi $drv_p $IFACES &> ${LOG_DIR}/xdp_redirect_${mode}.log & + ip netns exec ${NS[0]} ./xdp_redirect_multi $drv_p $IFACES &> ${LOG_DIR}/xdp_redirect_${mode}.log & xdp_pid=$! sleep 1 if ! ps -p $xdp_pid > /dev/null; then
@@ -197,10 +199,10 @@ do_tests() kill $xdp_pid } -trap clean_up EXIT - check_env +trap clean_up EXIT + for mode in ${DRV_MODE}; do setup_ns $mode do_tests $mode
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 470/1126 ath9k_htc: fix uninit value bugs
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit d1e0df1c57bd30871dd1c855742a7c346dbca853 ]
Syzbot reported 2 KMSAN bugs in ath9k. All of them are caused by missing field initialization.
In htc_connect_service() svc_meta_len and pad are not initialized. Based on code it looks like in current skb there is no service data, so simply initialize svc_meta_len to 0.
htc_issue_send() does not initialize htc_frame_hdr::control array. Based on firmware code, it will initialize it by itself, so simply zero whole array to make KMSAN happy
Fail logs:
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 hif_usb_send_regout drivers/net/wireless/ath/ath9k/hif_usb.c:127 [inline] hif_usb_send+0x5f0/0x16f0 drivers/net/wireless/ath/ath9k/hif_usb.c:479 htc_issue_send drivers/net/wireless/ath/ath9k/htc_hst.c:34 [inline] htc_connect_service+0x143e/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:275
...
Uninit was created at:
slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] htc_connect_service+0x1029/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:258
...
Bytes 4-7 of 18 are uninitialized
Memory access of size 18 starts at ffff888027377e00
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 hif_usb_send_regout drivers/net/wireless/ath/ath9k/hif_usb.c:127 [inline] hif_usb_send+0x5f0/0x16f0 drivers/net/wireless/ath/ath9k/hif_usb.c:479 htc_issue_send drivers/net/wireless/ath/ath9k/htc_hst.c:34 [inline] htc_connect_service+0x143e/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:275
...
Uninit was created at:
slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] htc_connect_service+0x1029/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:258
...
Bytes 16-17 of 18 are uninitialized
Memory access of size 18 starts at ffff888027377e00
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath9k/htc_hst.c +5 -0
@@ -30,6 +30,7 @@ static int htc_issue_send(struct htc_target *target, struct sk_buff* skb, hdr->endpoint_id = epid; hdr->flags = flags; hdr->payload_len =cpu_to_be16 (len); +memset (hdr->control,0 ,sizeof (hdr->control)); status = target->hif->send (target->hif_dev, endpoint->ul_pipeid, skb);
@@ -272,6 +273,10 @@ int htc_connect_service(struct htc_target *target, conn_msg->dl_pipeid = endpoint->dl_pipeid; conn_msg->ul_pipeid = endpoint->ul_pipeid; +/* To prevent infoleak */ + conn_msg->svc_meta_len =0 ; + conn_msg->pad =0 ; + ret =htc_issue_send (target, skb, skb->len,0 ,ENDPOINT0 );if (ret) goto err;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 471/1126 ath11k: set WMI_PEER_40MHZ while peer assoc for 6 GHz
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 1cb747192de2edb7e55920af8c458e4792908486 ]
When station connect to AP of 6 GHz with 40 MHz bandwidth, the TX is always stay 20 MHz, it is because the flag WMI_PEER_40MHZ is not set while peer assoc. Add the flag if remote peer is 40 MHz bandwidth.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
--- drivers/net/wireless/ath/ath11k/mac.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +3 -0
@@ -2319,6 +2319,9 @@ static void ath11k_peer_assoc_h_he_6ghz(struct ath11k *ar,if (!arg->he_flag || band !=NL80211_BAND_6GHZ || !sta->he_6ghz_capa.capa)return ; +if (sta->bandwidth ==IEEE80211_STA_RX_BW_40 ) + arg->bw_40 = true; +if (sta->bandwidth ==IEEE80211_STA_RX_BW_80 ) arg->bw_80 = true;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 472/1126 RDMA/core: Set MR type in ib_reg_user_mr
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit 32a88d16615c2be295571c29273c4ac94cb75309 ]
Add missing assignment of MR type to IB_MR_TYPE_USER.
--- drivers/infiniband/core/verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/verbs.c +1 -0
@@ -2153,6 +2153,7 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,return mr; mr->device = pd->device; + mr->type =IB_MR_TYPE_USER ; mr->pd = pd; mr->dm =NULL ;atomic_inc (&pd->usecnt);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 473/1126 KVM: PPC: Fix vmx/vsx mixup in mmio emulation
In reply to Greg Kroah-HartmanFrom: Fabiano Rosas <[email protected]>
[ Upstream commit b99234b918c6e36b9aa0a5b2981e86b6bd11f8e2 ]
The MMIO emulation code for vector instructions is duplicated between VSX and VMX. When emulating VMX we should check the VMX copy size instead of the VSX one.
--- arch/powerpc/kvm/powerpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/powerpc.c +2 -2
@@ -1499,7 +1499,7 @@ int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu, {enum emulation_result emulated =EMULATE_DONE ; -if (vcpu->arch.mmio_vsx_copy_nums >2 ) +if (vcpu->arch.mmio_vmx_copy_nums >2 )return EMULATE_FAIL ;while (vcpu->arch.mmio_vmx_copy_nums) {
@@ -1596,7 +1596,7 @@ int kvmppc_handle_vmx_store(struct kvm_vcpu *vcpu,unsigned int index = rs &KVM_MMIO_REG_MASK ;enum emulation_result emulated =EMULATE_DONE ; -if (vcpu->arch.mmio_vsx_copy_nums >2 ) +if (vcpu->arch.mmio_vmx_copy_nums >2 )return EMULATE_FAIL ; vcpu->arch.io_gpr = rs;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 474/1126 selftests/net: timestamping: Fix bind_phc check
In reply to Greg Kroah-HartmanFrom: Gerhard Engleder <[email protected]>
[ Upstream commit 678dfd5280341d877ca646499bfdc82a3d8b4356 ]
timestamping checks socket options during initialisation. For the field bind_phc of the socket option SO_TIMESTAMPING it expects the value -1 if PHC is not bound. Actually the value of bind_phc is 0 if PHC is not bound. This results in the following output:
SIOCSHWTSTAMP: tx_type 0 requested, got 0; rx_filter 0 requested, got 0 SO_TIMESTAMP 0SO_TIMESTAMPNS 0SO_TIMESTAMPING flags 0, bind phc 0
not expected, flags 0, bind phc -1
This is fixed by setting default value and expected value of bind_phc to 0.
--- tools/testing/selftests/net/timestamping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/timestamping.c +2 -2
@@ -325,8 +325,8 @@ int main(int argc, char **argv)struct ifreq device;struct ifreq hwtstamp;struct hwtstamp_config hwconfig, hwconfig_requested; -struct so_timestamping so_timestamping_get = {0 ,-1 }; -struct so_timestamping so_timestamping = {0 ,-1 }; +struct so_timestamping so_timestamping_get = {0 ,0 }; +struct so_timestamping so_timestamping = {0 ,0 };struct sockaddr_in addr;struct ip_mreq imr;struct in_addr iaddr;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 475/1126 rtw88: check for validity before using a pointer
In reply to Greg Kroah-HartmanFrom: Muhammad Usama Anjum <[email protected]>
[ Upstream commit a12f809968dbf46ce2a6bc94463db8d431bb75fc ]
ieee80211_probereq_get() can return NULL. Pointer skb should be checked for validty before use. If it is not valid, list of skbs needs to be freed.
--- drivers/net/wireless/realtek/rtw88/fw.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/realtek/rtw88/fw.c +8 -0
@@ -1866,11 +1866,19 @@ static int rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, req->ssids[i].ssid, req->ssids[i].ssid_len, req->ie_len); +if (!skb) + goto out;rtw_append_probe_req_ie (rtwdev, skb, &list, rtwvif);kfree_skb (skb); }return _rtw_hw_scan_update_probe_req (rtwdev, num, &list); + +out: + skb_queue_walk(&list, skb) +kfree_skb (skb); + +return -ENOMEM ; } static int rtw_add_chan_info(struct rtw_dev *rtwdev, struct rtw_chan_info *info,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 476/1126 rtw88: fix idle mode flow for hw scan
In reply to Greg Kroah-HartmanFrom: Po-Hao Huang <[email protected]>
[ Upstream commit c17f27167b4cb4988ae035fb8dce0c314e9de155 ]
Upon hw scan completion, idle mode is not re-entered. This might increase power consumption under no link mode. Fix this by adding the re-enter flow. We need another work for this since enter_ips waits for c2h_work to finish, which might lead to deadlock if caller is in the same work.
--- drivers/net/wireless/realtek/rtw88/fw.c | 2 +- drivers/net/wireless/realtek/rtw88/mac80211.c | 5 ++++- drivers/net/wireless/realtek/rtw88/main.c | 16 +++++++++++++++- drivers/net/wireless/realtek/rtw88/main.h | 4 +++- 4 files changed, 23 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw88/fw.c +1 -1
@@ -2030,7 +2030,7 @@ void rtw_hw_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, rtwdev->hal.rcr |=BIT_CBSSID_BCN ;rtw_write32 (rtwdev,REG_RCR , rtwdev->hal.rcr); -rtw_core_scan_complete (rtwdev, vif); +rtw_core_scan_complete (rtwdev, vif, true);ieee80211_wake_queues (rtwdev->hw);ieee80211_scan_completed (rtwdev->hw, &info);
drivers/net/wireless/realtek/rtw88/mac80211.c +4 -1
@@ -72,6 +72,9 @@ static int rtw_ops_config(struct ieee80211_hw *hw, u32 changed)struct rtw_dev *rtwdev = hw->priv;int ret =0 ; +/* let previous ips work finish to ensure we don't leave ips twice */ +cancel_work_sync (&rtwdev->ips_work); +mutex_lock (&rtwdev->mutex);rtw_leave_lps_deep (rtwdev);
@@ -614,7 +617,7 @@ static void rtw_ops_sw_scan_complete(struct ieee80211_hw *hw,struct rtw_dev *rtwdev = hw->priv;mutex_lock (&rtwdev->mutex); -rtw_core_scan_complete (rtwdev, vif); +rtw_core_scan_complete (rtwdev, vif, false);mutex_unlock (&rtwdev->mutex); }
drivers/net/wireless/realtek/rtw88/main.c +15 -1
@@ -272,6 +272,15 @@ static void rtw_c2h_work(struct work_struct *work) } } +static void rtw_ips_work (struct work_struct *work) +{ + struct rtw_dev *rtwdev = container_of(work, struct rtw_dev, ips_work); + +mutex_lock (&rtwdev->mutex); +rtw_enter_ips (rtwdev); +mutex_unlock (&rtwdev->mutex); +} +static u8 rtw_acquire_macid (struct rtw_dev *rtwdev) {unsigned long mac_id;
@@ -1339,7 +1348,8 @@ void rtw_core_scan_start(struct rtw_dev *rtwdev, struct rtw_vif *rtwvif,set_bit (RTW_FLAG_SCANNING , rtwdev->flags); } -void rtw_core_scan_complete (struct rtw_dev *rtwdev,struct ieee80211_vif *vif) +void rtw_core_scan_complete (struct rtw_dev *rtwdev,struct ieee80211_vif *vif, +bool hw_scan) {struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;u32 config =0 ;
@@ -1354,6 +1364,9 @@ void rtw_core_scan_complete(struct rtw_dev *rtwdev, struct ieee80211_vif *vif)rtw_vif_port_config (rtwdev, rtwvif, config);rtw_coex_scan_notify (rtwdev,COEX_SCAN_FINISH ); + +if (rtwvif->net_type ==RTW_NET_NO_LINK && hw_scan) +ieee80211_queue_work (rtwdev->hw, &rtwdev->ips_work); }int rtw_core_start (struct rtw_dev *rtwdev)
@@ -1919,6 +1932,7 @@ int rtw_core_init(struct rtw_dev *rtwdev)INIT_DELAYED_WORK (&coex->wl_ccklock_work, rtw_coex_wl_ccklock_work);INIT_WORK (&rtwdev->tx_work, rtw_tx_work);INIT_WORK (&rtwdev->c2h_work, rtw_c2h_work); +INIT_WORK (&rtwdev->ips_work, rtw_ips_work);INIT_WORK (&rtwdev->fw_recovery_work, rtw_fw_recovery_work);INIT_WORK (&rtwdev->ba_work, rtw_txq_ba_work);skb_queue_head_init (&rtwdev->c2h_queue);
drivers/net/wireless/realtek/rtw88/main.h +3 -1
@@ -1960,6 +1960,7 @@ struct rtw_dev {/* c2h cmd queue & handler work */ struct sk_buff_head c2h_queue;struct work_struct c2h_work; +struct work_struct ips_work;struct work_struct fw_recovery_work;/* used to protect txqs list */
@@ -2101,7 +2102,8 @@ void rtw_tx_report_purge_timer(struct timer_list *t);void rtw_update_sta_info (struct rtw_dev *rtwdev,struct rtw_sta_info *si);void rtw_core_scan_start (struct rtw_dev *rtwdev,struct rtw_vif *rtwvif,const u8 *mac_addr,bool hw_scan); -void rtw_core_scan_complete (struct rtw_dev *rtwdev,struct ieee80211_vif *vif); +void rtw_core_scan_complete (struct rtw_dev *rtwdev,struct ieee80211_vif *vif, +bool hw_scan);int rtw_core_start (struct rtw_dev *rtwdev);void rtw_core_stop (struct rtw_dev *rtwdev);int rtw_chip_info_setup (struct rtw_dev *rtwdev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 477/1126 rtw88: fix memory overrun and memory leak during hw_scan
In reply to Greg Kroah-HartmanFrom: Po-Hao Huang <[email protected]>
[ Upstream commit d95984b5580dcb8b1c0036577c52b609990a1dab ]
Previously we allocated less memory than actual required, overwrite to the buffer causes the mm module to complaint and raise access violation faults. Along with potential memory leaks when returned early. Fix these by passing the correct size and proper deinit flow.
--- drivers/net/wireless/realtek/rtw88/fw.c | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-)
drivers/net/wireless/realtek/rtw88/fw.c +24 -10
@@ -1784,9 +1784,9 @@ void rtw_fw_scan_notify(struct rtw_dev *rtwdev, bool start)rtw_fw_send_h2c_command (rtwdev, h2c_pkt); } -static void rtw_append_probe_req_ie (struct rtw_dev *rtwdev,struct sk_buff *skb, -struct sk_buff_head *list, -struct rtw_vif *rtwvif) +static int rtw_append_probe_req_ie (struct rtw_dev *rtwdev,struct sk_buff *skb, +struct sk_buff_head *list,u8 *bands, +struct rtw_vif *rtwvif) {struct ieee80211_scan_ies *ies = rtwvif->scan_ies;struct rtw_chip_info *chip = rtwdev->chip;
@@ -1797,19 +1797,24 @@ static void rtw_append_probe_req_ie(struct rtw_dev *rtwdev, struct sk_buff *skb,if (!(BIT (idx) & chip->band))continue ; new =skb_copy (skb,GFP_KERNEL ); +if (!new) +return -ENOMEM ;skb_put_data (new, ies->ies[idx], ies->len[idx]);skb_put_data (new, ies->common_ies, ies->common_ie_len);skb_queue_tail (list, new); + (*bands)++; } + +return 0 ; } -static int _rtw_hw_scan_update_probe_req (struct rtw_dev *rtwdev,u8 num_ssids, +static int _rtw_hw_scan_update_probe_req (struct rtw_dev *rtwdev,u8 num_probes,struct sk_buff_head *probe_req_list) {struct rtw_chip_info *chip = rtwdev->chip;struct sk_buff *skb, *tmp;u8 page_offset =1 , *buf, page_size = chip->page_size; -u8 pages = page_offset + num_ssids *RTW_PROBE_PG_CNT ; +u8 pages = page_offset + num_probes *RTW_PROBE_PG_CNT ;u16 pg_addr = rtwdev->fifo.rsvd_h2c_info_addr, loc;u16 buf_offset = page_size * page_offset;u8 tx_desc_sz = chip->tx_pkt_desc_sz;
@@ -1848,6 +1853,8 @@ static int _rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, u8 num_ssids, rtwdev->scan_info.probe_pg_size = page_offset; out:kfree (buf); + skb_queue_walk(probe_req_list, skb) +kfree_skb (skb);return ret; }
@@ -1858,7 +1865,8 @@ static int rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev,struct cfg80211_scan_request *req = rtwvif->scan_req;struct sk_buff_head list;struct sk_buff *skb; -u8 num = req->n_ssids, i; +u8 num = req->n_ssids, i, bands =0 ; +int ret;skb_queue_head_init (&list);for (i =0 ; i < num; i++) {
@@ -1866,19 +1874,25 @@ static int rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, req->ssids[i].ssid, req->ssids[i].ssid_len, req->ie_len); -if (!skb) +if (!skb) { + ret = -ENOMEM ; goto out; -rtw_append_probe_req_ie (rtwdev, skb, &list, rtwvif); + } + ret =rtw_append_probe_req_ie (rtwdev, skb, &list, &bands, + rtwvif); +if (ret) + goto out; +kfree_skb (skb); } -return _rtw_hw_scan_update_probe_req (rtwdev, num, &list); +return _rtw_hw_scan_update_probe_req (rtwdev, num * bands, &list); out: skb_queue_walk(&list, skb)kfree_skb (skb); -return -ENOMEM ; +return ret; } static int rtw_add_chan_info(struct rtw_dev *rtwdev, struct rtw_chan_info *info,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 478/1126 drm/bridge: lt9611: Fix an error handling path in lt9611_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 9987151a90567785beebcbd5c8ac58d05f254137 ]
If lt9611_audio_init() fails, some resources still need to be released before returning an error code.
Add the missing goto the error handling path.
--- drivers/gpu/drm/bridge/lontium-lt9611.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt9611.c +5 -1
@@ -1164,7 +1164,11 @@ static int lt9611_probe(struct i2c_client *client,lt9611_enable_hpd_interrupts (lt9611); -return lt9611_audio_init (dev, lt9611); + ret =lt9611_audio_init (dev, lt9611); +if (ret) + goto err_remove_bridge; + +return 0 ; err_remove_bridge:drm_bridge_remove (<9611->bridge);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 479/1126 i40e: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit bc97f9c6f988b31b728eb47a94ca825401dbeffe ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, i40e_construct_skb_zc() currently allocates and reserves additional xdp->data - xdp->data_hard_start, which is XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
--- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +1 -3
@@ -246,13 +246,11 @@ static struct sk_buff *i40e_construct_skb_zc(struct i40e_ring *rx_ring,struct sk_buff *skb;/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, - xdp->data_end - xdp->data_hard_start, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb)) goto out; -skb_reserve (skb, xdp->data - xdp->data_hard_start);memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 480/1126 i40e: respect metadata on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 6dba29537c0f639b482bd8f8bbd50ab4ae74b48d ]
For now, if the XDP prog returns XDP_PASS on XSK, the metadata will be lost as it doesn't get copied to the skb.
Copy it along with the frame headers. Account its size on skb allocation, and when copying just treat it as a part of the frame and do a pull after to "move" it to the "reserved" zone.
net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match i40e_construct_skb().
--- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +10 -4
@@ -241,19 +241,25 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count)static struct sk_buff *i40e_construct_skb_zc (struct i40e_ring *rx_ring,struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; +net_prefetch (xdp->data_meta); +/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb)) goto out; -memcpy (__skb_put (skb, datasize), xdp->data, datasize); -if (metasize) +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); + +if (metasize) {skb_metadata_set (skb, metasize); +__skb_pull (skb, metasize); + } out:xsk_buff_free (xdp);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 481/1126 ice: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit dc44572d195e10ec41a03e09b3b5addab4af5cea ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, ice_construct_skb_zc() currently allocates and reserves additional xdp->data - xdp->data_hard_start, which is XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
--- drivers/net/ethernet/intel/ice/ice_xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_xsk.c +1 -3
@@ -428,17 +428,15 @@ static void ice_bump_ntc(struct ice_rx_ring *rx_ring)static struct sk_buff *ice_construct_skb_zc (struct ice_rx_ring *rx_ring,struct xdp_buff *xdp) { -unsigned int datasize_hard = xdp->data_end - xdp->data_hard_start;unsigned int metasize = xdp->data - xdp->data_meta;unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize_hard, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, xdp->data - xdp->data_hard_start);memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 482/1126 ice: respect metadata on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 45a34ca68070e34e09d5bf4309f7f1f286a27fc7 ]
For now, if the XDP prog returns XDP_PASS on XSK, the metadata will be lost as it doesn't get copied to the skb.
Copy it along with the frame headers. Account its size on skb allocation, and when copying just treat it as a part of the frame and do a pull after to "move" it to the "reserved" zone.
net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match ice_construct_skb().
--- drivers/net/ethernet/intel/ice/ice_xsk.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_xsk.c +10 -4
@@ -428,18 +428,24 @@ static void ice_bump_ntc(struct ice_rx_ring *rx_ring)static struct sk_buff *ice_construct_skb_zc (struct ice_rx_ring *rx_ring,struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize, +net_prefetch (xdp->data_meta); + + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -memcpy (__skb_put (skb, datasize), xdp->data, datasize); -if (metasize) +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); + +if (metasize) {skb_metadata_set (skb, metasize); +__skb_pull (skb, metasize); + }xsk_buff_free (xdp);return skb;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 483/1126 igc: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit f9e61d365bafdee40fe2586fc6be490c3e824dad ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, igc_construct_skb_zc() currently allocates and reserves additional xdp->data_meta - xdp->data_hard_start, which is about XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only (+ meta) to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
Also, net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match igc_construct_skb().
--- drivers/net/ethernet/intel/igc/igc_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +7 -6
@@ -2446,19 +2446,20 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget)static struct sk_buff *igc_construct_skb_zc (struct igc_ring *ring,struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data; -unsigned int totalsize = metasize + datasize;struct sk_buff *skb; - skb =__napi_alloc_skb (&ring->q_vector->napi, - xdp->data_end - xdp->data_hard_start, +net_prefetch (xdp->data_meta); + + skb =__napi_alloc_skb (&ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, xdp->data_meta - xdp->data_hard_start); -memcpy (__skb_put (skb, totalsize), xdp->data_meta, totalsize); +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); +if (metasize) {skb_metadata_set (skb, metasize);__skb_pull (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 484/1126 ixgbe: pass bi->xdp to ixgbe_construct_skb_zc() directly
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 1fbdaa13386804a31eefd3db3c5fe00e80ce9bc3 ]
To not dereference bi->xdp each time in ixgbe_construct_skb_zc(), pass bi->xdp as an argument instead of bi. We can also call xsk_buff_free() outside of the function as well as assign bi->xdp to NULL, which seems to make it closer to its name.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +10 -9
@@ -207,26 +207,24 @@ bool ixgbe_alloc_rx_buffers_zc(struct ixgbe_ring *rx_ring, u16 count) }static struct sk_buff *ixgbe_construct_skb_zc (struct ixgbe_ring *rx_ring, -struct ixgbe_rx_buffer *bi) +const struct xdp_buff *xdp) { -unsigned int metasize = bi->xdp->data - bi->xdp->data_meta; -unsigned int datasize = bi->xdp->data_end - bi->xdp->data; +unsigned int metasize = xdp->data - xdp->data_meta; +unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb;/* allocate a skb to store the frags */ skb =__napi_alloc_skb (&rx_ring->q_vector->napi, - bi->xdp->data_end - bi->xdp->data_hard_start, + xdp->data_end - xdp->data_hard_start,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, bi->xdp->data - bi->xdp->data_hard_start); -memcpy (__skb_put (skb, datasize), bi->xdp->data, datasize); +skb_reserve (skb, xdp->data - xdp->data_hard_start); +memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize); -xsk_buff_free (bi->xdp); - bi->xdp =NULL ;return skb; }
@@ -317,12 +315,15 @@ int ixgbe_clean_rx_irq_zc(struct ixgbe_q_vector *q_vector, }/* XDP_PASS path */ - skb =ixgbe_construct_skb_zc (rx_ring, bi); + skb =ixgbe_construct_skb_zc (rx_ring, bi->xdp);if (!skb) { rx_ring->rx_stats.alloc_rx_buff_failed++;break ; } +xsk_buff_free (bi->xdp); + bi->xdp =NULL ; + cleaned_count++;ixgbe_inc_ntc (rx_ring);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 485/1126 ixgbe: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 8f405221a73a53234486c185d8ef647377a53cc6 ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, ixgbe_construct_skb_zc() currently allocates and reserves additional xdp->data - xdp->data_hard_start, which is XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +1 -3
@@ -214,13 +214,11 @@ static struct sk_buff *ixgbe_construct_skb_zc(struct ixgbe_ring *rx_ring,struct sk_buff *skb;/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, - xdp->data_end - xdp->data_hard_start, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, xdp->data - xdp->data_hard_start);memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 486/1126 ixgbe: respect metadata on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit f322a620be69e95594eda89502b478aa7dbf6ec2 ]
For now, if the XDP prog returns XDP_PASS on XSK, the metadata will be lost as it doesn't get copied to the skb.
Copy it along with the frame headers. Account its size on skb allocation, and when copying just treat it as a part of the frame and do a pull after to "move" it to the "reserved" zone.
net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match ixgbe_construct_skb().
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +10 -4
@@ -209,19 +209,25 @@ bool ixgbe_alloc_rx_buffers_zc(struct ixgbe_ring *rx_ring, u16 count)static struct sk_buff *ixgbe_construct_skb_zc (struct ixgbe_ring *rx_ring,const struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; +net_prefetch (xdp->data_meta); +/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -memcpy (__skb_put (skb, datasize), xdp->data, datasize); -if (metasize) +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); + +if (metasize) {skb_metadata_set (skb, metasize); +__skb_pull (skb, metasize); + }return skb; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 487/1126 power: reset: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit ba18dad0fb880cd29aa97b6b75560ef14d1061ba ]
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/power/reset/gemini-poweroff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/reset/gemini-poweroff.c +2 -2
@@ -107,8 +107,8 @@ static int gemini_poweroff_probe(struct platform_device *pdev)return PTR_ERR (gpw->base); irq =platform_get_irq (pdev,0 ); -if (!irq) -return -EINVAL ; +if (irq <0 ) +return irq; gpw->dev = dev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 488/1126 ray_cs: Check ioremap return value
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 7e4760713391ee46dc913194b33ae234389a174e ]
As the possible failure of the ioremap(), the 'local->sram' and other two could be NULL.
Therefore it should be better to check it in order to avoid the later dev_dbg.
--- drivers/net/wireless/ray_cs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ray_cs.c +6 -0
@@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->sram =ioremap (link->resource[2 ]->start,resource_size (link->resource[2 ])); +if (!local->sram) + goto failed;/*** Set up 16k window for shared memory (receive buffer) ***************/ link->resource[3]->flags |=
@@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->rmem =ioremap (link->resource[3 ]->start,resource_size (link->resource[3 ])); +if (!local->rmem) + goto failed;/*** Set up window for attribute memory ***********************************/ link->resource[4]->flags |=
@@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->amem =ioremap (link->resource[4 ]->start,resource_size (link->resource[4 ])); +if (!local->amem) + goto failed;dev_dbg (&link->dev,"ray_config sram=%p\n" , local->sram);dev_dbg (&link->dev,"ray_config rmem=%p\n" , local->rmem);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 489/1126 powerpc: dts: t1040rdb: fix ports names for Seville Ethernet switch
In reply to Greg Kroah-HartmanFrom: Maxim Kiselev <[email protected]>
[ Upstream commit 5ebb74749202a25da4b3cc2eb15470225a05527c ]
On board rev A, the network interface labels for the switch ports written on the front panel are different than on rev B and later.
This patch fixes network interface names for the switch ports according to labels that are written on the front panel of the board rev B. They start from ETH3 and end at ETH10.
This patch also introduces a separate device tree for rev A. The main device tree is supposed to cover rev B and later.
--- arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts | 30 ++++++++++++++++++++ arch/powerpc/boot/dts/fsl/t1040rdb.dts | 8 +++--- 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts
arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts new file +30 -0
@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * T1040RDB-REV-A Device Tree Source + * + * Copyright 2014 - 2015 Freescale Semiconductor Inc. + * + */ + +#include "t1040rdb.dts" + +/ { + model = "fsl,T1040RDB-REV-A"; + compatible = "fsl,T1040RDB-REV-A"; +}; + +&seville_port0 { + label = "ETH5"; +}; + +&seville_port2 { + label = "ETH7"; +}; + +&seville_port4 { + label = "ETH9"; +}; + +&seville_port6 { + label = "ETH11"; +};
arch/powerpc/boot/dts/fsl/t1040rdb.dts +4 -4
@@ -119,7 +119,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_0>; phy-mode = "qsgmii"; - label = "ETH5"; + label = "ETH3"; status = "okay"; };
@@ -135,7 +135,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_2>; phy-mode = "qsgmii"; - label = "ETH7"; + label = "ETH5"; status = "okay"; };
@@ -151,7 +151,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_4>; phy-mode = "qsgmii"; - label = "ETH9"; + label = "ETH7"; status = "okay"; };
@@ -167,7 +167,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_6>; phy-mode = "qsgmii"; - label = "ETH11"; + label = "ETH9"; status = "okay"; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 490/1126 KVM: PPC: Book3S HV: Check return value of kvmppc_radix_init
In reply to Greg Kroah-HartmanFrom: Fabiano Rosas <[email protected]>
[ Upstream commit 69ab6ac380a00244575de02c406dcb9491bf3368 ]
The return of the function is being shadowed by the call to kvmppc_uvmem_init.
--- arch/powerpc/kvm/book3s_hv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kvm/book3s_hv.c +4 -1
@@ -6137,8 +6137,11 @@ static int kvmppc_book3s_init_hv(void)if (r)return r; -if (kvmppc_radix_possible ()) +if (kvmppc_radix_possible ()) { r =kvmppc_radix_init (); +if (r) +return r; + } r =kvmppc_uvmem_init ();if (r <0 )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 491/1126 powerpc/perf: Dont use perf_hw_context for trace IMC PMU
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
[ Upstream commit 0198322379c25215b2778482bf1221743a76e2b5 ]
Trace IMC (In-Memory collection counters) in powerpc is useful for application level profiling.
For trace_imc, presently task context (task_ctx_nr) is set to perf_hw_context. But perf_hw_context should only be used for CPU PMU. See commit 26657848502b ("perf/core: Verify we have a single perf_hw_context PMU").
So for trace_imc, even though it is per thread PMU, it is preferred to use sw_context in order to be able to do application level monitoring. Hence change the task_ctx_nr to use perf_sw_context.
--- arch/powerpc/perf/imc-pmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/perf/imc-pmu.c +5 -1
@@ -1457,7 +1457,11 @@ static int trace_imc_event_init(struct perf_event *event) event->hw.idx =-1 ; - event->pmu->task_ctx_nr = perf_hw_context; +/* +* There can only be a single PMU for perf_hw_context events which is assigned to +* core PMU. Hence use "perf_sw_context" for trace_imc. +*/ + event->pmu->task_ctx_nr = perf_sw_context; event->destroy = reset_global_refc;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 492/1126 mt76: connac: fix sta_rec_wtbl tag len
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 74c337ec0905d99111fc63a15f2e0784b9ed5503 ]
Similar to mt7915 driver, fix tag len error for sta_rec_wtbl, which causes fw parsing error for the tags placed behind it.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 -1
@@ -310,7 +310,7 @@ mt76_connac_mcu_alloc_wtbl_req(struct mt76_dev *dev, struct mt76_wcid *wcid, }if (sta_hdr) - sta_hdr->len =cpu_to_le16 (sizeof (hdr)); +le16_add_cpu (&sta_hdr->len,sizeof (hdr));return skb_put_data (nskb, &hdr,sizeof (hdr)); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 493/1126 mt76: mt7915: use proper aid value in mt7915_mcu_wtbl_generic_tlv in sta mode
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit a56b1b0f145ef2d6bb9312dedf3ab8558ef50a5b ]
mac80211 provides aid in vif->bss_conf.aid for sta mode and not in sta->aid. Fix mt7915_mcu_wtbl_generic_tlv routine using proper value for aid in sta mode.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +4 -1
@@ -1264,8 +1264,11 @@ mt7915_mcu_wtbl_generic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, generic = (struct wtbl_generic *)tlv;if (sta) { +if (vif->type ==NL80211_IFTYPE_STATION ) + generic->partial_aid =cpu_to_le16 (vif->bss_conf.aid); +else + generic->partial_aid =cpu_to_le16 (sta->aid);memcpy (generic->peer_addr, sta->addr,ETH_ALEN ); - generic->partial_aid =cpu_to_le16 (sta->aid); generic->muar_idx = mvif->mt76.omac_idx; generic->qos = sta->wme; }else {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 494/1126 mt76: mt7915: use proper aid value in mt7915_mcu_sta_basic_tlv
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit abdb8bc94be4cf68aa71c9a8ee0bad9b3e6f52d3 ]
Similar to mt7915_mcu_wtbl_generic_tlv, rely on vif->bss_conf.aid for aid in sta mode and not on sta->aid.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +3 -1
@@ -1322,12 +1322,15 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP : basic->conn_type =cpu_to_le32 (CONNECTION_INFRA_STA ); + basic->aid =cpu_to_le16 (sta->aid);break ;case NL80211_IFTYPE_STATION : basic->conn_type =cpu_to_le32 (CONNECTION_INFRA_AP ); + basic->aid =cpu_to_le16 (vif->bss_conf.aid);break ;case NL80211_IFTYPE_ADHOC : basic->conn_type =cpu_to_le32 (CONNECTION_IBSS_ADHOC ); + basic->aid =cpu_to_le16 (sta->aid);break ;default :WARN_ON (1 );
@@ -1335,7 +1338,6 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, }memcpy (basic->peer_addr, sta->addr,ETH_ALEN ); - basic->aid =cpu_to_le16 (sta->aid); basic->qos = sta->wme; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 495/1126 mt76: mt76_connac: fix MCU_CE_CMD_SET_ROC definition error
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit bf9727a27442a50c75b7d99a5088330c578b2a42 ]
Fixed an MCU_CE_CMD_SET_ROC definition error that occurred from a previous refactor work.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -1
@@ -996,7 +996,7 @@ enum {MCU_CE_CMD_SET_BSS_CONNECTED =0x16 ,MCU_CE_CMD_SET_BSS_ABORT =0x17 ,MCU_CE_CMD_CANCEL_HW_SCAN =0x1b , -MCU_CE_CMD_SET_ROC =0x1d , +MCU_CE_CMD_SET_ROC =0x1c ,MCU_CE_CMD_SET_P2P_OPPPS =0x33 ,MCU_CE_CMD_SET_RATE_TX_POWER =0x5d , MCU_CE_CMD_SCHED_SCAN_ENABLE = 0x61,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 496/1126 mt76: mt7921: set EDCA parameters with the MCU CE command
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 66ca1a7b2d5503f561b751abdd6ec6fa96343eb6 ]
The command MCU_EXT_CMD_EDCA_UPDATE is not fully supported by the MT7921 firmware, so we apply CE command MCU_CE_CMD_SET_EDCA_PARAMS instead which is supported even in the oldest firmware to properly set up EDCA parameters for each AC.
--- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7921/mcu.c | 49 ++++++++----------- 2 files changed, 22 insertions(+), 28 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -0
@@ -997,6 +997,7 @@ enum {MCU_CE_CMD_SET_BSS_ABORT =0x17 ,MCU_CE_CMD_CANCEL_HW_SCAN =0x1b ,MCU_CE_CMD_SET_ROC =0x1c , +MCU_CE_CMD_SET_EDCA_PARMS =0x1d ,MCU_CE_CMD_SET_P2P_OPPPS =0x33 ,MCU_CE_CMD_SET_RATE_TX_POWER =0x5d , MCU_CE_CMD_SCHED_SCAN_ENABLE = 0x61,
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +21 -28
91 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 497/1126 mt76: mt7921: do not always disable fw runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit b44eeb8cbdf2b88f2844f11e4f263b0abed5b5b0 ]
After commit 'd430dffbe9dd ("mt76: mt7921: fix a possible race enabling/disabling runtime-pm")', runtime-pm is always disabled in the fw even if the user requests to enable it toggling debugfs node since mt7921_pm_interface_iter routine will use pm->enable to configure the fw. Fix the issue moving enable variable configuration before running mt7921_pm_interface_iter routine.
--- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +1 -2
@@ -291,13 +291,12 @@ mt7921_pm_set(void *data, u64 val) pm->enable = false;mt76_connac_pm_wake (&dev->mphy, pm); + pm->enable = val;ieee80211_iterate_active_interfaces (mt76_hw (dev),IEEE80211_IFACE_ITER_RESUME_ALL , mt7921_pm_interface_iter, dev);mt76_connac_mcu_set_deep_sleep (&dev->mt76, pm->ds_enable); - - pm->enable = val;mt76_connac_power_save_sched (&dev->mphy, pm); out:mutex_unlock (&dev->mt76.mutex);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 498/1126 mt76: mt7921: fix a leftover race in runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 591cdccebdd4d02eb46d400dea911136400cc567 ]
Fix a possible race in mt7921_pm_power_save_work() if rx/tx napi schedules ps_work and we are currently accessing device register on a different cpu.
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +8 -0
@@ -1551,6 +1551,14 @@ void mt7921_pm_power_save_work(struct work_struct *work) test_bit(MT76_HW_SCHED_SCANNING, &mphy->state)) goto out; +if (mutex_is_locked (&dev->mt76.mutex)) +/* if mt76 mutex is held we should not put the device +* to sleep since we are currently accessing device +* register map. We need to wait for the next power_save +* trigger. +*/ + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 499/1126 mt76: mt7615: fix a leftover race in runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 42ce8d3b623162f3248db50a38359f294e6b06fd ]
Fix a possible race in mt7615_pm_power_save_work() if rx/tx napi schedules ps_work and we are currently accessing device register on a different cpu.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +8 -0
@@ -2103,6 +2103,14 @@ void mt7615_pm_power_save_work(struct work_struct *work) test_bit(MT76_HW_SCHED_SCANNING, &dev->mphy.state)) goto out; +if (mutex_is_locked (&dev->mt76.mutex)) +/* if mt76 mutex is held we should not put the device +* to sleep since we are currently accessing device +* register map. We need to wait for the next power_save +* trigger. +*/ + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 500/1126 mt76: mt7915: fix ht mcs in mt7915_mac_add_txs_skb()
In reply to Greg Kroah-HartmanFrom: Peter Chiu <[email protected]>
[ Upstream commit d8e4e8d148fb68858d6a997d88a87a2c615629ce ]
The mcs value of HT mode reported by mt7915_mac_add_txs_skb() has already been converted to the expected format.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +0 -1
@@ -1512,7 +1512,6 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,break ;case MT_PHY_TYPE_HT :case MT_PHY_TYPE_HT_GF : - rate.mcs += (rate.nss -1 ) *8 ;if (rate.mcs >31 ) goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 501/1126 mt76: mt7921: fix ht mcs in mt7921_mac_add_txs_skb()
In reply to Greg Kroah-HartmanFrom: Peter Chiu <[email protected]>
[ Upstream commit b1fe07ed21024f64719315ba0f3a5676d8b36db6 ]
The mcs value of HT mode reported by mt7921_mac_add_txs_skb() has already been converted to the expected format.
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +0 -1
@@ -1092,7 +1092,6 @@ mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid,break ;case MT_PHY_TYPE_HT :case MT_PHY_TYPE_HT_GF : - rate.mcs += (rate.nss -1 ) *8 ;if (rate.mcs >31 ) goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 502/1126 mt76: mt7921s: fix mt7921s_mcu_[fw|drv]_pmctrl
In reply to Greg Kroah-HartmanFrom: Leon Yen <[email protected]>
[ Upstream commit b12deb5e86fa36dc6f3aa3321f5da27addec4f1f ]
According to the firmware behavior (even the oldest one in linux-firmware) If the firmware is downloaded, MT7921S must rely on the additional mailbox mechanism that resides in firmware to check if the device is the right state for mt7921s_mcu_[fw|drv]_pmctrl. Otherwise, we still apply the old way for that.
That is a necessary patch before we enable runtime pm for mt7921s as default.
--- .../wireless/mediatek/mt76/mt7921/sdio_mcu.c | 38 +++++++++++++++++++ drivers/net/wireless/mediatek/mt76/sdio.h | 2 + 2 files changed, 40 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c +38 -0
@@ -49,6 +49,26 @@ mt7921s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,return ret; } +static u32 mt7921s_read_rm3r (struct mt7921_dev *dev) +{ +struct mt76_sdio *sdio = &dev->mt76.sdio; + +return sdio_readl (sdio->func,MCR_D2HRM3R ,NULL ); +} + +static u32 mt7921s_clear_rm3r_drv_own (struct mt7921_dev *dev) +{ +struct mt76_sdio *sdio = &dev->mt76.sdio; +u32 val; + + val =sdio_readl (sdio->func,MCR_D2HRM3R ,NULL ); +if (val) +sdio_writel (sdio->func,H2D_SW_INT_CLEAR_MAILBOX_ACK , +MCR_WSICR ,NULL ); + +return val; +} +int mt7921s_mcu_init (struct mt7921_dev *dev) {static const struct mt76_mcu_ops mt7921s_mcu_ops = {
@@ -88,6 +108,12 @@ int mt7921s_mcu_drv_pmctrl(struct mt7921_dev *dev) err =readx_poll_timeout (mt76s_read_pcr, &dev->mt76, status, status &WHLPCR_IS_DRIVER_OWN ,2000 ,1000000 ); + +if (!err &&test_bit (MT76_STATE_MCU_RUNNING , &dev->mphy.state)) + err =readx_poll_timeout (mt7921s_read_rm3r, dev, status, + status &D2HRM3R_IS_DRIVER_OWN , +2000 ,1000000 ); +sdio_release_host (func);if (err <0 ) {
@@ -115,12 +141,24 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev)sdio_claim_host (func); +if (test_bit (MT76_STATE_MCU_RUNNING , &dev->mphy.state)) { + err =readx_poll_timeout (mt7921s_clear_rm3r_drv_own, + dev, status, + !(status &D2HRM3R_IS_DRIVER_OWN ), +2000 ,1000000 ); +if (err <0 ) { +dev_err (dev->mt76.dev,"mailbox ACK not cleared\n" ); + goto err; + } + } +sdio_writel (func,WHLPCR_FW_OWN_REQ_SET ,MCR_WHLPCR ,NULL ); err =readx_poll_timeout (mt76s_read_pcr, &dev->mt76, status, !(status &WHLPCR_IS_DRIVER_OWN ),2000 ,1000000 );sdio_release_host (func); +err:if (err <0 ) {dev_err (dev->mt76.dev,"firmware own failed\n" );clear_bit (MT76_STATE_PM , &mphy->state);
drivers/net/wireless/mediatek/mt76/sdio.h +2 -0
@@ -65,6 +65,7 @@#define MCR_H2DSM0R 0x0070#define H2D_SW_INT_READ BIT(16)#define H2D_SW_INT_WRITE BIT(17) +#define H2D_SW_INT_CLEAR_MAILBOX_ACK BIT(22)#define MCR_H2DSM1R 0x0074#define MCR_D2HRM0R 0x0078
@@ -109,6 +110,7 @@#define MCR_H2DSM2R 0x0160/* supported in CONNAC2 */ #define MCR_H2DSM3R 0x0164/* supported in CONNAC2 */ #define MCR_D2HRM3R 0x0174/* supported in CONNAC2 */ +#define D2HRM3R_IS_DRIVER_OWN BIT(0)#define MCR_WTQCR8 0x0190/* supported in CONNAC2 */ #define MCR_WTQCR9 0x0194/* supported in CONNAC2 */ #define MCR_WTQCR10 0x0198/* supported in CONNAC2 */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 503/1126 mt76: mt7921e: fix possible probe failure after reboot
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 602cc0c9618a819ab00ea3c9400742a0ca318380 ]
It doesn't guarantee the mt7921e gets started with ASPM L0 after each machine reboot on every platform.
If mt7921e gets started with not ASPM L0, it would be possible that the driver encounters time to time failure in mt7921_pci_probe, like a weird chip identifier is read
[ 215.514503] mt7921e 0000:05:00.0: ASIC revision: feed0000 [ 216.604741] mt7921e: probe of 0000:05:00.0 failed with error -110
or failing to init hardware because the driver is not allowed to access the register until the device is in ASPM L0 state. So, we call __mt7921e_mcu_drv_pmctrl in early mt7921_pci_probe to force the device to bring back to the L0 state for we can safely access registers in any case.
In the patch, we move all functions from dma.c to pci.c and register mt76 bus operation earilier, that is the __mt7921e_mcu_drv_pmctrl depends on.
--- .../net/wireless/mediatek/mt76/mt7921/dma.c | 119 ----------------- .../wireless/mediatek/mt76/mt7921/mt7921.h | 1 + .../net/wireless/mediatek/mt76/mt7921/pci.c | 124 ++++++++++++++++++ .../wireless/mediatek/mt76/mt7921/pci_mcu.c | 18 ++- 4 files changed, 139 insertions(+), 123 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/dma.c +0 -119
@@ -78,110 +78,6 @@ static void mt7921_dma_prefetch(struct mt7921_dev *dev)mt76_wr (dev,MT_WFDMA0_TX_RING17_EXT_CTRL ,PREFETCH (0x380 ,0x4 )); } -static u32 __mt7921_reg_addr (struct mt7921_dev *dev,u32 addr) -{ -static const struct { -u32 phys; -u32 mapped; -u32 size; - } fixed_map[] = { - {0x820d0000 ,0x30000 ,0x10000 },/* WF_LMAC_TOP (WF_WTBLON) */ - {0x820ed000 ,0x24800 ,0x0800 },/* WF_LMAC_TOP BN0 (WF_MIB) */ - {0x820e4000 ,0x21000 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_TMAC) */ - {0x820e7000 ,0x21e00 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_DMA) */ - {0x820eb000 ,0x24200 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_LPON) */ - {0x820e2000 ,0x20800 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_AGG) */ - {0x820e3000 ,0x20c00 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_ARB) */ - {0x820e5000 ,0x21400 ,0x0800 },/* WF_LMAC_TOP BN0 (WF_RMAC) */ - {0x00400000 ,0x80000 ,0x10000 },/* WF_MCU_SYSRAM */ - {0x00410000 ,0x90000 ,0x10000 },/* WF_MCU_SYSRAM (configure register) */ - {0x40000000 ,0x70000 ,0x10000 },/* WF_UMAC_SYSRAM */ - {0x54000000 ,0x02000 ,0x1000 },/* WFDMA PCIE0 MCU DMA0 */ - {0x55000000 ,0x03000 ,0x1000 },/* WFDMA PCIE0 MCU DMA1 */ - {0x58000000 ,0x06000 ,0x1000 },/* WFDMA PCIE1 MCU DMA0 (MEM_DMA) */ - {0x59000000 ,0x07000 ,0x1000 },/* WFDMA PCIE1 MCU DMA1 */ - {0x7c000000 ,0xf0000 ,0x10000 },/* CONN_INFRA */ - {0x7c020000 ,0xd0000 ,0x10000 },/* CONN_INFRA, WFDMA */ - {0x7c060000 ,0xe0000 ,0x10000 },/* CONN_INFRA, conn_host_csr_top */ - {0x80020000 ,0xb0000 ,0x10000 },/* WF_TOP_MISC_OFF */ - {0x81020000 ,0xc0000 ,0x10000 },/* WF_TOP_MISC_ON */ - {0x820c0000 ,0x08000 ,0x4000 },/* WF_UMAC_TOP (PLE) */ - {0x820c8000 ,0x0c000 ,0x2000 },/* WF_UMAC_TOP (PSE) */ - {0x820cc000 ,0x0e000 ,0x1000 },/* WF_UMAC_TOP (PP) */ - {0x820cd000 ,0x0f000 ,0x1000 },/* WF_MDP_TOP */ - {0x820ce000 ,0x21c00 ,0x0200 },/* WF_LMAC_TOP (WF_SEC) */ - {0x820cf000 ,0x22000 ,0x1000 },/* WF_LMAC_TOP (WF_PF) */ - {0x820e0000 ,0x20000 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_CFG) */ - {0x820e1000 ,0x20400 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_TRB) */ - {0x820e9000 ,0x23400 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_WTBLOFF) */ - {0x820ea000 ,0x24000 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_ETBF) */ - {0x820ec000 ,0x24600 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_INT) */ - {0x820f0000 ,0xa0000 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_CFG) */ - {0x820f1000 ,0xa0600 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_TRB) */ - {0x820f2000 ,0xa0800 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_AGG) */ - {0x820f3000 ,0xa0c00 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_ARB) */ - {0x820f4000 ,0xa1000 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_TMAC) */ - {0x820f5000 ,0xa1400 ,0x0800 },/* WF_LMAC_TOP BN1 (WF_RMAC) */ - {0x820f7000 ,0xa1e00 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_DMA) */ - {0x820f9000 ,0xa3400 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_WTBLOFF) */ - {0x820fa000 ,0xa4000 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_ETBF) */ - {0x820fb000 ,0xa4200 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_LPON) */ - {0x820fc000 ,0xa4600 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_INT) */ - {0x820fd000 ,0xa4800 ,0x0800 },/* WF_LMAC_TOP BN1 (WF_MIB) */ - }; -int i; - -if (addr <0x100000 ) -return addr; - -for (i =0 ; i <ARRAY_SIZE (fixed_map); i++) { -u32 ofs; - -if (addr < fixed_map[i].phys) -continue ; - - ofs = addr - fixed_map[i].phys; -if (ofs > fixed_map[i].size) -continue ; - -return fixed_map[i].mapped + ofs; - } - -if ((addr >=0x18000000 && addr <0x18c00000 ) || - (addr >=0x70000000 && addr <0x78000000 ) || - (addr >=0x7c000000 && addr <0x7c400000 )) -return mt7921_reg_map_l1 (dev, addr); - -dev_err (dev->mt76.dev,"Access currently unsupported address %08x\n" , - addr); - -return 0 ; -} - -static u32 mt7921_rr (struct mt76_dev *mdev,u32 offset) -{ - struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -u32 addr =__mt7921_reg_addr (dev, offset); - -return dev->bus_ops->rr (mdev, addr); -} - -static void mt7921_wr (struct mt76_dev *mdev,u32 offset,u32 val) -{ - struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -u32 addr =__mt7921_reg_addr (dev, offset); - - dev->bus_ops->wr (mdev, addr, val); -} - -static u32 mt7921_rmw (struct mt76_dev *mdev,u32 offset,u32 mask,u32 val) -{ - struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -u32 addr =__mt7921_reg_addr (dev, offset); - -return dev->bus_ops->rmw (mdev, addr, mask, val); -} -static int mt7921_dma_disable (struct mt7921_dev *dev,bool force) {if (force) {
@@ -341,23 +237,8 @@ int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev)int mt7921_dma_init (struct mt7921_dev *dev) { -struct mt76_bus_ops *bus_ops;int ret; - dev->phy.dev = dev; - dev->phy.mt76 = &dev->mt76.phy; - dev->mt76.phy.priv = &dev->phy; - dev->bus_ops = dev->mt76.bus; - bus_ops =devm_kmemdup (dev->mt76.dev, dev->bus_ops,sizeof (*bus_ops), -GFP_KERNEL ); -if (!bus_ops) -return -ENOMEM ; - - bus_ops->rr = mt7921_rr; - bus_ops->wr = mt7921_wr; - bus_ops->rmw = mt7921_rmw; - dev->mt76.bus = bus_ops; -mt76_dma_attach (&dev->mt76); ret =mt7921_dma_disable (dev, true);
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +1 -0
@@ -452,6 +452,7 @@ int mt7921e_mcu_init(struct mt7921_dev *dev);int mt7921s_wfsys_reset (struct mt7921_dev *dev);int mt7921s_mac_reset (struct mt7921_dev *dev);int mt7921s_init_reset (struct mt7921_dev *dev); +int __mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev);int mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev);int mt7921e_mcu_fw_pmctrl (struct mt7921_dev *dev);
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +124 -0
142 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c +14 -4
@@ -59,10 +59,8 @@ int mt7921e_mcu_init(struct mt7921_dev *dev)return err; } -int mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev) +int __mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev) { -struct mt76_phy *mphy = &dev->mt76.phy; -struct mt76_connac_pm *pm = &dev->pm;int i, err =0 ;for (i =0 ; i <MT7921_DRV_OWN_RETRY_COUNT ; i++) {
@@ -75,9 +73,21 @@ int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev)if (i ==MT7921_DRV_OWN_RETRY_COUNT ) {dev_err (dev->mt76.dev,"driver own failed\n" ); err = -EIO ; - goto out; } +return err; +} + +int mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev) +{ +struct mt76_phy *mphy = &dev->mt76.phy; +struct mt76_connac_pm *pm = &dev->pm; +int err; + + err =__mt7921e_mcu_drv_pmctrl (dev); +if (err <0 ) + goto out; +mt7921_wpdma_reinit_cond (dev);clear_bit (MT76_STATE_PM , &mphy->state);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 504/1126 mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit fc8e2c707ce11c8ec2e992885b0d53a5e04031ac ]
Check sta_rates pointer value in mt7603_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
--- drivers/net/wireless/mediatek/mt76/mt7603/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7603/main.c +3 -0
@@ -641,6 +641,9 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 505/1126 mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 6a6f457ed5fdf6777536c20644a9e42128a50ec2 ]
Check sta_rates pointer value in mt7615_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
--- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -0
@@ -683,6 +683,9 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 506/1126 mt76: mt7915: fix possible memory leak in mt7915_mcu_add_sta
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit a43736cd12d82913102eb49cb56787a5553e028f ]
Free allocated skb in mt7915_mcu_add_sta routine in case of failures.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +6 -2
@@ -2399,8 +2399,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, } ret =mt7915_mcu_sta_wtbl_tlv (dev, skb, vif, sta); -if (ret) +if (ret) { +dev_kfree_skb (skb);return ret; + }if (sta && sta->ht_cap.ht_supported) {/* starec amsdu */
@@ -2414,8 +2416,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, } ret =mt7915_mcu_add_group (dev, vif, sta); -if (ret) +if (ret) { +dev_kfree_skb (skb);return ret; + } out:return mt76_mcu_skb_send_msg (&dev->mt76, skb,MCU_EXT_CMD (STA_REC_UPDATE ), true);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 507/1126 mt76: mt7921s: fix a possible memory leak in mt7921_load_patch
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 11005b18f453aa192d035d410c11d07edcba5a45 ]
Always release fw data at the end of mt7921_load_patch routine.
--- drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +2 -6
@@ -707,12 +707,8 @@ static int mt7921_load_patch(struct mt7921_dev *dev)if (mt76_is_sdio (&dev->mt76)) {/* activate again */ ret =__mt7921_mcu_fw_pmctrl (dev); -if (ret) -return ret; - - ret =__mt7921_mcu_drv_pmctrl (dev); -if (ret) -return ret; +if (!ret) + ret =__mt7921_mcu_drv_pmctrl (dev); } out:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 508/1126 mt76: mt7915: fix mcs_map in mt7915_mcu_set_sta_he_mcs()
In reply to Greg Kroah-HartmanFrom: Peter Chiu <[email protected]>
[ Upstream commit ade25ca7950bc8930356d98ec89aa41560a9dab5 ]
Should use peer's bandwidth instead of chandef->width to get correct mcs_map.
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +8 -21
@@ -211,24 +211,12 @@ mt7915_mcu_get_sta_nss(u16 mcs_map)static void mt7915_mcu_set_sta_he_mcs (struct ieee80211_sta *sta,__le16 *he_mcs, -const u16 *mask) +u16 mcs_map) {struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; -struct cfg80211_chan_def *chandef = &msta->vif->phy->mt76->chandef; +enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band; +const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;int nss, max_nss = sta->rx_nss >3 ?4 : sta->rx_nss; -u16 mcs_map; - -switch (chandef->width) { -case NL80211_CHAN_WIDTH_80P80 : - mcs_map =le16_to_cpu (sta->he_cap.he_mcs_nss_supp.rx_mcs_80p80); -break ; -case NL80211_CHAN_WIDTH_160 : - mcs_map =le16_to_cpu (sta->he_cap.he_mcs_nss_supp.rx_mcs_160); -break ; -default : - mcs_map =le16_to_cpu (sta->he_cap.he_mcs_nss_supp.rx_mcs_80); -break ; - }for (nss =0 ; nss < max_nss; nss++) {int mcs;
@@ -1345,11 +1333,9 @@ static void mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, struct ieee80211_vif *vif) { - struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem; -enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band; -const u16 *mcs_mask = msta->vif->bitrate_mask.control[band].he_mcs; +struct ieee80211_he_mcs_nss_supp mcs_map;struct sta_rec_he *he;struct tlv *tlv;u32 cap =0 ;
@@ -1439,22 +1425,23 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, he->he_cap =cpu_to_le32 (cap); + mcs_map = sta->he_cap.he_mcs_nss_supp;switch (sta->bandwidth) {case IEEE80211_STA_RX_BW_160 :if (elem->phy_cap_info[0 ] &IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G )mt7915_mcu_set_sta_he_mcs (sta, &he->max_nss_mcs[CMD_HE_MCS_BW8080 ], - mcs_mask); +le16_to_cpu (mcs_map.rx_mcs_80p80));mt7915_mcu_set_sta_he_mcs (sta, &he->max_nss_mcs[CMD_HE_MCS_BW160 ], - mcs_mask); +le16_to_cpu (mcs_map.rx_mcs_160)); fallthrough;default :mt7915_mcu_set_sta_he_mcs (sta, &he->max_nss_mcs[CMD_HE_MCS_BW80 ], - mcs_mask); +le16_to_cpu (mcs_map.rx_mcs_80));break ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 509/1126 mt76: mt7915: fix the nss setting in bitrates
In reply to Greg Kroah-HartmanFrom: MeiChia Chiu <[email protected]>
[ Upstream commit c41d2a075206fcbdc89695b874a6ac06160b4f1a ]
without this change, the fixed MCS only supports 1 Nss.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +6 -3
@@ -2126,9 +2126,12 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, phy.sgi |= gi << (i << (_he)); \ phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\ } \ -for (i =0 ; i <ARRAY_SIZE (mask->control[band]._mcs); i++) \ - nrates +=hweight16 (mask->control[band]._mcs[i]); \ - phy.mcs =ffs (mask->control[band]._mcs[0 ]) -1 ; \ +for (i =0 ; i <ARRAY_SIZE (mask->control[band]._mcs); i++) { \ +if (!mask->control[band]._mcs[i]) \ +continue ; \ + nrates +=hweight16 (mask->control[band]._mcs[i]); \ + phy.mcs =ffs (mask->control[band]._mcs[i]) -1 ; \ + } \ }while (0 )if (sta->he_cap.has_he) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 510/1126 ptp: unregister virtual clocks when unregistering physical clock.
In reply to Greg Kroah-HartmanFrom: Miroslav Lichvar <[email protected]>
[ Upstream commit bfcbb76b0f595ea9ede9f7a218086fef85242f10 ]
When unregistering a physical clock which has some virtual clocks, unregister the virtual clocks with it.
This fixes the following oops, which can be triggered by unloading a driver providing a PTP clock when it has enabled virtual clocks:
BUG: unable to handle page fault for address: ffffffffc04fc4d8 Oops: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:ptp_vclock_read+0x31/0xb0 Call Trace: timecounter_read+0xf/0x50 ptp_vclock_refresh+0x2c/0x50 ? ptp_clock_release+0x40/0x40 ptp_aux_kworker+0x17/0x30 kthread_worker_fn+0x9b/0x240 ? kthread_should_park+0x30/0x30 kthread+0xe2/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30
--- drivers/ptp/ptp_clock.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ptp/ptp_clock.c +9 -2
@@ -317,11 +317,18 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, }EXPORT_SYMBOL (ptp_clock_register); +static int unregister_vclock (struct device *dev,void *data) +{ +struct ptp_clock *ptp =dev_get_drvdata (dev); + +ptp_vclock_unregister (info_to_vclock (ptp->info)); +return 0 ; +} +int ptp_clock_unregister (struct ptp_clock *ptp) {if (ptp_vclock_in_use (ptp)) { -pr_err ("ptp: virtual clock in use\n" ); -return -EBUSY ; +device_for_each_child (&ptp->dev,NULL , unregister_vclock); } ptp->defunct =1 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 511/1126 net: dsa: mv88e6xxx: Enable port policy support on 6097
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
[ Upstream commit 585d42bb57bb358d48906660a8de273b078810b1 ]
This chip has support for the same per-port policy actions found in later versions of LinkStreet devices.
--- drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mv88e6xxx/chip.c +1 -0
@@ -3639,6 +3639,7 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { .port_sync_link = mv88e6185_port_sync_link, .port_set_speed_duplex = mv88e6185_port_set_speed_duplex, .port_tag_remap = mv88e6095_port_tag_remap, + .port_set_policy = mv88e6352_port_set_policy, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_ucast_flood = mv88e6352_port_set_ucast_flood, .port_set_mcast_flood = mv88e6352_port_set_mcast_flood,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 512/1126 bpf: Fix a btf decl_tag bug when tagging a function
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit d7e7b42f4f956f2c68ad8cda87d750093dbba737 ]
syzbot reported a btf decl_tag bug with stack trace below:
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 3592 Comm: syz-executor914 Not tainted 5.16.0-syzkaller-11424-gb7892f7d5cb2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:btf_type_vlen include/linux/btf.h:231 [inline] RIP: 0010:btf_decl_tag_resolve+0x83e/0xaa0 kernel/bpf/btf.c:3910 ... Call Trace: <TASK> btf_resolve+0x251/0x1020 kernel/bpf/btf.c:4198 btf_check_all_types kernel/bpf/btf.c:4239 [inline] btf_parse_type_sec kernel/bpf/btf.c:4280 [inline] btf_parse kernel/bpf/btf.c:4513 [inline] btf_new_fd+0x19fe/0x2370 kernel/bpf/btf.c:6047 bpf_btf_load kernel/bpf/syscall.c:4039 [inline] __sys_bpf+0x1cbb/0x5970 kernel/bpf/syscall.c:4679 __do_sys_bpf kernel/bpf/syscall.c:4738 [inline] __se_sys_bpf kernel/bpf/syscall.c:4736 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4736 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
The kasan error is triggered with an illegal BTF like below:
type 0: void
type 1: int
type 2: decl_tag to func type 3
type 3: func to func_proto type 8
The total number of types is 4 and the type 3 is illegal since its func_proto type is out of range.
Currently, the target type of decl_tag can be struct/union, var or func. Both struct/union and var implemented their own 'resolve' callback functions and hence handled properly in kernel.
But func type doesn't have 'resolve' callback function. When btf_decl_tag_resolve() tries to check func type, it tries to get vlen of its func_proto type, which triggered the above kasan error.
To fix the issue, btf_decl_tag_resolve() needs to do btf_func_check() before trying to accessing func_proto type.
In the current implementation, func type is checked with btf_func_check() in the main checking function btf_check_all_types(). To fix the above kasan issue, let us implement 'resolve' callback func type properly. The 'resolve' callback will be also called in btf_check_all_types() for func types.
--- kernel/bpf/btf.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
kernel/bpf/btf.c +21 -8
@@ -403,6 +403,9 @@ static struct btf_type btf_void;static int btf_resolve (struct btf_verifier_env *env,const struct btf_type *t,u32 type_id); +static int btf_func_check (struct btf_verifier_env *env, +const struct btf_type *t); +static bool btf_type_is_modifier (const struct btf_type *t) {/* Some of them is not strictly a C modifier
@@ -579,6 +582,7 @@ static bool btf_type_needs_resolve(const struct btf_type *t)btf_type_is_struct (t) ||btf_type_is_array (t) ||btf_type_is_var (t) || +btf_type_is_func (t) ||btf_type_is_decl_tag (t) ||btf_type_is_datasec (t); }
@@ -3533,9 +3537,24 @@ static s32 btf_func_check_meta(struct btf_verifier_env *env,return 0 ; } +static int btf_func_resolve (struct btf_verifier_env *env, +const struct resolve_vertex *v) +{ +const struct btf_type *t = v->t; +u32 next_type_id = t->type; +int err; + + err =btf_func_check (env, t); +if (err) +return err; + +env_stack_pop_resolved (env, next_type_id,0 ); +return 0 ; +} +static struct btf_kind_operations func_ops = { .check_meta = btf_func_check_meta, - .resolve = btf_df_resolve, + .resolve = btf_func_resolve, .check_member = btf_df_check_member, .check_kflag_member = btf_df_check_kflag_member, .log_details = btf_ref_type_log,
@@ -4156,7 +4175,7 @@ static bool btf_resolve_valid(struct btf_verifier_env *env,return !btf_resolved_type_id (btf, type_id) && !btf_resolved_type_size (btf, type_id); -if (btf_type_is_decl_tag (t)) +if (btf_type_is_decl_tag (t) ||btf_type_is_func (t))return btf_resolved_type_id (btf, type_id) && !btf_resolved_type_size (btf, type_id);
@@ -4246,12 +4265,6 @@ static int btf_check_all_types(struct btf_verifier_env *env)if (err)return err; } - -if (btf_type_is_func (t)) { - err =btf_func_check (env, t); -if (err) -return err; - } }return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 513/1126 mac80211: limit bandwidth in HE capabilities
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 1f2c104448477512fcf7296df54bfbc3a6f9a765 ]
If we're limiting bandwidth for some reason such as regulatory restrictions, then advertise that limitation just like we do for VHT today, so the AP is aware we cannot use the higher BW it might be using.
--- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/mesh.c | 2 +- net/mac80211/mlme.c | 11 ++++++++--- net/mac80211/util.c | 27 ++++++++++++++++++++++----- 4 files changed, 32 insertions(+), 10 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -2380,7 +2380,7 @@ u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,u8 *ieee80211_ie_build_vht_oper (u8 *pos,struct ieee80211_sta_vht_cap *vht_cap,const struct cfg80211_chan_def *chandef);u8 ieee80211_ie_len_he_cap (struct ieee80211_sub_if_data *sdata,u8 iftype); -u8 *ieee80211_ie_build_he_cap (u8 *pos, +u8 *ieee80211_ie_build_he_cap (u32 disable_flags,u8 *pos,const struct ieee80211_sta_he_cap *he_cap,u8 *end); void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
net/mac80211/mesh.c +1 -1
@@ -580,7 +580,7 @@ int mesh_add_he_cap_ie(struct ieee80211_sub_if_data *sdata,return -ENOMEM ; pos =skb_put (skb, ie_len); -ieee80211_ie_build_he_cap (pos, he_cap, pos + ie_len); +ieee80211_ie_build_he_cap (0 , pos, he_cap, pos + ie_len);return 0 ; }
net/mac80211/mlme.c +8 -3
@@ -636,7 +636,7 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, struct ieee80211_supported_band *sband) { - u8 *pos; + u8 *pos, *pre_he_pos;const struct ieee80211_sta_he_cap *he_cap =NULL ;struct ieee80211_chanctx_conf *chanctx_conf;u8 he_cap_size;
@@ -653,16 +653,21 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, he_cap =ieee80211_get_he_iftype_cap (sband,ieee80211_vif_type_p2p (&sdata->vif)); -if (!he_cap || !reg_cap) +if (!he_cap || !chanctx_conf || !reg_cap)return ; +/* get a max size estimate */ he_cap_size =2 +1 +sizeof (he_cap->he_cap_elem) +ieee80211_he_mcs_nss_size (&he_cap->he_cap_elem) +ieee80211_he_ppe_size (he_cap->ppe_thres[0 ], he_cap->he_cap_elem.phy_cap_info); pos =skb_put (skb, he_cap_size); -ieee80211_ie_build_he_cap (pos, he_cap, pos + he_cap_size); + pre_he_pos = pos; + pos =ieee80211_ie_build_he_cap (sdata->u.mgd.flags, + pos, he_cap, pos + he_cap_size); +/* trim excess if any */ +skb_trim (skb, skb->len - (pre_he_pos + he_cap_size - pos));ieee80211_ie_build_he_6ghz_cap (sdata, skb); }
net/mac80211/util.c +22 -5
@@ -1974,7 +1974,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_sub_if_data *sdata,if (he_cap &&cfg80211_any_usable_channels (local->hw.wiphy,BIT (sband->band),IEEE80211_CHAN_NO_HE )) { - pos =ieee80211_ie_build_he_cap (pos, he_cap, end); + pos =ieee80211_ie_build_he_cap (0 , pos, he_cap, end);if (!pos) goto out_err; }
@@ -2918,10 +2918,11 @@ u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype) he_cap->he_cap_elem.phy_cap_info); } -u8 *ieee80211_ie_build_he_cap (u8 *pos, +u8 *ieee80211_ie_build_he_cap (u32 disable_flags,u8 *pos,const struct ieee80211_sta_he_cap *he_cap,u8 *end) { +struct ieee80211_he_cap_elem elem;u8 n;u8 ie_len;u8 *orig_pos = pos;
@@ -2934,7 +2935,23 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos,if (!he_cap)return orig_pos; - n =ieee80211_he_mcs_nss_size (&he_cap->he_cap_elem); +/* modify on stack first to calculate 'n' and 'ie_len' correctly */ + elem = he_cap->he_cap_elem; + +if (disable_flags &IEEE80211_STA_DISABLE_40MHZ ) + elem.phy_cap_info[0 ] &= + ~(IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | +IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G ); + +if (disable_flags &IEEE80211_STA_DISABLE_160MHZ ) + elem.phy_cap_info[0 ] &= + ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G ; + +if (disable_flags &IEEE80211_STA_DISABLE_80P80MHZ ) + elem.phy_cap_info[0 ] &= + ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G ; + + n =ieee80211_he_mcs_nss_size (&elem); ie_len =2 +1 +sizeof (he_cap->he_cap_elem) + n + ieee80211_he_ppe_size(he_cap->ppe_thres[0],
@@ -2948,8 +2965,8 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos, *pos++ =WLAN_EID_EXT_HE_CAPABILITY ;/* Fixed data */ -memcpy (pos, &he_cap->he_cap_elem,sizeof (he_cap->he_cap_elem)); - pos +=sizeof (he_cap->he_cap_elem); +memcpy (pos, &elem,sizeof (elem)); + pos +=sizeof (elem);memcpy (pos, &he_cap->he_mcs_nss_supp, n); pos += n;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 514/1126 scripts/dtc: Call pkg-config POSIXly correct
In reply to Greg Kroah-HartmanFrom: Thomas Bracht Laumann Jespersen <[email protected]>
[ Upstream commit a8b309ce9760943486e0585285e0125588a31650 ]
Running with POSIXLY_CORRECT=1 in the environment the scripts/dtc build fails, because pkg-config doesn't output anything when the flags come after the arguments.
--- scripts/dtc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/dtc/Makefile +1 -1
@@ -29,7 +29,7 @@ dtc-objs += yamltree.o # To include <yaml.h> installed in a non-default path HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1) # To link libyaml installed in a non-default path -HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs) +HOSTLDLIBS_dtc := $(shell pkg-config --libs yaml-0.1) endif # Generated files need one more search path to include headers in source tree
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 515/1126 livepatch: Fix build failure on 32 bits processors
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 2f293651eca3eacaeb56747dede31edace7329d2 ]
Trying to build livepatch on powerpc/32 results in:
kernel/livepatch/core.c: In function 'klp_resolve_symbols':
kernel/livepatch/core.c:221:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info);
| ^
kernel/livepatch/core.c:221:21: error: assignment to 'Elf32_Sym *' {aka 'struct elf32_sym *'} from incompatible pointer type 'Elf64_Sym *' {aka 'struct elf64_sym *'} [-Werror=incompatible-pointer-types]
221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info);
| ^
kernel/livepatch/core.c: In function 'klp_apply_section_relocs':
kernel/livepatch/core.c:312:35: error: passing argument 1 of 'klp_resolve_symbols' from incompatible pointer type [-Werror=incompatible-pointer-types]
312 | ret = klp_resolve_symbols(sechdrs, strtab, symndx, sec, sec_objname);
| ^~~~~~~
| |
| Elf32_Shdr * {aka struct elf32_shdr *}
kernel/livepatch/core.c:193:44: note: expected 'Elf64_Shdr *' {aka 'struct elf64_shdr *'} but argument is of type 'Elf32_Shdr *' {aka 'struct elf32_shdr *'}
193 | static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab,
| ~~~~~~~~~~~~^~~~~~~Fix it by using the right types instead of forcing 64 bits types.
--- kernel/livepatch/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/livepatch/core.c +2 -2
@@ -190,7 +190,7 @@ static int klp_find_object_symbol(const char *objname, const char *name,return -EINVAL ; } -static int klp_resolve_symbols (Elf64_Shdr *sechdrs,const char *strtab, +static int klp_resolve_symbols (Elf_Shdr *sechdrs,const char *strtab,unsigned int symndx,Elf_Shdr *relasec,const char *sec_objname) {
@@ -218,7 +218,7 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab, relas = (Elf_Rela *) relasec->sh_addr;/* For each rela in this klp relocation section */ for (i =0 ; i < relasec->sh_size /sizeof (Elf_Rela); i++) { - sym = (Elf64_Sym *)sechdrs[symndx].sh_addr +ELF_R_SYM (relas[i].r_info); + sym = (Elf_Sym *)sechdrs[symndx].sh_addr +ELF_R_SYM (relas[i].r_info);if (sym->st_shndx !=SHN_LIVEPATCH ) {pr_err ("symbol %s is not marked as a livepatch symbol\n" , strtab + sym->st_name);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 516/1126 net: asix: add proper error handling of usb read errors
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 920a9fa27e7805499cfe78491b36fed2322c02ec ]
Syzbot once again hit uninit value in asix driver. The problem still the same -- asix_read_cmd() reads less bytes, than was requested by caller.
Since all read requests are performed via asix_read_cmd() let's catch usb related error there and add __must_check notation to be sure all callers actually check return value.
So, this patch adds sanity check inside asix_read_cmd(), that simply checks if bytes read are not less, than was requested and adds missing error handling of asix_read_cmd() all across the driver code.
--- drivers/net/usb/asix.h | 4 ++-- drivers/net/usb/asix_common.c | 19 +++++++++++++------ drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++--- 3 files changed, 33 insertions(+), 11 deletions(-)
drivers/net/usb/asix.h +2 -2
@@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;/* ASIX specific flags */ #define FLAG_EEPROM_MAC (1UL << 0)/* init device MAC from eeprom */ -int asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, -u16 size,void *data,int in_pm); +int __must_check asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, +u16 size,void *data,int in_pm);int asix_write_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index,u16 size,void *data,int in_pm);
drivers/net/usb/asix_common.c +13 -6
@@ -11,8 +11,8 @@#define AX_HOST_EN_RETRIES 30 -int asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, -u16 size,void *data,int in_pm) +int __must_check asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, +u16 size,void *data,int in_pm) {int ret;int (*fn)(struct usbnet *,u8 ,u8 ,u16 ,u16 ,void *,u16 );
@@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, ret =fn (dev, cmd,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , value, index, data, size); -if (unlikely (ret <0 )) +if (unlikely (ret < size)) { + ret = ret <0 ? ret : -ENODATA ; +netdev_warn (dev->net,"Failed to read reg index 0x%04x: %d\n" , index, ret); + }return ret; }
@@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm) 0, 0, 1, &smsr, in_pm);if (ret == -ENODEV )break ; -else if (ret <sizeof (smsr)) +else if (ret <0 )continue ;else if (smsr &AX_HOST_EN )break ;
@@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)return ret; } -asix_read_cmd (dev,AX_CMD_READ_MII_REG , phy_id, - (__u16 )loc,2 , &res,1 ); + ret =asix_read_cmd (dev,AX_CMD_READ_MII_REG , phy_id, + (__u16 )loc,2 , &res,1 ); +if (ret <0 ) { +mutex_unlock (&dev->phy_mutex); +return ret; + }asix_set_hw_mii (dev,1 );mutex_unlock (&dev->phy_mutex);
drivers/net/usb/asix_devices.c +18 -3
@@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) priv->phy_addr = ret; priv->embd_phy = ((priv->phy_addr &0x1f ) ==0x10 ); -asix_read_cmd (dev,AX_CMD_STATMNGSTS_REG ,0 ,0 ,1 , &chipcode,0 ); + ret =asix_read_cmd (dev,AX_CMD_STATMNGSTS_REG ,0 ,0 ,1 , &chipcode,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read STATMNGSTS_REG: %d\n" , ret); +return ret; + } + chipcode &=AX_CHIPCODE_MASK ; ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
@@ -920,11 +925,21 @@ static int ax88178_reset(struct usbnet *dev)int gpio0 =0 ;u32 phyid; -asix_read_cmd (dev,AX_CMD_READ_GPIOS ,0 ,0 ,1 , &status,0 ); + ret =asix_read_cmd (dev,AX_CMD_READ_GPIOS ,0 ,0 ,1 , &status,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read GPIOS: %d\n" , ret); +return ret; + } +netdev_dbg (dev->net,"GPIO Status: 0x%04x\n" , status);asix_write_cmd (dev,AX_CMD_WRITE_ENABLE ,0 ,0 ,0 ,NULL ,0 ); -asix_read_cmd (dev,AX_CMD_READ_EEPROM ,0x0017 ,0 ,2 , &eeprom,0 ); + ret =asix_read_cmd (dev,AX_CMD_READ_EEPROM ,0x0017 ,0 ,2 , &eeprom,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read EEPROM: %d\n" , ret); +return ret; + } +asix_write_cmd (dev,AX_CMD_WRITE_DISABLE ,0 ,0 ,0 ,NULL ,0 );netdev_dbg (dev->net,"EEPROM index 0x17 is 0x%04x\n" , eeprom);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 517/1126 i2c: bcm2835: Fix the error handling in bcm2835_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b205f5850263632b6897d8f0bfaeeea4955f8663 ]
Some resource should be released if an error occurs in 'bcm2835_i2c_probe()'.
Add an error handling path and the needed 'clk_disable_unprepare()' and 'clk_rate_exclusive_put()' calls.
While at it, rework the bottom of the function to use this newly added error handling path and have an explicit and more standard "return 0;" at the end of the normal path.
--- drivers/i2c/busses/i2c-bcm2835.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-bcm2835.c +16 -5
@@ -454,18 +454,20 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) ret =clk_prepare_enable (i2c_dev->bus_clk);if (ret) {dev_err (&pdev->dev,"Couldn't prepare clock" ); -return ret; + goto err_put_exclusive_rate; } i2c_dev->irq =platform_get_irq (pdev,0 ); -if (i2c_dev->irq <0 ) -return i2c_dev->irq; +if (i2c_dev->irq <0 ) { + ret = i2c_dev->irq; + goto err_disable_unprepare_clk; + } ret =request_irq (i2c_dev->irq, bcm2835_i2c_isr,IRQF_SHARED ,dev_name (&pdev->dev), i2c_dev);if (ret) {dev_err (&pdev->dev,"Could not request IRQ\n" ); -return -ENODEV ; + goto err_disable_unprepare_clk; } adap = &i2c_dev->adapter;
@@ -489,7 +491,16 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) ret =i2c_add_adapter (adap);if (ret) -free_irq (i2c_dev->irq, i2c_dev); + goto err_free_irq; + +return 0 ; + +err_free_irq: +free_irq (i2c_dev->irq, i2c_dev); +err_disable_unprepare_clk: +clk_disable_unprepare (i2c_dev->bus_clk); +err_put_exclusive_rate: +clk_rate_exclusive_put (i2c_dev->bus_clk);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 518/1126 mtd: mchp23k256: Add SPI ID table
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit bc7ee2e34b219da6813c17a1680dd20766648883 ]
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.
--- drivers/mtd/devices/mchp23k256.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/mtd/devices/mchp23k256.c +14 -0
@@ -231,6 +231,19 @@ static const struct of_device_id mchp23k256_of_table[] = { };MODULE_DEVICE_TABLE (of, mchp23k256_of_table); +static const struct spi_device_id mchp23k256_spi_ids[] = { + { + .name ="mchp23k256" , + .driver_data = (kernel_ulong_t)&mchp23k256_caps, + }, + { + .name ="mchp23lcv1024" , + .driver_data = (kernel_ulong_t)&mchp23lcv1024_caps, + }, + {} +}; +MODULE_DEVICE_TABLE (spi, mchp23k256_spi_ids); +static struct spi_driver mchp23k256_driver = { .driver = { .name ="mchp23k256" ,
@@ -238,6 +251,7 @@ static struct spi_driver mchp23k256_driver = { }, .probe = mchp23k256_probe, .remove = mchp23k256_remove, + .id_table = mchp23k256_spi_ids, };module_spi_driver (mchp23k256_driver);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 519/1126 mtd: mchp48l640: Add SPI ID table
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 69a6d06878f05d63673b0dcdc3c3ef1af2996d46 ]
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.
--- drivers/mtd/devices/mchp48l640.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mtd/devices/mchp48l640.c +10 -0
@@ -359,6 +359,15 @@ static const struct of_device_id mchp48l640_of_table[] = { };MODULE_DEVICE_TABLE (of, mchp48l640_of_table); +static const struct spi_device_id mchp48l640_spi_ids[] = { + { + .name ="48l640" , + .driver_data = (kernel_ulong_t)&mchp48l640_caps, + }, + {} +}; +MODULE_DEVICE_TABLE (spi, mchp48l640_spi_ids); +static struct spi_driver mchp48l640_driver = { .driver = { .name ="mchp48l640" ,
@@ -366,6 +375,7 @@ static struct spi_driver mchp48l640_driver = { }, .probe = mchp48l640_probe, .remove = mchp48l640_remove, + .id_table = mchp48l640_spi_ids, };module_spi_driver (mchp48l640_driver);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 520/1126 selftests/bpf: Extract syscall wrapper
In reply to Greg Kroah-HartmanFrom: Kenta Tada <[email protected]>
[ Upstream commit 78a2054156dd6265619b230cc5372b74f9ba5233 ]
Extract the helper to set up SYS_PREFIX for fentry and kprobe selftests that use __x86_sys_* attach functions.
--- tools/testing/selftests/bpf/progs/bpf_misc.h | 19 +++++++++++++++++++ .../selftests/bpf/progs/test_probe_user.c | 15 +-------------- 2 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/bpf_misc.h
tools/testing/selftests/bpf/progs/bpf_misc.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __BPF_MISC_H__ +#define __BPF_MISC_H__ + +#if defined(__TARGET_ARCH_x86) +#define SYSCALL_WRAPPER 1 +#define SYS_PREFIX "__x64_" +#elif defined(__TARGET_ARCH_s390) +#define SYSCALL_WRAPPER 1 +#define SYS_PREFIX "__s390x_" +#elif defined(__TARGET_ARCH_arm64) +#define SYSCALL_WRAPPER 1 +#define SYS_PREFIX "__arm64_" +#else +#define SYSCALL_WRAPPER 0 +#define SYS_PREFIX "" +#endif + +#endif
tools/testing/selftests/bpf/progs/test_probe_user.c +1 -14
@@ -7,20 +7,7 @@#include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> - -#if defined(__TARGET_ARCH_x86) -#define SYSCALL_WRAPPER 1 -#define SYS_PREFIX "__x64_" -#elif defined(__TARGET_ARCH_s390) -#define SYSCALL_WRAPPER 1 -#define SYS_PREFIX "__s390x_" -#elif defined(__TARGET_ARCH_arm64) -#define SYSCALL_WRAPPER 1 -#define SYS_PREFIX "__arm64_" -#else -#define SYSCALL_WRAPPER 0 -#define SYS_PREFIX "" -#endif +#include "bpf_misc.h" static struct sockaddr_in old;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 521/1126 selftests/bpf: Use "__se_" prefix on architectures without syscall wrapper
In reply to Greg Kroah-HartmanFrom: Naveen N. Rao <[email protected]>
[ Upstream commit 046b841ea7c528931e7d2e74d5e668aa6c94c1fc ]
On architectures that don't use a syscall wrapper, sys_* function names are set as an alias of __se_sys_* functions. Due to this, there is no BTF associated with sys_* function names. This results in some of the test progs failing to load. Set the SYS_PREFIX to "__se_" to fix this issue.
--- tools/testing/selftests/bpf/progs/bpf_misc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/bpf_misc.h +1 -1
@@ -13,7 +13,7 @@#define SYS_PREFIX "__arm64_"#else #define SYSCALL_WRAPPER 0 -#define SYS_PREFIX "" +#define SYS_PREFIX "__se_"#endif #endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 522/1126 igc: avoid kernel warning when changing RX ring parameters
In reply to Greg Kroah-HartmanFrom: Corinna Vinschen <[email protected]>
[ Upstream commit 453307b569a0d41bddd07f26bf41b784cd82a4c9 ]
Calling ethtool changing the RX ring parameters like this:
$ ethtool -G eth0 rx 1024
on igc triggers kernel warnings like this:
[ 225.198467] ------------[ cut here ]------------ [ 225.198473] Missing unregister, handled but fix driver [ 225.198485] WARNING: CPU: 7 PID: 959 at net/core/xdp.c:168 xdp_rxq_info_reg+0x79/0xd0 [...] [ 225.198601] Call Trace: [ 225.198604] <TASK> [ 225.198609] igc_setup_rx_resources+0x3f/0xe0 [igc] [ 225.198617] igc_ethtool_set_ringparam+0x30e/0x450 [igc] [ 225.198626] ethnl_set_rings+0x18a/0x250 [ 225.198631] genl_family_rcv_msg_doit+0xca/0x110 [ 225.198637] genl_rcv_msg+0xce/0x1c0 [ 225.198640] ? rings_prepare_data+0x60/0x60 [ 225.198644] ? genl_get_cmd+0xd0/0xd0 [ 225.198647] netlink_rcv_skb+0x4e/0xf0 [ 225.198652] genl_rcv+0x24/0x40 [ 225.198655] netlink_unicast+0x20e/0x330 [ 225.198659] netlink_sendmsg+0x23f/0x480 [ 225.198663] sock_sendmsg+0x5b/0x60 [ 225.198667] __sys_sendto+0xf0/0x160 [ 225.198671] ? handle_mm_fault+0xb2/0x280 [ 225.198676] ? do_user_addr_fault+0x1eb/0x690 [ 225.198680] __x64_sys_sendto+0x20/0x30 [ 225.198683] do_syscall_64+0x38/0x90 [ 225.198687] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 225.198693] RIP: 0033:0x7f7ae38ac3aa
igc_ethtool_set_ringparam() copies the igc_ring structure but neglects to reset the xdp_rxq_info member before calling igc_setup_rx_resources(). This in turn calls xdp_rxq_info_reg() with an already registered xdp_rxq_info.
Make sure to unregister the xdp_rxq_info structure first in igc_setup_rx_resources.
--- drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igc/igc_main.c +3 -0
@@ -505,6 +505,9 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring)u8 index = rx_ring->queue_index;int size, desc_len, res; +/* XDP RX-queue info */ +if (xdp_rxq_info_is_reg (&rx_ring->xdp_rxq)) +xdp_rxq_info_unreg (&rx_ring->xdp_rxq); res =xdp_rxq_info_reg (&rx_ring->xdp_rxq, ndev, index, rx_ring->q_vector->napi.napi_id);if (res <0 ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 523/1126 igb: refactor XDP registration
In reply to Greg Kroah-HartmanFrom: Corinna Vinschen <[email protected]>
[ Upstream commit e62ad74aa534404b3ee7e250b114a3536ac56987 ]
On changing the RX ring parameters igb uses a hack to avoid a warning when calling xdp_rxq_info_reg via igb_setup_rx_resources. It just clears the struct xdp_rxq_info content.
Instead, change this to unregister if we're already registered. Align code to the igc code.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ---- drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +0 -4
@@ -965,10 +965,6 @@ static int igb_set_ringparam(struct net_device *netdev,memcpy (&temp_ring[i], adapter->rx_ring[i],sizeof (struct igb_ring )); -/* Clear copied XDP RX-queue info */ -memset (&temp_ring[i].xdp_rxq,0 , -sizeof (temp_ring[i].xdp_rxq)); - temp_ring[i].count = new_rx_count; err =igb_setup_rx_resources (&temp_ring[i]);if (err) {
drivers/net/ethernet/intel/igb/igb_main.c +13 -6
@@ -4352,7 +4352,18 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) {struct igb_adapter *adapter =netdev_priv (rx_ring->netdev);struct device *dev = rx_ring->dev; -int size; +int size, res; + +/* XDP RX-queue info */ +if (xdp_rxq_info_is_reg (&rx_ring->xdp_rxq)) +xdp_rxq_info_unreg (&rx_ring->xdp_rxq); + res =xdp_rxq_info_reg (&rx_ring->xdp_rxq, rx_ring->netdev, + rx_ring->queue_index,0 ); +if (res <0 ) { +dev_err (dev,"Failed to register xdp_rxq index %u\n" , + rx_ring->queue_index); +return res; + } size =sizeof (struct igb_rx_buffer ) * rx_ring->count;
@@ -4375,14 +4386,10 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) rx_ring->xdp_prog = adapter->xdp_prog; -/* XDP RX-queue info */ -if (xdp_rxq_info_reg (&rx_ring->xdp_rxq, rx_ring->netdev, - rx_ring->queue_index,0 ) <0 ) - goto err; -return 0 ; err: +xdp_rxq_info_unreg (&rx_ring->xdp_rxq);vfree (rx_ring->rx_buffer_info); rx_ring->rx_buffer_info =NULL ;dev_err (dev,"Unable to allocate memory for the Rx descriptor ring\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 524/1126 drm/amdgpu: Dont offset by 2 in FRU EEPROM
In reply to Greg Kroah-HartmanFrom: Luben Tuikov <[email protected]>
[ Upstream commit 3f3a24a0a3a58677d2b4f3c442d7a1be05afb123 ]
Read buffers no longer expose the I2C address, and so we don't need to offset by two when we get the read data.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +4 -9
@@ -91,17 +91,13 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,int amdgpu_fru_get_product_info (struct amdgpu_device *adev) { -unsigned char buff[AMDGPU_PRODUCT_NAME_LEN +2 ]; +unsigned char buff[AMDGPU_PRODUCT_NAME_LEN ];u32 addrptr;int size, len; -int offset =2 ;if (!is_fru_eeprom_supported (adev))return 0 ; -if (adev->asic_type ==CHIP_ALDEBARAN ) - offset =0 ; -/* If algo exists, it means that the i2c_adapter's initialized */ if (!adev->pm.smu_i2c.algo) {DRM_WARN ("Cannot access FRU, EEPROM accessor not initialized" );
@@ -143,8 +139,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) AMDGPU_PRODUCT_NAME_LEN); len =AMDGPU_PRODUCT_NAME_LEN -1 ; } -/* Start at 2 due to buff using fields 0 and 1 for the address */ -memcpy (adev->product_name, &buff[offset], len); +memcpy (adev->product_name, buff, len); adev->product_name[len] ='\0' ; addrptr += size +1 ;
@@ -162,7 +157,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)DRM_WARN ("FRU Product Number is larger than 16 characters. This is likely a mistake" ); len =sizeof (adev->product_number) -1 ; } -memcpy (adev->product_number, &buff[offset], len); +memcpy (adev->product_number, buff, len); adev->product_number[len] ='\0' ; addrptr += size +1 ;
@@ -189,7 +184,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)DRM_WARN ("FRU Serial Number is larger than 16 characters. This is likely a mistake" ); len =sizeof (adev->serial) -1 ; } -memcpy (adev->serial, &buff[offset], len); +memcpy (adev->serial, buff, len); adev->serial[len] ='\0' ;return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 525/1126 PCI: aardvark: Fix reading MSI interrupt number
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 805dfc18dd3d4dd97a987d4406593b5a225b1253 ]
In advk_pcie_handle_msi() it is expected that when bit i in the W1C register PCIE_MSI_STATUS_REG is cleared, the PCIE_MSI_PAYLOAD_REG is updated to contain the MSI number corresponding to index i.
Experiments show that this is not so, and instead PCIE_MSI_PAYLOAD_REG always contains the number of the last received MSI, overall.
Do not read PCIE_MSI_PAYLOAD_REG register for determining MSI interrupt number. Since Aardvark already forbids more than 32 interrupts and uses own allocated hwirq numbers, the msi_idx already corresponds to the received MSI number.
--- drivers/pci/controller/pci-aardvark.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/pci/controller/pci-aardvark.c +2 -7
@@ -1388,7 +1388,6 @@ static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)static void advk_pcie_handle_msi (struct advk_pcie *pcie) {u32 msi_val, msi_mask, msi_status, msi_idx; -u16 msi_data; msi_mask =advk_readl (pcie,PCIE_MSI_MASK_REG ); msi_val =advk_readl (pcie,PCIE_MSI_STATUS_REG );
@@ -1398,13 +1397,9 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie)if (!(BIT (msi_idx) & msi_status))continue ; -/* -* msi_idx contains bits [4:0] of the msi_data and msi_data -* contains 16bit MSI interrupt number -*/ advk_writel (pcie,BIT (msi_idx),PCIE_MSI_STATUS_REG ); - msi_data =advk_readl (pcie,PCIE_MSI_PAYLOAD_REG ) &PCIE_MSI_DATA_MASK ; -generic_handle_irq (msi_data); +if (generic_handle_domain_irq (pcie->msi_inner_domain, msi_idx) == -EINVAL ) +dev_err_ratelimited (&pcie->pdev->dev,"unexpected MSI 0x%02x\n" , msi_idx); } advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 526/1126 PCI: aardvark: Fix reading PCI_EXP_RTSTA_PME bit on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 735f5ae49e1b44742cc63ca9b5c1ffde3e94ba91 ]
The emulated bridge returns incorrect value for PCI_EXP_RTSTA register during readout in advk_pci_bridge_emul_pcie_conf_read() function: the correct bit is BIT(16), but we are setting BIT(23), because the code does
*value = (isr0 & PCIE_MSG_PM_PME_MASK) << 16
where
PCIE_MSG_PM_PME_MASK
is
BIT(7).
The code should probably have been something like
*value = (!!(isr0 & PCIE_MSG_PM_PME_MASK)) << 16,
but we are better of using an if() and using the proper macro for this bit.
--- drivers/pci/controller/pci-aardvark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
@@ -846,7 +846,9 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge,case PCI_EXP_RTSTA : {u32 isr0 =advk_readl (pcie,PCIE_ISR0_REG );u32 msglog =advk_readl (pcie,PCIE_MSG_LOG_REG ); - *value = (isr0 &PCIE_MSG_PM_PME_MASK ) <<16 | (msglog >>16 ); + *value = msglog >>16 ; +if (isr0 &PCIE_MSG_PM_PME_MASK ) + *value |=PCI_EXP_RTSTA_PME ;return PCI_BRIDGE_EMUL_HANDLED ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 527/1126 RDMA/rxe: Check the last packet by RXE_END_MASK
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
[ Upstream commit b1377cc37f6bebd57ce8747b7e16163a475af295 ]
It's wrong to check the last packet by RXE_COMP_MASK because the flag is to indicate if responder needs to generate a completion.
--- drivers/infiniband/sw/rxe/rxe_resp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +6 -4
@@ -814,6 +814,10 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt)return RESPST_ERR_INVALIDATE_RKEY ; } +if (pkt->mask &RXE_END_MASK ) +/* We successfully processed this new request. */ + qp->resp.msn++; +/* next expected psn, read handles this separately */ qp->resp.psn = (pkt->psn +1 ) &BTH_PSN_MASK ; qp->resp.ack_psn = qp->resp.psn;
@@ -821,11 +825,9 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) qp->resp.opcode = pkt->opcode; qp->resp.status =IB_WC_SUCCESS ; -if (pkt->mask &RXE_COMP_MASK ) { -/* We successfully processed this new request. */ - qp->resp.msn++; +if (pkt->mask &RXE_COMP_MASK )return RESPST_COMPLETE ; - }else if (qp_type (qp) ==IB_QPT_RC ) +else if (qp_type (qp) ==IB_QPT_RC )return RESPST_ACKNOWLEDGE ;else return RESPST_CLEANUP ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 528/1126 libbpf: Fix signedness bug in btf_dump_array_data()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4172843ed4a38f97084032f74f07b2037b5da3a6 ]
The btf__resolve_size() function returns negative error codes so "elem_size" must be signed for the error handling to work.
--- tools/lib/bpf/btf_dump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/lib/bpf/btf_dump.c +3 -2
@@ -1861,14 +1861,15 @@ static int btf_dump_array_data(struct btf_dump *d, {const struct btf_array *array =btf_array (t);const struct btf_type *elem_type; -__u32 i, elem_size =0 , elem_type_id; +__u32 i, elem_type_id; +__s64 elem_size;bool is_array_member; elem_type_id = array->type; elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %d for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 529/1126 libbpf: Fix riscv register names
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 5c101153bfd67387ba159b7864176217a40757da ]
riscv registers are accessed via struct user_regs_struct, not struct pt_regs. The program counter member in this struct is called pc, not epc. The frame pointer is called s0, not fp.
--- tools/lib/bpf/bpf_tracing.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/bpf/bpf_tracing.h +2 -2
@@ -206,10 +206,10 @@#define __PT_PARM4_REG a3#define __PT_PARM5_REG a4#define __PT_RET_REG ra -#define __PT_FP_REG fp +#define __PT_FP_REG s0#define __PT_RC_REG a5#define __PT_SP_REG sp -#define __PT_IP_REG epc +#define __PT_IP_REG pc#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 530/1126 cxl/core: Fix cxl_probe_component_regs() error message
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit d621bc2e7282f9955033a6359877fd4ac4be60e1 ]
Fix a '\n' vs '/n' typo.
--- drivers/cxl/core/regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/regs.c +1 -1
@@ -49,7 +49,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base,if (FIELD_GET (CXL_CM_CAP_HDR_ID_MASK , cap_array) !=CM_CAP_HDR_CAP_ID ) {dev_err (dev, -"Couldn't locate the CXL.cache and CXL.mem capability array header./n" ); +"Couldn't locate the CXL.cache and CXL.mem capability array header.\n" );return ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 531/1126 tools/testing/cxl: Fix root port to host bridge assignment
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit a4a0ce242fcd7022349212c4e2f795762e6ff050 ]
Mocked root-ports are meant to be round-robin assigned to host-bridges.
--- tools/testing/cxl/test/cxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/cxl/test/cxl.c +1 -1
@@ -511,7 +511,7 @@ static __init int cxl_test_init(void)for (i =0 ; i <ARRAY_SIZE (cxl_root_port); i++) {struct platform_device *bridge = - cxl_host_bridge[i /NR_CXL_ROOT_PORTS ]; + cxl_host_bridge[i %ARRAY_SIZE (cxl_host_bridge)];struct platform_device *pdev; pdev =platform_device_alloc ("cxl_root_port" , i);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 532/1126 cxl/regs: Fix size of CXL Capability Header Register
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 74b0fe80409733055971bbfaf33c80a33fddeeb3 ]
In CXL 2.0, 8.2.5.1 CXL Capability Header Register: this register is given as 32 bits.
8.2.3 which covers the CXL 2.0 Component registers, including the CXL Capability Header Register states that access restrictions specified in Section 8.2.2 apply.
8.2.2 includes:
* A 32 bit register shall be accessed as a 4 Byte quantity.
...
If these rules are not followed, the behavior is undefined.
Discovered during review of CXL QEMU emulation. Alex Bennée pointed out there was a comment saying that 4 byte registers must be read with a 4 byte read, but 8 byte reads were being emulated.
https://lore.kernel.org/qemu-devel/[email protected]/
Fixing that, led to this code failing. Whilst a given hardware implementation 'might' work with an 8 byte read, it should not be relied upon. The QEMU emulation v5 will return 0 and log the wrong access width.
The code moved, so one fixes tag for where this will directly apply and also a reference to the earlier introduction of the code for backports.
--- drivers/cxl/core/regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cxl/core/regs.c +2 -2
@@ -35,7 +35,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base, struct cxl_component_reg_map *map) {int cap, cap_count; -u64 cap_array; +u32 cap_array; *map = (struct cxl_component_reg_map ) {0 };
@@ -45,7 +45,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base,*/ base +=CXL_CM_OFFSET ; - cap_array =readq (base +CXL_CM_CAP_HDR_OFFSET ); + cap_array =readl (base +CXL_CM_CAP_HDR_OFFSET );if (FIELD_GET (CXL_CM_CAP_HDR_ID_MASK , cap_array) !=CM_CAP_HDR_CAP_ID ) { dev_err(dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 533/1126 Netvsc: Call hv_unmap_memory() in the netvsc_device_remove()
In reply to Greg Kroah-HartmanFrom: Tianyu Lan <[email protected]>
[ Upstream commit b539324f6fe798bdb186e4e91eafb37dd851db2a ]
netvsc_device_remove() calls vunmap() inside which should not be called in the interrupt context. Current code calls hv_unmap_memory() in the free_netvsc_device() which is rcu callback and maybe called in the interrupt context. This will trigger BUG_ON(in_interrupt()) in the vunmap(). Fix it via moving hv_unmap_memory() to netvsc_device_ remove().
--- drivers/net/hyperv/netvsc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/net/hyperv/netvsc.c +16 -8
@@ -154,19 +154,15 @@ static void free_netvsc_device(struct rcu_head *head)kfree (nvdev->extension); -if (nvdev->recv_original_buf) { -hv_unmap_memory (nvdev->recv_buf); +if (nvdev->recv_original_buf)vfree (nvdev->recv_original_buf); - }else { +else vfree (nvdev->recv_buf); - } -if (nvdev->send_original_buf) { -hv_unmap_memory (nvdev->send_buf); +if (nvdev->send_original_buf)vfree (nvdev->send_original_buf); - }else { +else vfree (nvdev->send_buf); - }bitmap_free (nvdev->send_section_map);
@@ -765,6 +761,12 @@ void netvsc_device_remove(struct hv_device *device)netvsc_teardown_send_gpadl (device, net_device, ndev); } +if (net_device->recv_original_buf) +hv_unmap_memory (net_device->recv_buf); + +if (net_device->send_original_buf) +hv_unmap_memory (net_device->send_buf); +/* Release all resources */ free_netvsc_device_rcu (net_device); }
@@ -1821,6 +1823,12 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,netif_napi_del (&net_device->chan_table[0 ].napi); cleanup2: +if (net_device->recv_original_buf) +hv_unmap_memory (net_device->recv_buf); + +if (net_device->send_original_buf) +hv_unmap_memory (net_device->send_buf); +free_netvsc_device (&net_device->rcu);return ERR_PTR (ret);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 534/1126 net:enetc: allocate CBD ring data memory using DMA coherent methods
In reply to Greg Kroah-HartmanFrom: Po Liu <[email protected]>
[ Upstream commit b3a723dbc94a6e38f67669d03b521edd766ad895 ]
To replace the dma_map_single() stream DMA mapping with DMA coherent method dma_alloc_coherent() which is more simple.
dma_map_single() found by Tim Gardner not proper. Suggested by Claudiu Manoil and Jakub Kicinski to use dma_alloc_coherent(). Discussion at:
--- .../net/ethernet/freescale/enetc/enetc_qos.c | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +64 -64
@@ -45,6 +45,7 @@ void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) | pspeed); } +#define ENETC_QOS_ALIGN 64static int enetc_setup_taprio (struct net_device *ndev,struct tc_taprio_qopt_offload *admin_conf) {
@@ -52,10 +53,11 @@ static int enetc_setup_taprio(struct net_device *ndev,struct enetc_cbd cbd = {.cmd =0 };struct tgs_gcl_conf *gcl_config;struct tgs_gcl_data *gcl_data; +dma_addr_t dma, dma_align;struct gce *gce; -dma_addr_t dma;u16 data_size;u16 gcl_len; +void *tmp;u32 tge;int err;int i;
@@ -82,9 +84,16 @@ static int enetc_setup_taprio(struct net_device *ndev, gcl_config = &cbd.gcl_conf; data_size =struct_size (gcl_data, entry, gcl_len); - gcl_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!gcl_data) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of taprio gate list failed!\n" );return -ENOMEM ; + } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + gcl_data = (struct tgs_gcl_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); gce = (struct gce *)(gcl_data +1 );
@@ -110,16 +119,8 @@ static int enetc_setup_taprio(struct net_device *ndev, cbd.length =cpu_to_le16 (data_size); cbd.status_flags =0 ; - dma =dma_map_single (&priv->si->pdev->dev, gcl_data, - data_size,DMA_TO_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); -kfree (gcl_data); -return -ENOMEM ; - } - - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); cbd.cls =BDCR_CMD_PORT_GCL ; cbd.status_flags =0 ;
@@ -132,8 +133,8 @@ static int enetc_setup_taprio(struct net_device *ndev,ENETC_QBV_PTGCR_OFFSET , tge & (~ENETC_QBV_TGE)); -dma_unmap_single (&priv->si->pdev->dev, dma, data_size,DMA_TO_DEVICE ); -kfree (gcl_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
@@ -463,8 +464,9 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv,struct enetc_cbd cbd = {.cmd =0 };struct streamid_data *si_data;struct streamid_conf *si_conf; +dma_addr_t dma, dma_align;u16 data_size; -dma_addr_t dma; +void *tmp;int port;int err;
@@ -485,21 +487,20 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, cbd.status_flags =0 ; data_size =sizeof (struct streamid_data ); - si_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!si_data) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream identify failed!\n" );return -ENOMEM ; - cbd.length =cpu_to_le16 (data_size); - - dma =dma_map_single (&priv->si->pdev->dev, si_data, - data_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); - err = -ENOMEM ; - goto out; } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + si_data = (struct streamid_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.length =cpu_to_le16 (data_size); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align));eth_broadcast_addr (si_data->dmac); si_data->vid_vidm_tg = (ENETC_CBDR_SID_VID_MASK + ((0x3 <<14 ) |ENETC_CBDR_SID_VIDM ));
@@ -539,8 +540,8 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, cbd.length =cpu_to_le16 (data_size); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align));/* VIDM default to be 1. * VID Match. If set (b1) then the VID must match, otherwise
@@ -561,10 +562,8 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, err =enetc_send_cmd (priv->si, &cbd); out: -if (!dma_mapping_error (&priv->si->pdev->dev, dma)) -dma_unmap_single (&priv->si->pdev->dev, dma, data_size,DMA_FROM_DEVICE ); - -kfree (si_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
@@ -633,8 +632,9 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, {struct enetc_cbd cbd = { .cmd =2 };struct sfi_counter_data *data_buf; -dma_addr_t dma; +dma_addr_t dma, dma_align;u16 data_size; +void *tmp;int err; cbd.index =cpu_to_le16 ((u16 )index);
@@ -643,19 +643,19 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, cbd.status_flags =0 ; data_size =sizeof (struct sfi_counter_data ); - data_buf =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!data_buf) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream counter failed!\n" );return -ENOMEM ; - - dma =dma_map_single (&priv->si->pdev->dev, data_buf, - data_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); - err = -ENOMEM ; - goto exit; } - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + data_buf = (struct sfi_counter_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); + + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); cbd.length =cpu_to_le16 (data_size);
@@ -684,7 +684,9 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, data_buf->flow_meter_dropl; exit: -kfree (data_buf); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma); +return err; }
@@ -723,9 +725,10 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv,struct sgcl_conf *sgcl_config;struct sgcl_data *sgcl_data;struct sgce *sgce; -dma_addr_t dma; +dma_addr_t dma, dma_align;u16 data_size;int err, i; +void *tmp;u64 now; cbd.index =cpu_to_le16 (sgi->index);
@@ -772,24 +775,20 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv, sgcl_config->acl_len = (sgi->num_entries -1 ) &0x3 ; data_size =struct_size (sgcl_data, sgcl, sgi->num_entries); - - sgcl_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!sgcl_data) -return -ENOMEM ; - - cbd.length =cpu_to_le16 (data_size); - - dma =dma_map_single (&priv->si->pdev->dev, - sgcl_data, data_size, -DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); -kfree (sgcl_data); + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream counter failed!\n" );return -ENOMEM ; } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + sgcl_data = (struct sgcl_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.length =cpu_to_le16 (data_size); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); sgce = &sgcl_data->sgcl[0 ];
@@ -844,7 +843,8 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv, err =enetc_send_cmd (priv->si, &cbd); exit: -kfree (sgcl_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 535/1126 libbpf: Fix compilation warning due to mismatched printf format
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit dc37dc617fabfb1c3a16d49f5d8cc20e9e3608ca ]
On ppc64le architecture __s64 is long int and requires %ld. Cast to ssize_t and use %zd to avoid architecture-specific specifiers.
--- tools/lib/bpf/btf_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/btf_dump.c +2 -1
@@ -1869,7 +1869,8 @@ static int btf_dump_array_data(struct btf_dump *d, elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %zd for array type [%u]\n" , + (ssize_t )elem_size, id);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 536/1126 rtw88: fix use after free in rtw_hw_scan_update_probe_req()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit a954f29aea5d2cf58feedf83235edf3367229a37 ]
This code needs to use skb_queue_walk_safe() instead of skb_queue_walk() because it frees the list iterator.
--- drivers/net/wireless/realtek/rtw88/fw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw88/fw.c +3 -3
@@ -1853,7 +1853,7 @@ static int _rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, u8 num_probes, rtwdev->scan_info.probe_pg_size = page_offset; out:kfree (buf); - skb_queue_walk(probe_req_list, skb) + skb_queue_walk_safe(probe_req_list, skb, tmp)kfree_skb (skb);return ret;
@@ -1864,7 +1864,7 @@ static int rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, {struct cfg80211_scan_request *req = rtwvif->scan_req;struct sk_buff_head list; -struct sk_buff *skb; +struct sk_buff *skb, *tmp;u8 num = req->n_ssids, i, bands =0 ;int ret;
@@ -1889,7 +1889,7 @@ static int rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev,return _rtw_hw_scan_update_probe_req (rtwdev, num * bands, &list); out: - skb_queue_walk(&list, skb) + skb_queue_walk_safe(&list, skb, tmp)kfree_skb (skb);return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 537/1126 drm/bridge: dw-hdmi: use safe format when first in bridge chain
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 1528038385c0a706aac9ac165eeb24044fef6825 ]
When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.
Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.
Commit 7cd70656d128 ("drm/bridge: display-connector: implement bus fmts callbacks") was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.
But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
@@ -2551,8 +2551,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,if (!output_fmts)return NULL ; -/* If dw-hdmi is the only bridge, avoid negociating with ourselves */ -if (list_is_singular (&bridge->encoder->bridge_chain)) { +/* If dw-hdmi is the first or only bridge, avoid negociating with ourselves */ +if (list_is_singular (&bridge->encoder->bridge_chain) || +list_is_first (&bridge->chain_node, &bridge->encoder->bridge_chain)) { *num_output_fmts =1 ; output_fmts[0 ] =MEDIA_BUS_FMT_FIXED ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 538/1126 power: supply: ab8500: Swap max and overvoltage
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit d662a7df36e1edc65eaf166ec1c8527ce9d088ea ]
We should terminate charging when we reach the voltage_max_design_uv not overvoltage_limit_uv, this is an abuse of that struct member.
The overvoltage limit is actually not configurable on the AB8500, it is fixed to 4.75 V so drop a comment about that in the code.
--- drivers/power/supply/ab8500_bmdata.c | 8 +++----- drivers/power/supply/ab8500_chargalg.c | 2 +- drivers/power/supply/ab8500_fg.c | 8 +++++++- 3 files changed, 11 insertions(+), 7 deletions(-)
drivers/power/supply/ab8500_bmdata.c +3 -5
@@ -188,13 +188,11 @@ int ab8500_bm_of_probe(struct power_supply *psy,* fall back to safe defaults. */ if ((bi->voltage_min_design_uv <0 ) || - (bi->voltage_max_design_uv <0 ) || - (bi->overvoltage_limit_uv <0 )) { + (bi->voltage_max_design_uv <0 )) {/* Nominal voltage is 3.7V for unknown batteries */ bi->voltage_min_design_uv =3700000 ; - bi->voltage_max_design_uv =3700000 ; -/* Termination voltage (overcharge limit) 4.05V */ - bi->overvoltage_limit_uv =4050000 ; +/* Termination voltage 4.05V */ + bi->voltage_max_design_uv =4050000 ; }if (bi->constant_charge_current_max_ua <0 )
drivers/power/supply/ab8500_chargalg.c +1 -1
@@ -802,7 +802,7 @@ static void ab8500_chargalg_end_of_charge(struct ab8500_chargalg *di) if (di->charge_status == POWER_SUPPLY_STATUS_CHARGING && di->charge_state == STATE_NORMAL && !di->maintenance_chg && (di->batt_data.volt_uv >= - di->bm->bi->overvoltage_limit_uv || + di->bm->bi->voltage_max_design_uv || di->events.usb_cv_active || di->events.ac_cv_active) && di->batt_data.avg_curr_ua < di->bm->bi->charge_term_current_ua &&
drivers/power/supply/ab8500_fg.c +7 -1
@@ -2263,7 +2263,13 @@ static int ab8500_fg_init_hw_registers(struct ab8500_fg *di) {int ret; -/* Set VBAT OVV threshold */ +/* +* Set VBAT OVV (overvoltage) threshold to 4.75V (typ) this is what +* the hardware supports, nothing else can be configured in hardware. +* See this as an "outer limit" where the charger will certainly +* shut down. Other (lower) overvoltage levels need to be implemented +* in software. +*/ ret = abx500_mask_and_set_register_interruptible(di->dev, AB8500_CHARGER, AB8500_BATT_OVV,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 539/1126 libbpf: Fix libbpf.map inheritance chain for LIBBPF_0.7.0
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit d130e954a002b901391037c33b9ae11bae5aaa91 ]
Ensure that LIBBPF_0.7.0 inherits everything from LIBBPF_0.6.0.
--- tools/lib/bpf/libbpf.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.map +1 -1
@@ -431,4 +431,4 @@ LIBBPF_0.7.0 { libbpf_probe_bpf_map_type; libbpf_probe_bpf_prog_type; libbpf_set_memlock_rlim_max; -}; +} LIBBPF_0.6.0;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 540/1126 libbpf: Use dynamically allocated buffer when receiving netlink messages
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 9c3de619e13ee6693ec5ac74f50b7aa89056a70e ]
When receiving netlink messages, libbpf was using a statically allocated stack buffer of 4k bytes. This happened to work fine on systems with a 4k page size, but on systems with larger page sizes it can lead to truncated messages. The user-visible impact of this was that libbpf would insist no XDP program was attached to some interfaces because that bit of the netlink message got chopped off.
Fix this by switching to a dynamically allocated buffer; we borrow the approach from iproute2 of using recvmsg() with MSG_PEEK|MSG_TRUNC to get the actual size of the pending message before receiving it, adjusting the buffer as necessary. While we're at it, also add retries on interrupted system calls around the recvmsg() call.
v2:
- Move peek logic to libbpf_netlink_recv(), don't double free on ENOMEM.
--- tools/lib/bpf/netlink.c | 55 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-)
tools/lib/bpf/netlink.c +51 -4
@@ -87,29 +87,75 @@ enum { NL_DONE, }; +static int netlink_recvmsg (int sock,struct msghdr *mhdr,int flags) +{ +int len; + +do { + len =recvmsg (sock, mhdr, flags); + }while (len <0 && (errno ==EINTR || errno ==EAGAIN )); + +if (len <0 ) +return -errno; +return len; +} + +static int alloc_iov (struct iovec *iov,int len) +{ +void *nbuf; + + nbuf =realloc (iov->iov_base, len); +if (!nbuf) +return -ENOMEM ; + + iov->iov_base = nbuf; + iov->iov_len = len; +return 0 ; +} +static int libbpf_netlink_recv (int sock,__u32 nl_pid,int seq,__dump_nlmsg_t _fn,libbpf_dump_nlmsg_t fn,void *cookie) { +struct iovec iov = {}; +struct msghdr mhdr = { + .msg_iov = &iov, + .msg_iovlen =1 , + };bool multipart = true;struct nlmsgerr *err;struct nlmsghdr *nh; -char buf[4096 ];int len, ret; + ret =alloc_iov (&iov,4096 ); +if (ret) + goto done; +while (multipart) { start: multipart = false; - len =recv (sock, buf,sizeof (buf),0 ); + len =netlink_recvmsg (sock, &mhdr,MSG_PEEK |MSG_TRUNC ); +if (len <0 ) { + ret = len; + goto done; + } + +if (len > iov.iov_len) { + ret =alloc_iov (&iov, len); +if (ret) + goto done; + } + + len =netlink_recvmsg (sock, &mhdr,0 );if (len <0 ) { - ret = -errno; + ret = len; goto done; }if (len ==0 )break ; -for (nh = (struct nlmsghdr *)buf;NLMSG_OK (nh, len); +for (nh = (struct nlmsghdr *)iov.iov_base;NLMSG_OK (nh, len); nh =NLMSG_NEXT (nh, len)) {if (nh->nlmsg_pid != nl_pid) { ret = -LIBBPF_ERRNO__WRNGPID ;
@@ -151,6 +197,7 @@ static int libbpf_netlink_recv(int sock, __u32 nl_pid, int seq, } ret =0 ; done: +free (iov.iov_base);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 541/1126 power: supply: ab8500: Fix memory leak in ab8500_fg_sysfs_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6a4760463dbc6b603690938c468839985189ce0a ]
kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add():
If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.
Fix memory leak by calling kobject_put().
--- drivers/power/supply/ab8500_fg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/power/supply/ab8500_fg.c +3 -1
@@ -2527,8 +2527,10 @@ static int ab8500_fg_sysfs_init(struct ab8500_fg *di) ret =kobject_init_and_add (&di->fg_kobject, &ab8500_fg_ktype,NULL ,"battery" ); -if (ret <0 ) +if (ret <0 ) { +kobject_put (&di->fg_kobject);dev_err (di->dev,"failed to create sysfs entry\n" ); + }return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 542/1126 HID: i2c-hid: fix GET/SET_REPORT for unnumbered reports
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit a5e5e03e94764148a01757b2fa4737d3445c13a6 ]
Internally kernel prepends all report buffers, for both numbered and unnumbered reports, with report ID, therefore to properly handle unnumbered reports we should prepend it ourselves.
For the same reason we should skip the first byte of the buffer when calling i2c_hid_set_or_send_report() which then will take care of properly formatting the transfer buffer based on its separate report ID argument along with report payload.
--- drivers/hid/i2c-hid/i2c-hid-core.c | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
drivers/hid/i2c-hid/i2c-hid-core.c +24 -8
@@ -618,6 +618,17 @@ static int i2c_hid_get_raw_report(struct hid_device *hid,if (report_type ==HID_OUTPUT_REPORT )return -EINVAL ; +/* +* In case of unnumbered reports the response from the device will +* not have the report ID that the upper layers expect, so we need +* to stash it the buffer ourselves and adjust the data size. +*/ +if (!report_number) { + buf[0 ] =0 ; + buf++; + count--; + } +/* +2 bytes to include the size of the reply in the query buffer */ ask_count =min (count +2 , (size_t )ihid->bufsize);
@@ -639,6 +650,9 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, count =min (count, ret_count -2 );memcpy (buf, ihid->rawbuf +2 , count); +if (!report_number) + count++; +return count; }
@@ -655,17 +669,19 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,mutex_lock (&ihid->reset_lock); -if (report_id) { - buf++; - count--; - } - +/* +* Note that both numbered and unnumbered reports passed here +* are supposed to have report ID stored in the 1st byte of the +* buffer, so we strip it off unconditionally before passing payload +* to i2c_hid_set_or_send_report which takes care of encoding +* everything properly. +*/ ret =i2c_hid_set_or_send_report (client, report_type ==HID_FEATURE_REPORT ?0x03 :0x02 , - report_id, buf, count, use_data); + report_id, buf +1 , count -1 , use_data); -if (report_id && ret >=0 ) - ret++;/* add report_id to the number of transfered bytes */ +if (ret >=0 ) + ret++;/* add report_id to the number of transferred bytes */ mutex_unlock (&ihid->reset_lock);
Signature · 1 line
2.34.1