5.10.214-rc1 review
Subsystems (4)
Sasha Levin
maintainerPATCH 148/238 ASoC: meson: Use dev_err_probe() helper
In reply to Sasha LevinFrom: Kuninori Morimoto <[email protected]>
[ Upstream commit 2ff4e003e8e105fb65c682c876a5cb0e00f854bf ]
Use the dev_err_probe() helper, instead of open-coding the same operation.
Stable-dep-of: 98ac85a00f31 ("ASoC: meson: aiu: fix function pointer type mismatch")
--- sound/soc/meson/aiu.c | 36 +++++++-------------- sound/soc/meson/axg-fifo.c | 16 +++------ sound/soc/meson/axg-pdm.c | 25 ++++----------- sound/soc/meson/axg-spdifin.c | 17 +++------- sound/soc/meson/axg-spdifout.c | 17 +++------- sound/soc/meson/axg-tdm-formatter.c | 50 ++++++++--------------------- sound/soc/meson/axg-tdm-interface.c | 25 ++++----------- sound/soc/meson/meson-card-utils.c | 8 ++--- sound/soc/meson/t9015.c | 14 +++----- 9 files changed, 56 insertions(+), 152 deletions(-)
sound/soc/meson/aiu.c +11 -25
@@ -218,34 +218,23 @@ static int aiu_clk_get(struct device *dev)int ret; aiu->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (aiu->pclk)) { -if (PTR_ERR (aiu->pclk) != -EPROBE_DEFER ) -dev_err (dev,"Can't get the aiu pclk\n" ); -return PTR_ERR (aiu->pclk); - } +if (IS_ERR (aiu->pclk)) +return dev_err_probe (dev,PTR_ERR (aiu->pclk),"Can't get the aiu pclk\n" ); aiu->spdif_mclk =devm_clk_get (dev,"spdif_mclk" ); -if (IS_ERR (aiu->spdif_mclk)) { -if (PTR_ERR (aiu->spdif_mclk) != -EPROBE_DEFER ) -dev_err (dev,"Can't get the aiu spdif master clock\n" ); -return PTR_ERR (aiu->spdif_mclk); - } +if (IS_ERR (aiu->spdif_mclk)) +return dev_err_probe (dev,PTR_ERR (aiu->spdif_mclk), +"Can't get the aiu spdif master clock\n" ); ret =aiu_clk_bulk_get (dev, aiu_i2s_ids,ARRAY_SIZE (aiu_i2s_ids), &aiu->i2s); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Can't get the i2s clocks\n" ); -return ret; - } +if (ret) +return dev_err_probe (dev, ret,"Can't get the i2s clocks\n" ); ret =aiu_clk_bulk_get (dev, aiu_spdif_ids,ARRAY_SIZE (aiu_spdif_ids), &aiu->spdif); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Can't get the spdif clocks\n" ); -return ret; - } +if (ret) +return dev_err_probe (dev, ret,"Can't get the spdif clocks\n" ); ret =clk_prepare_enable (aiu->pclk);if (ret) {
@@ -281,11 +270,8 @@ static int aiu_probe(struct platform_device *pdev)platform_set_drvdata (pdev, aiu); ret =device_reset (dev); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"Failed to reset device\n" ); -return ret; - } +if (ret) +return dev_err_probe (dev, ret,"Failed to reset device\n" ); regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (regs))
sound/soc/meson/axg-fifo.c +4 -12
@@ -350,20 +350,12 @@ int axg_fifo_probe(struct platform_device *pdev) } fifo->pclk =devm_clk_get (dev,NULL ); -if (IS_ERR (fifo->pclk)) { -if (PTR_ERR (fifo->pclk) != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %ld\n" , -PTR_ERR (fifo->pclk)); -return PTR_ERR (fifo->pclk); - } +if (IS_ERR (fifo->pclk)) +return dev_err_probe (dev,PTR_ERR (fifo->pclk),"failed to get pclk\n" ); fifo->arb =devm_reset_control_get_exclusive (dev,NULL ); -if (IS_ERR (fifo->arb)) { -if (PTR_ERR (fifo->arb) != -EPROBE_DEFER ) -dev_err (dev,"failed to get arb reset: %ld\n" , -PTR_ERR (fifo->arb)); -return PTR_ERR (fifo->arb); - } +if (IS_ERR (fifo->arb)) +return dev_err_probe (dev,PTR_ERR (fifo->arb),"failed to get arb reset\n" ); fifo->irq =of_irq_get (dev->of_node,0 );if (fifo->irq <=0 ) {
sound/soc/meson/axg-pdm.c +6 -19
@@ -586,7 +586,6 @@ static int axg_pdm_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct axg_pdm *priv;void __iomem *regs; -int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -611,28 +610,16 @@ static int axg_pdm_probe(struct platform_device *pdev) } priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) { - ret =PTR_ERR (priv->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->pclk)) +return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get pclk\n" ); priv->dclk =devm_clk_get (dev,"dclk" ); -if (IS_ERR (priv->dclk)) { - ret =PTR_ERR (priv->dclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get dclk: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->dclk)) +return dev_err_probe (dev,PTR_ERR (priv->dclk),"failed to get dclk\n" ); priv->sysclk =devm_clk_get (dev,"sysclk" ); -if (IS_ERR (priv->sysclk)) { - ret =PTR_ERR (priv->sysclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get dclk: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->sysclk)) +return dev_err_probe (dev,PTR_ERR (priv->sysclk),"failed to get dclk\n" );return devm_snd_soc_register_component (dev, &axg_pdm_component_drv, &axg_pdm_dai_drv,1 );
sound/soc/meson/axg-spdifin.c +4 -13
@@ -439,7 +439,6 @@ static int axg_spdifin_probe(struct platform_device *pdev)struct axg_spdifin *priv;struct snd_soc_dai_driver *dai_drv;void __iomem *regs; -int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -464,20 +463,12 @@ static int axg_spdifin_probe(struct platform_device *pdev) } priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) { - ret =PTR_ERR (priv->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->pclk)) +return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get pclk\n" ); priv->refclk =devm_clk_get (dev,"refclk" ); -if (IS_ERR (priv->refclk)) { - ret =PTR_ERR (priv->refclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get mclk: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->refclk)) +return dev_err_probe (dev,PTR_ERR (priv->refclk),"failed to get mclk\n" ); dai_drv =axg_spdifin_get_dai_drv (dev, priv);if (IS_ERR (dai_drv)) {
sound/soc/meson/axg-spdifout.c +4 -13
@@ -403,7 +403,6 @@ static int axg_spdifout_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct axg_spdifout *priv;void __iomem *regs; -int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -422,20 +421,12 @@ static int axg_spdifout_probe(struct platform_device *pdev) } priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) { - ret =PTR_ERR (priv->pclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get pclk: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->pclk)) +return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get pclk\n" ); priv->mclk =devm_clk_get (dev,"mclk" ); -if (IS_ERR (priv->mclk)) { - ret =PTR_ERR (priv->mclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get mclk: %d\n" , ret); -return ret; - } +if (IS_ERR (priv->mclk)) +return dev_err_probe (dev,PTR_ERR (priv->mclk),"failed to get mclk\n" );return devm_snd_soc_register_component (dev, &axg_spdifout_component_drv, axg_spdifout_dai_drv,ARRAY_SIZE (axg_spdifout_dai_drv));
sound/soc/meson/axg-tdm-formatter.c +13 -37
77 lines not on this page · raw message
sound/soc/meson/axg-tdm-interface.c +7 -18
@@ -517,21 +517,13 @@ static int axg_tdm_iface_probe(struct platform_device *pdev)/* Bit clock provided on the pad */ iface->sclk =devm_clk_get (dev,"sclk" ); -if (IS_ERR (iface->sclk)) { - ret =PTR_ERR (iface->sclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get sclk: %d\n" , ret); -return ret; - } +if (IS_ERR (iface->sclk)) +return dev_err_probe (dev,PTR_ERR (iface->sclk),"failed to get sclk\n" );/* Sample clock provided on the pad */ iface->lrclk =devm_clk_get (dev,"lrclk" ); -if (IS_ERR (iface->lrclk)) { - ret =PTR_ERR (iface->lrclk); -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get lrclk: %d\n" , ret); -return ret; - } +if (IS_ERR (iface->lrclk)) +return dev_err_probe (dev,PTR_ERR (iface->lrclk),"failed to get lrclk\n" );/* * mclk maybe be missing when the cpu dai is in slave mode and
@@ -542,13 +534,10 @@ static int axg_tdm_iface_probe(struct platform_device *pdev) iface->mclk =devm_clk_get (dev,"mclk" );if (IS_ERR (iface->mclk)) { ret =PTR_ERR (iface->mclk); -if (ret == -ENOENT ) { +if (ret == -ENOENT ) iface->mclk =NULL ; - }else { -if (ret != -EPROBE_DEFER ) -dev_err (dev,"failed to get mclk: %d\n" , ret); -return ret; - } +else +return dev_err_probe (dev, ret,"failed to get mclk\n" ); } return devm_snd_soc_register_component(dev,
sound/soc/meson/meson-card-utils.c +3 -5
@@ -85,11 +85,9 @@ int meson_card_parse_dai(struct snd_soc_card *card, ret =of_parse_phandle_with_args (node,"sound-dai" ,"#sound-dai-cells" ,0 , &args); -if (ret) { -if (ret != -EPROBE_DEFER ) -dev_err (card->dev,"can't parse dai %d\n" , ret); -return ret; - } +if (ret) +return dev_err_probe (card->dev, ret,"can't parse dai\n" ); + *dai_of_node = args.np;return snd_soc_get_dai_name (&args, dai_name);
sound/soc/meson/t9015.c +4 -10
@@ -258,18 +258,12 @@ static int t9015_probe(struct platform_device *pdev)platform_set_drvdata (pdev, priv); priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) { -if (PTR_ERR (priv->pclk) != -EPROBE_DEFER ) -dev_err (dev,"failed to get core clock\n" ); -return PTR_ERR (priv->pclk); - } +if (IS_ERR (priv->pclk)) +return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get core clock\n" ); priv->avdd =devm_regulator_get (dev,"AVDD" ); -if (IS_ERR (priv->avdd)) { -if (PTR_ERR (priv->avdd) != -EPROBE_DEFER ) -dev_err (dev,"failed to AVDD\n" ); -return PTR_ERR (priv->avdd); - } +if (IS_ERR (priv->avdd)) +return dev_err_probe (dev,PTR_ERR (priv->avdd),"failed to AVDD\n" ); ret =clk_prepare_enable (priv->pclk);if (ret) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 149/238 ASoC: meson: aiu: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 98ac85a00f31d2e9d5452b825a9ed0153d934043 ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/aiu.c:243:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
243 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/aiu.c | 19 ++++--------------- sound/soc/meson/aiu.h | 1 - 2 files changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/aiu.c +4 -15
@@ -215,11 +215,12 @@ static const char * const aiu_spdif_ids[] = {static int aiu_clk_get (struct device *dev) {struct aiu *aiu =dev_get_drvdata (dev); +struct clk *pclk;int ret; - aiu->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (aiu->pclk)) -return dev_err_probe (dev,PTR_ERR (aiu->pclk),"Can't get the aiu pclk\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"Can't get the aiu pclk\n" ); aiu->spdif_mclk =devm_clk_get (dev,"spdif_mclk" );if (IS_ERR (aiu->spdif_mclk))
@@ -236,18 +237,6 @@ static int aiu_clk_get(struct device *dev)if (ret)return dev_err_probe (dev, ret,"Can't get the spdif clocks\n" ); - ret =clk_prepare_enable (aiu->pclk); -if (ret) { -dev_err (dev,"peripheral clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - aiu->pclk); -if (ret) -dev_err (dev,"failed to add reset action on pclk" ); -return ret; }
sound/soc/meson/aiu.h +0 -1
@@ -33,7 +33,6 @@ struct aiu_platform_data { };struct aiu { -struct clk *pclk;struct clk *spdif_mclk;struct aiu_interface i2s;struct aiu_interface spdif;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 150/238 ASoC: meson: t9015: fix function pointer type mismatch
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 5ad992c71b6a8e8a547954addc7af9fbde6ca10a ]
clang-16 warns about casting functions to incompatible types, as is done here to call clk_disable_unprepare:
sound/soc/meson/t9015.c:274:4: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
274 | (void(*)(void *))clk_disable_unprepare,
The pattern of getting, enabling and setting a disable callback for a clock can be replaced with devm_clk_get_enabled(), which also fixes this warning.
--- sound/soc/meson/t9015.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
sound/soc/meson/t9015.c +4 -16
@@ -48,7 +48,6 @@#define POWER_CFG 0x10struct t9015 { -struct clk *pclk;struct regulator *avdd; };
@@ -250,6 +249,7 @@ static int t9015_probe(struct platform_device *pdev)struct t9015 *priv;void __iomem *regs;struct regmap *regmap; +struct clk *pclk;int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );
@@ -257,26 +257,14 @@ static int t9015_probe(struct platform_device *pdev)return -ENOMEM ;platform_set_drvdata (pdev, priv); - priv->pclk =devm_clk_get (dev,"pclk" ); -if (IS_ERR (priv->pclk)) -return dev_err_probe (dev,PTR_ERR (priv->pclk),"failed to get core clock\n" ); + pclk =devm_clk_get_enabled (dev,"pclk" ); +if (IS_ERR (pclk)) +return dev_err_probe (dev,PTR_ERR (pclk),"failed to get core clock\n" ); priv->avdd =devm_regulator_get (dev,"AVDD" );if (IS_ERR (priv->avdd))return dev_err_probe (dev,PTR_ERR (priv->avdd),"failed to AVDD\n" ); - ret =clk_prepare_enable (priv->pclk); -if (ret) { -dev_err (dev,"core clock enable failed\n" ); -return ret; - } - - ret =devm_add_action_or_reset (dev, - (void (*)(void *))clk_disable_unprepare, - priv->pclk); -if (ret) -return ret; - ret =device_reset (dev);if (ret) {dev_err (dev,"reset failed\n" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 151/238 media: sun8i-di: Fix coefficient writes
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 794b581f8c6eb7b60fe468ccb96dd3cd38ff779f ]
Currently coefficients are applied only once, since they don't change. However, this is done before enable bit is set and thus it doesn't get applied properly.
Fix that by applying coefficients after enable bit is set. While this means that it will be done evey time, it doesn't bring much time penalty.
--- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +21 -21
@@ -66,6 +66,7 @@ static void deinterlace_device_run(void *priv)struct vb2_v4l2_buffer *src, *dst;unsigned int hstep, vstep;dma_addr_t addr; +int i; src =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); dst =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx);
@@ -160,6 +161,26 @@ static void deinterlace_device_run(void *priv)deinterlace_write (dev,DEINTERLACE_CH1_HORZ_FACT , hstep);deinterlace_write (dev,DEINTERLACE_CH1_VERT_FACT , vstep); +/* neutral filter coefficients */ +deinterlace_set_bits (dev,DEINTERLACE_FRM_CTRL , +DEINTERLACE_FRM_CTRL_COEF_ACCESS ); +readl_poll_timeout (dev->base +DEINTERLACE_STATUS , val, + val &DEINTERLACE_STATUS_COEF_STATUS ,2 ,40 ); + +for (i =0 ; i <32 ; i++) { +deinterlace_write (dev,DEINTERLACE_CH0_HORZ_COEF0 + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH0_VERT_COEF + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH1_HORZ_COEF0 + i *4 , +DEINTERLACE_IDENTITY_COEF ); +deinterlace_write (dev,DEINTERLACE_CH1_VERT_COEF + i *4 , +DEINTERLACE_IDENTITY_COEF ); + } + +deinterlace_clr_set_bits (dev,DEINTERLACE_FRM_CTRL , +DEINTERLACE_FRM_CTRL_COEF_ACCESS ,0 ); +deinterlace_clr_set_bits (dev,DEINTERLACE_FIELD_CTRL ,DEINTERLACE_FIELD_CTRL_FIELD_CNT_MSK ,DEINTERLACE_FIELD_CTRL_FIELD_CNT (ctx->field));
@@ -248,7 +269,6 @@ static irqreturn_t deinterlace_irq(int irq, void *data)static void deinterlace_init (struct deinterlace_dev *dev) {u32 val; -int i;deinterlace_write (dev,DEINTERLACE_BYPASS ,DEINTERLACE_BYPASS_CSC );
@@ -285,26 +305,6 @@ static void deinterlace_init(struct deinterlace_dev *dev)deinterlace_clr_set_bits (dev,DEINTERLACE_CHROMA_DIFF ,DEINTERLACE_CHROMA_DIFF_TH_MSK ,DEINTERLACE_CHROMA_DIFF_TH (5 )); - -/* neutral filter coefficients */ -deinterlace_set_bits (dev,DEINTERLACE_FRM_CTRL , -DEINTERLACE_FRM_CTRL_COEF_ACCESS ); -readl_poll_timeout (dev->base +DEINTERLACE_STATUS , val, - val &DEINTERLACE_STATUS_COEF_STATUS ,2 ,40 ); - -for (i =0 ; i <32 ; i++) { -deinterlace_write (dev,DEINTERLACE_CH0_HORZ_COEF0 + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH0_VERT_COEF + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH1_HORZ_COEF0 + i *4 , -DEINTERLACE_IDENTITY_COEF ); -deinterlace_write (dev,DEINTERLACE_CH1_VERT_COEF + i *4 , -DEINTERLACE_IDENTITY_COEF ); - } - -deinterlace_clr_set_bits (dev,DEINTERLACE_FRM_CTRL , -DEINTERLACE_FRM_CTRL_COEF_ACCESS ,0 ); }static inline struct deinterlace_ctx *deinterlace_file2ctx (struct file *file)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 152/238 media: sun8i-di: Fix power on/off sequences
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit cff104e33bad38f4b2c8d58816a7accfaa2879f9 ]
According to user manual, reset line should be deasserted before clocks are enabled. Also fix power down sequence to be reverse of that.
--- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +13 -12
@@ -937,11 +937,18 @@ static int deinterlace_runtime_resume(struct device *device)return ret; } + ret =reset_control_deassert (dev->rstc); +if (ret) { +dev_err (dev->dev,"Failed to apply reset\n" ); + + goto err_exclusive_rate; + } + ret =clk_prepare_enable (dev->bus_clk);if (ret) {dev_err (dev->dev,"Failed to enable bus clock\n" ); - goto err_exclusive_rate; + goto err_rst; } ret =clk_prepare_enable (dev->mod_clk);
@@ -958,23 +965,16 @@ static int deinterlace_runtime_resume(struct device *device) goto err_mod_clk; } - ret =reset_control_deassert (dev->rstc); -if (ret) { -dev_err (dev->dev,"Failed to apply reset\n" ); - - goto err_ram_clk; - } -deinterlace_init (dev);return 0 ; -err_ram_clk: -clk_disable_unprepare (dev->ram_clk); err_mod_clk:clk_disable_unprepare (dev->mod_clk); err_bus_clk:clk_disable_unprepare (dev->bus_clk); +err_rst: +reset_control_assert (dev->rstc); err_exclusive_rate:clk_rate_exclusive_put (dev->mod_clk);
@@ -985,11 +985,12 @@ static int deinterlace_runtime_suspend(struct device *device) {struct deinterlace_dev *dev =dev_get_drvdata (device); -reset_control_assert (dev->rstc); -clk_disable_unprepare (dev->ram_clk);clk_disable_unprepare (dev->mod_clk);clk_disable_unprepare (dev->bus_clk); + +reset_control_assert (dev->rstc); +clk_rate_exclusive_put (dev->mod_clk);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 153/238 media: sun8i-di: Fix chroma difference threshold
In reply to Sasha LevinFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 856525e8db272b0ce6d9c6e6c2eeb97892b485a6 ]
While there is no good explanation what this value does, vendor driver uses value 31 for it. Align driver with it.
--- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +1 -1
@@ -304,7 +304,7 @@ static void deinterlace_init(struct deinterlace_dev *dev)deinterlace_clr_set_bits (dev,DEINTERLACE_CHROMA_DIFF ,DEINTERLACE_CHROMA_DIFF_TH_MSK , -DEINTERLACE_CHROMA_DIFF_TH (5 )); +DEINTERLACE_CHROMA_DIFF_TH (31 )); }static inline struct deinterlace_ctx *deinterlace_file2ctx (struct file *file)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 154/238 media: imx: csc/scaler: fix v4l2_ctrl_handler memory leak
In reply to Sasha LevinFrom: Lucas Stach <[email protected]>
[ Upstream commit 4797a3dd46f220e6d83daf54d70c5b33db6deb01 ]
Free the memory allocated in v4l2_ctrl_handler_init on release.
--- drivers/staging/media/imx/imx-media-csc-scaler.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/imx/imx-media-csc-scaler.c +1 -0
@@ -803,6 +803,7 @@ static int ipu_csc_scaler_release(struct file *file)dev_dbg (priv->dev,"Releasing instance %p\n" , ctx); +v4l2_ctrl_handler_free (&ctx->ctrl_hdlr);v4l2_m2m_ctx_release (ctx->fh.m2m_ctx);v4l2_fh_del (&ctx->fh);v4l2_fh_exit (&ctx->fh);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 155/238 media: go7007: add check of return value of go7007_read_addr()
In reply to Sasha LevinFrom: Daniil Dulov <[email protected]>
[ Upstream commit 0b70530ee740861f4776ff724fcc25023df1799a ]
If go7007_read_addr() returns error channel is not assigned a value. In this case go to allocfail.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/usb/go7007/go7007-usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/go7007/go7007-usb.c +3 -1
@@ -1201,7 +1201,9 @@ static int go7007_usb_probe(struct usb_interface *intf,u16 channel;/* read channel number from GPIO[1:0] */ -go7007_read_addr (go,0x3c81 , &channel); +if (go7007_read_addr (go,0x3c81 , &channel)) + goto allocfail; + channel &=0x3 ; go->board_id =GO7007_BOARDID_ADLINK_MPG24 ; usb->board = board = &board_adlink_mpg24;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 156/238 media: pvrusb2: remove redundant NULL check
In reply to Sasha LevinFrom: Daniil Dulov <[email protected]>
[ Upstream commit 95ac1210fb2753f968ebce0730d4fbc553c2a3dc ]
Pointer dip->stream cannot be NULL due to a shift, thus remove redundant NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +0 -5
@@ -1202,11 +1202,6 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, dip->minor_type = pvr2_v4l_type_video; nr_ptr = video_nr; caps |=V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_AUDIO ; -if (!dip->stream) { -pr_err (KBUILD_MODNAME -": Failed to set up pvrusb2 v4l video dev due to missing stream instance\n" ); -return ; - }break ;case VFL_TYPE_VBI : dip->config = pvr2_config_vbi;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 157/238 media: pvrusb2: fix pvr2_stream_callback casts
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 30baa4a96b23add91a87305baaeba82c4e109e1f ]
clang-16 complains about a control flow integrity (KCFI) issue in pvrusb2, which casts three different prototypes into pvr2_stream_callback:
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c:1070:30: error: cast from 'void (*)(struct pvr2_v4l2_fh *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1070 | pvr2_stream_set_callback(sp,(pvr2_stream_callback)pvr2_v4l2_notify,fh);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-context.c:110:6: error: cast from 'void (*)(struct pvr2_context *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
110 | (void (*)(void *))pvr2_context_notify,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/usb/pvrusb2/pvrusb2-dvb.c:152:6: error: cast from 'void (*)(struct pvr2_dvb_adapter *)' to 'pvr2_stream_callback' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
152 | (pvr2_stream_callback) pvr2_dvb_notify, adap);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Change the functions to actually take a void* argument so the cast is no longer needed.
--- drivers/media/usb/pvrusb2/pvrusb2-context.c | 8 ++++---- drivers/media/usb/pvrusb2/pvrusb2-dvb.c | 6 ++++-- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-context.c +4 -4
@@ -90,8 +90,10 @@ static void pvr2_context_destroy(struct pvr2_context *mp) } -static void pvr2_context_notify (struct pvr2_context *mp) +static void pvr2_context_notify (void *ptr) { +struct pvr2_context *mp = ptr; +pvr2_context_set_notify (mp,!0 ); }
@@ -106,9 +108,7 @@ static void pvr2_context_check(struct pvr2_context *mp)pvr2_trace (PVR2_TRACE_CTXT ,"pvr2_context %p (initialize)" , mp);/* Finish hardware initialization */ -if (pvr2_hdw_initialize (mp->hdw, - (void (*)(void *))pvr2_context_notify, - mp)) { +if (pvr2_hdw_initialize (mp->hdw, pvr2_context_notify, mp)) { mp->video_stream.stream =pvr2_hdw_get_video_stream (mp->hdw);/* Trigger interface initialization. By doing this
drivers/media/usb/pvrusb2/pvrusb2-dvb.c +4 -2
@@ -88,8 +88,10 @@ static int pvr2_dvb_feed_thread(void *data)return stat; } -static void pvr2_dvb_notify (struct pvr2_dvb_adapter *adap) +static void pvr2_dvb_notify (void *ptr) { +struct pvr2_dvb_adapter *adap = ptr; +wake_up (&adap->buffer_wait_data); }
@@ -149,7 +151,7 @@ static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap) }pvr2_stream_set_callback (pvr->video_stream.stream, - (pvr2_stream_callback ) pvr2_dvb_notify, adap); + pvr2_dvb_notify, adap); ret =pvr2_stream_set_buffer_count (stream,PVR2_DVB_BUFFER_COUNT );if (ret <0 )return ret;
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +4 -2
@@ -1037,8 +1037,10 @@ static int pvr2_v4l2_open(struct file *file) } -static void pvr2_v4l2_notify (struct pvr2_v4l2_fh *fhp) +static void pvr2_v4l2_notify (void *ptr) { +struct pvr2_v4l2_fh *fhp = ptr; +wake_up (&fhp->wait_data); }
@@ -1071,7 +1073,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh) hdw = fh->channel.mc_head->hdw; sp = fh->pdi->stream->stream; -pvr2_stream_set_callback (sp,(pvr2_stream_callback )pvr2_v4l2_notify,fh); +pvr2_stream_set_callback (sp, pvr2_v4l2_notify, fh);pvr2_hdw_set_stream_type (hdw,fh->pdi->config);if ((ret =pvr2_hdw_set_streaming (hdw,!0 )) <0 )return ret;return pvr2_ioread_set_enabled (fh->rhp,!0 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 158/238 clk: qcom: dispcc-sdm845: Adjust internal GDSC wait times
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 117e7dc697c2739d754db8fe0c1e2d4f1f5d5f82 ]
SDM845 downstream uses non-default values for GDSC internal waits. Program them accordingly to avoid surprises.
--- drivers/clk/qcom/dispcc-sdm845.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/qcom/dispcc-sdm845.c +2 -0
@@ -768,6 +768,8 @@ static struct clk_branch disp_cc_mdss_vsync_clk = {static struct gdsc mdss_gdsc = { .gdscr =0x3000 , + .en_few_wait_val =0x6 , + .en_rest_wait_val =0x5 , .pd = { .name ="mdss_gdsc" , },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 159/238 drm/mediatek: dsi: Fix DSI RGB666 formats and definitions
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit fae6f815505301b92d9113764f4d76d0bfe45607 ]
The register bits definitions for RGB666 formats are wrong in multiple
ways: first, in the DSI_PS_SEL bits region, the Packed 18-bits RGB666 format is selected with bit 1, while the Loosely Packed one is bit 2, and second - the definition name "LOOSELY_PS_18BIT_RGB666" is wrong because the loosely packed format is 24 bits instead!
Either way, functions mtk_dsi_ps_control_vact() and mtk_dsi_ps_control() do not even agree on the DSI_PS_SEL bit to set in DSI_PSCTRL: one sets loosely packed (24) on RGB666, the other sets packed (18), and the other way around for RGB666_PACKED.
Fixing this entire stack of issues is done in one go:
- Use the correct bit for the Loosely Packed RGB666 definition
- Rename LOOSELY_PS_18BIT_RGB666 to LOOSELY_PS_24BIT_RGB666
- Change ps_bpp_mode in mtk_dsi_ps_control_vact() to set:
- Loosely Packed, 24-bits for MIPI_DSI_FMT_RGB666
- Packed, 18-bits for MIPI_DSI_FMT_RGB666_PACKED
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +5 -5
@@ -68,8 +68,8 @@#define DSI_PS_WC 0x3fff#define DSI_PS_SEL (3 << 16)#define PACKED_PS_16BIT_RGB565 (0 << 16) -#define LOOSELY_PS_18BIT_RGB666 (1 << 16) -#define PACKED_PS_18BIT_RGB666 (2 << 16) +#define PACKED_PS_18BIT_RGB666 (1 << 16) +#define LOOSELY_PS_24BIT_RGB666 (2 << 16)#define PACKED_PS_24BIT_RGB888 (3 << 16)#define DSI_VSA_NL 0x20
@@ -365,10 +365,10 @@ static void mtk_dsi_ps_control_vact(struct mtk_dsi *dsi) ps_bpp_mode |=PACKED_PS_24BIT_RGB888 ;break ;case MIPI_DSI_FMT_RGB666 : - ps_bpp_mode |=PACKED_PS_18BIT_RGB666 ; + ps_bpp_mode |=LOOSELY_PS_24BIT_RGB666 ;break ;case MIPI_DSI_FMT_RGB666_PACKED : - ps_bpp_mode |=LOOSELY_PS_18BIT_RGB666 ; + ps_bpp_mode |=PACKED_PS_18BIT_RGB666 ;break ;case MIPI_DSI_FMT_RGB565 : ps_bpp_mode |=PACKED_PS_16BIT_RGB565 ;
@@ -419,7 +419,7 @@ static void mtk_dsi_ps_control(struct mtk_dsi *dsi) dsi_tmp_buf_bpp =3 ;break ;case MIPI_DSI_FMT_RGB666 : - tmp_reg =LOOSELY_PS_18BIT_RGB666 ; + tmp_reg =LOOSELY_PS_24BIT_RGB666 ; dsi_tmp_buf_bpp =3 ;break ;case MIPI_DSI_FMT_RGB666_PACKED :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 160/238 PCI: Mark 3ware-9650SE Root Port Extended Tags as broken
In reply to Sasha LevinFrom: Jörg Wedekind <[email protected]>
[ Upstream commit baf67aefbe7d7deafa59ca49612d163f8889934c ]
Per PCIe r6.1, sec 2.2.6.2 and 7.5.3.4, a Requester may not use 8-bit Tags unless its Extended Tag Field Enable is set, but all Receivers/Completers must handle 8-bit Tags correctly regardless of their Extended Tag Field Enable.
Some devices do not handle 8-bit Tags as Completers, so add a quirk for them. If we find such a device, we disable Extended Tags for the entire hierarchy to make peer-to-peer DMA possible.
The 3ware 9650SE seems to have issues with handling 8-bit tags. Mark it as broken.
This fixes PCI Parity Errors like :
3w-9xxx: scsi0: ERROR: (0x06:0x000C): PCI Parity Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000D): PCI Abort: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x000E): Controller Queue Error: clearing. 3w-9xxx: scsi0: ERROR: (0x06:0x0010): Microcontroller Error: clearing.
--- drivers/pci/quirks.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/quirks.c +1 -0
@@ -5364,6 +5364,7 @@ static void quirk_no_ext_tags(struct pci_dev *pdev)pci_walk_bus (bridge->bus, pci_configure_extended_tags,NULL ); } +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_3WARE ,0x1004 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0132 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0140 , quirk_no_ext_tags);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_SERVERWORKS ,0x0141 , quirk_no_ext_tags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 161/238 clk: hisilicon: hi3519: Release the correct number of gates in hi3519_clk_unregister()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 74e39f526d95c0c119ada1874871ee328c59fbee ]
The gates are stored in 'hi3519_gate_clks', not 'hi3519_mux_clks'. This is also in line with how hisi_clk_register_gate() is called in the probe.
--- drivers/clk/hisilicon/clk-hi3519.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/hisilicon/clk-hi3519.c +1 -1
@@ -130,7 +130,7 @@ static void hi3519_clk_unregister(struct platform_device *pdev)of_clk_del_provider (pdev->dev.of_node);hisi_clk_unregister_gate (hi3519_gate_clks, -ARRAY_SIZE (hi3519_mux_clks), +ARRAY_SIZE (hi3519_gate_clks), crg->clk_data); hisi_clk_unregister_mux(hi3519_mux_clks, ARRAY_SIZE(hi3519_mux_clks),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 162/238 drm/tegra: put drm_gem_object ref on error in tegra_fb_create
In reply to Sasha LevinFrom: Fedor Pchelkin <[email protected]>
[ Upstream commit 32e5a120a5105bce01561978ee55aee8e40ac0dc ]
Inside tegra_fb_create(), drm_gem_object_lookup() increments ref count of the found object. But if the following size check fails then the last found object's ref count should be put there as the unreferencing loop can't detect this situation.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/gpu/drm/tegra/fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/fb.c +1 -0
@@ -155,6 +155,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,if (gem->size < size) { err = -EINVAL ; +drm_gem_object_put (gem); goto unreference; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 163/238 mfd: syscon: Call of_node_put() only when of_parse_phandle() takes a ref
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit d2b0680cf3b05490b579e71b0df6e07451977745 ]
of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node.
--- drivers/mfd/syscon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/syscon.c +3 -1
@@ -224,7 +224,9 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,return ERR_PTR (-ENODEV ); regmap =syscon_node_to_regmap (syscon_np); -of_node_put (syscon_np); + +if (property) +of_node_put (syscon_np);return regmap; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 164/238 mfd: altera-sysmgr: Call of_node_put() only when of_parse_phandle() takes a ref
In reply to Sasha LevinFrom: Peter Griffin <[email protected]>
[ Upstream commit e28c28a34ee9fa2ea671a20e5e7064e6220d55e7 ]
of_parse_phandle() returns a device_node with refcount incremented, which the callee needs to call of_node_put() on when done. We should only call of_node_put() when the property argument is provided though as otherwise nothing has taken a reference on the node.
--- drivers/mfd/altera-sysmgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/altera-sysmgr.c +3 -1
@@ -110,7 +110,9 @@ struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np, dev =driver_find_device_by_of_node (&altr_sysmgr_driver.driver, (void *)sysmgr_np); -of_node_put (sysmgr_np); +if (property) +of_node_put (sysmgr_np); +if (!dev)return ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 165/238 crypto: arm/sha - fix function cast warnings
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 53cc9baeb9bc2a187eb9c9790d30995148852b12 ]
clang-16 warns about casting between incompatible function types:
arch/arm/crypto/sha256_glue.c:37:5: error: cast from 'void (*)(u32 *, const void *, unsigned int)' (aka 'void (*)(unsigned int *, const void *, unsigned int)') to 'sha256_block_fn *' (aka 'void (*)(struct sha256_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
37 | (sha256_block_fn *)sha256_block_data_order);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/arm/crypto/sha512-glue.c:34:3: error: cast from 'void (*)(u64 *, const u8 *, int)' (aka 'void (*)(unsigned long long *, const unsigned char *, int)') to 'sha512_block_fn *' (aka 'void (*)(struct sha512_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
34 | (sha512_block_fn *)sha512_block_data_order);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Fix the prototypes for the assembler functions to match the typedef. The code already relies on the digest being the first part of the state structure, so there is no change in behavior.
--- arch/arm/crypto/sha256_glue.c | 13 +++++-------- arch/arm/crypto/sha512-glue.c | 12 +++++------- 2 files changed, 10 insertions(+), 15 deletions(-)
arch/arm/crypto/sha256_glue.c +5 -8
@@ -24,8 +24,8 @@#include "sha256_glue.h" -asmlinkage void sha256_block_data_order(u32 *digest, const void *data, -unsigned int num_blks); +asmlinkage void sha256_block_data_order(struct sha256_state *state, +const u8 *data,int num_blks);int crypto_sha256_arm_update (struct shash_desc *desc,const u8 *data,unsigned int len)
@@ -33,23 +33,20 @@ int crypto_sha256_arm_update(struct shash_desc *desc, const u8 *data,/* make sure casting to sha256_block_fn() is safe */ BUILD_BUG_ON (offsetof(struct sha256_state , state) !=0 ); -return sha256_base_do_update (desc, data, len, - (sha256_block_fn *)sha256_block_data_order); +return sha256_base_do_update (desc, data, len, sha256_block_data_order); }EXPORT_SYMBOL (crypto_sha256_arm_update);static int crypto_sha256_arm_final (struct shash_desc *desc,u8 *out) { -sha256_base_do_finalize (desc, - (sha256_block_fn *)sha256_block_data_order); +sha256_base_do_finalize (desc, sha256_block_data_order);return sha256_base_finish (desc, out); }int crypto_sha256_arm_finup (struct shash_desc *desc,const u8 *data,unsigned int len,u8 *out) { -sha256_base_do_update (desc, data, len, - (sha256_block_fn *)sha256_block_data_order); +sha256_base_do_update (desc, data, len, sha256_block_data_order);return crypto_sha256_arm_final (desc, out); }EXPORT_SYMBOL (crypto_sha256_arm_finup);
arch/arm/crypto/sha512-glue.c +5 -7
@@ -25,27 +25,25 @@ MODULE_ALIAS_CRYPTO("sha512");MODULE_ALIAS_CRYPTO ("sha384-arm" );MODULE_ALIAS_CRYPTO ("sha512-arm" ); -asmlinkage void sha512_block_data_order(u64 *state, u8 const *src, int blocks); +asmlinkage void sha512_block_data_order(struct sha512_state *state, +u8 const *src,int blocks);int sha512_arm_update (struct shash_desc *desc,const u8 *data,unsigned int len) { -return sha512_base_do_update (desc, data, len, - (sha512_block_fn *)sha512_block_data_order); +return sha512_base_do_update (desc, data, len, sha512_block_data_order); }static int sha512_arm_final (struct shash_desc *desc,u8 *out) { -sha512_base_do_finalize (desc, - (sha512_block_fn *)sha512_block_data_order); +sha512_base_do_finalize (desc, sha512_block_data_order);return sha512_base_finish (desc, out); }int sha512_arm_finup (struct shash_desc *desc,const u8 *data,unsigned int len,u8 *out) { -sha512_base_do_update (desc, data, len, - (sha512_block_fn *)sha512_block_data_order); +sha512_base_do_update (desc, data, len, sha512_block_data_order);return sha512_arm_final (desc, out); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 166/238 drm/tidss: Fix initial plane zpos values
In reply to Sasha LevinFrom: Tomi Valkeinen <[email protected]>
[ Upstream commit 3ec948ccb2c4b99e8fbfdd950adbe92ea577b395 ]
When the driver sets up the zpos property it sets the default zpos value to the HW id of the plane. That is fine as such, but as on many DSS versions the driver arranges the DRM planes in a different order than the HW planes (to keep the non-scalable planes first), this leads to odd initial zpos values. An example is J721e, where the initial zpos values for DRM planes are 1, 3, 0, 2.
In theory the userspace should configure the zpos values properly when using multiple planes, and in that sense the initial zpos values shouldn't matter, but there's really no reason not to fix this and help the userspace apps which don't handle zpos perfectly. In particular, some versions of Weston seem to have issues dealing with the planes with the current default zpos values.
So let's change the zpos values for the DRM planes to 0, 1, 2, 3.
Another option would be to configure the planes marked as primary planes to zpos 0. On a two display system this would give us plane zpos values of 0, 0, 1, 2. The end result and behavior would be very similar in this option, and I'm not aware that this would actually help us in any way. So, to keep the code simple, I opted for the 0, 1, 2, 3 values.
--- drivers/gpu/drm/tidss/tidss_plane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_plane.c +1 -1
@@ -202,7 +202,7 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,drm_plane_helper_add (&tplane->plane, &tidss_plane_helper_funcs); -drm_plane_create_zpos_property (&tplane->plane, hw_plane_id,0 , +drm_plane_create_zpos_property (&tplane->plane, tidss->num_planes,0 , num_planes -1 ); ret = drm_plane_create_color_properties(&tplane->plane,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 167/238 mtd: maps: physmap-core: fix flash size larger than 32-bit
In reply to Sasha LevinFrom: Baruch Siach <[email protected]>
[ Upstream commit 3884f03edd34887514a0865a80769cd5362d5c3b ]
mtd-ram can potentially be larger than 4GB. get_bitmask_order() uses fls() that is not guaranteed to work with values larger than 32-bit. Specifically on aarch64 fls() returns 0 when all 32 LSB bits are clear. Use fls64() instead.
--- drivers/mtd/maps/physmap-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/maps/physmap-core.c +1 -1
@@ -528,7 +528,7 @@ static int physmap_flash_probe(struct platform_device *dev)if (!info->maps[i].phys) info->maps[i].phys = res->start; - info->win_order =get_bitmask_order (resource_size (res)) -1 ; + info->win_order =fls64 (resource_size (res)) -1 ; info->maps[i].size =BIT (info->win_order + (info->gpios ? info->gpios->ndescs :0 ));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 168/238 mtd: rawnand: lpc32xx_mlc: fix irq handler prototype
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 347b828882e6334690e7003ce5e2fe5f233dc508 ]
clang-16 warns about mismatched function prototypes:
drivers/mtd/nand/raw/lpc32xx_mlc.c:783:29: error: cast from 'irqreturn_t (*)(int, struct lpc32xx_nand_host *)' (aka 'enum irqreturn (*)(int, struct lpc32xx_nand_host *)') to 'irq_handler_t' (aka 'enum irqreturn (*)(int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Change the interrupt handler to the normal way of just passing a void* pointer and converting it inside the function..
--- drivers/mtd/nand/raw/lpc32xx_mlc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/lpc32xx_mlc.c +3 -2
@@ -304,8 +304,9 @@ static int lpc32xx_nand_device_ready(struct nand_chip *nand_chip)return 0 ; } -static irqreturn_t lpc3xxx_nand_irq (int irq,struct lpc32xx_nand_host *host) +static irqreturn_t lpc3xxx_nand_irq (int irq,void *data) { +struct lpc32xx_nand_host *host = data;uint8_t sr;/* Clear interrupt flag by reading status */
@@ -780,7 +781,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) goto release_dma_chan; } -if (request_irq (host->irq, (irq_handler_t)&lpc3xxx_nand_irq, +if (request_irq (host->irq, &lpc3xxx_nand_irq,IRQF_TRIGGER_HIGH ,DRV_NAME , host)) {dev_err (&pdev->dev,"Error requesting NAND IRQ\n" ); res = -ENXIO ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 169/238 ASoC: meson: axg-tdm-interface: fix mclk setup without mclk-fs
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit e3741a8d28a1137f8b19ae6f3d6e3be69a454a0a ]
By default, when mclk-fs is not provided, the tdm-interface driver requests an MCLK that is 4x the bit clock, SCLK.
However there is no justification for this:
* If the codec needs MCLK for its operation, mclk-fs is expected to be set according to the codec requirements.
* If the codec does not need MCLK the minimum is 2 * SCLK, because this is minimum the divider between SCLK and MCLK can do.
Multiplying by 4 may cause problems because the PLL limit may be reached sooner than it should, so use 2x instead.
--- sound/soc/meson/axg-tdm-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/meson/axg-tdm-interface.c +2 -2
@@ -266,8 +266,8 @@ static int axg_tdm_iface_set_sclk(struct snd_soc_dai *dai, srate = iface->slots * iface->slot_width *params_rate (params);if (!iface->mclk_rate) { -/* If no specific mclk is requested, default to bit clock * 4 */ -clk_set_rate (iface->mclk,4 * srate); +/* If no specific mclk is requested, default to bit clock * 2 */ +clk_set_rate (iface->mclk,2 * srate); }else {/* Check if we can actually get the bit clock from mclk */ if (iface->mclk_rate % srate) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 170/238 ASoC: meson: axg-tdm-interface: add frame rate constraint
In reply to Sasha LevinFrom: Jerome Brunet <[email protected]>
[ Upstream commit 59c6a3a43b221cc2a211181b1298e43b2c2df782 ]
According to Amlogic datasheets for the SoCs supported by this driver, the maximum bit clock rate is 100MHz.
The tdm interface allows the rates listed by the DAI driver, regardless of the number slots or their width. However, these will impact the bit clock rate.
Hitting the 100MHz limit is very unlikely for most use cases but it is possible.
For example with 32 slots / 32 bits wide, the maximum rate is no longer 384kHz but ~96kHz.
Add the constraint accordingly if the component is not already active. If it is active, the rate is already constrained by the first stream rate.
--- sound/soc/meson/axg-tdm-interface.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
sound/soc/meson/axg-tdm-interface.c +18 -7
@@ -12,6 +12,9 @@#include "axg-tdm.h" +/* Maximum bit clock frequency according the datasheets */ +#define MAX_SCLK 100000000/* Hz */ +enum {TDM_IFACE_PAD ,TDM_IFACE_LOOPBACK ,
@@ -155,19 +158,27 @@ static int axg_tdm_iface_startup(struct snd_pcm_substream *substream,return -EINVAL ; } -/* Apply component wide rate symmetry */ if (snd_soc_component_active (dai->component)) { +/* Apply component wide rate symmetry */ ret =snd_pcm_hw_constraint_single (substream->runtime,SNDRV_PCM_HW_PARAM_RATE , iface->rate); -if (ret <0 ) { -dev_err (dai->dev, -"can't set iface rate constraint\n" ); -return ret; - } + + }else { +/* Limit rate according to the slot number and width */ +unsigned int max_rate = +MAX_SCLK / (iface->slots * iface->slot_width); + ret =snd_pcm_hw_constraint_minmax (substream->runtime, +SNDRV_PCM_HW_PARAM_RATE , +0 , max_rate); } -return 0 ; +if (ret <0 ) +dev_err (dai->dev,"can't set iface rate constraint\n" ); +else + ret =0 ; + +return ret; } static int axg_tdm_iface_set_stream(struct snd_pcm_substream *substream,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 171/238 drm/amdgpu: Fix missing break in ATOM_ARG_IMM Case of atom_get_src_int()
In reply to Sasha LevinFrom: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 7cf1ad2fe10634238b38442a851d89514cb14ea2 ]
Missing break statement in the ATOM_ARG_IMM case of a switch statement, adds the missing break statement, ensuring that the program's control flow is as intended.
Fixes the below:drivers/gpu/drm/amd/amdgpu/atom.c:323 atom_get_src_int() warn: ignoring unreachable code.
--- drivers/gpu/drm/amd/amdgpu/atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/atom.c +1 -1
@@ -310,7 +310,7 @@ static uint32_t atom_get_src_int(atom_exec_context *ctx, uint8_t attr,DEBUG ("IMM 0x%02X\n" , val);return val; } -return 0 ; +break ;case ATOM_ARG_PLL : idx =U8 (*ptr); (*ptr)++;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 172/238 media: pvrusb2: fix uaf in pvr2_context_set_notify
In reply to Sasha LevinFrom: Edward Adam Davis <[email protected]>
[ Upstream commit 0a0b79ea55de8514e1750884e5fec77f9fdd01ee ]
[Syzbot reported]
BUG: KASAN: slab-use-after-free in pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 Read of size 4 at addr ffff888113aeb0d8 by task kworker/1:1/26 CPU: 1 PID: 26 Comm: kworker/1:1 Not tainted 6.8.0-rc1-syzkaller-00046-gf1a27f081c1f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Workqueue: usb_hub_wq hub_event Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 pvr2_context_set_notify+0x2c4/0x310 drivers/media/usb/pvrusb2/pvrusb2-context.c:35 pvr2_context_notify drivers/media/usb/pvrusb2/pvrusb2-context.c:95 [inline] pvr2_context_disconnect+0x94/0xb0 drivers/media/usb/pvrusb2/pvrusb2-context.c:272 Freed by task 906: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:640 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x106/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x105/0x340 mm/slub.c:4409 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:137 [inline] pvr2_context_thread_func+0x69d/0x960 drivers/media/usb/pvrusb2/pvrusb2-context.c:158
[Analyze]
Task A set disconnect_flag = !0, which resulted in Task B's condition being met and releasing mp, leading to this issue.
[Fix]
Place the disconnect_flag assignment operation after all code in pvr2_context_disconnect() to avoid this issue.
--- drivers/media/usb/pvrusb2/pvrusb2-context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/pvrusb2/pvrusb2-context.c +1 -1
@@ -267,9 +267,9 @@ static void pvr2_context_exit(struct pvr2_context *mp)void pvr2_context_disconnect (struct pvr2_context *mp) {pvr2_hdw_disconnect (mp->hdw); - mp->disconnect_flag = !0 ;if (!pvr2_context_shutok ())pvr2_context_notify (mp); + mp->disconnect_flag = !0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 173/238 media: dvb-frontends: avoid stack overflow warnings with clang
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7a4cf27d1f0538f779bf31b8c99eda394e277119 ]
A previous patch worked around a KASAN issue in stv0367, now a similar problem showed up with clang:
drivers/media/dvb-frontends/stv0367.c:1222:12: error: stack frame size (3624) exceeds limit (2048) in 'stv0367ter_set_frontend' [-Werror,-Wframe-larger-than]
1214 | static int stv0367ter_set_frontend(struct dvb_frontend *fe)
Rework the stv0367_writereg() function to be simpler and mark both register access functions as noinline_for_stack so the temporary i2c_msg structures do not get duplicated on the stack when KASAN_STACK is enabled.
--- drivers/media/dvb-frontends/stv0367.c | 34 +++++++-------------------- 1 file changed, 8 insertions(+), 26 deletions(-)
drivers/media/dvb-frontends/stv0367.c +8 -26
@@ -118,50 +118,32 @@ static const s32 stv0367cab_RF_LookUp2[RF_LOOKUP_TABLE2_SIZE][RF_LOOKUP_TABLE2_S } }; -static -int stv0367_writeregs (struct stv0367_state *state,u16 reg,u8 *data,int len) +static noinline_for_stack +int stv0367_writereg(struct stv0367_state *state, u16 reg, u8 data) { -u8 buf[MAX_XFER_SIZE ]; +u8 buf[3 ] = {MSB (reg),LSB (reg), data };struct i2c_msg msg = { .addr = state->config->demod_address, .flags =0 , .buf = buf, - .len = len +2 + .len =3 , };int ret; -if (2 + len >sizeof (buf)) { -printk (KERN_WARNING -"%s: i2c wr reg=%04x: len=%d is too big!\n" , -KBUILD_MODNAME , reg, len); -return -EINVAL ; - } - - - buf[0 ] =MSB (reg); - buf[1 ] =LSB (reg); -memcpy (buf +2 , data, len); -if (i2cdebug)printk (KERN_DEBUG "%s: [%02x] %02x: %02x\n" , __func__, - state->config->demod_address, reg, buf[2 ]); + state->config->demod_address, reg, data); ret =i2c_transfer (state->i2c, &msg,1 );if (ret !=1 )printk (KERN_ERR "%s: i2c write error! ([%02x] %02x: %02x)\n" , - __func__, state->config->demod_address, reg, buf[2 ]); + __func__, state->config->demod_address, reg, data);return (ret !=1 ) ? -EREMOTEIO :0 ; } -static int stv0367_writereg (struct stv0367_state *state,u16 reg,u8 data) -{ -u8 tmp = data;/* see gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 */ - -return stv0367_writeregs (state, reg, &tmp,1 ); -} - -static u8 stv0367_readreg (struct stv0367_state *state,u16 reg) +static noinline_for_stack +u8 stv0367_readreg(struct stv0367_state *state, u16 reg) {u8 b0[] = {0 ,0 };u8 b1[] = {0 };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 174/238 media: go7007: fix a memleak in go7007_load_encoder
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit b9b683844b01d171a72b9c0419a2d760d946ee12 ]
In go7007_load_encoder, bounce(i.e. go->boot_fw), is allocated without a deallocation thereafter. After the following call chain:
saa7134_go7007_init
|-> go7007_boot_encoder
|-> go7007_load_encoder
|-> kfree(go)
go is freed and thus bounce is leaked.
--- drivers/media/usb/go7007/go7007-driver.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/usb/go7007/go7007-driver.c +5 -3
@@ -80,7 +80,7 @@ static int go7007_load_encoder(struct go7007 *go)const struct firmware *fw_entry;char fw_name[] ="go7007/go7007fw.bin" ;void *bounce; -int fw_len, rv =0 ; +int fw_len;u16 intr_val, intr_data;if (go->boot_fw ==NULL ) {
@@ -109,9 +109,11 @@ static int go7007_load_encoder(struct go7007 *go) go7007_read_interrupt(go, &intr_val, &intr_data) < 0 || (intr_val & ~0x1) != 0x5a5a) {v4l2_err (go,"error transferring firmware\n" ); - rv =-1 ; +kfree (go->boot_fw); + go->boot_fw =NULL ; +return -1 ; } -return rv; +return 0 ; }MODULE_FIRMWARE ("go7007/go7007fw.bin" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 175/238 media: ttpci: fix two memleaks in budget_av_attach
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit d0b07f712bf61e1a3cf23c87c663791c42e50837 ]
When saa7146_register_device and saa7146_vv_init fails, budget_av_attach should free the resources it allocates, like the error-handling of ttpci_budget_init does. Besides, there are two fixme comment refers to such deallocations.
--- drivers/media/pci/ttpci/budget-av.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/pci/ttpci/budget-av.c +5 -3
@@ -1462,7 +1462,8 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio budget_av->has_saa7113 =1 ; err =saa7146_vv_init (dev, &vv_data);if (err !=0 ) { -/* fixme: proper cleanup here */ +ttpci_budget_deinit (&budget_av->budget); +kfree (budget_av);ERR ("cannot init vv subsystem\n" );return err; }
@@ -1471,9 +1472,10 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio vv_data.vid_ops.vidioc_s_input = vidioc_s_input;if ((err =saa7146_register_device (&budget_av->vd, dev,"knc1" ,VFL_TYPE_VIDEO ))) { -/* fixme: proper cleanup here */ -ERR ("cannot register capture v4l2 device\n" );saa7146_vv_release (dev); +ttpci_budget_deinit (&budget_av->budget); +kfree (budget_av); +ERR ("cannot register capture v4l2 device\n" );return err; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 176/238 media: mediatek: vcodec: avoid -Wcast-function-type-strict warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit bfb1b99802ef16045402deb855c197591dc78886 ]
The ipi handler here tries hard to maintain const-ness of its argument, but by doing that causes a warning about function type casts:
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vpu.c:38:32: error: cast from 'mtk_vcodec_ipi_handler' (aka 'void (*)(void *, unsigned int, void *)') to 'ipi_handler_t' (aka 'void (*)(const void *, unsigned int, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
38 | ipi_handler_t handler_const = (ipi_handler_t)handler;
| ^~~~~~~~~~~~~~~~~~~~~~Remove the hack and just use a non-const argument.
--- drivers/media/platform/mtk-mdp/mtk_mdp_vpu.c | 2 +- drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c | 10 +--------- drivers/media/platform/mtk-vpu/mtk_vpu.c | 2 +- drivers/media/platform/mtk-vpu/mtk_vpu.h | 2 +- 4 files changed, 4 insertions(+), 12 deletions(-)
drivers/media/platform/mtk-mdp/mtk_mdp_vpu.c +1 -1
@@ -26,7 +26,7 @@ static void mtk_mdp_vpu_handle_init_ack(const struct mdp_ipi_comm_ack *msg) vpu->inst_addr = msg->vpu_inst_addr; } -static void mtk_mdp_vpu_ipi_handler (const void *data,unsigned int len, +static void mtk_mdp_vpu_ipi_handler (void *data,unsigned int len,void *priv) {const struct mdp_ipi_comm_ack *msg = data;
drivers/media/platform/mtk-vcodec/mtk_vcodec_fw_vpu.c +1 -9
@@ -29,15 +29,7 @@ static int mtk_vcodec_vpu_set_ipi_register(struct mtk_vcodec_fw *fw, int id,mtk_vcodec_ipi_handler handler, const char *name, void *priv) { -/* -* The handler we receive takes a void * as its first argument. We -* cannot change this because it needs to be passed down to the rproc -* subsystem when SCP is used. VPU takes a const argument, which is -* more constrained, so the conversion below is safe. -*/ - ipi_handler_t handler_const = (ipi_handler_t)handler; - -return vpu_ipi_register (fw->pdev, id, handler_const, name, priv); + return vpu_ipi_register(fw->pdev, id, handler, name, priv); } static int mtk_vcodec_vpu_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf,
drivers/media/platform/mtk-vpu/mtk_vpu.c +1 -1
@@ -612,7 +612,7 @@ int vpu_load_firmware(struct platform_device *pdev) }EXPORT_SYMBOL_GPL (vpu_load_firmware); -static void vpu_init_ipi_handler (const void *data,unsigned int len,void *priv) +static void vpu_init_ipi_handler (void *data,unsigned int len,void *priv) {struct mtk_vpu *vpu = priv;const struct vpu_run *run = data;
drivers/media/platform/mtk-vpu/mtk_vpu.h +1 -1
@@ -15,7 +15,7 @@* VPU interfaces with other blocks by share memory and interrupt. **/ -typedef void (*ipi_handler_t ) (const void *data, +typedef void (*ipi_handler_t ) (void *data,unsigned int len,void *priv);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 177/238 drm/mediatek: Fix a null pointer crash in mtk_drm_crtc_finish_page_flip
In reply to Sasha LevinFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit c958e86e9cc1b48cac004a6e245154dfba8e163b ]
It's possible that mtk_crtc->event is NULL inmtk_drm_crtc_finish_page_flip().
pending_needs_vblank value is set by mtk_crtc->event, but in mtk_drm_crtc_atomic_flush(), it's is not guarded by the same lock in mtk_drm_finish_page_flip(), thus a race condition happens.
Consider the following case:
CPU1 CPU2
step 1:mtk_drm_crtc_atomic_begin()mtk_crtc->event is not null,
step 1:
mtk_drm_crtc_atomic_flush:
mtk_drm_crtc_update_config(
!!mtk_crtc->event)step 2:mtk_crtc_ddp_irq ->mtk_drm_finish_page_flip:
lockmtk_crtc->event set to null,pending_needs_vblank set to false
unlock
pending_needs_vblank set to true,
step 2:
mtk_crtc_ddp_irq -> mtk_drm_finish_page_flip called again, pending_needs_vblank is still true //null pointer
Instead of guarding the entire mtk_drm_crtc_atomic_flush(), it's more efficient to just check if mtk_crtc->event is null before use.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +7 -5
@@ -84,11 +84,13 @@ static void mtk_drm_crtc_finish_page_flip(struct mtk_drm_crtc *mtk_crtc)struct drm_crtc *crtc = &mtk_crtc->base;unsigned long flags; -spin_lock_irqsave (&crtc->dev->event_lock, flags); -drm_crtc_send_vblank_event (crtc, mtk_crtc->event); -drm_crtc_vblank_put (crtc); - mtk_crtc->event =NULL ; -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); +if (mtk_crtc->event) { +spin_lock_irqsave (&crtc->dev->event_lock, flags); +drm_crtc_send_vblank_event (crtc, mtk_crtc->event); +drm_crtc_vblank_put (crtc); + mtk_crtc->event =NULL ; +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); + } }static void mtk_drm_finish_page_flip (struct mtk_drm_crtc *mtk_crtc)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 178/238 powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks
In reply to Sasha LevinFrom: Kajol Jain <[email protected]>
[ Upstream commit ad86d7ee43b22aa2ed60fb982ae94b285c1be671 ]
Running event hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ in one of the system throws below error:
---Logs---
# perf list | grep hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=?/[Kernel PMU event]
# perf stat -v -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2 Using CPUID 00800200 Control descriptor is not initialized Warning: hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event is not supported by the kernel. failed to read counter hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/
Performance counter stats for 'system wide':
<not supported> hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/
2.000700771 seconds time elapsed
The above error is because of the hcall failure as required permission "Enable Performance Information Collection" is not set. Based on current code, single_gpci_request function did not check the error type incase hcall fails and by default returns EINVAL. But we can have other reasons for hcall failures like H_AUTHORITY/H_PARAMETER with detail_rc as GEN_BUF_TOO_SMALL, for which we need to act accordingly.
Fix this issue by adding new checks in the single_gpci_request and h_gpci_event_init functions.
Result after fix patch changes:
# perf stat -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2 Error: No permission to enable hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event.
--- arch/powerpc/perf/hv-gpci.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
arch/powerpc/perf/hv-gpci.c +27 -2
@@ -164,6 +164,20 @@ static unsigned long single_gpci_request(u32 req, u32 starting_index, ret =plpar_hcall_norets (H_GET_PERF_COUNTER_INFO ,virt_to_phys (arg),HGPCI_REQ_BUFFER_SIZE ); + +/* +* ret value as 'H_PARAMETER' with detail_rc as 'GEN_BUF_TOO_SMALL', +* specifies that the current buffer size cannot accommodate +* all the information and a partial buffer returned. +* Since in this function we are only accessing data for a given starting index, +* we don't need to accommodate whole data and can get required count by +* accessing first entry data. +* Hence hcall fails only incase the ret value is other than H_SUCCESS or +* H_PARAMETER with detail_rc value as GEN_BUF_TOO_SMALL(0x1B). +*/ +if (ret ==H_PARAMETER &&be32_to_cpu (arg->params.detail_rc) ==0x1B ) + ret =0 ; +if (ret) {pr_devel ("hcall failed: 0x%lx\n" , ret); goto out;
@@ -228,6 +242,7 @@ static int h_gpci_event_init(struct perf_event *event) {u64 count;u8 length; +unsigned long ret;/* Not our event */ if (event->attr.type != event->pmu->type)
@@ -258,13 +273,23 @@ static int h_gpci_event_init(struct perf_event *event) }/* check if the request works... */ -if (single_gpci_request (event_get_request (event), + ret =single_gpci_request (event_get_request (event),event_get_starting_index (event),event_get_secondary_index (event),event_get_counter_info_version (event),event_get_offset (event), length, - &count)) { + &count); + +/* +* ret value as H_AUTHORITY implies that partition is not permitted to retrieve +* performance information, and required to set +* "Enable Performance Information Collection" option. +*/ +if (ret ==H_AUTHORITY ) +return -EPERM ; + +if (ret) {pr_devel ("gpci hcall failed\n" );return -EINVAL ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 179/238 drm/msm/dpu: add division of drm_display_mode's hskew parameter
In reply to Sasha LevinFrom: Paloma Arellano <[email protected]>
[ Upstream commit 551ee0f210991d25f336bc27262353bfe99d3eed ]
Setting up the timing engine when the physical encoder has a split role neglects dividing the drm_display_mode's hskew parameter. Let's fix this since this must also be done in preparation for implementing YUV420 over DP.
Patchwork: https://patchwork.freedesktop.org/patch/579605/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +4 -2
@@ -265,12 +265,14 @@ static void dpu_encoder_phys_vid_setup_timing_engine( mode.htotal >>=1 ; mode.hsync_start >>=1 ; mode.hsync_end >>=1 ; + mode.hskew >>=1 ;DPU_DEBUG_VIDENC (phys_enc, -"split_role %d, halve horizontal %d %d %d %d\n" , +"split_role %d, halve horizontal %d %d %d %d %d\n" , phys_enc->split_role, mode.hdisplay, mode.htotal, - mode.hsync_start, mode.hsync_end); + mode.hsync_start, mode.hsync_end, + mode.hskew); }drm_mode_to_intf_timing_params (phys_enc, &mode, &timing_params);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 180/238 powerpc/embedded6xx: Fix no previous prototype for avr_uart_send() etc.
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
[ Upstream commit 20933531be0577cdd782216858c26150dbc7936f ]
Move the prototypes into mpc10x.h which is included by all the relevant C files, fixes:
arch/powerpc/platforms/embedded6xx/ls_uart.c:59:6: error: no previous prototype for 'avr_uart_configure' arch/powerpc/platforms/embedded6xx/ls_uart.c:82:6: error: no previous prototype for 'avr_uart_send'
--- arch/powerpc/platforms/embedded6xx/linkstation.c | 3 --- arch/powerpc/platforms/embedded6xx/mpc10x.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/platforms/embedded6xx/linkstation.c +0 -3
@@ -97,9 +97,6 @@ static void __init linkstation_init_IRQ(void)mpic_init (mpic); } -extern void avr_uart_configure (void ); -extern void avr_uart_send (const char ); -static void __noreturn linkstation_restart (char *cmd) {local_irq_disable ();
arch/powerpc/platforms/embedded6xx/mpc10x.h +3 -0
@@ -156,4 +156,7 @@ int mpc10x_disable_store_gathering(struct pci_controller *hose);/* For MPC107 boards that use the built-in openpic */ void mpc10x_set_openpic (void ); +void avr_uart_configure (void ); +void avr_uart_send (const char c); +#endif /* __PPC_KERNEL_MPC10X_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 181/238 leds: aw2013: Unlock mutex before destroying it
In reply to Sasha LevinFrom: George Stark <[email protected]>
[ Upstream commit 6969d0a2ba1adc9ba6a49b9805f24080896c255c ]
In the probe() callback in case of error mutex is destroyed being locked which is not allowed so unlock the mutex before destroying.
--- drivers/leds/leds-aw2013.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/leds-aw2013.c +1 -0
@@ -397,6 +397,7 @@ static int aw2013_probe(struct i2c_client *client)regulator_disable (chip->vcc_regulator); error: +mutex_unlock (&chip->mutex);mutex_destroy (&chip->mutex);return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 182/238 leds: sgm3140: Add missing timer cleanup and flash gpio control
In reply to Sasha LevinFrom: Ondrej Jirman <[email protected]>
[ Upstream commit 205c29887a333ee4b37596e6533373e38cb23947 ]
Enabling strobe and then setting brightness to 0 causes the driver to enter invalid state after strobe end timer fires. We should cancel strobe mode resources when changing brightness (aka torch mode).
--- drivers/leds/leds-sgm3140.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/leds/leds-sgm3140.c +3 -0
@@ -114,8 +114,11 @@ static int sgm3140_brightness_set(struct led_classdev *led_cdev, "failed to enable regulator: %d\n", ret);return ret; } +gpiod_set_value_cansleep (priv->flash_gpio,0 );gpiod_set_value_cansleep (priv->enable_gpio,1 ); }else { +del_timer_sync (&priv->powerdown_timer); +gpiod_set_value_cansleep (priv->flash_gpio,0 );gpiod_set_value_cansleep (priv->enable_gpio,0 ); ret =regulator_disable (priv->vin_regulator);if (ret) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 183/238 backlight: lm3630a: Initialize backlight_properties on init
In reply to Sasha LevinFrom: Luca Weiss <[email protected]>
[ Upstream commit ad9aeb0e3aa90ebdad5fabf9c21783740eb95907 ]
The backlight_properties struct should be initialized to zero before using, otherwise there will be some random values in the struct.
--- drivers/video/backlight/lm3630a_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lm3630a_bl.c +1 -0
@@ -339,6 +339,7 @@ static int lm3630a_backlight_register(struct lm3630a_chip *pchip)struct backlight_properties props;const char *label; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ;if (pdata->leda_ctrl !=LM3630A_LEDA_DISABLE ) { props.brightness = pdata->leda_init_brt;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 184/238 backlight: lm3630a: Don't set bl->props.brightness in get_brightness
In reply to Sasha LevinFrom: Luca Weiss <[email protected]>
[ Upstream commit 4bf7ddd2d2f0f8826f25f74c7eba4e2c323a1446 ]
There's no need to set bl->props.brightness, the get_brightness function is just supposed to return the current brightness and not touch the struct.
With that done we can also remove the 'goto out' and just return the value.
--- drivers/video/backlight/lm3630a_bl.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/video/backlight/lm3630a_bl.c +4 -10
@@ -229,7 +229,7 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl)if (rval <0 ) goto out_i2c_err; brightness |= rval; - goto out; +return brightness; }/* disable sleep */
@@ -240,11 +240,8 @@ static int lm3630a_bank_a_get_brightness(struct backlight_device *bl) rval =lm3630a_read (pchip,REG_BRT_A );if (rval <0 ) goto out_i2c_err; - brightness = rval; +return rval; -out: - bl->props.brightness = brightness; -return bl->props.brightness; out_i2c_err:dev_err (pchip->dev,"i2c failed to access register\n" );return 0 ;
@@ -306,7 +303,7 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl)if (rval <0 ) goto out_i2c_err; brightness |= rval; - goto out; +return brightness; }/* disable sleep */
@@ -317,11 +314,8 @@ static int lm3630a_bank_b_get_brightness(struct backlight_device *bl) rval =lm3630a_read (pchip,REG_BRT_B );if (rval <0 ) goto out_i2c_err; - brightness = rval; +return rval; -out: - bl->props.brightness = brightness; -return bl->props.brightness; out_i2c_err:dev_err (pchip->dev,"i2c failed to access register\n" );return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 185/238 backlight: da9052: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit 0285e9efaee8276305db5c52a59baf84e9731556 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/da9052_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/da9052_bl.c +1 -0
@@ -117,6 +117,7 @@ static int da9052_backlight_probe(struct platform_device *pdev) wleds->led_reg =platform_get_device_id (pdev)->driver_data; wleds->state =DA9052_WLEDS_OFF ; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ; props.max_brightness =DA9052_MAX_BRIGHTNESS ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 186/238 backlight: lm3639: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit abb5a5d951fbea3feb5c4ba179b89bb96a1d3462 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/lm3639_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lm3639_bl.c +1 -0
@@ -339,6 +339,7 @@ static int lm3639_probe(struct i2c_client *client, }/* backlight */ +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_RAW ; props.brightness = pdata->init_brt_led; props.max_brightness = pdata->max_brt_led;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 187/238 backlight: lp8788: Fully initialize backlight_properties during probe
In reply to Sasha LevinFrom: Daniel Thompson <[email protected]>
[ Upstream commit 392346827fbe8a7fd573dfb145170d7949f639a6 ]
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)!
--- drivers/video/backlight/lp8788_bl.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/backlight/lp8788_bl.c +1 -0
@@ -191,6 +191,7 @@ static int lp8788_backlight_register(struct lp8788_bl *bl)int init_brt;char *name; +memset (&props,0 ,sizeof (struct backlight_properties )); props.type =BACKLIGHT_PLATFORM ; props.max_brightness =MAX_BRIGHTNESS ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 188/238 arch/powerpc: Remove <linux/fb.h> from backlight code
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit 838f865802b9f26135ea7df4e30f89ac2f50c23e ]
Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to resolve an unnecessary dependency. Remove pmac_backlight_curve_lookup() and struct fb_info from source and header files. The function and the framebuffer struct are unused. No functional changes.
v3:
* Add Fixes tag (Christophe)
* fix typos in commit message (Jani)
--- arch/powerpc/include/asm/backlight.h | 5 ++-- arch/powerpc/platforms/powermac/backlight.c | 26 --------------------- 2 files changed, 2 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/backlight.h +2 -3
@@ -10,15 +10,14 @@#define __ASM_POWERPC_BACKLIGHT_H#ifdef __KERNEL__ -#include <linux/fb.h> #include <linux/mutex.h> +struct backlight_device ; +/* For locking instructions, see the implementation file */ extern struct backlight_device *pmac_backlight;extern struct mutex pmac_backlight_mutex; -extern int pmac_backlight_curve_lookup (struct fb_info *info,int value); -extern int pmac_has_backlight_type (const char *type);extern void pmac_backlight_key (int direction);
arch/powerpc/platforms/powermac/backlight.c +0 -26
@@ -9,7 +9,6 @@*/ #include <linux/kernel.h> -#include <linux/fb.h> #include <linux/backlight.h> #include <linux/adb.h> #include <linux/pmu.h>
@@ -73,31 +72,6 @@ int pmac_has_backlight_type(const char *type)return 0 ; } -int pmac_backlight_curve_lookup (struct fb_info *info,int value) -{ -int level = (FB_BACKLIGHT_LEVELS -1 ); - -if (info && info->bl_dev) { -int i, max =0 ; - -/* Look for biggest value */ -for (i =0 ; i <FB_BACKLIGHT_LEVELS ; i++) - max =max ((int )info->bl_curve[i], max); - -/* Look for nearest value */ -for (i =0 ; i <FB_BACKLIGHT_LEVELS ; i++) { -int diff =abs (info->bl_curve[i] - value); -if (diff < max) { - max = diff; - level = i; - } - } - - } - -return level; -} -static void pmac_backlight_key_worker (struct work_struct *work) {if (atomic_read (&kernel_backlight_disabled))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 189/238 sparc32: Fix section mismatch in leon_pci_grpci
In reply to Sasha LevinFrom: Sam Ravnborg <[email protected]>
[ Upstream commit 24338a6ae13cb743ced77da1b3a12c83f08a0c96 ]
Passing a datastructre marked _initconst to platform_driver_register() is wrong. Drop the __initconst notation.
This fixes the following warnings:
WARNING: modpost: vmlinux: section mismatch in reference: grpci1_of_driver+0x30 (section: .data) -> grpci1_of_match (section: .init.rodata)
WARNING: modpost: vmlinux: section mismatch in reference: grpci2_of_driver+0x30 (section: .data) -> grpci2_of_match (section: .init.rodata)
--- arch/sparc/kernel/leon_pci_grpci1.c | 2 +- arch/sparc/kernel/leon_pci_grpci2.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/sparc/kernel/leon_pci_grpci1.c +1 -1
@@ -696,7 +696,7 @@ static int grpci1_of_probe(struct platform_device *ofdev)return err; } -static const struct of_device_id grpci1_of_match[]__initconst = { +static const struct of_device_id grpci1_of_match[] = { { .name ="GAISLER_PCIFBRG" , },
arch/sparc/kernel/leon_pci_grpci2.c +1 -1
@@ -887,7 +887,7 @@ static int grpci2_of_probe(struct platform_device *ofdev)return err; } -static const struct of_device_id grpci2_of_match[]__initconst = { +static const struct of_device_id grpci2_of_match[] = { { .name ="GAISLER_GRPCI2" , },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 190/238 clk: Fix clk_core_get NULL dereference
In reply to Sasha LevinFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit e97fe4901e0f59a0bfd524578fe3768f8ca42428 ]
It is possible for clk_core_get to dereference a NULL in the following sequence:
clk_core_get()
of_clk_get_hw_from_clkspec()
__of_clk_get_hw_from_provider()
__clk_get_hw()__clk_get_hw() can return NULL which is dereferenced by clk_core_get() at hw->core.
Prior to commit dde4eff47c82 ("clk: Look for parents with clkdev based clk_lookups") the check IS_ERR_OR_NULL() was performed which would have caught the NULL.
Reading the description of this function it talks about returning NULL but that cannot be so at the moment.
Update the function to check for hw before dereferencing it and return NULL if hw is NULL.
--- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
@@ -425,6 +425,9 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index)if (IS_ERR (hw))return ERR_CAST (hw); +if (!hw) +return NULL ; +return hw->core; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 191/238 ALSA: hda/realtek: fix ALC285 issues on HP Envy x360 laptops
In reply to Sasha LevinFrom: Athaariq Ardhiansyah <[email protected]>
[ Upstream commit c062166995c9e57d5cd508b332898f79da319802 ]
Realtek codec on HP Envy laptop series are heavily modified by vendor. Therefore, need intervention to make it work properly. The patch fixes:
- B&O soundbar speakers (between lid and keyboard) activation
- Enable LED on mute button
- Add missing process coefficient which affects the output amplifier
- Volume control synchronization between B&O soundbar and side speakers
- Unmute headset output on several HP Envy models
- Auto-enable headset mic when plugged
This patch was tested on HP Envy x360 13-AR0107AU with Realtek ALC285
The only unsolved problem is output amplifier of all built-in speakers is too weak, which causes volume of built-in speakers cannot be loud as vendor's proprietary driver due to missing _DSD parameter in the firmware. The solution is currently on research. Expected to has another patch in the future.
Potential fix to related issues, need test before close those issues:
- https://bugzilla.kernel.org/show_bug.cgi?id=189331
- https://bugzilla.kernel.org/show_bug.cgi?id=216632
- https://bugzilla.kernel.org/show_bug.cgi?id=216311
- https://bugzilla.kernel.org/show_bug.cgi?id=213507
Message-ID: <[email protected]>
--- sound/pci/hda/patch_realtek.c | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)
sound/pci/hda/patch_realtek.c +63 -0
@@ -6612,6 +6612,60 @@ static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, } } +static void alc285_fixup_hp_envy_x360 (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +static const struct coef_fw coefs[] = { +WRITE_COEF (0x08 ,0x6a0c ),WRITE_COEF (0x0d ,0xa023 ), +WRITE_COEF (0x10 ,0x0320 ),WRITE_COEF (0x1a ,0x8c03 ), +WRITE_COEF (0x25 ,0x1800 ),WRITE_COEF (0x26 ,0x003a ), +WRITE_COEF (0x28 ,0x1dfe ),WRITE_COEF (0x29 ,0xb014 ), +WRITE_COEF (0x2b ,0x1dfe ),WRITE_COEF (0x37 ,0xfe15 ), +WRITE_COEF (0x38 ,0x7909 ),WRITE_COEF (0x45 ,0xd489 ), +WRITE_COEF (0x46 ,0x00f4 ),WRITE_COEF (0x4a ,0x21e0 ), +WRITE_COEF (0x66 ,0x03f0 ),WRITE_COEF (0x67 ,0x1000 ), +WRITE_COEF (0x6e ,0x1005 ), { } + }; + +static const struct hda_pintbl pincfgs[] = { + {0x12 ,0xb7a60130 },/* Internal microphone*/ + {0x14 ,0x90170150 },/* B&O soundbar speakers */ + {0x17 ,0x90170153 },/* Side speakers */ + {0x19 ,0x03a11040 },/* Headset microphone */ + { } + }; + +switch (action) { +case HDA_FIXUP_ACT_PRE_PROBE : +snd_hda_apply_pincfgs (codec, pincfgs); + +/* Fixes volume control problem for side speakers */ +alc295_fixup_disable_dac3 (codec, fix, action); + +/* Fixes no sound from headset speaker */ +snd_hda_codec_amp_stereo (codec,0x21 ,HDA_OUTPUT ,0 ,-1 ,0 ); + +/* Auto-enable headset mic when plugged */ +snd_hda_jack_set_gating_jack (codec,0x19 ,0x21 ); + +/* Headset mic volume enhancement */ +snd_hda_codec_set_pin_target (codec,0x19 ,PIN_VREF50 ); +break ; +case HDA_FIXUP_ACT_INIT : +alc_process_coef_fw (codec, coefs); +break ; +case HDA_FIXUP_ACT_BUILD : +rename_ctl (codec,"Bass Speaker Playback Volume" , +"B&O-Tuned Playback Volume" ); +rename_ctl (codec,"Front Playback Switch" , +"B&O Soundbar Playback Switch" ); +rename_ctl (codec,"Bass Speaker Playback Switch" , +"Side Speaker Playback Switch" ); +break ; + } +} +/* for hda_fixup_thinkpad_acpi() */ #include "thinkpad_helper.c"
@@ -6819,6 +6873,7 @@ enum {ALC280_FIXUP_HP_9480M ,ALC245_FIXUP_HP_X360_AMP ,ALC285_FIXUP_HP_SPECTRE_X360_EB1 , +ALC285_FIXUP_HP_ENVY_X360 ,ALC288_FIXUP_DELL_HEADSET_MODE ,ALC288_FIXUP_DELL1_MIC_NO_PRESENCE , ALC288_FIXUP_DELL_XPS_13,
@@ -8614,6 +8669,12 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_spectre_x360_eb1 }, + [ALC285_FIXUP_HP_ENVY_X360] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_envy_x360, + .chained = true, + .chain_id = ALC285_FIXUP_HP_GPIO_AMP_INIT, + }, [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_ideapad_s740_coef,
@@ -9001,6 +9062,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8519 ,"HP Spectre x360 15-df0xxx" ,ALC285_FIXUP_HP_SPECTRE_X360 ),SND_PCI_QUIRK (0x103c ,0x8537 ,"HP ProBook 440 G6" ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ), +SND_PCI_QUIRK (0x103c ,0x85de ,"HP Envy x360 13-ar0xxx" ,ALC285_FIXUP_HP_ENVY_X360 ),SND_PCI_QUIRK (0x103c ,0x860f ,"HP ZBook 15 G6" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x861f ,"HP Elite Dragonfly G1" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ), SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
@@ -9517,6 +9579,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"}, + {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"}, {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"}, {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 192/238 ALSA: usb-audio: Stop parsing channels bits when all channels are found.
In reply to Sasha LevinFrom: Johan Carlsson <[email protected]>
[ Upstream commit a39d51ff1f52cd0b6fe7d379ac93bd8b4237d1b7 ]
If a usb audio device sets more bits than the amount of channels it could write outside of the map array.
Message-ID: <[email protected]>
--- sound/usb/stream.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/usb/stream.c +4 -1
@@ -301,9 +301,12 @@ static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits, c =0 ;if (bits) { -for (; bits && *maps; maps++, bits >>=1 ) +for (; bits && *maps; maps++, bits >>=1 ) {if (bits &1 ) chmap->map[c++] = *maps; +if (c == chmap->channels) +break ; + } }else {/* If we're missing wChannelConfig, then guess something to make sure the channel map is not skipped entirely */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 193/238 RDMA/srpt: Do not register event handler until srpt device is fully setup
In reply to Sasha LevinFrom: William Kucharski <[email protected]>
[ Upstream commit c21a8870c98611e8f892511825c9607f1e2cd456 ]
Upon rare occasions, KASAN reports a use-after-free Write in srpt_refresh_port().
This seems to be because an event handler is registered before the srpt device is fully setup and a race condition upon error may leave a partially setup event handler in place.
Instead, only register the event handler after srpt device initialization is complete.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -2
@@ -3205,7 +3205,6 @@ static int srpt_add_one(struct ib_device *device)INIT_IB_EVENT_HANDLER (&sdev->event_handler, sdev->device, srpt_event_handler); -ib_register_event_handler (&sdev->event_handler);for (i =1 ; i <= sdev->device->phys_port_cnt; i++) { sport = &sdev->port[i -1 ];
@@ -3228,6 +3227,7 @@ static int srpt_add_one(struct ib_device *device) } } +ib_register_event_handler (&sdev->event_handler);spin_lock (&srpt_dev_lock);list_add_tail (&sdev->list, &srpt_dev_list);spin_unlock (&srpt_dev_lock);
@@ -3238,7 +3238,6 @@ static int srpt_add_one(struct ib_device *device) err_port:srpt_unregister_mad_agent (sdev, i); -ib_unregister_event_handler (&sdev->event_handler); err_cm:if (sdev->cm_id)ib_destroy_cm_id (sdev->cm_id);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 194/238 f2fs: compress: fix to check unreleased compressed cluster
In reply to Sasha LevinFrom: Sheng Yong <[email protected]>
[ Upstream commit eb8fbaa53374e0a2d4381190abfe708481517bbb ]
Compressed cluster may not be released due to we can fail in release_compress_blocks(), fix to handle reserved compressed cluster correctly in reserve_compress_blocks().
--- fs/f2fs/file.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
fs/f2fs/file.c +12 -1
@@ -3663,7 +3663,13 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) goto next; } -if (__is_valid_data_blkaddr (blkaddr)) { +/* +* compressed cluster was not released due to it +* fails in release_compress_blocks(), so NEW_ADDR +* is a possible case. +*/ +if (blkaddr ==NEW_ADDR || +__is_valid_data_blkaddr (blkaddr)) { compr_blocks++;continue ; }
@@ -3673,6 +3679,11 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count) } reserved = cluster_size - compr_blocks; + +/* for the case all blocks in cluster were reserved */ +if (reserved ==1 ) + goto next; + ret =inc_valid_block_count (sbi, dn->inode, &reserved);if (ret)return ret;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 195/238 scsi: csiostor: Avoid function pointer casts
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 9f3dbcb5632d6876226031d552ef6163bb3ad215 ]
csiostor uses function pointer casts to keep the csio_ln_ev state machine hidden, but this causes warnings about control flow integrity (KCFI) violations in clang-16 and higher:
drivers/scsi/csiostor/csio_lnode.c:1098:33: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1098 | return (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1369:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1369 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_uninit)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1373:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1373 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_ready)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/csiostor/csio_lnode.c:1377:29: error: cast from 'void (*)(struct csio_lnode *, enum csio_ln_ev)' to 'csio_sm_state_t' (aka 'void (*)(void *, unsigned int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
1377 | if (csio_get_state(ln) == ((csio_sm_state_t)csio_lns_offline)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Move the enum into a shared header so the correct types can be used without the need for casts.
--- drivers/scsi/csiostor/csio_defs.h | 18 ++++++++++++++++-- drivers/scsi/csiostor/csio_lnode.c | 8 ++++---- drivers/scsi/csiostor/csio_lnode.h | 13 ------------- 3 files changed, 20 insertions(+), 19 deletions(-)
drivers/scsi/csiostor/csio_defs.h +16 -2
@@ -73,7 +73,21 @@ csio_list_deleted(struct list_head *list)#define csio_list_prev (elem) (((struct list_head *)(elem))->prev)/* State machine */ -typedef void (*csio_sm_state_t )(void *,uint32_t ); +struct csio_lnode ; + +/* State machine evets */ +enum csio_ln_ev { +CSIO_LNE_NONE = (uint32_t )0 , +CSIO_LNE_LINKUP , +CSIO_LNE_FAB_INIT_DONE , +CSIO_LNE_LINK_DOWN , +CSIO_LNE_DOWN_LINK , +CSIO_LNE_LOGO , +CSIO_LNE_CLOSE , +CSIO_LNE_MAX_EVENT , +}; + +typedef void (*csio_sm_state_t )(struct csio_lnode *ln,enum csio_ln_ev evt);struct csio_sm {struct list_head sm_list;
@@ -83,7 +97,7 @@ struct csio_sm {static inline void csio_set_state (void *smp,void *state) { - ((struct csio_sm *)smp)->sm_state = (csio_sm_state_t )state; + ((struct csio_sm *)smp)->sm_state = state; } static inline void
drivers/scsi/csiostor/csio_lnode.c +4 -4
@@ -1095,7 +1095,7 @@ csio_handle_link_down(struct csio_hw *hw, uint8_t portid, uint32_t fcfi,int csio_is_lnode_ready (struct csio_lnode *ln) { -return (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_ready)); +return (csio_get_state (ln) == csio_lns_ready); }/*****************************************************************************/
@@ -1366,15 +1366,15 @@ csio_free_fcfinfo(struct kref *kref)void csio_lnode_state_to_str (struct csio_lnode *ln,int8_t *str) { -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_uninit)) { +if (csio_get_state (ln) == csio_lns_uninit) {strcpy (str,"UNINIT" );return ; } -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_ready)) { +if (csio_get_state (ln) == csio_lns_ready) {strcpy (str,"READY" );return ; } -if (csio_get_state (ln) == ((csio_sm_state_t )csio_lns_offline)) { +if (csio_get_state (ln) == csio_lns_offline) {strcpy (str,"OFFLINE" );return ; }
drivers/scsi/csiostor/csio_lnode.h +0 -13
@@ -53,19 +53,6 @@extern int csio_fcoe_rnodes;extern int csio_fdmi_enable; -/* State machine evets */ -enum csio_ln_ev { -CSIO_LNE_NONE = (uint32_t )0 , -CSIO_LNE_LINKUP , -CSIO_LNE_FAB_INIT_DONE , -CSIO_LNE_LINK_DOWN , -CSIO_LNE_DOWN_LINK , -CSIO_LNE_LOGO , -CSIO_LNE_CLOSE , -CSIO_LNE_MAX_EVENT , -}; - -struct csio_fcf_info {struct list_head list;uint8_t priority;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 196/238 RDMA/device: Fix a race between mad_client and cm_client init
In reply to Sasha LevinFrom: Shifeng Li <[email protected]>
[ Upstream commit 7a8bccd8b29c321ac181369b42b04fecf05f98e2 ]
The mad_client will be initialized in enable_device_and_get(), while the devices_rwsem will be downgraded to a read semaphore. There is a window that leads to the failed initialization for cm_client, since it can not get matched mad port from ib_mad_port_list, and the matched mad port will be added to the list after that.
mad_client | cm_client ------------------|-------------------------------------------------------- ib_register_device|
enable_device_and_getdown_write(&devices_rwsem)xa_set_mark(&devices, DEVICE_REGISTERED)downgrade_write(&devices_rwsem)
|
|ib_cm_init
|ib_register_client(&cm_client)
|down_read(&devices_rwsem)
|xa_for_each_marked (&devices, DEVICE_REGISTERED)
|add_client_context
|cm_add_one
|ib_register_mad_agent
|ib_get_mad_port
|__ib_get_mad_port
|list_for_each_entry(entry, &ib_mad_port_list, port_list)
|return NULL
|up_read(&devices_rwsem)
|
add_client_context|
ib_mad_init_device|
ib_mad_port_open |
list_add_tail(&port_priv->port_list, &ib_mad_port_list)
up_read(&devices_rwsem)
|Fix it by using down_write(&devices_rwsem) in ib_register_client().
--- drivers/infiniband/core/device.c | 37 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-)
drivers/infiniband/core/device.c +22 -15
@@ -1686,7 +1686,7 @@ static int assign_client_id(struct ib_client *client) {int ret; -down_write (&clients_rwsem); +lockdep_assert_held (&clients_rwsem);/* * The add/remove callbacks must be called in FIFO/LIFO order. To * achieve this we assign client_ids so they are sorted in
@@ -1695,14 +1695,11 @@ static int assign_client_id(struct ib_client *client) client->client_id = highest_client_id; ret =xa_insert (&clients, client->client_id, client,GFP_KERNEL );if (ret) - goto out; +return ret; highest_client_id++;xa_set_mark (&clients, client->client_id,CLIENT_REGISTERED ); - -out: -up_write (&clients_rwsem); -return ret; +return 0 ; }static void remove_client_id (struct ib_client *client)
@@ -1732,25 +1729,35 @@ int ib_register_client(struct ib_client *client) {struct ib_device *device;unsigned long index; +bool need_unreg = false;int ret;refcount_set (&client->uses,1 );init_completion (&client->uses_zero); + +/* +* The devices_rwsem is held in write mode to ensure that a racing +* ib_register_device() sees a consisent view of clients and devices. +*/ +down_write (&devices_rwsem); +down_write (&clients_rwsem); ret =assign_client_id (client);if (ret) -return ret; + goto out; -down_read (&devices_rwsem); + need_unreg = true; xa_for_each_marked (&devices, index, device, DEVICE_REGISTERED) { ret =add_client_context (device, client); -if (ret) { -up_read (&devices_rwsem); -ib_unregister_client (client); -return ret; - } +if (ret) + goto out; } -up_read (&devices_rwsem); -return 0 ; + ret =0 ; +out: +up_write (&clients_rwsem); +up_write (&devices_rwsem); +if (need_unreg && ret) +ib_unregister_client (client); +return ret; }EXPORT_SYMBOL (ib_register_client);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 197/238 scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit b69600231f751304db914c63b937f7098ed2895c ]
Some callback functions used here take a boolean argument, others take a status argument. This breaks KCFI type checking, so clang now warns about the function pointer cast:
drivers/scsi/bfa/bfad_bsg.c:2138:29: error: cast from 'void (*)(void *, enum bfa_status)' to 'bfa_cb_cbfn_t' (aka 'void (*)(void *, enum bfa_boolean)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
Assuming the code is actually correct here and the callers always match the argument types of the callee, rework this to replace the explicit cast with a union of the two pointer types. This does not change the behavior of the code, so if something is actually broken here, a larger rework may be necessary.
--- drivers/scsi/bfa/bfa.h | 9 ++++++++- drivers/scsi/bfa/bfa_core.c | 4 +--- drivers/scsi/bfa/bfa_ioc.h | 8 ++++++-- drivers/scsi/bfa/bfad_bsg.c | 11 ++++------- 4 files changed, 19 insertions(+), 13 deletions(-)
drivers/scsi/bfa/bfa.h +8 -1
@@ -20,7 +20,6 @@struct bfa_s ;typedef void (*bfa_isr_func_t ) (struct bfa_s *bfa,struct bfi_msg_s *m); -typedef void (*bfa_cb_cbfn_status_t ) (void *cbarg,bfa_status_t status);/* * Interrupt message handlers
@@ -437,4 +436,12 @@ struct bfa_cb_pending_q_s { (__qe)->data = (__data); \ } while (0) +#define bfa_pending_q_init_status (__qe, __cbfn, __cbarg, __data) do { \ + bfa_q_qe_init(&((__qe)->hcb_qe.qe)); \ + (__qe)->hcb_qe.cbfn_status = (__cbfn); \ + (__qe)->hcb_qe.cbarg = (__cbarg); \ + (__qe)->hcb_qe.pre_rmv = BFA_TRUE; \ + (__qe)->data = (__data); \ +} while (0) +#endif /* __BFA_H__ */
drivers/scsi/bfa/bfa_core.c +1 -3
@@ -1907,15 +1907,13 @@ bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q)struct list_head *qe;struct list_head *qen;struct bfa_cb_qe_s *hcb_qe; -bfa_cb_cbfn_status_t cbfn;list_for_each_safe (qe, qen, comp_q) { hcb_qe = (struct bfa_cb_qe_s *) qe;if (hcb_qe->pre_rmv) {/* qe is invalid after return, dequeue before cbfn() */ list_del (qe); - cbfn = (bfa_cb_cbfn_status_t)(hcb_qe->cbfn); -cbfn (hcb_qe->cbarg, hcb_qe->fw_status); + hcb_qe->cbfn_status (hcb_qe->cbarg, hcb_qe->fw_status); }else hcb_qe->cbfn (hcb_qe->cbarg,BFA_TRUE ); }
drivers/scsi/bfa/bfa_ioc.h +6 -2
@@ -361,14 +361,18 @@ struct bfa_reqq_wait_s {void *cbarg; }; -typedef void (*bfa_cb_cbfn_t ) (void *cbarg,bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_t ) (void *cbarg,bfa_boolean_t complete); +typedef void (*bfa_cb_cbfn_status_t ) (void *cbarg,bfa_status_t status);/* * Generic BFA callback element. */ struct bfa_cb_qe_s {struct list_head qe; -bfa_cb_cbfn_t cbfn; +union { +bfa_cb_cbfn_status_t cbfn_status; +bfa_cb_cbfn_t cbfn; + };bfa_boolean_t once;bfa_boolean_t pre_rmv;/* set for stack based qe(s) */ bfa_status_t fw_status;/* to access fw status in comp proc */
drivers/scsi/bfa/bfad_bsg.c +4 -7
@@ -2135,8 +2135,7 @@ bfad_iocmd_fcport_get_stats(struct bfad_s *bfad, void *cmd)struct bfa_cb_pending_q_s cb_qe;init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp, &iocmd->stats); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats);spin_lock_irqsave (&bfad->bfad_lock, flags); iocmd->status =bfa_fcport_get_stats (&bfad->bfa, &cb_qe);spin_unlock_irqrestore (&bfad->bfad_lock, flags);
@@ -2159,7 +2158,7 @@ bfad_iocmd_fcport_reset_stats(struct bfad_s *bfad, void *cmd)struct bfa_cb_pending_q_s cb_qe;init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, &fcomp,NULL ); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp,NULL );spin_lock_irqsave (&bfad->bfad_lock, flags); iocmd->status =bfa_fcport_clear_stats (&bfad->bfa, &cb_qe);
@@ -2443,8 +2442,7 @@ bfad_iocmd_qos_get_stats(struct bfad_s *bfad, void *cmd)struct bfa_fcport_s *fcport =BFA_FCPORT_MOD (&bfad->bfa);init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp, &iocmd->stats); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp, &iocmd->stats);spin_lock_irqsave (&bfad->bfad_lock, flags);WARN_ON (!bfa_ioc_get_fcmode (&bfad->bfa.ioc));
@@ -2474,8 +2472,7 @@ bfad_iocmd_qos_reset_stats(struct bfad_s *bfad, void *cmd)struct bfa_fcport_s *fcport =BFA_FCPORT_MOD (&bfad->bfa);init_completion (&fcomp.comp); -bfa_pending_q_init (&cb_qe, (bfa_cb_cbfn_t )bfad_hcb_comp, - &fcomp,NULL ); +bfa_pending_q_init_status (&cb_qe, bfad_hcb_comp, &fcomp,NULL );spin_lock_irqsave (&bfad->bfad_lock, flags);WARN_ON (!bfa_ioc_get_fcmode (&bfad->bfa.ioc));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 198/238 net: sunrpc: Fix an off by one in rpc_sockaddr2uaddr()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d6f4de70f73a106986ee315d7d512539f2f3303a ]
The intent is to check if the strings' are truncated or not. So, >= should be used instead of >, because strlcat() and snprintf() return the length of the output, excluding the trailing NULL.
--- net/sunrpc/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/addr.c +2 -2
@@ -284,10 +284,10 @@ char *rpc_sockaddr2uaddr(const struct sockaddr *sap, gfp_t gfp_flags) }if (snprintf (portbuf,sizeof (portbuf), -".%u.%u" , port >>8 , port &0xff ) > (int )sizeof (portbuf)) +".%u.%u" , port >>8 , port &0xff ) >= (int )sizeof (portbuf))return NULL ; -if (strlcat (addrbuf, portbuf,sizeof (addrbuf)) >sizeof (addrbuf)) +if (strlcat (addrbuf, portbuf,sizeof (addrbuf)) >=sizeof (addrbuf))return NULL ;return kstrdup (addrbuf, gfp_flags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 199/238 NFSv4.2: fix nfs4_listxattr kernel BUG at mm/usercopy.c:102
In reply to Sasha LevinFrom: Jorge Mora <[email protected]>
[ Upstream commit 251a658bbfceafb4d58c76b77682c8bf7bcfad65 ]
A call to listxattr() with a buffer size = 0 returns the actual size of the buffer needed for a subsequent call. When size > 0, nfs4_listxattr() does not return an error because either generic_listxattr() or nfs4_listxattr_nfs4_label() consumes exactly all the bytes then size is 0 when calling nfs4_listxattr_nfs4_user() which then triggers the following kernel BUG:
[ 99.403778] kernel BUG at mm/usercopy.c:102! [ 99.404063] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP [ 99.408463] CPU: 0 PID: 3310 Comm: python3 Not tainted 6.6.0-61.fc40.aarch64 #1 [ 99.415827] Call trace: [ 99.415985] usercopy_abort+0x70/0xa0 [ 99.416227] __check_heap_object+0x134/0x158 [ 99.416505] check_heap_object+0x150/0x188 [ 99.416696] __check_object_size.part.0+0x78/0x168 [ 99.416886] __check_object_size+0x28/0x40 [ 99.417078] listxattr+0x8c/0x120 [ 99.417252] path_listxattr+0x78/0xe0 [ 99.417476] __arm64_sys_listxattr+0x28/0x40 [ 99.417723] invoke_syscall+0x78/0x100 [ 99.417929] el0_svc_common.constprop.0+0x48/0xf0 [ 99.418186] do_el0_svc+0x24/0x38 [ 99.418376] el0_svc+0x3c/0x110 [ 99.418554] el0t_64_sync_handler+0x120/0x130 [ 99.418788] el0t_64_sync+0x194/0x198 [ 99.418994] Code: aa0003e3 d000a3e0 91310000 97f49bdb (d4210000)
Issue is reproduced when generic_listxattr() returns 'system.nfs4_acl', thus calling lisxattr() with size = 16 will trigger the bug.
Add check on nfs4_listxattr() to return ERANGE error when it is called with size > 0 and the return value is greater than size.
--- fs/nfs/nfs4proc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
fs/nfs/nfs4proc.c +10 -6
@@ -10370,29 +10370,33 @@ const struct nfs4_minor_version_ops *nfs_v4_minor_ops[] = {static ssize_t nfs4_listxattr (struct dentry *dentry,char *list,size_t size) {ssize_t error, error2, error3; +size_t left = size; - error =generic_listxattr (dentry, list, size); + error =generic_listxattr (dentry, list, left);if (error <0 )return error;if (list) { list += error; - size -= error; + left -= error; } - error2 =nfs4_listxattr_nfs4_label (d_inode (dentry), list, size); + error2 =nfs4_listxattr_nfs4_label (d_inode (dentry), list, left);if (error2 <0 )return error2;if (list) { list += error2; - size -= error2; + left -= error2; } - error3 =nfs4_listxattr_nfs4_user (d_inode (dentry), list, size); + error3 =nfs4_listxattr_nfs4_user (d_inode (dentry), list, left);if (error3 <0 )return error3; -return error + error2 + error3; + error += error2 + error3; +if (size && error > size) +return -ERANGE ; +return error; }static void nfs4_enable_swap (struct inode *inode)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 200/238 NFSv4.2: fix listxattr maximum XDR buffer size
In reply to Sasha LevinFrom: Jorge Mora <[email protected]>
[ Upstream commit bcac8bff90a6ee1629f90669cdb9d28fb86049b0 ]
Switch order of operations to avoid creating a short XDR buffer:
e.g., buflen = 12, old xdrlen = 12, new xdrlen = 20.
Having a short XDR buffer leads to lxa_maxcount be a few bytes less than what is needed to retrieve the whole list when using a buflen as returned by a call with size = 0:
buflen = listxattr(path, NULL, 0);
buf = malloc(buflen);
buflen = listxattr(path, buf, buflen);For a file with one attribute (name = '123456'), the first call with size = 0 will return buflen = 12 ('user.123456\x00'). The second call with size = 12, sends LISTXATTRS with lxa_maxcount = 12 + 8 (cookie) + 4 (array count) = 24. The XDR buffer needs 8 (cookie) + 4 (array count) + 4 (name count)
+ 6 (name len) + 2 (padding) + 4 (eof) = 28 which is 4 bytes shorter than the lxa_maxcount provided in the call.
--- fs/nfs/nfs42.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfs/nfs42.h +5 -2
@@ -54,11 +54,14 @@ int nfs42_proc_removexattr(struct inode *inode, const char *name);* They would be 7 bytes long in the eventual buffer ("user.x\0"), and * 8 bytes long XDR-encoded. * -* Include the trailing eof word as well. +* Include the trailing eof word as well and make the result a multiple +* of 4 bytes. */ static inline u32 nfs42_listxattr_xdrsize (u32 buflen) { -return ((buflen / (XATTR_USER_PREFIX_LEN +2 )) *8 ) +4 ; +u32 size =8 * buflen / (XATTR_USER_PREFIX_LEN +2 ) +4 ; + +return (size +3 ) & ~3 ; }#endif /* CONFIG_NFS_V4_2 */ #endif /* __LINUX_FS_NFS_NFS4_2_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 201/238 watchdog: stm32_iwdg: initialize default timeout
In reply to Sasha LevinFrom: Ben Wolsieffer <[email protected]>
[ Upstream commit dbd7c0088b7f44aa0b9276ed3449df075a7b5b54 ]
The driver never sets a default timeout value, therefore it is initialized to zero. When CONFIG_WATCHDOG_HANDLE_BOOT_ENABLED is enabled, the watchdog is started during probe. The kernel is supposed to automatically ping the watchdog from this point until userspace takes over, but this does not happen if the configured timeout is zero. A zero timeout causes watchdog_need_worker() to return false, so the heartbeat worker does not run and the system therefore resets soon after the driver is probed.
This patch fixes this by setting an arbitrary non-zero default timeout. The default could be read from the hardware instead, but I didn't see any reason to add this complexity.
This has been tested on an STM32F746.
--- drivers/watchdog/stm32_iwdg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/watchdog/stm32_iwdg.c +3 -0
@@ -21,6 +21,8 @@#include <linux/platform_device.h> #include <linux/watchdog.h> +#define DEFAULT_TIMEOUT 10 +/* IWDG registers */ #define IWDG_KR 0x00/* Key register */ #define IWDG_PR 0x04/* Prescaler Register */
@@ -254,6 +256,7 @@ static int stm32_iwdg_probe(struct platform_device *pdev) wdd->parent = dev; wdd->info = &stm32_iwdg_info; wdd->ops = &stm32_iwdg_ops; + wdd->timeout =DEFAULT_TIMEOUT ; wdd->min_timeout =DIV_ROUND_UP ((RLR_MIN +1 ) *PR_MIN , wdt->rate); wdd->max_hw_heartbeat_ms = ((RLR_MAX +1 ) * wdt->data->max_prescaler *1000 ) / wdt->rate;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 202/238 NFS: Fix an off by one in root_nfs_cat()
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 698ad1a538da0b6bf969cfee630b4e3a026afb87 ]
The intent is to check if 'dest' is truncated or not. So, >= should be used instead of >, because strlcat() returns the length of 'dest' and 'src' excluding the trailing NULL.
--- fs/nfs/nfsroot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfsroot.c +2 -2
@@ -175,10 +175,10 @@ static int __init root_nfs_cat(char *dest, const char *src,size_t len =strlen (dest);if (len && dest[len -1 ] !=',' ) -if (strlcat (dest,"," , destlen) > destlen) +if (strlcat (dest,"," , destlen) >= destlen)return -1 ; -if (strlcat (dest, src, destlen) > destlen) +if (strlcat (dest, src, destlen) >= destlen)return -1 ;return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 203/238 afs: Revert "afs: Hide silly-rename files from userspace"
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 0aec3847d044273733285dcff90afda89ad461d2 ]
This reverts commit 57e9d49c54528c49b8bffe6d99d782ea051ea534.
This undoes the hiding of .__afsXXXX silly-rename files. The problem with hiding them is that rm can't then manually delete them.
This also reverts commit 5f7a07646655fb4108da527565dcdc80124b14c4 ("afs: Fix endless loop in directory parsing") as that's a bugfix for the above.
--- fs/afs/dir.c | 10 ---------- 1 file changed, 10 deletions(-)
fs/afs/dir.c +0 -10
@@ -418,16 +418,6 @@ static int afs_dir_iterate_block(struct afs_vnode *dvnode,continue ; } -/* Don't expose silly rename entries to userspace. */ -if (nlen >6 && - dire->u.name[0 ] =='.' && - ctx->actor != afs_lookup_filldir && - ctx->actor != afs_lookup_one_filldir && -memcmp (dire->u.name,".__afs" ,6 ) ==0 ) { - ctx->pos = blkoff + next *sizeof (union afs_xdr_dirent ); -continue ; - } -/* found the next entry */ if (!dir_emit(ctx, dire->u.name, nlen, ntohl(dire->u.vnode),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 204/238 remoteproc: stm32: Constify st_rproc_ops
In reply to Sasha LevinFrom: Rikard Falkeborn <[email protected]>
[ Upstream commit 0eee3d28ff6572f0e1afd41e863e44d396a308e2 ]
The only usage of st_rproc_ops is to pass its address to rproc_alloc() which accepts a const pointer. Make it const to allow the compiler to put it in read-only memory.
Stable-dep-of: 32381bbccba4 ("remoteproc: stm32: Fix incorrect type in assignment for va")
--- drivers/remoteproc/stm32_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/stm32_rproc.c +1 -1
@@ -553,7 +553,7 @@ static void stm32_rproc_kick(struct rproc *rproc, int vqid) } } -static struct rproc_ops st_rproc_ops = { +static const struct rproc_ops st_rproc_ops = { .start = stm32_rproc_start, .stop = stm32_rproc_stop, .attach = stm32_rproc_attach,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 205/238 remoteproc: Add new get_loaded_rsc_table() to rproc_ops
In reply to Sasha LevinFrom: Mathieu Poirier <[email protected]>
[ Upstream commit 1a631382be1d22ddab0582dae3498b3d28e2e44a ]
Add a new get_loaded_rsc_table() operation in order to support scenarios where the remoteproc core has booted a remote processor and detaches from it. When re-attaching to the remote processor, the core needs to know where the resource table has been placed in memory.
Stable-dep-of: 32381bbccba4 ("remoteproc: stm32: Fix incorrect type in assignment for va")
--- drivers/remoteproc/remoteproc_core.c | 32 ++++++++++++++++++++++++ drivers/remoteproc/remoteproc_internal.h | 10 ++++++++ include/linux/remoteproc.h | 6 ++++- 3 files changed, 47 insertions(+), 1 deletion(-)
drivers/remoteproc/remoteproc_core.c +32 -0
@@ -1539,6 +1539,32 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)return ret; } +static int rproc_set_rsc_table (struct rproc *rproc) +{ +struct resource_table *table_ptr; +struct device *dev = &rproc->dev; +size_t table_sz; +int ret; + + table_ptr =rproc_get_loaded_rsc_table (rproc, &table_sz); +if (!table_ptr) { +/* Not having a resource table is acceptable */ +return 0 ; + } + +if (IS_ERR (table_ptr)) { + ret =PTR_ERR (table_ptr); +dev_err (dev,"can't load resource table: %d\n" , ret); +return ret; + } + + rproc->cached_table =NULL ; + rproc->table_ptr = table_ptr; + rproc->table_sz = table_sz; + +return 0 ; +} +/* * Attach to remote processor - similar to rproc_fw_boot() but without * the steps that deal with the firmware image.
@@ -1558,6 +1584,12 @@ static int rproc_actuate(struct rproc *rproc)return ret; } + ret =rproc_set_rsc_table (rproc); +if (ret) { +dev_err (dev,"can't load resource table: %d\n" , ret); + goto disable_iommu; + } +/* reset max_notifyid */ rproc->max_notifyid =-1 ;
drivers/remoteproc/remoteproc_internal.h +10 -0
@@ -177,6 +177,16 @@ struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc,return NULL ; } +static inline +struct resource_table *rproc_get_loaded_rsc_table (struct rproc *rproc, +size_t *size) +{ +if (rproc->ops->get_loaded_rsc_table) +return rproc->ops->get_loaded_rsc_table (rproc, size); + +return NULL ; +} +static inline bool rproc_u64_fit_in_size_t (u64 val) {
include/linux/remoteproc.h +5 -1
@@ -368,7 +368,9 @@ enum rsc_handling_status {* RSC_HANDLED if resource was handled, RSC_IGNORED if not handled and a * negative value on error * @load_rsc_table: load resource table from firmware image -* @find_loaded_rsc_table: find the loaded resouce table +* @find_loaded_rsc_table: find the loaded resource table from firmware image +* @get_loaded_rsc_table: get resource table installed in memory +* by external entity * @load: load firmware to memory, where the remote processor * expects to find it * @sanity_check: sanity check the fw image
@@ -389,6 +391,8 @@ struct rproc_ops { int offset, int avail);struct resource_table *(*find_loaded_rsc_table)(struct rproc *rproc,const struct firmware *fw); +struct resource_table *(*get_loaded_rsc_table)( +struct rproc *rproc,size_t *size);int (*load)(struct rproc *rproc,const struct firmware *fw);int (*sanity_check)(struct rproc *rproc,const struct firmware *fw);u64 (*get_boot_addr)(struct rproc *rproc,const struct firmware *fw);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 206/238 remoteproc: stm32: Move resource table setup to rproc_ops
In reply to Sasha LevinFrom: Mathieu Poirier <[email protected]>
[ Upstream commit 8a471396d21ca499d89d4071b2b670258f009ffa ]
Move the setting of the resource table installed by an external entity to rproc_ops::get_loaded_rsc_table(). This is to support scenarios where a remote processor has been attached to but is detached at a later stage. To re-attach the remote processor, the address of the resource table needs to be available at a later time than the platform driver's probe() function.
Stable-dep-of: 32381bbccba4 ("remoteproc: stm32: Fix incorrect type in assignment for va")
--- drivers/remoteproc/stm32_rproc.c | 141 +++++++++++++++---------------- 1 file changed, 68 insertions(+), 73 deletions(-)
drivers/remoteproc/stm32_rproc.c +68 -73
@@ -553,6 +553,73 @@ static void stm32_rproc_kick(struct rproc *rproc, int vqid) } } +static int stm32_rproc_da_to_pa (struct rproc *rproc, +u64 da,phys_addr_t *pa) +{ +struct stm32_rproc *ddata = rproc->priv; +struct device *dev = rproc->dev.parent; +struct stm32_rproc_mem *p_mem; +unsigned int i; + +for (i =0 ; i < ddata->nb_rmems; i++) { + p_mem = &ddata->rmems[i]; + +if (da < p_mem->dev_addr || + da >= p_mem->dev_addr + p_mem->size) +continue ; + + *pa = da - p_mem->dev_addr + p_mem->bus_addr; +dev_dbg (dev,"da %llx to pa %#x\n" , da, *pa); + +return 0 ; + } + +dev_err (dev,"can't translate da %llx\n" , da); + +return -EINVAL ; +} + +static struct resource_table * +stm32_rproc_get_loaded_rsc_table (struct rproc *rproc,size_t *table_sz) +{ +struct stm32_rproc *ddata = rproc->priv; +struct device *dev = rproc->dev.parent; +phys_addr_t rsc_pa; +u32 rsc_da; +int err; + +/* The resource table has already been mapped, nothing to do */ +if (ddata->rsc_va) + goto done; + + err =regmap_read (ddata->rsctbl.map, ddata->rsctbl.reg, &rsc_da); +if (err) { +dev_err (dev,"failed to read rsc tbl addr\n" ); +return ERR_PTR (-EINVAL ); + } + +if (!rsc_da) +/* no rsc table */ +return ERR_PTR (-ENOENT ); + + err =stm32_rproc_da_to_pa (rproc, rsc_da, &rsc_pa); +if (err) +return ERR_PTR (err); + + ddata->rsc_va =devm_ioremap_wc (dev, rsc_pa,RSC_TBL_SIZE ); +if (IS_ERR_OR_NULL (ddata->rsc_va)) { +dev_err (dev,"Unable to map memory region: %pa+%zx\n" , + &rsc_pa,RSC_TBL_SIZE ); + ddata->rsc_va =NULL ; +return ERR_PTR (-ENOMEM ); + } + +done: +/* Assuming the resource table fits in 1kB is fair */ + *table_sz =RSC_TBL_SIZE ; +return (struct resource_table *)ddata->rsc_va; +} +static const struct rproc_ops st_rproc_ops = { .start = stm32_rproc_start, .stop = stm32_rproc_stop,
@@ -561,6 +628,7 @@ static const struct rproc_ops st_rproc_ops = { .load = rproc_elf_load_segments, .parse_fw = stm32_rproc_parse_fw, .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, + .get_loaded_rsc_table = stm32_rproc_get_loaded_rsc_table, .sanity_check = rproc_elf_sanity_check, .get_boot_addr = rproc_elf_get_boot_addr, };
@@ -704,75 +772,6 @@ static int stm32_rproc_get_m4_status(struct stm32_rproc *ddata,return regmap_read (ddata->m4_state.map, ddata->m4_state.reg, state); } -static int stm32_rproc_da_to_pa (struct platform_device *pdev, -struct stm32_rproc *ddata, -u64 da,phys_addr_t *pa) -{ -struct device *dev = &pdev->dev; -struct stm32_rproc_mem *p_mem; -unsigned int i; - -for (i =0 ; i < ddata->nb_rmems; i++) { - p_mem = &ddata->rmems[i]; - -if (da < p_mem->dev_addr || - da >= p_mem->dev_addr + p_mem->size) -continue ; - - *pa = da - p_mem->dev_addr + p_mem->bus_addr; -dev_dbg (dev,"da %llx to pa %#x\n" , da, *pa); - -return 0 ; - } - -dev_err (dev,"can't translate da %llx\n" , da); - -return -EINVAL ; -} - -static int stm32_rproc_get_loaded_rsc_table (struct platform_device *pdev, -struct rproc *rproc, -struct stm32_rproc *ddata) -{ -struct device *dev = &pdev->dev; -phys_addr_t rsc_pa; -u32 rsc_da; -int err; - - err =regmap_read (ddata->rsctbl.map, ddata->rsctbl.reg, &rsc_da); -if (err) { -dev_err (dev,"failed to read rsc tbl addr\n" ); -return err; - } - -if (!rsc_da) -/* no rsc table */ -return 0 ; - - err =stm32_rproc_da_to_pa (pdev, ddata, rsc_da, &rsc_pa); -if (err) -return err; - - ddata->rsc_va =devm_ioremap_wc (dev, rsc_pa,RSC_TBL_SIZE ); -if (IS_ERR_OR_NULL (ddata->rsc_va)) { -dev_err (dev,"Unable to map memory region: %pa+%zx\n" , - &rsc_pa,RSC_TBL_SIZE ); - ddata->rsc_va =NULL ; -return -ENOMEM ; - } - -/* -* The resource table is already loaded in device memory, no need -* to work with a cached table. -*/ - rproc->cached_table =NULL ; -/* Assuming the resource table fits in 1kB is fair */ - rproc->table_sz =RSC_TBL_SIZE ; - rproc->table_ptr = (struct resource_table *)ddata->rsc_va; - -return 0 ; -} -static int stm32_rproc_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -812,10 +811,6 @@ static int stm32_rproc_probe(struct platform_device *pdev) ret =stm32_rproc_parse_memory_regions (rproc);if (ret) goto free_resources; - - ret =stm32_rproc_get_loaded_rsc_table (pdev, rproc, ddata); -if (ret) - goto free_resources; } rproc->has_iommu = false;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 207/238 remoteproc: stm32: use correct format strings on 64-bit
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 03bd158e1535e68bcd2b1e095b0ebcad7c84bd20 ]
With CONFIG_ARCH_STM32 making it into arch/arm64, a couple of format strings no longer work, since they rely on size_t being compatible with %x, or they print an 'int' using %z:
drivers/remoteproc/stm32_rproc.c: In function 'stm32_rproc_mem_alloc':drivers/remoteproc/stm32_rproc.c:122:22: error: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=] drivers/remoteproc/stm32_rproc.c:122:40: note: format string is defined here
122 | dev_dbg(dev, "map memory: %pa+%x\n", &mem->dma, mem->len);
| ~^
| |
| unsigned int
| %lx
drivers/remoteproc/stm32_rproc.c:125:30: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Werror=format=]
drivers/remoteproc/stm32_rproc.c:125:65: note: format string is defined here
125 | dev_err(dev, "Unable to map memory region: %pa+%x\n",
| ~^
| |
| unsigned int
| %lx
drivers/remoteproc/stm32_rproc.c: In function 'stm32_rproc_get_loaded_rsc_table':
drivers/remoteproc/stm32_rproc.c:646:30: error: format '%zx' expects argument of type 'size_t', but argument 4 has type 'int' [-Werror=format=]
drivers/remoteproc/stm32_rproc.c:646:66: note: format string is defined here
646 | dev_err(dev, "Unable to map memory region: %pa+%zx\n",
| ~~^
| |
| long unsigned int
| %xFix up all three instances to work across architectures, and enable compile testing for this driver to ensure it builds everywhere.
Stable-dep-of: 32381bbccba4 ("remoteproc: stm32: Fix incorrect type in assignment for va")
--- drivers/remoteproc/Kconfig | 2 +- drivers/remoteproc/stm32_rproc.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/remoteproc/Kconfig +1 -1
@@ -249,7 +249,7 @@ config ST_SLIM_REMOTEPROC config STM32_RPROC tristate "STM32 remoteproc support" - depends on ARCH_STM32 + depends on ARCH_STM32 || COMPILE_TEST depends on REMOTEPROC select MAILBOX help
drivers/remoteproc/stm32_rproc.c +3 -3
@@ -117,10 +117,10 @@ static int stm32_rproc_mem_alloc(struct rproc *rproc,struct device *dev = rproc->dev.parent;void *va; -dev_dbg (dev,"map memory: %pa+%x\n" , &mem->dma, mem->len); +dev_dbg (dev,"map memory: %pad+%zx\n" , &mem->dma, mem->len); va =ioremap_wc (mem->dma, mem->len);if (IS_ERR_OR_NULL (va)) { -dev_err (dev,"Unable to map memory region: %pa+%x\n" , +dev_err (dev,"Unable to map memory region: %pad+0x%zx\n" , &mem->dma, mem->len);return -ENOMEM ; }
@@ -608,7 +608,7 @@ stm32_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz) ddata->rsc_va =devm_ioremap_wc (dev, rsc_pa,RSC_TBL_SIZE );if (IS_ERR_OR_NULL (ddata->rsc_va)) { -dev_err (dev,"Unable to map memory region: %pa+%zx\n" , +dev_err (dev,"Unable to map memory region: %pa+%x\n" , &rsc_pa,RSC_TBL_SIZE ); ddata->rsc_va =NULL ;return ERR_PTR (-ENOMEM );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 208/238 remoteproc: stm32: Fix incorrect type in assignment for va
In reply to Sasha LevinFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit 32381bbccba4c21145c571701f8f7fb1d9b3a92e ]
The sparse tool complains about the attribute conversion between a _iomem void * and a void *:
stm32_rproc.c:122:12: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *va @@ got void [noderef] __iomem * @@
stm32_rproc.c:122:12: sparse: expected void *va
stm32_rproc.c:122:12: sparse: got void [noderef] __iomem *
Add '__force' to explicitly specify that the cast is intentional. This conversion is necessary to cast to virtual addresses pointer,used, by the remoteproc core.
--- drivers/remoteproc/stm32_rproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/stm32_rproc.c +2 -2
@@ -118,7 +118,7 @@ static int stm32_rproc_mem_alloc(struct rproc *rproc,void *va;dev_dbg (dev,"map memory: %pad+%zx\n" , &mem->dma, mem->len); - va =ioremap_wc (mem->dma, mem->len); + va = (__force void *)ioremap_wc (mem->dma, mem->len);if (IS_ERR_OR_NULL (va)) {dev_err (dev,"Unable to map memory region: %pad+0x%zx\n" , &mem->dma, mem->len);
@@ -135,7 +135,7 @@ static int stm32_rproc_mem_release(struct rproc *rproc, struct rproc_mem_entry *mem) {dev_dbg (rproc->dev.parent,"unmap memory: %pa\n" , &mem->dma); -iounmap (mem->va); +iounmap ((__force __iomem void *)mem->va);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 209/238 remoteproc: stm32: Fix incorrect type assignment returned by stm32_rproc_get_loaded_rsc_tablef
In reply to Sasha LevinFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit c77b35ce66af25bdd6fde60b62e35b9b316ea5c2 ]
The sparse tool complains about the remove of the _iomem attribute.
stm32_rproc.c:660:17: warning: cast removes address space '__iomem' of expression
Add '__force' to explicitly specify that the cast is intentional. This conversion is necessary to cast to addresses pointer, which are then managed by the remoteproc core as a pointer to a resource_table structure.
--- drivers/remoteproc/stm32_rproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/stm32_rproc.c +1 -1
@@ -617,7 +617,7 @@ stm32_rproc_get_loaded_rsc_table(struct rproc *rproc, size_t *table_sz) done:/* Assuming the resource table fits in 1kB is fair */ *table_sz =RSC_TBL_SIZE ; -return (struct resource_table *)ddata->rsc_va; +return (__force struct resource_table *)ddata->rsc_va; }static const struct rproc_ops st_rproc_ops = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 210/238 tty: vt: fix 20 vs 0x20 typo in EScsiignore
In reply to Sasha LevinFrom: "Jiri Slaby (SUSE)" <[email protected]>
[ Upstream commit 0e6a92f67c8a94707f7bb27ac29e2bdf3e7c167d ]
The if (c >= 20 && c <= 0x3f) test added in commit 7a99565f8732 is wrong. 20 is DC4 in ascii and it makes no sense to consider that as the bottom limit. Instead, it should be 0x20 as in the other test in the commit above. This is supposed to NOT change anything as we handle interesting 20-0x20 asciis far before this if.
So for sakeness, change to 0x20 (which is SPACE).
--- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/vt/vt.c +1 -1
@@ -2516,7 +2516,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) }return ;case EScsiignore: -if (c >=20 && c <=0x3f ) +if (c >=0x20 && c <=0x3f )return ; vc->vc_state = ESnormal;return ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 211/238 serial: max310x: fix syntax error in IRQ error message
In reply to Sasha LevinFrom: Hugo Villeneuve <[email protected]>
[ Upstream commit 8ede8c6f474255b2213cccd7997b993272a8e2f9 ]
Replace g with q.
Helpful when grepping thru source code or logs for "request" keyword.
--- drivers/tty/serial/max310x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/max310x.c +1 -1
@@ -1460,7 +1460,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devtyif (!ret)return 0 ; -dev_err (dev,"Unable to reguest IRQ %i\n" , irq); +dev_err (dev,"Unable to request IRQ %i\n" , irq); out_uart:for (i =0 ; i < devtype->nr; i++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 212/238 tty: serial: samsung: fix tx_empty() to return TIOCSER_TEMT
In reply to Sasha LevinFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 314c2b399288f0058a8c5b6683292cbde5f1531b ]
The core expects for tx_empty() either TIOCSER_TEMT when the tx is empty or 0 otherwise. s3c24xx_serial_txempty_nofifo() might return 0x4, and at least uart_get_lsr_info() tries to clear exactly TIOCSER_TEMT (BIT(1)). Fix tx_empty() to return TIOCSER_TEMT.
--- drivers/tty/serial/samsung_tty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/tty/serial/samsung_tty.c +2 -3
@@ -922,11 +922,10 @@ static unsigned int s3c24xx_serial_tx_empty(struct uart_port *port)if ((ufstat & info->tx_fifomask) !=0 || (ufstat & info->tx_fifofull))return 0 ; - -return 1 ; +return TIOCSER_TEMT ; } -return s3c24xx_serial_txempty_nofifo (port); +return s3c24xx_serial_txempty_nofifo (port) ?TIOCSER_TEMT :0 ; }/* no modem control lines */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 213/238 kconfig: fix infinite loop when expanding a macro at the end of file
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit af8bbce92044dc58e4cc039ab94ee5d470a621f5 ]
A macro placed at the end of a file with no newline causes an infinite loop.
[Test Kconfig]
$(info,hello)
\ No newline at end of file
I realized that flex-provided input() returns 0 instead of EOF when it reaches the end of a file.
--- scripts/kconfig/lexer.l | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
scripts/kconfig/lexer.l +5 -2
@@ -305,8 +305,11 @@ static char *expand_token(const char *in, size_t n) new_string(); append_string(in, n); - /* get the whole line because we do not know the end of token. */ - while ((c = input()) != EOF) { + /* + * get the whole line because we do not know the end of token. + * input() returns 0 (not EOF!) when it reachs the end of file. + */ + while ((c = input()) != 0) { if (c == '\n') { unput(c); break;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 214/238 rtc: mt6397: select IRQ_DOMAIN instead of depending on it
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 544c42f798e1651dcb04fb0395219bf0f1c2607e ]
IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set it directly thru "make *config", so drivers should select it instead of depending on it if they need it.
Relying on it being set for a dependency is risky.
Consistently using "select" or "depends on" can also help reduce Kconfig circular dependency issues.
Therefore, change the use of "depends on" for IRQ_DOMAIN to "select" for RTC_DRV_MT6397.
--- drivers/rtc/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/rtc/Kconfig +2 -1
@@ -1833,7 +1833,8 @@ config RTC_DRV_MT2712 config RTC_DRV_MT6397 tristate "MediaTek PMIC based RTC" - depends on MFD_MT6397 || (COMPILE_TEST && IRQ_DOMAIN) + depends on MFD_MT6397 || COMPILE_TEST + select IRQ_DOMAIN help This selects the MediaTek(R) RTC driver. RTC is part of MediaTek MT6397 PMIC. You should enable MT6397 PMIC MFD before select
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 215/238 serial: 8250_exar: Don't remove GPIO device on suspend
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 73b5a5c00be39e23b194bad10e1ea8bb73eee176 ]
It seems a copy&paste mistake that suspend callback removes the GPIO device. There is no counterpart of this action, means once suspended there is no more GPIO device available untile full unbind-bind cycle is performed. Remove suspicious GPIO device removal in suspend.
--- drivers/tty/serial/8250/8250_exar.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/tty/serial/8250/8250_exar.c +1 -4
@@ -688,6 +688,7 @@ static void exar_pci_remove(struct pci_dev *pcidev)for (i =0 ; i < priv->nr; i++)serial8250_unregister_port (priv->line[i]); +/* Ensure that every init quirk is properly torn down */ if (priv->board->exit) priv->board->exit (pcidev); }
@@ -702,10 +703,6 @@ static int __maybe_unused exar_suspend(struct device *dev)if (priv->line[i] >=0 )serial8250_suspend_port (priv->line[i]); -/* Ensure that every init quirk is properly torn down */ -if (priv->board->exit) - priv->board->exit (pcidev); -return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 216/238 staging: greybus: fix get_channel_from_mode() failure path
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 34164202a5827f60a203ca9acaf2d9f7d432aac8 ]
The get_channel_from_mode() function is supposed to return the channel which matches the mode. But it has a bug where if it doesn't find a matching channel then it returns the last channel. It should return NULL instead.
Also remove an unnecessary NULL check on "channel".
--- drivers/staging/greybus/light.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/greybus/light.c +4 -4
@@ -100,15 +100,15 @@ static struct led_classdev *get_channel_cdev(struct gb_channel *channel)static struct gb_channel *get_channel_from_mode (struct gb_light *light,u32 mode) { -struct gb_channel *channel =NULL ; +struct gb_channel *channel;int i;for (i =0 ; i < light->channels_count; i++) { channel = &light->channels[i]; -if (channel && channel->mode == mode) -break ; +if (channel->mode == mode) +return channel; } -return channel; +return NULL ; } static int __gb_lights_flash_intensity_set(struct gb_channel *channel,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 217/238 usb: gadget: net2272: Use irqflags in the call to net2272_probe_fin
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit 600556809f04eb3bbccd05218215dcd7b285a9a9 ]
Currently the variable irqflags is being set but is not being used, it appears it should be used in the call to net2272_probe_fin rather than IRQF_TRIGGER_LOW being used. Kudos to Uwe Kleine-König for suggesting the fix.
Cleans up clang scan build warning:drivers/usb/gadget/udc/net2272.c:2610:15: warning: variable 'irqflags' set but not used [-Wunused-but-set-variable]
--- drivers/usb/gadget/udc/net2272.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/net2272.c +1 -1
@@ -2636,7 +2636,7 @@ net2272_plat_probe(struct platform_device *pdev) goto err_req; } - ret =net2272_probe_fin (dev,IRQF_TRIGGER_LOW ); + ret =net2272_probe_fin (dev, irqflags);if (ret) goto err_io;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 218/238 io_uring: don't save/restore iowait state
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ Upstream commit 6f0974eccbf78baead1735722c4f1ee3eb9422cd ]
This kind of state is per-syscall, and since we're doing the waiting off entering the io_uring_enter(2) syscall, there's no way that iowait can already be set for this case. Simplify it by setting it if we need to, and always clearing it to 0 when done.
--- io_uring/io_uring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
io_uring/io_uring.c +2 -3
@@ -7640,7 +7640,7 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,struct io_wait_queue *iowq, ktime_t *timeout) { - int io_wait, ret; + int ret;/* make sure we run task_work before checking for signals */ ret =io_run_task_work_sig ();
@@ -7655,13 +7655,12 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,* can take into account that the task is waiting for IO - turns out * to be important for low QD IO. */ - io_wait = current->in_iowait;if (current_pending_io ()) current->in_iowait =1 ; ret =1 ;if (!schedule_hrtimeout (timeout,HRTIMER_MODE_ABS )) ret = -ETIME ; - current->in_iowait = io_wait; + current->in_iowait =0 ;return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 219/238 octeontx2-af: Use matching wake_up API variant in CGX command interface
In reply to Sasha LevinFrom: Linu Cherian <[email protected]>
[ Upstream commit e642921dfeed1e15e73f78f2c3b6746f72b6deb2 ]
Use wake_up API instead of wake_up_interruptible, since wait_event_timeout API is used for waiting on command completion.
--- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/cgx.c +1 -1
@@ -714,7 +714,7 @@ static irqreturn_t cgx_fwi_event_handler(int irq, void *data)/* Release thread waiting for completion */ lmac->cmd_pend = false; -wake_up_interruptible (&lmac->wq_cmd_cmplt); +wake_up (&lmac->wq_cmd_cmplt);break ;case CGX_EVT_ASYNC :if (cgx_event_is_linkevent (event))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 220/238 s390/vtime: fix average steal time calculation
In reply to Sasha LevinFrom: Mete Durlu <[email protected]>
[ Upstream commit 367c50f78451d3bd7ad70bc5c89f9ba6dec46ca9 ]
Current average steal timer calculation produces volatile and inflated values. The only user of this value is KVM so far and it uses that to decide whether or not to yield the vCPU which is seeing steal time. KVM compares average steal timer to a threshold and if the threshold is past then it does not allow CPU polling and yields it to host, else it keeps the CPU by polling.
Since KVM's steal time threshold is very low by default (%10) it most likely is not effected much by the bloated average steal timer values because the operating region is pretty small. However there might be new users in the future who might rely on this number. Fix average steal timer calculation by changing the formula from:
avg_steal_timer = avg_steal_timer / 2 + steal_timer;
to the following:
avg_steal_timer = (avg_steal_timer + steal_timer) / 2;
This ensures that avg_steal_timer is actually a naive average of steal timer values. It now closely follows steal timer values but of course in a smoother manner.
--- arch/s390/kernel/vtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/vtime.c +2 -2
@@ -214,13 +214,13 @@ void vtime_flush(struct task_struct *tsk)virt_timer_expire (); steal = S390_lowcore.steal_timer; - avg_steal = S390_lowcore.avg_steal_timer /2 ; + avg_steal = S390_lowcore.avg_steal_timer;if ((s64 ) steal >0 ) { S390_lowcore.steal_timer =0 ;account_steal_time (cputime_to_nsecs (steal)); avg_steal += steal; } - S390_lowcore.avg_steal_timer = avg_steal; + S390_lowcore.avg_steal_timer = avg_steal /2 ; }/*
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 221/238 soc: fsl: dpio: fix kcalloc() argument order
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 72ebb41b88f9d7c10c5e159e0507074af0a22fe2 ]
A previous bugfix added a call to kcalloc(), which starting in gcc-14 causes a harmless warning about the argument order:
drivers/soc/fsl/dpio/dpio-service.c: In function 'dpaa2_io_service_enqueue_multiple_desc_fq':drivers/soc/fsl/dpio/dpio-service.c:526:29: error: 'kcalloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
526 | ed = kcalloc(sizeof(struct qbman_eq_desc), 32, GFP_KERNEL);
| ^~~~~~drivers/soc/fsl/dpio/dpio-service.c:526:29: note: earlier argument should specify number of elements, later size of each element
Since the two are only multiplied, the order does not change the behavior, so just fix it now to shut up the compiler warning.
Dmity independently came up with the same fix.
--- drivers/soc/fsl/dpio/dpio-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/dpio/dpio-service.c +1 -1
@@ -485,7 +485,7 @@ int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d,struct qbman_eq_desc *ed;int i, ret; - ed =kcalloc (sizeof (struct qbman_eq_desc ),32 ,GFP_KERNEL ); + ed =kcalloc (32 ,sizeof (struct qbman_eq_desc ),GFP_KERNEL );if (!ed)return -ENOMEM ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 222/238 hsr: Fix uninit-value access in hsr_get_node()
In reply to Sasha LevinFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit ddbec99f58571301679addbc022256970ca3eac6 ]
KMSAN reported the following uninit-value access issue [1]:
=====================================================
BUG: KMSAN: uninit-value in hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c:246 hsr_get_node+0xa2e/0xa40 net/hsr/hsr_framereg.c:246 fill_frame_info net/hsr/hsr_forward.c:577 [inline] hsr_forward_skb+0xe12/0x30e0 net/hsr/hsr_forward.c:615 hsr_dev_xmit+0x1a1/0x270 net/hsr/hsr_device.c:223 __netdev_start_xmit include/linux/netdevice.h:4940 [inline] netdev_start_xmit include/linux/netdevice.h:4954 [inline] xmit_one net/core/dev.c:3548 [inline] dev_hard_start_xmit+0x247/0xa10 net/core/dev.c:3564 __dev_queue_xmit+0x33b8/0x5130 net/core/dev.c:4349 dev_queue_xmit include/linux/netdevice.h:3134 [inline] packet_xmit+0x9c/0x6b0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3087 [inline] packet_sendmsg+0x8b1d/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b
Uninit was created at:
slab_post_alloc_hook+0x129/0xa70 mm/slab.h:768 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x5e9/0xb10 mm/slub.c:3523 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:560 __alloc_skb+0x318/0x740 net/core/skbuff.c:651 alloc_skb include/linux/skbuff.h:1286 [inline] alloc_skb_with_frags+0xc8/0xbd0 net/core/skbuff.c:6334 sock_alloc_send_pskb+0xa80/0xbf0 net/core/sock.c:2787 packet_alloc_skb net/packet/af_packet.c:2936 [inline] packet_snd net/packet/af_packet.c:3030 [inline] packet_sendmsg+0x70e8/0x9f30 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] __sys_sendto+0x735/0xa10 net/socket.c:2191 __do_sys_sendto net/socket.c:2203 [inline] __se_sys_sendto net/socket.c:2199 [inline] __x64_sys_sendto+0x125/0x1c0 net/socket.c:2199 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x6d/0x140 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b CPU: 1 PID: 5033 Comm: syz-executor334 Not tainted 6.7.0-syzkaller-00562-g9f8413c4a66f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 =====================================================
If the packet type ID field in the Ethernet header is either ETH_P_PRP or ETH_P_HSR, but it is not followed by an HSR tag, hsr_get_skb_sequence_nr() reads an invalid value as a sequence number. This causes the above issue.
This patch fixes the issue by returning NULL if the Ethernet header is not followed by an HSR tag.
--- net/hsr/hsr_framereg.c | 4 ++++ 1 file changed, 4 insertions(+)
net/hsr/hsr_framereg.c +4 -0
@@ -237,6 +237,10 @@ struct hsr_node *hsr_get_node(struct hsr_port *port, struct list_head *node_db,*/ if (ethhdr->h_proto ==htons (ETH_P_PRP ) || ethhdr->h_proto ==htons (ETH_P_HSR )) { +/* Check if skb contains hsr_ethhdr */ +if (skb->mac_len <sizeof (struct hsr_ethhdr )) +return NULL ; +/* Use the existing sequence_nr from the tag as starting point * for filtering duplicate frames. */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 223/238 packet: annotate data-races around ignore_outgoing
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 6ebfad33161afacb3e1e59ed1c2feefef70f9f97 ]
ignore_outgoing is read locklessly from dev_queue_xmit_nit() and packet_getsockopt()
Add appropriate READ_ONCE()/WRITE_ONCE() annotations.
syzbot reported:
BUG: KCSAN: data-race in dev_queue_xmit_nit / packet_setsockopt
write to 0xffff888107804542 of 1 bytes by task 22618 on cpu 0:
packet_setsockopt+0xd83/0xfd0 net/packet/af_packet.c:4003 do_sock_setsockopt net/socket.c:2311 [inline] __sys_setsockopt+0x1d8/0x250 net/socket.c:2334 __do_sys_setsockopt net/socket.c:2343 [inline] __se_sys_setsockopt net/socket.c:2340 [inline] __x64_sys_setsockopt+0x66/0x80 net/socket.c:2340 do_syscall_64+0xd3/0x1d0 entry_SYSCALL_64_after_hwframe+0x6d/0x75
read to 0xffff888107804542 of 1 bytes by task 27 on cpu 1:
dev_queue_xmit_nit+0x82/0x620 net/core/dev.c:2248 xmit_one net/core/dev.c:3527 [inline] dev_hard_start_xmit+0xcc/0x3f0 net/core/dev.c:3547 __dev_queue_xmit+0xf24/0x1dd0 net/core/dev.c:4335 dev_queue_xmit include/linux/netdevice.h:3091 [inline] batadv_send_skb_packet+0x264/0x300 net/batman-adv/send.c:108 batadv_send_broadcast_skb+0x24/0x30 net/batman-adv/send.c:127 batadv_iv_ogm_send_to_if net/batman-adv/bat_iv_ogm.c:392 [inline] batadv_iv_ogm_emit net/batman-adv/bat_iv_ogm.c:420 [inline] batadv_iv_send_outstanding_bat_ogm_packet+0x3f0/0x4b0 net/batman-adv/bat_iv_ogm.c:1700 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0x465/0x990 kernel/workqueue.c:3335 worker_thread+0x526/0x730 kernel/workqueue.c:3416 kthread+0x1d1/0x210 kernel/kthread.c:388 ret_from_fork+0x4b/0x60 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
value changed: 0x00 -> 0x01
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 27 Comm: kworker/u8:1 Tainted: G W 6.8.0-syzkaller-08073-g480e035fc4c7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet
--- net/core/dev.c | 2 +- net/packet/af_packet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
net/core/dev.c +1 -1
@@ -2324,7 +2324,7 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)rcu_read_lock (); again:list_for_each_entry_rcu (ptype, ptype_list, list) { -if (ptype->ignore_outgoing) +if (READ_ONCE (ptype->ignore_outgoing))continue ;/* Never send packets back to the socket
net/packet/af_packet.c +2 -2
@@ -3951,7 +3951,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval,if (val <0 || val >1 )return -EINVAL ; - po->prot_hook.ignore_outgoing = !!val; +WRITE_ONCE (po->prot_hook.ignore_outgoing, !!val);return 0 ; }case PACKET_TX_HAS_OFF :
@@ -4083,7 +4083,7 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, 0);break ;case PACKET_IGNORE_OUTGOING : - val = po->prot_hook.ignore_outgoing; + val =READ_ONCE (po->prot_hook.ignore_outgoing);break ;case PACKET_ROLLOVER_STATS :if (!po->rollover)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 224/238 net: dsa: mt7530: prevent possible incorrect XTAL frequency selection
In reply to Sasha LevinFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit f490c492e946d8ffbe65ad4efc66de3c5ede30a4 ]
On MT7530, the HT_XTAL_FSEL field of the HWTRAP register stores a 2-bit value that represents the frequency of the crystal oscillator connected to the switch IC. The field is populated by the state of the ESW_P4_LED_0 and ESW_P4_LED_0 pins, which is done right after reset is deasserted.
ESW_P4_LED_0 ESW_P3_LED_0 Frequency
-----------------------------------------
0 0 Reserved 0 1 20MHz 1 0 40MHz 1 1 25MHz
On MT7531, the XTAL25 bit of the STRAP register stores this. The LAN0LED0 pin is used to populate the bit. 25MHz when the pin is high, 40MHz when it's low.
These pins are also used with LEDs, therefore, their state can be set to something other than the bootstrapping configuration. For example, a link may be established on port 3 before the DSA subdriver takes control of the switch which would set ESW_P3_LED_0 to high.
Currently on mt7530_setup() and mt7531_setup(), 1000 - 1100 usec delay is described between reset assertion and deassertion. Some switch ICs in real life conditions cannot always have these pins set back to the bootstrapping configuration before reset deassertion in this amount of delay. This causes wrong crystal frequency to be selected which puts the switch in a nonfunctional state after reset deassertion.
The tests below are conducted on an MT7530 with a 40MHz crystal oscillator by Justin Swartz.
With a cable from an active peer connected to port 3 before reset, an incorrect crystal frequency (0b11 = 25MHz) is selected:
[1] [3] [5]
: : :
_____________________________ __________________
ESW_P4_LED_0 |_______|
_____________________________ESW_P3_LED_0 |__________________________
: : : :
: : [4]...:
: :
[2]................:[1] Reset is asserted.
[2] Period of 1000 - 1100 usec.
[3] Reset is deasserted.
[4] Period of 315 usec. HWTRAP register is populated with incorrect XTAL frequency.
[5] Signals reflect the bootstrapped configuration.
Increase the delay between reset_control_assert() and reset_control_deassert(), and gpiod_set_value_cansleep(priv->reset, 0) and gpiod_set_value_cansleep(priv->reset, 1) to 5000 - 5100 usec. This amount ensures a higher possibility that the switch IC will have these pins back to the bootstrapping configuration before reset deassertion.
With a cable from an active peer connected to port 3 before reset, the correct crystal frequency (0b10 = 40MHz) is selected:
[1] [2-1] [3] [5]
: : : :
_____________________________ __________________
ESW_P4_LED_0 |_______|
___________________ _______ESW_P3_LED_0 |_________| |__________________
: : : : :
: [2-2]...: [4]...:
[2]................:[1] Reset is asserted.
[2] Period of 5000 - 5100 usec.
[2-1] ESW_P3_LED_0 goes low.
[2-2] Remaining period of 5000 - 5100 usec.
[3] Reset is deasserted.
[4] Period of 310 usec. HWTRAP register is populated with bootstrapped XTAL frequency.
[5] Signals reflect the bootstrapped configuration.
ESW_P3_LED_0 low period before reset deassertion:
5000 usec
- 5100 usec
TEST RESET HOLD
# (usec)
---------------------
1 5410
2 5440
3 4375
4 5490
5 5475
6 4335
7 4370
8 5435
9 4205
10 4335
11 3750
12 3170
13 4395
14 4375
15 3515
16 4335
17 4220
18 4175
19 4175
20 4350 Min 3170
Max 5490
Median 4342.500
Avg 4466.500
Revert commit 2920dd92b980 ("net: dsa: mt7530: disable LEDs before reset"). Changing the state of pins via reset assertion is simpler and more efficient than doing so by setting the LED controller off.
--- drivers/net/dsa/mt7530.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/dsa/mt7530.c +4 -4
@@ -1581,11 +1581,11 @@ mt7530_setup(struct dsa_switch *ds)*/ if (priv->mcm) {reset_control_assert (priv->rstc); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );reset_control_deassert (priv->rstc); }else {gpiod_set_value_cansleep (priv->reset,0 ); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );gpiod_set_value_cansleep (priv->reset,1 ); }
@@ -1704,11 +1704,11 @@ mt7531_setup(struct dsa_switch *ds)*/ if (priv->mcm) {reset_control_assert (priv->rstc); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );reset_control_deassert (priv->rstc); }else {gpiod_set_value_cansleep (priv->reset,0 ); -usleep_range (1000 ,1100 ); +usleep_range (5000 ,5100 );gpiod_set_value_cansleep (priv->reset,1 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 225/238 wireguard: receive: annotate data-race around receiving_counter.counter
In reply to Sasha LevinFrom: Nikita Zhandarovich <[email protected]>
[ Upstream commit bba045dc4d996d03dce6fe45726e78a1a1f6d4c3 ]
Syzkaller with KCSAN identified a data-race issue when accessing keypair->receiving_counter.counter. Use READ_ONCE() and WRITE_ONCE() annotations to mark the data race as intentional.
BUG: KCSAN: data-race in wg_packet_decrypt_worker / wg_packet_rx_poll
write to 0xffff888107765888 of 8 bytes by interrupt on cpu 0:
counter_validate drivers/net/wireguard/receive.c:321 [inline]
wg_packet_rx_poll+0x3ac/0xf00 drivers/net/wireguard/receive.c:461
__napi_poll+0x60/0x3b0 net/core/dev.c:6536
napi_poll net/core/dev.c:6605 [inline]
net_rx_action+0x32b/0x750 net/core/dev.c:6738
__do_softirq+0xc4/0x279 kernel/softirq.c:553
do_softirq+0x5e/0x90 kernel/softirq.c:454
__local_bh_enable_ip+0x64/0x70 kernel/softirq.c:381
__raw_spin_unlock_bh include/linux/spinlock_api_smp.h:167 [inline]
_raw_spin_unlock_bh+0x36/0x40 kernel/locking/spinlock.c:210
spin_unlock_bh include/linux/spinlock.h:396 [inline]
ptr_ring_consume_bh include/linux/ptr_ring.h:367 [inline]
wg_packet_decrypt_worker+0x6c5/0x700 drivers/net/wireguard/receive.c:499
process_one_work kernel/workqueue.c:2633 [inline]
...
read to 0xffff888107765888 of 8 bytes by task 3196 on cpu 1:
decrypt_packet drivers/net/wireguard/receive.c:252 [inline]
wg_packet_decrypt_worker+0x220/0x700 drivers/net/wireguard/receive.c:501
process_one_work kernel/workqueue.c:2633 [inline]
process_scheduled_works+0x5b8/0xa30 kernel/workqueue.c:2706
worker_thread+0x525/0x730 kernel/workqueue.c:2787
...--- drivers/net/wireguard/receive.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireguard/receive.c +3 -3
@@ -258,7 +258,7 @@ static bool decrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair)if (unlikely (!READ_ONCE (keypair->receiving.is_valid) ||wg_birthdate_has_expired (keypair->receiving.birthdate,REJECT_AFTER_TIME ) || - keypair->receiving_counter.counter >=REJECT_AFTER_MESSAGES )) { +READ_ONCE (keypair->receiving_counter.counter) >=REJECT_AFTER_MESSAGES )) {WRITE_ONCE (keypair->receiving.is_valid, false);return false; }
@@ -325,7 +325,7 @@ static bool counter_validate(struct noise_replay_counter *counter, u64 their_coufor (i =1 ; i <= top; ++i) counter->backtrack[(i + index_current) & ((COUNTER_BITS_TOTAL /BITS_PER_LONG ) -1 )] =0 ; - counter->counter = their_counter; +WRITE_ONCE (counter->counter, their_counter); } index &= (COUNTER_BITS_TOTAL /BITS_PER_LONG ) -1 ;
@@ -470,7 +470,7 @@ int wg_packet_rx_poll(struct napi_struct *napi, int budget)net_dbg_ratelimited ("%s: Packet has invalid nonce %llu (max %llu)\n" , peer->device->dev->name,PACKET_CB (skb)->nonce, - keypair->receiving_counter.counter); +READ_ONCE (keypair->receiving_counter.counter)); goto next; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 226/238 rds: introduce acquire/release ordering in acquire/release_in_xmit()
In reply to Sasha LevinFrom: Yewon Choi <[email protected]>
[ Upstream commit 1422f28826d2a0c11e5240b3e951c9e214d8656e ]
acquire/release_in_xmit() work as bit lock in rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, following smp_mb__after_atomic() does not guarantee release ordering (memory barrier actually should be placed before clear_bit()).
Instead, we use clear_bit_unlock/test_and_set_bit_lock() here.
--- net/rds/send.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/rds/send.c +2 -3
@@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset);static int acquire_in_xmit (struct rds_conn_path *cp) { -return test_and_set_bit (RDS_IN_XMIT , &cp->cp_flags) ==0 ; +return test_and_set_bit_lock (RDS_IN_XMIT , &cp->cp_flags) ==0 ; }static void release_in_xmit (struct rds_conn_path *cp) { -clear_bit (RDS_IN_XMIT , &cp->cp_flags); -smp_mb__after_atomic (); +clear_bit_unlock (RDS_IN_XMIT , &cp->cp_flags);/* * We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 227/238 hsr: Handle failures in module init
In reply to Sasha LevinFrom: Felix Maurer <[email protected]>
[ Upstream commit 3cf28cd492308e5f63ed00b29ea03ca016264376 ]
A failure during registration of the netdev notifier was not handled at all. A failure during netlink initialization did not unregister the netdev notifier.
Handle failures of netdev notifier registration and netlink initialization. Both functions should only return negative values on failure and thereby lead to the hsr module not being loaded.
--- net/hsr/hsr_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/hsr/hsr_main.c +11 -4
@@ -137,14 +137,21 @@ static struct notifier_block hsr_nb = {static int __init hsr_init (void ) { -int res; +int err;BUILD_BUG_ON (sizeof (struct hsr_tag ) !=HSR_HLEN ); -register_netdevice_notifier (&hsr_nb); - res =hsr_netlink_init (); + err =register_netdevice_notifier (&hsr_nb); +if (err) +return err; + + err =hsr_netlink_init (); +if (err) { +unregister_netdevice_notifier (&hsr_nb); +return err; + } -return res; +return 0 ; } static void __exit hsr_exit(void)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 228/238 net/bnx2x: Prevent access to a freed page in page_pool
In reply to Sasha LevinFrom: Thinh Tran <[email protected]>
[ Upstream commit d27e2da94a42655861ca4baea30c8cd65546f25d ]
Fix race condition leading to system crash during EEH error handling
During EEH error recovery, the bnx2x driver's transmit timeout logic could cause a race condition when handling reset tasks. The bnx2x_tx_timeout() schedules reset tasks via bnx2x_sp_rtnl_task(), which ultimately leads to bnx2x_nic_unload(). In bnx2x_nic_unload() SGEs are freed using bnx2x_free_rx_sge_range(). However, this could overlap with the EEH driver's attempt to reset the device using bnx2x_io_slot_reset(), which also tries to free SGEs. This race condition can result in system crashes due to accessing freed memory locations in bnx2x_free_rx_sge()
799 static inline void bnx2x_free_rx_sge(struct bnx2x *bp,
800 struct bnx2x_fastpath *fp, u16 index)
801 {
802 struct sw_rx_page *sw_buf = &fp->rx_page_ring[index];
803 struct page *page = sw_buf->page;
....
where sw_buf was set to NULL after the call to dma_unmap_page() by the preceding thread.
EEH: Beginning: 'slot_reset'
PCI 0011:01:00.0#10000: EEH: Invoking bnx2x->slot_reset()
bnx2x: [bnx2x_io_slot_reset:14228(eth1)]IO slot reset initializing...
bnx2x 0011:01:00.0: enabling device (0140 -> 0142)
bnx2x: [bnx2x_io_slot_reset:14244(eth1)]IO slot reset --> driver unload
Kernel attempted to read user page (0) - exploit attempt? (uid: 0)
BUG: Kernel NULL pointer dereference on read at 0x00000000
Faulting instruction address: 0xc0080000025065fc
Oops: Kernel access of bad area, sig: 11 [#1]
.....
Call Trace:
[c000000003c67a20] [c00800000250658c] bnx2x_io_slot_reset+0x204/0x610 [bnx2x] (unreliable)
[c000000003c67af0] [c0000000000518a8] eeh_report_reset+0xb8/0xf0
[c000000003c67b60] [c000000000052130] eeh_pe_report+0x180/0x550
[c000000003c67c70] [c00000000005318c] eeh_handle_normal_event+0x84c/0xa60
[c000000003c67d50] [c000000000053a84] eeh_event_handler+0xf4/0x170
[c000000003c67da0] [c000000000194c58] kthread+0x1c8/0x1d0
[c000000003c67e10] [c00000000000cf64] ret_from_kernel_thread+0x5c/0x64To solve this issue, we need to verify page pool allocations before freeing.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +3 -3
@@ -1002,9 +1002,6 @@ static inline void bnx2x_set_fw_mac_addr(__le16 *fw_hi, __le16 *fw_mid,static inline void bnx2x_free_rx_mem_pool (struct bnx2x *bp,struct bnx2x_alloc_pool *pool) { -if (!pool->page) -return ; -put_page (pool->page); pool->page =NULL ;
@@ -1015,6 +1012,9 @@ static inline void bnx2x_free_rx_sge_range(struct bnx2x *bp, {int i; +if (!fp->page_pool.page) +return ; +if (fp->mode ==TPA_MODE_DISABLED )return ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 229/238 octeontx2-af: Use separate handlers for interrupts
In reply to Sasha LevinFrom: Subbaraya Sundeep <[email protected]>
[ Upstream commit 50e60de381c342008c0956fd762e1c26408f372c ]
For PF to AF interrupt vector and VF to AF vector same interrupt handler is registered which is causing race condition. When two interrupts are raised to two CPUs at same time then two cores serve same event corrupting the data.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu.c +14 -3
@@ -1969,10 +1969,9 @@ static void rvu_queue_work(struct mbox_wq_info *mw, int first, } } -static irqreturn_t rvu_mbox_intr_handler (int irq,void *rvu_irq) +static irqreturn_t rvu_mbox_pf_intr_handler (int irq,void *rvu_irq) {struct rvu *rvu = (struct rvu *)rvu_irq; -int vfs = rvu->vfs;u64 intr; intr =rvu_read64 (rvu,BLKADDR_RVUM ,RVU_AF_PFAF_MBOX_INT );
@@ -1986,6 +1985,18 @@ static irqreturn_t rvu_mbox_intr_handler(int irq, void *rvu_irq)rvu_queue_work (&rvu->afpf_wq_info,0 , rvu->hw->total_pfs, intr); +return IRQ_HANDLED ; +} + +static irqreturn_t rvu_mbox_intr_handler (int irq,void *rvu_irq) +{ +struct rvu *rvu = (struct rvu *)rvu_irq; +int vfs = rvu->vfs; +u64 intr; + +/* Sync with mbox memory region */ +rmb (); +/* Handle VF interrupts */ if (vfs >64 ) { intr =rvupf_read64 (rvu,RVU_PF_VFPF_MBOX_INTX (1 ));
@@ -2300,7 +2311,7 @@ static int rvu_register_interrupts(struct rvu *rvu)/* Register mailbox interrupt handler */ sprintf (&rvu->irq_name[RVU_AF_INT_VEC_MBOX *NAME_SIZE ],"RVUAF Mbox" ); ret =request_irq (pci_irq_vector (rvu->pdev,RVU_AF_INT_VEC_MBOX ), - rvu_mbox_intr_handler,0 , + rvu_mbox_pf_intr_handler,0 , &rvu->irq_name[RVU_AF_INT_VEC_MBOX *NAME_SIZE ], rvu);if (ret) { dev_err(rvu->dev,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 230/238 netfilter: nft_set_pipapo: release elements in clone only from destroy path
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b0e256f3dd2ba6532f37c5c22e07cb07a36031ee ]
Clone already always provides a current view of the lookup table, use it to destroy the set, otherwise it is possible to destroy elements twice.
This fix requires:
212ed75dc5fb ("netfilter: nf_tables: integrate pipapo into commit protocol")
which came after:
9827a0e6e23b ("netfilter: nft_set_pipapo: release elements in clone from abort path").
--- net/netfilter/nft_set_pipapo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/netfilter/nft_set_pipapo.c +1 -4
@@ -2226,8 +2226,6 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx,if (m) {rcu_barrier (); -nft_set_pipapo_match_destroy (ctx, set, m); -for_each_possible_cpu (cpu)pipapo_free_scratch (m, cpu);free_percpu (m->scratch);
@@ -2239,8 +2237,7 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx,if (priv->clone) { m = priv->clone; -if (priv->dirty) -nft_set_pipapo_match_destroy (ctx, set, m); +nft_set_pipapo_match_destroy (ctx, set, m);for_each_possible_cpu (cpu)pipapo_free_scratch (priv->clone, cpu);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 231/238 scsi: fc: Update formal FPIN descriptor definitions
In reply to Sasha LevinFrom: Shyam Sundar <[email protected]>
[ Upstream commit 874163aab75a6cd7422e71f1fbc6db12977fcf1d ]
Add Fabric Performance Impact Notification (FPIN) descriptor definitions for the following FPINs:
- Delivery Notification Descriptor
- Peer Congestion Notification Descriptor
- Congestion Notification Descriptor
Stable-dep-of: 4a0e7f2decbf ("netfilter: nf_tables: do not compare internal table flags on updates")
--- include/uapi/scsi/fc/fc_els.h | 114 +++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-)
include/uapi/scsi/fc/fc_els.h +113 -1
@@ -916,7 +916,9 @@ enum fc_els_clid_ic { ELS_CLID_IC_LIP = 8, /* receiving LIP */ }; - +/* +* Link Integrity event types +*/ enum fc_fpin_li_event_types {FPIN_LI_UNKNOWN =0x0 ,FPIN_LI_LINK_FAILURE =0x1 ,
@@ -943,6 +945,54 @@ enum fc_fpin_li_event_types { { FPIN_LI_DEVICE_SPEC, "Device Specific" }, \ } +/* +* Delivery event types +*/ +enum fc_fpin_deli_event_types { +FPIN_DELI_UNKNOWN =0x0 , +FPIN_DELI_TIMEOUT =0x1 , +FPIN_DELI_UNABLE_TO_ROUTE =0x2 , +FPIN_DELI_DEVICE_SPEC =0xF , +}; + +/* +* Initializer useful for decoding table. +* Please keep this in sync with the above definitions. +*/ +#define FC_FPIN_DELI_EVT_TYPES_INIT { \ + { FPIN_DELI_UNKNOWN, "Unknown" }, \ + { FPIN_DELI_TIMEOUT, "Timeout" }, \ + { FPIN_DELI_UNABLE_TO_ROUTE, "Unable to Route" }, \ + { FPIN_DELI_DEVICE_SPEC, "Device Specific" }, \ +} + +/* +* Congestion event types +*/ +enum fc_fpin_congn_event_types { +FPIN_CONGN_CLEAR =0x0 , +FPIN_CONGN_LOST_CREDIT =0x1 , +FPIN_CONGN_CREDIT_STALL =0x2 , +FPIN_CONGN_OVERSUBSCRIPTION =0x3 , +FPIN_CONGN_DEVICE_SPEC =0xF , +}; + +/* +* Initializer useful for decoding table. +* Please keep this in sync with the above definitions. +*/ +#define FC_FPIN_CONGN_EVT_TYPES_INIT { \ + { FPIN_CONGN_CLEAR, "Clear" }, \ + { FPIN_CONGN_LOST_CREDIT, "Lost Credit" }, \ + { FPIN_CONGN_CREDIT_STALL, "Credit Stall" }, \ + { FPIN_CONGN_OVERSUBSCRIPTION, "Oversubscription" }, \ + { FPIN_CONGN_DEVICE_SPEC, "Device Specific" }, \ +} + +enum fc_fpin_congn_severity_types { +FPIN_CONGN_SEVERITY_WARNING =0xF1 , +FPIN_CONGN_SEVERITY_ERROR =0xF7 , +};/* * Link Integrity Notification Descriptor
@@ -974,6 +1024,68 @@ struct fc_fn_li_desc {*/ }; +/* +* Delivery Notification Descriptor +*/ +struct fc_fn_deli_desc { +__be32 desc_tag;/* Descriptor Tag (0x00020002) */ +__be32 desc_len;/* Length of Descriptor (in bytes). +* Size of descriptor excluding +* desc_tag and desc_len fields. +*/ +__be64 detecting_wwpn;/* Port Name that detected event */ +__be64 attached_wwpn;/* Port Name of device attached to +* detecting Port Name +*/ +__be32 deli_reason_code;/* see enum fc_fpin_deli_event_types */ +}; + +/* +* Peer Congestion Notification Descriptor +*/ +struct fc_fn_peer_congn_desc { +__be32 desc_tag;/* Descriptor Tag (0x00020003) */ +__be32 desc_len;/* Length of Descriptor (in bytes). +* Size of descriptor excluding +* desc_tag and desc_len fields. +*/ +__be64 detecting_wwpn;/* Port Name that detected event */ +__be64 attached_wwpn;/* Port Name of device attached to +* detecting Port Name +*/ +__be16 event_type;/* see enum fc_fpin_congn_event_types */ +__be16 event_modifier;/* Implementation specific value +* describing the event type +*/ +__be32 event_period;/* duration (ms) of the detected +* congestion event +*/ +__be32 pname_count;/* number of portname_list elements */ +__be64 pname_list[0 ];/* list of N_Port_Names accessible +* through the attached port +*/ +}; + +/* +* Congestion Notification Descriptor +*/ +struct fc_fn_congn_desc { +__be32 desc_tag;/* Descriptor Tag (0x00020004) */ +__be32 desc_len;/* Length of Descriptor (in bytes). +* Size of descriptor excluding +* desc_tag and desc_len fields. +*/ +__be16 event_type;/* see enum fc_fpin_congn_event_types */ +__be16 event_modifier;/* Implementation specific value +* describing the event type +*/ +__be32 event_period;/* duration (ms) of the detected +* congestion event +*/ +__u8 severity;/* command */ +__u8 resv[3 ];/* reserved - must be zero */ +}; +/* * ELS_FPIN - Fabric Performance Impact Notification */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 232/238 ARM: dts: sun8i-h2-plus-bananapi-m2-zero: add regulator nodes vcc-dram and vcc1v2
In reply to Sasha LevinFrom: Michael Klein <[email protected]>
[ Upstream commit 23e85be1ec81647374055f731488cc9a7c013a5c ]
Add regulator nodes vcc-dram and vcc1v2 to the devicetree. These regulators correspond to U4 and U5 in the schematics:
http://forum.banana-pi.org/t/bpi-m2-zero-schematic-diagram-public/4111
Stable-dep-of: 4a0e7f2decbf ("netfilter: nf_tables: do not compare internal table flags on updates")
--- .../dts/sun8i-h2-plus-bananapi-m2-zero.dts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts +24 -0
@@ -62,6 +62,30 @@ reg_vdd_cpux: vdd-cpux-regulator { states = <1100000 0>, <1300000 1>; }; + reg_vcc_dram: vcc-dram { + compatible = "regulator-fixed"; + regulator-name = "vcc-dram"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */ + vin-supply = <®_vcc5v0>; + }; + + reg_vcc1v2: vcc1v2 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v2"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + regulator-always-on; + regulator-boot-on; + enable-active-high; + gpio = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ + vin-supply = <®_vcc5v0>; + }; + wifi_pwrseq: wifi_pwrseq { compatible = "mmc-pwrseq-simple"; reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 233/238 netfilter: nf_tables: do not compare internal table flags on updates
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 4a0e7f2decbf9bd72461226f1f5f7dcc4b08f139 ]
Restore skipping transaction if table update does not modify flags.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -1097,7 +1097,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx)if (flags & ~NFT_TABLE_F_DORMANT )return -EINVAL ; -if (flags == ctx->table->flags) +if (flags == (ctx->table->flags &NFT_TABLE_F_MASK ))return 0 ;/* No dormant off/on/off/on games in single transaction */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 234/238 rcu: add a helper to report consolidated flavor QS
In reply to Sasha LevinFrom: Yan Zhai <[email protected]>
[ Upstream commit 1a77557d48cff187a169c2aec01c0dd78a5e7e50 ]
When under heavy load, network processing can run CPU-bound for many tens of seconds. Even in preemptible kernels (non-RT kernel), this can block RCU Tasks grace periods, which can cause trace-event removal to take more than a minute, which is unacceptably long.
This commit therefore creates a new helper function that passes through both RCU and RCU-Tasks quiescent states every 100 milliseconds. This hard-coded value suffices for current workloads.
Stable-dep-of: 00bf63122459 ("bpf: report RCU QS in cpumap kthread")
--- include/linux/rcupdate.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
include/linux/rcupdate.h +31 -0
@@ -226,6 +226,37 @@ do { \cond_resched (); \ }while (0 ) +/** +* rcu_softirq_qs_periodic - Report RCU and RCU-Tasks quiescent states +* @old_ts: jiffies at start of processing. +* +* This helper is for long-running softirq handlers, such as NAPI threads in +* networking. The caller should initialize the variable passed in as @old_ts +* at the beginning of the softirq handler. When invoked frequently, this macro +* will invoke rcu_softirq_qs() every 100 milliseconds thereafter, which will +* provide both RCU and RCU-Tasks quiescent states. Note that this macro +* modifies its old_ts argument. +* +* Because regions of code that have disabled softirq act as RCU read-side +* critical sections, this macro should be invoked with softirq (and +* preemption) enabled. +* +* The macro is not needed when CONFIG_PREEMPT_RT is defined. RT kernels would +* have more chance to invoke schedule() calls and provide necessary quiescent +* states. As a contrast, calling cond_resched() only won't achieve the same +* effect because cond_resched() does not provide RCU-Tasks quiescent states. + */ +#define rcu_softirq_qs_periodic (old_ts) \ +do { \ + if (!IS_ENABLED(CONFIG_PREEMPT_RT) && \ + time_after(jiffies, (old_ts) + HZ / 10)) { \ + preempt_disable(); \ + rcu_softirq_qs(); \ + preempt_enable(); \ + (old_ts) = jiffies; \ + } \ +} while (0) +/* * Infrastructure to implement the synchronize_() primitives in * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 235/238 bpf: report RCU QS in cpumap kthread
In reply to Sasha LevinFrom: Yan Zhai <[email protected]>
[ Upstream commit 00bf63122459e87193ee7f1bc6161c83a525569f ]
When there are heavy load, cpumap kernel threads can be busy polling packets from redirect queues and block out RCU tasks from reaching quiescent states. It is insufficient to just call cond_resched() in such context. Periodically raise a consolidated RCU QS before cond_resched fixes the problem.
--- kernel/bpf/cpumap.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/bpf/cpumap.c +3 -0
@@ -299,6 +299,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,static int cpu_map_kthread_run (void *data) {struct bpf_cpu_map_entry *rcpu = data; +unsigned long last_qs = jiffies;set_current_state (TASK_INTERRUPTIBLE );
@@ -322,10 +323,12 @@ static int cpu_map_kthread_run(void *data)if (__ptr_ring_empty (rcpu->queue)) {schedule (); sched =1 ; + last_qs = jiffies; }else {__set_current_state (TASK_RUNNING ); } }else { +rcu_softirq_qs_periodic (last_qs); sched =cond_resched (); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 236/238 spi: spi-mt65xx: Fix NULL pointer access in interrupt handler
In reply to Sasha LevinFrom: Fei Shao <[email protected]>
[ Upstream commit a20ad45008a7c82f1184dc6dee280096009ece55 ]
The TX buffer in spi_transfer can be a NULL pointer, so the interrupt handler may end up writing to the invalid memory and cause crashes.
Add a check to trans->tx_buf before using it.
--- drivers/spi/spi-mt65xx.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/spi/spi-mt65xx.c +12 -10
@@ -566,17 +566,19 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) mdata->xfer_len =min (MTK_SPI_MAX_FIFO_SIZE , len);mtk_spi_setup_packet (master); - cnt = mdata->xfer_len /4 ; -iowrite32_rep (mdata->base +SPI_TX_DATA_REG , - trans->tx_buf + mdata->num_xfered, cnt); +if (trans->tx_buf) { + cnt = mdata->xfer_len /4 ; +iowrite32_rep (mdata->base +SPI_TX_DATA_REG , + trans->tx_buf + mdata->num_xfered, cnt); - remainder = mdata->xfer_len %4 ; -if (remainder >0 ) { - reg_val =0 ; -memcpy (®_val, - trans->tx_buf + (cnt *4 ) + mdata->num_xfered, - remainder); -writel (reg_val, mdata->base +SPI_TX_DATA_REG ); + remainder = mdata->xfer_len %4 ; +if (remainder >0 ) { + reg_val =0 ; +memcpy (®_val, + trans->tx_buf + (cnt *4 ) + mdata->num_xfered, + remainder); +writel (reg_val, mdata->base +SPI_TX_DATA_REG ); + } }mtk_spi_enable_transfer (master);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 237/238 regmap: Add missing map->bus check
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit 5c422f0b970d287efa864b8390a02face404db5d ]
The map->bus can be NULL here, add the missing NULL pointer check.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1796,7 +1796,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, map->format.reg_bytes + map->format.pad_bytes + val_len); - else if (map->bus->gather_write) + else if (map->bus && map->bus->gather_write) ret = map->bus->gather_write(map->bus_context, map->work_buf, map->format.reg_bytes + map->format.pad_bytes,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 238/238 Linux 5.10.214-rc1
In reply to Sasha Levin--- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 10 -SUBLEVEL = 213 -EXTRAVERSION = +SUBLEVEL = 214 +EXTRAVERSION = -rc1 NAME = Dare mighty things # *DOCUMENTATION*
Signature · 1 line
2.43.0
Quoted 10 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.214 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue Mar 26 11:40:23 PM UTC 2024. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.213or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.Thanks,
Sasha
We're seeing regressions while building PowerPC with GCC 8 and 12 with
ppc6xx_defconfig.
Quoted 2 lines
Thomas Zimmermann (1):
arch/powerpc: Remove <linux/fb.h> from backlight code
-----8<-----
/builds/linux/drivers/macintosh/via-pmu-backlight.c:22:20: error:
'FB_BACKLIGHT_LEVELS' undeclared here (not in a function)
22 | static u8 bl_curve[FB_BACKLIGHT_LEVELS];
| ^~~~~~~~~~~~~~~~~~~ In file included from /builds/linux/include/linux/kernel.h:15,
from /builds/linux/include/asm-generic/bug.h:20, from /builds/linux/arch/powerpc/include/asm/bug.h:109, from /builds/linux/include/linux/bug.h:5,
from /builds/linux/include/linux/thread_info.h:12, from /builds/linux/arch/powerpc/include/asm/ptrace.h:264, from /builds/linux/drivers/macintosh/via-pmu-backlight.c:11:
----->8-----
Bisection points to:
commit ee550f669e91c4cb0c884f38aa915497bc201585
Author: Thomas Zimmermann <[email protected]>
Date: Wed Mar 6 13:28:20 2024 +0100
arch/powerpc: Remove <linux/fb.h> from backlight code
Reverting that commit made the build pass again.
Reproducer:
tuxmake --runtime podman --target-arch powerpc --toolchain gcc-12
--kconfig ppc6xx_defconfig
Greetings!
Daniel Díaz
[email protected]
Quoted 6 lines · Sasha Levin
This is the start of the stable review cycle for the 5.10.214 release. There are 238 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 9 lines
Responses should be made by Tue Mar 26 11:40:23 PM UTC 2024. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-5.10.y&id2=v5.10.213or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.
KernelCI report for stable-rc/linux-5.10.y for this week.
## stable-rc HEAD for linux-5.10.y:
Date: 2024-03-25
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=bbdc0ccf6f1665aabba4a0a227f9c118e86804eb
## Build failures:
No build failures seen for the stable-rc/linux-5.10.y commit head \o/
## Boot failures:
No **new** boot failures seen for the stable-rc/linux-5.10.y commit head \o/
Thanks,
Shreeya Patel